Add trail component for homing bullets; update homing bullet scene and remove debug print
This commit is contained in:
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)
|
Reference in New Issue
Block a user