aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Nodes/Level_test.tscn41
-rw-r--r--Nodes/checkpoint.tscn14
-rw-r--r--Nodes/drawing_and_driving.tscn6
-rw-r--r--Nodes/game.tscn2
-rw-r--r--Nodes/main_menu.tscn2
-rw-r--r--Nodes/ui.tscn4
-rw-r--r--Scripts/drawing.gd7
-rw-r--r--Scripts/scene_control.gd13
8 files changed, 44 insertions, 45 deletions
diff --git a/Nodes/Level_test.tscn b/Nodes/Level_test.tscn
index 18a1a1a..80330fd 100644
--- a/Nodes/Level_test.tscn
+++ b/Nodes/Level_test.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=9 format=3 uid="uid://ct2kxw1rrjryo"]
+[gd_scene load_steps=11 format=3 uid="uid://dliou1u4o6bib"]
[ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_0esj3"]
[ext_resource type="Texture2D" uid="uid://5xqahgawme4m" path="res://Assets/start.png" id="1_wenkl"]
@@ -6,6 +6,8 @@
[ext_resource type="Texture2D" uid="uid://dg3v488vx0oj6" path="res://Assets/checkpoint.png" id="3_cgigr"]
[ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="4_xvobs"]
[ext_resource type="Script" path="res://Scripts/drawing.gd" id="5_x7h3g"]
+[ext_resource type="PackedScene" uid="uid://wkfai2lvnp7n" path="res://Nodes/checkpoint.tscn" id="7_52mhf"]
+[ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="8_8u1ba"]
[sub_resource type="CircleShape2D" id="CircleShape2D_6g88q"]
radius = 18.0278
@@ -15,34 +17,22 @@ radius = 18.0278
[node name="Level_test" type="Node2D"]
script = ExtResource("1_0esj3")
-[node name="start" type="TextureButton" parent="."]
+[node name="Start" type="TextureButton" parent="."]
offset_left = 787.0
offset_top = 514.0
offset_right = 819.0
offset_bottom = 546.0
texture_normal = ExtResource("1_wenkl")
-[node name="End" type="Sprite2D" parent="."]
+[node name="FinishLine" type="Sprite2D" parent="."]
position = Vector2(793, 96)
texture = ExtResource("2_gp6ng")
-[node name="Area2D" type="Area2D" parent="End"]
+[node name="Area2D" type="Area2D" parent="FinishLine"]
-[node name="CollisionShape2D" type="CollisionShape2D" parent="End/Area2D"]
+[node name="CollisionShape2D" type="CollisionShape2D" parent="FinishLine/Area2D"]
shape = SubResource("CircleShape2D_6g88q")
-[node name="cp1" type="Sprite2D" parent="."]
-position = Vector2(283, 479)
-texture = ExtResource("3_cgigr")
-
-[node name="cp2" type="Sprite2D" parent="."]
-position = Vector2(618, 354)
-texture = ExtResource("3_cgigr")
-
-[node name="cp3" type="Sprite2D" parent="."]
-position = Vector2(514, 173)
-texture = ExtResource("3_cgigr")
-
[node name="Car" parent="." instance=ExtResource("4_xvobs")]
max_speed = 500
acceleration = 0.05
@@ -65,5 +55,18 @@ texture = ExtResource("3_cgigr")
wait_time = 0.2
one_shot = true
-[connection signal="pressed" from="start" to="DrawNode" method="_start_drawing"]
-[connection signal="mouse_entered" from="End/Area2D" to="DrawNode" method="_end_drawing"]
+[node name="Checkpoints" type="Node" parent="."]
+
+[node name="Checkpoint" parent="Checkpoints" instance=ExtResource("7_52mhf")]
+position = Vector2(619, 355)
+
+[node name="Checkpoint2" parent="Checkpoints" instance=ExtResource("7_52mhf")]
+position = Vector2(285, 479)
+
+[node name="Checkpoint3" parent="Checkpoints" instance=ExtResource("7_52mhf")]
+position = Vector2(517, 172)
+
+[node name="UI" parent="." instance=ExtResource("8_8u1ba")]
+
+[connection signal="pressed" from="Start" to="DrawNode" method="_start_drawing"]
+[connection signal="mouse_entered" from="FinishLine/Area2D" to="DrawNode" method="_end_drawing"]
diff --git a/Nodes/checkpoint.tscn b/Nodes/checkpoint.tscn
index 088da4b..0f76bc6 100644
--- a/Nodes/checkpoint.tscn
+++ b/Nodes/checkpoint.tscn
@@ -1,22 +1,20 @@
-[gd_scene load_steps=4 format=3 uid="uid://bi1dw58p4tky3"]
+[gd_scene load_steps=4 format=3 uid="uid://wkfai2lvnp7n"]
[ext_resource type="Script" path="res://Scripts/Checkpoint.gd" id="1_fwyov"]
-
-[sub_resource type="CanvasTexture" id="CanvasTexture_lawdg"]
+[ext_resource type="Texture2D" uid="uid://dg3v488vx0oj6" path="res://Assets/checkpoint.png" id="2_0dl7u"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f8epl"]
+size = Vector2(32, 32)
[node name="Checkpoint" type="Node2D"]
-position = Vector2(225, 128)
script = ExtResource("1_fwyov")
-[node name="Sprite2D" type="Sprite2D" parent="."]
-scale = Vector2(19.32, 19.8)
-texture = SubResource("CanvasTexture_lawdg")
-
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_f8epl")
+[node name="Sprite2D" type="Sprite2D" parent="."]
+texture = ExtResource("2_0dl7u")
+
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
diff --git a/Nodes/drawing_and_driving.tscn b/Nodes/drawing_and_driving.tscn
index 5052e04..ab51464 100644
--- a/Nodes/drawing_and_driving.tscn
+++ b/Nodes/drawing_and_driving.tscn
@@ -1,11 +1,11 @@
-[gd_scene load_steps=6 format=3 uid="uid://bj5wruvb2hg20"]
+[gd_scene load_steps=10 format=3 uid="uid://cb06k14t2slax"]
[ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_6bj13"]
[ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="1_ktvsb"]
[ext_resource type="Script" path="res://Scripts/drawing.gd" id="3_el555"]
[ext_resource type="Texture2D" uid="uid://dg3v488vx0oj6" path="res://Assets/checkpoint.png" id="4_ar5ae"]
-[ext_resource type="PackedScene" uid="uid://bi1dw58p4tky3" path="res://Nodes/checkpoint.tscn" id="5_lbroe"]
-[ext_resource type="PackedScene" uid="uid://bunwe03ob38mr" path="res://Nodes/ui.tscn" id="6_y2lbh"]
+[ext_resource type="PackedScene" uid="uid://wkfai2lvnp7n" path="res://Nodes/checkpoint.tscn" id="5_lbroe"]
+[ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="6_y2lbh"]
[sub_resource type="Curve2D" id="Curve2D_wmfhm"]
diff --git a/Nodes/game.tscn b/Nodes/game.tscn
index 5553ea5..5187a55 100644
--- a/Nodes/game.tscn
+++ b/Nodes/game.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=3 format=3 uid="uid://b7wp8w46l64vc"]
+[gd_scene load_steps=3 format=3 uid="uid://cu0s2nljmac8c"]
[ext_resource type="Script" path="res://Scripts/game.gd" id="1_1dait"]
diff --git a/Nodes/main_menu.tscn b/Nodes/main_menu.tscn
index 96928fb..0dbe20b 100644
--- a/Nodes/main_menu.tscn
+++ b/Nodes/main_menu.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=16 format=3 uid="uid://cqskj7j8bqmd5"]
+[gd_scene load_steps=16 format=3 uid="uid://b2ql8qlyaa5tr"]
[ext_resource type="Script" path="res://Scripts/main_menu.gd" id="2"]
[ext_resource type="FontFile" uid="uid://b2n2cbthkca0k" path="res://Assets/fonts/format.otf" id="7"]
diff --git a/Nodes/ui.tscn b/Nodes/ui.tscn
index 8467074..aabf0ff 100644
--- a/Nodes/ui.tscn
+++ b/Nodes/ui.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=4 format=3 uid="uid://bunwe03ob38mr"]
+[gd_scene load_steps=4 format=3 uid="uid://c8r6i3bu37ogu"]
[ext_resource type="Script" path="res://Scripts/UI_Control.gd" id="1_77hb8"]
@@ -16,6 +16,8 @@ layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
script = ExtResource("1_77hb8")
[node name="InGameUI" type="Control" parent="Control"]
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;