Jump animation won't show but every animation does.

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

It doesn’t give me any errors but it doesn’t show animation when i jump, but the walking and idle animation shows `const SPEED = 300.0
const JUMP_VELOCITY = -400.0

@onready var animPlayer = $AnimationPlayer

var gravity = ProjectSettings.get_setting(“physics/2d/default_gravity”)

func _physics_process(delta):
if not is_on_floor():
velocity.y += gravity * delta


if Input.is_action_just_pressed("ui_accept") and is_on_floor():
	animPlayer.play("Jump")
	velocity.y = JUMP_VELOCITY
	

var direction = Input.get_axis("ui_left", "ui_right")

if direction:
	animPlayer.play("Walk")
	velocity.x = direction * SPEED
else:
	animPlayer.play("Idle")
	velocity.x = move_toward(velocity.x, 0, SPEED)


move_and_slide()`
:bust_in_silhouette: Reply From: bamboo_river_kid

I believe the issue may be in the physicsprocess(delta). It says if NOT is on floor, then velocity.y += gravity* delta.

But in your other line, it says “if input action pressed and IS on floor” etc etc. So, I think velocity.y isn’t getting the “gravity * delta”.