Hey there,
so i am currently implementing animations for my main character.
The goals is to to animate the character in all eight directions.
For reference:
Forward = F, Backward = B, Left = L, Right = R.
By eight directions i mean, F,B,L,R, FR, FL, BR, BL.
So basically also the diagonals.
Right now i am doing something like this:
private final ActionListener animListener = (name, isPressed, tpf) -> {
if(app != null);
if (name.equals(FORWARD) &isPressed) getPlayer.setAnimation("WalkForward");
else if(name.equals(BACKWARD)&isPressed) getPlayer.setAnimation("WalkBackward");
else if(name.equals(LEFT)&isPressed) getPlayer.setAnimation("WalkLeft");
else if(name.equals(RIGHT)&isPressed) getPLayer.setAnimation("WalkRight");
/*
else if(name.equals(Right) && name,equals(Forward) && isPressed) getPlayer.setAnimation("WalkForwardRight);
*/
else getPlayer.setIdleAnimation();
};
The commented out part is where the problems begin. I thought that i could listen for two Key Inputs simultaneously, but it turns out i cannot. Or i am just doing it wrong. I have read something in the Wiki about ComboMoves but it is not exactly i am looking for.
So basically i need to “listen” if two keys are pressed at the same time, but as far as i know this is not possible the way i do. Does anyone have encountered the same isse? If yes, how did you solve it?