On Fri, 31 Oct 2008 18:39:31 +1000 Nicholas Dudfield <[EMAIL PROTECTED]> wrote:
> I am pretty sure you don't need to run event.pump() for every event. > > It doesn't seem like `keyinput` is being used at all so it's probably > not needed. You're right. I don't need it anymore. keyinput was being used before to make it so that more than one key could be pressed to move the character. I gave up due to minor bugs in my code and forgot to remove that little bit. What I would like to do: Right now if you are holding a directional key to move, and you press a different directional key at the same time, the player will stop, instead of changing directions. If anyone could give me some pointers on how to do this I'd be very happy, because I want it to be gamepad-friendly too. > <code> > elif event.key == K_UP or event.key == K_DOWN or event.key == K_LEFT > or event.key == K_RIGHT: > do_stuff() > </code > > The python idiom for this is > > <code> > elif event.key in (K_UP, K_DOWN, K_LEFT, K_RIGHT): > do_stuff() > </code> Aha, nice. Thanks!