-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevelMinigun.pde
63 lines (56 loc) · 1.7 KB
/
LevelMinigun.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
class LevelMinigun extends Level {
LevelMinigun() {
super();
dropItems = true;
}
void setupLevel() {
backgroundColour = color(214, 154, 0);
showHUD = true;
allowItems = true;
for (int i = 0; i < 125; ++i) {
emus.add(new StaticEmu(random(width*.75, width), random(300, height-300), random(0.1, 0.4)));
}
guns.add(new Gun_Minigun(2500));
for (Gun g : guns) {
g.setAmmo(g.getMaxAmmo());
}
for (int i = 0; i < 30; i++) {
decorations.add(new Decor(int(random(0, width)), int(random(0, height)), random(0.2, 0.4), false, bushImages[floor(random(0, bushImages.length))]));
}
gunWorking = true;
//sets xpos, ypos, heading, speed, HP, and maxSpeec, and items in inventory, as well as music
truck.setX(200);
truck.setY(200);
truck.setHeading(PI);
truck.setSpeed(0);
truck.setHP(1);
truck.resetMaxSpeed();
inventory.put("Boomerang", 0);
inventory.put("Vegemite", 0);
inventory.put("Grenade", 0);
inventory.put("Landmine", 0);
inventory.put("Gas", 0);
music1.rewind();
music1.loop(5);
scene = 4;
}
void clearLevel() {
TableRow scoreRow = scores.addRow();
scoreRow.setString("name", "test");
scoreRow.setInt("score", emusKilled);
scoreRow.setString("date", date);
saveTable(scores, "data/scores.csv");
super.clearLevel();
}
void update() {
track = true;
super.update();
if (emusAlive() < 100) {
if (truck.getX() < width/2) {
emus.add(new StaticEmu(random(width*.75, width), random(300, height-300), random(0.1, 0.4)));
} else {
emus.add(new StaticEmu(random(0, width*.25), random(300, height-300), random(0.1, 0.4)));
}
}
}
}