-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevel.cpp
More file actions
95 lines (77 loc) · 1.84 KB
/
Level.cpp
File metadata and controls
95 lines (77 loc) · 1.84 KB
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
#include "Level.h"
Level::Level(const int screenHeight, const int screenWidth, const std::string& name)
{
BG = new Sprite();
setLevelHeight(0);
setLevelWidth(0);
camera_.w = screenWidth;
camera_.h = screenHeight;
setName(name);
}
//**********************************************************
Level::Level(const std::string& fileName, const int screenHeight, const int screenWidth, const std::string& name)
{
BG = new Sprite(0, 0, fileName);
setLevelHeight(BG->h());
setLevelWidth(BG->w());
camera_.w = screenWidth;
camera_.h = screenHeight;
setName(name);
}
//**********************************************************
Level::~Level()
{
delete BG;
}
//**********************************************************
void Level::addEnemy(int type, int number)
{
}
//**********************************************************
void Level::addPlat(Platform* plat)
{
path_.push_back(plat);
}
void Level::addToon(Toon* tempToon)
{
toons_.push_back(tempToon);
}
//**********************************************************
void Level::setLevelHeight(int height)
{
LEVEL_HEIGHT = height;
}
//**********************************************************
void Level::setLevelWidth(int width)
{
LEVEL_WIDTH = width;
}
//**********************************************************
void Level::setXPos(const int x)
{
BG->setXPos(x);
}
void Level::setPlatX(int plat, int x)
{
path_[plat]->setXPos(x);
}
void Level::setPlatY(int plat, int y)
{
path_[plat]->setYPos(y);
}
//**********************************************************
void Level::setYPos(const int y)
{
BG->setYPos(y);
}
void Level::show(SDL_Surface* screen)
{
BG->show(screen);
std::vector<Platform*>::iterator iter;
iter = path_.begin();
while(iter != path_.end())
{
(*iter)->show(screen);
iter++;
}
}