class GameState(pyglet.event.EventDispatcher): """I keep track of high-level, game-global state: the player's progress, roughly what's going on at the moment, etc. I also act as an event hub for player input. Don't tell anyone, but I'm like the M in MVC. """ _world = None def __init__(self): self.loader = Loader(['maps/field.yaml'], ['entities/entities.yaml']) self.inventory = [] def change_map(self, map_name): mapdata = self.loader.load_map(map_name) # TODO blah blah another circular ref. self._world = WorldLayer(self, mapdata) return self._world
def __init__(self): self.loader = Loader(['maps/field.yaml'], ['entities/entities.yaml']) self.inventory = []