-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameMode.pde
147 lines (125 loc) · 3.27 KB
/
GameMode.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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
class GameMode
{
// SCREEN-CODE(2)
// FIELDS:
void basicRender() {
surface.setTitle("IRON MAN: THE GAME > GAMEPLAY");
background(255);
image(bg1, 0, 0);
ironman.update();
hud.render();
for (int i = 0; i < healthBump.size(); i++)
{
Perks moreHealth = healthBump.get(i);
noStroke();
moreHealth.healthUp();
moreHealth.checkHealthCollision();
}
for (int i = 0; i < repulsorCharge.size(); i++)
{
Perks moreBullets = repulsorCharge.get(i);
noStroke();
moreBullets.repulsorIncrease();
moreBullets.checkRepulsorCollision();
}
for (int i = 0; i < alien.size(); i++)
{
BasicEnemy enemy = alien.get(i);
enemy.update();
if (deathCount >= 10) {
enemy.vel.x = 6;
achievementState = false;
}
if (deathCount == 9) {
screen = ACHIEVEMENT;
achievementState = true;
} else {
achievementState = false;
}
}
if (alien.size() <= 2) {
alien.add(new BasicEnemy(new PVector(random(width, width + 1000), random(500))));
}
if (healthBump.size() <= 0) {
healthBump.add(new Perks(new PVector(random(100, width), -1000), new PVector(0, random(0.9, 2))));
}
if (repulsorCharge.size() <= 0)
{
repulsorCharge.add(new Perks(new PVector(random(300, 1000), random(-300, -500)), new PVector(0, random(1, 2))));
}
if (deathCount >= 20)
{
screen = BOSS_CUT_SCENE;
}
}
void bossRender()
{
background(255);
image(bg2, 0, 0);
surface.setTitle("GAME" + "X " + mouseX + " Y " + mouseY);
loki.update();
ironman.update();
hud.render();
for (int i = 0; i < healthBump.size(); i++)
{
Perks moreHealth = healthBump.get(i);
noStroke();
moreHealth.healthUp();
moreHealth.checkHealthCollision();
}
for (int i = 0; i < repulsorCharge.size(); i++)
{
Perks moreBullets = repulsorCharge.get(i);
noStroke();
moreBullets.repulsorIncrease();
moreBullets.checkRepulsorCollision();
}
if (repulsorCharge.size() <= 0)
{
repulsorCharge.add(new Perks(new PVector(random(100, width), -500), new PVector(0, random(1, 2))));
}
if (healthBump.size() <= 0)
{
healthBump.add(new Perks(new PVector(random(100, width), -1000), new PVector(0, random(0.9, 2))));
}
}
void pauseGame()
{
noLoop();
gameState = false;
pushMatrix();
fill(0, 0, 0, 90);
noStroke();
rect(0, 0, 1280 * 2, 720 * 2);
fill(246, 9, 81);
translate(width / 2 - 100, height / 2);
text(" GAME PAUSED ", 0, 0);
textFont(hudFont);
textSize(24);
text("Press 'R' to resume", -50, 70);
popMatrix();
}
void restartGame() {
screen = GAME;
deathCount = 0;
hudDead = 0;
for (int i = 0; i < alien.size(); i++)
{
BasicEnemy enemy = alien.get(i);
enemy.pos.x = -500;
}
ironman.health = 200;
hud.bulletBar = 200;
bulletCount = 5;
for (int i = 0; i < healthBump.size(); i++)
{
Perks moreHealth = healthBump.get(i);
moreHealth.pos.y = -100;
}
for (int i = 0; i < repulsorCharge.size(); i++)
{
Perks moreBullets = repulsorCharge.get(i);
moreBullets.pos.y = height + 100;
}
}
} // class end