Attention | Topic was automatically imported from the old Question2Answer platform. | |
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.
#PLAYER MOVEMENT CONTROL
func _physics_process(delta):
if Input.is_action_pressed(“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)
do you want to play the “jump” or “attack”?
shifitzel | 2022-10-07 19:47