class_name NPCCar
extends PathFollow2D

@export var car : Car
@export var speed = 0.1
@export var distanceMax = 100


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	if car == null:
		return
	if (delta > 0.01):
		return
	if position.distance_to(car.position) < distanceMax:
		progress += car.speed * delta
	if progress_ratio > 1:
		progress_ratio = progress_ratio - 1
	if progress > 0:
		car.moveTo(position);
