Godot Version
Godot 3.5.3
Question
I have a slight problem about animation, it’s quite simple really, i have two animation, one is walking, and one is attacking, now the problem is whenever i want to attack but still pressing the arrow button, the attack animation only showing the first frame until i release the arrow button, what i want is when i press the attack button, i want to game to ignore all key pressed until the animation is finished. This is my code
var velocity = Vector2.ZERO
attacking = false
if Input.is_action_pressed("ui_left") and attacking == false:
velocity.x -= 1
$Sprite.flip_h = true
$AnimationPlayer.play("Walk_Right")
facing = "Left"
if Input.is_action_pressed("ui_right") and attacking == false:
velocity.x += 1
$Sprite.flip_h = false
$AnimationPlayer.play("Walk_Right")
facing = "Right"
if Input.is_action_just_released("ui_left") or Input.is_action_just_released("ui_right"):
$AnimationPlayer.stop(true)
if Input.is_action_pressed("ui_accept"):
attacking = true
$AnimationPlayer.current_animation = "Attack"
velocity = Vector2.ZERO
thank you