-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animate.h
90 lines (69 loc) · 1.94 KB
/
Animate.h
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
#ifndef PARACHUTE_ANIMATE
#define PARACHUTE_ANIMATE
#include "Global.h"
void animateShark() {
if (moveTick > 0)
return;
if ((sharkAnimation > -2) || ((sharkAnimation == -2) && (random(0, 50) < 3))) {
++sharkAnimation;
if (sharkAnimation > -1)
gb.sound.playTick();
}
if (sharkAnimation > 4) {
sharkAnimation = -2;
if (floodedAnimation > 4)
floodedAnimation = -2;
}
}
void animateHelicopter() {
if (helicopterAnimation > 2)
helicopterAnimation = -1;
++helicopterAnimation;
}
void animateFlooded() {
if ((moveTick <= 0) && (floodedAnimation < 6))
++floodedAnimation;
}
void testBoat(uint8_t column, uint8_t currentParachute) {
// Test if boat is under the paratrooper => score or tansform the para as swimmer ...
for (size_t count = currentParachute; count < parachuteLaunchCount; ++count) {
parachutes[count] = parachutes[count + 1];
parachuteLaunchCount--;
}
if (column == (player.spriteIndex + 1)) {
++score;
gb.sound.playOK();
} else {
++misses;
gb.sound.playCancel();
floodedAnimation = (2 - column);
sharkAnimation = (2 - column);
}
}
void animateParatrooper() {
if (moveTick > 0)
return;
for (size_t count = 0; count < parachuteLaunchCount; ++count) {
uint8_t parachute = parachutes[count];
if (parachute > -1) {
if (parachute == (firstSpriteColumn[1] - 1))
{
testBoat(1, count); // Test if paratrooper is at last step of colonne 0
}
else if (parachute == (firstSpriteColumn[2] - 1))
{
testBoat(2, count); // Test if paratrooper is at last step of colonne 1
}
else if (parachute == firstSpriteColumn[3])
{
testBoat(3, count); // Test if paratrooper is at last step of colonne 2
}
else if (parachute < firstSpriteColumn[3])
{
++parachutes[count]; // Next step for paratrooper fall
gb.sound.playTick();
}
}
}
}
#endif