Finally
Ok this is final version of my game. I am really proud of myself, actually.(log in to comment)
Comments
$ python run_game.py
Traceback (most recent call last):
File "run_game.py", line 5, in <module>
squarescity.__main__.main()
File "/home/andy/PyWeek-12-finals/unrated/petraszd-pw-12/squarescity-1.0/squarescity/__main__.py", line 11, in main
return director.run(StartScene())
File "/home/andy/PyWeek-12-finals/unrated/petraszd-pw-12/squarescity-1.0/squarescity/scenes.py", line 69, in __init__
super(StartScene, self).__init__()
File "/home/andy/PyWeek-12-finals/unrated/petraszd-pw-12/squarescity-1.0/squarescity/scenes.py", line 57, in __init__
back = Sprite(self.get_image_filename())
File "/usr/local/lib/python2.6/dist-packages/cocos2d-0.4.0-py2.6.egg/cocos/sprite.py", line 114, in __init__
image = pyglet.resource.image(image)
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 481, in image
identity = self._cached_images[name] = self._alloc_image(name)
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 425, in _alloc_image
file = self.file(name)
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 383, in file
raise ResourceNotFoundException(name)
pyglet.resource.ResourceNotFoundException: Resource "data/start-screen.png" was not found on the path. Ensure that the filename has the correct captialisation.
AL lib: ALc.c:1879: exit(): closing 1 Device
AL lib: ALc.c:1808: alcCloseDevice(): destroying 1 Context(s)
Inconsistency detected by ld.so: dl-close.c: 731: _dl_close: Assertion `map->l_init_called' failed!
And I fixed it by modifying run_game.py:
import squarescity.__main__
import os
import pyglet
pyglet.resource.path = ['.']
pyglet.resource.reindex()
# monkey patch pyglet to fix a resource loading bug
slash_paths = filter(lambda x: x.startswith('/'), pyglet.resource._default_loader._index.keys())
for path in slash_paths:
pyglet.resource._default_loader._index[path[1:]] = pyglet.resource._default_loader._index[path]
if __name__ == "__main__":
squarescity.__main__.main()
$ python run_game.py
Traceback (most recent call last):
File "run_game.py", line 18, in <module>
squarescity.__main__.main()
File "/home/andy/PyWeek-12-finals/unrated/petraszd-pw-12/squarescity-1.0/squarescity/__main__.py", line 11, in main
return director.run(StartScene())
File "/usr/local/lib/python2.6/dist-packages/cocos2d-0.4.0-py2.6.egg/cocos/director.py", line 450, in run
event_loop.run()
File "/usr/lib/pymodules/python2.6/pyglet/app/xlib.py", line 83, in run
window.dispatch_platform_event(e)
File "/usr/lib/pymodules/python2.6/pyglet/window/xlib/__init__.py", line 1169, in dispatch_platform_event
event_handler(e)
File "/usr/lib/pymodules/python2.6/pyglet/window/xlib/__init__.py", line 1323, in _event_key
self.dispatch_event('on_key_press', symbol, modifiers)
File "/usr/lib/pymodules/python2.6/pyglet/window/__init__.py", line 1217, in dispatch_event
EventDispatcher.dispatch_event(self, *args)
File "/usr/lib/pymodules/python2.6/pyglet/event.py", line 340, in dispatch_event
if handler(*args):
File "/usr/local/lib/python2.6/dist-packages/cocos2d-0.4.0-py2.6.egg/cocos/menu.py", line 307, in on_key_press
self._activate_item()
File "/usr/local/lib/python2.6/dist-packages/cocos2d-0.4.0-py2.6.egg/cocos/menu.py", line 248, in _activate_item
self.children[ self.selected_index ][1].on_key_press( key.ENTER, 0 )
File "/usr/local/lib/python2.6/dist-packages/cocos2d-0.4.0-py2.6.egg/cocos/menu.py", line 443, in on_key_press
self.callback_func(*self.callback_args, **self.callback_kwargs)
File "/home/andy/PyWeek-12-finals/unrated/petraszd-pw-12/squarescity-1.0/squarescity/scenes.py", line 38, in start_game
WinScene))))
File "/home/andy/PyWeek-12-finals/unrated/petraszd-pw-12/squarescity-1.0/squarescity/levels.py", line 40, in __init__
self.line = Line((0.0, 0.0), (0.0, 0.0), (255, 255, 255, 255))
File "/usr/local/lib/python2.6/dist-packages/cocos2d-0.4.0-py2.6.egg/cocos/draw.py", line 417, in __init__
super(Line, self).__init__()
File "/usr/local/lib/python2.6/dist-packages/cocos2d-0.4.0-py2.6.egg/cocos/draw.py", line 193, in __init__
self._texture = image = pyglet.resource.image('draw_texture.png').get_texture()
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 481, in image
identity = self._cached_images[name] = self._alloc_image(name)
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 425, in _alloc_image
file = self.file(name)
File "/usr/lib/pymodules/python2.6/pyglet/resource.py", line 383, in file
raise ResourceNotFoundException(name)
pyglet.resource.ResourceNotFoundException: Resource "draw_texture.png" was not found on the path. Ensure that the filename has the correct captialisation.
AL lib: ALc.c:1879: exit(): closing 1 Device
AL lib: ALc.c:1808: alcCloseDevice(): destroying 1 Context(s)
Inconsistency detected by ld.so: dl-close.c: 731: _dl_close: Assertion `map->l_init_called' failed!
draw_texture.png isn't in data/!
On windows I have included that file in archive, because I got same error. On Linux I found no problem with that file. So, my guess is: a) Something is wrong with Your cocos2d installation b) Something is wrong with my installation (It works for me, but not for others);
That file is (or should be) at SOMETHING/lib/python2.7/site-packages/cocos/resources directory
replace in your fix
pyglet.resource.path = ['.']
with
pyglet.resource.path.append('.')
[untested, I don't have *nix OS ]
Alternatively, copy from cocos/resources the file draw_texture.png to the game/data dir.
--
in windows xp, pyglet 1.1.4 release, cocos 0.4.0 release the game works correctly
I very liked the game, hope there will be a postcompo release with just a bit of tweaking in the controls and more levels
It could very well be a pyglet problem: if I remember correctly the path handling in resources has been changed from pyglet 1.1.2 to 1.1.3 to 1.1.4 to 1.dev , with issues reported for each version (except the dev version...yet)
gizmo_thunder on 2011/04/09 21:57:
thats' a good game man... well done..