The "Shoot" animation plays way too fast

Found the solution.

Added the below

  • A bool variable to determine whether the animation is currently played. False by default. (var shooting_anim_playing)
  • A timer with the minimum amount of time required for the animation to be played. (var shoot_animation_timer = $ShootAnimationTimer)

In the “enter_state()” function of the “Shoot” state, start the timer, play the animation, and set the bool variable to true.
Once the timer is timed out, reset the bool variable to false.

extends ""

@onready var shoot_animation_timer = $ShootAnimationTimer

@export var shoot_animation_duration = 0.4
var shooting_anim_playing = false

func update(delta):
	Player.velocity.x = 0
	if !shooting_anim_playing:
			return STATES.IDLE
	return null
func enter_state():
	shooting_anim_playing = true

func exit_state():
	shooting_anim_playing = false

func _on_shoot_animation_timer_timeout():
	shooting_anim_playing = false