forked from doxman/chamber-crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobject.h
79 lines (66 loc) · 1.04 KB
/
object.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
74
75
76
77
78
79
#ifndef __OBJECT_H__
#define __OBJECT_H__
struct posn
{
int row;
int col;
};
const posn nullPosn = {-1, -1};
const char FLOOR = '.';
// Directions
const int numDirections = 8;
const int NORTH = 0;
const int NORTHWEST = 1;
const int NORTHEAST = 2;
const int WEST = 3;
const int EAST = 4;
const int SOUTHWEST = 5;
const int SOUTHEAST = 6;
const int SOUTH = 7;
// Object characters
const char PLAYER = '@';
const char STAIRS = '\\';
const char POTION = 'P';
const char GOLD = 'G';
const char ENEMY = 'E';
class Object
{
char objectChar;
posn loc;
protected:
void setLoc(posn p);
public:
Object(char oC);
char getObjectChar();
posn getLoc();
void initLoc(posn p); // Only works when loc is the null position; used to initialize posn;
};
class Player:public Object
{
char tileChar;
public:
Player();
char getTileChar();
};
class Stairs:public Object
{
public:
Stairs();
};
class Potion:public Object
{
public:
Potion();
};
class Gold:public Object
{
public:
Gold();
};
class Enemy:public Object
{
public:
Enemy();
void move (int dir);
};
#endif