-
Notifications
You must be signed in to change notification settings - Fork 0
/
clevel.cpp
107 lines (83 loc) · 2.19 KB
/
clevel.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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include "clevel.h"
clevel::clevel(int screenW,int screenH,int *tileSize, int *scale)
{
m_screenW=screenW;
m_screenH=screenH;
p_tileSize=tileSize;
p_scale=scale;
s_tile tmp;
for (int x=0; x< (m_screenW / *tileSize) ; x++)
{
tmp.x=x;
tmp.y=0;
tmp.size=*tileSize;
tmp.n=2;
mapLevel.push_back(tmp);
tmp.x=x;
tmp.y=1;
tmp.size=*tileSize;
tmp.n=1;
mapLevel.push_back(tmp);
tmp.x=x;
tmp.y= (m_screenH / *tileSize)-1;
tmp.size=*tileSize;
tmp.n=2;
mapLevel.push_back(tmp);
tmp.x=x;
tmp.y= (m_screenH / *tileSize);
tmp.size=*tileSize;
tmp.n=1;
mapLevel.push_back(tmp);
}
//Spikes
for (int x=((m_screenW / *tileSize)/2)-2; x < ((m_screenW / *tileSize)/2)+2 ; x++)
{
tmp.x=x;
tmp.y=(m_screenH / *tileSize)/2;
tmp.size=*tileSize;
tmp.n=3;
mapLevel.push_back(tmp);
}
for (int y=0; y < (m_screenH / *tileSize)-1 ; y++)
{
tmp.x=0;
tmp.y=y;
tmp.size=*tileSize;
tmp.n=2;
mapLevel.push_back(tmp);
tmp.x= (m_screenW / *tileSize)-1;
tmp.y=y;
tmp.size=*tileSize;
tmp.n=2;
mapLevel.push_back(tmp);
}
//Lava Corners
tmp.x=1;
tmp.y=2;
tmp.n=4;
mapLevel.push_back(tmp);
tmp.x=(m_screenW / *tileSize)-2;
tmp.y=2;
tmp.n=4;
mapLevel.push_back(tmp);
tmp.x=1;
tmp.y=(m_screenH / *tileSize)-2;
tmp.n=4;
mapLevel.push_back(tmp);
tmp.x=(m_screenW / *tileSize)-2;
tmp.y=(m_screenH / *tileSize)-2;
tmp.n=4;
mapLevel.push_back(tmp);
}
int clevel::getX(int n){return mapLevel[n].x;}
int clevel::getY(int n){return mapLevel[n].y;}
bool clevel::getPassable(int n){return mapLevel[n].passable;}
bool clevel::getDangerous(int n){return mapLevel[n].dangerous;}
int clevel::getTile(int n)
{
return mapLevel[n].n;
}
int clevel::getSize()
{
return mapLevel.size();
}