From 88e3751834af72c413afa25a7c17a5994f570bfb Mon Sep 17 00:00:00 2001 From: IcECreAm777 Date: Sat, 8 Jul 2023 01:52:33 +0200 Subject: end of day commit --- Scripts/scene_control.gd | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Scripts/scene_control.gd (limited to 'Scripts/scene_control.gd') diff --git a/Scripts/scene_control.gd b/Scripts/scene_control.gd new file mode 100644 index 0000000..99bc3a2 --- /dev/null +++ b/Scripts/scene_control.gd @@ -0,0 +1,12 @@ +extends Node + +class_name SceneControl + +@onready var path : Path2D = $Path2D +@onready 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 -- cgit From 9ab7bc4c1e8bb266de9f100213e4036b1cd83c11 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Sat, 8 Jul 2023 01:38:26 +0100 Subject: why does this work gdscript HELLO? --- Scripts/scene_control.gd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Scripts/scene_control.gd') diff --git a/Scripts/scene_control.gd b/Scripts/scene_control.gd index 99bc3a2..9f231e0 100644 --- a/Scripts/scene_control.gd +++ b/Scripts/scene_control.gd @@ -3,7 +3,8 @@ extends Node class_name SceneControl @onready var path : Path2D = $Path2D -@onready var path_follow : PathFollow2D = $Path2D/PathFollow2D + +@on#ready var path_follow : PathFollow2D = $Path2D/PathFollow2D func get_path_direction(pos): -- cgit