From: = <=> Date: Mon, 5 Oct 2026 12:30:44 +0000 (+0200) Subject: Tiny cleanup X-Git-Url: https://git.uwuaxy.net/?a=commitdiff_plain;h=46cf83aa5b4dc2a1e37030a21305cb4200759f31;p=axy%2Fft%2Fpacman.git Tiny cleanup --- diff --git a/src/pacman/game/__init__.py b/src/pacman/game/__init__.py index afa25f8..a21efe0 100644 --- a/src/pacman/game/__init__.py +++ b/src/pacman/game/__init__.py @@ -207,8 +207,7 @@ def move_to_target( cells: Query[tuple[Cell, Coord2D]], maze_q: Query[Maze], ) -> None: - maze = maze_q.single() - if maze is None: + if (maze := maze_q.single()) is None: return for target, motion, pos in entities: cell, cell_pos = cells[motion.pos] @@ -247,7 +246,6 @@ class Inputs(Resource): key=lambda e: e[1], reverse=True, ) - print(self.inputs) if len(res) == 0: return None return lookup[res[0][0]] @@ -261,8 +259,7 @@ class Pacman(Component): def spawn_pacman( world: World, assets: Assets[Sprite2D], maze_q: Query[Maze] ) -> None: - maze = maze_q.single() - if maze is None: + if (maze := maze_q.single()) is None: return world.spawn( tuple[ @@ -341,8 +338,7 @@ class Ghost(Component): def spawn_ghosts( world: World, assets: Assets[Sprite2D], maze_q: Query[Maze] ) -> None: - maze = maze_q.single() - if maze is None: + if (maze := maze_q.single()) is None: return world.spawn_many( tuple[ @@ -395,8 +391,7 @@ def move_pacman( cells: Query[tuple[Cell, Coord2D]], maze_q: Query[Maze], ) -> None: - maze = maze_q.single() - if maze is None: + if (maze := maze_q.single()) is None: return for coord, motion, pos in pacman_q: direction = inputs.get_dir()