aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts
diff options
context:
space:
mode:
authorLibravatar IcECreAm777 <hgk.1998@googlemail.com>2023-07-08 17:05:48 +0200
committerLibravatar IcECreAm777 <hgk.1998@googlemail.com>2023-07-08 17:05:48 +0200
commit516635e22464699fa940ed981a186088352ba734 (patch)
tree9fcce535afb4b59f6109d95644b23ca5f5873b72 /Scripts
parent8b08fec313ac3517e782d946cbd203958801e6be (diff)
download2023-516635e22464699fa940ed981a186088352ba734.tar.gz
2023-516635e22464699fa940ed981a186088352ba734.tar.bz2
2023-516635e22464699fa940ed981a186088352ba734.zip
some cleanups
Diffstat (limited to '')
-rw-r--r--Scripts/drawing.gd7
-rw-r--r--Scripts/scene_control.gd13
2 files changed, 8 insertions, 12 deletions
diff --git a/Scripts/drawing.gd b/Scripts/drawing.gd
index 51e7f21..18e2a6c 100644
--- a/Scripts/drawing.gd
+++ b/Scripts/drawing.gd
@@ -8,12 +8,6 @@ var drawing = false
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
-func _process(delta):
- pass
-
-func _physics_process(delta):
- pass
-
func _start_drawing():
line.clear_points()
@@ -31,4 +25,3 @@ func _input(event):
if drawing and event is InputEventMouseMotion:
line.add_point(event.position)
path.curve.add_point(event.position)
-
diff --git a/Scripts/scene_control.gd b/Scripts/scene_control.gd
index 0b55d0f..d01342f 100644
--- a/Scripts/scene_control.gd
+++ b/Scripts/scene_control.gd
@@ -7,14 +7,16 @@ class_name SceneControl
@onready var car = $Car
@onready var checkpoints = $Checkpoints.get_children()
@onready var ui = $UI/Control
-@onready var finish_line: Area2D
+@onready var start = $Start
+
+var finish_line: Area2D
var is_driving = false
var current_time = 0.0
func _ready():
- finish_line = $FinishLine as Area2D
+ finish_line = $FinishLine/Area2D as Area2D
finish_line.body_entered.connect(_on_finish_line_body_entered)
reset_level()
@@ -41,8 +43,12 @@ func set_driving(driving: bool):
func reset_level():
ui.update_timer_label(-1)
+
for cp in checkpoints:
cp.set_was_visited(false)
+
+ car.global_position = start.global_position
+ car.global_rotation = start.rotation;
func start_driving():
current_time = 0.0
@@ -61,6 +67,3 @@ func _on_finish_line_body_entered(node: Node2D):
set_driving(false)
reset_level()
- # TODO get this from the start position
- car.global_position = Vector2.ZERO
- car.global_rotation = 0;