aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/scene_control.gd
diff options
context:
space:
mode:
authorLibravatar perivesta <>2023-07-08 10:19:19 +0200
committerLibravatar perivesta <>2023-07-08 10:19:19 +0200
commita10d0e582a9a614b933f3e689592595e6438513e (patch)
tree824c6c8a4abec16e95959b177219f55aa45884ce /Scripts/scene_control.gd
parent45b2751b4e63c8d7b048b005f19f9042782e5a13 (diff)
parentf7fd3f9dacf87e4d6f95aa0fdbb0bdb309bdbc3a (diff)
download2023-a10d0e582a9a614b933f3e689592595e6438513e.tar.gz
2023-a10d0e582a9a614b933f3e689592595e6438513e.tar.bz2
2023-a10d0e582a9a614b933f3e689592595e6438513e.zip
Merge branch 'base-car-behaviour'
Diffstat (limited to 'Scripts/scene_control.gd')
-rw-r--r--Scripts/scene_control.gd13
1 files changed, 13 insertions, 0 deletions
diff --git a/Scripts/scene_control.gd b/Scripts/scene_control.gd
new file mode 100644
index 0000000..9f231e0
--- /dev/null
+++ b/Scripts/scene_control.gd
@@ -0,0 +1,13 @@
+extends Node
+
+class_name SceneControl
+
+@onready var path : Path2D = $Path2D
+
+@on#ready var path_follow : PathFollow2D = $Path2D/PathFollow2D
+
+
+func get_path_direction(pos):
+ var offset = path.curve.get_closest_offset(pos)
+ path_follow.h_offset = offset
+ return path_follow.transform.x