-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacman.h
47 lines (37 loc) · 1.34 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
#pragma once
#include <iostream>
#include "board.h"
#include "Creature.h"
using std::cout;
class pacMan : public Creature
{
public:
//-------------------------------------Consts--------------------------------------------------------//
static const char KEYS[];
static constexpr char representativeCh = '@';
private:
//-----------------------------------------Data Members----------------------------------------------//
char keys[SIZE];
int lives;
int score;
public:
//-----------------------------------Public Member Functions-----------------------------------------//
pacMan(Colors _color = Colors::BROWN, int _x = -1, int _y = -1) :
Creature(_color, representativeCh, _x, _y), lives(3), score(0)
{
for (int dir = 0; dir < SIZE; dir++)
{
keys[dir] = KEYS[dir];
}
}
void lostLife();
void init(bool start_screen, bool start_game);
void move(Board& board);
bool isValidMovePacman(Board& board, const Point& p);
//--------------------------------------Get Functions------------------------------------------------//
int getRemainLives()const { return lives; }
int getScore() const { return score; }
//--------------------------------------Set Functions-----------------------------------------------//
void setDirection(char ch);
void setScore(int _score) { score = _score; }
};