RoboCute bug?
Anyone else experience this? It happens on startup when I try to run RoboCute.% python2.5 run_game.py Traceback (most recent call last): File "run_game.py", line 16, in main.main() File "/Local/Games/Python/PyWeek6/Incoming/robocute/lib/main.py", line 44, in main scene.draw(camera) File "/Local/Games/Python/PyWeek6/Incoming/robocute/lib/robocute/scene.py", line 237, in draw self.mice.draw(graphics) File "/Local/Games/Python/PyWeek6/Incoming/robocute/lib/robocute/layer.py", line 49, in draw g.x = node.x AttributeError: 'Mouse' object has no attribute 'x'
(log in to comment)
Comments
I fixed it by adding these two lines to mouse.py:
class Mouse(Node): x = 0 # added y = 0 # added
r8 that I had added these lines to node.py:
Argh ... I tracked back through the revisions and found in class Node ... def _init_ ... self.x = 0 #added self.y = 0 #addedYour way is a quicker fix to judge the entry though. Thanks!
kfields on 2008/04/09 12:54:
Here is a shortcut to revision 11 that shows the changes that should get it to work.I'm surprised Python doesn't catch this mistake!.
class Mouse(Node): def __init__(self): super(Node, self).__init__()
'super(Node...' should be 'super(Mouse...'!
The bug got through because I wrote that code at the very end of the contest. Chalk up the other mistakes to being a Python Noob.