First Pyggy version (0.5)

Improvements in this version: By the way, if anyone would like to join me as a level designer, let me know! The biggest thing the game needs right now is ideas...

(log in to comment)

Comments

I just took a look at your code. You don't have to be treating everything in the game as events. It's okay to deal with input sometimes by checking it's state instead. For continuous actions such as moving (in most games), that's the method that results in simpler code.

Check the documentation for pygame.key.get_pressed and try it out in future projects. =)

That won't work in this case, because I need to keep track of the order in which the arrow keys were pressed, so that I can resume moving in the most recently requested direction when a key is released.

Another subtletly is that I don't stop moving the moment a key is released, but only after the end of the next frame. That's so you can quickly tap and release a key and be assured of moving at least one step. Otherwise, the key tap could be lost altogether if it occurs within one frame time.

For these reasons, I need to take notice of the event stream rather than just looking at the current state of the keyboard.