diff --git a/App/Scripts/InGameMenuController.gd b/App/Scripts/InGameMenuController.gd index 6946cb7a..03ce3fcf 100644 --- a/App/Scripts/InGameMenuController.gd +++ b/App/Scripts/InGameMenuController.gd @@ -27,5 +27,5 @@ static func close_menu() -> void: current_menu.queue_free() Input.set_mouse_mode(saved_mouse_mode) scene_tree.paused = false - if is_instance_valid(saved_focus_control): + if is_instance_valid(saved_focus_control) and saved_focus_control.is_inside_tree(): saved_focus_control.grab_focus() diff --git a/Extras/Scenes/LevelLoader/ProjectLevelLoader.tscn b/Extras/Scenes/Autoloads/ProjectLevelLoader.tscn similarity index 100% rename from Extras/Scenes/LevelLoader/ProjectLevelLoader.tscn rename to Extras/Scenes/Autoloads/ProjectLevelLoader.tscn diff --git a/Extras/Scenes/UISoundController/UISoundControllerAutoload.tscn b/Extras/Scenes/Autoloads/ProjectUISoundController.tscn similarity index 77% rename from Extras/Scenes/UISoundController/UISoundControllerAutoload.tscn rename to Extras/Scenes/Autoloads/ProjectUISoundController.tscn index 0b009db2..83f47504 100644 --- a/Extras/Scenes/UISoundController/UISoundControllerAutoload.tscn +++ b/Extras/Scenes/Autoloads/ProjectUISoundController.tscn @@ -2,5 +2,5 @@ [ext_resource type="Script" path="res://App/Scripts/UISoundController.gd" id="1_dmagn"] -[node name="UISoundControllerAutoload" type="Node"] +[node name="ProjectUISoundController" type="Node"] script = ExtResource("1_dmagn") diff --git a/Extras/Scenes/FailureScreen/FailureScreen.tscn b/Extras/Scenes/FailureScreen/FailureScreen.tscn index b2ec0adb..8ad5393a 100644 --- a/Extras/Scenes/FailureScreen/FailureScreen.tscn +++ b/Extras/Scenes/FailureScreen/FailureScreen.tscn @@ -23,6 +23,8 @@ layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 [node name="Panel" type="Panel" parent="Control"] custom_minimum_size = Vector2(410, 240) diff --git a/Extras/Scenes/SuccessScreen/SuccessScreen.tscn b/Extras/Scenes/SuccessScreen/SuccessScreen.tscn index de2a441d..d2695465 100644 --- a/Extras/Scenes/SuccessScreen/SuccessScreen.tscn +++ b/Extras/Scenes/SuccessScreen/SuccessScreen.tscn @@ -19,13 +19,15 @@ grow_horizontal = 2 grow_vertical = 2 color = Color(0, 0, 0, 0.501961) -[node name="CenterContainer" type="Control" parent="."] +[node name="Control" type="Control" parent="."] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 -[node name="Panel" type="Panel" parent="CenterContainer"] +[node name="Panel" type="Panel" parent="Control"] custom_minimum_size = Vector2(410, 240) layout_mode = 1 anchors_preset = 8 @@ -40,7 +42,7 @@ offset_bottom = 120.0 grow_horizontal = 2 grow_vertical = 2 -[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/Panel"] +[node name="MarginContainer" type="MarginContainer" parent="Control/Panel"] layout_mode = 0 anchor_right = 1.0 anchor_bottom = 1.0 @@ -49,11 +51,11 @@ theme_override_constants/margin_top = 8 theme_override_constants/margin_right = 8 theme_override_constants/margin_bottom = 8 -[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/Panel/MarginContainer"] +[node name="VBoxContainer" type="VBoxContainer" parent="Control/Panel/MarginContainer"] layout_mode = 2 alignment = 1 -[node name="Title" type="Label" parent="CenterContainer/Panel/MarginContainer/VBoxContainer"] +[node name="Title" type="Label" parent="Control/Panel/MarginContainer/VBoxContainer"] unique_name_in_owner = true layout_mode = 2 size_flags_vertical = 3 @@ -61,24 +63,24 @@ text = "You won!" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ButtonsContainer" type="HBoxContainer" parent="CenterContainer/Panel/MarginContainer/VBoxContainer"] +[node name="ButtonsContainer" type="HBoxContainer" parent="Control/Panel/MarginContainer/VBoxContainer"] layout_mode = 2 alignment = 1 script = ExtResource("3_rix3y") -[node name="ContinueButton" type="Button" parent="CenterContainer/Panel/MarginContainer/VBoxContainer/ButtonsContainer"] +[node name="ContinueButton" type="Button" parent="Control/Panel/MarginContainer/VBoxContainer/ButtonsContainer"] unique_name_in_owner = true custom_minimum_size = Vector2(128, 40) layout_mode = 2 text = "Continue" -[node name="MainMenuButton" type="Button" parent="CenterContainer/Panel/MarginContainer/VBoxContainer/ButtonsContainer"] +[node name="MainMenuButton" type="Button" parent="Control/Panel/MarginContainer/VBoxContainer/ButtonsContainer"] unique_name_in_owner = true custom_minimum_size = Vector2(128, 40) layout_mode = 2 text = "Main Menu" -[node name="ExitButton" type="Button" parent="CenterContainer/Panel/MarginContainer/VBoxContainer/ButtonsContainer"] +[node name="ExitButton" type="Button" parent="Control/Panel/MarginContainer/VBoxContainer/ButtonsContainer"] unique_name_in_owner = true custom_minimum_size = Vector2(128, 40) layout_mode = 2 @@ -95,8 +97,8 @@ dialog_text = "Quit the game?" [node name="UISoundController" type="Node" parent="."] script = ExtResource("3_smu5k") -[connection signal="pressed" from="CenterContainer/Panel/MarginContainer/VBoxContainer/ButtonsContainer/ContinueButton" to="." method="_on_continue_button_pressed"] -[connection signal="pressed" from="CenterContainer/Panel/MarginContainer/VBoxContainer/ButtonsContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"] -[connection signal="pressed" from="CenterContainer/Panel/MarginContainer/VBoxContainer/ButtonsContainer/ExitButton" to="." method="_on_exit_button_pressed"] +[connection signal="pressed" from="Control/Panel/MarginContainer/VBoxContainer/ButtonsContainer/ContinueButton" to="." method="_on_continue_button_pressed"] +[connection signal="pressed" from="Control/Panel/MarginContainer/VBoxContainer/ButtonsContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"] +[connection signal="pressed" from="Control/Panel/MarginContainer/VBoxContainer/ButtonsContainer/ExitButton" to="." method="_on_exit_button_pressed"] [connection signal="confirmed" from="ConfirmMainMenu" to="." method="_on_confirm_main_menu_confirmed"] [connection signal="confirmed" from="ConfirmExit" to="." method="_on_confirm_exit_confirmed"] diff --git a/README.md b/README.md index e3a4a5b8..cbc6742a 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,11 @@ The `Extras/` folder holds components that extend the core application. ### App vs. Extras -To begin with, use the `Extras/` folder, and make changes there. However, to start minimally, use just the `App/` folder. Compare [Features](#features) to decide. +`App/` contains the core features of the package. On first use, it's recommended to keep the `Extras/` folder, and make changes there. Features can be added and removed as needed. + +To start minimally, use just the `App/` folder, and safely remove the `Extras/` folder by following the [minimal](#minimal) instructions. + +Compare [features](#features) to decide which approach is best for your project. #### Minimal @@ -72,8 +76,14 @@ If you just want to use just the projects minimum `App/` folder: 1. Go to `Project > Project Settings… > General > Application > Run`. 2. Update `Main Scene` to `res://App/Scenes/InitApp/InitApp.tscn`. -3. Close the window. -4. Delete the `Extras/` folder. +3. Go to `Project > Project Settings… > Autoload`. +4. Remove autoloads that start with the path `res://Extras/...`. + 1. `ProjectUiSoundController` + 2. `ProjectLevelLoader` + 3. `RuntimeLogger` +5. Close the window. +6. Delete the `Extras/` folder. +7. Reload the project. The remaining instructions will apply the same for either folder you decide to use. @@ -172,7 +182,7 @@ For an existing project, just copy over the `App/` folder (optionally the `Extra 1. Update the project’s main scene. - 1. Go to Project > Project Settings… > General > Application > Run. + 1. Go to `Project > Project Settings… > General > Application > Run`. 2. Update `Main Scene` to `res://…/InitApp.tscn`. 3. Close the window. @@ -180,9 +190,9 @@ For an existing project, just copy over the `App/` folder (optionally the `Extra 2. Update the project’s autoloads. - 1. Go to Project > Project Settings… > Autoload. + 1. Go to `Project > Project Settings… > Autoload`. 2. Add `res://App/Scripts/SceneLoader.gd`. - 3. Optionally add `res://Extras/Scripts/RuntimeLogger.gd`. + 3. Optionally enable `res://Extras/Scripts/RuntimeLogger.gd`. 4. Close the window. 3. Update the project’s name. diff --git a/project.godot b/project.godot index 1a302ab5..ee3b1c61 100644 --- a/project.godot +++ b/project.godot @@ -18,7 +18,9 @@ config/icon="res://icon.png" [autoload] SceneLoader="*res://App/Scripts/SceneLoader.gd" -UISoundControllerAutoload="res://Extras/Scenes/UISoundController/UISoundControllerAutoload.tscn" +ProjectUiSoundController="res://Extras/Scenes/Autoloads/ProjectUISoundController.tscn" +ProjectLevelLoader="res://Extras/Scenes/Autoloads/ProjectLevelLoader.tscn" +RuntimeLogger="res://Extras/Scripts/RuntimeLogger.gd" [display]