-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enemy.h
39 lines (34 loc) · 901 Bytes
/
Enemy.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
#include <iostream>
using namespace std;
class Enemy{
public:
int row;
int col;
static const int ENEMY_RANGE = 2;
int hp;
string name;
enum enemyDir{
DIR_UP,
DIR_DOWN,
DIR_LEFT,
DIR_RIGHT
};
Enemy(int r, int c, int h) : row(r), col(c), hp(h), name("Enemy"){}
Enemy(int r, int c, int h, string n) : row(r), col(c), hp(h), name(n) {}
void moveEnemy(enemyDir dir){
switch(dir){
case DIR_UP :
row--;
break;
case DIR_DOWN :
row++;
break;
case DIR_LEFT :
col--;
break;
case DIR_RIGHT :
col++;
break;
}
}
};