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/inky.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/inky.py')
| -rw-r--r-- | src/inky.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/inky.py b/src/inky.py index 1989048..1f5bb8b 100644 --- a/src/inky.py +++ b/src/inky.py @@ -43,8 +43,8 @@ class Inky(Ghost): return (2 * 30 + 15, 30 * 30 + 15) def get_target(self, inter_tile, blinky): - target = (inter_tile[0] - (blinky.x - inter_tile[0]), - inter_tile[1] - (blinky.y - inter_tile[1])) + target = (max(inter_tile[0] - (blinky.x - inter_tile[0]) % 900, 0), + max(inter_tile[1] - (blinky.y - inter_tile[1]) % 990, 0)) return target @override @@ -76,7 +76,8 @@ class Inky(Ghost): self.mode = MODE.FRIGHETENED rand_pos = random.randint(0, 900), random.randint(0, 990) - # y = mx + c + if pacman.powerup is False and self.mode == MODE.FRIGHETENED: + self.mode = MODE.CHASING if settings.debug: pygame.draw.line(screen, self.color, (target), |
