How to make animation finish and not be interrupted

Godot Version v4.2.2

Question

Hello, so I am very new to gamedev and godot, and I have been searching for like 2 hours already, beacuse I really didnt want to ask. When I do the punch animation, it gets instantly interrupted even by the idle animation. Only thing I found was the $AnimationPlayer.queue(“my_animation”), but I dont know how to implement it into the code. And I also found about the AnimationTree, but I dont know if it solves this problem.
Also I tried to make the player stop when playing the punch animation by adding speed = 0 after the punch if statement and getting it back to 70 with the animation finish signal, but I also dont know how that works, I thought it worked with the names of my animations, but when I write them under the signal it doesnt work.
I hope you understand what I am asking and thank you for answers.


Make sure to paste scripts instead of screenshotting. Use code formatting like so

```
type or paste code here
```


Your script is playing idle if they aren’t moving, and playing walk if they pressed left or right. If you never want the punch interrupted then you can add this if condition to each animation.play

if animation.current_animation != "punch":
    animation.play("idle")

Thank that works, but only if I dont move. If I am moving the punch animation just gets stuck in the first frame and doesnt finish. Is there some simple way to just stop every other animation when I press punch?

Sorry I think I hit the wrong reply button, but my question stands.

No, you will have to use the same if condition for each animation play

You could also look into an AnimationTree.

Coming in a little late to the thread but have you checked through your animation settings?
Remember having a similar issue where the solution were to change some settings
Like animation length or speed scale of animations

And for a solution that might be a bit more advanced I would look into a finite state machine for animations (animationtree) and other player logic

1 Like

Ok thanks, I guess I will look more into the animation tree.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.