cocos.draw.Circle not working on Python

30 views
Skip to first unread message

Rogério Dec

unread,
Sep 25, 2018, 12:20:25 PM9/25/18
to cocos2d discuss
Trying to run this code:

import cocos
class Ant(cocos.layer.Layer):
    def __init__(self):
        super(Ant, self).__init__()
        centerPoint=cocos.draw.Vector2(200,200)
        circle=cocos.draw.Circle(centerPoint, 30.0)
        self.add(circle)

cocos.director.director.init(width=640, height=480)
scene=cocos.scene.Scene(Ant())
cocos.director.director.run(scene)

I get these errors:

Traceback (most recent call last):
File "C:/Users/Rogerio/Desktop/Python/PyCharm/carro/teste2.py", line 11, in 
cocos.director.director.run(scene)
File "C:\Program Files\Python\lib\site-packages\cocos\director.py", line 403, in run
self._set_scene(scene)
File "C:\Program Files\Python\lib\site-packages\cocos\director.py", line 532, in _set_scene
scene.on_enter()
File "C:\Program Files\Python\lib\site-packages\cocos\scene.py", line 89, in on_enter
super(Scene, self).on_enter()
File "C:\Program Files\Python\lib\site-packages\cocos\cocosnode.py", line 611, in on_enter
c.on_enter()
File "C:\Program Files\Python\lib\site-packages\cocos\layer\base_layers.py", line 73, in on_enter
super(Layer, self).on_enter()
File "C:\Program Files\Python\lib\site-packages\cocos\cocosnode.py", line 611, in on_enter
c.on_enter()
AttributeError: 'Circle' object has no attribute 'on_enter'

How to solve this?


Reply all
Reply to author
Forward
0 new messages