|
Pacman
1.0
Pacman game
|
Game class. Plus de détails...
#include <Game.h>

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< Pacman > | pacman |
| std::vector< std::shared_ptr< Ghosts > > | ghosts |
| int | score |
| std::unique_ptr< Renderer > | renderer |
| 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 |
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.
| 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 | ( | ) |
|
private |
|
private |
| int Game::reset | ( | ) |
reset the game to a starting state, called when the player loses a life
| void Game::setPlayerDirection | ( | int | d | ) |
Set the player direction. This function is called when the user presses a key.
| d | The direction of the player |
| 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.
| state | The current state of the game (STARTING, PLAYING, GAMEOVER, WON) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |