-
Notifications
You must be signed in to change notification settings - Fork 0
/
Level.pde
69 lines (65 loc) · 1.28 KB
/
Level.pde
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
class Level
{
float level;
float toPass;
boolean finishedLevel;
float amount;
float aliveZombies;
float elapsed;
boolean finishedLevelSpawn;
int levelCounter;
boolean nukeAwarded;
Level()
{
finishedLevel = false;
nukeAwarded = false;
level = 1;
amount = 5;
this.aliveZombies = 0;
this.finishedLevelSpawn = false;
this.levelCounter = 1;
}
void start()
{
if(finishedLevel == false)
{
println("Start");
aliveZombies = amount;
for(int i = 0; i<amount; i++)
{
println("Zombies");
Zombie z = new Zombie(random(width/2-400, width/2+400), height-50, level);
gameObjects.add(z);
}
finishedLevel = true;
}
check();
textSize(30);
fill(255, 0, 0);
text("Level: "+levelCounter, width/2-620, height-75);
if(levelCounter % 4 == 0 && nuke.used == false)
{
nuke.render();
}
}
void check()
{
if(aliveZombies == 0)
{
elapsed += timeDelta;
if(elapsed > 6)
{
finishedLevel = false;
level += 0.1;
amount += 3;
finishedLevelSpawn = true;
levelCounter++;
}
if(finishedLevelSpawn == true)
{
elapsed = 0;
finishedLevelSpawn = false;
}
}
}
}