Add MainMenu scene and script with start and quit functionality

This commit is contained in:
2025-08-23 17:12:29 +02:00
parent 846c3a6d83
commit 07995821f5
15 changed files with 125 additions and 145 deletions

Binary file not shown.

View File

@@ -1,35 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bns5c6hocyjua"
path="res://.godot/imported/ComicSansMS3.ttf-96b759465ff31d11f80283a7c12539ca.fontdata"
[deps]
source_file="res://Fonts/ComicSansMS3.ttf"
dest_files=["res://.godot/imported/ComicSansMS3.ttf-96b759465ff31d11f80283a7c12539ca.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

BIN
Fonts/Playful Boxes.otf Normal file

Binary file not shown.

View File

@@ -2,13 +2,13 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://cxiv86ha7xb6"
path="res://.godot/imported/comicz.ttf-66a741130a0c8d7e12d809da56e73bbf.fontdata"
uid="uid://wofoiaejxgsp"
path="res://.godot/imported/Playful Boxes.otf-113f6b887ec1f2b8d73de65734580dbc.fontdata"
[deps]
source_file="res://Fonts/comicz.ttf"
dest_files=["res://.godot/imported/comicz.ttf-66a741130a0c8d7e12d809da56e73bbf.fontdata"]
source_file="res://Fonts/Playful Boxes.otf"
dest_files=["res://.godot/imported/Playful Boxes.otf-113f6b887ec1f2b8d73de65734580dbc.fontdata"]
[params]

Binary file not shown.

View File

@@ -1,35 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bn4w716pu11lj"
path="res://.godot/imported/comici.ttf-66bd62e0af47442ee6f5c29193ae1405.fontdata"
[deps]
source_file="res://Fonts/comici.ttf"
dest_files=["res://.godot/imported/comici.ttf-66bd62e0af47442ee6f5c29193ae1405.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

View File

@@ -1,35 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://cqj7ianpr6jau"
path="res://.godot/imported/design.graffiti.comicsansms.ttf-6b5fd3e9dc5336099f793666df4ffc33.fontdata"
[deps]
source_file="res://Fonts/design.graffiti.comicsansms.ttf"
dest_files=["res://.godot/imported/design.graffiti.comicsansms.ttf-6b5fd3e9dc5336099f793666df4ffc33.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@@ -1,35 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://cafeq0txk8o1p"
path="res://.godot/imported/design.graffiti.comicsansmsgras.ttf-ab7fcd3a4b4dcda31884c957a19862a4.fontdata"
[deps]
source_file="res://Fonts/design.graffiti.comicsansmsgras.ttf"
dest_files=["res://.godot/imported/design.graffiti.comicsansmsgras.ttf-ab7fcd3a4b4dcda31884c957a19862a4.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

67
Scenes/main_menu.tscn Normal file
View File

@@ -0,0 +1,67 @@
[gd_scene load_steps=6 format=3 uid="uid://cmhvni5njpmee"]
[ext_resource type="Script" uid="uid://cbdokimy0qarg" path="res://Scripts/MainMenu.cs" id="1_1ehe0"]
[ext_resource type="FontFile" uid="uid://wofoiaejxgsp" path="res://Fonts/Playful Boxes.otf" id="1_28flt"]
[ext_resource type="Texture2D" uid="uid://d2wi2cs20q2b6" path="res://Parasitic_God.png" id="1_48xlc"]
[ext_resource type="PackedScene" uid="uid://bfil8sd154327" path="res://Scenes/Main/Main.tscn" id="2_ce3w2"]
[sub_resource type="LabelSettings" id="LabelSettings_48xlc"]
font = ExtResource("1_28flt")
font_size = 72
outline_size = 8
outline_color = Color(0.48, 0.408, 0, 1)
[node name="MainMenu" type="CanvasLayer" node_paths=PackedStringArray("_startButton", "_quitButton")]
script = ExtResource("1_1ehe0")
_gameScene = ExtResource("2_ce3w2")
_startButton = NodePath("CenterContainer/VBoxContainer/Play")
_quitButton = NodePath("CenterContainer/VBoxContainer/Exit")
[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="TextureRect" type="TextureRect" parent="Control"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("1_48xlc")
expand_mode = 2
stretch_mode = 5
[node name="CenterContainer" type="CenterContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
layout_mode = 2
[node name="Title" type="Label" parent="CenterContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 0
size_flags_stretch_ratio = 0.0
text = "PARASITIC GOD"
label_settings = SubResource("LabelSettings_48xlc")
[node name="Play" type="Button" parent="CenterContainer/VBoxContainer"]
layout_mode = 2
size_flags_stretch_ratio = 0.0
theme_override_font_sizes/font_size = 30
text = "Play"
[node name="Exit" type="Button" parent="CenterContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "Exit"

52
Scripts/MainMenu.cs Normal file
View File

@@ -0,0 +1,52 @@
using Godot;
namespace ParasiticGod.Scripts;
public partial class MainMenu : Node
{
[Export] private PackedScene _gameScene;
[Export] private Button _startButton;
[Export] private Button _quitButton;
public override void _Ready()
{
if (_startButton != null)
{
_startButton.Pressed += OnStartButtonPressed;
}
if (_quitButton != null)
{
_quitButton.Pressed += OnQuitButtonPressed;
}
}
public override void _ExitTree()
{
if (_startButton != null)
{
_startButton.Pressed -= OnStartButtonPressed;
}
if (_quitButton != null)
{
_quitButton.Pressed -= OnQuitButtonPressed;
}
}
private void OnStartButtonPressed()
{
if (_gameScene == null)
{
GD.PrintErr("Game scene is not assigned in MainMenu.");
return;
}
GetTree().ChangeSceneToPacked(_gameScene);
}
private void OnQuitButtonPressed()
{
GetTree().Quit();
}
}

1
Scripts/MainMenu.cs.uid Normal file
View File

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

View File

@@ -11,7 +11,7 @@ config_version=5
[application]
config/name="Parasitic God"
run/main_scene="uid://bfil8sd154327"
run/main_scene="uid://cmhvni5njpmee"
config/features=PackedStringArray("4.4", "C#", "GL Compatibility")
boot_splash/show_image=false
boot_splash/fullsize=false