imported main menu scene addon
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
extends SubViewport
|
||||
## Script to apply the anti-aliasing setting from [PlayerConfig] to a [SubViewport].
|
||||
|
||||
## The name of the anti-aliasing variable in the [ConfigFile].
|
||||
@export var anti_aliasing_key : StringName = "Anti-aliasing"
|
||||
## The name of the section of the anti-aliasing variable in the [ConfigFile].
|
||||
@export var video_section : StringName = AppSettings.VIDEO_SECTION
|
||||
|
||||
func _ready() -> void:
|
||||
var anti_aliasing : int = PlayerConfig.get_config(video_section, anti_aliasing_key, Viewport.MSAA_DISABLED)
|
||||
msaa_2d = anti_aliasing as MSAA
|
||||
msaa_3d = anti_aliasing as MSAA
|
||||
@@ -0,0 +1 @@
|
||||
uid://cxalcykynhnqa
|
||||
27
evolve-die-repeat/scenes/game_scene/game_timer.gd
Normal file
27
evolve-die-repeat/scenes/game_scene/game_timer.gd
Normal file
@@ -0,0 +1,27 @@
|
||||
extends Node
|
||||
|
||||
var play_time : int
|
||||
var total_time : int
|
||||
|
||||
func _add_timers() -> void:
|
||||
var play_timer := Timer.new()
|
||||
play_timer.one_shot = false
|
||||
play_timer.process_mode = Node.PROCESS_MODE_PAUSABLE
|
||||
play_timer.timeout.connect(func() : play_time += 1)
|
||||
add_child(play_timer)
|
||||
play_timer.start(1)
|
||||
var total_timer := Timer.new()
|
||||
total_timer.one_shot = false
|
||||
total_timer.process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
total_timer.timeout.connect(func() : total_time += 1)
|
||||
add_child(total_timer)
|
||||
total_timer.start(1)
|
||||
|
||||
func _enter_tree() -> void:
|
||||
_add_timers()
|
||||
|
||||
func _exit_tree() -> void:
|
||||
var game_state := GameState.get_or_create_state()
|
||||
game_state.play_time += play_time
|
||||
game_state.total_time += total_time
|
||||
GlobalState.save()
|
||||
1
evolve-die-repeat/scenes/game_scene/game_timer.gd.uid
Normal file
1
evolve-die-repeat/scenes/game_scene/game_timer.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://4mvjvxsdahll
|
||||
71
evolve-die-repeat/scenes/game_scene/game_ui.tscn
Normal file
71
evolve-die-repeat/scenes/game_scene/game_ui.tscn
Normal file
@@ -0,0 +1,71 @@
|
||||
[gd_scene format=3 uid="uid://bumbxg3bfrwtd"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/maaacks_game_template/base/nodes/utilities/pause_menu_controller.gd" id="1_bmy5n"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/windows/pause_menu_layer.tscn" id="2_7aihr"]
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/music_players/background_music_player.tscn" id="3_3re04"]
|
||||
[ext_resource type="Script" path="res://addons/maaacks_game_template/extras/scripts/level_loader.gd" id="4_ascoc"]
|
||||
[ext_resource type="Script" path="res://scripts/level_and_state_manager.gd" id="5_wr4n6"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/windows/game_won_window.tscn" id="6_ukb12"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/windows/level_lost_window.tscn" id="7_i7m4m"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/windows/level_won_window.tscn" id="8_rkfhe"]
|
||||
[ext_resource type="Script" path="res://addons/maaacks_game_template/extras/scripts/scene_lister.gd" id="9_g2ndc"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/loading_screen/level_loading_screen.tscn" id="10_0v86b"]
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/configurable_sub_viewport.gd" id="11_ulq3g"]
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/game_timer.gd" id="12_gpor5"]
|
||||
|
||||
[node name="GameUI" type="Control" unique_id=1609552811]
|
||||
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="." unique_id=1685173287 node_paths=PackedStringArray("focused_viewport")]
|
||||
script = ExtResource("1_bmy5n")
|
||||
pause_menu_packed = ExtResource("2_7aihr")
|
||||
focused_viewport = NodePath("../ViewportContainer/ConfigurableSubViewport")
|
||||
|
||||
[node name="BackgroundMusicPlayer" parent="." unique_id=986713811 instance=ExtResource("3_3re04")]
|
||||
|
||||
[node name="LevelLoader" type="Node" parent="." unique_id=1047451806 node_paths=PackedStringArray("level_container", "level_loading_screen")]
|
||||
script = ExtResource("4_ascoc")
|
||||
level_container = NodePath("../ViewportContainer/ConfigurableSubViewport")
|
||||
level_loading_screen = NodePath("../LevelLoadingScreen")
|
||||
|
||||
[node name="LevelManager" type="Node" parent="." unique_id=1350972375 node_paths=PackedStringArray("level_loader", "scene_lister")]
|
||||
script = ExtResource("5_wr4n6")
|
||||
level_loader = NodePath("../LevelLoader")
|
||||
starting_level_path = "res://scenes/game_scene/levels/level_1.tscn"
|
||||
scene_lister = NodePath("SceneLister")
|
||||
game_won_scene = ExtResource("6_ukb12")
|
||||
level_lost_scene = ExtResource("7_i7m4m")
|
||||
level_won_scene = ExtResource("8_rkfhe")
|
||||
|
||||
[node name="SceneLister" type="Node" parent="LevelManager" unique_id=673614733]
|
||||
script = ExtResource("9_g2ndc")
|
||||
files = Array[String](["res://scenes/game_scene/levels/level_1.tscn", "res://scenes/game_scene/levels/level_2.tscn", "res://scenes/game_scene/levels/level_3.tscn"])
|
||||
directory = "res://scenes/game_scene/levels"
|
||||
|
||||
[node name="LevelLoadingScreen" parent="." unique_id=816430938 instance=ExtResource("10_0v86b")]
|
||||
visible = false
|
||||
|
||||
[node name="ViewportContainer" type="SubViewportContainer" parent="." unique_id=1831513653]
|
||||
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" unique_id=204786699]
|
||||
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("11_ulq3g")
|
||||
|
||||
[node name="GameTimer" type="Node" parent="." unique_id=116840261]
|
||||
script = ExtResource("12_gpor5")
|
||||
21
evolve-die-repeat/scenes/game_scene/input_display_label.gd
Normal file
21
evolve-die-repeat/scenes/game_scene/input_display_label.gd
Normal 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 = ""
|
||||
@@ -0,0 +1 @@
|
||||
uid://jiyup3v57kj0
|
||||
37
evolve-die-repeat/scenes/game_scene/levels/level.gd
Normal file
37
evolve-die-repeat/scenes/game_scene/levels/level.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
extends Node
|
||||
|
||||
signal level_lost
|
||||
signal level_won(level_path : String)
|
||||
@warning_ignore("unused_signal")
|
||||
signal level_changed(level_path : String)
|
||||
|
||||
## Optional path to the next level if using an open world level system.
|
||||
@export_file("*.tscn") var next_level_path : String
|
||||
|
||||
var level_state : LevelState
|
||||
|
||||
func _on_lose_button_pressed() -> void:
|
||||
level_lost.emit()
|
||||
|
||||
func _on_win_button_pressed() -> void:
|
||||
level_won.emit(next_level_path)
|
||||
|
||||
func open_tutorials() -> void:
|
||||
%TutorialManager.open_tutorials()
|
||||
level_state.tutorial_read = true
|
||||
GlobalState.save()
|
||||
|
||||
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()
|
||||
1
evolve-die-repeat/scenes/game_scene/levels/level.gd.uid
Normal file
1
evolve-die-repeat/scenes/game_scene/levels/level.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://efly2n6s1ers
|
||||
101
evolve-die-repeat/scenes/game_scene/levels/level_1.tscn
Normal file
101
evolve-die-repeat/scenes/game_scene/levels/level_1.tscn
Normal file
@@ -0,0 +1,101 @@
|
||||
[gd_scene format=3 uid="uid://rkbotocsegqk"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/levels/level.gd" id="1_623lg"]
|
||||
[ext_resource type="Script" path="res://addons/maaacks_game_template/base/nodes/utilities/capture_focus.gd" id="2_sycfm"]
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/input_display_label.gd" id="3_pmyid"]
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/tutorial_manager.gd" id="4_bsimd"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/game_scene/tutorials/tutorial_1.tscn" id="5_fmabn"]
|
||||
|
||||
[node name="Level1" type="Control" unique_id=235822082]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_623lg")
|
||||
next_level_path = "res://scenes/game_scene/levels/level_2.tscn"
|
||||
|
||||
[node name="BackgroundColor" type="ColorRect" parent="." unique_id=1389548597]
|
||||
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="." unique_id=1051608179]
|
||||
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" unique_id=1696412727]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 16
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer" unique_id=1771422232]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "Example Level #1"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer" unique_id=1105591262]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer" unique_id=580896160]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 32
|
||||
script = ExtResource("2_sycfm")
|
||||
|
||||
[node name="LoseButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=1120638699]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Lose"
|
||||
|
||||
[node name="WinButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=1019168185]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Win"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer" unique_id=1186288776]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TutorialButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=501380068]
|
||||
layout_mode = 2
|
||||
text = "Tutorial"
|
||||
|
||||
[node name="InputDisplayLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=743402689]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
horizontal_alignment = 1
|
||||
script = ExtResource("3_pmyid")
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1165919418]
|
||||
layout_mode = 2
|
||||
text = "Change Level Color: "
|
||||
|
||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=2109296008]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Change Color"
|
||||
|
||||
[node name="TutorialManager" type="Node" parent="." unique_id=928060640]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("4_bsimd")
|
||||
tutorial_scenes = Array[PackedScene]([ExtResource("5_fmabn")])
|
||||
|
||||
[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"]
|
||||
107
evolve-die-repeat/scenes/game_scene/levels/level_2.tscn
Normal file
107
evolve-die-repeat/scenes/game_scene/levels/level_2.tscn
Normal file
@@ -0,0 +1,107 @@
|
||||
[gd_scene format=3 uid="uid://dok28ptvihsse"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/levels/level.gd" id="1_rgywr"]
|
||||
[ext_resource type="Script" path="res://addons/maaacks_game_template/base/nodes/utilities/capture_focus.gd" id="2_8s04l"]
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/input_display_label.gd" id="3_kjg0a"]
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/tutorial_manager.gd" id="4_w8c7f"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/game_scene/tutorials/tutorial_2.tscn" id="5_i1l6d"]
|
||||
|
||||
[node name="Level2" type="Control" unique_id=2110036821]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_rgywr")
|
||||
next_level_path = "res://scenes/game_scene/levels/level_3.tscn"
|
||||
|
||||
[node name="BackgroundColor" type="ColorRect" parent="." unique_id=1479828644]
|
||||
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="." unique_id=523912810]
|
||||
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" unique_id=107158970]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 16
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer" unique_id=806912222]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "Example Level #2"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer" unique_id=1089021380]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer" unique_id=1396072092]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 32
|
||||
script = ExtResource("2_8s04l")
|
||||
|
||||
[node name="LoseButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=842568930]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Lose"
|
||||
|
||||
[node name="WinButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=2033630088]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Win"
|
||||
|
||||
[node name="LoseButton2" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=866810661]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Lose"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer" unique_id=429267659]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TutorialButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=63948276]
|
||||
layout_mode = 2
|
||||
text = "Tutorial"
|
||||
|
||||
[node name="InputDisplayLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=919863907]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
horizontal_alignment = 1
|
||||
script = ExtResource("3_kjg0a")
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1863562002]
|
||||
layout_mode = 2
|
||||
text = "Change Level Color: "
|
||||
|
||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=153143410]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Change Color"
|
||||
|
||||
[node name="TutorialManager" type="Node" parent="." unique_id=927712379]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("4_w8c7f")
|
||||
tutorial_scenes = Array[PackedScene]([ExtResource("5_i1l6d")])
|
||||
|
||||
[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"]
|
||||
112
evolve-die-repeat/scenes/game_scene/levels/level_3.tscn
Normal file
112
evolve-die-repeat/scenes/game_scene/levels/level_3.tscn
Normal file
@@ -0,0 +1,112 @@
|
||||
[gd_scene format=3 uid="uid://d4idbbaheqxq7"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/levels/level.gd" id="1_3s8h5"]
|
||||
[ext_resource type="Script" path="res://addons/maaacks_game_template/base/nodes/utilities/capture_focus.gd" id="2_satlj"]
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/input_display_label.gd" id="3_4popk"]
|
||||
[ext_resource type="Script" path="res://scenes/game_scene/tutorial_manager.gd" id="4_mdq82"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/game_scene/tutorials/tutorial_3.tscn" id="5_32y40"]
|
||||
|
||||
[node name="Level3" type="Control" unique_id=710690354]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_3s8h5")
|
||||
|
||||
[node name="BackgroundColor" type="ColorRect" parent="." unique_id=2048289432]
|
||||
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="." unique_id=1139802558]
|
||||
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" unique_id=24784916]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 16
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer" unique_id=1118917856]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "Example Level #3"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer" unique_id=1867660130]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer" unique_id=1499324122]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 32
|
||||
script = ExtResource("2_satlj")
|
||||
|
||||
[node name="WinButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=500607117]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Win"
|
||||
|
||||
[node name="LoseButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=1616502597]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Lose"
|
||||
|
||||
[node name="LoseButton2" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=1282863293]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Lose"
|
||||
|
||||
[node name="LoseButton3" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=760845382]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Lose"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer" unique_id=1147500718]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TutorialButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=90402611]
|
||||
layout_mode = 2
|
||||
text = "Tutorial"
|
||||
|
||||
[node name="InputDisplayLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1335603973]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
horizontal_alignment = 1
|
||||
script = ExtResource("3_4popk")
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1223774581]
|
||||
layout_mode = 2
|
||||
text = "Change Level Color: "
|
||||
|
||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="MarginContainer/VBoxContainer/HBoxContainer2" unique_id=550861861]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Change Color"
|
||||
|
||||
[node name="TutorialManager" type="Node" parent="." unique_id=18876677]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("4_mdq82")
|
||||
tutorial_scenes = Array[PackedScene]([ExtResource("5_32y40")])
|
||||
|
||||
[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"]
|
||||
30
evolve-die-repeat/scenes/game_scene/tutorial_manager.gd
Normal file
30
evolve-die-repeat/scenes/game_scene/tutorial_manager.gd
Normal file
@@ -0,0 +1,30 @@
|
||||
extends Node
|
||||
## A script to add into a level or game scene to display tutorial windows.
|
||||
|
||||
## A list of tutorial scenes to open, one after the other.
|
||||
@export var tutorial_scenes : Array[PackedScene]
|
||||
## If true, open the tutorials when the scene becomes ready.
|
||||
@export var auto_open : bool = false
|
||||
## Delay before opening the tutorials when the scene becomes ready.
|
||||
@export var auto_open_delay : float = 0.25
|
||||
|
||||
func open_tutorials() -> void:
|
||||
var _initial_focus_control : Control = get_viewport().gui_get_focus_owner()
|
||||
for tutorial_scene in tutorial_scenes:
|
||||
var tutorial_menu : Control = 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)
|
||||
if tutorial_menu.has_signal(&"closed"):
|
||||
await tutorial_menu.closed
|
||||
else:
|
||||
await tutorial_menu.tree_exited
|
||||
if is_inside_tree() and _initial_focus_control:
|
||||
_initial_focus_control.grab_focus()
|
||||
|
||||
func _ready() -> void:
|
||||
if auto_open:
|
||||
if auto_open_delay > 0.0:
|
||||
await get_tree().create_timer(auto_open_delay, false).timeout
|
||||
open_tutorials.call_deferred()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bpvusqa2olipb
|
||||
@@ -0,0 +1,19 @@
|
||||
[gd_scene format=3 uid="uid://l2prmgoscdt0"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window.tscn" id="1_b2dkv"]
|
||||
|
||||
[node name="OverlaidWindow" unique_id=1876550858 instance=ExtResource("1_b2dkv")]
|
||||
custom_minimum_size = Vector2(420, 200)
|
||||
update_content = true
|
||||
text = "Click the Win button to progress.
|
||||
Click the Lose button to try again."
|
||||
title = "Tutorial"
|
||||
title_font_size = 20
|
||||
|
||||
[node name="TitleLabel" parent="ContentContainer/BoxContainer/TitleMargin/BoxContainer" parent_id_path=PackedInt32Array(1788474031) index="0" unique_id=1049966061]
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "Tutorial"
|
||||
|
||||
[node name="DescriptionLabel" parent="ContentContainer/BoxContainer/BodyMargin" parent_id_path=PackedInt32Array(590613964) index="0" unique_id=617407155]
|
||||
text = "Click the Win button to progress.
|
||||
Click the Lose button to try again."
|
||||
@@ -0,0 +1,19 @@
|
||||
[gd_scene format=3 uid="uid://byo4w7vrunyfn"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window.tscn" id="1_sjjon"]
|
||||
|
||||
[node name="OverlaidWindow" unique_id=902196267 instance=ExtResource("1_sjjon")]
|
||||
custom_minimum_size = Vector2(420, 200)
|
||||
update_content = true
|
||||
text = "Progress is saved.
|
||||
Pressing Continue from the main menu will load at the last checkpoint."
|
||||
title = "Tutorial"
|
||||
title_font_size = 20
|
||||
|
||||
[node name="TitleLabel" parent="ContentContainer/BoxContainer/TitleMargin/BoxContainer" parent_id_path=PackedInt32Array(1788474031) index="0" unique_id=1049966061]
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "Tutorial"
|
||||
|
||||
[node name="DescriptionLabel" parent="ContentContainer/BoxContainer/BodyMargin" parent_id_path=PackedInt32Array(590613964) index="0" unique_id=617407155]
|
||||
text = "Progress is saved.
|
||||
Pressing Continue from the main menu will load at the last checkpoint."
|
||||
@@ -0,0 +1,21 @@
|
||||
[gd_scene format=3 uid="uid://cktxovjiylmpi"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/nodes/windows/overlaid_window.tscn" id="1_hy5iy"]
|
||||
|
||||
[node name="OverlaidWindow" unique_id=1491564368 instance=ExtResource("1_hy5iy")]
|
||||
custom_minimum_size = Vector2(420, 200)
|
||||
update_content = true
|
||||
text = "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."
|
||||
title = "Tutorial"
|
||||
title_font_size = 20
|
||||
|
||||
[node name="TitleLabel" parent="ContentContainer/BoxContainer/TitleMargin/BoxContainer" parent_id_path=PackedInt32Array(1788474031) index="0" unique_id=1049966061]
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "Tutorial"
|
||||
|
||||
[node name="DescriptionLabel" parent="ContentContainer/BoxContainer/BodyMargin" parent_id_path=PackedInt32Array(590613964) index="0" unique_id=617407155]
|
||||
text = "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."
|
||||
Reference in New Issue
Block a user