game: add minimal main menu
This commit is contained in:
		
							
								
								
									
										19
									
								
								scenes/main_menu.gd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								scenes/main_menu.gd
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| extends Control | ||||
|  | ||||
| const MAIN = preload("res://scenes/main.tscn") | ||||
|  | ||||
|  | ||||
| func _ready() -> void: | ||||
| 	pass | ||||
|  | ||||
|  | ||||
| func _on_new_game_button_pressed() -> void: | ||||
| 	get_tree().change_scene_to_packed(MAIN) | ||||
|  | ||||
|  | ||||
| func _on_options_button_pressed() -> void: | ||||
| 	pass  # Replace with function body. | ||||
|  | ||||
|  | ||||
| func _on_exit_game_button_pressed() -> void: | ||||
| 	get_tree().quit() | ||||
							
								
								
									
										1
									
								
								scenes/main_menu.gd.uid
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								scenes/main_menu.gd.uid
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| uid://sd158y3mdmkt | ||||
							
								
								
									
										69
									
								
								scenes/main_menu.tscn
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								scenes/main_menu.tscn
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| [gd_scene load_steps=4 format=3 uid="uid://cynet50emve6c"] | ||||
|  | ||||
| [ext_resource type="Script" uid="uid://sd158y3mdmkt" path="res://scenes/main_menu.gd" id="1_l6cm7"] | ||||
|  | ||||
| [sub_resource type="Gradient" id="Gradient_vue75"] | ||||
| colors = PackedColorArray(0.252028, 0.252028, 0.252028, 1, 0.25098, 0.25098, 0.25098, 1) | ||||
|  | ||||
| [sub_resource type="GradientTexture1D" id="GradientTexture1D_l6cm7"] | ||||
| gradient = SubResource("Gradient_vue75") | ||||
|  | ||||
| [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_l6cm7") | ||||
|  | ||||
| [node name="Background" type="TextureRect" parent="."] | ||||
| layout_mode = 1 | ||||
| anchors_preset = 15 | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
| texture = SubResource("GradientTexture1D_l6cm7") | ||||
| expand_mode = 2 | ||||
|  | ||||
| [node name="PanelContainer" type="PanelContainer" parent="."] | ||||
| layout_mode = 1 | ||||
| anchors_preset = 8 | ||||
| anchor_left = 0.5 | ||||
| anchor_top = 0.5 | ||||
| anchor_right = 0.5 | ||||
| anchor_bottom = 0.5 | ||||
| offset_left = -20.0 | ||||
| offset_top = -20.0 | ||||
| offset_right = 20.0 | ||||
| offset_bottom = 20.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
|  | ||||
| [node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] | ||||
| 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="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"] | ||||
| layout_mode = 2 | ||||
| theme_override_constants/separation = 10 | ||||
|  | ||||
| [node name="NewGameButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] | ||||
| layout_mode = 2 | ||||
| text = "New game" | ||||
|  | ||||
| [node name="OptionsButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] | ||||
| layout_mode = 2 | ||||
| text = "Options" | ||||
|  | ||||
| [node name="ExitGameButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] | ||||
| layout_mode = 2 | ||||
| text = "Exit game" | ||||
|  | ||||
| [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/NewGameButton" to="." method="_on_new_game_button_pressed"] | ||||
| [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"] | ||||
| [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/ExitGameButton" to="." method="_on_exit_game_button_pressed"] | ||||
		Reference in New Issue
	
	Block a user