I can't thank you enough for helping! Sorry I have been busy so I couldn't 
reply in time but I really appreciate it!

On Wednesday, April 26, 2017 at 7:39:37 PM UTC-4, [email protected] wrote:
>
> Whenever a key is pressed functions like on_key_press are automatically 
> called, but only when a key is pressed or released. Its usually best to use 
> this to toggle other variables you can use in your main loop, as a simple 
> example:
>
> right = False
> left = False
> x = 0
> speed = 0.5
>
> #main loop
> def update(dt):
>     if right == True:
>         x += speed
>     if left == True:
>         x -= speed
>
> def on_key_press(symbol,modifiers):
>     if symbol == key.RIGHT:
>         right = True
>     if symbol == key.LEFT:
>         left = True
>
> def on_key_release(symbol,modifiers):
>     if symbol == key.RIGHT:
>         right = False
>     if symbol == key.LEFT:
>         left = False
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to