import pyglet
import cocos

class PlayingLayer(cocos.layer.Layer):
   is_event_handler = True

   def __init__(self):
      super( PlayingLayer, self ).__init__()

      self.image = cocos.sprite.Sprite('media/Paddel.png', position=
(50,50))

      self.keys_pressed = set()
      self.update_image()
      self.add(self.image)

   def update_image(self):
      x,y = self.image.position
      if keys_pressed[pyglet.key.UP]:
         y = y + 3

      self.image.position = (x,y)

   def on_key_press(self, key, modifiers):
      self.keys_pressed.add(key)
      self.update_image()

   def on_key_release(self, key, modifiers):
      self.keys_pressed.remove(key)
      self.update_image()

test = cocos.director.Director()
cocos.director.Director.init(test)
cocos.director.Director.run(cocos.scene.Scene(PlayingLayer()))


That code, gives me this error:

Traceback (most recent call last):
  File "py2.py", line 33, in <module>
    cocos.director.Director.run(cocos.scene.Scene(PlayingLayer()))
  File "py2.py", line 8, in __init__
    super( PlayingLayer, self ).__init__()
  File "/opt/local/lib/python2.5/site-packages/cocos2d-0.3.0-py2.5.egg/
cocos/layer/base_layers.py", line 59, in __init__
    super( Layer, self ).__init__()
  File "/opt/local/lib/python2.5/site-packages/cocos2d-0.3.0-py2.5.egg/
cocos/cocosnode.py", line 111, in __init__
    self.camera = Camera()
  File "/opt/local/lib/python2.5/site-packages/cocos2d-0.3.0-py2.5.egg/
cocos/camera.py", line 55, in __init__
    self.restore()
  File "/opt/local/lib/python2.5/site-packages/cocos2d-0.3.0-py2.5.egg/
cocos/camera.py", line 75, in restore
    width, height = director.get_window_size()
  File "/opt/local/lib/python2.5/site-packages/cocos2d-0.3.0-py2.5.egg/
cocos/director.py", line 383, in get_window_size
    return ( self._window_original_width,
self._window_original_height)
AttributeError: 'Director' object has no attribute
'_window_original_width'


Any help?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to