How to implement player jump animation

Godot Version



Hey, my beginner self is back with yet another question. I’m trying to implement jump animation and I’m doing it like so:

func _physics_process(delta):
	# Add the gravity.
	if not is_on_floor():
		velocity.y += gravity * delta"Jump")

But the thing is, my player is Idle when in the air, how do I correctly implement this?

You need to make sure other animations do not play during the jump animation. Only play “Idle” if the player is_on_floor for instance.

1 Like

Lemme try this, I will tell you how it goes. Thanks for responding…

It worked! I later did like so:

	if is_on_floor():
	# Play animation based on direction
		if direction == 0:"Idle")
		elif direction == 1 or direction == -1:"Run")

Thanks for the insight.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.