Merge pull request '0.2.5' (#17) from 0.2.5 into main

Reviewed-on: #17
This commit is contained in:
2025-04-19 10:07:03 +02:00
2 changed files with 15 additions and 15 deletions

View File

@@ -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

View File

@@ -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):