Why doesn't my attack animation play while jumping?

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

When attempting to perform a jump attack, the animation plays the falling animation. Once the player hits the ground after attempting a jump attack it gets frozen in the falling animation.

func _physics_process(delta):
if Input.is_action_pressed(“right”) && isAttacking == false:
velocity.x = SPEED
$AnimatedSprite.flip_h = false
$Weapon/CollisionShape2D.position = initialPos

elif Input.is_action_pressed("left") && isAttacking == false:
	velocity.x = -SPEED
	$AnimatedSprite.flip_h = true
	$Weapon/CollisionShape2D.position = -initialPos
	if isAttacking == false:


if Input.is_action_just_pressed("attack") && attackCooldown == false:
	isAttacking = true
	attackCooldown = true
	$Weapon/CollisionShape2D.disabled = false
if Input.is_action_just_pressed("jump") && is_on_floor():
	velocity.y = JUMPFORCE
	isJumping = true

if !is_on_floor():
	if velocity.y < 0:
	elif velocity.y > 0:

velocity.y = velocity.y + GRAVITY
velocity = move_and_slide(velocity, Vector2.UP)
velocity.x = lerp(velocity.x ,0 ,0.7)

do you want to play the “jump” or “attack”?

shifitzel | 2022-10-07 19:47

:bust_in_silhouette: Reply From: TechShubham

Bro you need to make a new animation in which player is jumping and attacking both at same time you cannot use two animations at same on same player in godot with any code.