24 lines
549 B
GDScript3
24 lines
549 B
GDScript3
|
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
|