From d2c788c826cfb87a54c4f21994f72ed202738604 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 26 Apr 2026 16:55:35 +0200 Subject: [PATCH] Added main menu and basic functionality --- Game.tscn => Scenes/Game.tscn | 0 Scenes/MainMenu.tscn | 91 +++++++++++++++++++++++++++++++++++ Scripts/MainMenu.cs | 25 ++++++++++ Scripts/MainMenu.cs.uid | 1 + Scripts/World.cs | 1 + project.godot | 2 +- 6 files changed, 119 insertions(+), 1 deletion(-) rename Game.tscn => Scenes/Game.tscn (100%) create mode 100644 Scenes/MainMenu.tscn create mode 100644 Scripts/MainMenu.cs create mode 100644 Scripts/MainMenu.cs.uid diff --git a/Game.tscn b/Scenes/Game.tscn similarity index 100% rename from Game.tscn rename to Scenes/Game.tscn diff --git a/Scenes/MainMenu.tscn b/Scenes/MainMenu.tscn new file mode 100644 index 0000000..34c7ab0 --- /dev/null +++ b/Scenes/MainMenu.tscn @@ -0,0 +1,91 @@ +[gd_scene format=3 uid="uid://dlommaelbbw2b"] + +[ext_resource type="Script" uid="uid://dda0bhhqspbr0" path="res://Scripts/MainMenu.cs" id="1_tt5f1"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bnhvo"] +bg_color = Color(0.24115604, 0.24115607, 0.24115595, 1) +border_width_top = 1 +border_width_bottom = 1 +border_color = Color(0.025273602, 0.38374466, 0.4973219, 1) +corner_radius_top_left = 10 +corner_radius_top_right = 10 +corner_radius_bottom_right = 10 +corner_radius_bottom_left = 10 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tt5f1"] +bg_color = Color(0.46618086, 0.4661808, 0.4661808, 1) +border_width_top = 1 +border_width_bottom = 1 +border_color = Color(0.025273602, 0.38374466, 0.4973219, 1) +corner_radius_top_left = 10 +corner_radius_top_right = 10 +corner_radius_bottom_right = 10 +corner_radius_bottom_left = 10 + +[node name="MainMenu" type="Control" unique_id=622011874] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_tt5f1") + +[node name="Panel" type="Panel" parent="." unique_id=167014122] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="CenterContainer" type="CenterContainer" parent="." unique_id=546163427] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -4.0 +offset_top = -126.5 +offset_right = 4.0 +offset_bottom = 126.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer" unique_id=1309259619] +layout_mode = 2 +theme_override_constants/separation = 40 + +[node name="RichTextLabel" type="RichTextLabel" parent="CenterContainer/VBoxContainer" unique_id=195514567] +layout_mode = 2 +bbcode_enabled = true +text = "[font_size=50]RuinAdventurer[/font_size]" +fit_content = true +scroll_active = false +autowrap_mode = 0 +horizontal_alignment = 1 + +[node name="Spacer" type="Panel" parent="CenterContainer/VBoxContainer" unique_id=1075556994] +layout_mode = 2 + +[node name="btnPlay" type="Button" parent="CenterContainer/VBoxContainer" unique_id=452402808] +layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxFlat_bnhvo") +theme_override_styles/hover = SubResource("StyleBoxFlat_tt5f1") +text = "Start Game" + +[node name="btnOptions" type="Button" parent="CenterContainer/VBoxContainer" unique_id=891656915] +layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxFlat_bnhvo") +theme_override_styles/hover = SubResource("StyleBoxFlat_tt5f1") +text = "Options" + +[node name="btnExit" type="Button" parent="CenterContainer/VBoxContainer" unique_id=2025231658] +layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxFlat_bnhvo") +theme_override_styles/hover = SubResource("StyleBoxFlat_tt5f1") +text = "Exit Game" + +[connection signal="button_up" from="CenterContainer/VBoxContainer/btnPlay" to="." method="OnPlayPressed"] +[connection signal="button_up" from="CenterContainer/VBoxContainer/btnExit" to="." method="OnQuitPressed"] diff --git a/Scripts/MainMenu.cs b/Scripts/MainMenu.cs new file mode 100644 index 0000000..599ed5f --- /dev/null +++ b/Scripts/MainMenu.cs @@ -0,0 +1,25 @@ +using Godot; +using System; + +public partial class MainMenu : Control +{ + // Called when the node enters the scene tree for the first time. + public override void _Ready() + { + } + + // Called every frame. 'delta' is the elapsed time since the previous frame. + public override void _Process(double delta) + { + } + + public void OnPlayPressed() + { + GetTree().ChangeSceneToFile("res://Scenes/Game.tscn"); + } + + public void OnQuitPressed() + { + GetTree().Quit(); + } +} diff --git a/Scripts/MainMenu.cs.uid b/Scripts/MainMenu.cs.uid new file mode 100644 index 0000000..213e872 --- /dev/null +++ b/Scripts/MainMenu.cs.uid @@ -0,0 +1 @@ +uid://dda0bhhqspbr0 diff --git a/Scripts/World.cs b/Scripts/World.cs index c5f088a..d2bf97b 100644 --- a/Scripts/World.cs +++ b/Scripts/World.cs @@ -89,6 +89,7 @@ public partial class World : Node3D { Robot robot = ResourceLoader.LoadRobotPrefab().Instantiate(); robot.Position = map[0].tiles[1,1].Position; + robot.Position -= new Vector3(0,1.5f,0); AddChild(robot); } } diff --git a/project.godot b/project.godot index f25e0d0..1f4eefd 100644 --- a/project.godot +++ b/project.godot @@ -15,7 +15,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true [application] config/name="RuinAdventurer" -run/main_scene="uid://cgsmfi2s51cbd" +run/main_scene="uid://dlommaelbbw2b" config/features=PackedStringArray("4.6", "C#", "Forward Plus") config/icon="res://icon.svg"