Add trail component for homing bullets; update homing bullet scene and remove debug print
This commit is contained in:
@@ -47,7 +47,6 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
|
||||
func on_detection_area_body_entered(body: Node) -> void:
|
||||
print("Body entered detection area: ", body.name)
|
||||
if target != null:
|
||||
return
|
||||
|
||||
|
18
scripts/components/trail_component.gd
Normal file
18
scripts/components/trail_component.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
class_name TrailComponent
|
||||
extends Line2D
|
||||
|
||||
@export var max_points: int = 100
|
||||
|
||||
var queue: Array[Vector2] = []
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
queue.push_front(owner.global_position)
|
||||
|
||||
if queue.size() > max_points:
|
||||
queue.pop_back()
|
||||
|
||||
clear_points()
|
||||
|
||||
for point in queue:
|
||||
add_point(point)
|
1
scripts/components/trail_component.gd.uid
Normal file
1
scripts/components/trail_component.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c0bvan0swashx
|
Reference in New Issue
Block a user