def __init__(self, args): Game.args = args # Configure game settings config = configparser.ConfigParser() cfg_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'config.cfg') config.read(cfg_path) Game.config = config # Configure tdl tdl.set_font(Game.config['ENGINE']['font']) tdl.set_fps(int(Game.config['ENGINE']['fps'])) self.console = tdl.init(54, 30, 'lunch break roguelike', renderer=Game.config['ENGINE']['renderer']) self._last_time = time.time() Game.seconds_per_tick = float(Game.config['GAME']['turn']) if not Game.instance: Game.instance = self instances.register('game', self) # Twitch Observer nickname = Game.config['TWITCH']['Nickname'] password = Game.config['TWITCH']['Password'] self.channel = Game.config['TWITCH']['Channel'] self.observer = Observer(nickname, password) self.observer.start() self.observer.join_channel(self.channel) self.start_time = time.time() Game.scene_root = gamescene.GameScene()
def __init__(self, x, y, width, height, title='Players'): super().__init__(x, y, width, height, title) self.messages = [] self.colorizer = StringColorizer(palette.BRIGHT_WHITE, palette.BLACK) if not Console.instance: Console.instance = self instances.register('console', self)
def __init__(self, x=0, y=0, width=54, height=30): super().__init__(x, y, width, height) self.level = None self.tick_count = 0 self.change_level_requested = False self._change_level_on_tick = 0 if not LevelScene.instance: LevelScene.instance = self instances.register('scene_root', self)