0 votes

Hello,

I can't find a clear solution to this problem. I have a death animation for an enemy pixel skeleton and I want it to stick to the floor during all frames, but on every frame except the biggest one the bone pile floats on the air and I have tried many things to fix this but nothing seems to work.

I really hope to get an answer and I thank in advance,
Eerik

in Engine by (12 points)

This doesn't seem like a problem for Godot to solve. What are the dimensions of each of the animation frames? If you equalize them all using negative space, this shouldn't be a problem anymore. I don't know how that works with meshes though, I haven't gotten into them at all.

Another option if you wanted to fix it in Godot alone would be to figure out the proper positional adjustment that needed to be done for each frame, and then connect your AnimatedSprite to its own frame_changed() signal. Each time it receives the signal, you have it check what the current animation and current frame is using get_animation() and get_frame(), then modify the AnimatedSprite's position based on each individual frame's needs.

1 Answer

0 votes

I’ve ran into this problem before myself and as denxl said it’s something that’s better to fix outside of the engine
There are three things you can do

  1. Check for that death frame and, if it’s true it’s on that death frame (or the frame when the bones float) scale your sprite to where it needs to be in from the script. Then scale it back.

  2. Create another animated sprite that holds only the death animation. Make it a child of the main animated sprite. Position it and hide the death animation when it doesn’t need to be shown. And when you are showing it hide the other animated sprite.

  3. The most ideal thing to do would be to go to the art program and fix the sizes of the sprites because that’s the problem. The floating sprite doesn’t have the same negative space as the other sprites. If you ripped the sprites yourself then you may have cropped that specific frame to little, or if you created the sprites you just need to remove or add extra empty space.

by (831 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 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.