Implement save and loading games (#8)

This commit is contained in:
Julian Murgia
2021-07-02 23:08:43 +02:00
committed by GitHub
parent 58d880101d
commit bd4c33cf77
66 changed files with 1268 additions and 736 deletions

View File

@@ -71,7 +71,7 @@ func _on_wait_finished() -> void:
# #### Parameters
#
# * camera_limits_id: The id of the room's camera limits to set
func set_camera_limits(camera_limit_id : int = 0) -> void:
func set_camera_limits(camera_limit_id: int = 0) -> void:
var limits = {}
var scene_camera_limits = current_scene.camera_limits[camera_limit_id]
if scene_camera_limits.size.x == 0 and scene_camera_limits.size.y == 0:
@@ -116,6 +116,13 @@ func set_camera_limits(camera_limit_id : int = 0) -> void:
current_scene.game.get_node("camera").set_offset(screen_ofs * 2)
func save_game(p_savegame_res: Resource) -> void:
p_savegame_res.main = {
ESCSaveGame.MAIN_LAST_SCENE_GLOBAL_ID_KEY: last_scene_global_id,
ESCSaveGame.MAIN_CURRENT_SCENE_FILENAME_KEY: current_scene.filename
}
# Sanity check that the game.tscn scene's root node script MUST
# implement the following methods. If they do not exist, stop immediately.
# Implement them, even if empty