diff --git a/game.py b/game.py index 2755fb2..d2c22de 100644 --- a/game.py +++ b/game.py @@ -5,23 +5,27 @@ class GameWorld(world.CustomWorld): def __init__(self): super().__init__() + ' Flags. ' self.create_dijkstra_map = False - self.debug_mode = False - self.events = [] self.generate_map = False + self.pop_state = False + self.reset_game = False + self.victory = False + self.view_log = False + + ' Data. ' + self.debug_mode = False # This one is a toggle + self.events = [] self.key = None self.messages = [] self.messages_offset = 0 self.mouse_pos = None - self.pop_state = False self.popup_menus = [] - self.redraw = False - self.reset_game = False + self.redraw = False # This information needs to communicate cross-tick self.state_stack = ['Exit', 'MainMenu'] self.ticker = 0 - self.victory = False - self.view_log = False - + + ' Objects. ' self.cursor = Cursor() self.map = Map() @@ -32,6 +36,14 @@ def state(self): @property def turn(self): return self.ticker // 10 + + def reset_flags(self): + self.create_dijkstra_map = False + self.generate_map = False + self.pop_state = False + self.reset_game = False + self.victory = False + self.view_log = False class Cursor(): def __init__(self): diff --git a/processors/final.py b/processors/final.py index 1eab7e3..51ead81 100644 --- a/processors/final.py +++ b/processors/final.py @@ -8,5 +8,6 @@ def __init__(self): def process(self): if self.world._entities and self.world.reset_game: - self.world.reset_game = False - self.world.clear_database() \ No newline at end of file + self.world.clear_database() + + self.world.reset_flags() \ No newline at end of file diff --git a/processors/state.py b/processors/state.py index 801e7d8..b9497c5 100644 --- a/processors/state.py +++ b/processors/state.py @@ -14,20 +14,15 @@ def process(self): if self.world.state == 'Game': if self.world.pop_state: self.world.state_stack.pop() - self.world.pop_state = False self.world.reset_game = True if self.world.component_for_entity(1, PlayerComponent).killed: self.world.remove_component(1, PlayerComponent) self.world.state_stack.append('GameOver') if self.world.popup_menus: self.world.state_stack.append('PopupMenu') - if self.world.generate_map: - self.world.generate_map = False if self.world.victory: - self.world.victory = False self.world.state_stack.append('VictoryScreen') if self.world.view_log: - self.world.view_log = False self.world.state_stack.append('ViewLog') if self.world.cursor.active: self.world.state_stack.append('Look') @@ -36,35 +31,31 @@ def process(self): if self.world.pop_state: self.world.state_stack.pop() # Pop to Game self.world.state_stack.pop() # Pop to MainMenu - self.world.pop_state = False self.world.reset_game = True elif self.world.state == 'Look': if self.world.pop_state: self.world.state_stack.pop() - self.world.pop_state = False self.world.cursor.active = False elif self.world.state == 'MainMenu': if self.world.generate_map: - self.world.generate_map = False self.world.state_stack.append('Game') if self.world.pop_state: self.world.state_stack.pop() - self.world.pop_state = False elif self.world.state == 'PopupMenu': if not self.world.popup_menus: self.world.state_stack.pop() + if self.world.pop_state: + self.world.state_stack.pop() elif self.world.state == 'VictoryScreen': if self.world.pop_state: self.world.state_stack.pop() # Pop to Game self.world.state_stack.pop() # Pop to MainMenu - self.world.pop_state = False self.world.reset_game = True elif self.world.state == 'ViewLog': if self.world.pop_state: - self.world.state_stack.pop() - self.world.pop_state = False \ No newline at end of file + self.world.state_stack.pop() \ No newline at end of file