Trying a Thing 0 ▲ ronjeffries.com 2 hours ago · Tech · hide · 0 comments Hello, loves! I’d like to make the KeyPress code simpler. Here’s something that works. Do we like it? Yes, but we don’t love it. Tout le monde déteste l’IA. Here’s the KeyPress code for D: class KeyPress: elif symbol == arcade.key.D: more = self.stepper.step() maker = DungeonViewMaker(self.dungeon) maker.update(self.view) if not more: self.dungeon.run() Here’s what I want: Wishful Thinking: elif symbol == arcade.key.D: more = self.stepper.step(self.view) if not more: self.dungeon.run() Here’s how I changed the stepper: class BuildStepper: def __init__(self, table, layout, dungeon ): self.table = table self.index = 0 self.layout = layout self.dungeon = dungeon def step(self, view=None): if self._more_to_do(): self._do_one_step(view) return self._more_to_do() def _more_to_do(self): return self.index < len(self.table) def _do_one_step(self, view): self.table[self.index](self.dungeon, self.layout) if view: maker = DungeonViewMaker(self.dungeon) maker.update(view) self.index += 1 The game… No comments yet. Log in to reply on the Fediverse. Comments will appear here.