-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPacman.cpp
36 lines (30 loc) · 1010 Bytes
/
Pacman.cpp
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
#include "Pacman.h"
/*------------------------------------------------------------------------------------------------------------------------------------------------------------*/
//This method moves the pacman.
void Pacman::moveMovingObj(char ch)
{
body.draw(ch);
body.move(direction, true);
drawMovingObj();
}
/*------------------------------------------------------------------------------------------------------------------------------------------------------------*/
//This method reurns the direction that the user's key represents.
int Pacman::getDirection(char key) const
{
int i;
for (i = 0; i < keyBoardSize; i++)
{
if (key == arrowKeys[i] || key == arrowKeys[i] - 32)
return i;
}
return -1;
}
/*------------------------------------------------------------------------------------------------------------------------------------------------------------*/
void Pacman::setDirection(const int& dir)
{
direction = dir;
}
void Pacman::updateEyes(int dir)
{
Eyes.move(dir, true);
}