0 votes

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.

in Engine by (16 points)

1 Answer

0 votes

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!

by (77 points)

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

Glad I could help

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.