Improve pause menu
This commit is contained in:
2 files changed
+29
-18
No files matched your search
@@ -1,9 +1,9 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://cs22tndewcohw"]
|
[gd_scene format=3 uid="uid://cs22tndewcohw"]
|
||||||
|
|
||||||
[ext_resource type="FontFile" uid="uid://dq7nkk7n7wrq4" path="res://Fonts/Lexend.ttf" id="1_lj4oq"]
|
[ext_resource type="FontFile" uid="uid://dq7nkk7n7wrq4" path="res://Fonts/Lexend.ttf" id="1_bech0"]
|
||||||
[ext_resource type="Script" uid="uid://bc4miccifwrk0" path="res://Scripts/SceneSwitcher.cs" id="2_qwhev"]
|
[ext_resource type="Script" uid="uid://bc4miccifwrk0" path="res://Scripts/SceneSwitcher.cs" id="2_s3wmd"]
|
||||||
[ext_resource type="Script" uid="uid://cmvj0ubia5hbv" path="res://Scripts/PauseMenuContinueButton.cs" id="3_5w4ur"]
|
[ext_resource type="Script" uid="uid://cqvgtx6usjjys" path="res://Scripts/BackToMenuLogic.cs" id="3_yl41b"]
|
||||||
[ext_resource type="Script" uid="uid://cqvgtx6usjjys" path="res://Scripts/BackToMenuLogic.cs" id="3_ey1tb"]
|
[ext_resource type="Script" uid="uid://cmvj0ubia5hbv" path="res://Scripts/PauseMenuContinueButton.cs" id="4_adtx4"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qwhev"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qwhev"]
|
||||||
bg_color = Color(1, 1, 1, 1)
|
bg_color = Color(1, 1, 1, 1)
|
||||||
@@ -26,7 +26,7 @@ corner_radius_top_right = 5
|
|||||||
corner_radius_bottom_right = 5
|
corner_radius_bottom_right = 5
|
||||||
corner_radius_bottom_left = 5
|
corner_radius_bottom_left = 5
|
||||||
|
|
||||||
[node name="PauseMenu" type="Control"]
|
[node name="PauseMenu" type="Control" unique_id=1316440612]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -34,7 +34,7 @@ anchor_bottom = 1.0
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="Background" type="ColorRect" parent="."]
|
[node name="Background" type="ColorRect" parent="." unique_id=1691929068]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -43,7 +43,7 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
color = Color(0, 0, 0, 0.49803922)
|
color = Color(0, 0, 0, 0.49803922)
|
||||||
|
|
||||||
[node name="Buttons" type="HBoxContainer" parent="."]
|
[node name="Buttons" type="HBoxContainer" parent="." unique_id=33125127]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
@@ -59,7 +59,7 @@ grow_vertical = 2
|
|||||||
theme_override_constants/separation = 50
|
theme_override_constants/separation = 50
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="Menu" type="Button" parent="Buttons"]
|
[node name="Menu" type="Button" parent="Buttons" unique_id=1222672524]
|
||||||
custom_minimum_size = Vector2(500, 0)
|
custom_minimum_size = Vector2(500, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||||
@@ -68,22 +68,22 @@ theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
|
|||||||
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
|
||||||
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
|
||||||
theme_override_colors/font_disabled_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_disabled_color = Color(0, 0, 0, 1)
|
||||||
theme_override_fonts/font = ExtResource("1_lj4oq")
|
theme_override_fonts/font = ExtResource("1_bech0")
|
||||||
theme_override_font_sizes/font_size = 56
|
theme_override_font_sizes/font_size = 56
|
||||||
theme_override_styles/normal = SubResource("StyleBoxFlat_qwhev")
|
theme_override_styles/normal = SubResource("StyleBoxFlat_qwhev")
|
||||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_5w4ur")
|
theme_override_styles/pressed = SubResource("StyleBoxFlat_5w4ur")
|
||||||
theme_override_styles/hover = SubResource("StyleBoxFlat_ey1tb")
|
theme_override_styles/hover = SubResource("StyleBoxFlat_ey1tb")
|
||||||
text = "Back to Menu"
|
text = "Back to Menu"
|
||||||
script = ExtResource("2_qwhev")
|
script = ExtResource("2_s3wmd")
|
||||||
ScenePath = "res://Scenes/MainMenu.tscn"
|
ScenePath = "res://Scenes/MainMenu.tscn"
|
||||||
|
|
||||||
[node name="BackToMenuLogic" type="Control" parent="Buttons/Menu"]
|
[node name="BackToMenuLogic" type="Control" parent="Buttons/Menu" unique_id=930904135]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
script = ExtResource("3_ey1tb")
|
script = ExtResource("3_yl41b")
|
||||||
|
|
||||||
[node name="Continue" type="Button" parent="Buttons"]
|
[node name="Continue" type="Button" parent="Buttons" unique_id=767344177]
|
||||||
custom_minimum_size = Vector2(500, 0)
|
custom_minimum_size = Vector2(500, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||||
@@ -92,13 +92,13 @@ theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
|
|||||||
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
|
||||||
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
|
||||||
theme_override_colors/font_disabled_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_disabled_color = Color(0, 0, 0, 1)
|
||||||
theme_override_fonts/font = ExtResource("1_lj4oq")
|
theme_override_fonts/font = ExtResource("1_bech0")
|
||||||
theme_override_font_sizes/font_size = 56
|
theme_override_font_sizes/font_size = 56
|
||||||
theme_override_styles/normal = SubResource("StyleBoxFlat_qwhev")
|
theme_override_styles/normal = SubResource("StyleBoxFlat_qwhev")
|
||||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_5w4ur")
|
theme_override_styles/pressed = SubResource("StyleBoxFlat_5w4ur")
|
||||||
theme_override_styles/hover = SubResource("StyleBoxFlat_ey1tb")
|
theme_override_styles/hover = SubResource("StyleBoxFlat_ey1tb")
|
||||||
text = "Continue"
|
text = "Continue"
|
||||||
script = ExtResource("3_5w4ur")
|
script = ExtResource("4_adtx4")
|
||||||
|
|
||||||
[connection signal="button_up" from="Buttons/Menu" to="Buttons/Menu/BackToMenuLogic" method="_on_menu_button_up"]
|
[connection signal="button_up" from="Buttons/Menu" to="Buttons/Menu/BackToMenuLogic" method="_on_menu_button_up"]
|
||||||
[connection signal="button_up" from="Buttons/Continue" to="Buttons/Continue" method="_on_button_up"]
|
[connection signal="button_up" from="Buttons/Continue" to="Buttons/Continue" method="_on_button_up"]
|
||||||
+13
-2
@@ -37,6 +37,7 @@ public partial class Player : Node2D {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Globals.IsPaused) {
|
||||||
if (VelocityY < 600f) {
|
if (VelocityY < 600f) {
|
||||||
VelocityY += Globals.Gravity * (float)delta;
|
VelocityY += Globals.Gravity * (float)delta;
|
||||||
}
|
}
|
||||||
@@ -49,6 +50,7 @@ public partial class Player : Node2D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Position = Pos;
|
Position = Pos;
|
||||||
|
}
|
||||||
|
|
||||||
// Effect handling
|
// Effect handling
|
||||||
if (Globals.ActiveEffect != "none" && !Globals.IsPaused) {
|
if (Globals.ActiveEffect != "none" && !Globals.IsPaused) {
|
||||||
@@ -74,8 +76,9 @@ public partial class Player : Node2D {
|
|||||||
Globals.BerrySpeed = Globals.DefaultBerrySpeed * 2f;
|
Globals.BerrySpeed = Globals.DefaultBerrySpeed * 2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.IsActionJustPressed("EscapeKey") && !Globals.IsPaused) {
|
if (Input.IsActionJustPressed("EscapeKey")) {
|
||||||
PackedScene PauseMenu = GD.Load<PackedScene>("res://Scenes/PauseMenu.tscn");
|
if (!Globals.IsPaused) {
|
||||||
|
PackedScene PauseMenu = GD.Load<PackedScene>("res://Prefabs/PauseMenu.tscn");
|
||||||
|
|
||||||
Control PauseMenuInstance = PauseMenu.Instantiate<Control>();
|
Control PauseMenuInstance = PauseMenu.Instantiate<Control>();
|
||||||
|
|
||||||
@@ -88,6 +91,14 @@ public partial class Player : Node2D {
|
|||||||
AudioStreamPlayer MusicPlayer = GetNode<AudioStreamPlayer>("/root/Game/MusicPlayer");
|
AudioStreamPlayer MusicPlayer = GetNode<AudioStreamPlayer>("/root/Game/MusicPlayer");
|
||||||
|
|
||||||
MusicPlayer.StreamPaused = !MusicPlayer.StreamPaused;
|
MusicPlayer.StreamPaused = !MusicPlayer.StreamPaused;
|
||||||
|
} else {
|
||||||
|
AudioStreamPlayer MusicPlayer = GetNode<AudioStreamPlayer>("/root/Game/MusicPlayer");
|
||||||
|
|
||||||
|
MusicPlayer.StreamPaused = !MusicPlayer.StreamPaused;
|
||||||
|
|
||||||
|
Globals.IsPaused = false;
|
||||||
|
GetNode<Control>("/root/Game/CanvasLayer/PauseMenu").QueueFree();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user