-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGun_M60.pde
37 lines (36 loc) · 816 Bytes
/
Gun_M60.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
final class Gun_M60 extends Gun {
Gun_M60(int maxAmmo) {
super();
myMaxAmmo = maxAmmo;
myAmmo = myMaxAmmo;
myRateOfFire = 6;
myDamage = 10;
gunImage = M60.copy();
numShots = 1;
}
void reload() {
if (!reloading) {
myAmmo = 0;
reloading = true;
}
if (reloading) {
if (myAmmo < myMaxAmmo) {
if (frameCount%1 == 0) {
myAmmo++;
}
// Draws the green rectangle to show visual reloading progress.
pushMatrix();
fill(255, 255, 0);
rectMode(CORNER);
rect(myX - 50, myY+ 20, 100*(myAmmo/myMaxAmmo), 10);
rectMode(CENTER);
fill(0);
textAlign(CENTER);
text("RELOADING", myX, myY+30);
popMatrix();
} else {
reloading = false;
}
}
}
}