How do I implement and use the AnimationPlayer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NotNEo

Hi!

I am new to godot so for my first project I made a simple 2d strategy game.
For that I made the simplest position animation in the built in animation player in godot.
However when I play the animation it plays as intended but when I run the game inside of godot the animation doesn’t start and I can’t even imagine why. Do I have to write and attach a scrip to the animation player or put it in the auto load or what do I have to do to make it work?
If someone can help me I would be very happy.

Thanks in advance.

:bust_in_silhouette: Reply From: skysphr

An animation player can contain a number of different animations. In order to launch one of them at runtime, you need to call its play() method: $YourAnimationPlayer.play("animation_name").

This is how it looks like:
https://i.imgur.com/SD923Nn.mp4

NotNEo | 2021-10-02 08:43