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

Game class. Plus de détails...

#include <Game.h>

Graphe de collaboration de Game:
Collaboration graph
[légende]

Fonctions membres publiques

 Game ()
 Construct a new Game object. Plus de détails...
 
 ~Game ()
 
int update (int state)
 This function updates the game state. Plus de détails...
 
void setPlayerDirection (int d)
 Set the player direction. This function is called when the user presses a key. Plus de détails...
 
int reset ()
 reset the game to a starting state, called when the player loses a life Plus de détails...
 

Fonctions membres privées

void handlePacgums ()
 
int handleGhosts ()
 

Attributs privés

int playerDirection = RIGHT
 
Maze maze
 
std::shared_ptr< Pacmanpacman
 
std::vector< std::shared_ptr< Ghosts > > ghosts
 
int score
 
std::unique_ptr< Rendererrenderer
 
int nb_gommes = 244
 
int lives
 
Uint32 last_gum_eaten = 0
 
int level = 1
 
std::vector< int > mode_times = {7000, 27000, 34000, 54000, 59000, 79000, 84000}
 
std::vector< int > modes = {CHASE, SCATTER, CHASE, SCATTER, CHASE, SCATTER, CHASE}
 
Uint32 game_start
 

Description détaillée

Game class.

This class is the main class of the game. It contains all the game logic. It is responsible for updating the game state and rendering the game.

Documentation des constructeurs et destructeur

◆ Game()

Game::Game ( )

Construct a new Game object.

This constructor initializes the game by creating the maze, the pacman and the ghosts. It also initializes the renderer.

◆ ~Game()

Game::~Game ( )

Documentation des fonctions membres

◆ handleGhosts()

int Game::handleGhosts ( )
private

◆ handlePacgums()

void Game::handlePacgums ( )
private

◆ reset()

int Game::reset ( )

reset the game to a starting state, called when the player loses a life

Renvoie
int The new state of the game

◆ setPlayerDirection()

void Game::setPlayerDirection ( int  d)

Set the player direction. This function is called when the user presses a key.

Paramètres
dThe direction of the player

◆ update()

int Game::update ( int  state)

This function updates the game state.

This function updates the game state by updating the pacman and the ghosts. It also handles the collisions between the pacman and the ghosts.

Paramètres
stateThe current state of the game (STARTING, PLAYING, GAMEOVER, WON)
Renvoie
int The new state of the game

Documentation des données membres

◆ game_start

Uint32 Game::game_start
private

◆ ghosts

std::vector<std::shared_ptr<Ghosts> > Game::ghosts
private

◆ last_gum_eaten

Uint32 Game::last_gum_eaten = 0
private

◆ level

int Game::level = 1
private

◆ lives

int Game::lives
private

◆ maze

Maze Game::maze
private

◆ mode_times

std::vector<int> Game::mode_times = {7000, 27000, 34000, 54000, 59000, 79000, 84000}
private

◆ modes

std::vector<int> Game::modes = {CHASE, SCATTER, CHASE, SCATTER, CHASE, SCATTER, CHASE}
private

◆ nb_gommes

int Game::nb_gommes = 244
private

◆ pacman

std::shared_ptr<Pacman> Game::pacman
private

◆ playerDirection

int Game::playerDirection = RIGHT
private

◆ renderer

std::unique_ptr<Renderer> Game::renderer
private

◆ score

int Game::score
private

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