how to fix my jump animation

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

i was told my jump animation isn’t working because the animatedSprite was playing my idle/walk animation whilst i play the air animation and that i need to implement a way to detect if the player is in the air and make it not play the walk or idle animation while they are.

i tried this piece of code from a previous qna but no go:

var jump_ani_playing = false

... # The following is in your physicsprocess function:...

    if !is_on_floor() and !jump_ani_playing:
        $Sprite.play("JUMP")
        jump_ani_playing = true

it just made my character play the idle animation in mid air, as opposed to my previoud stuck on the first frame of the jump animation problem.

:bust_in_silhouette: Reply From: putskan

You should specify the “UP” direction like so:

const UP = Vector2(0, -1)
motion = move_and_slide(motion, UP)

You may also read the “up_direction” specification in the docs.

Good luck!

thanks so much foe the advice, dude. i’ll read the docs when i get more time. appreciate your help :slight_smile:

kityeeeee | 2021-01-05 13:51

Glad I could help

putskan | 2021-01-05 14:06