Snake_catcher error: Type_error ‘Point’ object is not callable
Using the YouTube Snake Catcher Part 1 tutorial at the first run, where you should see snakes at the top of the screen I get Type_error ‘Point’ object is not callable on this line:
new_snake Is a is shown in the debugger as a _scene2.SprintNode object in the debugger.
What can I do to get past this?
The full code is here
from scene import * import sound import random import math A = Action class MyScene (Scene): def setup(self): self.frame_counter = 0 def did_change_size(self): pass def update(self): self.frame_counter = self.frame_counter + 1 if self.frame_counter >= 120: self.frame_counter = 0 new_snake = SpriteNode('emj:Snake') new_snake.position(random.randint(0,1024), 768) self.add_child(new_snake) def touch_began(self, touch): pass def touch_moved(self, touch): pass def touch_ended(self, touch): pass if __name__ == '__main__': run(MyScene(), show_fps=False)
this ones an easy one 😁
Pointis a class that doesnt overide
__call__mqgic method. the
positionattribute for a Node is a
Pointobject. so when you wrote:
your calling on position lime it was a function.
what you shouldmofmdone is set the attribute instead of calling it.
new_snake.position = Point(random.randint(0,1024), 768)
here we are calling he
__init__methodm instead of the
__call__to create a new
Also remember to use
```before and after blocks of code to format them properly. Thanks!
Thanks @stephen. I hate it when I make an easy mistake :-).