0 votes

Hey everyone,

I'm trying to do pixel art 2d animations in Godot with the AnimationPlayer as suggested by many. I have multiple sprite sheet for the different states of the character (idle, walking, running, attacking) and I'd like to handle everything in a single AnimationPlayer node.

To do this, in each animation, I keyframe texture, vframe and hframe so that each animation can have its own texture.

It seems to work great, except for 1 (big) problem: whenever I'm switching animation (via code or in the animation editor) between two anims that use different textures, on change, for a split second, the new texture get set with a frame of 0 (which isn't part of the animation itself).

So each time I switch, I always see the frame 0 for a split second and then the animation plays correctly, which makes it unusable this way.

I cannot find any info about using multiple sprite sheets in a single AnimationPlayer other than this way.

The only real solution I see is to merge everything into a single texture and simply don't change that on animation but that kinda defeats the purpose of having anything keyframeable.

Any suggestion?

example of the problem with a spritesheet taken online: https://imgur.com/a/YyHeN

in Engine by (12 points)

You probably already know about this as an alternative, but it's possible to use an AnimatedSprite instead of a Sprite/AnimationPlayer combo if splitting the spritesheet into individual frames is possible for you. If you have access to a pixel art oriented image editor like aseprite it's pretty straightforward iirc.

Thanks for the info. Yeah I was aware of the possibility of using AnimatedSprite in place of the AnimationPlayer, but kinda defeats the purpose of the tool, as I do like the cool things AnimationPlayer provides (like calling functions during animations, swapping textures, etc).

I'm not sure if it's only me experiencing this issue of if anybody else does. At least we would be able to figure out if I'm doing something wrong or if it's some kind of bug in Godot.

Also, I'm not sure that under the hood using the AnimatedSprite is as efficient as the AnimationPlayer in terms of batching the changes and minimising texture swaps on the GPU (nor I am an expert on this, so I may be totally wrong).

Please log in or register to answer this question.

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.