Fix des timer attaque + ajout tableau slot attaque

This commit is contained in:
Elouan 2025-01-24 22:51:25 +01:00
parent e9952f4ec9
commit 4040779923
11 changed files with 155 additions and 106 deletions

View file

@ -1,20 +1,14 @@
extends CharacterBody2D
extends Area2D
var cooldown_timer = null
var timer = 0.0
var cooldown = 1.5
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)
timer += delta
if timer >= cooldown:
queue_free()
# 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()
func Collision(body: Node2D) -> void:
if body.is_in_group("Enemies") :
queue_free()