How to lock animation to avoid spamming an action?

In my game I use animation like a kick + collision detection to inflict dmg on another object. As it is now, the player can spam the kick button to kill any object in a sec.

Is there a way to say something like??:

if (animation = notDone)
kick= false

Also would be great if someone could help me out with this problem:

Thank you in advance

the gist of what you want to do is


1 Like

^ like whaticamefromspace said. You should have an animation that is “idle” or something that just repeats all the time, and change it to the attack when needed, and set that animation to return to the idle animation when finished. Then you can check if the current animation is the idle one, and if it is, the attack is over.

1 Like

Not sure if I understood the answer correct.

FYI: I have my model always on “Idle” animation when not in action or after finishing an animation.

Is is as simple as saying

Edit: I tried it out. It didn’t help in my case, I think it is due to my Idle state?

excerpt from the code:
public void onAction(String name, boolean isPressed, float tpf)
if (name.equals(Kick))
if (!animChannel.getAnimationName().equals(Kick) && isPressed)
kick = true;

            kick = false;
            animChannel.setAnim("Idle1", 3f);


It worked. Thanks!
I had to move the else statement to the onAnimecycleDone and thats was it :smiley: