3

I am just starting out to learn cocos2d using python.

When I write this in pycharm :

import cocos

class HelloWorld(cocos.layer.Layer):
def __init__(self):
    super(HelloWorld, self).__init__()
    label = cocos.text.Label('Hello, World!',
                             font_name = 'Times New Roman',
                             font_size = 32,
                             anchor_x='center', anchor_y='center')
    label.position = 320, 240
    self.add(label)
cocos.director.director.init()
hello_layer = HelloWorld()
main_scene = cocos.scene.Scene(hello_layer)
cocos.director.director.run(main_scene)

Pycharm shows the error cannot find reference 'layer' in '__init__.py' but when I run it, the code works. The code works even when run from inside pycharm (not via terminal), although I don't find it surprising, but thought maybe it requires mentioning. It also doesn't gives any auto-suggestions and/or auto-completes anything related to cocos2d.

Any idea on how to fix this ?

I am using python 3.4.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Ishan
  • 3,303
  • 5
  • 29
  • 47
  • 1
    It could be related to [this](http://stackoverflow.com/questions/23248017/cannot-find-reference-xxx-in-init-py-python-pycharm?rq=1) issue, about a bug in PyCharm – BasedKojima Dec 07 '15 at 19:48

0 Answers0