diff --git a/Globla_Data.gd b/Globla_Data.gd index 867ffb1..1a01712 100644 --- a/Globla_Data.gd +++ b/Globla_Data.gd @@ -10,3 +10,4 @@ var doing_puzzle: bool = false var hurtable = false var weapon = 1 var level = 1 +var level2 = 1 diff --git a/assets/sprites/character.tres b/assets/sprites/character.tres index 147efe0..cd0b31c 100644 --- a/assets/sprites/character.tres +++ b/assets/sprites/character.tres @@ -1053,7 +1053,7 @@ animations = [{ "duration": 1.0, "texture": ExtResource("96_534c4") }], -"loop": 1, +"loop": 2, "name": &"death", "speed": 25.0 }, { diff --git a/scenes/levels/level_2.gd b/pause_screen.gd similarity index 59% rename from scenes/levels/level_2.gd rename to pause_screen.gd index 52c046e..0458b5d 100644 --- a/scenes/levels/level_2.gd +++ b/pause_screen.gd @@ -3,9 +3,17 @@ extends Node2D # Called when the node enters the scene tree for the first time. func _ready() -> void: - pass # Replace with function body. + pass # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - GloblaData.doing_puzzle = false + pass + + +func _on_button_pressed() -> void: + $".".queue_free() + get_tree().paused = false + +func _on_button_2_pressed() -> void: + get_tree().quit() diff --git a/pause_screen.gd.uid b/pause_screen.gd.uid new file mode 100644 index 0000000..32528b6 --- /dev/null +++ b/pause_screen.gd.uid @@ -0,0 +1 @@ +uid://duogtg7hc30a6 diff --git a/project.godot b/project.godot index b08ba87..3e9d047 100644 --- a/project.godot +++ b/project.godot @@ -35,6 +35,10 @@ enabled=PackedStringArray("res://addons/phantom_camera/plugin.cfg") import/blender/enabled=false +[global_group] + +pause_scene="" + [input] left={ @@ -102,6 +106,11 @@ gun={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null) ] } +pause={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} [physics] diff --git a/scenes/game_over.gd b/scenes/game_over.gd new file mode 100644 index 0000000..94159a7 --- /dev/null +++ b/scenes/game_over.gd @@ -0,0 +1,21 @@ +extends Node2D + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + + +func _on_button_pressed() -> void: + GloblaData.death_counter = 3 + $".".queue_free() + get_tree().reload_current_scene() + + +func _on_button_2_pressed() -> void: + get_tree().quit() diff --git a/scenes/game_over.gd.uid b/scenes/game_over.gd.uid new file mode 100644 index 0000000..1caa2f7 --- /dev/null +++ b/scenes/game_over.gd.uid @@ -0,0 +1 @@ +uid://qtq5kw1cwxo3 diff --git a/scenes/game_over.tscn b/scenes/game_over.tscn new file mode 100644 index 0000000..1aa30b8 --- /dev/null +++ b/scenes/game_over.tscn @@ -0,0 +1,49 @@ +[gd_scene format=3 uid="uid://dvujc88306mxp"] + +[ext_resource type="Script" uid="uid://qtq5kw1cwxo3" path="res://scenes/game_over.gd" id="1_tbwuq"] +[ext_resource type="FontFile" uid="uid://ddm6ojsaiq20b" path="res://assets/fonts/PixelOperator8-Bold.ttf" id="1_wqhvx"] +[ext_resource type="FontFile" uid="uid://dkytywan8eapf" path="res://assets/fonts/PixelOperator8.ttf" id="2_tbwuq"] + +[node name="game_over" type="Node2D" unique_id=1847116366] +script = ExtResource("1_tbwuq") + +[node name="ColorRect" type="ColorRect" parent="." unique_id=995002747] +z_index = 12 +offset_left = -1264.0 +offset_top = -635.0 +offset_right = 1107.0 +offset_bottom = 534.0 +color = Color(14.806348, 0, 0, 0.34509805) + +[node name="Label" type="Label" parent="." unique_id=677546612] +z_index = 13 +offset_left = -856.0 +offset_top = -334.0 +offset_right = 1019.0 +offset_bottom = -134.0 +theme_override_fonts/font = ExtResource("1_wqhvx") +theme_override_font_sizes/font_size = 200 +text = "GAME OVER!" + +[node name="Button" type="Button" parent="." unique_id=81464495] +z_index = 13 +offset_left = -288.0 +offset_top = 28.0 +offset_right = 358.0 +offset_bottom = 137.0 +theme_override_fonts/font = ExtResource("2_tbwuq") +theme_override_font_sizes/font_size = 100 +text = "Respawn" + +[node name="Button2" type="Button" parent="." unique_id=1126403836] +z_index = 13 +offset_left = -279.0 +offset_top = 205.0 +offset_right = 367.0 +offset_bottom = 314.0 +theme_override_fonts/font = ExtResource("2_tbwuq") +theme_override_font_sizes/font_size = 100 +text = "Quit" + +[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] +[connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"] diff --git a/scenes/level_2.tscn b/scenes/level_2.tscn new file mode 100644 index 0000000..fab7254 --- /dev/null +++ b/scenes/level_2.tscn @@ -0,0 +1,297 @@ +[gd_scene format=3 uid="uid://cbqewrj171ilj"] + +[ext_resource type="PackedScene" uid="uid://cmtdq6tedv1mm" path="res://scenes/player.tscn" id="1_3bmlt"] +[ext_resource type="Script" path="res://scenes/level_2.gd" id="1_jm1iu"] +[ext_resource type="PackedScene" uid="uid://c17txy4vh4wka" path="res://scenes/casset.tscn" id="3_pbc48"] +[ext_resource type="PackedScene" uid="uid://dxx6mxv6x5yws" path="res://scenes/enemy.tscn" id="4_eqxsl"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_aqe1g"] +size = Vector2(3717.5, 151.5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_yg5ta"] +size = Vector2(2563, 123) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_e270b"] +size = Vector2(792, 124.5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_xfo6b"] +size = Vector2(276, 125.5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_bytyy"] +size = Vector2(18.375, 104) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_0u1u7"] +size = Vector2(408, 61) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_4pwya"] +size = Vector2(1181, 143) + +[node name="level2" type="Node2D" unique_id=1987596250] +script = ExtResource("1_jm1iu") + +[node name="ground" type="Control" parent="." unique_id=1187971469] +layout_mode = 3 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="ColorRect" type="ColorRect" parent="ground" unique_id=426446834] +layout_mode = 0 +offset_left = 8.0 +offset_top = 865.0 +offset_right = 3721.0 +offset_bottom = 989.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect2" type="ColorRect" parent="ground" unique_id=1158203769] +layout_mode = 0 +offset_left = 876.0 +offset_top = 423.0 +offset_right = 1668.0 +offset_bottom = 547.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect3" type="ColorRect" parent="ground" unique_id=1987598295] +layout_mode = 0 +offset_left = 1793.0 +offset_top = 153.0 +offset_right = 2070.0 +offset_bottom = 277.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect4" type="ColorRect" parent="ground" unique_id=1231325246] +layout_mode = 0 +offset_left = 2310.0 +offset_top = 148.0 +offset_right = 2365.0 +offset_bottom = 272.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect6" type="ColorRect" parent="ground" unique_id=1323417565] +layout_mode = 0 +offset_left = 2599.0 +offset_top = -105.0 +offset_right = 2654.0 +offset_bottom = 19.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect7" type="ColorRect" parent="ground" unique_id=873117911] +layout_mode = 0 +offset_left = 2848.0 +offset_top = -275.0 +offset_right = 2903.0 +offset_bottom = -151.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect8" type="ColorRect" parent="ground" unique_id=862512216] +layout_mode = 0 +offset_left = 3111.0 +offset_top = -518.0 +offset_right = 3166.0 +offset_bottom = -394.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect9" type="ColorRect" parent="ground" unique_id=1225478351] +layout_mode = 0 +offset_left = 3373.0 +offset_top = -757.0 +offset_right = 3428.0 +offset_bottom = -633.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect10" type="ColorRect" parent="ground" unique_id=1618640032] +layout_mode = 0 +offset_left = 2571.0 +offset_top = -1347.0 +offset_right = 2626.0 +offset_bottom = -1223.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect11" type="ColorRect" parent="ground" unique_id=152893570] +layout_mode = 0 +offset_left = 2302.0 +offset_top = -1630.0 +offset_right = 2357.0 +offset_bottom = -1506.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect12" type="ColorRect" parent="ground" unique_id=1937003888] +layout_mode = 0 +offset_left = 1825.0 +offset_top = -1796.0 +offset_right = 1880.0 +offset_bottom = -1672.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect13" type="ColorRect" parent="ground" unique_id=794448806] +layout_mode = 0 +offset_left = 2987.0 +offset_top = -1111.0 +offset_right = 3042.0 +offset_bottom = -987.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect5" type="ColorRect" parent="ground" unique_id=569891626] +layout_mode = 0 +offset_left = 3720.0 +offset_top = 741.0 +offset_right = 6289.0 +offset_bottom = 865.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect14" type="ColorRect" parent="ground" unique_id=888007918] +layout_mode = 0 +offset_left = 1037.0 +offset_top = -1764.0 +offset_right = 1442.0 +offset_bottom = -1701.0 +color = Color(0, 0.23529412, 0, 1) + +[node name="ColorRect15" type="ColorRect" parent="ground" unique_id=439885816] +layout_mode = 0 +offset_left = 6399.0 +offset_top = 751.0 +offset_right = 6417.0 +offset_bottom = 855.0 +color = Color(1.3897754e-06, 0.32097825, 1.4439226e-07, 1) + +[node name="ColorRect16" type="ColorRect" parent="ground" unique_id=1423398203] +layout_mode = 0 +offset_left = 7319.0 +offset_top = 764.0 +offset_right = 7337.0 +offset_bottom = 868.0 +color = Color(1.3897754e-06, 0.32097825, 1.4439226e-07, 1) + +[node name="ColorRect17" type="ColorRect" parent="ground" unique_id=822568619] +layout_mode = 0 +offset_left = 8318.0 +offset_top = 768.0 +offset_right = 8336.0 +offset_bottom = 872.0 +color = Color(1.3897754e-06, 0.32097825, 1.4439226e-07, 1) + +[node name="ColorRect18" type="ColorRect" parent="ground" unique_id=1414623501] +layout_mode = 0 +offset_left = 8935.0 +offset_top = 447.0 +offset_right = 8953.0 +offset_bottom = 551.0 +color = Color(1.3897754e-06, 0.32097825, 1.4439226e-07, 1) + +[node name="ColorRect19" type="ColorRect" parent="ground" unique_id=462353603] +layout_mode = 0 +offset_left = 9677.0 +offset_top = 785.0 +offset_right = 9695.0 +offset_bottom = 889.0 +color = Color(1.3897754e-06, 0.32097825, 1.4439226e-07, 1) + +[node name="ColorRect20" type="ColorRect" parent="ground" unique_id=1710073146] +layout_mode = 0 +offset_left = 10379.0 +offset_top = 536.0 +offset_right = 11559.0 +offset_bottom = 679.0 +color = Color(1.0648929e-06, 0.3122861, 1.4439226e-07, 1) + +[node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=471962104] +collision_layer = 2 +collision_mask = 5 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" unique_id=1096663356] +position = Vector2(1865.25, 940.75) +shape = SubResource("RectangleShape2D_aqe1g") + +[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D" unique_id=192572670] +position = Vector2(5003.5, 802.5) +shape = SubResource("RectangleShape2D_yg5ta") + +[node name="CollisionShape2D3" type="CollisionShape2D" parent="StaticBody2D" unique_id=896122242] +position = Vector2(1272, 484.75) +shape = SubResource("RectangleShape2D_e270b") + +[node name="CollisionShape2D4" type="CollisionShape2D" parent="StaticBody2D" unique_id=1698934541] +position = Vector2(1931, 215.25) +shape = SubResource("RectangleShape2D_xfo6b") + +[node name="CollisionShape2D5" type="CollisionShape2D" parent="StaticBody2D" unique_id=935128976] +position = Vector2(2627, -45) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D6" type="CollisionShape2D" parent="StaticBody2D" unique_id=318025194] +position = Vector2(2875, -211) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D7" type="CollisionShape2D" parent="StaticBody2D" unique_id=682345200] +position = Vector2(3139, -455) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D8" type="CollisionShape2D" parent="StaticBody2D" unique_id=1733527828] +position = Vector2(3401, -693) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D9" type="CollisionShape2D" parent="StaticBody2D" unique_id=1517783979] +position = Vector2(3014, -1047) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D15" type="CollisionShape2D" parent="StaticBody2D" unique_id=1860761884] +position = Vector2(6408.8125, 803) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D16" type="CollisionShape2D" parent="StaticBody2D" unique_id=1206239722] +position = Vector2(7328, 816) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D17" type="CollisionShape2D" parent="StaticBody2D" unique_id=701106868] +position = Vector2(8327, 820) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D18" type="CollisionShape2D" parent="StaticBody2D" unique_id=900902997] +position = Vector2(8944, 499) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D19" type="CollisionShape2D" parent="StaticBody2D" unique_id=201295496] +position = Vector2(9686, 837) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D10" type="CollisionShape2D" parent="StaticBody2D" unique_id=1408705032] +position = Vector2(2597, -1284) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D11" type="CollisionShape2D" parent="StaticBody2D" unique_id=1742288823] +position = Vector2(2328, -1566) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D12" type="CollisionShape2D" parent="StaticBody2D" unique_id=1088108625] +position = Vector2(1852, -1732) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D13" type="CollisionShape2D" parent="StaticBody2D" unique_id=912985229] +position = Vector2(2337.625, 210) +shape = SubResource("RectangleShape2D_bytyy") + +[node name="CollisionShape2D14" type="CollisionShape2D" parent="StaticBody2D" unique_id=1242493128] +position = Vector2(1240, -1733.5) +shape = SubResource("RectangleShape2D_0u1u7") + +[node name="CollisionShape2D20" type="CollisionShape2D" parent="StaticBody2D" unique_id=1247256848] +position = Vector2(10969.5, 608.5) +shape = SubResource("RectangleShape2D_4pwya") + +[node name="player" parent="." unique_id=1596338883 instance=ExtResource("1_3bmlt")] + +[node name="casset" parent="." unique_id=918954585 instance=ExtResource("3_pbc48")] +position = Vector2(1196, -1831) + +[node name="casset2" parent="." unique_id=46718020 instance=ExtResource("3_pbc48")] +position = Vector2(8923, 371) + +[node name="enemy" parent="." unique_id=1471932521 instance=ExtResource("4_eqxsl")] +position = Vector2(1162, 192) + +[node name="enemy2" parent="." unique_id=1537388686 instance=ExtResource("4_eqxsl")] +position = Vector2(2368, 673) + +[node name="enemy3" parent="." unique_id=972117821 instance=ExtResource("4_eqxsl")] +position = Vector2(4869, 518) diff --git a/scenes/levels/level1.tscn b/scenes/levels/level1.tscn index 6298049..a757ee2 100644 --- a/scenes/levels/level1.tscn +++ b/scenes/levels/level1.tscn @@ -44,9 +44,6 @@ offset_right = 4563.0 offset_bottom = 267.0 color = Color(0, 0.39215687, 0, 1) -[node name="player" parent="." unique_id=1596338883 instance=ExtResource("1_dd0lh")] -position = Vector2(4730, 39) - [node name="enemy" parent="." unique_id=1471932521 instance=ExtResource("2_bfxgj")] position = Vector2(1304, -293) @@ -74,3 +71,6 @@ shape = SubResource("RectangleShape2D_e270b") [node name="Phonebooth" parent="." unique_id=1406086177 instance=ExtResource("5_dywbp")] position = Vector2(6498, 150) + +[node name="player" parent="." unique_id=1596338883 instance=ExtResource("1_dd0lh")] +position = Vector2(2605, 112) diff --git a/scenes/levels/level_2.gd.uid b/scenes/levels/level_2.gd.uid deleted file mode 100644 index c35d729..0000000 --- a/scenes/levels/level_2.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://c0kr0eqjtde28 diff --git a/scenes/levels/level_3.tscn b/scenes/levels/level_3.tscn index 8e41783..8c1d422 100644 --- a/scenes/levels/level_3.tscn +++ b/scenes/levels/level_3.tscn @@ -15,10 +15,6 @@ [node name="Level3" type="Node2D" unique_id=1807632894] script = ExtResource("1_2bnyt") -[node name="player" parent="." unique_id=1596338883 instance=ExtResource("1_fmg3e")] -z_index = 1 -position = Vector2(45, -143) - [node name="enemy" parent="." unique_id=1471932521 instance=ExtResource("2_ftfob")] position = Vector2(1179, -414) @@ -88,3 +84,7 @@ texture = ExtResource("9_n6eey") [node name="casset2" parent="." unique_id=1394348662 groups=["Cassets"] instance=ExtResource("3_fkk1g")] z_index = 1 position = Vector2(3628, -26) + +[node name="player" parent="." unique_id=1596338883 instance=ExtResource("1_fmg3e")] +z_index = 1 +position = Vector2(45, -143) diff --git a/scenes/pause_screen.tscn b/scenes/pause_screen.tscn new file mode 100644 index 0000000..3b8b235 --- /dev/null +++ b/scenes/pause_screen.tscn @@ -0,0 +1,44 @@ +[gd_scene format=3 uid="uid://0qbm646wkcl2"] + +[ext_resource type="Script" uid="uid://duogtg7hc30a6" path="res://pause_screen.gd" id="1_qeunj"] +[ext_resource type="FontFile" uid="uid://dkytywan8eapf" path="res://assets/fonts/PixelOperator8.ttf" id="2_hr2n2"] + +[node name="pause_screen" type="Node2D" unique_id=1046560820 groups=["pause_scene"]] +script = ExtResource("1_qeunj") + +[node name="ColorRect" type="ColorRect" parent="." unique_id=1229507916] +offset_left = -1132.0 +offset_top = -543.0 +offset_right = 1040.0 +offset_bottom = 593.0 +color = Color(0, 0.7254902, 0, 0.28235295) + +[node name="Label" type="Label" parent="." unique_id=220159306] +offset_left = -591.0 +offset_top = -336.0 +offset_right = 459.0 +offset_bottom = -136.0 +theme_override_fonts/font = ExtResource("2_hr2n2") +theme_override_font_sizes/font_size = 200 +text = "Paused" + +[node name="Button" type="Button" parent="." unique_id=1467636182] +offset_left = -341.0 +offset_top = -55.0 +offset_right = 217.0 +offset_bottom = 54.0 +theme_override_fonts/font = ExtResource("2_hr2n2") +theme_override_font_sizes/font_size = 100 +text = "resume" + +[node name="Button2" type="Button" parent="." unique_id=814575465] +offset_left = -329.0 +offset_top = 122.0 +offset_right = 229.0 +offset_bottom = 231.0 +theme_override_fonts/font = ExtResource("2_hr2n2") +theme_override_font_sizes/font_size = 100 +text = "quit" + +[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] +[connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"] diff --git a/scenes/player.tscn b/scenes/player.tscn index bb01408..02041b3 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -28,7 +28,7 @@ script = ExtResource("1_3vyb7") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1624841443] position = Vector2(53, 36.00006) sprite_frames = ExtResource("3_qhqgy") -animation = &"jump" +animation = &"death" [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1496788104] position = Vector2(57.5, 34) @@ -62,24 +62,25 @@ metadata/_edit_use_anchors_ = true position = Vector2(112, 38) [node name="Label" type="Label" parent="." unique_id=519077191] -offset_left = -722.0 -offset_top = -416.0 -offset_right = -689.0 -offset_bottom = -382.0 +offset_left = -687.0 +offset_top = -389.0 +offset_right = -654.0 +offset_bottom = -355.0 theme_override_fonts/font = ExtResource("2_g2els") theme_override_font_sizes/font_size = 25 text = "0" [node name="Label2" type="Label" parent="." unique_id=1907510281] -offset_left = -924.0 -offset_top = -417.0 -offset_right = -672.0 -offset_bottom = -383.0 +offset_left = -889.0 +offset_top = -390.0 +offset_right = -637.0 +offset_bottom = -356.0 theme_override_fonts/font = ExtResource("2_g2els") theme_override_font_sizes/font_size = 25 text = "cassets:" [node name="ColorRect5" type="ColorRect" parent="." unique_id=823301403] +visible = false offset_left = 107.0 offset_top = 47.0 offset_right = 119.0 @@ -131,4 +132,5 @@ metadata/_custom_type_script = "uid://bhexx6mj1xv3q" [node name="SpeechMarker" type="Marker2D" parent="." unique_id=1534560136] position = Vector2(51, -86) +[connection signal="dead" from="." to="." method="_on_dead"] [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] diff --git a/scripts/UltimatePlatformerController.gd b/scripts/UltimatePlatformerController.gd index deb37d3..9b27072 100644 --- a/scripts/UltimatePlatformerController.gd +++ b/scripts/UltimatePlatformerController.gd @@ -119,7 +119,7 @@ var slash = 300 @export var roll: bool var projectile = preload("res://scenes/projectile.tscn") - +signal dead #Variables determined by the developer set ones. var appliedGravity: float var maxSpeedLock: float @@ -326,6 +326,7 @@ func _process(_delta): var dir: bool = 1 func _physics_process(delta): + print(GloblaData.death_counter) if Input.is_action_just_pressed("slash_weapon"): weapon = 1 GloblaData.weapon = 1 @@ -341,6 +342,11 @@ func _physics_process(delta): $ColorRect5.rotation = -130 dir = 0 if GloblaData.doing_puzzle == false: + if Input.is_action_just_pressed("pause"): + toggle_paused() + + + if Input.is_action_just_pressed("right"): $ColorRect5.global_position = $Marker2D3.global_position $ColorRect5.rotation = 130 @@ -364,12 +370,16 @@ func _physics_process(delta): if GloblaData.doing_puzzle: velocity = Vector2(0, 0) - if GloblaData.death_counter == 0: - get_tree().quit() + if GloblaData.death_counter <= 0: + $AnimatedSprite2D.play("death") + emit_signal("dead") + dead.disconnect(_on_dead) if GloblaData.death_counter == 2: $ColorRect3.hide() elif GloblaData.death_counter == 1: $ColorRect4.hide() + elif GloblaData.death_counter == 0: + $ColorRect2.hide() if !dset: gdelta = delta dset = true @@ -396,34 +406,34 @@ func _physics_process(delta): if weapon == 1: anim_preamble = "sword_" - - if !is_on_floor(): - $AnimatedSprite2D.animation = "%sjump" % anim_preamble - $AnimatedSprite2D.play() - elif (leftHold or rightHold) and Input.is_action_just_pressed("fire") and weapon == 2: - $AnimatedSprite2D.animation = "run_shoot" - $AnimatedSprite2D.play() - elif (leftHold or rightHold) and Input.is_action_just_pressed("fire") and weapon == 1: - $AnimatedSprite2D.animation = "sword_run_swing" - $AnimatedSprite2D.play() - elif leftHold or rightHold: - $AnimatedSprite2D.animation = "%srun" % anim_preamble - $AnimatedSprite2D.play() - elif runHold: - $AnimatedSprite2D.animation = "%srun" % anim_preamble - $AnimatedSprite2D.play() - elif Input.is_action_just_pressed("fire") and weapon == 2: - $AnimatedSprite2D.animation = "shoot" - $AnimatedSprite2D.play() - elif Input.is_action_just_pressed("fire") and weapon == 1: - $AnimatedSprite2D.animation = "sword_swing" - $AnimatedSprite2D.play() - else: - $AnimatedSprite2D.animation = "%sidle" % anim_preamble - $AnimatedSprite2D.play() + if GloblaData.death_counter > 0: + if !is_on_floor(): + $AnimatedSprite2D.animation = "%sjump" % anim_preamble + $AnimatedSprite2D.play() + elif (leftHold or rightHold) and Input.is_action_just_pressed("fire") and weapon == 2: + $AnimatedSprite2D.animation = "run_shoot" + $AnimatedSprite2D.play() + elif (leftHold or rightHold) and Input.is_action_just_pressed("fire") and weapon == 1: + $AnimatedSprite2D.animation = "sword_run_swing" + $AnimatedSprite2D.play() + elif leftHold or rightHold: + $AnimatedSprite2D.animation = "%srun" % anim_preamble + $AnimatedSprite2D.play() + elif runHold: + $AnimatedSprite2D.animation = "%srun" % anim_preamble + $AnimatedSprite2D.play() + elif Input.is_action_just_pressed("fire") and weapon == 2: + $AnimatedSprite2D.animation = "shoot" + $AnimatedSprite2D.play() + elif Input.is_action_just_pressed("fire") and weapon == 1: + $AnimatedSprite2D.animation = "sword_swing" + $AnimatedSprite2D.play() + else: + $AnimatedSprite2D.animation = "%sidle" % anim_preamble + $AnimatedSprite2D.play() #INFO Left and Right Movement - if GloblaData.doing_puzzle == false: + if GloblaData.doing_puzzle == false and GloblaData.death_counter > 0: if rightHold and leftHold and movementInputMonitoring: if !instantStop: _decelerate(delta, false) @@ -511,7 +521,7 @@ func _physics_process(delta): pass #INFO Jump and Gravity - if GloblaData.doing_puzzle == false: + if GloblaData.doing_puzzle == false and GloblaData.death_counter > 0: if velocity.y > 0: appliedGravity = gravityScale * descendingGravityFactor else: @@ -758,3 +768,18 @@ func shoot(): func _on_timer_timeout() -> void: GloblaData.hurtable = false + + +func _on_dead() -> void: + var death_scene = preload("res://scenes/game_over.tscn") + var instance = death_scene.instantiate() + $".".add_child(instance) + + +func toggle_paused(): + var pause = preload("res://scenes/pause_screen.tscn") + var instace = pause.instantiate() + $"..".add_child(instace) + instace.position = $"..".global_position + get_tree().paused = true +