1 hour ago · Tech · hide · 0 comments

Hello, loves! Let’s move on_key_press out of DungeonView. Down to 146 lines, from 226 just a few commits ago. I think I’ll just do it unless something interesting comes up. Here it is going in: def on_key_press(self, symbol: int, modifiers: int) -> bool | None: if self.key_lock is not None: return self.key_lock = symbol if symbol == arcade.key.RIGHT: self.move_player(Direction.EAST) elif symbol == arcade.key.LEFT: self.move_player(Direction.WEST) elif symbol == arcade.key.UP: self.move_player(Direction.NORTH) elif symbol == arcade.key.DOWN: self.move_player(Direction.SOUTH) elif symbol == arcade.key.F: self.dungeon.maker_flood() elif symbol == arcade.key.B and (modifiers & arcade.key.MOD_CTRL): message = 'You have been eaten by a breakpoint!' self.pub_sub.publish('announce', 'view', message=message) pass elif symbol == arcade.key.H: self.dungeon.make_initial_announcement() elif symbol == arcade.key.K: self.dungeon.show_path_to('a red key', self) else: self.key_lock = None def…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.