Implemented spawn points correctly. Added saving & loading (currently only implemented with the spawn_index). You can now set spawn indicies in the DynamicAreaLoader to automatically load when the game is set to that value (on ready). Added configuration warnings to DynamicAreaLoader & PlayerSpawnPoint Added some generic translation (pot) files. Added AudioManager autoload to play, stop, fade audio streams (and set the bus directly). Added SceneFader autoload. Added SaveManager autoload. Added OptionsMenu with currently only volume sliders and a fullscreen toggle button. Added PauseMenu
33 lines
734 B
GDScript
33 lines
734 B
GDScript
extends Node
|
|
|
|
const SAVE_PATH: String = "user://saves/"
|
|
const SAVE_FILENAME: String = "saved_game.dat"
|
|
|
|
func save_game() -> void:
|
|
DirAccess.make_dir_recursive_absolute(SAVE_PATH)
|
|
|
|
var file := FileAccess.open(str(SAVE_PATH, SAVE_FILENAME), FileAccess.WRITE)
|
|
|
|
# Store the variables.
|
|
file.store_var(GameGlobals.spawn_index)
|
|
|
|
|
|
func load_game() -> bool:
|
|
if not save_exists():
|
|
return false
|
|
|
|
var file := FileAccess.open(str(SAVE_PATH, SAVE_FILENAME), FileAccess.READ)
|
|
|
|
# Load the variables.
|
|
GameGlobals.spawn_index = file.get_var()
|
|
|
|
return true
|
|
|
|
|
|
func delete_save() -> void:
|
|
DirAccess.remove_absolute(str(SAVE_PATH, SAVE_FILENAME))
|
|
|
|
|
|
func save_exists() -> bool:
|
|
return FileAccess.file_exists(str(SAVE_PATH, SAVE_FILENAME))
|