First attempt on ghost movement. /JL

This commit is contained in:
2025-04-20 18:42:21 +02:00
parent ea77fd4498
commit 97c06fd3cf
4 changed files with 26 additions and 26 deletions

14
pman.py
View File

@@ -7,7 +7,7 @@ from actors.ghost_mode_controller import GhostModeController
from hud import HUD
from maze import Maze
__version__ = "0.4.0"
__version__ = "0.4.1"
# Constants
HAT_REPEAT_DELAY = 300 # milliseconds before first repeat
@@ -62,12 +62,12 @@ class Game:
"""
offset = 20 # spread out a little bit inside ghost home
blinky = Blinky((center_position[0] - offset, center_position[1] - offset))
pinky = Pinky((center_position[0] + offset, center_position[1] - offset))
inky = Inky((center_position[0] - offset, center_position[1] + offset))
clyde = Clyde((center_position[0] + offset, center_position[1] + offset))
self.blinky = Blinky((center_position[0] - offset, center_position[1] - offset))
self.pinky = Pinky((center_position[0] + offset, center_position[1] - offset))
self.inky = Inky((center_position[0] - offset, center_position[1] + offset))
self.clyde = Clyde((center_position[0] + offset, center_position[1] + offset))
return pygame.sprite.Group(blinky, pinky, inky, clyde)
return pygame.sprite.Group(self.blinky, self.pinky, self.inky, self.clyde)
def handle_hat_repeat(self):
now = pygame.time.get_ticks()
@@ -104,7 +104,7 @@ class Game:
for ghost in self.ghosts:
ghost.set_mode(self.current_mode)
#ghost.update(maze, pacman)
ghost.update(self.maze, self.player)
self.ghosts.draw(self.screen)
pygame.display.flip()