Add a main menu scene (#47)
MainMenu.tscn is now project.godot's entry point: Play / Map Editor (disabled, explains itself - #48 wires it up) / Quit (hidden in web builds), styled like the rest of the game's menus and reusing the starfield shader for its background. Play calls GameState.reset_new_game(), so a second playthrough in the same process starts fresh instead of inheriting whatever the previous run left in the autoload - existing tests still load Main.tscn directly and are unaffected. Part of the #40 conquest-mechanic breakdown.
This commit is contained in:
parent
f14ee656ea
commit
a1fb239a50
7 changed files with 297 additions and 1 deletions
139
MainMenu.tscn
Normal file
139
MainMenu.tscn
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
[gd_scene load_steps=4 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://MainMenu.gd" id="1"]
|
||||
[ext_resource type="Script" path="res://IconButton.gd" id="2"]
|
||||
[ext_resource type="Shader" path="res://starfield.gdshader" id="3"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="1"]
|
||||
shader = ExtResource("3")
|
||||
shader_parameter/camera_cell = Vector2(0, 0)
|
||||
shader_parameter/camera_frac = Vector2(0, 0)
|
||||
shader_parameter/camera_zoom = 1.0
|
||||
shader_parameter/viewport_size = Vector2(720, 1280)
|
||||
shader_parameter/cell_size = 60.0
|
||||
shader_parameter/bg_color = Color(0.02, 0.02, 0.08, 1)
|
||||
|
||||
[node name="MainMenu" type="Node2D"]
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="BackgroundLayer" type="CanvasLayer" parent="."]
|
||||
layer = -10
|
||||
|
||||
[node name="Starfield" type="ColorRect" parent="BackgroundLayer"]
|
||||
material = SubResource("1")
|
||||
mouse_filter = 2
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="UI"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -300
|
||||
offset_right = 300
|
||||
offset_top = -560
|
||||
offset_bottom = -460
|
||||
theme_override_font_sizes/font_size = 60
|
||||
horizontal_alignment = 1
|
||||
text = "SPACESHIP TEST"
|
||||
|
||||
[node name="PlayButton" type="Control" parent="UI"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -64
|
||||
offset_right = 64
|
||||
offset_top = -300
|
||||
offset_bottom = -172
|
||||
script = ExtResource("2")
|
||||
icon = 2
|
||||
glow_color = Color(0.35, 0.95, 0.55, 1)
|
||||
|
||||
[node name="PlayLabel" type="Label" parent="UI"]
|
||||
mouse_filter = 2
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -160
|
||||
offset_right = 160
|
||||
offset_top = -160
|
||||
offset_bottom = -94
|
||||
theme_override_font_sizes/font_size = 32
|
||||
horizontal_alignment = 1
|
||||
text = "Play"
|
||||
|
||||
[node name="EditorButton" type="Control" parent="UI"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -64
|
||||
offset_right = 64
|
||||
offset_top = -20
|
||||
offset_bottom = 108
|
||||
script = ExtResource("2")
|
||||
icon = 0
|
||||
glow_color = Color(0.5, 0.75, 1, 1)
|
||||
|
||||
[node name="EditorLabel" type="Label" parent="UI"]
|
||||
mouse_filter = 2
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -200
|
||||
offset_right = 200
|
||||
offset_top = 120
|
||||
offset_bottom = 186
|
||||
theme_override_font_sizes/font_size = 32
|
||||
horizontal_alignment = 1
|
||||
text = "Map Editor"
|
||||
|
||||
[node name="StatusLabel" type="Label" parent="UI"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -260
|
||||
offset_right = 260
|
||||
offset_top = 200
|
||||
offset_bottom = 260
|
||||
theme_override_font_sizes/font_size = 26
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 2
|
||||
text = ""
|
||||
|
||||
[node name="QuitButton" type="Control" parent="UI"]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -64
|
||||
offset_right = 64
|
||||
offset_top = 320
|
||||
offset_bottom = 448
|
||||
script = ExtResource("2")
|
||||
icon = 1
|
||||
glow_color = Color(0.9, 0.35, 0.35, 1)
|
||||
|
||||
[node name="QuitLabel" type="Label" parent="UI"]
|
||||
mouse_filter = 2
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -160
|
||||
offset_right = 160
|
||||
offset_top = 460
|
||||
offset_bottom = 526
|
||||
theme_override_font_sizes/font_size = 32
|
||||
horizontal_alignment = 1
|
||||
text = "Quit"
|
||||
Loading…
Reference in a new issue