diff --git a/assets/textures/background/0.png b/assets/textures/background/0.png new file mode 100644 index 0000000..922ed81 Binary files /dev/null and b/assets/textures/background/0.png differ diff --git a/assets/textures/background/0.png.import b/assets/textures/background/0.png.import new file mode 100644 index 0000000..d1a8930 --- /dev/null +++ b/assets/textures/background/0.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d23fefvrd41re" +path="res://.godot/imported/0.png-7d5620e6b53641efc94237993c24f99a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/background/0.png" +dest_files=["res://.godot/imported/0.png-7d5620e6b53641efc94237993c24f99a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/project.godot b/project.godot index 4a35e2b..dbd2654 100644 --- a/project.godot +++ b/project.godot @@ -18,6 +18,7 @@ config/icon="res://icon.svg" [autoload] ControllerIcons="*uid://b7ho1rjcpht1d" +GameData="*uid://d4beiel88cwc7" [display] diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn index daa369d..abadbc0 100644 --- a/scenes/main_menu.tscn +++ b/scenes/main_menu.tscn @@ -2,6 +2,10 @@ [ext_resource type="Script" uid="uid://cj37ns1ahfvhr" path="res://scripts/main_menu.gd" id="1_ekxnf"] [ext_resource type="Script" uid="uid://7hglx6nfu063" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="2_bqqt6"] +[ext_resource type="Texture2D" uid="uid://d23fefvrd41re" path="res://assets/textures/background/0.png" id="2_wu84c"] + +[sub_resource type="LabelSettings" id="LabelSettings_3agn1"] +font_size = 64 [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bqqt6"] @@ -14,8 +18,12 @@ script = ExtResource("2_bqqt6") path = "ui_accept" metadata/_custom_type_script = "uid://7hglx6nfu063" -[sub_resource type="LabelSettings" id="LabelSettings_3agn1"] -font_size = 64 +[sub_resource type="Texture2D" id="Texture2D_bqqt6"] +resource_local_to_scene = false +resource_name = "" +script = ExtResource("2_bqqt6") +path = "ui_cancel" +metadata/_custom_type_script = "uid://7hglx6nfu063" [node name="MainMenu" type="Control" unique_id=1471802333] layout_mode = 3 @@ -25,60 +33,46 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_ekxnf") +progression_backgrounds = Array[Texture2D]([ExtResource("2_wu84c")]) -[node name="PanelContainer" type="PanelContainer" parent="." unique_id=1404024715] +[node name="Background" type="TextureRect" parent="." unique_id=545049912] +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 +expand_mode = 1 +stretch_mode = 6 + +[node name="GameInfos" type="Control" parent="." unique_id=2060446590] +unique_name_in_owner = true layout_mode = 1 anchors_preset = 6 anchor_left = 1.0 anchor_top = 0.5 anchor_right = 1.0 anchor_bottom = 0.5 +offset_left = -40.0 +offset_top = -20.0 +offset_bottom = 20.0 +grow_horizontal = 0 +grow_vertical = 2 + +[node name="GreyedBackground" type="PanelContainer" parent="GameInfos" unique_id=1404024715] +layout_mode = 0 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 offset_left = -571.0 offset_top = -323.5 offset_bottom = 323.5 grow_horizontal = 0 grow_vertical = 2 -[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1437260283] -layout_mode = 1 -anchors_preset = 3 -anchor_left = 1.0 -anchor_top = 1.0 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = -130.0 -offset_top = -67.0 -grow_horizontal = 0 -grow_vertical = 0 -theme_override_constants/margin_right = 200 -theme_override_constants/margin_bottom = 150 - -[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer" unique_id=212717997] -layout_mode = 2 - -[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/VBoxContainer" unique_id=455366583] -layout_mode = 2 -theme_override_styles/panel = SubResource("StyleBoxEmpty_bqqt6") - -[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/PanelContainer" unique_id=980574030] -layout_mode = 2 - -[node name="Start" type="Button" parent="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer" unique_id=1823965781] -unique_name_in_owner = true -layout_mode = 2 -theme_override_styles/focus = SubResource("StyleBoxEmpty_ekxnf") -text = "Appuyer sur" -flat = true -icon_alignment = 2 - -[node name="TextureRect" type="TextureRect" parent="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer" unique_id=544893863] -custom_minimum_size = Vector2(40, 40) -layout_mode = 2 -size_flags_vertical = 3 -texture = SubResource("Texture2D_wu84c") -expand_mode = 1 - -[node name="Label" type="Label" parent="." unique_id=745232782] +[node name="GameTitle" type="Label" parent="GameInfos" unique_id=745232782] layout_mode = 1 anchors_preset = 6 anchor_left = 1.0 @@ -94,4 +88,95 @@ grow_vertical = 2 text = "Tales of PKMN" label_settings = SubResource("LabelSettings_3agn1") -[connection signal="pressed" from="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer/Start" to="." method="_on_start_pressed"] +[node name="Buttons" type="MarginContainer" parent="GameInfos" unique_id=1437260283] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -347.0 +offset_top = 79.0 +offset_bottom = 304.0 +grow_horizontal = 0 +grow_vertical = 0 +theme_override_constants/margin_right = 200 +theme_override_constants/margin_bottom = 150 + +[node name="VBoxContainer" type="VBoxContainer" parent="GameInfos/Buttons" unique_id=212717997] +layout_mode = 2 + +[node name="StartContainer" type="PanelContainer" parent="GameInfos/Buttons/VBoxContainer" unique_id=455366583] +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_bqqt6") + +[node name="HBoxContainer" type="HBoxContainer" parent="GameInfos/Buttons/VBoxContainer/StartContainer" unique_id=980574030] +layout_mode = 2 + +[node name="Start" type="Button" parent="GameInfos/Buttons/VBoxContainer/StartContainer/HBoxContainer" unique_id=1823965781] +unique_name_in_owner = true +layout_mode = 2 +focus_neighbor_bottom = NodePath("../../../QuitContainer/HBoxContainer/Quit") +theme_override_styles/focus = SubResource("StyleBoxEmpty_ekxnf") +text = "Appuyer sur" +flat = true +icon_alignment = 2 + +[node name="TextureRect" type="TextureRect" parent="GameInfos/Buttons/VBoxContainer/StartContainer/HBoxContainer" unique_id=544893863] +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +size_flags_vertical = 3 +texture = SubResource("Texture2D_wu84c") +expand_mode = 1 + +[node name="QuitContainer" type="PanelContainer" parent="GameInfos/Buttons/VBoxContainer" unique_id=24421836] +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_bqqt6") + +[node name="HBoxContainer" type="HBoxContainer" parent="GameInfos/Buttons/VBoxContainer/QuitContainer" unique_id=174332387] +layout_mode = 2 +size_flags_horizontal = 4 + +[node name="Quit" type="Button" parent="GameInfos/Buttons/VBoxContainer/QuitContainer/HBoxContainer" unique_id=247251645] +unique_name_in_owner = true +layout_mode = 2 +focus_neighbor_top = NodePath("../../../StartContainer/HBoxContainer/Start") +theme_override_styles/focus = SubResource("StyleBoxEmpty_ekxnf") +text = "Quitter le jeu" +flat = true +icon_alignment = 2 + +[node name="TextureRect" type="TextureRect" parent="GameInfos/Buttons/VBoxContainer/QuitContainer/HBoxContainer" unique_id=1821014740] +visible = false +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +size_flags_vertical = 3 +texture = SubResource("Texture2D_bqqt6") +expand_mode = 1 + +[node name="VersionLabel" type="Label" parent="." unique_id=673582892] +unique_name_in_owner = true +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_top = -23.0 +offset_right = 40.0 +grow_vertical = 0 + +[node name="MusicPlayer" type="AudioStreamPlayer" parent="." unique_id=1279071971] +unique_name_in_owner = true + +[node name="TransitionRect" type="ColorRect" parent="." unique_id=389028330] +unique_name_in_owner = true +modulate = Color(1, 1, 1, 0) +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) + +[connection signal="pressed" from="GameInfos/Buttons/VBoxContainer/StartContainer/HBoxContainer/Start" to="." method="_on_start_pressed"] +[connection signal="pressed" from="GameInfos/Buttons/VBoxContainer/QuitContainer/HBoxContainer/Quit" to="." method="_on_quit_pressed"] diff --git a/scenes/main_menu.tscn6324169466.tmp b/scenes/main_menu.tscn6324169466.tmp new file mode 100644 index 0000000..06abe40 --- /dev/null +++ b/scenes/main_menu.tscn6324169466.tmp @@ -0,0 +1,109 @@ +[gd_scene format=3 uid="uid://bluq6da7tku3d"] + +[ext_resource type="Script" uid="uid://cj37ns1ahfvhr" path="res://scripts/main_menu.gd" id="1_ekxnf"] +[ext_resource type="Script" uid="uid://7hglx6nfu063" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="2_bqqt6"] +[ext_resource type="Texture2D" uid="uid://d23fefvrd41re" path="res://assets/textures/background/0.png" id="2_wu84c"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bqqt6"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ekxnf"] + +[sub_resource type="Texture2D" id="Texture2D_wu84c"] +resource_local_to_scene = false +resource_name = "" +script = ExtResource("2_bqqt6") +path = "ui_accept" +metadata/_custom_type_script = "uid://7hglx6nfu063" + +[sub_resource type="LabelSettings" id="LabelSettings_3agn1"] +font_size = 64 + +[node name="MainMenu" type="Control" unique_id=1471802333] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_ekxnf") +progression_backgrounds = Array[Texture2D]([ExtResource("2_wu84c")]) + +[node name="Background" type="TextureRect" parent="." unique_id=545049912] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +expand_mode = 1 +stretch_mode = 6 + +[node name="PanelContainer" type="PanelContainer" parent="." unique_id=1404024715] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -571.0 +offset_top = -323.5 +offset_bottom = 323.5 +grow_horizontal = 0 +grow_vertical = 2 + +[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1437260283] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -130.0 +offset_top = -67.0 +grow_horizontal = 0 +grow_vertical = 0 +theme_override_constants/margin_right = 200 +theme_override_constants/margin_bottom = 150 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer" unique_id=212717997] +layout_mode = 2 + +[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/VBoxContainer" unique_id=455366583] +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_bqqt6") + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/PanelContainer" unique_id=980574030] +layout_mode = 2 + +[node name="Start" type="Button" parent="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer" unique_id=1823965781] +unique_name_in_owner = true +layout_mode = 2 +theme_override_styles/focus = SubResource("StyleBoxEmpty_ekxnf") +text = "Appuyer sur" +flat = true +icon_alignment = 2 + +[node name="TextureRect" type="TextureRect" parent="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer" unique_id=544893863] +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +size_flags_vertical = 3 +texture = SubResource("Texture2D_wu84c") +expand_mode = 1 + +[node name="Label" type="Label" parent="." unique_id=745232782] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -489.0 +offset_top = -185.0 +offset_right = -45.0 +offset_bottom = -97.0 +grow_horizontal = 0 +grow_vertical = 2 +text = "Tales of PKMN" +label_settings = SubResource("LabelSettings_3agn1") + +[connection signal="pressed" from="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer/Start" to="." method="_on_start_pressed"] diff --git a/scenes/main_menu.tscn6333752743.tmp b/scenes/main_menu.tscn6333752743.tmp new file mode 100644 index 0000000..06abe40 --- /dev/null +++ b/scenes/main_menu.tscn6333752743.tmp @@ -0,0 +1,109 @@ +[gd_scene format=3 uid="uid://bluq6da7tku3d"] + +[ext_resource type="Script" uid="uid://cj37ns1ahfvhr" path="res://scripts/main_menu.gd" id="1_ekxnf"] +[ext_resource type="Script" uid="uid://7hglx6nfu063" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="2_bqqt6"] +[ext_resource type="Texture2D" uid="uid://d23fefvrd41re" path="res://assets/textures/background/0.png" id="2_wu84c"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bqqt6"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ekxnf"] + +[sub_resource type="Texture2D" id="Texture2D_wu84c"] +resource_local_to_scene = false +resource_name = "" +script = ExtResource("2_bqqt6") +path = "ui_accept" +metadata/_custom_type_script = "uid://7hglx6nfu063" + +[sub_resource type="LabelSettings" id="LabelSettings_3agn1"] +font_size = 64 + +[node name="MainMenu" type="Control" unique_id=1471802333] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_ekxnf") +progression_backgrounds = Array[Texture2D]([ExtResource("2_wu84c")]) + +[node name="Background" type="TextureRect" parent="." unique_id=545049912] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +expand_mode = 1 +stretch_mode = 6 + +[node name="PanelContainer" type="PanelContainer" parent="." unique_id=1404024715] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -571.0 +offset_top = -323.5 +offset_bottom = 323.5 +grow_horizontal = 0 +grow_vertical = 2 + +[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1437260283] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -130.0 +offset_top = -67.0 +grow_horizontal = 0 +grow_vertical = 0 +theme_override_constants/margin_right = 200 +theme_override_constants/margin_bottom = 150 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer" unique_id=212717997] +layout_mode = 2 + +[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/VBoxContainer" unique_id=455366583] +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_bqqt6") + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/PanelContainer" unique_id=980574030] +layout_mode = 2 + +[node name="Start" type="Button" parent="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer" unique_id=1823965781] +unique_name_in_owner = true +layout_mode = 2 +theme_override_styles/focus = SubResource("StyleBoxEmpty_ekxnf") +text = "Appuyer sur" +flat = true +icon_alignment = 2 + +[node name="TextureRect" type="TextureRect" parent="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer" unique_id=544893863] +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +size_flags_vertical = 3 +texture = SubResource("Texture2D_wu84c") +expand_mode = 1 + +[node name="Label" type="Label" parent="." unique_id=745232782] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -489.0 +offset_top = -185.0 +offset_right = -45.0 +offset_bottom = -97.0 +grow_horizontal = 0 +grow_vertical = 2 +text = "Tales of PKMN" +label_settings = SubResource("LabelSettings_3agn1") + +[connection signal="pressed" from="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer/Start" to="." method="_on_start_pressed"] diff --git a/scenes/main_menu.tscn6356094100.tmp b/scenes/main_menu.tscn6356094100.tmp new file mode 100644 index 0000000..06abe40 --- /dev/null +++ b/scenes/main_menu.tscn6356094100.tmp @@ -0,0 +1,109 @@ +[gd_scene format=3 uid="uid://bluq6da7tku3d"] + +[ext_resource type="Script" uid="uid://cj37ns1ahfvhr" path="res://scripts/main_menu.gd" id="1_ekxnf"] +[ext_resource type="Script" uid="uid://7hglx6nfu063" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="2_bqqt6"] +[ext_resource type="Texture2D" uid="uid://d23fefvrd41re" path="res://assets/textures/background/0.png" id="2_wu84c"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bqqt6"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ekxnf"] + +[sub_resource type="Texture2D" id="Texture2D_wu84c"] +resource_local_to_scene = false +resource_name = "" +script = ExtResource("2_bqqt6") +path = "ui_accept" +metadata/_custom_type_script = "uid://7hglx6nfu063" + +[sub_resource type="LabelSettings" id="LabelSettings_3agn1"] +font_size = 64 + +[node name="MainMenu" type="Control" unique_id=1471802333] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_ekxnf") +progression_backgrounds = Array[Texture2D]([ExtResource("2_wu84c")]) + +[node name="Background" type="TextureRect" parent="." unique_id=545049912] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +expand_mode = 1 +stretch_mode = 6 + +[node name="PanelContainer" type="PanelContainer" parent="." unique_id=1404024715] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -571.0 +offset_top = -323.5 +offset_bottom = 323.5 +grow_horizontal = 0 +grow_vertical = 2 + +[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1437260283] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -130.0 +offset_top = -67.0 +grow_horizontal = 0 +grow_vertical = 0 +theme_override_constants/margin_right = 200 +theme_override_constants/margin_bottom = 150 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer" unique_id=212717997] +layout_mode = 2 + +[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/VBoxContainer" unique_id=455366583] +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_bqqt6") + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/PanelContainer" unique_id=980574030] +layout_mode = 2 + +[node name="Start" type="Button" parent="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer" unique_id=1823965781] +unique_name_in_owner = true +layout_mode = 2 +theme_override_styles/focus = SubResource("StyleBoxEmpty_ekxnf") +text = "Appuyer sur" +flat = true +icon_alignment = 2 + +[node name="TextureRect" type="TextureRect" parent="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer" unique_id=544893863] +custom_minimum_size = Vector2(40, 40) +layout_mode = 2 +size_flags_vertical = 3 +texture = SubResource("Texture2D_wu84c") +expand_mode = 1 + +[node name="Label" type="Label" parent="." unique_id=745232782] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -489.0 +offset_top = -185.0 +offset_right = -45.0 +offset_bottom = -97.0 +grow_horizontal = 0 +grow_vertical = 2 +text = "Tales of PKMN" +label_settings = SubResource("LabelSettings_3agn1") + +[connection signal="pressed" from="MarginContainer/VBoxContainer/PanelContainer/HBoxContainer/Start" to="." method="_on_start_pressed"] diff --git a/scripts/game_data.gd b/scripts/game_data.gd new file mode 100644 index 0000000..708fe72 --- /dev/null +++ b/scripts/game_data.gd @@ -0,0 +1,14 @@ +extends Node +# Autoload : GameData + +var story_progress : int = 0 # 0 = début, 1 = après 1er badge, 2 = après 2e badge, etc. + +func save() -> void: + var config := ConfigFile.new() + config.set_value("progress", "story_progress", story_progress) + config.save("user://save.cfg") + +func load_data() -> void: + var config := ConfigFile.new() + if config.load("user://save.cfg") == OK: + story_progress = config.get_value("progress", "story_progress", 0) diff --git a/scripts/game_data.gd.uid b/scripts/game_data.gd.uid new file mode 100644 index 0000000..e464451 --- /dev/null +++ b/scripts/game_data.gd.uid @@ -0,0 +1 @@ +uid://d4beiel88cwc7 diff --git a/scripts/main_menu.gd b/scripts/main_menu.gd index 65ef293..44bcf07 100644 --- a/scripts/main_menu.gd +++ b/scripts/main_menu.gd @@ -1,18 +1,72 @@ extends Node @onready var Start: Button = %Start +@onready var Quit: Button = %Quit +@onready var background: TextureRect = %Background +@onready var music_player: AudioStreamPlayer = %MusicPlayer +@onready var transition_rect: ColorRect = %TransitionRect +@onready var version_label: Label = %VersionLabel +@onready var game_infos: Control = %GameInfos + +@export var progression_backgrounds: Array[Texture2D] = [] +@export var menu_music: AudioStream + +const GAME_SCENE_PATH := "res://scenes/main.tscn" +const MUSIC_FADE_DURATION := 0.8 +const SCREEN_FADE_DURATION := 0.6 + +var is_transitioning : bool = false -# Called when the node enters the scene tree for the first time. func _ready() -> void: - pass # Replace with function body. + update_background() + setup_version_label() + play_menu_music() + fade_in_game_infos() - -# Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - Start.grab_focus() - pass + if !is_transitioning: + Start.grab_focus() +func update_background() -> void: + if progression_backgrounds.is_empty(): + return + var stage : int = clampi(GameData.story_progress, 0, progression_backgrounds.size() - 1) + background.texture = progression_backgrounds[stage] + +func setup_version_label() -> void: + var version : String = ProjectSettings.get_setting("application/config/version", "") + version_label.text = "v%s" % version if version != "" else "" + +func play_menu_music() -> void: + if !menu_music: return + music_player.stream = menu_music + music_player.volume_db = -80.0 + music_player.play() + var tween := create_tween() + tween.tween_property(music_player, "volume_db", 0.0, MUSIC_FADE_DURATION) + +func fade_in_game_infos() -> void: + game_infos.modulate.a = 0.0 + var tween := create_tween() + tween.tween_property(game_infos, "modulate:a", 1.0, 1.0) func _on_start_pressed() -> void: - get_tree().change_scene_to_file("res://scenes/main.tscn") - pass # Replace with function body. + if is_transitioning: return + is_transitioning = true + start_transition_to(GAME_SCENE_PATH) + +func _on_quit_pressed() -> void: + get_tree().quit() + +func start_transition_to(scene_path : String) -> void: + if music_player.playing: + var music_tween := create_tween() + music_tween.tween_property(music_player, "volume_db", -80.0, MUSIC_FADE_DURATION) + + transition_rect.visible = true + transition_rect.modulate.a = 0.0 + var screen_tween := create_tween() + screen_tween.tween_property(transition_rect, "modulate:a", 1.0, SCREEN_FADE_DURATION) + await screen_tween.finished + + get_tree().change_scene_to_file(scene_path)