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

Re: [pygame] eventstates



On Fri, 2005-12-02 at 09:48 -0800, Knapp wrote:
> There is most likely a better
> way but I did not know the system that well so I did it in a way the I
> know works in a way I understand.

I like the pygame.key.get_pressed():
http://www.pygame.org/docs/ref/key.html#pygame.key.get_pressed

It returns sequence for booleans that could be indexed by pygame.K_* 
keyboard constants. The True value means that the key is pressed.

Usage:
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
	print "go left"

-- 
Ivo Danihelka