Add MainMenu

This commit is contained in:
Sofia 2024-08-20 18:34:08 +03:00
parent e5215356f3
commit fc15cad1b0
10 changed files with 207 additions and 4 deletions

BIN
materials/stairs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dv6fmvhxa0yyr"
path="res://.godot/imported/stairs.png-8852e0dd27c2e0c5b61937bcfdf2d9df.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://materials/stairs.png"
dest_files=["res://.godot/imported/stairs.png-8852e0dd27c2e0c5b61937bcfdf2d9df.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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

BIN
materials/tower.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d2p5wswquw0la"
path="res://.godot/imported/tower.png-af8481b47367d8ad6b6790723593a987.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://materials/tower.png"
dest_files=["res://.godot/imported/tower.png-af8481b47367d8ad6b6790723593a987.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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

View File

@ -24,7 +24,6 @@ UserSettings="*res://scripts/UserSettings.cs"
window/size/viewport_width=1920
window/size/viewport_height=1080
window/stretch/mode="canvas_items"
window/stretch/scale=2.0
[dotnet]

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://c5ksyousvxx7x"]
[gd_scene load_steps=5 format=3 uid="uid://c5ksyousvxx7x"]
[ext_resource type="PackedScene" uid="uid://dv81sy34l8ice" path="res://scenes/stairs/stairs.tscn" id="1_00r22"]
[ext_resource type="Script" path="res://scripts/SceneSwitcher.cs" id="1_ps0jf"]
[ext_resource type="PackedScene" uid="uid://bqtfwxneu1eqw" path="res://scenes/main_menu.tscn" id="2_mxfpj"]
[ext_resource type="PackedScene" uid="uid://8po7ftboqq4k" path="res://scenes/demo/demo.tscn" id="2_rf0rf"]
[node name="EntrypointScene" type="Node" node_paths=PackedStringArray("LoadingScreen")]
@ -9,6 +10,7 @@ process_mode = 3
script = ExtResource("1_ps0jf")
AddedLoadingScreenSeconds = 0.3
LoadingScreen = NodePath("LoadingScreen")
MainMenu = ExtResource("2_mxfpj")
DemoScene = ExtResource("2_rf0rf")
StairsScene = ExtResource("1_00r22")

108
scenes/main_menu.tscn Normal file
View File

@ -0,0 +1,108 @@
[gd_scene load_steps=4 format=3 uid="uid://bqtfwxneu1eqw"]
[ext_resource type="Script" path="res://scripts/MainMenu.cs" id="1_8obly"]
[ext_resource type="Texture2D" uid="uid://d2p5wswquw0la" path="res://materials/tower.png" id="1_h16yv"]
[ext_resource type="Texture2D" uid="uid://dv6fmvhxa0yyr" path="res://materials/stairs.png" id="2_6auxm"]
[node name="MainMenu" 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_8obly")
[node name="Panel" type="Panel" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="GameNameLabel" type="Label" parent="Panel"]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_top = 100.0
offset_bottom = 188.0
grow_horizontal = 2
theme_override_font_sizes/font_size = 64
text = "Miniature Maker"
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="Panel"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -602.0
offset_top = -300.0
offset_right = 602.0
offset_bottom = 300.0
grow_horizontal = 2
grow_vertical = 2
alignment = 1
[node name="BoxContainer2" type="BoxContainer" parent="Panel/HBoxContainer"]
custom_minimum_size = Vector2(600, 600)
layout_mode = 2
alignment = 1
vertical = true
metadata/_edit_lock_ = true
[node name="TextureRect" type="TextureRect" parent="Panel/HBoxContainer/BoxContainer2"]
layout_mode = 2
texture = ExtResource("1_h16yv")
expand_mode = 5
stretch_mode = 5
metadata/_edit_lock_ = true
[node name="TowerButton" type="Button" parent="Panel/HBoxContainer/BoxContainer2"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Tower"
metadata/_edit_lock_ = true
[node name="BoxContainer" type="BoxContainer" parent="Panel/HBoxContainer"]
custom_minimum_size = Vector2(600, 600)
layout_mode = 2
alignment = 1
vertical = true
metadata/_edit_lock_ = true
[node name="TextureRect" type="TextureRect" parent="Panel/HBoxContainer/BoxContainer"]
layout_mode = 2
texture = ExtResource("2_6auxm")
expand_mode = 5
stretch_mode = 5
metadata/_edit_lock_ = true
[node name="StairsButton" type="Button" parent="Panel/HBoxContainer/BoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Stairs"
metadata/_edit_lock_ = true
[node name="QuitButton" type="Button" parent="Panel"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -100.0
offset_top = -180.0
offset_right = 100.0
offset_bottom = -127.0
grow_horizontal = 2
grow_vertical = 0
theme_override_font_sizes/font_size = 32
text = "Quit"
[connection signal="pressed" from="Panel/HBoxContainer/BoxContainer2/TowerButton" to="." method="Tower"]
[connection signal="pressed" from="Panel/HBoxContainer/BoxContainer/StairsButton" to="." method="Stairs"]
[connection signal="pressed" from="Panel/QuitButton" to="." method="Quit"]

View File

@ -44,9 +44,10 @@ light_data = ExtResource("2_36ysp")
[node name="HazyEnv" parent="." instance=ExtResource("3_gdvn0")]
[node name="Player" parent="." instance=ExtResource("8_6btor")]
[node name="Player" parent="." node_paths=PackedStringArray("Table") instance=ExtResource("8_6btor")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -58.6119, 24, 3.65156)
MaxVolumeWindHeight = 60.0
Table = NodePath("../table")
[node name="table" parent="." node_paths=PackedStringArray("Hud", "TrenchbroomMap") instance=ExtResource("10_hcwch")]
transform = Transform3D(-0.0123217, 0, 0.999924, 0, 1, 0, -0.999924, 0, -0.0123217, -58.2601, 24.0011, 0)

19
scripts/MainMenu.cs Normal file
View File

@ -0,0 +1,19 @@
using Gmtk24;
using Godot;
using System;
namespace Gmtk24 {
public partial class MainMenu : Control {
public void Tower() {
SceneSwitcher.Singleton.SwitchToScene(SceneSwitcher.Scene.Demo);
}
public void Stairs() {
SceneSwitcher.Singleton.SwitchToScene(SceneSwitcher.Scene.Stairs);
}
public void Quit() {
GetTree().Quit();
}
}
}

View File

@ -4,6 +4,7 @@ using Godot;
namespace Gmtk24 {
public partial class SceneSwitcher : Node {
public enum Scene {
MainMenu,
Demo,
Stairs,
}
@ -17,6 +18,8 @@ namespace Gmtk24 {
[Export]
public Control LoadingScreen;
[Export]
public PackedScene MainMenu;
[Export]
public PackedScene DemoScene;
[Export]
public PackedScene StairsScene;
@ -31,7 +34,7 @@ namespace Gmtk24 {
public override void _Ready() {
Singleton = this;
SwitchToScene(Scene.Demo);
SwitchToScene(Scene.MainMenu);
}
public override void _UnhandledInput(InputEvent @event) {
@ -62,6 +65,9 @@ namespace Gmtk24 {
public void SwitchToScene(Scene newScene) {
PackedScene sceneToInstantiate = null;
switch (newScene) {
case Scene.MainMenu:
sceneToInstantiate = MainMenu;
break;
case Scene.Demo:
sceneToInstantiate = DemoScene;
break;