-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnemy.pde
49 lines (47 loc) · 1.34 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
class Enemy extends Player {
int kind, killTime;
PImage [] eneL = new PImage[4];
PImage [] eneR = new PImage[4];
Enemy(int posX, int posY, int size, int n, int _kind) {
super(posX, posY, size, n);
kind = _kind;
speedX = 1;
if (kind==0) {
PImage _eneL = loadImage("walkEneL.png");
PImage _eneR = loadImage("walkEneR.png");
for (int i=0; i<3; i++) {
eneL[i] = _eneL.get(16*i, 0, 16, 16);
eneR[i] = _eneR.get(16*i, 0, 16, 16);
}
eneL[3] = eneL[1];
eneR[3] = eneR[1];
dead = loadImage("walkEneDead.png");
} else {
for (int i=0; i<3; i++) {
eneL[i] = loadImage("ghostL.png");
eneR[i] = loadImage("ghostR.png");
}
eneL[3] = loadImage("ghostL2.png");
eneR[3] = loadImage("ghostR2.png");
dead = loadImage("ghostDead.png");
}
isFacingRight = false; //あそぶモードでは全部左向きのため
}
void draw() {
if (!alive) {
image(dead, posX, posY, size, size);
} else if (touch==true) {
if (isFacingRight) {
image(eneR[time%4], posX, posY, size, size);
} else {
image(eneL[time%4], posX, posY, size, size);
}
} else {
if (isFacingRight) {
image(eneR[1], posX, posY, size, size);
} else {
image(eneL[1], posX, posY, size, size);
}
}
}
}