The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I am new to Godot and I am trying to figure out how to use the AnimationPlayer to create animations. I have created an AnimatedSprite node where I stored all my walk animations of my character. So I have walkleft and walkup for example.

Now I have selected AnimationPlayer, created a new Animation called "walkleft", chose the 0 position of my timeline and then have clicked on my AnimatedSprite, chose the animation stored there called "walkleft" and clicked at the "Frame" option on the add key frame. I then incremented in the AnimationPlayer to position 1 and did the same again until I have all animated pictures in the timeline.

When I now hit start in the AnimationPlayer the animation runs perfectly fine.

But when I now try to create a new animation called "walkup" in the AnimationPlayer and select the next Animation in my AnimatedSprite called "walkup" and apply the same procedure, the second animation overwrites my first one.....

I am clueless as to why this happens but it must be something trivial and since I have just started with Godot it is probably an easy fix I hope :)

Anyways, hopefully someone has a solution here.

in Engine by (29 points)

I suspect that you need to create a new timeline animation within the AnimationPlayer to mirror your sprite animations, but controlled by the player and not the sprite animator.

In Godot 3.0 it should be the file with a green plus in the animation editor tab. And then select the other animation timeline in the dropdown.

1 Answer

0 votes

Maybe I'm not understanding this correctly, but I don't think you need AnimationPlayer in this case.

If you have the different animations set up with the AnimatedSprite, you can just set which animation you want using that node.

if Input.is_action_pressed('walk_left'):
    $AnimatedSprite.animation = 'walk_left'
    $AnimatedSprite.playing = true
elif Input.is_action_pressed('walk_up'):
    $AnimatedSprite.animation = 'walk_up'
    $AnimatedSprite.playing = true
# etc...
by (1,663 points)

Hi Eric, thanks for your answer. The reason why I am using AnimationPlayer is because I am using a Framework which uses the AnimationPlayer in a certain way and I am not knowledgeable enough of the code implementation that I would want to change big parts of it :) Thats why I was simply trying to take over whats there, but then ran into this issue as described above. But yes, I would be able to use an AnimatedSprite for this. Is there any way I can accomplish this with AnimationPlayer just to preserve whats there and work from there? The framework I am trying to work with is this one here:
https://github.com/godotengine/escoria, it uses AnimationPlayer and I would like to simply go from there while getting used to all the functionality it offers without me having to build it myself you see

Hi Eric, no must have missed that. Will check that out thanks!

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 Frequently asked questions and 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 [email protected] with your username.