game: add weapon active ability

This commit is contained in:
2025-08-21 05:52:40 +02:00
parent 8f02850a73
commit a0d121fadc
7 changed files with 49 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ extends Node2D
@export var attack_duration: float
@export var attack_range: float
@onready var active_cd_timer: Timer = $ActiveCDTimer
func _on_attack_cd_timer_timeout() -> void:
do_attack()
@@ -15,6 +16,15 @@ func _on_attack_cd_timer_timeout() -> void:
func do_attack() -> void:
push_error("%s does not implement do_attack" % self)
func do_active() -> void:
if not active_cd_timer.is_stopped():
return
active_cd_timer.start()
_do_active()
func _do_active() -> void:
push_error("%s does not implement do_active" % self)
func find_target_in_radius() -> EnemyBase:
var space_state: PhysicsDirectSpaceState2D = get_world_2d().direct_space_state