1#ifndef PACMAN_GHOSTMODEL_H
2#define PACMAN_GHOSTMODEL_H
121 void move(
const World& world,
float dt)
override;
155 bool gridTargetReached(
const World& world)
override;
163 void updateWaiting(
const World& world,
double dt);
170 void updateExiting(
const World& world);
177 void updateChasing(
const World& world);
183 void updateDead(
const World& world);
191 bool frightened =
false;
193 double startCooldown;
196 std::list<Moves> cachedPath;
~GhostModel() override=default
bool isFrightened() const
Returns whether the Ghost is currently frightened.
Definition GhostModel.cpp:27
GhostModel(float normalizedX, float normalizedY, float mapWidth, float mapHeight, double cooldown)
Base class for Ghosts. Handles Ghost state and how that influences ghost behaviour.
Definition GhostModel.cpp:11
int getGridSpawnX() const
Returns the Grid mapped X coordinate of where the Ghost spawned.
Definition GhostModel.cpp:31
virtual Moves decideNextMove(const World &world)=0
This function must be overriden by any inheriting Ghost classes. It must return the best Move accordi...
int getGridSpawnY() const
Returns the Grid mapped Y coordinate of where the Ghost spawned.
Definition GhostModel.cpp:35
void setFrightened(bool frightened, const World &world)
Allows the World to set toggle whether the Ghost is Frigthened or not.
Definition GhostModel.cpp:40
void pacmanCollides(World &world)
Tells the Ghost it collided with Pacman and should handle this situation.
Definition GhostModel.cpp:64
void respawn() override
Tell the Ghost to respawn. It will go back to its spawnpoint and start in a GhostState::WAITING state...
Definition GhostModel.cpp:118
void move(const World &world, float dt) override
This function is to be called in the World update loop. The Ghost will act based on it's current Stat...
Definition GhostModel.cpp:82
GhostState getState() const
Returns the current state of the Ghost.
Definition GhostModel.cpp:23
float mapWidth
Definition EntityModel.h:120
MovingEntityModel(float normalizedX, float normalizedY, float mapWidth, float mapHeight, float speed)
Subclass of EntityModel to be used for any moving entity.
Definition EntityModel.cpp:22
float mapHeight
Definition EntityModel.h:121
Definition Difficulty.h:6
GhostState
Definition GhostModel.h:33
@ WAITING
Definition GhostModel.h:33
@ EXITING
Definition GhostModel.h:33
@ CHASING
Definition GhostModel.h:33
@ DEAD
Definition GhostModel.h:33
Moves
Definition EntityModel.h:8