I need my player to stay facing a certain direction after they stop moving

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pointlessperson1

So this is my setup

if Input.is_action_pressed("ui_right"):
	$AnimatedSprite.play("walkright")

elif Input.is_action_pressed("ui_left"):
	$AnimatedSprite.play("walkleft")

How do i make it that after they have being walking they will stay facing the direction they were looking

:bust_in_silhouette: Reply From: Magso

If your code is in _process you’ll be calling play() every frame so the animations will never get past their first frame so you’ll need to use is_action_just_pressed(). After the animation has finished it will stop and face whatever direction you set in the last keyframe.