[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] key refrence~



do something like:

        pygame.event.pump()
        keys=pygame.key.get_pressed()
        if keys[K_ESCAPE] or pygame.event.peek(QUIT):
            break
        if keys[K_LEFT]:  
            #code for moving left here

cheers,
Andy


On Fri, 2002-10-18 at 09:49, black wrote:
> 
> First of all, thanx Pete and Fredrik and Jesse and other kind people who helped me with my basic questions. Fortunately now I can create a nice background and add pictures to it and move them, as I said before my destination is to make games, so the next step is to contol those character(surface) which attached to background. my code is like this:
> 
> ev=pygame.event.wait()
>     if ev.type==pygame.KEYDOWN :
>         break
> 
> I searched Key and Event manual but only find event types. where does those key reference live ?  for example I need a surface moving 10 pixel when left key is pressed.
> 
> thanx~
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Faith Hill - Exclusive Performances, Videos, & more
> faith.yahoo.com


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org