Files
PyGame-Pacman/actors/enums.py
2025-04-17 21:40:49 +02:00

55 lines
1.3 KiB
Python

from enum import Enum, auto
class PlayerDirection(Enum):
DirectionRight = 0
DirectionLeft = 180
DirectionUp = -90
DirectionDown = 90
class GhostDirection(Enum):
GhostRight = 1
GhostLeft = 2
GhostUp = 3
GhostDown = 4
class PillType(Enum):
PillTypeRegular = 1
PillTypePower = 2
class Colors(Enum):
Yellow = (255, 255, 0)
Black = (0, 0, 0)
Blue = (0, 0, 255)
Cyan = (0, 255, 255)
Magenta = (255, 0, 255)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
# add others as needed
def __getitem__(self):
return self.value
class GhostColor(Enum):
BLINKY = (255, 0, 0)
PINKY = (255, 184, 255)
INKY = (0, 255, 255)
CLYDE = (255, 184, 82)
class GhostMode(Enum):
SCATTER = auto()
CHASE = auto()
FRIGHTENED = auto()
class GhostBehavior(Enum):
BLINKY = "blinky_behavior"
PINKY = "pinky_behavior"
INKY = "inky_behavior"
CLYDE = "clyde_behavior"
def decide_direction(self, ghost, pacman, maze):
strategy = {
GhostBehavior.BLINKY: blinky_behavior,
GhostBehavior.PINKY: pinky_behavior,
GhostBehavior.INKY: inky_behavior,
GhostBehavior.CLYDE: clyde_behavior,
}[self]
return strategy(ghost, pacman, maze)