0 votes

I have three animations:
Runstart
Running
Run
end
If I press the start button, the animations should play one after the other. Three frames "Runstart", loop "Running" and two frames "Runend".
I know you can use AnimationTree / state machine, but but maybe there is another way?
I would like to use AnimatedSprite or AnimationPlayer and manage from code.
I would be grateful if you could show me an example code.

Godot version 3.3.2
in Engine by (27 points)

1 Answer

0 votes

Loads of ways to skin that cat. One way is to add a method call in the AnimationPlayer. They're basically signals, when one finishes it will call a method which can call the next and string them as long as you like.

Speaking of signals, maybe an even easier option is to add an animation_finished signal to AnimationPlayer which passes the animation name, so it's trivial to branch in code.

by (793 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.