-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevelOne.pde
71 lines (60 loc) · 2.39 KB
/
LevelOne.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
70
71
class LevelOne extends Level {
LevelOne() {
super();
showHUD = false;
allowItems = false;
dropItems = false;
}
void setupLevel() {
// spawns emus, rain, and decor
for (int i = 0; i < 40; ++i) {
emus.add(new BasicEmu(random(width*.75, width), random(300, height-300), random(0.1, 0.4)));
}
for (int i = 0; i < 600; ++i) {
rains.add(new Rain());
}
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))]));
}
guns.add(new Gun_Lewisgun(75));
for (Gun g : guns) {
g.setAmmo(g.getMaxAmmo());
}
//disables item use, gun use, and movement
allowItems = false;
gunWorking = false;
truckWorking = false;
//sets xpos, ypos, heading, speed, HP, and maxSpeec, and items in inventory
truck.setX(200);
truck.setY(200);
truck.setHeading(PI);
truck.setSpeed(0);
truck.setHP(1);
truck.resetMaxSpeed();
inventory.put("Boomerang", 5);
inventory.put("Vegemite", 3);
inventory.put("Grenade", 10);
inventory.put("Landmine", 10);
inventory.put("Gas", 10);
textScene[0] = "October 30, 1932 \n \n \nMajor G.P.W Meredith,\n \nA herd of 50 emus have been spotted near Campon, Australia. \nWe're assigning Sergeant S. McMurray and Gunner J. O'Hallora to help you deal with them.\n\nYou'll have a pickup truck and a mounted Lewis light machine gun.\n \n \nGood luck,\nPrime Minister Lyons";
endScene[0] = "Operation Update - October 30, 1932 \n \n \nIt began raining as soon as we set out.\nBy the time we made it to the area the emus were spotted, the mud made it impossible to move our truck.\n\nUpon spotting us, the emus scattered.\n\nWe fear that this delay and chance for them to escape will make our objective harder to complete, as the emus are\nnow scattered across multiple areas.\n\n - Major G.P.W Meredith";
}
void update() {
super.update();
if (scene == 1 && !levelEnded) {
if (scene != 0) {
endTimer++;
if (!levelEnded) {
fill(0, endTimer/2);
rect(width/2, height/2, width, height);
}
}
if (endTimer > 600) {
if (getLevelData() < 1) {
setLevelData(1);
}
levelEnded = true;
}
}
}
}