diff options
-rw-r--r-- | scenes/levels/base_level.gd | 6 | ||||
-rw-r--r-- | scenes/levels/base_level.tscn | 1 | ||||
-rw-r--r-- | scenes/menu.tscn | 1 | ||||
-rw-r--r-- | scenes/pause.gd | 16 | ||||
-rw-r--r-- | scenes/pause.tscn | 21 |
5 files changed, 35 insertions, 10 deletions
diff --git a/scenes/levels/base_level.gd b/scenes/levels/base_level.gd index 7eaf734..a296a3c 100644 --- a/scenes/levels/base_level.gd +++ b/scenes/levels/base_level.gd @@ -6,11 +6,5 @@ onready var pause_menu = $PauseMenu 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_MenuButton_on_click(): - pause_menu.visible = true pause_menu.pause() diff --git a/scenes/levels/base_level.tscn b/scenes/levels/base_level.tscn index 197b8d0..edf0d0d 100644 --- a/scenes/levels/base_level.tscn +++ b/scenes/levels/base_level.tscn @@ -41,5 +41,6 @@ position = Vector2( 722.995, 115.66 ) text = "Menu" [node name="PauseMenu" parent="." instance=ExtResource( 5 )] +visible = false position = Vector2( 155.016, 424.068 ) [connection signal="on_click" from="MenuButton" to="." method="_on_MenuButton_on_click"] diff --git a/scenes/menu.tscn b/scenes/menu.tscn index 3dd2f0c..0a69c87 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -32,5 +32,4 @@ fixed_width = 150 [node name="Logo" parent="." instance=ExtResource( 1 )] position = Vector2( 640, 250 ) rotation = -1.74846e-07 - [connection signal="on_click" from="Exit" to="." method="_on_Exit_on_click"] diff --git a/scenes/pause.gd b/scenes/pause.gd index 546ae93..e705880 100644 --- a/scenes/pause.gd +++ b/scenes/pause.gd @@ -1,8 +1,22 @@ extends Node2D onready var pause_menu = $"." +onready var backgroud = $Control/Sprite func pause(): - pause_menu.pause_mode = PAUSE_MODE_PROCESS + pause_menu.visible = true + pause_menu.pause_mode = PAUSE_MODE_PROCESS # to be save get_tree().paused = true + +func _ready(): + backgroud.modulate.a = 0.5 + + +func _on_Resume_on_click(): + pause_menu.visible = false + get_tree().paused = false + + +func _on_Main_Menu_on_click(): + get_tree().change_scene("res://scenes/menu.tscn") diff --git a/scenes/pause.tscn b/scenes/pause.tscn index 872362f..7164c89 100644 --- a/scenes/pause.tscn +++ b/scenes/pause.tscn @@ -1,21 +1,38 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://components/button.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/pause.gd" type="Script" id=2] +[ext_resource path="res://textures/backgrounds/background_black.png" type="Texture" id=3] [node name="PauseMenu" type="Node2D"] pause_mode = 2 -visible = false script = ExtResource( 2 ) +[node name="Control" type="Control" parent="."] +margin_left = -974.0 +margin_top = -552.0 +margin_right = 957.0 +margin_bottom = 557.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Sprite" type="Sprite" parent="Control"] +position = Vector2( 965.018, 550.197 ) +texture = ExtResource( 3 ) + [node name="Resume" parent="." instance=ExtResource( 1 )] pause_mode = 2 position = Vector2( -1.68179, -50 ) +z_index = 1 text = "Resume" fixed_width = 250 [node name="Main Menu" parent="." instance=ExtResource( 1 )] pause_mode = 2 position = Vector2( -1.68179, 50 ) +z_index = 1 text = "Main Menu" fixed_width = 250 +[connection signal="on_click" from="Resume" to="." method="_on_Resume_on_click"] +[connection signal="on_click" from="Main Menu" to="." method="_on_Main_Menu_on_click"] |