From 209d2fdea87b476af82cb0816f0c03ea652f4ca5 Mon Sep 17 00:00:00 2001 From: ToasterPanic Date: Sun, 7 Dec 2025 14:10:10 -0500 Subject: [PATCH] Ground pause menu, fix issue with aim laser --- scenes/enemy_ground.tscn | 2 +- scenes/game.tscn | 119 +------------------------------------- scenes/ground.tscn | 6 +- scenes/pause_menu.tscn | 122 +++++++++++++++++++++++++++++++++++++++ scripts/game_ground.gd | 7 ++- 5 files changed, 137 insertions(+), 119 deletions(-) create mode 100644 scenes/pause_menu.tscn diff --git a/scenes/enemy_ground.tscn b/scenes/enemy_ground.tscn index aaa870c..9a725a8 100644 --- a/scenes/enemy_ground.tscn +++ b/scenes/enemy_ground.tscn @@ -106,7 +106,7 @@ collide_with_areas = true [node name="Cast" type="RayCast2D" parent="HeldItem"] position = Vector2(64, 0) -target_position = Vector2(2048, 0) +target_position = Vector2(204800, 0) collision_mask = 2 collide_with_areas = true diff --git a/scenes/game.tscn b/scenes/game.tscn index 3e76bd2..f43d607 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=45 format=4 uid="uid://bauklhpieuivd"] +[gd_scene load_steps=42 format=4 uid="uid://bauklhpieuivd"] [ext_resource type="Script" uid="uid://d0qswyhwbhdua" path="res://scripts/game.gd" id="1_u5sy4"] [ext_resource type="Texture2D" uid="uid://dtwo7g0ipc4k" path="res://textures/ship_1.png" id="1_uwrxv"] @@ -19,9 +19,8 @@ [ext_resource type="Script" uid="uid://d0txwo63hlrsy" path="res://scripts/enterable.gd" id="13_trtic"] [ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="15_ca42v"] [ext_resource type="Theme" uid="uid://dtc7h6gpwpend" path="res://scenes/ui.tres" id="15_ir15t"] -[ext_resource type="Script" uid="uid://dqiaioigmj5wb" path="res://scripts/pause_menu.gd" id="15_rysoc"] [ext_resource type="FontFile" uid="uid://donsvh2l775rb" path="res://fonts/Doto.ttf" id="16_1kice"] -[ext_resource type="PackedScene" uid="uid://cy4nbqbm222os" path="res://scenes/settings.tscn" id="17_ssvqc"] +[ext_resource type="PackedScene" uid="uid://b6bq2viqao61m" path="res://scenes/pause_menu.tscn" id="19_37s47"] [ext_resource type="Texture2D" uid="uid://cwa4uu7hrw2l0" path="res://textures/save_indicator.png" id="22_bt5mj"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ir15t"] @@ -78,15 +77,6 @@ font_size = 14 [sub_resource type="LabelSettings" id="LabelSettings_pl11u"] font_size = 14 -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_264po"] -bg_color = Color(0, 0, 0, 1) -border_color = Color(0.53333336, 0.53333336, 0.53333336, 1) -corner_detail = 1 - -[sub_resource type="LabelSettings" id="LabelSettings_1kice"] -font_size = 48 -outline_size = 2 - [sub_resource type="AtlasTexture" id="AtlasTexture_vuhkc"] atlas = ExtResource("22_bt5mj") region = Rect2(0, 0, 16, 16) @@ -511,111 +501,9 @@ layout_mode = 2 size_flags_horizontal = 3 text = "back" -[node name="PauseMenu" type="Panel" parent="UI/Control"] -process_mode = 3 -visible = false -self_modulate = Color(1, 1, 1, 0.53333336) -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_styles/panel = SubResource("StyleBoxFlat_264po") -script = ExtResource("15_rysoc") - -[node name="Panel" type="PanelContainer" parent="UI/Control/PauseMenu"] -layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -130.0 -offset_top = -26.0 -offset_right = 130.0 -offset_bottom = 26.0 -grow_horizontal = 2 -grow_vertical = 2 -theme = ExtResource("15_ir15t") - -[node name="Flow" type="HFlowContainer" parent="UI/Control/PauseMenu/Panel"] -layout_mode = 2 -alignment = 1 - -[node name="Label" type="Label" parent="UI/Control/PauseMenu/Panel/Flow"] -custom_minimum_size = Vector2(512, 0) -layout_mode = 2 -text = "PAUSED" -label_settings = SubResource("LabelSettings_1kice") -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="HFlowContainer" type="HFlowContainer" parent="UI/Control/PauseMenu/Panel/Flow"] -custom_minimum_size = Vector2(257, 0) -layout_mode = 2 -alignment = 1 - -[node name="InputIconTextureRect2" type="TextureRect" parent="UI/Control/PauseMenu/Panel/Flow/HFlowContainer"] -custom_minimum_size = Vector2(48, 48) -layout_mode = 2 -expand_mode = 1 -script = ExtResource("15_ca42v") -action_name = "ui_up" -metadata/_custom_type_script = "uid://b2maxk5g6yb0i" - -[node name="InputIconTextureRect3" type="TextureRect" parent="UI/Control/PauseMenu/Panel/Flow/HFlowContainer"] -custom_minimum_size = Vector2(48, 48) -layout_mode = 2 -expand_mode = 1 -script = ExtResource("15_ca42v") -action_name = "ui_down" -metadata/_custom_type_script = "uid://b2maxk5g6yb0i" - -[node name="InputIconTextureRect" type="TextureRect" parent="UI/Control/PauseMenu/Panel/Flow/HFlowContainer"] -custom_minimum_size = Vector2(48, 48) -layout_mode = 2 -expand_mode = 1 -script = ExtResource("15_ca42v") -action_name = "dialogue_continue" -metadata/_custom_type_script = "uid://b2maxk5g6yb0i" - -[node name="Resume" type="Button" parent="UI/Control/PauseMenu/Panel/Flow"] -custom_minimum_size = Vector2(257, 0) -layout_mode = 2 -focus_neighbor_top = NodePath("../QuitToTitle") -text = "Resume" - -[node name="Settings" type="Button" parent="UI/Control/PauseMenu/Panel/Flow"] -custom_minimum_size = Vector2(257, 0) -layout_mode = 2 -text = "Settings" - -[node name="QuitToTitle" type="Button" parent="UI/Control/PauseMenu/Panel/Flow"] -custom_minimum_size = Vector2(257, 0) -layout_mode = 2 -focus_neighbor_bottom = NodePath("../Resume") -text = "Quit to Title" - -[node name="Label2" type="Label" parent="UI/Control/PauseMenu/Panel/Flow"] -custom_minimum_size = Vector2(512, 0) -layout_mode = 2 -text = "PAUSED" -label_settings = SubResource("LabelSettings_1kice") -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="Settings" parent="UI/Control/PauseMenu" instance=ExtResource("17_ssvqc")] -visible = false +[node name="PauseMenu" parent="UI/Control" instance=ExtResource("19_37s47")] layout_mode = 0 anchors_preset = 0 -anchor_left = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -offset_left = 0.0 -offset_right = 640.0 -grow_horizontal = 1 -grow_vertical = 1 [node name="ControlsBox" type="VBoxContainer" parent="UI/Control"] modulate = Color(1, 1, 1, 0.53333336) @@ -780,4 +668,3 @@ color = Color(1, 1, 1, 0) [connection signal="pressed" from="UI/Control/Navpanel/NavigationRoutes/NavigationBack" to="." method="_on_navigation_back_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/NavigationHyperboost/EnableHyperboost" to="." method="_on_enable_hyperboost_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/NavigationHyperboost/NavigationBack" to="." method="_on_navigation_back_pressed"] -[connection signal="pressed" from="UI/Control/PauseMenu/Panel/Flow/Resume" to="UI/Control/PauseMenu" method="_on_resume_pressed"] diff --git a/scenes/ground.tscn b/scenes/ground.tscn index 6fd5a75..10e7943 100644 --- a/scenes/ground.tscn +++ b/scenes/ground.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=32 format=3 uid="uid://by43ihcec8e8q"] +[gd_scene load_steps=33 format=3 uid="uid://by43ihcec8e8q"] [ext_resource type="Script" uid="uid://b2sw6ymaf4t0s" path="res://scripts/game_ground.gd" id="1_6ra5r"] [ext_resource type="Script" uid="uid://dowu512otgyyf" path="res://scripts/player_ground.gd" id="3_8gbjj"] @@ -11,6 +11,7 @@ [ext_resource type="Shader" uid="uid://d2e0541hawkml" path="res://scripts/vignette.gdshader" id="9_5vwr8"] [ext_resource type="Shader" uid="uid://bk7q00br1ms30" path="res://scripts/retro.gdshader" id="9_257nh"] [ext_resource type="Texture2D" uid="uid://cwa4uu7hrw2l0" path="res://textures/save_indicator.png" id="13_176r3"] +[ext_resource type="PackedScene" uid="uid://b6bq2viqao61m" path="res://scenes/pause_menu.tscn" id="14_vuhkc"] [ext_resource type="Texture2D" uid="uid://dauoebs801ngm" path="res://addons/super_awesome_input_icons/textures/keyboard/question.png" id="16_e3s4u"] [ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="16_hby33"] [ext_resource type="PackedScene" uid="uid://dhcfrsf726k68" path="res://scenes/dialogue_select_button.tscn" id="19_qqas2"] @@ -501,6 +502,9 @@ sprite_frames = SubResource("SpriteFrames_257nh") autoplay = "default" frame_progress = 0.6029871 +[node name="PauseMenu" parent="UI/Control" instance=ExtResource("14_vuhkc")] +layout_mode = 1 + [node name="Shader" type="ColorRect" parent="UI"] material = SubResource("ShaderMaterial_ypt7u") anchors_preset = 15 diff --git a/scenes/pause_menu.tscn b/scenes/pause_menu.tscn new file mode 100644 index 0000000..5bb7847 --- /dev/null +++ b/scenes/pause_menu.tscn @@ -0,0 +1,122 @@ +[gd_scene load_steps=7 format=3 uid="uid://b6bq2viqao61m"] + +[ext_resource type="Script" uid="uid://dqiaioigmj5wb" path="res://scripts/pause_menu.gd" id="1_5d2l8"] +[ext_resource type="Theme" uid="uid://dtc7h6gpwpend" path="res://scenes/ui.tres" id="2_7l7mv"] +[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="3_v4r4p"] +[ext_resource type="PackedScene" uid="uid://cy4nbqbm222os" path="res://scenes/settings.tscn" id="4_1s2dm"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_264po"] +bg_color = Color(0, 0, 0, 1) +border_color = Color(0.53333336, 0.53333336, 0.53333336, 1) +corner_detail = 1 + +[sub_resource type="LabelSettings" id="LabelSettings_1kice"] +font_size = 48 +outline_size = 2 + +[node name="PauseMenu" type="Panel"] +process_mode = 3 +visible = false +self_modulate = Color(1, 1, 1, 0.53333336) +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_264po") +script = ExtResource("1_5d2l8") + +[node name="Panel" type="PanelContainer" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -130.0 +offset_top = -26.0 +offset_right = 130.0 +offset_bottom = 26.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("2_7l7mv") + +[node name="Flow" type="HFlowContainer" parent="Panel"] +layout_mode = 2 +alignment = 1 + +[node name="Label" type="Label" parent="Panel/Flow"] +custom_minimum_size = Vector2(512, 0) +layout_mode = 2 +text = "PAUSED" +label_settings = SubResource("LabelSettings_1kice") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="HFlowContainer" type="HFlowContainer" parent="Panel/Flow"] +custom_minimum_size = Vector2(257, 0) +layout_mode = 2 +alignment = 1 + +[node name="InputIconTextureRect2" type="TextureRect" parent="Panel/Flow/HFlowContainer"] +custom_minimum_size = Vector2(48, 48) +layout_mode = 2 +expand_mode = 1 +script = ExtResource("3_v4r4p") +action_name = "ui_up" +metadata/_custom_type_script = "uid://b2maxk5g6yb0i" + +[node name="InputIconTextureRect3" type="TextureRect" parent="Panel/Flow/HFlowContainer"] +custom_minimum_size = Vector2(48, 48) +layout_mode = 2 +expand_mode = 1 +script = ExtResource("3_v4r4p") +action_name = "ui_down" +metadata/_custom_type_script = "uid://b2maxk5g6yb0i" + +[node name="InputIconTextureRect" type="TextureRect" parent="Panel/Flow/HFlowContainer"] +custom_minimum_size = Vector2(48, 48) +layout_mode = 2 +expand_mode = 1 +script = ExtResource("3_v4r4p") +action_name = "dialogue_continue" +metadata/_custom_type_script = "uid://b2maxk5g6yb0i" + +[node name="Resume" type="Button" parent="Panel/Flow"] +custom_minimum_size = Vector2(257, 0) +layout_mode = 2 +focus_neighbor_top = NodePath("../QuitToTitle") +text = "Resume" + +[node name="Settings" type="Button" parent="Panel/Flow"] +custom_minimum_size = Vector2(257, 0) +layout_mode = 2 +text = "Settings" + +[node name="QuitToTitle" type="Button" parent="Panel/Flow"] +custom_minimum_size = Vector2(257, 0) +layout_mode = 2 +focus_neighbor_bottom = NodePath("../Resume") +text = "Quit to Title" + +[node name="Label2" type="Label" parent="Panel/Flow"] +custom_minimum_size = Vector2(512, 0) +layout_mode = 2 +text = "PAUSED" +label_settings = SubResource("LabelSettings_1kice") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Settings" parent="." instance=ExtResource("4_1s2dm")] +visible = false +layout_mode = 0 +anchors_preset = 0 +anchor_left = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +offset_left = 0.0 +offset_right = 640.0 +grow_horizontal = 1 +grow_vertical = 1 + +[connection signal="pressed" from="Panel/Flow/Resume" to="." method="_on_resume_pressed"] diff --git a/scripts/game_ground.gd b/scripts/game_ground.gd index 3b0b392..56933b7 100644 --- a/scripts/game_ground.gd +++ b/scripts/game_ground.gd @@ -166,5 +166,10 @@ func set_vignette_parameter(name: String, value: float) -> void: func _input(event: InputEvent) -> void: if event.is_action_released("dialogue_continue"): - dialogue_continue.emit() + if event.is_action_pressed("pause"): + $UI/Control/PauseMenu.visible = true + + $UI/Control/PauseMenu/Panel/Flow/Resume.grab_focus() + + get_tree().paused = true