-
Notifications
You must be signed in to change notification settings - Fork 0
/
tile.h
58 lines (45 loc) · 1.29 KB
/
tile.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
#ifndef TILE_H
#define TILE_H
#include "qvectornd.h"
#include "vec.h"
enum TileColor{ Red, Blue, Green, Purple };
class Tile
{
protected:
// solid means you can't walk through it
bool solid;
// destructible means it can be blown up
bool breakable;
TileColor tc;
// since tiles will be squares on a grid, each will be the same size, so we can just
// store their side length as a static member of the class
float sideLength;
public:
Tile();
Tile(bool solid, bool breakable, float sideLength); // only meant to be used for tiles drawing it
Tile(TileColor, bool solid, bool breakable, float sideLength);
bool isSolid();
bool isBreakable();
virtual void draw(float y, float x);
void setSideLength(float);
float getSideLength();
void Explode(float x, float y, int strength);
};
class Breakable: public Tile {
public:
Breakable(float sideLength);
virtual void draw(float y, float x);
};
class Invincible: public Tile {
public:
Invincible(float sideLength);
virtual void draw(float y, float x);
};
enum Junction { open, closed };
class Floor: public Tile {
Junction left, right, up, down;
public:
Floor(float sideLength, Junction, Junction, Junction, Junction);
virtual void draw(float y, float x);
};
#endif // TILE_H