-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZombieManager.cpp
More file actions
99 lines (78 loc) · 2.6 KB
/
ZombieManager.cpp
File metadata and controls
99 lines (78 loc) · 2.6 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
96
97
98
#include "ZombieManager.h"
ZombieManager::ZombieManager(){
};
ZombieManager::~ZombieManager(){
};
//***********************************************
// OTHER FUNCTIONS
//***********************************************
void ZombieManager::update(double playerX, double playerY){
for(int i = 0; i < zombiesRapidosArray.size(); i++){
zombiesRapidosArray[i]->update(playerX+5,playerY+5);
if((zombiesRapidosArray[i])->isWasted()){
delete zombiesRapidosArray[i];
zombiesRapidosArray.erase(zombiesRapidosArray.begin() + i);
i--;
}
}
};
void ZombieManager::drawShadows() const{
for(int i = 0; i < zombiesRapidosArray.size(); i++){zombiesRapidosArray[i]->drawShadow();}
};
void ZombieManager::draw() const{
for(int i = 0; i < zombiesRapidosArray.size(); i++){zombiesRapidosArray[i]->draw();}
};
void ZombieManager::addZombie(){
//RANDOMLY DECIDES IF THE ZOMBIE WILL APPEAR FROM TOP, LEFT, BOTTOM OF RIGHT
int x = 0;
int y = 0;
int zone = rand() % 4; // 0 = arriba, 1 = derecha, 2 = abajo, 3 = izquierda
switch(zone){
case 0:
y = rand()%50 - 100;
x = rand()%600;
break;
case 1:
x = 800 + rand()%50 + 100;
y = rand()%800;
break;
case 2:
y = 600 + rand()%50 + 100;;
x = rand()%800;
break;
case 3:
x = rand()%50 - 100;
y = rand()%600;
break;
}
//CREATES THE ZOMBIE
ZombieRapido *newZombieRapido = new ZombieRapido(x,y);
zombiesRapidosArray.push_back(newZombieRapido);
};
void ZombieManager::addZombie(int x, int y){ //ADS RAMDON ZOMBIE ON LOCATION
//CREATES THE ZOMBIE
ZombieRapido *newZombie = new ZombieRapido(x,y);
zombiesRapidosArray.push_back(newZombie);
};
void ZombieManager::addZombie(int x, int y, int type){ //ADS EXPLICIT ZOMBIE ON LOCATION
};
void ZombieManager::addZombies(int new_zombies){ //ADS SOME RANDOM ZOMBIES
for(int i = 0; i < new_zombies; i++){
addZombie();
}
};
void ZombieManager::addZombies(int cantZombies, int tipo){ //ADDS SOME EXPLICIT TYPE ZOMBIE
};
//void ZombieManager::killAll()(
//);
void ZombieManager::freeze() const{
};
//***********************************************
// GETTERS/SETTERS
//***********************************************
int ZombieManager::getZombieCount() const{
return zombiesRapidosArray.size(); // + zombiesT2Array.size() + ... etc
};
std::vector<ZombieRapido*> ZombieManager::getZombiesList(int type) const{
return zombiesRapidosArray;
};