Files
PyGame-Pacman/actors/pill.py
2025-04-15 22:07:32 +02:00

22 lines
767 B
Python

import pygame
from .enums import PillType
class Pill(pygame.sprite.Sprite):
def __init__(self, x, y, pill_type: PillType):
super().__init__()
self.x = x
self.y = y
self.pill_type = pill_type
self.radius = 2 if pill_type == PillType.NORMAL else 6
self.color = (255, 255, 255)
self.image = pygame.Surface((self.radius * 2, self.radius * 2), pygame.SRCALPHA)
pygame.draw.circle(self.image, self.color, (self.radius, self.radius), self.radius)
self.rect = self.image.get_rect(center=(x, y))
class NormalPill(Pill):
def __init__(self, x, y):
super().__init__(x, y, PillType.NORMAL)
class PowerPill(Pill):
def __init__(self, x, y):
super().__init__(x, y, PillType.POWER)