|
| enum | Moves { UP
, LEFT
, RIGHT
, DOWN
} |
| enum class | GhostState { WAITING
, EXITING
, CHASING
, DEAD
} |
| enum | Events {
NO_EVENT
, GAME_OVER
, LEVEL_COMPLETED
, DIRECTION_CHANGED
,
ISMOVING_CHANGED
, DEATH
, RESPAWN
, FRUIT_EATEN
,
GHOST_EATEN
, COIN_EATEN
, SCORE_UPDATE
, GHOST_FRIGHTENED
,
GHOST_NORMAL
, FRIGHTENED_FLASHING
} |
| enum | WorldState { AWAITING_MAP
, RESTARTING
, FRIGHTENED
, PLAYING
} |
◆ Events
| Enumerator |
|---|
| NO_EVENT | |
| GAME_OVER | |
| LEVEL_COMPLETED | |
| DIRECTION_CHANGED | |
| ISMOVING_CHANGED | |
| DEATH | |
| RESPAWN | |
| FRUIT_EATEN | |
| GHOST_EATEN | |
| COIN_EATEN | |
| SCORE_UPDATE | |
| GHOST_FRIGHTENED | |
| GHOST_NORMAL | |
| FRIGHTENED_FLASHING | |
◆ GhostState
Ghosts have a few states they could be in. Being frightened is not a State but rather a way of being in some sense. I decided against making it a State because it overlaps with what the Ghost actually is (doing) at that point.
WAITING: This is the initial state of a (respawned) Ghost. A Ghost waits for as long as it is still on cooldown before EXITING. EXITING: This is an intermediary state between WAITING and CHASING. This state forces the Ghost to get out of its enclosure. The moment it successfully left said enclosure it will start CHASING. CHASING: While CHASING a Ghost will target Pacman as per it's specific targetting behaviour. It will not stop doing so unless frightened, afterwhich it will pause its chasing activities and start running away. When no longer frigthened it will just continue as normal. DEAD: In this state Pacman can no longer collide with the Ghost. A Ghost will remain in this state while it is navigating back to its enclosure. When it is at its spawnpoint again it will be in a WAITING state again.
| Enumerator |
|---|
| WAITING | |
| EXITING | |
| CHASING | |
| DEAD | |
◆ Moves
| Enumerator |
|---|
| UP | |
| LEFT | |
| RIGHT | |
| DOWN | |
◆ WorldState
| Enumerator |
|---|
| AWAITING_MAP | |
| RESTARTING | |
| FRIGHTENED | |
| PLAYING | |
◆ BASE_COIN_POINTS
| int logic::BASE_COIN_POINTS = 10 |
|
constexpr |
◆ COLLISSION_EPSILON
| float logic::COLLISSION_EPSILON = 0.07f |
|
constexpr |
◆ GHOST_POINTS
| int logic::GHOST_POINTS = 200 |
|
constexpr |
◆ LEVEL_CLEAR_POINTS
| int logic::LEVEL_CLEAR_POINTS = 500 |
|
constexpr |
◆ SCORE_DECAY
| int logic::SCORE_DECAY = 10 |
|
constexpr |
◆ TARGET_EPSILON
| float logic::TARGET_EPSILON = 0.001f |
|
constexpr |