Return to repo list

tzed

Simple story-driven open world 2D CRPG.
Return to HMagellan.com

commit 2dc3f686e5d9db5b8dcaa096aef10f38a4eefb1f
parent 9b6d5304e1eae8c01dd499f99f5dce3c0359300e
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Thu,  1 Jul 2021 21:39:11 -0500

finalize part loading

Diffstat:
Msrc/entity.py | 3++-
Msrc/game.py | 4++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/entity.py b/src/entity.py @@ -127,7 +127,8 @@ class EntityManager(manager.Manager): # Regenerate the board r = int(24 / (self.system_bus.fetch("camera", "scale_factor") / 2)) - self.bus.perform_board_manager_generate_board_tilesprites_by_range((-r, r), (-r, r)) + tp = self.player.tile_pos + self.bus.perform_board_manager_generate_board_tilesprites_by_range((tp[0] - r, tp[0] + r), (tp[1] - r, tp[1] + r)) def expose(self): """ diff --git a/src/game.py b/src/game.py @@ -84,6 +84,10 @@ class Game(object): self.entity_manager.place_player_on_overworld() if "direction" in data.keys(): self.entity_manager.move_player_by_tile_offset(data["direction"]) + # Force a single board regen at overworld load + r = int(24 / (self.camera.scale_factor / 2)) + tp = self.entity_manager.player.tile_pos + self.board_manager.generate_board_tilesprites_by_range((tp[0] - r, tp[0] + r), (tp[1] - r,tp[1] + r)) self.entity_manager.load_board_overlay_from_file(OVERWORLD_BOARD) def shift_frames(self, framerate = FRAMERATE):