im trying to make a combo system with state machine but the delay of the first attack is not working properly, if i add attacking == false it doesnt transition to the second attack. Also the animationplayer is changing attacking to false at the end of the animation
extends NodeState
@export var character_body_2d: CharacterBody2D
@export var animation_player: AnimationPlayer
@export var attacking = false
@export var can_combo = false
func _on_process(_delta : float) -> void:
pass
func _on_physics_process(_delta : float) -> void:
pass
func _on_next_transitions() -> void:
if GameInputEvents.attack_input() and can_combo == true:
transition.emit("Attack2")
if character_body_2d.is_on_floor() and attacking == false:
transition.emit("Idle")
elif not character_body_2d.is_on_floor() and attacking == false:
transition.emit("Fall")
func _on_enter() -> void:
attacking = true
animation_player.play("attack_up")
combo_timer()
func _on_exit() -> void:
animation_player.stop()
func combo_timer():
can_combo = true
await get_tree().create_timer(1.0).timeout
can_combo = false