From 230a29d6ef2e4683d850e128098399203fce4b5c Mon Sep 17 00:00:00 2001 From: Lerking Date: Sat, 19 Apr 2025 10:01:54 +0200 Subject: [PATCH 1/2] Update pman.py --- pman.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pman.py b/pman.py index 1c00794..8940bd5 100644 --- a/pman.py +++ b/pman.py @@ -6,7 +6,7 @@ from actors.ghost_mode_controller import GhostModeController from hud import HUD from maze import Maze -__version__ = "0.2.4" +__version__ = "0.2.5" def spawn_ghosts(center_position): From d61722c0480936f3746907323a37352856c33a4a Mon Sep 17 00:00:00 2001 From: Lerking Date: Sat, 19 Apr 2025 10:06:26 +0200 Subject: [PATCH 2/2] Update actors/pacman.py --- actors/pacman.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/actors/pacman.py b/actors/pacman.py index 123c47e..fc88c61 100644 --- a/actors/pacman.py +++ b/actors/pacman.py @@ -15,6 +15,9 @@ class ActorPacman: self.animate_speed = 2 self.mouth_closing = False + def update(self): + self.animate() + def animate(self): if self.mouth_closing: self.mouth_angle_deg -= self.animate_speed @@ -26,18 +29,18 @@ class ActorPacman: if self.mouth_angle_deg >= self.max_mouth_deg: self.mouth_angle_deg = self.max_mouth_deg self.mouth_closing = True - match self.direction: - case PlayerDirection.DirectionRight: - self.x += self.speed - case PlayerDirection.DirectionLeft: - self.x -= self.speed - case PlayerDirection.DirectionUp: - self.y -= self.speed - case PlayerDirection.DirectionDown: - self.y += self.speed + match self.direction: + case PlayerDirection.DirectionRight: + self.x += self.speed + case PlayerDirection.DirectionLeft: + self.x -= self.speed + case PlayerDirection.DirectionUp: + self.y -= self.speed + case PlayerDirection.DirectionDown: + self.y += self.speed - self.x = max(self.radius, min(self.x, 400 - self.radius)) - self.y = max(self.radius, min(self.y, 400 - self.radius)) + self.x = max(self.radius, min(self.x, 400 - self.radius)) + self.y = max(self.radius, min(self.y, 400 - self.radius)) def draw(self): mouth_angle = math.radians(self.mouth_angle_deg) @@ -54,8 +57,5 @@ class ActorPacman: angle += math.radians(1) pygame.draw.polygon(self.screen, Colors.Yellow.value, points) - def move_right(self): - pass - def set_direction(self, dir: PlayerDirection): self.direction = dir \ No newline at end of file