2026-05-17 21:41:28 +00:00
|
|
|
extends Node3D
|
|
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
|
func pow() -> void:
|
|
|
|
|
var going = true
|
|
|
|
|
|
|
|
|
|
while going:
|
|
|
|
|
$Hit.force_raycast_update()
|
|
|
|
|
var hit = $Hit.get_collider()
|
|
|
|
|
|
2026-05-18 14:41:07 +00:00
|
|
|
if hit and hit.name == "Player":
|
|
|
|
|
pass
|
|
|
|
|
elif not hit:
|
2026-05-17 21:41:28 +00:00
|
|
|
print("hit nothing")
|
|
|
|
|
break
|
2026-05-18 14:41:07 +00:00
|
|
|
elif "health" in hit:
|
2026-05-17 21:41:28 +00:00
|
|
|
hit.health -= 100
|
|
|
|
|
if "on_knockback" in hit: hit.on_knockback()
|
|
|
|
|
print(hit.name, hit.health)
|
|
|
|
|
else:
|
|
|
|
|
print("no health in hit: ", hit.name)
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
$Hit.add_exception(hit)
|
|
|
|
|
|
|
|
|
|
$Hit.force_raycast_update()
|
|
|
|
|
var final_point = $Hit.get_collision_point()
|
|
|
|
|
|
|
|
|
|
$Line.position.x = -(final_point - global_position).length() / 2.0
|
|
|
|
|
$Line.height = (final_point - global_position).length()
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
|
func _process(delta: float) -> void:
|
|
|
|
|
$Line.radius -= delta * 0.2
|
|
|
|
|
|
|
|
|
|
if $Line.radius <= 0.001: queue_free()
|