-
Notifications
You must be signed in to change notification settings - Fork 0
/
Creature.cpp
42 lines (36 loc) · 1.1 KB
/
Creature.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
36
37
38
39
40
41
42
#include "Creature.h"
//-----------------------------------------------------------------------------------------------//
const Point Creature::directions[SIZE] = { {-1,0}, {1,0}, {0,-1} ,{0,1}, {0,0}};
const vector<string> Creature::dirStr = { "LEFT", "RIGHT", "UP", "DOWN", "STAY" };
//-----------------------------------------------------------------------------------------------//
void Creature::print(bool gameColor) const
{
gotoxy(curr.get_X(), curr.get_Y());
if (gameColor)
{
setTextColor(color);
}
cout << representativeCh;
}
//-----------------------------------------------------------------------------------------------//
void Creature::init(bool start)
{
direction = directions[STAY];
//
if (start)
{
last = initP;
}
else
{
last = curr;
}
curr = initP;
}
//-----------------------------------------------------------------------------------------------//
void Creature::move(const Point& nextStep)
{
setLast(getCurr());
setCurr(nextStep);
}
//-----------------------------------------------------------------------------------------------//