-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map.h
84 lines (67 loc) · 2.13 KB
/
Map.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
80
81
82
83
84
#pragma once
#include <vector>
#include "Texture.h"
#include "Monster.h"
class Map {
public:
// constructor
// int level means the stage of map
Map(int level);
// draw pixel image of map according to the stage
void drawMap(vector<Monster>& monsters, bool& clear, bool gamestart);
void drawStage(int level);
void drawBackground();
void changeMap(vector<Monster>& monsters, bool& clear);
void setMonsters(vector<Monster>& monsters);
void drawScoreBoard();
/* drawBlock draws block on which player's state will be STAY from FALL
drawHard draws hard block which player can't pass
setBorder stores block information in border
setHard stores hard block information in borderHard and block information in border
*/
void drawBlock(float x, float y, float width, float height);
void drawHard(float x, float y, float width, float height);
void setBorder(float x, float y, float width);
void setHard(float x, float y, float width, float height);
// stages' pixel image setting
void drawStage0();
void drawStage1();
void drawStage2();
void drawStage3();
void drawStage4();
// check whether player's movement is allowed or not
bool checkFALL();
void checkJUMP();
void checkLEFT();
void checkRIGHT();
// restrict monster's movement range
bool checkMonster(Monster& monster);
// getter
vector<vector<float>> getBorderHard () const;
vector<vector<float>> getBorder() const;
float getTime () const;
int getLevel() const;
// check whether the map is moving
bool isMoving();
// reset stage number
void resetStage();
// detects whether it is final stage or not.
bool isFinalStage();
private:
// stage means the stage level
int stage;
// true if the map has been drawn
bool drawn;
// time consumed moving motion
float time;
// true if the map is moving
bool moving;
// border has information of map's layers on which player's state will be STAY from FALL
vector<vector<float>> border;
// borderHard has information of map's layers which player can't pass
vector<vector<float>> borderHard;
// textures information used in map design
vector<Texture> textures;
// Number of total stages;
int maxLevel = 4;
};