Adrien
Adrien

Reputation: 3

Using non-blocking keyboard event with PyGame

I am working with PyGame for the first time, and I haven't been able to find any way to handle event in a non-blocking way. For instance if I am playing a game with a character moving according to key pressing, I want the character to move continuously if I maintain the key pressed, and not having to release the key each time.

I am starting to think it is not possible with PyGame, am I right ?

Thanks.

Upvotes: 0

Views: 732

Answers (1)

DaOnlyOwner
DaOnlyOwner

Reputation: 353

Maybe you can use pygame.key.set_repeat() which sends multiple keydown events when you hold down a key; From here: https://www.pygame.org/docs/ref/key.html

Upvotes: 1

Related Questions