0 votes

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.

PLAYER MOVEMENT CONTROL

func physicsprocess(delta):
if Input.isactionpressed("right") && isAttacking == false:
velocity.x = SPEED
$AnimatedSprite.play("Run")
$AnimatedSprite.flip_h = false
$Weapon/CollisionShape2D.position = initialPos

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

else:
    if isAttacking == false:
        $AnimatedSprite.play("Idle")

ATTACKING ANIMATION CONTROL

if Input.is_action_just_pressed("attack") && attackCooldown == false:
    $AnimatedSprite.play("Attack")
    isAttacking = true
    attackCooldown = true
    $attackCooldown.start()
    $Weapon/CollisionShape2D.disabled = false


#PLAYER JUMPING CONTROL
if Input.is_action_just_pressed("jump") && is_on_floor():
    velocity.y = JUMPFORCE
    isJumping = true

if !is_on_floor():
    if velocity.y < 0:
        $AnimatedSprite.play("Jump")
    elif velocity.y > 0:
        $AnimatedSprite.play("Falling")




velocity.y = velocity.y + GRAVITY
velocity = move_and_slide(velocity, Vector2.UP)
velocity.x = lerp(velocity.x ,0 ,0.7)
in Engine by (14 points)

do you want to play the "jump" or "attack"?

1 Answer

0 votes

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.

by (21 points)
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 Frequently asked questions and 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 [email protected] with your username.