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/car_behaviour.gd | 6 +++--- Scripts/scene_control.gd | 3 ++- root_scene.tscn | 8 ++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Scripts/car_behaviour.gd b/Scripts/car_behaviour.gd index dfc9ea4..c90fe05 100644 --- a/Scripts/car_behaviour.gd +++ b/Scripts/car_behaviour.gd @@ -1,10 +1,10 @@ extends StaticBody2D # editor variables -@export var max_speed = 350 +@export var max_speed = 3500 @export var steer_force = 0.1 -@export var look_ahead = 100 -@export var num_rays = 8 +@export var look_ahead = 75 +@export var num_rays = 32 # context array var ray_directions = [] 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): diff --git a/root_scene.tscn b/root_scene.tscn index 58d6e57..12d5bba 100644 --- a/root_scene.tscn +++ b/root_scene.tscn @@ -7,9 +7,9 @@ [sub_resource type="Curve2D" id="Curve2D_rg63l"] bake_interval = 10.0 _data = { -"points": PackedVector2Array(0, 0, 0, 0, 495, 54, 0, 0, 0, 0, 567, 56, -17.0089, 38.4276, 17.0089, -38.4276, 627, 32, -18.8988, 13.2292, 18.8988, -13.2292, 648, -102, -31.498, -18.8988, 31.498, 18.8988, 718, -102, 8.18949, -25.8284, -8.18949, 25.8284, 720, 263, 26.4583, 13.2292, -26.4583, -13.2292, 639, 286, 46.6171, 22.6786, -46.6171, -22.6786, 500, 170, 0, 0, 0, 0, 369, 136, -3.1498, 47.247, 3.1498, -47.247, 312, 90, 0, 0, 0, 0, 368, 53, 0, 0, 0, 0, 495, 54) +"points": PackedVector2Array(0, 0, 0, 0, 500, 61, 0, 0, 0, 0, 421, 8, -17.0089, 38.4276, 17.0089, -38.4276, 606, 37, -18.8988, 13.2292, 18.8988, -13.2292, 634, -114, -31.498, -18.8988, 31.498, 18.8988, 718, -102, 8.18949, -25.8284, -8.18949, 25.8284, 720, 263, 26.4583, 13.2292, -26.4583, -13.2292, 639, 286, 0, 0, 0, 0, 400, 152, 0, 0, 0, 0, 646, 194, 46.6171, 22.6786, -46.6171, -22.6786, 537, 118, 0, 0, 0, 0, 369, 136, -3.1498, 47.247, 3.1498, -47.247, 312, 90, 0, 0, 0, 0, 358, 16, 0, 0, 0, 0, 378, 42) } -point_count = 12 +point_count = 14 [node name="Node2D" type="Node2D"] position = Vector2(0, 1) @@ -54,10 +54,6 @@ scale = Vector2(1.28, 27.28) position = Vector2(0, 147) curve = SubResource("Curve2D_rg63l") -[node name="PathFollow2D" type="PathFollow2D" parent="Path2D"] -position = Vector2(495, 54) -rotation = 0.0277706 - [node name="Car" parent="." instance=ExtResource("2_22f5l")] position = Vector2(390, 202) max_speed = 100 -- cgit