semi-idle-arpg/scripts/main_menu.gd
2024-11-05 09:29:20 -07:00

49 lines
1.2 KiB
GDScript

extends Control
func _ready() -> void:
Engine.time_scale = 1.0
if OS.is_debug_build():
$MenuButtons/DebugButtons.show()
$MenuButtons/DebugButtons/AutostartToggle.button_pressed = Globals.debugAutoPlayEnabled
await get_tree().create_timer(5).timeout
if Globals.debugAutoPlayEnabled:
_enter_loaded_save()
func _on_play_button_pressed() -> void:
_enter_loaded_save()
func _enter_loaded_save() -> void:
# TODO: make this load a "where do you want to go/what do you want to do?"
get_tree().change_scene_to_file("res://scenes/combatUIScene.tscn")
func _on_exit_button_pressed() -> void:
get_tree().quit()
func _on_load_button_pressed() -> void:
Globals.load_game()
func _on_save_button_pressed() -> void:
# ResourceSaver.save(PlayerState, "user://player_state.tres")
Globals.save_game()
func _on_test_button_pressed() -> void:
pass # Replace with function body.
func _on_autostart_toggle_toggled(toggled_on: bool) -> void:
Globals.debugAutoPlayEnabled = toggled_on
func _on_speed_toggle_toggled(toggled_on: bool) -> void:
if toggled_on:
Engine.time_scale = 60.0
else:
Engine.time_scale = 1.0