Added HUD with lives and level indicators. /JL
This commit is contained in:
8
maze.py
8
maze.py
@@ -35,21 +35,21 @@ class Maze:
|
||||
elif char == "*":
|
||||
self.power_pellets.add((x, y))
|
||||
elif char == "P":
|
||||
self.pacman_start = (x * TILE_SIZE + TILE_SIZE // 2, y * TILE_SIZE + TILE_SIZE // 2)
|
||||
self.pacman_start = (x * TILE_SIZE + TILE_SIZE // 2, y * TILE_SIZE + TILE_SIZE // 2 + 32)
|
||||
|
||||
def draw(self, screen):
|
||||
for y, row in enumerate(self.layout):
|
||||
for x, char in enumerate(row):
|
||||
rect = pygame.Rect(x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE)
|
||||
rect = pygame.Rect(x * TILE_SIZE, y * TILE_SIZE + 32, TILE_SIZE, TILE_SIZE)
|
||||
if char == "W":
|
||||
pygame.draw.rect(screen, COLOR_WALL, rect)
|
||||
# Draw dots
|
||||
for (x, y) in self.dots:
|
||||
center = (x * TILE_SIZE + TILE_SIZE // 2, y * TILE_SIZE + TILE_SIZE // 2)
|
||||
center = (x * TILE_SIZE + TILE_SIZE // 2, y * TILE_SIZE + TILE_SIZE // 2 + 32)
|
||||
pygame.draw.circle(screen, COLOR_DOT, center, 2)
|
||||
# Draw power pellets
|
||||
for (x, y) in self.power_pellets:
|
||||
center = (x * TILE_SIZE + TILE_SIZE // 2, y * TILE_SIZE + TILE_SIZE // 2)
|
||||
center = (x * TILE_SIZE + TILE_SIZE // 2, y * TILE_SIZE + TILE_SIZE // 2 + 32)
|
||||
pygame.draw.circle(screen, COLOR_POWER, center, 5)
|
||||
|
||||
def tile_at(self, x, y):
|
||||
|
||||
Reference in New Issue
Block a user