diff options
author | perivesta <> | 2023-07-08 15:53:37 +0200 |
---|---|---|
committer | perivesta <> | 2023-07-08 15:53:37 +0200 |
commit | 9573d3ae4170f43f7f65224a16db7ad161a11e28 (patch) | |
tree | aca31f8254e6e2876ade6472febf8ad003bfea18 | |
parent | bf17c8a97b77cdb783a2751e7ee4a90843a00f06 (diff) | |
download | 2023-9573d3ae4170f43f7f65224a16db7ad161a11e28.tar.gz 2023-9573d3ae4170f43f7f65224a16db7ad161a11e28.tar.bz2 2023-9573d3ae4170f43f7f65224a16db7ad161a11e28.zip |
add main menu, pause menu, basic level
Diffstat (limited to '')
-rw-r--r-- | Assets/Images/Tab.png | bin | 0 -> 1187 bytes | |||
-rw-r--r-- | Assets/Images/Tab.png.import | 34 | ||||
-rw-r--r-- | Assets/Images/icons8-esc-80.png | bin | 0 -> 1063 bytes | |||
-rw-r--r-- | Assets/Images/icons8-esc-80.png.import | 34 | ||||
-rw-r--r-- | Assets/Images/icons8-maus-26.png | bin | 0 -> 465 bytes | |||
-rw-r--r-- | Assets/Images/icons8-maus-26.png.import | 34 | ||||
-rw-r--r-- | Assets/Images/icons8-mausklick-links-26.png | bin | 0 -> 480 bytes | |||
-rw-r--r-- | Assets/Images/icons8-mausklick-links-26.png.import | 34 | ||||
-rw-r--r-- | Assets/fonts/Roboto-Medium.ttf | bin | 0 -> 168644 bytes | |||
-rw-r--r-- | Assets/fonts/Roboto-Medium.ttf.import | 33 | ||||
-rw-r--r-- | Assets/fonts/Roboto.zip | bin | 0 -> 1108906 bytes | |||
-rw-r--r-- | Assets/fonts/format.otf | bin | 0 -> 18820 bytes | |||
-rw-r--r-- | Assets/fonts/format.otf.import | 38 | ||||
-rw-r--r-- | Nodes/Level_test.tscn | 31 | ||||
-rw-r--r-- | Nodes/drawing_and_driving.tscn | 2 | ||||
-rw-r--r-- | Nodes/game.tscn | 76 | ||||
-rw-r--r-- | Nodes/main_menu.tscn | 197 | ||||
-rw-r--r-- | Scripts/car_behaviour.gd | 2 | ||||
-rw-r--r-- | Scripts/game.gd | 104 | ||||
-rw-r--r-- | Scripts/main_menu.gd | 25 | ||||
-rw-r--r-- | project.godot | 2 |
21 files changed, 639 insertions, 7 deletions
diff --git a/Assets/Images/Tab.png b/Assets/Images/Tab.png Binary files differnew file mode 100644 index 0000000..0fbebc5 --- /dev/null +++ b/Assets/Images/Tab.png diff --git a/Assets/Images/Tab.png.import b/Assets/Images/Tab.png.import new file mode 100644 index 0000000..ec1d371 --- /dev/null +++ b/Assets/Images/Tab.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://x8v7h1k864pa" +path="res://.godot/imported/Tab.png-5a733af1e7a7340111a3d6726a04658f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Tab.png" +dest_files=["res://.godot/imported/Tab.png-5a733af1e7a7340111a3d6726a04658f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Assets/Images/icons8-esc-80.png b/Assets/Images/icons8-esc-80.png Binary files differnew file mode 100644 index 0000000..994576d --- /dev/null +++ b/Assets/Images/icons8-esc-80.png diff --git a/Assets/Images/icons8-esc-80.png.import b/Assets/Images/icons8-esc-80.png.import new file mode 100644 index 0000000..d8efc5f --- /dev/null +++ b/Assets/Images/icons8-esc-80.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://di55k8elenqfw" +path="res://.godot/imported/icons8-esc-80.png-6abe945fccf15d605ca00ce7229a0d63.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/icons8-esc-80.png" +dest_files=["res://.godot/imported/icons8-esc-80.png-6abe945fccf15d605ca00ce7229a0d63.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Assets/Images/icons8-maus-26.png b/Assets/Images/icons8-maus-26.png Binary files differnew file mode 100644 index 0000000..a91be1c --- /dev/null +++ b/Assets/Images/icons8-maus-26.png diff --git a/Assets/Images/icons8-maus-26.png.import b/Assets/Images/icons8-maus-26.png.import new file mode 100644 index 0000000..f2dd8f3 --- /dev/null +++ b/Assets/Images/icons8-maus-26.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d1ctheqx77tb3" +path="res://.godot/imported/icons8-maus-26.png-eac52e0aec66b25032cf4b12cc5e31d1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/icons8-maus-26.png" +dest_files=["res://.godot/imported/icons8-maus-26.png-eac52e0aec66b25032cf4b12cc5e31d1.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Assets/Images/icons8-mausklick-links-26.png b/Assets/Images/icons8-mausklick-links-26.png Binary files differnew file mode 100644 index 0000000..6e2917c --- /dev/null +++ b/Assets/Images/icons8-mausklick-links-26.png diff --git a/Assets/Images/icons8-mausklick-links-26.png.import b/Assets/Images/icons8-mausklick-links-26.png.import new file mode 100644 index 0000000..8072190 --- /dev/null +++ b/Assets/Images/icons8-mausklick-links-26.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c3hqr4uh3ekx5" +path="res://.godot/imported/icons8-mausklick-links-26.png-9c396c1623349363a01cb5d64adb8640.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/icons8-mausklick-links-26.png" +dest_files=["res://.godot/imported/icons8-mausklick-links-26.png-9c396c1623349363a01cb5d64adb8640.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Assets/fonts/Roboto-Medium.ttf b/Assets/fonts/Roboto-Medium.ttf Binary files differnew file mode 100644 index 0000000..ac0f908 --- /dev/null +++ b/Assets/fonts/Roboto-Medium.ttf diff --git a/Assets/fonts/Roboto-Medium.ttf.import b/Assets/fonts/Roboto-Medium.ttf.import new file mode 100644 index 0000000..a613307 --- /dev/null +++ b/Assets/fonts/Roboto-Medium.ttf.import @@ -0,0 +1,33 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://dvv1ikpl1vu1p" +path="res://.godot/imported/Roboto-Medium.ttf-06662c7ecf4ddeef36f4fd7835376149.fontdata" + +[deps] + +source_file="res://Assets/fonts/Roboto-Medium.ttf" +dest_files=["res://.godot/imported/Roboto-Medium.ttf-06662c7ecf4ddeef36f4fd7835376149.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/Assets/fonts/Roboto.zip b/Assets/fonts/Roboto.zip Binary files differnew file mode 100644 index 0000000..cfc3014 --- /dev/null +++ b/Assets/fonts/Roboto.zip diff --git a/Assets/fonts/format.otf b/Assets/fonts/format.otf Binary files differnew file mode 100644 index 0000000..129be34 --- /dev/null +++ b/Assets/fonts/format.otf diff --git a/Assets/fonts/format.otf.import b/Assets/fonts/format.otf.import new file mode 100644 index 0000000..9dcd0f2 --- /dev/null +++ b/Assets/fonts/format.otf.import @@ -0,0 +1,38 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://b2n2cbthkca0k" +path="res://.godot/imported/format.otf-bffc17fe2c0ae4ec683d5ea3f210c668.fontdata" + +[deps] + +source_file="res://Assets/fonts/format.otf" +dest_files=["res://.godot/imported/format.otf-bffc17fe2c0ae4ec683d5ea3f210c668.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0) +}] +language_support={} +script_support={} +opentype_features={} diff --git a/Nodes/Level_test.tscn b/Nodes/Level_test.tscn index 4fa88fe..1928496 100644 --- a/Nodes/Level_test.tscn +++ b/Nodes/Level_test.tscn @@ -1,11 +1,16 @@ -[gd_scene load_steps=5 format=3 uid="uid://ct2kxw1rrjryo"] +[gd_scene load_steps=8 format=3 uid="uid://ct2kxw1rrjryo"] +[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://cfolt02ucvo3d" path="res://Nodes/drawing.tscn" id="4_t4rjk"] +[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"] + +[sub_resource type="Curve2D" id="Curve2D_0exre"] [node name="Level_test" type="Node2D"] +script = ExtResource("1_0esj3") [node name="Start" type="Sprite2D" parent="."] position = Vector2(669, 515) @@ -27,4 +32,24 @@ texture = ExtResource("3_cgigr") position = Vector2(404, 145) texture = ExtResource("3_cgigr") -[node name="Drawing" parent="." instance=ExtResource("4_t4rjk")] +[node name="Car" parent="." instance=ExtResource("4_xvobs")] +max_speed = 500 +acceleration = 0.05 + +[node name="DrawNode" type="Node2D" parent="."] +script = ExtResource("5_x7h3g") + +[node name="TrackLine" type="Line2D" parent="DrawNode"] + +[node name="TrackPath" type="Path2D" parent="DrawNode"] +curve = SubResource("Curve2D_0exre") + +[node name="TrackFollower" type="PathFollow2D" parent="DrawNode/TrackPath"] + +[node name="Sprite2D" type="Sprite2D" parent="DrawNode/TrackPath/TrackFollower"] +scale = Vector2(0.604, 0.604) +texture = ExtResource("3_cgigr") + +[node name="31005" type="Timer" parent="DrawNode/TrackPath/TrackFollower"] +wait_time = 0.2 +one_shot = true diff --git a/Nodes/drawing_and_driving.tscn b/Nodes/drawing_and_driving.tscn index 865fd4e..01f0787 100644 --- a/Nodes/drawing_and_driving.tscn +++ b/Nodes/drawing_and_driving.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=6 format=3 uid="uid://cb06k14t2slax"] +[gd_scene load_steps=6 format=3 uid="uid://bj5wruvb2hg20"] [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"] diff --git a/Nodes/game.tscn b/Nodes/game.tscn new file mode 100644 index 0000000..5553ea5 --- /dev/null +++ b/Nodes/game.tscn @@ -0,0 +1,76 @@ +[gd_scene load_steps=3 format=3 uid="uid://b7wp8w46l64vc"] + +[ext_resource type="Script" path="res://Scripts/game.gd" id="1_1dait"] + +[sub_resource type="AudioStream" id="AudioStream_n3sou"] + +[node name="Game" type="Node2D"] +script = ExtResource("1_1dait") + +[node name="JinglePlayer" type="AudioStreamPlayer2D" parent="."] +stream = SubResource("AudioStream_n3sou") +volume_db = 1.0 + +[node name="Evaluation" type="Control" parent="."] +visible = false +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="EvaluationLabel" type="Label" parent="Evaluation"] +layout_mode = 0 +anchor_left = 0.3 +anchor_top = 0.4 +anchor_right = 0.7 +anchor_bottom = 0.5 +text = "Finished +" + +[node name="PausePopup" type="Control" parent="."] +process_mode = 2 +visible = false +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Panel" type="Panel" parent="PausePopup"] +layout_mode = 0 +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="Label" type="Label" parent="PausePopup/Panel"] +layout_mode = 0 +anchor_right = 1.0 +anchor_bottom = 0.3 +text = "Game is Paused" + +[node name="VBoxContainer" type="VBoxContainer" parent="PausePopup/Panel"] +layout_mode = 0 +anchor_top = 0.3 +anchor_right = 1.0 +anchor_bottom = 1.0 +alignment = 1 + +[node name="ResumeButton" type="Button" parent="PausePopup/Panel/VBoxContainer"] +layout_mode = 2 +text = "Resume" + +[node name="MainMenuButton" type="Button" parent="PausePopup/Panel/VBoxContainer"] +layout_mode = 2 +text = "Main Menu" + +[node name="QuitButton" type="Button" parent="PausePopup/Panel/VBoxContainer"] +layout_mode = 2 +text = "Quit" + +[node name="LoadedLevel" type="Node2D" parent="."] + +[connection signal="pressed" from="PausePopup/Panel/VBoxContainer/ResumeButton" to="." method="_on_ResumeButton_pressed"] +[connection signal="pressed" from="PausePopup/Panel/VBoxContainer/MainMenuButton" to="." method="_on_MainMenuButton_pressed"] +[connection signal="pressed" from="PausePopup/Panel/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] diff --git a/Nodes/main_menu.tscn b/Nodes/main_menu.tscn new file mode 100644 index 0000000..96928fb --- /dev/null +++ b/Nodes/main_menu.tscn @@ -0,0 +1,197 @@ +[gd_scene load_steps=16 format=3 uid="uid://cqskj7j8bqmd5"] + +[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"] + +[sub_resource type="FontFile" id="1"] +fallbacks = Array[Font]([ExtResource("7")]) +face_index = null +embolden = null +transform = null +cache/0/16/0/ascent = 0.0 +cache/0/16/0/descent = 0.0 +cache/0/16/0/underline_position = 0.0 +cache/0/16/0/underline_thickness = 0.0 +cache/0/16/0/scale = 1.0 +cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0) + +[sub_resource type="StyleBoxFlat" id="2"] +content_margin_top = 10.0 +content_margin_bottom = 10.0 +bg_color = Color(0.4, 0.337255, 0.313726, 0.32549) + +[sub_resource type="StyleBoxFlat" id="3"] +content_margin_top = 10.0 +content_margin_bottom = 10.0 +bg_color = Color(0.176471, 0.14902, 0.141176, 1) + +[sub_resource type="StyleBoxFlat" id="4"] +content_margin_top = 10.0 +content_margin_bottom = 10.0 +bg_color = Color(0.4, 0.337255, 0.313726, 1) + +[sub_resource type="StyleBoxFlat" id="5"] +content_margin_top = 20.0 +content_margin_bottom = 20.0 +bg_color = Color(0.290196, 0.247059, 0.231373, 1) + +[sub_resource type="StyleBoxFlat" id="6"] +content_margin_top = 10.0 +content_margin_bottom = 10.0 +bg_color = Color(0.176471, 0.14902, 0.141176, 1) + +[sub_resource type="FontFile" id="11"] +fallbacks = Array[Font]([ExtResource("7")]) +face_index = null +embolden = null +transform = null +cache/0/16/0/ascent = 0.0 +cache/0/16/0/descent = 0.0 +cache/0/16/0/underline_position = 0.0 +cache/0/16/0/underline_thickness = 0.0 +cache/0/16/0/scale = 1.0 +cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0) + +[sub_resource type="StyleBoxFlat" id="7"] +bg_color = Color(0.160784, 0.133333, 0.133333, 1) + +[sub_resource type="Theme" id="12"] +Button/fonts/font = SubResource("1") +Button/styles/disabled = SubResource("2") +Button/styles/focus = SubResource("3") +Button/styles/hover = SubResource("4") +Button/styles/normal = SubResource("5") +Button/styles/pressed = SubResource("6") +Label/fonts/font = SubResource("11") +Panel/styles/panel = SubResource("7") + +[sub_resource type="LabelSettings" id="LabelSettings_ygt8r"] +font = ExtResource("7") +font_size = 40 + +[sub_resource type="FontFile" id="8"] +subpixel_positioning = 0 +msdf_pixel_range = 14 +msdf_size = 128 +face_index = null +embolden = null +transform = null +cache/0/16/0/ascent = 0.0 +cache/0/16/0/descent = 0.0 +cache/0/16/0/underline_position = 0.0 +cache/0/16/0/underline_thickness = 0.0 +cache/0/16/0/scale = 1.0 +cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0) + +[sub_resource type="FontFile" id="9"] +fallbacks = Array[Font]([SubResource("8")]) +face_index = null +embolden = null +transform = null +cache/0/16/0/ascent = 0.0 +cache/0/16/0/descent = 0.0 +cache/0/16/0/underline_position = 0.0 +cache/0/16/0/underline_thickness = 0.0 +cache/0/16/0/scale = 1.0 +cache/0/16/0/glyphs/0/advance = Vector2(0, 0) +cache/0/16/0/glyphs/0/offset = Vector2(0, 0) +cache/0/16/0/glyphs/0/size = Vector2(0, 0) +cache/0/16/0/glyphs/0/uv_rect = Rect2(0, 0, 0, 0) +cache/0/16/0/glyphs/0/texture_idx = -1 +cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0) + +[sub_resource type="Theme" id="10"] +Button/fonts/font = SubResource("1") +Button/styles/disabled = SubResource("2") +Button/styles/focus = SubResource("3") +Button/styles/hover = SubResource("4") +Button/styles/normal = SubResource("5") +Button/styles/pressed = SubResource("6") +Label/fonts/font = SubResource("9") +Panel/styles/panel = SubResource("7") + +[node name="Menu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("2") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 0 +anchor_right = 0.25 +anchor_bottom = 1.0 +alignment = 2 + +[node name="StartButton" type="Button" parent="VBoxContainer"] +layout_mode = 2 +text = "Start" + +[node name="LevelButton" type="Button" parent="VBoxContainer"] +visible = false +layout_mode = 2 +text = "Levels" + +[node name="QuitButton" type="Button" parent="VBoxContainer"] +layout_mode = 2 +text = "Quit" + +[node name="Label Title" type="Label" parent="."] +layout_mode = 0 +theme = SubResource("12") +text = "Racing Game but Worse" +label_settings = SubResource("LabelSettings_ygt8r") + +[node name="Credits" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.862 +anchor_top = 0.784 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -0.0240479 +offset_top = -0.0320129 +offset_right = -4.0 +offset_bottom = -4.0 + +[node name="Label" type="Label" parent="Credits"] +layout_mode = 2 +text = "CREDITS" + +[node name="Label2" type="Label" parent="Credits"] +layout_mode = 2 +theme = SubResource("10") +text = "[Celeste] +[IceLRemius] +[Perivesta] +" + +[node name="Label Instructions" type="Label" parent="."] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.05 +anchor_top = 0.2 +anchor_right = 0.3 +anchor_bottom = 0.2 +offset_left = -9.6 +offset_top = -50.6 +offset_right = -9.60001 +offset_bottom = -24.6 +text = "HOW TO PLAY" + +[node name="VBoxContainer3" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.05 +anchor_top = 0.25 +anchor_right = 0.3 +anchor_bottom = 0.7 +offset_left = 264.4 +offset_top = 121.0 +offset_right = 264.4 +offset_bottom = 121.0 + +[connection signal="pressed" from="VBoxContainer/StartButton" to="." method="_on_StartButton_pressed"] +[connection signal="pressed" from="VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] diff --git a/Scripts/car_behaviour.gd b/Scripts/car_behaviour.gd index 0463dc1..03546d3 100644 --- a/Scripts/car_behaviour.gd +++ b/Scripts/car_behaviour.gd @@ -99,8 +99,6 @@ func own_movement(delta): var actual_speed = lerpf(velocity.length(), max_speed, acceleration) var actual_angle = lerp_angle(velocity.angle(), desired_velocity.angle(), steer_force) - print("lerped speed: ", actual_speed, " | lerped angle: ", actual_angle) - velocity = Vector2.from_angle(actual_angle) * actual_speed rotation = actual_angle diff --git a/Scripts/game.gd b/Scripts/game.gd new file mode 100644 index 0000000..bacb709 --- /dev/null +++ b/Scripts/game.gd @@ -0,0 +1,104 @@ +extends Node2D + +const NUM_LEVELS = 3 + +# level control +var current_level_id = 0 +var levels = [] +var post_game = false + +var scenes = [ +# preload("res://Nodes/levels/level1/level1.tscn"), +# preload("res://Nodes/levels/level2/level2.tscn") + preload("res://Nodes/Level_test.tscn") + ] + +# Called when the node enters the scene tree for the first time. +func _ready(): +# $JinglePlayer.stream.loop_mode = AudioStream.LOOP_DISABLED + load_scene_by_index(0) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + if Input.is_action_just_pressed("ui_cancel"): + close_scoreboard() + get_tree().paused = true + $PausePopup.show() + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + + +func _on_QuitButton_pressed(): + get_tree().quit() + + +func _on_ResumeButton_pressed(): + print('aaaa') + $PausePopup.hide() + get_tree().paused = false + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + + +func _on_MainMenuButton_pressed(): + get_tree().paused = false + get_tree().change_scene_to_file("res://Nodes/main_menu.tscn") + + +func end_level(): + open_scoreboard() +# evaluate_player(current_strokes, PAR[current_level_id]) + $BGMPLayer.stream_paused = true + $JinglePlayer.play() + post_game = true + + +func open_scoreboard(): +# strokes_per_level[current_level_id] = current_strokes +# $Scoreboard.update_values(strokes_per_level, PAR) +# $Scoreboard.show() + pass + + +func close_scoreboard(): +# $Scoreboard.hide() + pass + + +func is_post_game(): + return post_game + + +func next_level(): + post_game = false + current_level_id += 1 + + if current_level_id >= NUM_LEVELS: + get_tree().change_scene("res://scenes/levels/MainMenu.tscn") + return + + load_scene_by_index(current_level_id) + close_scoreboard() + $Evaluation.hide() + + $BGMPLayer.stream_paused = false + $JinglePlayer.stop() + + +func evaluate_player(strokes, par): + $Evaluation/EvaluationLabel.text = "%d Seconds" % 42 + $Evaluation.show() + + +func _on_JinglePlayer_finished(): + $BGMPLayer.stream_paused = false + + +func load_scene_by_index(index): + # clear level + for n in $LoadedLevel.get_children(): + $LoadedLevel.remove_child(n) + n.queue_free() + + # add new level + var instance = scenes[index].instantiate() + $LoadedLevel.add_child(instance) diff --git a/Scripts/main_menu.gd b/Scripts/main_menu.gd new file mode 100644 index 0000000..3bfe28e --- /dev/null +++ b/Scripts/main_menu.gd @@ -0,0 +1,25 @@ +extends Control + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + + +func _on_StartButton_pressed(): + get_tree().change_scene_to_file("res://Nodes/game.tscn") + + + +func _on_QuitButton_pressed(): + get_tree().quit() diff --git a/project.godot b/project.godot index 46c0223..5ddc5cc 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="CodeWithYourFriends23" -run/main_scene="res://Nodes/drawing_and_driving.tscn" +run/main_scene="res://Nodes/main_menu.tscn" config/features=PackedStringArray("4.0", "Forward Plus") config/icon="res://icon.svg" |