On 21/07/13 05:26, Brandon Jumbeck wrote: > [...] > > For example here is a snippet of code from my player class > http://pastebin.com/cBBkmVwA . Notice the big if/elif/else combination I > am using to update the player sprite based on keyboard input. This seems > rather ugly to me and a lot of work to maintain (Specially since that > code is only for basic movement of the sprite)... So I was wondering is > there a better way to do this? Or is this the correct way to go about it?
I think I use something similar. I tend to abstract the input in a controller class so I can easily use keyboard or joystick (pglet 1.2 alpha1): https://github.com/reidrac/ya-falling-blocks/blob/master/useboxnet/puzzle/control.py I don't want to show you the movement handler of that game because it is ugly :) Is a falling blocks game and I wanted to emulate the movement of Tetris, Columns, etc, so I don't think it's what you want. Regards, Juan -- jjm's home: http://www.usebox.net/jjm/ blackshell: http://blackshell.usebox.net/ -- 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 http://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/groups/opt_out.
