cant add jump animation into script godot

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

hi all,

so i’m trying to add the jump animation called surprisingly “jumping”. and i’m using input vector.y < 0 to make the animation play on line 31. however , its not working as shown in the gif:

here is the paste bin script link:

can someone suggest how i can get the animation to work thank you

I don’t know how I can help you, but I can help with your jump() function:

func jump():
    if is_on_floor() and Input.is_action_pressed("jump"):
                # This had the comparison operator, `==`, instead of the assignment operator, `=`.
	    jump = true
	    velocity.y = jump_impulse

Ertain | 2022-07-09 23:39

The most common cause of this is a difference like a capital letter in the names etc. Does the name of the animation begin with a capital J for example but your code uses a lower case?

Gluon | 2022-07-10 00:02

:bust_in_silhouette: Reply From: umma

Maybe a typo try > instead of < at vector. y < 0

so i figured it out. after the else animated sprite “idle” statement on line 22, i added underneath it :

if not is_on_floor():

animatedSprite.animation = “jumping”

just need to figure out how to get a smooth jump animation

you can get the updated script here:

10_07_2022_jump_fix -

chris33556 | 2022-07-10 20:22