From 4ab7111e7b021bb66af135cc10c1559f9ad2f771 Mon Sep 17 00:00:00 2001 From: KingGurke Date: Mon, 2 Oct 2023 22:12:20 +0200 Subject: [PATCH] Added retry button, made lv 3 --- src/game/levels/level_1.tscn | 45 +++++++-- src/game/levels/level_3.tscn | 174 +++++++++++++++++++++++++++++++++ src/gui/menu/score_submit.gd | 7 ++ src/gui/menu/score_submit.tscn | 28 +++++- 4 files changed, 243 insertions(+), 11 deletions(-) create mode 100644 src/game/levels/level_3.tscn diff --git a/src/game/levels/level_1.tscn b/src/game/levels/level_1.tscn index 8dd692c..271c666 100644 --- a/src/game/levels/level_1.tscn +++ b/src/game/levels/level_1.tscn @@ -25,6 +25,7 @@ point_count = 7 script = ExtResource("1_s3rsn") starting_width = 400.0 shrink_factor = 5.0 +max_distance_offset = 5.0 path = NodePath("TrackPath") line = NodePath("TrackLine") player = NodePath("player") @@ -33,10 +34,10 @@ menu = NodePath("CanvasLayer/menu_box") [node name="EditingBG" type="TextureRect" parent="."] self_modulate = Color(0.0313726, 0.737255, 0, 1) -offset_left = -13640.0 -offset_top = -10315.0 -offset_right = 43910.0 -offset_bottom = 33829.0 +offset_left = -13625.0 +offset_top = -10313.0 +offset_right = 43925.0 +offset_bottom = 33831.0 scale = Vector2(0.5, 0.5) texture = ExtResource("2_4qg8j") stretch_mode = 1 @@ -102,10 +103,8 @@ layout_mode = 1 [node name="Sign" parent="Node2D2" instance=ExtResource("8_i27bq")] light_mask = 7 -position = Vector2(-7592, -6933) -rotation = -0.451921 -scale = Vector2(36.1222, 29.4521) -energy = 8.0 +position = Vector2(-2102, 196) +rotation = 0.439265 [node name="Arrow_light_1" parent="Node2D2" instance=ExtResource("9_om2g6")] position = Vector2(-4310.93, -5419.8) @@ -119,6 +118,36 @@ rotation = 1.27233 position = Vector2(-6857.93, -4664.8) rotation = 1.53565 +[node name="Sign2" parent="Node2D2" instance=ExtResource("8_i27bq")] +light_mask = 7 +position = Vector2(-2019, 9) +rotation = 0.439265 + +[node name="Sign3" parent="Node2D2" instance=ExtResource("8_i27bq")] +light_mask = 7 +position = Vector2(-1582, 2034) +rotation = -1.25741 + +[node name="Sign4" parent="Node2D2" instance=ExtResource("8_i27bq")] +light_mask = 7 +position = Vector2(-1297, 2113) +rotation = -1.31406 + +[node name="Sign5" parent="Node2D2" instance=ExtResource("8_i27bq")] +light_mask = 7 +position = Vector2(2557, 132) +rotation = -4.01318 + +[node name="Sign6" parent="Node2D2" instance=ExtResource("8_i27bq")] +light_mask = 7 +position = Vector2(2760, 306) +rotation = -3.87817 + +[node name="Sign7" parent="Node2D2" instance=ExtResource("8_i27bq")] +light_mask = 7 +position = Vector2(-2181, 391) +rotation = 0.413662 + [node name="Node2D" type="Node2D" parent="."] visible = false diff --git a/src/game/levels/level_3.tscn b/src/game/levels/level_3.tscn new file mode 100644 index 0000000..2acfa63 --- /dev/null +++ b/src/game/levels/level_3.tscn @@ -0,0 +1,174 @@ +[gd_scene load_steps=15 format=3 uid="uid://cnumqjk16txi8"] + +[ext_resource type="Script" path="res://src/game/levels/level.gd" id="1_nto0b"] +[ext_resource type="Texture2D" uid="uid://gjr7tbyrdo6e" path="res://assets/bkbg.png" id="2_wrsa7"] +[ext_resource type="Texture2D" uid="uid://dio3rrptd6w7c" path="res://assets/bg_90_bk.png" id="3_wk5nu"] +[ext_resource type="Texture2D" uid="uid://ds0un04pocx6i" path="res://assets/track_90_bk.png" id="4_von4u"] +[ext_resource type="Texture2D" uid="uid://dmcrms0qu0mtt" path="res://assets/finish2.png" id="5_3dae3"] +[ext_resource type="PackedScene" uid="uid://ckau5s2tsb3oc" path="res://src/game/player.tscn" id="6_s3m1a"] +[ext_resource type="PackedScene" uid="uid://cdlbh3smpgg42" path="res://src/gui/hud/hud.tscn" id="7_wvwuj"] +[ext_resource type="PackedScene" uid="uid://c0sexrwxdge73" path="res://src/gui/menu/level.tscn" id="8_s6qwc"] +[ext_resource type="PackedScene" uid="uid://ya1ctigi23wa" path="res://assets/sign.tscn" id="9_j8hxc"] +[ext_resource type="PackedScene" uid="uid://ebmku7hq0mxi" path="res://assets/arrow_light_1.tscn" id="10_hylbo"] +[ext_resource type="PackedScene" uid="uid://da1mcxm6jcpbo" path="res://assets/arrow_light_2.tscn" id="11_wq72b"] +[ext_resource type="PackedScene" uid="uid://c0v3ix36w45d3" path="res://assets/arrow_light_3.tscn" id="12_8hmne"] +[ext_resource type="AudioStream" uid="uid://dh5jxxwim7ra8" path="res://assets/sounds/music/death_by_waveshaper.wav" id="14_l3kca"] + +[sub_resource type="Curve2D" id="Curve2D_ll8bj"] +_data = { +"points": PackedVector2Array(-266.985, 4.23785, 266.985, -4.23785, 109.978, -70.3514, -513.815, 18.9911, 513.815, -18.9911, 1857.14, -93.007, -369.12, -11.9501, 369.12, 11.9501, 2802.14, -548.007, -427.449, 4.45711, 427.449, -4.45711, 4279.14, 483.993, -176.023, 336.585, 176.023, -336.585, 5375.14, 120.993, 95.3432, 714.279, -95.3432, -714.279, 5591.14, -1478.01, 452.857, 245.161, -452.857, -245.161, 4646.14, -2887.01, 539.983, 67.2156, -539.983, -67.2156, 2444.14, -3657.01, 548.897, -21.3095, -548.897, 21.3095, 270.142, -3728.01, 558.343, -328.604, -558.343, 328.604, -1672.86, -3239.01, 130.438, -383.199, -130.438, 383.199, -2578.86, -1684.01, -290.494, -376.102, 290.494, 376.102, -2102.86, -438.007, -274.272, 8.4734, 274.272, -8.4734, -608.498, -80.6266, 0, 0, 0, 0, 109.978, -70.3514) +} +point_count = 14 + +[node name="level1" type="Node2D" node_paths=PackedStringArray("path", "line", "player", "finish", "menu")] +script = ExtResource("1_nto0b") +starting_width = 400.0 +shrink_factor = 5.0 +max_distance_offset = 5.0 +level_nr = 3 +path = NodePath("TrackPath") +line = NodePath("TrackLine") +player = NodePath("player") +finish = NodePath("FinishLine") +menu = NodePath("CanvasLayer/menu_box") + +[node name="EditingBG" type="TextureRect" parent="."] +self_modulate = Color(0.0313726, 0.737255, 0, 1) +offset_left = -13662.0 +offset_top = -10349.0 +offset_right = 43888.0 +offset_bottom = 33795.0 +scale = Vector2(0.5, 0.5) +texture = ExtResource("2_wrsa7") +stretch_mode = 1 + +[node name="Background" type="TextureRect" parent="."] +visible = false +self_modulate = Color(0.827451, 0.521569, 0.713726, 1) +offset_left = -10392.0 +offset_top = -8149.0 +offset_right = 34096.0 +offset_bottom = 24335.0 +scale = Vector2(0.5, 0.5) +texture = ExtResource("3_wk5nu") +stretch_mode = 1 + +[node name="TrackPath" type="Path2D" parent="."] +curve = SubResource("Curve2D_ll8bj") + +[node name="TrackLine" type="Line2D" parent="."] +self_modulate = Color(0.321569, 0.145098, 0.858824, 1) +texture_repeat = 2 +texture = ExtResource("4_von4u") +texture_mode = 2 +begin_cap_mode = 2 + +[node name="FinishLine" type="Line2D" parent="."] +texture_repeat = 2 +width = 40.0 +texture = ExtResource("5_3dae3") +texture_mode = 1 +begin_cap_mode = 2 +end_cap_mode = 2 +round_precision = 32 +antialiased = true + +[node name="player" parent="." instance=ExtResource("6_s3m1a")] +position = Vector2(27, -55) +brake_strength = 800.0 + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="hud" parent="CanvasLayer" instance=ExtResource("7_wvwuj")] +size_flags_horizontal = 3 + +[node name="menu_box" type="Control" parent="CanvasLayer"] +visible = false +layout_mode = 3 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -20.0 +offset_right = 20.0 +offset_bottom = 20.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="level" parent="CanvasLayer/menu_box" instance=ExtResource("8_s6qwc")] +layout_mode = 1 + +[node name="Node2D2" type="Node2D" parent="."] +position = Vector2(117, -85) + +[node name="Sign" parent="Node2D2" instance=ExtResource("9_j8hxc")] +light_mask = 7 +position = Vector2(-7592, -6933) +rotation = -0.451921 +scale = Vector2(36.1222, 29.4521) +energy = 8.0 + +[node name="Arrow_light_1x" parent="Node2D2" instance=ExtResource("10_hylbo")] +position = Vector2(1451, -19) +rotation = 1.54091 + +[node name="Arrow_light_2x" parent="Node2D2" instance=ExtResource("11_wq72b")] +position = Vector2(4817, 495) +rotation = 1.16486 + +[node name="Arrow_light_3x" parent="Node2D2" instance=ExtResource("12_8hmne")] +position = Vector2(3926, -3065) +rotation = -1.06685 + +[node name="Sign2" parent="Node2D2" instance=ExtResource("9_j8hxc")] +light_mask = 7 +position = Vector2(2073, -131) +rotation = -2.15817 + +[node name="Sign3" parent="Node2D2" instance=ExtResource("9_j8hxc")] +light_mask = 7 +position = Vector2(2619, -474) +rotation = -4.78017 + +[node name="Sign4" parent="Node2D2" instance=ExtResource("9_j8hxc")] +light_mask = 7 +position = Vector2(3428, 72.0001) +rotation = -0.789446 + +[node name="Arrow_light_2x2" parent="Node2D2" instance=ExtResource("11_wq72b")] +position = Vector2(5490, -1061) +rotation = -0.0642122 + +[node name="Arrow_light_2x3" parent="Node2D2" instance=ExtResource("11_wq72b")] +position = Vector2(5135, -2277) +rotation = -0.655069 + +[node name="Arrow_light_3x2" parent="Node2D2" instance=ExtResource("12_8hmne")] +position = Vector2(2394, -3578) +rotation = -1.43785 + +[node name="Arrow_light_2x4" parent="Node2D2" instance=ExtResource("11_wq72b")] +position = Vector2(206, -3659) +rotation = -1.58244 + +[node name="Arrow_light_2x5" parent="Node2D2" instance=ExtResource("11_wq72b")] +position = Vector2(-1802, -3167) +rotation = -2.30423 + +[node name="Arrow_light_2x6" parent="Node2D2" instance=ExtResource("11_wq72b")] +position = Vector2(-2728, -1371) +rotation = -3.09825 + +[node name="level_music" type="AudioStreamPlayer" parent="."] +stream = ExtResource("14_l3kca") +volume_db = -29.953 +autoplay = true +bus = &"Music" + +[node name="Editor_Light" type="DirectionalLight2D" parent="."] +editor_only = true + +[connection signal="distance_changed" from="." to="CanvasLayer/hud" method="_on_level_distance_changed"] +[connection signal="speed_changed" from="player" to="CanvasLayer/hud" method="_on_player_speed_changed"] diff --git a/src/gui/menu/score_submit.gd b/src/gui/menu/score_submit.gd index 26a14f2..a66d466 100644 --- a/src/gui/menu/score_submit.gd +++ b/src/gui/menu/score_submit.gd @@ -12,3 +12,10 @@ func _ready(): func _on_sumbit_button_pressed(): pass #insert score sumbitting function here #then proceed to highscore screen + +func _on_retry_button_pressed(): + get_tree().reload_current_scene() + + +func _on_submit_button_pressed(): + pass # Replace with function body. diff --git a/src/gui/menu/score_submit.tscn b/src/gui/menu/score_submit.tscn index ce00b81..5bb8316 100644 --- a/src/gui/menu/score_submit.tscn +++ b/src/gui/menu/score_submit.tscn @@ -50,9 +50,9 @@ anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 offset_left = -49.5 -offset_top = -81.0 +offset_top = -107.0 offset_right = 49.5 -offset_bottom = 7.0 +offset_bottom = -19.0 grow_horizontal = 2 grow_vertical = 2 @@ -70,7 +70,7 @@ layout_mode = 2 placeholder_text = "enter name" expand_to_text_length = true -[node name="SubmitButton" type="Button" parent="Panel"] +[node name="RetryButton" type="Button" parent="Panel"] custom_minimum_size = Vector2(120, 40) layout_mode = 1 anchors_preset = 7 @@ -87,4 +87,26 @@ grow_vertical = 0 size_flags_horizontal = 4 size_flags_vertical = 8 focus_neighbor_bottom = NodePath("../StartButton") +text = "RETRY" + +[node name="SubmitButton" type="Button" parent="Panel"] +custom_minimum_size = Vector2(120, 40) +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -60.0 +offset_top = -204.0 +offset_right = 60.0 +offset_bottom = -164.0 +grow_horizontal = 2 +grow_vertical = 0 +size_flags_horizontal = 4 +size_flags_vertical = 8 +focus_neighbor_bottom = NodePath("../StartButton") text = "SUBMIT" + +[connection signal="pressed" from="Panel/RetryButton" to="." method="_on_retry_button_pressed"] +[connection signal="pressed" from="Panel/SubmitButton" to="." method="_on_submit_button_pressed"]