diff options
Diffstat (limited to '')
-rw-r--r-- | Scripts/scene_control.gd | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Scripts/scene_control.gd b/Scripts/scene_control.gd index 9f231e0..fdaad14 100644 --- a/Scripts/scene_control.gd +++ b/Scripts/scene_control.gd @@ -2,12 +2,19 @@ extends Node class_name SceneControl -@onready var path : Path2D = $Path2D - -@on#ready var path_follow : PathFollow2D = $Path2D/PathFollow2D - +@onready var path : Path2D = $DrawNode/TrackPath +@onready var path_follow : PathFollow2D = $DrawNode/TrackPath/TrackFollower +@onready var car : StaticBody2D = $Car func get_path_direction(pos): var offset = path.curve.get_closest_offset(pos) - path_follow.h_offset = offset + path_follow.progress = offset return path_follow.transform.x + +func get_path_next_position(pos): + var offset = path.curve.get_closest_offset(pos) + path_follow.progress = offset + 50 + return path_follow.position + +func set_driving(driving: bool): + car.driving = driving |