-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasicEmu.pde
32 lines (28 loc) · 882 Bytes
/
BasicEmu.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
// For documentation, see Emu class.
class BasicEmu extends Emu {
PImage runPhotos[] = new PImage[34];
PImage runPhotosF[] = new PImage[34];
BasicEmu(float x, float y, float size) {
super(x, y, size);
for (int i = 1; i < runPhotos.length; i++) {
runPhotos[i] = emuRun[i].copy();
runPhotos[i].resize((int) (mySize*400), (int) (mySize*406));
}
for (int i = 1; i < runPhotosF.length; i++) {
runPhotosF[i] = emuRunFlip[i].copy();
runPhotosF[i].resize((int) (mySize*400), (int) (mySize*406));
}
}
void update() {
super.update();
if (frameNum > runPhotos.length - 1) {
frameNum = 1;
}
// animates the emu by running through the running or flipped running photos.
if (xVelocity() > 0) {
image(runPhotosF[frameNum], myX, myY);
} else {
image(runPhotos[frameNum], myX, myY);
}
}
}