grunk/src/ui/menus/title_screen/title_screen.gd

47 lines
1.2 KiB
GDScript3
Raw Normal View History

2025-04-22 21:30:11 -06:00
extends Control
## Title screen!
2025-04-22 22:10:08 -06:00
# TODO is there a way to get this path without loading the level scene?
@export var save_path: String
2025-04-22 21:30:11 -06:00
@export_category("Game Scenes")
# TODO is there a way to get the appropriate level scene path here without loading the world scene?
@export_file("*.tscn") var level_scene: String
@export_file("*.tscn") var world_scene: String
@export var settings_scene: PackedScene
@onready var continue_button: Button = %Continue
@onready var settings_container: Control = %SettingsContainer
2025-04-22 22:38:06 -06:00
@onready var title_sfx: AudioStreamPlayer = %TitleSFX
@onready var title_drone: AudioStreamPlayer = %TitleDrone
2025-04-22 21:30:11 -06:00
func _ready() -> void:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if FileAccess.file_exists(save_path):
continue_button.disabled = false
func continue_game() -> void:
2025-04-22 22:10:08 -06:00
LoadingTools.load_save(save_path)
2025-04-22 21:30:11 -06:00
func new_game() -> void:
LoadingTools.load_level(level_scene)
func show_settings() -> void:
var instance: Control = settings_scene.instantiate()
settings_container.add_child(instance)
func quit() -> void:
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
2025-04-22 22:38:06 -06:00
func _exit_tree() -> void:
title_sfx.stop()
title_drone.stop()