Pacman Torben Petré
Loading...
Searching...
No Matches
logic::ChasingGhost Class Referencefinal

#include <ChasingGhost.h>

Inheritance diagram for logic::ChasingGhost:
Collaboration diagram for logic::ChasingGhost:

Public Member Functions

 ChasingGhost (float normalizedX, float normalizedY, float mapWidth, float mapHeight, double cooldown)
 Initializes base class GhostModel. ChasingGhost has specific chasing behaviour.
Public Member Functions inherited from logic::GhostModel
 GhostModel (float normalizedX, float normalizedY, float mapWidth, float mapHeight, double cooldown)
 Base class for Ghosts. Handles Ghost state and how that influences ghost behaviour.
 ~GhostModel () override=default
GhostState getState () const
 Returns the current state of the Ghost.
bool isFrightened () const
 Returns whether the Ghost is currently frightened.
int getGridSpawnX () const
 Returns the Grid mapped X coordinate of where the Ghost spawned.
int getGridSpawnY () const
 Returns the Grid mapped Y coordinate of where the Ghost spawned.
void setFrightened (bool frightened, const World &world)
 Allows the World to set toggle whether the Ghost is Frigthened or not.
void pacmanCollides (World &world)
 Tells the Ghost it collided with Pacman and should handle this situation.
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 State and possibly move.
void respawn () override
 Tell the Ghost to respawn. It will go back to its spawnpoint and start in a GhostState::WAITING state again.
Public Member Functions inherited from logic::MovingEntityModel
 MovingEntityModel (float normalizedX, float normalizedY, float mapWidth, float mapHeight, float speed)
 Subclass of EntityModel to be used for any moving entity.
Moves getDirection () const
 Get the direction the entity is currently moving in.
int getGridX () const
int getGridY () const
Public Member Functions inherited from logic::EntityModel
 EntityModel (float normalizedX, float normalizedY)
 Base class for entities.
 ~EntityModel () override=default
float getX () const
float getY () const
Public Member Functions inherited from logic::Subject
virtual ~Subject ()=default
void attach (const std::shared_ptr< Observer > &observer)
 Attaches an observer to this Subject.
void notify (Events event)
 Call the Observer update function with the provided event.

Additional Inherited Members

Protected Member Functions inherited from logic::MovingEntityModel
void normalizeTarget ()
 Normalizes the grid coordinates and stores these values in as target coordinates. Moving entities strive towards normalized grid coordinates.
Protected Attributes inherited from logic::MovingEntityModel
float mapWidth
float mapHeight
float spawnX
float spawnY
int gridY
int gridX
float targetX
float targetY
Moves direction = Moves::RIGHT
float speed
Protected Attributes inherited from logic::EntityModel
float x
float y
Protected Attributes inherited from logic::Subject
std::list< std::weak_ptr< Observer > > observers

Constructor & Destructor Documentation

◆ ChasingGhost()

ChasingGhost::ChasingGhost ( float normalizedX,
float normalizedY,
float mapWidth,
float mapHeight,
double cooldown )
explicit

Initializes base class GhostModel. ChasingGhost has specific chasing behaviour.

Parameters
normalizedXNormalized x spawn coordinate
normalizedYNormalized y spawn coordinate
mapWidthMap width (in tiles)
mapHeightMap height (in tiles)
cooldownSpawn cooldown before leaving enclosure

The documentation for this class was generated from the following files: