Settings and resolutions

This commit is contained in:
2025-07-29 19:15:39 +02:00
parent e638e780c8
commit ec3a23b5cc
16 changed files with 617 additions and 0 deletions

BIN
Assets/Maps/map1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cheweipqa125e"
path="res://.godot/imported/map1.png-9abf0d8a931f730e91b072952cabd99e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Maps/map1.png"
dest_files=["res://.godot/imported/map1.png-9abf0d8a931f730e91b072952cabd99e.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=false
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bgy114b67j3kg"
path="res://.godot/imported/8-bit-graphics-pixels-scene-with-castle.jpg-5e75aae1144b62b766366fd0294ed4fc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Others/8-bit-graphics-pixels-scene-with-castle.jpg"
dest_files=["res://.godot/imported/8-bit-graphics-pixels-scene-with-castle.jpg-5e75aae1144b62b766366fd0294ed4fc.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=false
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

Binary file not shown.

View File

@ -0,0 +1,35 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bu44ne346ymoe"
path="res://.godot/imported/Canterbury.ttf-f96b9fe73e87f4ab7ef268137a16b97a.fontdata"
[deps]
source_file="res://Assets/Others/Canterbury.ttf"
dest_files=["res://.godot/imported/Canterbury.ttf-f96b9fe73e87f4ab7ef268137a16b97a.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

@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.freepik.com/free-ai-image/8-bit-graphics-pixels-scene-with-castle_137494400.htm#fromView=keyword&page=1&position=0&uuid=86787ed6-3996-4876-a594-5d1e2ab05e56&query=Pixel+Art+Castle

15
Game/Menu/main.gd Normal file
View File

@ -0,0 +1,15 @@
extends Control
func _on_button_pressed() -> void:
get_tree().change_scene_to_file("res://Game/Menu/mapselector.tscn")
func _on_button_2_pressed() -> void:
get_tree().change_scene_to_file("res://Game/Menu/options.tscn")
pass # Replace with function body.
func _on_button_3_pressed() -> void:
get_tree().quit()
pass # Replace with function body.

1
Game/Menu/main.gd.uid Normal file
View File

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

125
Game/Menu/main.tscn Normal file
View File

@ -0,0 +1,125 @@
[gd_scene load_steps=9 format=3 uid="uid://6x8vpcfwmxjd"]
[ext_resource type="Texture2D" uid="uid://bgy114b67j3kg" path="res://Assets/Others/8-bit-graphics-pixels-scene-with-castle.jpg" id="1_3jfgb"]
[ext_resource type="Script" uid="uid://cnle2j2fnno26" path="res://Game/Menu/main.gd" id="1_i0ya0"]
[ext_resource type="FontFile" uid="uid://bu44ne346ymoe" path="res://Assets/Others/Canterbury.ttf" id="2_i0ya0"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_14uxm"]
texture = ExtResource("1_3jfgb")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3jfgb"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3jfgb"]
bg_color = Color(0.485703, 0.485704, 0.485703, 0.447059)
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
shadow_size = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_i0ya0"]
bg_color = Color(0.117647, 0.117647, 0.117647, 0.682353)
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
shadow_size = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hnj4u"]
bg_color = Color(1, 1, 1, 0.447059)
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
shadow_size = 5
[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_i0ya0")
[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
theme_override_styles/panel = SubResource("StyleBoxTexture_14uxm")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
custom_minimum_size = Vector2(250, 0)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -125.0
offset_top = -220.0
offset_right = 125.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/separation = 20
[node name="Button" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/focus = SubResource("StyleBoxEmpty_3jfgb")
theme_override_styles/hover = SubResource("StyleBoxFlat_3jfgb")
theme_override_styles/pressed = SubResource("StyleBoxFlat_i0ya0")
theme_override_styles/normal = SubResource("StyleBoxFlat_hnj4u")
text = "Start Game"
[node name="Button2" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/focus = SubResource("StyleBoxEmpty_3jfgb")
theme_override_styles/hover = SubResource("StyleBoxFlat_3jfgb")
theme_override_styles/pressed = SubResource("StyleBoxFlat_i0ya0")
theme_override_styles/normal = SubResource("StyleBoxFlat_hnj4u")
text = "Options"
[node name="Button3" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/focus = SubResource("StyleBoxEmpty_3jfgb")
theme_override_styles/hover = SubResource("StyleBoxFlat_3jfgb")
theme_override_styles/pressed = SubResource("StyleBoxFlat_i0ya0")
theme_override_styles/normal = SubResource("StyleBoxFlat_hnj4u")
text = "Exit
"
[node name="VBoxContainer2" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -179.0
offset_right = 179.0
offset_bottom = 200.0
grow_horizontal = 2
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer2"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_i0ya0")
theme_override_font_sizes/font_size = 86
text = "Defensaria"
[node name="Label2" type="Label" parent="VBoxContainer2"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_i0ya0")
theme_override_font_sizes/font_size = 32
text = "Guardians of the Last Cytadel"
[connection signal="pressed" from="VBoxContainer/Button" to="." method="_on_button_pressed"]
[connection signal="pressed" from="VBoxContainer/Button2" to="." method="_on_button_2_pressed"]
[connection signal="pressed" from="VBoxContainer/Button3" to="." method="_on_button_3_pressed"]

7
Game/Menu/mapselector.gd Normal file
View File

@ -0,0 +1,7 @@
extends Control
func _on_button_pressed() -> void:
get_tree().change_scene_to_file("res://Game/Maps/map_1.tscn")
pass # Replace with function body.

View File

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

104
Game/Menu/mapselector.tscn Normal file
View File

@ -0,0 +1,104 @@
[gd_scene load_steps=10 format=3 uid="uid://cxet2lvdco2ak"]
[ext_resource type="Script" uid="uid://y5h2sfhsyn7f" path="res://Game/Menu/mapselector.gd" id="1_cnef1"]
[ext_resource type="Texture2D" uid="uid://bgy114b67j3kg" path="res://Assets/Others/8-bit-graphics-pixels-scene-with-castle.jpg" id="1_jteil"]
[ext_resource type="FontFile" uid="uid://bu44ne346ymoe" path="res://Assets/Others/Canterbury.ttf" id="2_2uj2s"]
[ext_resource type="Texture2D" uid="uid://cheweipqa125e" path="res://Assets/Maps/map1.png" id="3_2uj2s"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_cnef1"]
texture = ExtResource("1_jteil")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_mjmwi"]
texture = ExtResource("3_2uj2s")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_udeaf"]
texture = ExtResource("3_2uj2s")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_5yqcp"]
texture = ExtResource("3_2uj2s")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_cg1t8"]
texture = ExtResource("3_2uj2s")
[node name="mapselector" 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_cnef1")
[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
theme_override_styles/panel = SubResource("StyleBoxTexture_cnef1")
[node name="VBoxContainer2" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -179.0
offset_right = 179.0
offset_bottom = 200.0
grow_horizontal = 2
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer2"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_2uj2s")
theme_override_font_sizes/font_size = 86
text = "Defensaria"
[node name="Label2" type="Label" parent="VBoxContainer2"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_2uj2s")
theme_override_font_sizes/font_size = 32
text = "Guardians of the Last Cytadel"
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -466.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/separation = 50
alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 8
theme_override_constants/separation = 30
alignment = 1
[node name="first" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer/first"]
layout_mode = 2
size_flags_horizontal = 4
text = "1st Level"
[node name="Button" type="Button" parent="VBoxContainer/HBoxContainer/first"]
custom_minimum_size = Vector2(120, 80)
layout_mode = 2
theme_override_styles/focus = SubResource("StyleBoxTexture_mjmwi")
theme_override_styles/hover = SubResource("StyleBoxTexture_udeaf")
theme_override_styles/pressed = SubResource("StyleBoxTexture_5yqcp")
theme_override_styles/normal = SubResource("StyleBoxTexture_cg1t8")
[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer/first"]
layout_mode = 2
size_flags_horizontal = 4
text = "Score: 10 / "
[connection signal="pressed" from="VBoxContainer/HBoxContainer/first/Button" to="." method="_on_button_pressed"]

69
Game/Menu/options.gd Normal file
View File

@ -0,0 +1,69 @@
extends Control
var resolutions = [
Vector2i(640, 360),
Vector2i(800, 450),
Vector2i(1152, 648),
Vector2i(1280, 720),
Vector2i(1366, 768),
Vector2i(1600, 900),
Vector2i(1920, 1080),
Vector2i(2560, 1440),
Vector2i(3840, 2160)
]
# Adjust these paths as needed to match your scene
@onready var resolution_button: OptionButton = $"TabContainer/Screen & Video/VBoxContainer/HBoxContainer/OptionButton"
@onready var display_mode: OptionButton = $"TabContainer/Screen & Video/VBoxContainer/HBoxContainer2/OptionButton"
func _ready():
# Populate resolution selector
for res in resolutions:
resolution_button.add_item("%d x %d" % [res.x, res.y])
# Populate display mode selector
display_mode.clear()
display_mode.add_item("Windowed")
display_mode.add_item("Fullscreen")
display_mode.add_item("Borderless")
# Connect signals (editor: also connect in "Node" panel for best reliability)
resolution_button.connect("item_selected", Callable(self, "_on_resolution_button_item_selected"))
display_mode.connect("item_selected", Callable(self, "_on_display_mode_selected"))
# Set defaults (optional)
display_mode.select(0)
resolution_button.select(2)
resolution_button.disabled = false
func _on_display_mode_selected(index):
var mode_name = display_mode.get_item_text(index)
match mode_name:
"Windowed":
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
resolution_button.disabled = false
# Reapply current resolution
_set_screen_size(resolutions[resolution_button.selected])
"Fullscreen":
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
resolution_button.disabled = true
"Borderless":
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)
resolution_button.disabled = false
# Optional: some platforms need actual borderless flag set
# DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)
_set_screen_size(resolutions[resolution_button.selected])
func _on_resolution_button_item_selected(index):
# Only acts if mode is not Fullscreen
if display_mode.get_selected_id() != 1:
_set_screen_size(resolutions[index])
func _set_screen_size(size: Vector2i):
# Only relevant for windowed/borderless
if display_mode.get_selected_id() != 1: # 1 is "Fullscreen"
DisplayServer.window_set_size(size)
# Optionally center or reposition window if desired
func _on_button_pressed() -> void:
get_tree().change_scene_to_file("res://Game/Menu/main.tscn")

1
Game/Menu/options.gd.uid Normal file
View File

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

186
Game/Menu/options.tscn Normal file
View File

@ -0,0 +1,186 @@
[gd_scene load_steps=10 format=3 uid="uid://b07dvegdyt8yk"]
[ext_resource type="Script" uid="uid://dcmglfhifv32l" path="res://Game/Menu/options.gd" id="1_ed6ki"]
[ext_resource type="Texture2D" uid="uid://bgy114b67j3kg" path="res://Assets/Others/8-bit-graphics-pixels-scene-with-castle.jpg" id="2_jxn2r"]
[ext_resource type="FontFile" uid="uid://bu44ne346ymoe" path="res://Assets/Others/Canterbury.ttf" id="3_j0ebt"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_lksfn"]
texture = ExtResource("2_jxn2r")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ed6ki"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_scbv7"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0b84r"]
bg_color = Color(0.485703, 0.485704, 0.485703, 0.447059)
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
shadow_size = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ndngw"]
bg_color = Color(0.117647, 0.117647, 0.117647, 0.682353)
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
shadow_size = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_617je"]
bg_color = Color(1, 1, 1, 0.447059)
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
shadow_size = 5
[node name="Options" 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_ed6ki")
[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
theme_override_styles/panel = SubResource("StyleBoxTexture_lksfn")
[node name="VBoxContainer2" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -179.0
offset_right = 179.0
offset_bottom = 200.0
grow_horizontal = 2
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer2"]
layout_mode = 2
theme_override_fonts/font = ExtResource("3_j0ebt")
theme_override_font_sizes/font_size = 64
text = "Options"
horizontal_alignment = 1
[node name="TabContainer" type="TabContainer" parent="."]
custom_minimum_size = Vector2(700, 300)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -139.5
offset_top = -15.5
offset_right = 139.5
offset_bottom = 15.5
grow_horizontal = 2
grow_vertical = 2
tab_alignment = 1
current_tab = 0
clip_tabs = false
tab_focus_mode = 1
[node name="Screen & Video" type="TabBar" parent="TabContainer"]
layout_mode = 2
metadata/_tab_index = 0
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Screen & Video"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -288.5
offset_top = -20.0
offset_right = 288.5
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Screen & Video/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Label" type="Label" parent="TabContainer/Screen & Video/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Resolution"
[node name="VSeparator" type="VSeparator" parent="TabContainer/Screen & Video/VBoxContainer/HBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 50
theme_override_styles/separator = SubResource("StyleBoxEmpty_ed6ki")
[node name="OptionButton" type="OptionButton" parent="TabContainer/Screen & Video/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(250, 40)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="HBoxContainer2" type="HBoxContainer" parent="TabContainer/Screen & Video/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Label" type="Label" parent="TabContainer/Screen & Video/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Display Mode"
[node name="VSeparator" type="VSeparator" parent="TabContainer/Screen & Video/VBoxContainer/HBoxContainer2"]
layout_mode = 2
theme_override_constants/separation = 50
theme_override_styles/separator = SubResource("StyleBoxEmpty_ed6ki")
[node name="OptionButton" type="OptionButton" parent="TabContainer/Screen & Video/VBoxContainer/HBoxContainer2"]
custom_minimum_size = Vector2(250, 40)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Music & Sound" type="TabBar" parent="TabContainer"]
visible = false
layout_mode = 2
metadata/_tab_index = 1
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -8.0
grow_horizontal = 2
grow_vertical = 0
alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="Button" type="Button" parent="HBoxContainer/MarginContainer"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/focus = SubResource("StyleBoxEmpty_scbv7")
theme_override_styles/hover = SubResource("StyleBoxFlat_0b84r")
theme_override_styles/pressed = SubResource("StyleBoxFlat_ndngw")
theme_override_styles/normal = SubResource("StyleBoxFlat_617je")
text = "Main Menu"
[connection signal="pressed" from="HBoxContainer/MarginContainer/Button" to="." method="_on_button_pressed"]