Godot Version
Godot 3
Question
So, in my game you can pounce towards an enemy. When you do so, you change form and are rotated to point at them. The issue is that setting rotation degrees to 0 when you aren’t pouncing seems to make you spin when you move left.
if pouncing:
if target:
look_at(target.position)
pounceTimer -= delta
if pounceTimer > 0:
Globals.iframe = true
if target:
velocity = (target.global_position - global_position).normalized() * POUNCE_SPED * 8
else:
Globals.iframe = false
pouncing = false
velocity = Vector2.ZERO
else:
rotation_degrees = 0
This is my code for flipping the character, which may have something to do with it:
var direction := Input.get_axis("left", "right")
if direction == -1:
transform.x.x = -1
elif direction == 1:
transform.x.x = 1