What's a good way of storing positions/key_frames?

Godot Version



I have a enemy character who points right or left. To make them flip left or right, I tried to be smart and used an animation player that stores all the positions of their collision shapes and ray casts when they’re facing right or left. Then I could edit them as I needed without having to add extra nodes or encode their new positions manually.

I used this and “played” the correct animation when flipping, however, this caused collision glitches, causing the poor enemies to flip around too much. I managed to fix this by setting the process mode for the Animation Player to manual and advancing it, but this does not seem like a good way of doing this. Is there a better way to “store” the positions and other data of collision shapes?

Sounds like you could have bugs?

A few questions, are Tweens relevant?

and have you been using the animation tree?

Tweens are not relevent, and I am not using animation trees.

Here is what I am doing - My enemy has a sprite, and to make sure that they have no strange physics glitches caused by scaling, I store both facing right and facing left as separate animations, which I then play when the character flips -


Then in my code, when the character flips, I have it play the relevant animation and advance it, so that it is in the first animation when it’s ready.

func flip():
	facing_right = !facing_right
	if facing_right:
	else :

This seems to work, but I wonder if there is a better way of doing it! If anyone know, please let me know!

Are you flipping the collider and or body, or just the sprite?

I use the same methods to move and rotate colliders and I don’t think I had any issues like that.

What calls the flip func anyway?