diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2023-05-08 18:32:04 +0300 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2023-05-08 18:32:04 +0300 |
| commit | 1584574267bae0ec4b0096ace7a7cbbe08787c05 (patch) | |
| tree | 912cd58e7e21c35c0afebe125e6badf69c12ed52 /src/pinky.py | |
| parent | 9621f880a03337a8a252cf5cd3993d5a1a29969c (diff) | |
| download | Macpan-1584574267bae0ec4b0096ace7a7cbbe08787c05.tar.xz Macpan-1584574267bae0ec4b0096ace7a7cbbe08787c05.zip | |
Fixed a bug in inky's algorithms and also now the ghost reset to chase mode after pacman finishes his powerup
Diffstat (limited to 'src/pinky.py')
| -rw-r--r-- | src/pinky.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pinky.py b/src/pinky.py index 416e7d8..29949a7 100644 --- a/src/pinky.py +++ b/src/pinky.py @@ -43,7 +43,7 @@ class Pinky(Ghost): return (27 * 30 + 15, 30 * 30 + 15) @override - def get_next_move(self, target, maze, screen, blinky): + def get_next_move(self, pacman, maze, screen, blinky): default_tile = self.get_default_tile() dx = [1, 0, -1, 0] @@ -64,17 +64,20 @@ class Pinky(Ghost): rand_pos = (0, 0) - new_target = self.get_four_tiles_ahead_of_pacman(target) + new_target = self.get_four_tiles_ahead_of_pacman(pacman) if settings.debug: pygame.draw.circle(screen, self.color, (new_target[0], new_target[1]), 15) pygame.draw.circle(screen, self.color, default_tile, 15) - if target.powerup: + if 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: + self.mode = MODE.CHASING + for i in range(len(dx)): if i != forbidden: nx = self.x + dx[i] * self.speed |
