Return to repo list

heart-of-gold

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

commit d187a7c54496419c9a584cbf9730b10ef63e7758
parent 586b3e78d341574e556ba22929dd8e942ba79a85
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Thu, 21 Jan 2021 17:45:42 -0600

basic framework for base mode

Diffstat:
Adata/board/testbase1/testbase1.tmx | 20++++++++++++++++++++
Mdata/json/menus/mainmenu.json | 2+-
Msrc/constants.py | 4++--
Msrc/game.py | 7+++++++
Msrc/interface.py | 5+++++
5 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/data/board/testbase1/testbase1.tmx b/data/board/testbase1/testbase1.tmx @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="12" height="12" tilewidth="64" tileheight="64" infinite="0" nextlayerid="2" nextobjectid="1"> + <tileset firstgid="1" source="../../tsx/testtiles1.tsx"/> + <layer id="1" name="Tile Layer 1" width="12" height="12"> + <data encoding="csv"> +4,4,4,4,4,4,4,4,4,4,4,4, +3,3,3,3,3,3,4,4,4,4,4,4, +1,1,1,1,1,3,3,3,4,4,4,4, +1,1,1,1,1,1,1,3,3,4,4,4, +1,1,1,1,1,1,1,1,3,3,4,4, +1,1,1,1,1,1,1,1,1,3,4,4, +1,1,1,1,1,1,1,1,1,3,3,4, +1,1,1,1,1,1,1,1,1,1,3,4, +1,1,1,1,1,1,1,1,1,1,3,4, +1,1,1,1,1,1,1,1,1,1,3,4, +3,3,3,3,3,3,3,3,3,3,3,4, +4,4,4,4,4,4,4,4,4,4,4,4 +</data> + </layer> +</map> diff --git a/data/json/menus/mainmenu.json b/data/json/menus/mainmenu.json @@ -11,7 +11,7 @@ "effects" : [ { "call" : "ef_game_switch_mode", - "data" : ["Battle_Mode", "testmap1"] + "data" : ["Base_Mode", "testbase1"] } ] }, diff --git a/src/constants.py b/src/constants.py @@ -88,8 +88,8 @@ RESERVE_STATS = ["MOVE", "INIT", "CNTR", "GARD", "PUSH", "SKLL", "PASS"] OTHER_STATS = ["HP", "EXP", "LVL", "RNK"] # Enums -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 Turn_Select_Attack Turn_Watch_Move Turn_Watch_Attack Turn_Display_Stats Turn_Watch_Guard Battle_Dialog Battle_Intro Still_Scene_Normal') +STATE_MODES = enum.Enum('STATE_MODES', 'Main_Menu_Mode Base_Mode Battle_Mode Still_Scene_Mode') +CTRL_MODES = enum.Enum('CTRL_MODES', 'No_Control Main_Menu_Normal Base_Normal Turn_Normal Turn_Select_Move Turn_Select_Attack Turn_Watch_Move Turn_Watch_Attack Turn_Display_Stats Turn_Watch_Guard Battle_Dialog Battle_Intro Still_Scene_Normal') FACE_DIR = enum.Enum('FACE_DIR', 'U D L R') GAME_EFFECTS = enum.Enum('GAME_EFFECTS', 'ef_game_quit ef_game_switch_mode ef_game_switch_control') TEAMS = enum.Enum('TEAMS', 'Player Ally Neutral Enemy Other') diff --git a/src/game.py b/src/game.py @@ -84,6 +84,10 @@ class Game(object): self.control_mode = CTRL_MODES.Main_Menu_Normal self.menu_manager.load_menu_from_file("mainmenu.json") self.camera.load_camera_surface((SCREEN_WIDTH, SCREEN_HEIGHT)) + elif new_mode == STATE_MODES.Base_Mode: + self.control_mode = CTRL_MODES.Base_Normal + self.board_manager.load_board(data) + self.camera.load_camera_surface(self.board_manager.current_board.pixel_dimensions) elif new_mode == STATE_MODES.Battle_Mode: self.control_mode = CTRL_MODES.Turn_Normal self.board_manager.load_board(data) @@ -139,6 +143,9 @@ class Game(object): if self.state_mode == STATE_MODES.Main_Menu_Mode: self.menu_manager.update(self.camera.camera_surface) self.camera.update_camera(self.screen) + elif self.state_mode == STATE_MODES.Base_Mode: + self.board_manager.update(self.camera.camera_surface) + self.camera.update_camera(self.screen) elif self.state_mode == STATE_MODES.Battle_Mode: self.board_manager.update(self.camera.camera_surface) self.piece_manager.update(self.camera.camera_surface) diff --git a/src/interface.py b/src/interface.py @@ -105,6 +105,11 @@ class GameInterface(subsystem.GameSubsystem): if self.game.control_mode == CTRL_MODES.Main_Menu_Normal: self.bus.perform_trigger_menu_button_at_pos(mousepos) + # Base mode behavior + if self.game.state_mode == STATE_MODES.Base_Mode: + + pass + # Battle mode behavior elif self.game.state_mode == STATE_MODES.Battle_Mode: