30 lines
920 B
GDScript
30 lines
920 B
GDScript
extends Control
|
|
|
|
# Скрипт главного меню
|
|
|
|
func _ready():
|
|
# Подключаем сигналы кнопок
|
|
var start_button = get_node_or_null("VBoxContainer/StartButton")
|
|
var settings_button = get_node_or_null("VBoxContainer/SettingsButton")
|
|
var quit_button = get_node_or_null("VBoxContainer/QuitButton")
|
|
|
|
if start_button:
|
|
start_button.pressed.connect(_on_start_button_pressed)
|
|
if settings_button:
|
|
settings_button.pressed.connect(_on_settings_button_pressed)
|
|
if quit_button:
|
|
quit_button.pressed.connect(_on_quit_button_pressed)
|
|
|
|
func _on_start_button_pressed():
|
|
# Переход к игре
|
|
get_tree().change_scene_to_file("res://scenes/main.tscn")
|
|
|
|
func _on_settings_button_pressed():
|
|
# TODO: Открыть меню настроек
|
|
print("Настройки (пока не реализовано)")
|
|
|
|
func _on_quit_button_pressed():
|
|
# Выход из игры
|
|
get_tree().quit()
|
|
|