Godot Version
func process_physics(_delta) -> State:
if parent.movement:
parent.velocity.x = speed * parent.movement * _delta
if parent.movement > 0:
parent.animation.flip_h = -1
elif parent.movement < 0:
parent.animation.flip_h = 1
else:
parent.velocity.x = 0
Question
only the first time does the player turn around when an opposite direction is pressed, but everytime after that nothing happens.
Hi,
flip_h being a boolean, you should assign either 0 (for false) or 1 (for true). Here, your -1 will not work properly.
Even better (and actually advised as everyone does that), assign true or false directly:
if parent.movement > 0:
parent.animation.flip_h = false
elif parent.movement < 0:
parent.animation.flip_h = true
system
Closed
August 10, 2025, 10:47pm
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.