Ohh thank you for that I didn't even realize I was doing that. I suppose after I have already check if UP was press I could then just check to see if RIGHT or LEFT have been pressed to get the correct image for the sprite to use instead of testing for UP again.
On Saturday, July 20, 2013 11:26:00 PM UTC-5, Brandon Jumbeck wrote: > > So just recently I jumped into Python and Pyglet since I have been looking > for a language that can prototype much faster then my usual C++ and it > seemed to fit my need perfectly. I am also quite new at game development in > general so try not to be to hard on me ;p. > > Anyways my question is about a little project I am working on (A little > space shooter) and I have having trouble trying to figure out a good system > to use for managing each objects state. > > 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 have been reading up on different state handling designs like FSM, HFSM > and Behavior Tress but I couldn't really find any code examples of how they > are implemented (I learn better by examining actual code). > > So any help would be appreciated thank you. > > > -- 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.
