Hello everybody.
I've made a simple walking-cutout-animation.
In this animation the character is walking to the right. Is there any easy way to flip the cutout-animation, so the character is walking to the left?
I tried to change the x-value of the KinematicBody2D, but this leads to strange results (the animation is flipping continously).
This is my code so far (adapted from the demo-project 'Platformer 2D'):
if (IsOnFloor()) {
if (mLinearVelocity.x < -SIDING_CHANGE_SPEED) {
mPlayerBody.Scale = new Vector2(Mathf.Abs(mPlayerBody.Scale.x) *-1f, mPlayerBody.Scale.y);
newAnimation = "Walking";
}
if (mLinearVelocity.x > SIDING_CHANGE_SPEED) {
mPlayerBody.Scale = new Vector2(Mathf.Abs(mPlayerBody.Scale.x), mPlayerBody.Scale.y);
newAnimation = "Walking";
}
}
Any help is really appreciated :)
Edit:
Here is a video of the strange behaviour.
Please don't judge my Actor. It is just a simple stickmantest of cutout-animation and movement :):
Video