def __init__(self, game): self.game = game self.state_machine = state_machine.StateMachine(game) # self.event_queue = [] # TODO: Very easy to forget to add an event - any better solutions? self.active_events = { Events.THROUGH_EXIT_GATE, Events.THROUGH_ENTRANCE_GATE, Events.LANDING_ZONE_ENTERED, Events.START_OF_SUNRISE, Events.START_OF_SUNSET, Events.START_OF_DAYTIME, Events.START_OF_NIGHTTIME, Events.GOT_HUNGRY, Events.STARVING, Events.START_FEEDING, Events.REPLETE, } # In debug mode all events are active from the start if logger.getEffectiveLevel() <= logging.DEBUG: self.active_events.update([ Events.SHOUT ])
def main(): maingui = gui.Gui() statemachine = state_machine.StateMachine() maingui.start() statemachine.start() maingui.end() statemachine.end()
def __init__(self, caption): self.screen = pg.display.get_surface() self.caption = caption self.done = False self.clock = pg.time.Clock() self.fps = 60.0 self.fps_visible = True self.now = 0.0 self.keys = pg.key.get_pressed() self.state_machine = state_machine.StateMachine()