Pacman
1.0
Pacman game
|
Ghosts class. Plus de détails...
#include <Ghosts.h>
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< Intersection > | getDestination ()=0 |
virtual void | setDestination (std::shared_ptr< Intersection > dest)=0 |
void | setMode (int mode) |
int | getMode () |
virtual Tile | getOrig ()=0 |
![]() | |
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< Intersection > | makeTurn (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) |
![]() | |
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 |
![]() | |
float | x |
float | y |
float | speed |
int | direction |
std::vector< SDL_Rect > | sprites |
Ghosts class.
this class is used to store the ghosts. It is an abstract class.
Ghosts::Ghosts | ( | float | x, |
float | y, | ||
int | direction, | ||
Tile | target, | ||
int | dotCounter | ||
) |
Ghosts::~Ghosts | ( | ) |
|
pure virtual |
|
protectedpure virtual |
int Ghosts::getMode | ( | ) |
|
protectedvirtual |
Implémente Entity.
|
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.
pacmanX | |
pacmanY | |
dest |
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.
pacmanX | |
pacmanY | |
dest | |
dotEaten |
|
protected |
|
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.
frame | |
renderer | |
texture |
Implémente Entity.
|
pure virtual |
void Ghosts::setMode | ( | int | mode | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |