diff options
author | IcECreAm777 <hgk.1998@googlemail.com> | 2023-07-09 13:59:48 +0200 |
---|---|---|
committer | IcECreAm777 <hgk.1998@googlemail.com> | 2023-07-09 13:59:48 +0200 |
commit | a6cf1d882adec3c34b809c832615fefab924e870 (patch) | |
tree | e2362fa21c2b2df7123508961d2e25bdd18d90b5 | |
parent | d6cdfb1b7e40890f6521f67198d13d2c575a90f2 (diff) | |
download | 2023-a6cf1d882adec3c34b809c832615fefab924e870.tar.gz 2023-a6cf1d882adec3c34b809c832615fefab924e870.tar.bz2 2023-a6cf1d882adec3c34b809c832615fefab924e870.zip |
template level & setting offset to the start button so the car is in the middle
Diffstat (limited to '')
-rw-r--r-- | Levels/LevelTemplate.tscn (renamed from Nodes/Level_test.tscn) | 53 | ||||
-rw-r--r-- | Scripts/scene_control.gd | 6 |
2 files changed, 26 insertions, 33 deletions
diff --git a/Nodes/Level_test.tscn b/Levels/LevelTemplate.tscn index f082198..86ea221 100644 --- a/Nodes/Level_test.tscn +++ b/Levels/LevelTemplate.tscn @@ -1,13 +1,12 @@ -[gd_scene load_steps=11 format=3 uid="uid://dliou1u4o6bib"] +[gd_scene load_steps=10 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"] -[ext_resource type="Texture2D" uid="uid://b8vhe5kt6037n" path="res://Assets/end.png" id="2_gp6ng"] -[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"] +[ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_2b4bf"] +[ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="2_2w0c4"] +[ext_resource type="Texture2D" uid="uid://5xqahgawme4m" path="res://Assets/start.png" id="3_ckyv7"] +[ext_resource type="Texture2D" uid="uid://b8vhe5kt6037n" path="res://Assets/end.png" id="4_2vjhv"] +[ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="5_v816p"] +[ext_resource type="Script" path="res://Scripts/drawing.gd" id="6_ihf71"] +[ext_resource type="Texture2D" uid="uid://dg3v488vx0oj6" path="res://Assets/checkpoint.png" id="7_bofa3"] [sub_resource type="CircleShape2D" id="CircleShape2D_6g88q"] radius = 18.0278 @@ -15,32 +14,35 @@ radius = 18.0278 [sub_resource type="Curve2D" id="Curve2D_0exre"] [node name="Level_test" type="Node2D"] -script = ExtResource("1_0esj3") +script = ExtResource("1_2b4bf") -[node name="UI" parent="." instance=ExtResource("8_8u1ba")] +[node name="UI" parent="." instance=ExtResource("2_2w0c4")] -[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="Start" type="Node2D" parent="."] +position = Vector2(256, 422) + +[node name="Start" type="TextureButton" parent="Start"] +offset_left = -16.0 +offset_top = -16.0 +offset_right = 16.0 +offset_bottom = 16.0 +texture_normal = ExtResource("3_ckyv7") [node name="FinishLine" type="Sprite2D" parent="."] position = Vector2(793, 96) -texture = ExtResource("2_gp6ng") +texture = ExtResource("4_2vjhv") [node name="Area2D" type="Area2D" parent="FinishLine"] [node name="CollisionShape2D" type="CollisionShape2D" parent="FinishLine/Area2D"] shape = SubResource("CircleShape2D_6g88q") -[node name="Car" parent="." instance=ExtResource("4_xvobs")] +[node name="Car" parent="." instance=ExtResource("5_v816p")] max_speed = 500 acceleration = 0.05 [node name="DrawNode" type="Node2D" parent="."] -script = ExtResource("5_x7h3g") +script = ExtResource("6_ihf71") [node name="TrackLine" type="Line2D" parent="DrawNode"] @@ -53,7 +55,7 @@ loop = false [node name="Sprite2D" type="Sprite2D" parent="DrawNode/TrackPath/TrackFollower"] visible = false scale = Vector2(0.604, 0.604) -texture = ExtResource("3_cgigr") +texture = ExtResource("7_bofa3") [node name="31005" type="Timer" parent="DrawNode/TrackPath/TrackFollower"] wait_time = 0.2 @@ -61,13 +63,4 @@ one_shot = true [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) - [connection signal="mouse_entered" from="FinishLine/Area2D" to="DrawNode" method="_end_drawing"] diff --git a/Scripts/scene_control.gd b/Scripts/scene_control.gd index ce3332f..73d9273 100644 --- a/Scripts/scene_control.gd +++ b/Scripts/scene_control.gd @@ -8,12 +8,12 @@ class_name SceneControl @onready var checkpoints = $Checkpoints.get_children() @onready var ui = $UI/Control @onready var drawing = $DrawNode +@onready var start = $Start var is_driving = false var current_time = 0.0 var game_control -var start func _ready(): @@ -23,8 +23,8 @@ func _ready(): $UI/Control/PostGameUI/RestartButton.pressed.connect(reset_level) $UI/Control/PostGameUI/NextLevelButton.pressed.connect(next_level) - start = $Start as TextureButton - start.pressed.connect(start_drawing) + var start_button = $Start/Start as TextureButton + start_button.pressed.connect(start_drawing) reset_level() |