gd: added menu template

This commit is contained in:
2025-06-10 18:46:20 +02:00
parent f9a6c42b14
commit c554e24b01
421 changed files with 12371 additions and 2 deletions

View File

@ -0,0 +1,9 @@
extends SubViewport
@export var anti_aliasing_key : StringName = "Anti-aliasing"
@export var video_section : StringName = AppSettings.VIDEO_SECTION
func _ready() -> void:
var anti_aliasing : int = Config.get_config(video_section, anti_aliasing_key, Viewport.MSAA_DISABLED)
msaa_2d = anti_aliasing as MSAA
msaa_3d = anti_aliasing as MSAA

View File

@ -0,0 +1 @@
uid://setdprunjids

View File

@ -0,0 +1,63 @@
[gd_scene load_steps=11 format=3 uid="uid://cn7ialakmhaeq"]
[ext_resource type="Script" uid="uid://cyh0d64pfygbl" path="res://addons/maaacks_game_template/base/scripts/pause_menu_controller.gd" id="1_wm2gk"]
[ext_resource type="PackedScene" uid="uid://ccqajqchiw4xu" path="res://menus/scenes/overlaid_menus/pause_menu.tscn" id="2_0bqsg"]
[ext_resource type="PackedScene" uid="uid://bkcsjsk2ciff" path="res://addons/maaacks_game_template/base/scenes/music_players/background_music_player.tscn" id="3_aryyu"]
[ext_resource type="Script" uid="uid://crbo2e4ndbyvk" path="res://addons/maaacks_game_template/extras/scripts/level_list_loader.gd" id="4_q70eh"]
[ext_resource type="Script" uid="uid://3yfyhcjuxm0t" path="res://menus/scripts/level_list_and_state_manager.gd" id="5_cm6at"]
[ext_resource type="PackedScene" uid="uid://dmq0tpdodtomh" path="res://menus/scenes/overlaid_menus/game_won_menu.tscn" id="6_72q1f"]
[ext_resource type="PackedScene" uid="uid://ciyq8eiv1mtie" path="res://menus/scenes/overlaid_menus/level_lost_menu.tscn" id="7_mkrcq"]
[ext_resource type="PackedScene" uid="uid://b46jlduh4lllk" path="res://menus/scenes/overlaid_menus/level_won_menu.tscn" id="8_sqpeu"]
[ext_resource type="PackedScene" uid="uid://c63l6okbko3xp" path="res://menus/scenes/loading_screen/level_loading_screen.tscn" id="9_u7rb7"]
[ext_resource type="Script" uid="uid://setdprunjids" path="res://menus/scenes/game_scene/configurable_sub_viewport.gd" id="10_kh6hf"]
[node name="GameUI" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PauseMenuController" type="Node" parent="." node_paths=PackedStringArray("focused_viewport")]
script = ExtResource("1_wm2gk")
pause_menu_packed = ExtResource("2_0bqsg")
focused_viewport = NodePath("../ViewportContainer/ConfigurableSubViewport")
[node name="BackgroundMusicPlayer" parent="." instance=ExtResource("3_aryyu")]
[node name="LevelListLoader" type="Node" parent="." node_paths=PackedStringArray("level_container")]
script = ExtResource("4_q70eh")
level_container = NodePath("../ViewportContainer/ConfigurableSubViewport")
files = Array[String](["res://menus/scenes/game_scene/levels/level_1.tscn", "res://menus/scenes/game_scene/levels/level_2.tscn", "res://menus/scenes/game_scene/levels/level_3.tscn"])
directory = "res://menus/scenes/game_scene/levels"
[node name="LevelListManager" type="Node" parent="." node_paths=PackedStringArray("level_list_loader", "level_loading_screen")]
script = ExtResource("5_cm6at")
level_list_loader = NodePath("../LevelListLoader")
main_menu_scene = "res://menus/scenes/menus/main_menu/main_menu_with_animations.tscn"
ending_scene = "res://menus/scenes/end_credits/end_credits.tscn"
level_loading_screen = NodePath("../LevelLoadingScreen")
game_won_scene = ExtResource("6_72q1f")
level_lost_scene = ExtResource("7_mkrcq")
level_won_scene = ExtResource("8_sqpeu")
[node name="LevelLoadingScreen" parent="." instance=ExtResource("9_u7rb7")]
visible = false
[node name="ViewportContainer" type="SubViewportContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
stretch = true
[node name="ConfigurableSubViewport" type="SubViewport" parent="ViewportContainer"]
handle_input_locally = false
audio_listener_enable_2d = true
audio_listener_enable_3d = true
size = Vector2i(1280, 720)
render_target_update_mode = 4
script = ExtResource("10_kh6hf")

View File

@ -0,0 +1,21 @@
extends Label
@onready var action_names := AppSettings.get_action_names()
func _get_inputs_as_string() -> String:
var all_inputs : String = ""
var is_first : bool = true
for action_name in action_names:
if Input.is_action_pressed(action_name):
if is_first:
is_first = false
all_inputs += action_name
else:
all_inputs += " + " + action_name
return all_inputs
func _process(_delta : float) -> void:
if Input.is_anything_pressed():
text = _get_inputs_as_string()
else:
text = ""

View File

@ -0,0 +1 @@
uid://nvm4qcl05gmc

View File

@ -0,0 +1,31 @@
extends Node
signal level_won
signal level_lost
var level_state : LevelState
func _on_lose_button_pressed() -> void:
level_lost.emit()
func _on_win_button_pressed() -> void:
level_won.emit()
func open_tutorials() -> void:
%TutorialManager.open_tutorials()
level_state.tutorial_read = true
func _ready() -> void:
level_state = GameState.get_level_state(scene_file_path)
%ColorPickerButton.color = level_state.color
%BackgroundColor.color = level_state.color
if not level_state.tutorial_read:
open_tutorials()
func _on_color_picker_button_color_changed(color : Color) -> void:
%BackgroundColor.color = color
level_state.color = color
GlobalState.save()
func _on_tutorial_button_pressed() -> void:
open_tutorials()

View File

@ -0,0 +1 @@
uid://oqr1470sqa04

View File

@ -0,0 +1,90 @@
[gd_scene load_steps=6 format=3 uid="uid://b0qcy25u3w436"]
[ext_resource type="Script" uid="uid://oqr1470sqa04" path="res://menus/scenes/game_scene/levels/level.gd" id="1_gurrc"]
[ext_resource type="Script" uid="uid://1nf36h0gms3q" path="res://addons/maaacks_game_template/base/scripts/capture_focus.gd" id="2_ou215"]
[ext_resource type="Script" uid="uid://nvm4qcl05gmc" path="res://menus/scenes/game_scene/input_display_label.gd" id="3_c34o5"]
[ext_resource type="Script" uid="uid://qf7h5xkvdgqw" path="res://menus/scenes/game_scene/tutorial_manager.gd" id="4_f47b8"]
[ext_resource type="PackedScene" uid="uid://cy58hst85hxsj" path="res://menus/scenes/game_scene/tutorials/tutorial_1.tscn" id="5_4spcs"]
[node name="Level1" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_gurrc")
[node name="BackgroundColor" type="ColorRect" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 32
theme_override_constants/margin_right = 32
theme_override_constants/margin_bottom = 32
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 16
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 32
script = ExtResource("2_ou215")
[node name="LoseButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Lose"
[node name="WinButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Win"
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="TutorialButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Tutorial"
[node name="InputDisplayLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
size_flags_horizontal = 3
horizontal_alignment = 1
script = ExtResource("3_c34o5")
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Change Level State: "
[node name="ColorPickerButton" type="ColorPickerButton" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
text = "Change Color"
[node name="TutorialManager" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("4_f47b8")
tutorial_scenes = Array[PackedScene]([ExtResource("5_4spcs")])
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/LoseButton" to="." method="_on_lose_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/WinButton" to="." method="_on_win_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/TutorialButton" to="." method="_on_tutorial_button_pressed"]
[connection signal="color_changed" from="MarginContainer/VBoxContainer/HBoxContainer2/ColorPickerButton" to="." method="_on_color_picker_button_color_changed"]

View File

@ -0,0 +1,96 @@
[gd_scene load_steps=6 format=3 uid="uid://cnywew70g84u8"]
[ext_resource type="Script" uid="uid://oqr1470sqa04" path="res://menus/scenes/game_scene/levels/level.gd" id="1_3qleh"]
[ext_resource type="Script" uid="uid://1nf36h0gms3q" path="res://addons/maaacks_game_template/base/scripts/capture_focus.gd" id="2_n4y0n"]
[ext_resource type="Script" uid="uid://nvm4qcl05gmc" path="res://menus/scenes/game_scene/input_display_label.gd" id="3_fxw66"]
[ext_resource type="Script" uid="uid://qf7h5xkvdgqw" path="res://menus/scenes/game_scene/tutorial_manager.gd" id="4_hrqtj"]
[ext_resource type="PackedScene" uid="uid://dxrk0tt7ciipu" path="res://menus/scenes/game_scene/tutorials/tutorial_2.tscn" id="5_318fc"]
[node name="Level2" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_3qleh")
[node name="BackgroundColor" type="ColorRect" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 32
theme_override_constants/margin_right = 32
theme_override_constants/margin_bottom = 32
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 16
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 32
script = ExtResource("2_n4y0n")
[node name="LoseButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Lose"
[node name="WinButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Win"
[node name="LoseButton2" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Lose"
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="TutorialButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Tutorial"
[node name="InputDisplayLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
size_flags_horizontal = 3
horizontal_alignment = 1
script = ExtResource("3_fxw66")
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Change Level State: "
[node name="ColorPickerButton" type="ColorPickerButton" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
text = "Change Color"
[node name="TutorialManager" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("4_hrqtj")
tutorial_scenes = Array[PackedScene]([ExtResource("5_318fc")])
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/LoseButton" to="." method="_on_lose_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/WinButton" to="." method="_on_win_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/LoseButton2" to="." method="_on_lose_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/TutorialButton" to="." method="_on_tutorial_button_pressed"]
[connection signal="color_changed" from="MarginContainer/VBoxContainer/HBoxContainer2/ColorPickerButton" to="." method="_on_color_picker_button_color_changed"]

View File

@ -0,0 +1,102 @@
[gd_scene load_steps=6 format=3 uid="uid://5k7yo8y0x1th"]
[ext_resource type="Script" uid="uid://oqr1470sqa04" path="res://menus/scenes/game_scene/levels/level.gd" id="1_x17wb"]
[ext_resource type="Script" uid="uid://1nf36h0gms3q" path="res://addons/maaacks_game_template/base/scripts/capture_focus.gd" id="2_fxhbp"]
[ext_resource type="Script" uid="uid://nvm4qcl05gmc" path="res://menus/scenes/game_scene/input_display_label.gd" id="3_5rvw0"]
[ext_resource type="Script" uid="uid://qf7h5xkvdgqw" path="res://menus/scenes/game_scene/tutorial_manager.gd" id="4_eriqx"]
[ext_resource type="PackedScene" uid="uid://belanf70yj2sq" path="res://menus/scenes/game_scene/tutorials/tutorial_3.tscn" id="5_fejky"]
[node name="Level3" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_x17wb")
[node name="BackgroundColor" type="ColorRect" parent="."]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 32
theme_override_constants/margin_top = 32
theme_override_constants/margin_right = 32
theme_override_constants/margin_bottom = 32
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 16
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 32
script = ExtResource("2_fxhbp")
[node name="WinButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Win"
[node name="LoseButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Lose"
[node name="LoseButton2" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Lose"
[node name="LoseButton3" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Lose"
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="TutorialButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Tutorial"
[node name="InputDisplayLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
size_flags_horizontal = 3
horizontal_alignment = 1
script = ExtResource("3_5rvw0")
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Change Level State: "
[node name="ColorPickerButton" type="ColorPickerButton" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
text = "Change Color"
[node name="TutorialManager" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("4_eriqx")
tutorial_scenes = Array[PackedScene]([ExtResource("5_fejky")])
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/WinButton" to="." method="_on_win_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/LoseButton" to="." method="_on_lose_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/LoseButton2" to="." method="_on_lose_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/LoseButton3" to="." method="_on_lose_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/TutorialButton" to="." method="_on_tutorial_button_pressed"]
[connection signal="color_changed" from="MarginContainer/VBoxContainer/HBoxContainer2/ColorPickerButton" to="." method="_on_color_picker_button_color_changed"]

View File

@ -0,0 +1,19 @@
extends Node
@export var tutorial_scenes : Array[PackedScene]
@export var open_delay : float = 0.25
@export var auto_open : bool = false
func open_tutorials() -> void:
if open_delay > 0.0:
await get_tree().create_timer(open_delay, false).timeout
for tutorial_scene in tutorial_scenes:
var tutorial_menu : OverlaidMenu = tutorial_scene.instantiate()
if tutorial_menu == null:
push_warning("tutorial failed to open %s" % tutorial_scene)
return
get_tree().current_scene.call_deferred("add_child", tutorial_menu)
await tutorial_menu.tree_exited
func _ready() -> void:
if auto_open:
open_tutorials()

View File

@ -0,0 +1 @@
uid://qf7h5xkvdgqw

View File

@ -0,0 +1,25 @@
[gd_scene load_steps=2 format=3 uid="uid://cy58hst85hxsj"]
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/overlaid_menu/overlaid_menu.tscn" id="1_apclv"]
[node name="Tutorial1" instance=ExtResource("1_apclv")]
[node name="MenuPanelContainer" parent="." index="1"]
offset_left = -206.0
offset_top = -75.0
offset_right = 215.0
offset_bottom = 76.0
[node name="BoxContainer" parent="MenuPanelContainer/MarginContainer" index="0"]
theme_override_constants/separation = 16
[node name="TitleLabel" parent="MenuPanelContainer/MarginContainer/BoxContainer/TitleMargin" index="0"]
text = "Tutorial"
[node name="DescriptionMargin" parent="MenuPanelContainer/MarginContainer/BoxContainer" index="1"]
visible = true
[node name="DescriptionLabel" parent="MenuPanelContainer/MarginContainer/BoxContainer/DescriptionMargin" index="0"]
text = "[center]Click the Win button to progress.
Click the Lose button to try again.[/center]"
fit_content = true

View File

@ -0,0 +1,25 @@
[gd_scene load_steps=2 format=3 uid="uid://dxrk0tt7ciipu"]
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/overlaid_menu/overlaid_menu.tscn" id="1_cg7og"]
[node name="Tutorial2" instance=ExtResource("1_cg7og")]
[node name="MenuPanelContainer" parent="." index="1"]
offset_left = -206.0
offset_top = -75.0
offset_right = 215.0
offset_bottom = 76.0
[node name="BoxContainer" parent="MenuPanelContainer/MarginContainer" index="0"]
theme_override_constants/separation = 16
[node name="TitleLabel" parent="MenuPanelContainer/MarginContainer/BoxContainer/TitleMargin" index="0"]
text = "Tutorial"
[node name="DescriptionMargin" parent="MenuPanelContainer/MarginContainer/BoxContainer" index="1"]
visible = true
[node name="DescriptionLabel" parent="MenuPanelContainer/MarginContainer/BoxContainer/DescriptionMargin" index="0"]
text = "[center]Progress is saved.
Pressing Continue from the main menu will load the last level played.[/center]"
fit_content = true

View File

@ -0,0 +1,26 @@
[gd_scene load_steps=2 format=3 uid="uid://belanf70yj2sq"]
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/overlaid_menu/overlaid_menu.tscn" id="1_w71gn"]
[node name="Tutorial2" instance=ExtResource("1_w71gn")]
[node name="MenuPanelContainer" parent="." index="1"]
offset_left = -206.0
offset_top = -75.0
offset_right = 215.0
offset_bottom = 76.0
[node name="BoxContainer" parent="MenuPanelContainer/MarginContainer" index="0"]
theme_override_constants/separation = 16
[node name="TitleLabel" parent="MenuPanelContainer/MarginContainer/BoxContainer/TitleMargin" index="0"]
text = "Tutorial"
[node name="DescriptionMargin" parent="MenuPanelContainer/MarginContainer/BoxContainer" index="1"]
visible = true
[node name="DescriptionLabel" parent="MenuPanelContainer/MarginContainer/BoxContainer/DescriptionMargin" index="0"]
text = "[center]The color picker at the bottom-right updates the level state. This change persists until the game is reset.
The label at the bottom-center displays the current input action detected, if any are setup for the project.[/center]"
fit_content = true