From 45b882110d854d9e6e8ff0d35bde313a0f454890 Mon Sep 17 00:00:00 2001 From: Lerking Date: Tue, 15 Apr 2025 22:07:32 +0200 Subject: [PATCH] Update actors/pill.py --- actors/pill.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/actors/pill.py b/actors/pill.py index a26edcc..af3a597 100644 --- a/actors/pill.py +++ b/actors/pill.py @@ -1,5 +1,22 @@ +import pygame from .enums import PillType -class Pill: - def __init__(self, typ: PillType): - self.pilltype = typ \ No newline at end of file +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) \ No newline at end of file