Return to repo list

tzed

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

commit 44923054aa0017485c43540e91a735c604cb1c56
parent c4f5bde233d4efe6fd2af609e43eacd38259976e
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Sat, 28 Aug 2021 16:29:32 -0500

save now accounts for gametime

Diffstat:
Msrc/game.py | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/game.py b/src/game.py @@ -152,7 +152,7 @@ class Game(object): needed to create a player. """ if self.current_board != None: - self.player = entity.PlayerEntity(self.sheets[playerchar["sheet"] + str(self.current_board.scale_factor)].sprites[tuple(playerchar["sprite"])], cellpos, tilepos) + self.player = entity.PlayerEntity(self.sheets[playerchar["sheet"] + str(self.current_board.scale_factor)].sprites[tuple(playerchar["sprite"])], cellpos, tilepos, playerchar["color"]) self.player_name = playerchar["name"] self.player.rect.topleft = ((SCREEN_WIDTH // 3) - 6, (SCREEN_HEIGHT // 3) - 6)# TODO: Weirdly derived self.current_board.position_offset = self.player.rect.topleft @@ -230,13 +230,12 @@ class Game(object): """ # First, add time and calculate into date string. - # TODO: Add date string and its display self.old_gametime = self.gametime self.gametime += time_mod # Factor this time into the appropriate categories # TODO: Time should be defined externally to allow for custom time systems - self.seconds = (10 * self.gametime) + 15000000070 + self.seconds = 10 * self.gametime self.minutes = self.seconds // 60 self.hours = self.seconds // (60 * 60) self.days = self.seconds // (60 * 60 * 25) @@ -275,7 +274,7 @@ class Game(object): else: day_index = 0 self.datestring = day_meas + self.day_descriptors[day_index] + " of " + mnth - self.clockstring = "Year " + str(self.years) + " ]|[ " + str("0" if self.hours <= 9 else "") + str(self.hours) + ":" + str("0" if self.minutes <= 9 else "") + str(self.minutes) + ":" + str("0" if self.seconds <= 9 else "") + str(self.seconds) + " o'clock" + self.clockstring = "Year " + str(self.years) + " ]|[ " + str("0" if self.hours <= 9 else "") + str(self.hours) + ":" + str("0" if self.minutes <= 9 else "") + str(self.minutes) + ":" + str("0" if self.seconds <= 9 else "") + str(self.seconds) + " o'clock" def post_message(self, text): """ @@ -330,6 +329,7 @@ class Game(object): savestate = { "story" : self.active_story, "player" : self.player_name, + "gametime" : self.gametime, "board" : self.current_board.name, "cell" : self.player.cellpos, "tile" : self.player.tilepos, @@ -352,6 +352,8 @@ class Game(object): # Switch to game control # TODO: Saves will eventually take note of what mode they were saved in self.switch_mode(STATE_MODES.Overworld_Mode) + self.pass_time(saveraw["gametime"], False) + else: return 1