0 votes

I`m trying to animate a character when they start walking and when they stop. Here is the code causing the problem

if $AnimatedSprite.is_playing ("walkright") == true and motion.x == 0:
    $AnimationPlayer.play("idleright")

I`m not sure what could have caused it could someone please help me out

in Engine by (28 points)

1 Answer

0 votes

$AnimatedSprite.is_playing() checks if the animated sprite is playing and returns a 'bool'(true/false) depending on whether the animated sprite is playing or not .
It does not accept any inputs.

Instead use

$AnimationPlayer.current_animation == "animation_name"

by (51 points)
edited by
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 Frequently asked questions and 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 [email protected] with your username.