Pacman  1.0
Pacman game
Game.h
Aller à la documentation de ce fichier.
1 #ifndef GAME_H
2 #define GAME_H
3 
4 #include "Blinky.h"
5 #include "Clyde.h"
6 #include "Entity.h"
7 #include "Ghosts.h"
8 #include "Inky.h"
9 #include "Maze.h"
10 #include "Pacman.h"
11 #include "Pinky.h"
12 #include "Renderer.h"
13 #include "constants.h"
14 #include <iostream>
15 #include <memory>
16 
25 class Game {
26  public:
34  Game();
35  ~Game();
36 
47  int update(int state);
48 
54  void setPlayerDirection(int d);
55 
61  int reset();
62 
63  private:
64  void handlePacgums();
65  int handleGhosts();
68  std::shared_ptr<Pacman> pacman;
69  std::vector<std::shared_ptr<Ghosts>> ghosts;
70  int score;
71  std::unique_ptr<Renderer> renderer;
72  int nb_gommes = 244;
73  int lives;
74  Uint32 last_gum_eaten = 0;
75  int level = 1;
76  std::vector<int> mode_times = {7000, 27000, 34000, 54000, 59000, 79000, 84000};
77  std::vector<int> modes = {CHASE, SCATTER, CHASE, SCATTER, CHASE, SCATTER, CHASE};
78  Uint32 game_start;
79 };
80 
81 #endif /* GAME_H */
Game class.
Definition: Game.h:25
void setPlayerDirection(int d)
Set the player direction. This function is called when the user presses a key.
Definition: Game.cpp:27
void handlePacgums()
Definition: Game.cpp:33
int update(int state)
This function updates the game state.
Definition: Game.cpp:98
Uint32 last_gum_eaten
Definition: Game.h:74
Maze maze
Definition: Game.h:67
int handleGhosts()
Definition: Game.cpp:56
std::shared_ptr< Pacman > pacman
Definition: Game.h:68
std::vector< int > modes
Definition: Game.h:77
Uint32 game_start
Definition: Game.h:78
int lives
Definition: Game.h:73
std::vector< std::shared_ptr< Ghosts > > ghosts
Definition: Game.h:69
int level
Definition: Game.h:75
int nb_gommes
Definition: Game.h:72
int playerDirection
Definition: Game.h:66
std::vector< int > mode_times
Definition: Game.h:76
std::unique_ptr< Renderer > renderer
Definition: Game.h:71
Game()
Construct a new Game object.
Definition: Game.cpp:3
~Game()
Definition: Game.cpp:25
int reset()
reset the game to a starting state, called when the player loses a life
Definition: Game.cpp:76
int score
Definition: Game.h:70
Maze class.
Definition: Maze.h:29
#define SCATTER
Definition: constants.h:44
#define RIGHT
Definition: constants.h:37
#define CHASE
Definition: constants.h:43