Pacman  1.0
Pacman game
Fonctions membres publiques | Fonctions membres protégées | Attributs protégés | Liste de tous les membres
Référence de la classe Ghostsabstract

Ghosts class. Plus de détails...

#include <Ghosts.h>

Graphe d'héritage de Ghosts:
Inheritance graph
[légende]
Graphe de collaboration de Ghosts:
Collaboration graph
[légende]

Fonctions membres publiques

 Ghosts (float x, float y, int direction, Tile target, int dotCounter)
 
 ~Ghosts ()
 
void move (int pacmanX, int pacmanY, std::shared_ptr< Intersection > dest, int dotEaten)
 move the ghost Plus de détails...
 
void render (int frame, SDL_Renderer *renderer, SDL_Texture *texture)
 render the ghost Plus de détails...
 
virtual std::shared_ptr< IntersectiongetDestination ()=0
 
virtual void setDestination (std::shared_ptr< Intersection > dest)=0
 
void setMode (int mode)
 
int getMode ()
 
virtual Tile getOrig ()=0
 
- Fonctions membres publiques hérités de Entity
 Entity (float x, float y, int direction)
 
void setDirection (int d)
 
float getX () const
 
float getY () const
 

Fonctions membres protégées

SDL_Rect getSprite (int frame, int direction)
 
std::shared_ptr< IntersectionmakeTurn (int pacmanX, int pacmanY, std::shared_ptr< Intersection > dest)
 return the next intersection Plus de détails...
 
virtual Tile getGoalTile (int pacmanX, int pacmanY)=0
 
int oppositeDirection (int direction)
 
- Fonctions membres protégées hérités de Entity
bool isAtIntersection (std::shared_ptr< Intersection > dest)
 return wether the entity is at an intersection Plus de détails...
 

Attributs protégés

std::vector< SDL_Rect > sprites
 
int mode = SCATTER
 
int previousMode = SCATTER
 
Tile scatterTarget
 
std::mt19937 rng
 
Uint32 modeTimer = 0
 
int dotCounter
 
bool isFree = false
 
- Attributs protégés hérités de Entity
float x
 
float y
 
float speed
 
int direction
 
std::vector< SDL_Rect > sprites
 

Description détaillée

Ghosts class.

this class is used to store the ghosts. It is an abstract class.

Documentation des constructeurs et destructeur

◆ Ghosts()

Ghosts::Ghosts ( float  x,
float  y,
int  direction,
Tile  target,
int  dotCounter 
)

◆ ~Ghosts()

Ghosts::~Ghosts ( )

Documentation des fonctions membres

◆ getDestination()

virtual std::shared_ptr<Intersection> Ghosts::getDestination ( )
pure virtual

Implémenté dans Pinky, Inky, Clyde, et Blinky.

◆ getGoalTile()

virtual Tile Ghosts::getGoalTile ( int  pacmanX,
int  pacmanY 
)
protectedpure virtual

Implémenté dans Pinky, Inky, Clyde, et Blinky.

◆ getMode()

int Ghosts::getMode ( )

◆ getOrig()

virtual Tile Ghosts::getOrig ( )
pure virtual

Implémenté dans Pinky, Inky, Clyde, et Blinky.

◆ getSprite()

SDL_Rect Ghosts::getSprite ( int  frame,
int  direction 
)
protectedvirtual

Implémente Entity.

◆ makeTurn()

std::shared_ptr< Intersection > Ghosts::makeTurn ( int  pacmanX,
int  pacmanY,
std::shared_ptr< Intersection dest 
)
protected

return the next intersection

this method is used to return the next intersection. It also updates the coordinates of the ghost. It calls the getGoalTile method to get the goal tile of the ghost. The behaviour of the ghost depends on the mode it is in.

Paramètres
pacmanX
pacmanY
dest
Renvoie
std::shared_ptr<Intersection>

◆ move()

void Ghosts::move ( int  pacmanX,
int  pacmanY,
std::shared_ptr< Intersection dest,
int  dotEaten 
)

move the ghost

this method is used to move the ghost. It calls the makeTurn method to make the ghost turn at an intersection.

Paramètres
pacmanX
pacmanY
dest
dotEaten

◆ oppositeDirection()

int Ghosts::oppositeDirection ( int  direction)
protected

◆ render()

void Ghosts::render ( int  frame,
SDL_Renderer *  renderer,
SDL_Texture *  texture 
)
virtual

render the ghost

this method is used to render the ghost. It calls the getSprite method to get the correct sprite for the ghost.

Paramètres
frame
renderer
texture

Implémente Entity.

◆ setDestination()

virtual void Ghosts::setDestination ( std::shared_ptr< Intersection dest)
pure virtual

Implémenté dans Pinky, Inky, Clyde, et Blinky.

◆ setMode()

void Ghosts::setMode ( int  mode)

Documentation des données membres

◆ dotCounter

int Ghosts::dotCounter
protected

◆ isFree

bool Ghosts::isFree = false
protected

◆ mode

int Ghosts::mode = SCATTER
protected

◆ modeTimer

Uint32 Ghosts::modeTimer = 0
protected

◆ previousMode

int Ghosts::previousMode = SCATTER
protected

◆ rng

std::mt19937 Ghosts::rng
protected

◆ scatterTarget

Tile Ghosts::scatterTarget
protected

◆ sprites

std::vector<SDL_Rect> Ghosts::sprites
protected

La documentation de cette classe a été générée à partir du fichier suivant :