PDA

View Full Version : Question About Buffer of excess key presses in Java


jaypaul
08-06-2009, 03:11
Hi friends,

Right now, in the game I am working on, if the user presses a key multiple times the actions will be performed as many times as it registers, even though I disallow key presses during the time that the action is taking place.

For example, a move of 1 space can be carried out with a key press. While the character is moving, key presses are not allowed. However, if you just press the key 5 or 25 times, the character will just keep moving, once he's done with the first one.

What I need to do is clear the buffer of key presses after an action has taken place, so that the excess keys are not registered. I know the commands to do so in C++, but not in Java

Your Answers'll be Helpful.

Thanks
Paul
.

DABhand
08-06-2009, 13:01
http://java.sun.com/products/jlf/ed1/dg/index.htm

Has everyone listed there.

Why didnt you go here first?