diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2023-05-08 21:40:21 +0300 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2023-05-08 21:40:21 +0300 |
| commit | 241e41892a10d3913c63935a8f9e14306e8a73cd (patch) | |
| tree | e8a95b5e20d20aad3d677ce02a089fbc0339a4b8 /src/inky.py | |
| parent | d610718c10e310c75126593624ecaaaa2233b371 (diff) | |
| download | Macpan-241e41892a10d3913c63935a8f9e14306e8a73cd.tar.xz Macpan-241e41892a10d3913c63935a8f9e14306e8a73cd.zip | |
Made a Singeltion class GameState containg the current state of the game
Diffstat (limited to 'src/inky.py')
| -rw-r--r-- | src/inky.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/inky.py b/src/inky.py index 1f5bb8b..840b60b 100644 --- a/src/inky.py +++ b/src/inky.py @@ -48,7 +48,7 @@ class Inky(Ghost): return target @override - def get_next_move(self, pacman, maze, screen, blinky): + def get_next_move(self, game_state, screen): default_tile = self.get_default_tile() dx = [1, 0, -1, 0] @@ -67,16 +67,16 @@ class Inky(Ghost): if self.last_move == 3: forbidden = 1 - inter_tile = self.get_intermediate_tile(pacman) - target = self.get_target(inter_tile, blinky) + inter_tile = self.get_intermediate_tile(game_state.pacman) + target = self.get_target(inter_tile, game_state.blinky) rand_pos = (0, 0) - if pacman.powerup: + if game_state.pacman.powerup: self.mode = MODE.FRIGHETENED rand_pos = random.randint(0, 900), random.randint(0, 990) - if pacman.powerup is False and self.mode == MODE.FRIGHETENED: + if game_state.pacman.powerup is False and self.mode == MODE.FRIGHETENED: self.mode = MODE.CHASING if settings.debug: @@ -87,7 +87,7 @@ class Inky(Ghost): if i != forbidden: nx = self.x + dx[i] * self.speed ny = self.y + dy[i] * self.speed - if self.check_collision(nx, ny, 30, 30, maze): + if self.check_collision(nx, ny, 30, 30, game_state.map.maze): if self.mode == MODE.SCATTERED: ret[i] = self.heuristic( (nx, ny), default_tile[0], default_tile[1]) |
