teststrecke-game/scripts/tiretrail.gd
2024-11-10 20:49:52 +01:00

23 lines
549 B
GDScript

extends Line2D
var point
var isSliding=false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
set_as_top_level(true)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
pass
func _process(delta: float) -> void:
if isSliding:
point = get_parent().global_position
add_point(point)
if points.size()>100:
remove_point(0)
func setSliding(psliding:bool):
if not isSliding and psliding: #just started sliding
clear_points()
isSliding=psliding