diff --git a/Scenes/Levels/Level1.tscn b/Scenes/Levels/Level1.tscn index 5ea7e60..c623f7e 100644 --- a/Scenes/Levels/Level1.tscn +++ b/Scenes/Levels/Level1.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=21 format=2] [ext_resource path="res://Scripts/Pause.gd" type="Script" id=1] [ext_resource path="res://Scenes/SceneTransitionRect.tscn" type="PackedScene" id=2] @@ -11,12 +11,28 @@ [ext_resource path="res://Assets/Tileset.tres" type="TileSet" id=9] [ext_resource path="res://Scenes/Interactables/Activator.tscn" type="PackedScene" id=10] [ext_resource path="res://Assets/Sprites/Interactables/LightRays.png" type="Texture" id=11] +[ext_resource path="res://addons/gut/fonts/AnonymousPro-Regular.ttf" type="DynamicFontData" id=12] +[ext_resource path="res://addons/gut/fonts/AnonymousPro-Bold.ttf" type="DynamicFontData" id=13] +[ext_resource path="res://Scenes/LevelTimer.tscn" type="PackedScene" id=15] +[ext_resource path="res://Scripts/WinScreen.gd" type="Script" id=16] -[sub_resource type="DynamicFont" id=1] +[sub_resource type="DynamicFont" id=3] +size = 110 +font_data = ExtResource( 13 ) + +[sub_resource type="DynamicFont" id=4] +size = 75 +font_data = ExtResource( 12 ) + +[sub_resource type="DynamicFont" id=5] +size = 55 +font_data = ExtResource( 12 ) + +[sub_resource type="DynamicFont" id=6] size = 48 font_data = ExtResource( 8 ) -[sub_resource type="DynamicFont" id=2] +[sub_resource type="DynamicFont" id=7] size = 30 font_data = ExtResource( 7 ) @@ -171,10 +187,95 @@ tile_data = PoolIntArray( -1179579, 0, 65538, -1179578, 0, 65538, -1179577, 0, 6 [node name="LevelGoal" parent="." instance=ExtResource( 4 )] position = Vector2( 16960, -640 ) -sceneTransitionPath = NodePath("../CanvasLayer/SceneTransitionRect") +winScreenPath = NodePath("../CanvasLayer/WinScreen") [node name="CanvasLayer" type="CanvasLayer" parent="."] +[node name="WinScreen" type="Control" parent="CanvasLayer"] +pause_mode = 2 +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 16 ) +__meta__ = { +"_edit_use_anchors_": false +} +pausePath = NodePath("../Pause") + +[node name="WinOverlay" type="ColorRect" parent="CanvasLayer/WinScreen"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 0.470588 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -512.0 +margin_top = -340.0 +margin_right = 513.0 +margin_bottom = -124.0 +custom_fonts/font = SubResource( 3 ) +text = "LEVEL CLEAR" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label2" type="Label" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -512.0 +margin_top = -84.0 +margin_right = 513.0 +margin_bottom = 132.0 +custom_fonts/font = SubResource( 4 ) +text = "TIME" +align = 1 +valign = 1 + +[node name="Control" parent="CanvasLayer/WinScreen" instance=ExtResource( 15 )] +pause_mode = 1 +margin_top = 112.0 +margin_bottom = 112.0 + +[node name="Restart" type="Button" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -256.0 +margin_top = 220.0 +margin_right = 256.0 +margin_bottom = 324.0 +custom_fonts/font = SubResource( 5 ) +text = "RESTART" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Menu" type="Button" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -256.0 +margin_top = 348.0 +margin_right = 256.0 +margin_bottom = 452.0 +custom_fonts/font = SubResource( 5 ) +text = "MENU" +__meta__ = { +"_edit_use_anchors_": false +} + [node name="Pause" type="Control" parent="CanvasLayer"] pause_mode = 2 visible = false @@ -207,14 +308,14 @@ __meta__ = { [node name="Pause" type="Label" parent="CanvasLayer/Pause/PauseOptions"] margin_right = 174.0 margin_bottom = 55.0 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 6 ) text = "Paused" [node name="Resume" type="Button" parent="CanvasLayer/Pause/PauseOptions"] margin_top = 59.0 margin_right = 174.0 margin_bottom = 100.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 7 ) text = "Resume" flat = true align = 0 @@ -223,7 +324,7 @@ align = 0 margin_top = 104.0 margin_right = 174.0 margin_bottom = 145.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 7 ) text = "Menu" flat = true align = 0 @@ -232,7 +333,7 @@ align = 0 margin_top = 149.0 margin_right = 174.0 margin_bottom = 190.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 7 ) text = "Restart" flat = true align = 0 @@ -241,7 +342,7 @@ align = 0 margin_top = 194.0 margin_right = 174.0 margin_bottom = 235.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 7 ) text = "Exit" flat = true align = 0 @@ -255,7 +356,11 @@ margin_right = -253.11 margin_bottom = -149.68 rect_scale = Vector2( 12.5768, 7.37932 ) +[connection signal="pressed" from="CanvasLayer/WinScreen/Restart" to="CanvasLayer/WinScreen" method="_on_Restart_pressed"] +[connection signal="pressed" from="CanvasLayer/WinScreen/Menu" to="CanvasLayer/WinScreen" method="_on_Menu_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Resume" to="CanvasLayer/Pause" method="_on_Resume_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Menu" to="CanvasLayer/Pause" method="_on_Menu_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Restart" to="CanvasLayer/Pause" method="_on_Restart_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Exit" to="CanvasLayer/Pause" method="_on_Exit_pressed"] + +[editable path="CanvasLayer/WinScreen/Control"] diff --git a/Scenes/Levels/Level2.tscn b/Scenes/Levels/Level2.tscn index 93f9794..cca388c 100644 --- a/Scenes/Levels/Level2.tscn +++ b/Scenes/Levels/Level2.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=2] +[gd_scene load_steps=23 format=2] [ext_resource path="res://Scripts/Pause.gd" type="Script" id=1] [ext_resource path="res://Scenes/SceneTransitionRect.tscn" type="PackedScene" id=2] @@ -13,12 +13,28 @@ [ext_resource path="res://Scenes/Enemy/RightCamera.tscn" type="PackedScene" id=11] [ext_resource path="res://Scenes/Interactables/ReceiverDoor.tscn" type="PackedScene" id=12] [ext_resource path="res://Assets/Sprites/Interactables/LightRays.png" type="Texture" id=13] +[ext_resource path="res://Scripts/WinScreen.gd" type="Script" id=14] +[ext_resource path="res://Scenes/LevelTimer.tscn" type="PackedScene" id=15] +[ext_resource path="res://addons/gut/fonts/AnonymousPro-Regular.ttf" type="DynamicFontData" id=16] +[ext_resource path="res://addons/gut/fonts/AnonymousPro-Bold.ttf" type="DynamicFontData" id=17] [sub_resource type="DynamicFont" id=1] +size = 110 +font_data = ExtResource( 17 ) + +[sub_resource type="DynamicFont" id=2] +size = 75 +font_data = ExtResource( 16 ) + +[sub_resource type="DynamicFont" id=6] +size = 55 +font_data = ExtResource( 16 ) + +[sub_resource type="DynamicFont" id=4] size = 48 font_data = ExtResource( 8 ) -[sub_resource type="DynamicFont" id=2] +[sub_resource type="DynamicFont" id=5] size = 30 font_data = ExtResource( 7 ) @@ -234,10 +250,95 @@ texture = ExtResource( 13 ) [node name="LevelGoal" parent="." instance=ExtResource( 4 )] position = Vector2( 9472, -512 ) -sceneTransitionPath = NodePath("../CanvasLayer/SceneTransitionRect") +winScreenPath = NodePath("../CanvasLayer/WinScreen") [node name="CanvasLayer" type="CanvasLayer" parent="."] +[node name="WinScreen" type="Control" parent="CanvasLayer"] +pause_mode = 2 +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 14 ) +__meta__ = { +"_edit_use_anchors_": false +} +pausePath = NodePath("../Pause") + +[node name="WinOverlay" type="ColorRect" parent="CanvasLayer/WinScreen"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 0.470588 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -512.0 +margin_top = -340.0 +margin_right = 513.0 +margin_bottom = -124.0 +custom_fonts/font = SubResource( 1 ) +text = "LEVEL CLEAR" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label2" type="Label" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -512.0 +margin_top = -84.0 +margin_right = 513.0 +margin_bottom = 132.0 +custom_fonts/font = SubResource( 2 ) +text = "TIME" +align = 1 +valign = 1 + +[node name="Control" parent="CanvasLayer/WinScreen" instance=ExtResource( 15 )] +pause_mode = 1 +margin_top = 112.0 +margin_bottom = 112.0 + +[node name="Menu" type="Button" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -256.0 +margin_top = 348.0 +margin_right = 256.0 +margin_bottom = 452.0 +custom_fonts/font = SubResource( 6 ) +text = "MENU" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Restart" type="Button" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -256.0 +margin_top = 220.0 +margin_right = 256.0 +margin_bottom = 324.0 +custom_fonts/font = SubResource( 6 ) +text = "RESTART" +__meta__ = { +"_edit_use_anchors_": false +} + [node name="Pause" type="Control" parent="CanvasLayer"] pause_mode = 2 visible = false @@ -270,14 +371,14 @@ __meta__ = { [node name="Pause" type="Label" parent="CanvasLayer/Pause/PauseOptions"] margin_right = 174.0 margin_bottom = 55.0 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 4 ) text = "Paused" [node name="Resume" type="Button" parent="CanvasLayer/Pause/PauseOptions"] margin_top = 59.0 margin_right = 174.0 margin_bottom = 100.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 5 ) text = "Resume" flat = true align = 0 @@ -286,7 +387,7 @@ align = 0 margin_top = 104.0 margin_right = 174.0 margin_bottom = 145.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 5 ) text = "Menu" flat = true align = 0 @@ -295,7 +396,7 @@ align = 0 margin_top = 149.0 margin_right = 174.0 margin_bottom = 190.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 5 ) text = "Restart" flat = true align = 0 @@ -304,7 +405,7 @@ align = 0 margin_top = 194.0 margin_right = 174.0 margin_bottom = 235.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 5 ) text = "Exit" flat = true align = 0 @@ -318,6 +419,8 @@ margin_right = -253.11 margin_bottom = -149.68 rect_scale = Vector2( 12.5768, 7.37932 ) +[connection signal="pressed" from="CanvasLayer/WinScreen/Menu" to="CanvasLayer/WinScreen" method="_on_Menu_pressed"] +[connection signal="pressed" from="CanvasLayer/WinScreen/Restart" to="CanvasLayer/WinScreen" method="_on_Restart_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Resume" to="CanvasLayer/Pause" method="_on_Resume_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Menu" to="CanvasLayer/Pause" method="_on_Menu_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Restart" to="CanvasLayer/Pause" method="_on_Restart_pressed"] diff --git a/Scenes/Levels/Level3.tscn b/Scenes/Levels/Level3.tscn index b72c8ef..b6f9bd7 100644 --- a/Scenes/Levels/Level3.tscn +++ b/Scenes/Levels/Level3.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=2] +[gd_scene load_steps=26 format=2] [ext_resource path="res://Scripts/Pause.gd" type="Script" id=1] [ext_resource path="res://Scenes/SceneTransitionRect.tscn" type="PackedScene" id=2] @@ -16,12 +16,28 @@ [ext_resource path="res://Assets/Tileset.tres" type="TileSet" id=14] [ext_resource path="res://Scenes/Interactables/Activator.tscn" type="PackedScene" id=15] [ext_resource path="res://Assets/Sprites/Interactables/LightRays.png" type="Texture" id=16] +[ext_resource path="res://Scripts/WinScreen.gd" type="Script" id=17] +[ext_resource path="res://Scenes/LevelTimer.tscn" type="PackedScene" id=18] +[ext_resource path="res://addons/gut/fonts/AnonymousPro-Regular.ttf" type="DynamicFontData" id=19] +[ext_resource path="res://addons/gut/fonts/AnonymousPro-Bold.ttf" type="DynamicFontData" id=20] [sub_resource type="DynamicFont" id=1] +size = 110 +font_data = ExtResource( 20 ) + +[sub_resource type="DynamicFont" id=2] +size = 75 +font_data = ExtResource( 19 ) + +[sub_resource type="DynamicFont" id=6] +size = 55 +font_data = ExtResource( 19 ) + +[sub_resource type="DynamicFont" id=4] size = 48 font_data = ExtResource( 8 ) -[sub_resource type="DynamicFont" id=2] +[sub_resource type="DynamicFont" id=5] size = 30 font_data = ExtResource( 7 ) @@ -220,10 +236,95 @@ texture = ExtResource( 16 ) [node name="LevelGoal" parent="." instance=ExtResource( 4 )] position = Vector2( 13208, -1152 ) -sceneTransitionPath = NodePath("../CanvasLayer/SceneTransitionRect") +winScreenPath = NodePath("../CanvasLayer/WinScreen") [node name="CanvasLayer" type="CanvasLayer" parent="."] +[node name="WinScreen" type="Control" parent="CanvasLayer"] +pause_mode = 2 +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 17 ) +__meta__ = { +"_edit_use_anchors_": false +} +pausePath = NodePath("../Pause") + +[node name="WinOverlay" type="ColorRect" parent="CanvasLayer/WinScreen"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 0.470588 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -512.0 +margin_top = -340.0 +margin_right = 513.0 +margin_bottom = -124.0 +custom_fonts/font = SubResource( 1 ) +text = "LEVEL CLEAR" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label2" type="Label" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -512.0 +margin_top = -84.0 +margin_right = 513.0 +margin_bottom = 132.0 +custom_fonts/font = SubResource( 2 ) +text = "TIME" +align = 1 +valign = 1 + +[node name="Control" parent="CanvasLayer/WinScreen" instance=ExtResource( 18 )] +pause_mode = 1 +margin_top = 112.0 +margin_bottom = 112.0 + +[node name="Restart" type="Button" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -256.0 +margin_top = 220.0 +margin_right = 256.0 +margin_bottom = 324.0 +custom_fonts/font = SubResource( 6 ) +text = "RESTART" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Menu" type="Button" parent="CanvasLayer/WinScreen"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -256.0 +margin_top = 348.0 +margin_right = 256.0 +margin_bottom = 452.0 +custom_fonts/font = SubResource( 6 ) +text = "MENU" +__meta__ = { +"_edit_use_anchors_": false +} + [node name="Pause" type="Control" parent="CanvasLayer"] pause_mode = 2 visible = false @@ -256,14 +357,14 @@ __meta__ = { [node name="Pause" type="Label" parent="CanvasLayer/Pause/PauseOptions"] margin_right = 174.0 margin_bottom = 55.0 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 4 ) text = "Paused" [node name="Resume" type="Button" parent="CanvasLayer/Pause/PauseOptions"] margin_top = 59.0 margin_right = 174.0 margin_bottom = 100.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 5 ) text = "Resume" flat = true align = 0 @@ -272,7 +373,7 @@ align = 0 margin_top = 104.0 margin_right = 174.0 margin_bottom = 145.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 5 ) text = "Menu" flat = true align = 0 @@ -281,7 +382,7 @@ align = 0 margin_top = 149.0 margin_right = 174.0 margin_bottom = 190.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 5 ) text = "Restart" flat = true align = 0 @@ -290,7 +391,7 @@ align = 0 margin_top = 194.0 margin_right = 174.0 margin_bottom = 235.0 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 5 ) text = "Exit" flat = true align = 0 @@ -304,6 +405,8 @@ margin_right = -253.11 margin_bottom = -149.68 rect_scale = Vector2( 12.5768, 7.37932 ) +[connection signal="pressed" from="CanvasLayer/WinScreen/Restart" to="CanvasLayer/WinScreen" method="_on_Restart_pressed"] +[connection signal="pressed" from="CanvasLayer/WinScreen/Menu" to="CanvasLayer/WinScreen" method="_on_Menu_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Resume" to="CanvasLayer/Pause" method="_on_Resume_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Menu" to="CanvasLayer/Pause" method="_on_Menu_pressed"] [connection signal="pressed" from="CanvasLayer/Pause/PauseOptions/Restart" to="CanvasLayer/Pause" method="_on_Restart_pressed"] diff --git a/Scripts/LevelGoal.gd b/Scripts/LevelGoal.gd index 5f66e7e..12b7283 100644 --- a/Scripts/LevelGoal.gd +++ b/Scripts/LevelGoal.gd @@ -1,12 +1,8 @@ extends Node2D -export (NodePath) var sceneTransitionPath - -var sceneTransition - -func _ready(): - sceneTransition = get_node(sceneTransitionPath) +export(NodePath) var winScreenPath : NodePath +onready var winScreen = get_node(winScreenPath) func _on_WinArea2D_body_entered(body): if(body.is_in_group("Player")) : - sceneTransition.transition_to("res://Scenes/MainMenu.tscn") + winScreen.win() diff --git a/Scripts/LevelTimer.gd b/Scripts/LevelTimer.gd index 9ac8da9..b5a6fa7 100644 --- a/Scripts/LevelTimer.gd +++ b/Scripts/LevelTimer.gd @@ -5,6 +5,9 @@ var runTimer : bool = false onready var label = get_node("Label") +func _ready(): + runTimer = true + func _process(delta): if runTimer: time += delta @@ -15,5 +18,3 @@ func _process(delta): label.text = "%02d:%02d:%03d" % [mins, secs, mils] -func _ready(): - runTimer = true diff --git a/Scripts/Pause.gd b/Scripts/Pause.gd index 865be47..98a8a5a 100644 --- a/Scripts/Pause.gd +++ b/Scripts/Pause.gd @@ -2,6 +2,8 @@ onready var _transition_rect := $"../SceneTransitionRect" +var didWin : bool = false + func _input(event): if event.is_action_pressed("pause") and not _transition_rect.isTransitioning: pause() @@ -21,6 +23,9 @@ func _on_Exit_pressed(): get_tree().quit() func pause(): + if didWin: + return + var new_pause_state = not get_tree().paused get_tree().paused = new_pause_state visible = new_pause_state diff --git a/Scripts/WinScreen.gd b/Scripts/WinScreen.gd new file mode 100644 index 0000000..0e6dce1 --- /dev/null +++ b/Scripts/WinScreen.gd @@ -0,0 +1,24 @@ +extends Control + +export(NodePath) var pausePath : NodePath + +onready var _transition_rect := $"../SceneTransitionRect" +onready var timer = get_node("Control") + +var didWin : bool = false + +func win(): + if not didWin: + visible = true + timer.runTimer = false + get_tree().paused = true + didWin = true + get_node(pausePath).didWin = true + +func _on_Menu_pressed(): + get_tree().paused = false + _transition_rect.transition_to("res://Scenes/MainMenu.tscn") + +func _on_Restart_pressed(): + get_tree().paused = false + get_tree().reload_current_scene()