-
Notifications
You must be signed in to change notification settings - Fork 0
/
animations.pde
97 lines (87 loc) · 2.15 KB
/
animations.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
int fadeSpeed = 15;
int saturation= 200;
int lavaAnimFrames;
int playerAnimFrames;
int endAnimFrames;
PImage Player;
PImage Lava;
PImage endTexture;
void drawDamageEffect(int saturation
)
{
while(saturation > 20)
{
noStroke();
fill(saturation,0,0);
rect(0,0,width,height);
}
saturation =- 10;
}
void lavaAnimation() {
if(lavaAnimFrames < 20) {
Lava = loadImage("Lava1.png");
lavaAnimFrames ++;
} else if (lavaAnimFrames < 40) {
Lava = loadImage("Lava2.png");
lavaAnimFrames ++;
} else if (lavaAnimFrames < 60) {
Lava = loadImage("Lava3.png");
lavaAnimFrames ++;
} else if (lavaAnimFrames < 80) {
Lava = loadImage("Lava4.png");
lavaAnimFrames ++;
} else if (lavaAnimFrames < 100) {
Lava = loadImage("Lava5.png");
lavaAnimFrames ++;
} else {
lavaAnimFrames = 0;
}
}
void playerAnimation() {
if (!collision){
if(playerAnimFrames < 2) {
Player = loadImage("PlayerRun1.png");
playerAnimFrames ++;
} else if(playerAnimFrames < 4) {
Player = loadImage("PlayerRun2.png");
playerAnimFrames ++;
} else if(playerAnimFrames < 6) {
Player = loadImage("PlayerRun3.png");
playerAnimFrames ++;
} else if(playerAnimFrames < 8) {
Player = loadImage("PlayerRun4.png");
playerAnimFrames ++;
} else {
playerAnimFrames = 0;
}
}
}
void endAnimation() {
if(endAnimFrames < 6) {
endTexture = loadImage("End1.png");
endAnimFrames ++;
} else if(endAnimFrames < 12) {
endTexture = loadImage("End2.png");
endAnimFrames ++;
} else if(endAnimFrames < 18) {
endTexture = loadImage("End3.png");
endAnimFrames ++;
} else if(endAnimFrames < 24) {
endTexture = loadImage("End4.png");
endAnimFrames ++;
} else if(endAnimFrames < 30) {
endTexture = loadImage("End5.png");
endAnimFrames ++;
} else if(endAnimFrames < 36) {
endTexture = loadImage("End6.png");
endAnimFrames ++;
} else if(endAnimFrames < 42) {
endTexture = loadImage("End7.png");
endAnimFrames ++;
} else if(endAnimFrames < 48) {
endTexture = loadImage("End8.png");
endAnimFrames ++;
} else {
endAnimFrames = 0;
}
}