[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Character Movement



A more readable alternative to chaining together all the or's:

if event.key in [K_e,K_i,K_KP8]:
   player.xmove -=3



On 4/26/07, Charles Christie <sonicbhoc@xxxxxxxxx> wrote:
It worked!

...but I confused x and y. o_O


On 4/26/07, Charles Christie < sonicbhoc@xxxxxxxxx> wrote:
oooooooooooooooooooooooh. Lemme try that...


On 4/26/07, Aaron Maupin <maupin@xxxxxxxxxxxxxx > wrote:
Just scanning your code,

Charles Christie wrote:

>                         if event.key == K_e or K_i or K_KP8:
>                             player.xmove = -3

should probably be:

if event.key == K_e or event.key == K_i or event.key == K_KP8:
     player.xmove = -3

etc.