The Godot Community Forums are back up and running! Please read the the announcement post for important information on what happened. Thanks!

Walk animation not playing for certain direction

Hello.
I tried to setup the animation for my character.
The idle animation works fine. but when I start to move right, up and down, It's not playing any animation. But when I move to the left, the walk animation works. idk whats wrong.

Here's the code:

Comments

  • nvm found the solution:
    I deleted the "else" and replace it with

    if motion == Vector2(0,0):
        $Sprite.play("idle")
    
  • UnknownUserUnknownUser Posts: 0
    edited September 13

    The problem you're having is you're not using an if/elif/else all the way down the chain. You have four completely separate if statements here and only the last one has an else clause, so the else is only run if left is not pressed.

    Admin note: This comment was in the moderation queue

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file