I'm learning about animations and how does Skeletons2D work in Godot, I've a walk animation and is working fine, but have a problem with the horizontal flipping when is walking right or left, i've done it like this:
var TurnRight = Input.is_action_just_pressed("ui_right")
var TurnLeft = Input.is_action_just_pressed("ui_left")
if TurnLeft == true:
self.scale.x *= -1
if TurnRight == true:
self.scale.x *= 1
If I press Right it works fine and if i press Left it flips and walks fine, but if i press Left again it flips again (because -scale.x * -1 = scale.x) and when is facing Left and press Right it does Moonwalk (bacause -scale.x * 1 = -scale.x)
How can I fix this? or Which is the correct way to make this flip?
Thnx