delete files in nickes
This commit is contained in:
@@ -12,7 +12,7 @@ var swing_start_angle: float = 0.0 # Starting angle
|
||||
var swing_arc: float = 180.0 # Total arc to swing (180 degrees)
|
||||
var elapsed_time: float = 0.0
|
||||
var player_owner: Node = null
|
||||
var hit_targets = [] # Track what we've already hit
|
||||
var hit_targets = {} # Track what we've already hit (Dictionary for O(1) lookup)
|
||||
|
||||
@onready var sprite = $Sprite2D
|
||||
@onready var hit_area = $Area2D
|
||||
@@ -57,11 +57,12 @@ func _on_body_entered(body):
|
||||
if body == player_owner:
|
||||
return
|
||||
|
||||
# Don't hit the same target twice
|
||||
# Don't hit the same target twice - use Dictionary for O(1) lookup to prevent race conditions
|
||||
if body in hit_targets:
|
||||
return
|
||||
|
||||
hit_targets.append(body)
|
||||
# Add to hit_targets IMMEDIATELY to prevent multiple hits (mark as hit before processing)
|
||||
hit_targets[body] = true
|
||||
|
||||
# Deal damage to players
|
||||
if body.is_in_group("player") and body.has_method("take_damage"):
|
||||
|
||||
Reference in New Issue
Block a user