code-game-jam-drop-plafond-.../scripts/Instrument/onde.gd
2025-01-24 18:45:09 +01:00

20 lines
543 B
GDScript

extends CharacterBody2D
var cooldown_timer = null
func _process(delta: float) -> void:
if cooldown_timer == null:
cooldown_timer = Timer.new()
cooldown_timer.name = "OndeCooldownTimer"
cooldown_timer.one_shot = true
cooldown_timer.connect("timeout", Callable(self, "_on_cooldown_timeout"))
get_tree().root.add_child(cooldown_timer)
# Démarrer le timer pour le cooldown
func start_cooldown() -> void:
cooldown_timer.start()
func _on_cooldown_timeout() -> void:
cooldown_timer.queue_free()
cooldown_timer = null
queue_free()