Hi guys,
I’m looking for a way to enable button mashing in slick2d, that means the player has to repress a certain key to repeat an action.
I thought this was possible by using isKeyPressed. For fluent moving I’m using isKeyDown, but for attack I don’t want the player to be able to hold down the attacking button.
if (CoreGameState.inputHandler.isKeyPressed(Input.KEY_SPACE)) {
PlayerCharacter.nextAction = ActionController.findActionByName("Simple Attack");
SimpleAttack sa = (SimpleAttack)PlayerCharacter.nextAction;
sa.useAction(pc);
}
This is the code I’m using for attacking, right now the player can just hold down space and the attack is repeated. I want the player to press the space for each attack.
I’m sure this isn’t super hard to achieve but somehow I can’t figure it out right now.