i'm using the keyboard class from the LWJGL and am currently using
if(Keyboard.isKeyDown(Keyboard.KEY_A))
{
//move left
}
else if(Keyboard.isKeyDown(Keyboard.KEY_D))
{
//move right
}
if i have the 'a' key down then the 'd' key it will move right but if i have the 'd' key down then the 'a' key it will still continue to move right due to the "else" part.
i've tried it without the else and just letting them both run but if both keys are press there is no movement
im looking for a piece of code that allows me to only take the input from the last key that was pressed.
i also need to be able to move up and down (using 'w' and 's') so the solution can't stop other keys from working, only 'a' or 'd'.
thanks. Alex.