-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenemy.pde
63 lines (62 loc) · 1.28 KB
/
enemy.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 Enemy {
float x, y, z;
float w, h, d;
color col;
boolean life;
BombHandler bomber=new BombHandler();
class BombHandler {
Bomb bombs[]=new Bomb[5];
int time;
boolean timeset=false;
BombHandler() {
for (int i=0; i<bombs.length; i++) {
bombs[i]=new Bomb();
}
}
void makeBomb(float inangle) {
for (int i=0; i<bombs.length; i++) {
if (!bombs[i].seted) {
bombs[i].setBomb(x, y, z, inangle);
break;
}
}
}
void makeBombInTime(float inangle, int timeout) {
int nowTime=millis();
if (!timeset) {
time=nowTime;
timeset=true;
}
if (nowTime - time > timeout && timeset) {
makeBomb(inangle);
timeset=false;
}
}
void handleBombs(Player player, Maze maze) {
for (int i=0; i<bombs.length; i++) {
bombs[i].move(player, maze);
bombs[i].draw();
}
}
};
Enemy(float inx, float iny, float inz, float inw, float inh, float ind, color incol) {
x=inx;
y=iny;
z=inz;
w=inw;
h=inh;
d=ind;
col=incol;
life=true;
}
void draw() {
if (life) {
pushMatrix();
translate(x, y, z);
fill(col);
stroke(0);
box(w, h, d);
popMatrix();
}
}
};