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

[pygame] Problem with simultaneous key presses



Howdy, folks.

The following small program demonstrates a problem with key presses.

http://trollsouttaluckland.googlecode.com/files/test.py

The program accepts cursor keys and space key to simulate moving and firing, respectively. It accumulates keydown and keyup events, translating combinations into diagonal movement. If you press up+left, for example, the box moves diagonally upward and left. This works as intended.

Theoretically you can also fire the ray while moving. However, while moving diagonally this only sometimes works. If for example I press space while holding down up+left, the space key event is sometimes lost or blocked. I can't tell which. But the result is that sometimes while moving diagonally the ray "fires" and sometimes it does not.

This occurs on Windows XP, Python 2.5.4, Pygame 1.9.1release-svn2575. I've also seen it in Pygame 1.8.1.

Does anyone have some insight on this odd behavior? Thanks in advance. :)

Gumm