extends Node2D var player_movement : PlayerMovement var timer : Timer var just_clicked : bool = false var can_dash : bool = true func _ready() -> void: player_movement = get_node("../../PlayerMovement") timer = Timer.new() timer.wait_time = .5 timer.one_shot = true timer.timeout.connect(_timeout) add_child(timer) func _input(_event: InputEvent) -> void: # if Input.is_action_just_pressed("left") || Input.is_action_just_pressed("right"): # if !just_clicked: # just_clicked = true # timer.start() # else: # just_clicked = false if Input.is_action_just_pressed("dash"): if can_dash: player_movement.dash(Input.get_axis("left", "right")) can_dash = false $"Cooldown".start() func _timeout() -> void: just_clicked = false func _on_cooldown_timeout() -> void: can_dash = true