0 votes

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

in Engine by (28 points)

1 Answer

0 votes

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.

by (3,223 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.