0 votes

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.

in Engine by (1,571 points)
edited by

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.