Ok been trying to figure this out currently I can update the rotation
of my cannon every time I press the key that rotates it but I want it
to rotate while I hold the key down. I understate that this is what
KeyStateHandler but I can't seem to get it to work. Here is my event
code as it is currently where I have to press the key every time I
want it to rotate the cannon. Thanks in advance for the Help.
-------------------------------------------------------------------------------------------------------------------------
from pyglet.window import key
class GameEventHandler(object):
def __init__(self, game):
self._game = game
def on_draw(self):
self._game.draw()
def on_key_press(self, symbol, modifiers):
if symbol == key.ESCAPE:
self._game.shutdown()
if symbol == key.LEFT:
self._game.cannon.set_rotation(5.0)
if symbol == key.RIGHT:
self._game.cannon.set_rotation(-5.0)
-------------------------------------------------------------------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" 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/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---