Main menu with 2 button (play & quit)

main
Ervan Lefevre 2 years ago
parent 54efe27d66
commit b927efeb1a
  1. 9
      project.godot
  2. 47
      scenes/main_menu.tscn
  3. 8
      scripts/ui/change_scene_button.gd
  4. 5
      scripts/ui/quit_button.gd

@ -11,9 +11,18 @@ config_version=5
[application]
config/name="LD54"
run/main_scene="res://scenes/main_menu.tscn"
config/features=PackedStringArray("4.1", "GL Compatibility")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
window/size/mode=2
window/size/initial_screen=1
window/stretch/mode="viewport"
[rendering]
renderer/rendering_method="gl_compatibility"

@ -0,0 +1,47 @@
[gd_scene load_steps=3 format=3 uid="uid://xjo01yx3nybo"]
[ext_resource type="Script" path="res://scripts/ui/change_scene_button.gd" id="1_2rx5y"]
[ext_resource type="Script" path="res://scripts/ui/quit_button.gd" id="2_fjtya"]
[node name="root" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="panel" type="Panel" parent="."]
layout_mode = 0
offset_right = 1928.0
offset_bottom = 1088.0
[node name="titre" type="Label" parent="panel"]
layout_mode = 2
offset_left = 1.0
offset_top = 2.0
offset_right = 961.0
offset_bottom = 107.0
scale = Vector2(2, 2)
text = "Ant Underwater Odyssey"
horizontal_alignment = 1
vertical_alignment = 1
[node name="play" type="Button" parent="."]
layout_mode = 0
offset_left = 624.0
offset_top = 776.0
offset_right = 1279.0
offset_bottom = 853.0
text = "Play"
script = ExtResource("1_2rx5y")
TARGET_SCENE = "res://scenes/main_menu.tscn"
[node name="quit" type="Button" parent="."]
layout_mode = 0
offset_left = 629.0
offset_top = 875.0
offset_right = 1284.0
offset_bottom = 952.0
text = "Quit"
script = ExtResource("2_fjtya")

@ -0,0 +1,8 @@
extends Button
class_name SceneChanger
@export_file("*.tscn") var TARGET_SCENE;
func _pressed():
print("Changing scene to: " + TARGET_SCENE)
get_tree().change_scene(TARGET_SCENE)

@ -0,0 +1,5 @@
extends Button
class_name QuitButton
func _pressed():
get_tree().quit()
Loading…
Cancel
Save