Skip to content Skip to sidebar Skip to footer

PyGame Not Receiving Events When 3+ Keys Are Pressed At The Same Time

I am developing a simple game in PyGame... A rocket ship flying around and shooting stuff. Question: Why does pygame stop emitting keyboard events when too may keys are pressed

Solution 1:

This sounds like a input problem, not a code problem - are you sure the problem isn't the keyboard itself? Most keyboards have limitations on the number of keys that can be pressed at the same time. Often times you can't press more than a few keys that are close together at a time.

To test it out, just start pressing and holding letters on the keyboard and see when new letters stop appearing.

My suggestion is to try mapping SPACE to a different key somewhere else and see what happens.


Solution 2:

As others have eluded to already, certain (especially cheaper, lower-end) keyboards have a low quality keyboard matrix. With these keyboards, certain key combinations will lead to the behavior you're experiencing. Another common side effect can be "ghost keys," where the an extra key press will appear in the input stream that was not actually pressed.

The only solution (if the problem is related to the keyboard matrix) is to change your key mapping to use keys on different rows/columns of the matrix, or buy a keyboard with a better matrix.


Solution 3:

Some keyboards cannot send certain keys together. Often this limit is reached with 3 keys.


Solution 4:

It may very well depend on the keyboard. My current no-name keyboard only supports two keys pressed at the same time, often a pain in games.


Post a Comment for "PyGame Not Receiving Events When 3+ Keys Are Pressed At The Same Time"