Reflecting positional animations across origin

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

I have a player consisting of a KinematicBody2D. The player has an orientation attribute which can be either ‘LEFT’ or ‘RIGHT’.

This player has a Sprite > AnimationPlayer, which plays my animations.

Depending on the player’s orientation, I set the sprite’s flip_h to either true or false. This flips the sprite to face either left or right, depending on the orientation of the player.

This has worked well enough when my animations were simple, but I have recently tried key framing changes in the position of my CollisionShape2D.

Now, if you’re changing the position of the CollisionShape2D (to accommodate, for example, animations where the sprite moves far off center), naturally this change should be different depending on the orientation of the sprite.

So when I change the position of the collision shape in the animation, it works fine for the native orientation of the sprite image, but it doesn’t match for the other orientation, when the sprite image is flipped.

So, What is a good way to achieve what I want? That is, key framing CollisionShape2D positions while simultaneously accommodating flips of the sprite?

Ideally, I’d avoid making two animations, one for to each orientation.