0.2.6 #19

Closed
Lerking wants to merge 4 commits from 0.2.6 into main
3 changed files with 6 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ import pygame
import math
class ActorPacman:
def __init__(self, scr, center):
def __init__(self, scr, center, start_location):
self.screen = scr
self.direction = PlayerDirection.DirectionRight
self.speed = 3
@@ -14,6 +14,7 @@ class ActorPacman:
self.max_mouth_deg = 45
self.animate_speed = 2
self.mouth_closing = False
self.location = start_location
def update(self):
self.animate()

View File

@@ -36,6 +36,7 @@ class Maze:
self.power_pellets.add((x, y))
elif char == "P":
self.pacman_start = (x * TILE_SIZE + TILE_SIZE // 2, y * TILE_SIZE + TILE_SIZE // 2 + 32)
self.pacman_location = (x, y)
def draw(self, screen):
for y, row in enumerate(self.layout):

View File

@@ -6,7 +6,7 @@ from actors.ghost_mode_controller import GhostModeController
from hud import HUD
from maze import Maze
__version__ = "0.2.5"
__version__ = "0.2.6"
def spawn_ghosts(center_position):
@@ -38,7 +38,7 @@ def main() -> None:
hud = HUD(screen_width, screen_height, cherry_image=cherry_img)
maze = Maze("maze/pacman_maze.txt")
player = ActorPacman(screen, center=maze.pacman_start)
player = ActorPacman(screen, center=maze.pacman_start, location=maze.pacman_location)
ghost_mode_controller = GhostModeController()
ghost_home_center = (screen_width // 2, (screen_height) // 2)
ghosts = spawn_ghosts(ghost_home_center)
@@ -77,7 +77,7 @@ def main() -> None:
# In your main game loop:
hud.draw(screen)
maze.draw(screen)
player.animate()
player.update(maze)
player.draw()
ghost_mode_controller.update()
current_mode = ghost_mode_controller.mode