Return to repo list

heart-of-gold

Tactical RPG written in python, using pygame.
Return to HMagellan.com

commit 5fd6237c899a4503ec75b3685db3832905e24bc1
parent 5375168c540273118e1aee7d3086349636fd9362
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Wed,  4 Nov 2020 16:20:08 -0600

Basic skeleton of save system

Diffstat:
Msrc/game.py | 11++++++-----
Msrc/menu.py | 3+--
Msrc/subsystem.py | 20++++++++++++++++++++
3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/game.py b/src/game.py @@ -31,25 +31,26 @@ class Game(object): self.no_control_timer = 0 self.return_control_mode = None - # PyGame objects - self.screen = pygame.display.set_mode(self.screen_dimensions) - self.frame_clock = pygame.time.Clock() - # Mode management values self.state_mode = STATE_MODES.Main_Menu_Mode self.control_mode = CTRL_MODES.Main_Menu_Normal + # PyGame objects + self.screen = pygame.display.set_mode(self.screen_dimensions) + self.frame_clock = pygame.time.Clock() + # Subsystems self.interface = subsystem.GameInterface(self) self.manager_bus = subsystem.ManagerBus(self) self.camera = subsystem.GameCamera(self) + self.object_oracle = subsystem.ObjectOrace(self) + self.save_system = subsystem.SaveSystem(self) # Managers self.sheet_manager = images.SheetManager(self, self.manager_bus) self.sound_manager = sound.SoundManager(self, self.manager_bus) self.menu_manager = menu.MenuManager(self, self.manager_bus) self.board_manager = board.BoardManager(self, self.manager_bus) - #self.entity_manager = vgo.EntityManager(self, self.manager_bus) self.piece_manager = piece.PieceManager(self, self.manager_bus) self.scene_manager = scene.SceneManager(self, self.manager_bus) diff --git a/src/menu.py b/src/menu.py @@ -100,7 +100,6 @@ class Menu(object): # Load background, if any self.background = entity.Entity(self.manager.bus.fetch_sheet(self.definition["bg_sheet"]), tuple(self.definition["bg_sprite"]), None, False) - # Load buttons, if any for b in self.definition["buttons"]: nmb = MenuButton(self.manager.bus.fetch_sheet(self.definition["buttons"][b]["sheet"]), tuple(self.definition["buttons"][b]["sprite"]), @@ -138,7 +137,7 @@ class MenuButton(entity.Entity): # Saved values self.effects = effects # A list of effects. Each effect goes with a method in MenuManager, and each one is triggered on a press. - # VGO settings + # Entity settings self.custom_flags = None # DirtySprite settings diff --git a/src/subsystem.py b/src/subsystem.py @@ -247,3 +247,23 @@ class ObjectOracle(GameSubsystem): # Parent init super().__init__(game) + +#################################### +# Section 6 - The SaveSystem class # +#################################### + +class SaveSystem(GameSubsystem): + """ + The SaveSystem object handles saving to and loading + from a game save JSON file. This large JSON file is + subdivided into smaller objects called definitions + that are transformed at load time to Python dicts. + These definitions are passed to Game, managers, and + other subsystems in order to generate the gameplay + environment. + """ + + def __init__(self, game): + + # Parent init + super().__init__(game)