I’m trying to make a game where a stick figure’s movements are controlled by the keyboard. Pretty much everything works, but not exactly the way I want. Left, right, up, and down movements are controlled with the arrow keys. There are times where the stick figure can perform other actions by pressing other keys, like the spacebar. However, if I press an arrow key and spacebar, the figure will move AND perform the action attached to the spacebar. What I would like is a way to ‘lock out’ all other keys when any one key is down. Currently, I am using the following commands, in a function, to detect keys: if (Key.isDown (Key.LEFT)) etc…
Is there a method for locking out the other keys when one key is already pressed?