Hi guys
couple of questions here... not really cocos-related, more like a python
syntax thing, but when solved it will help my cocos script, so here goes...
When I have a variable, in my example I have something like this (main.py):
if __name__ == "__main__":
[... director init and all other stuff ...]
keyboard = key.KeyStateHandler()
director.window.push_handlers(keyboard)
[... ...]
In an other file (let's say util.py) I have a class:
class Util(actions.Action.........):
def act(self, dt):
[... XXX ...]
So basically the question is... how do I access the variable keyboard,
which is obviously in the global scope of main.py from util.py, or any
other file, what's the proper way to do this... when I try to create a
constructor for the class Util and affect a static property to it it gives
me errors, not syntax errors, stuff like this:
...
File "/home/trevor/cocos/cocos2d-0.5.0/game/util.py", line 51, in step
dx, dy = self.target.velocity = self.collide_map(map, last, new, dy, dx)
File
"/usr/lib64/python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/tiles.py",
line 780, in collide_map
for cell in map.get_in_region(*(new.bottomleft + new.topright)):
AttributeError: 'builtin_function_or_method' object has no attribute
'get_in_region'
so I guess it works but not for this type of variable... can someone tell
me what's the problem?
--
Thanks,
Donahue Trevor
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cocos-discuss?hl=en.