Return to repo list

heart-of-gold

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

commit 166826b767738181d42f59d00bef2e85fa0322e5
parent f852d39a3dcddc612b3b5165b5eec95907744619
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Wed, 14 Oct 2020 23:02:38 -0500

Bare-bones ver of scene.py

Diffstat:
Msrc/constants.py | 5+++--
Msrc/game.py | 2++
Asrc/scene.py | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/src/constants.py b/src/constants.py @@ -33,8 +33,9 @@ JSON_PATH = os.path.join(DATA_PATH, "json") ENTITY_JSON_PATH = os.path.join(JSON_PATH, "ents") STATUS_JSON_PATH = os.path.join(JSON_PATH, "stats") MENU_JSON_PATH = os.path.join(JSON_PATH, "menus") +SCENE_JSON_PATH = os.path.join(JSON_PATH, "scenes") # Enums -STATE_MODES = enum.Enum('STATE_MODES', 'Main_Menu_Mode Battle_Mode') -CTRL_MODES = enum.Enum('CTRL_MODES', 'Main_Menu_Normal Turn_Normal Turn_Select_Move') +STATE_MODES = enum.Enum('STATE_MODES', 'Main_Menu_Mode Battle_Mode Still_Scene_Mode') +CTRL_MODES = enum.Enum('CTRL_MODES', 'No_Control Main_Menu_Normal Turn_Normal Turn_Select_Move Still_Scene_Normal') FACE_DIR = enum.Enum('FACE_DIR', 'U D L R') diff --git a/src/game.py b/src/game.py @@ -79,6 +79,8 @@ class Game(object): self.unit_manager.load_stats_from_json("jisella_1.json") self.entity_manager.load_entities_from_json("testmap1.json") self.entity_manager.load_tile_cursor("cursor1") + elif new_mode == STATE_MODES.Still_Scene_Mode: + pass def shift_frames(self): """ diff --git a/src/scene.py b/src/scene.py @@ -0,0 +1,61 @@ +import py, os, json +from . import manager +from .constants import SCENE_JSON_PATH + +############ +# scene.py # +############ + +# This file contains: +# 1. The SceneManager class, which controls in-game cutscenes that it loads from JSON. +# 2. The StillScene object, which defines a particular kind of common cutscene that is used often. + +###################################### +# Section 1 - The SceneManager class # +###################################### + +class SceneManager(manager.Manager): + """ + SceneManager takes control during all cutscenes, whether + they be the typical still-shot character interaction + cutscenes defined by StillScene objects, or other, more + complicated scenes. + """ + + def __init__(self, game): + + # Parent initialization + super().__init__(game) + + # Important values + self.current_scene = None + +#################################### +# Section 2 - The StillScene class # +#################################### + +class StillScene(object): + """ + A StillScene defines a particular common type of cutscene + wherein still images of characters are displayed over a + text box. + """ + + def __init__(self, manager, scenefile): + + # Saved values + self.manager = manager + + # Important values + self.characters = [] + self.current_text = "" + self.text_speed = 1 + + # Load the scene + self.load_scene(scenefile) + + def load_scene(self, scenefile): + """ + Load a scene from file. + """ + pass