Files
Brachistochrone/Scenes/Scripts/main_menu.gd
T
BadQuanta 1e8ebb7567 Added gameplay_input manager.
Refactored menus, player, and escape_capsule to utilize new system.
Actions defined in Godot project file with default bindings.
Player/Vehicles now react to actions and GameplayInput states instead of polling Input directly.
They respond to commands via `_handle_gameplay_command` and should not implement _unhandled_input directly.
Kept some debugging input handling code in `player.gd` for things like F3/F5/F4/PageUp/PageDown.
We may want to move much of this out of `player.gd` into something that handles the gamestate more generally.
2026-10-06 02:19:50 +00:00

38 lines
1.0 KiB
GDScript

extends Control
@onready var new_game_button: Button = $CenterRoot/MenuColumn/NewGameButton
@onready var continue_button: Button = $CenterRoot/MenuColumn/ContinueButton
@onready var quit_button: Button = $CenterRoot/MenuColumn/QuitButton
func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
GameplayInput.set_menu_open(self, true)
if new_game_button:
new_game_button.pressed.connect(_on_new_game)
if continue_button:
continue_button.pressed.connect(_on_continue)
if quit_button:
quit_button.pressed.connect(_on_quit)
if continue_button:
continue_button.disabled = not GameState.has_save
new_game_button.grab_focus()
## Removes menu ownership when changing scenes so gameplay can resume.
func _exit_tree() -> void:
GameplayInput.set_menu_open(self, false)
func _on_new_game() -> void:
get_tree().change_scene_to_file("res://Scenes/character_creation.tscn")
func _on_continue() -> void:
Engine.set_meta("load_save", true)
get_tree().change_scene_to_file("res://Scenes/main.tscn")
func _on_quit() -> void:
get_tree().quit()