extends Line2D var maxlen = 2 func _process(delta): var pos = get_global_mouse_position() add_point(pos) func _physics_process(delta): if len(points) >= maxlen: remove_point(0)