-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacman.h
73 lines (50 loc) · 1.2 KB
/
pacman.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef PACMAN_H
#define PACMAN_H
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <SDL_ttf.h>
#include "ghost.h"
using namespace std;
class Pacman
{
public:
//The dimensions of Pacman
static const int PACMAN_WIDTH = 45;
static const int PACMAN_HEIGHT = 45;
//Maximum axis velocity of Pacman
static const int PACMAN_VEL = 3;
// Direct
int direct = 0;
//Lives
int Lives = 3;
//Check if Pacman eats cherry
bool eatCherry = false;
//Time eat cherry
int timeEatCherry = 0;
//Initializes the variables
Pacman();
//Check if pacman die
bool isDead = false;
//Reset pacman
void reset();
//Handle keyboard's events
void handleEvent( SDL_Event& e );
//Moves Pacman
void move(SDL_Rect wall[], int numbers_Wall);
//Shows Pacman on the screen
void render();
//Pacman's collision box
SDL_Rect mCollider;
void doEatCherry();
private:
//The X and Y offsets of Pacman
int mPosX, mPosY;
//The velocity of the Pacman
int mVelX, mVelY;
friend int Ghost::directChasing();
friend void Ghost::handleEvent();
friend int Ghost::directRunAway();
};
void getPacmanAnimation();
#endif // PACMAN_H