-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimation.cpp
More file actions
259 lines (208 loc) · 7.29 KB
/
Animation.cpp
File metadata and controls
259 lines (208 loc) · 7.29 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#include <windows.h>
#include "icb_gui.h"
int F1, F2;
ICBYTES Background, Buttercup, Blossom, Bubbles, Mojo, Cloud, LightEffect, Explosion, MojoDies, Bushes;
ICBYTES ButtercupRun[18], BlossomRun[18], BubblesRun[18], MojoRun[30], CloudRun[6], ExplosionFrames[6], MojoDiesFrames[3], BushesFrames[4];
void ICGUI_Create() {
ICG_MWSize(1200, 830);
ICG_MWTitle("POWERPUFF GIRLS");
}
void LoadCharacter(ICBYTES& character, ICBYTES characterRun[], int coordinates[][4]) {
for (int i = 0; i < 18; i++) {
Copy(character, coordinates[i][0], coordinates[i][1], coordinates[i][2], coordinates[i][3], characterRun[i]);
}
}
void LoadCloudRun() {
if (!ReadImage("cloud.bmp", Cloud)) {
MessageBox(NULL, "cloud.bmp not found!", "Error", MB_OK);
return;
}
int cloudCoords[6][4] = {
//write coordinates here
};
for (int i = 0; i < 6; i++) {
Copy(Cloud, cloudCoords[i][0], cloudCoords[i][1], cloudCoords[i][2], cloudCoords[i][3], CloudRun[i]);
}
}
void LoadMojoRun() {
if (!ReadImage("mojo.bmp", Mojo)) {
MessageBox(NULL, "mojo.bmp not found!", "Error", MB_OK);
return;
}
int mojoCoords[30][4] = {
//write coordinates here
};
for (int i = 0; i < 30; i++) {
Copy(Mojo, mojoCoords[i][0], mojoCoords[i][1], mojoCoords[i][2], mojoCoords[i][3], MojoRun[i]);
}
if (!ReadImage("mojolost.bmp", MojoDies)) {
MessageBox(NULL, "mojodies.bmp not found!", "Error", MB_OK);
return;
}
int mojoDiesCoords[3][4] = {
//write coordinates here
};
for (int i = 0; i < 3; i++) {
Copy(MojoDies, mojoDiesCoords[i][0], mojoDiesCoords[i][1], mojoDiesCoords[i][2], mojoDiesCoords[i][3], MojoDiesFrames[i]);
}
}
void LoadAgentRun() {
if (!ReadImage("Buttercup182.bmp", Buttercup)) {
MessageBox(NULL, "Buttercup182.bmp not found!", "Error", MB_OK);
return;
}
if (!ReadImage("Blossom182.bmp", Blossom)) {
MessageBox(NULL, "Blossom182.bmp not found!", "Error", MB_OK);
return;
}
if (!ReadImage("Bubbles182.bmp", Bubbles)) {
MessageBox(NULL, "Bubbles182.bmp not found!", "Error", MB_OK);
return;
}
int buttercupCoords[18][4] = {
//write coordinates here
};
int blossomCoords[18][4] = {
//write coordinates here
};
int bubblesCoords[18][4] = {
//write coordinates here
};
LoadCharacter(Buttercup, ButtercupRun, buttercupCoords);
LoadCharacter(Blossom, BlossomRun, blossomCoords);
LoadCharacter(Bubbles, BubblesRun, bubblesCoords);
}
void LoadBushes() {
if (!ReadImage("bushes.bmp", Bushes)) {
MessageBox(NULL, "bushes.bmp not found!", "Error", MB_OK);
return;
}
int bushesCoords[4][4] = {
//write coordinates here
};
for (int i = 0; i < 4; i++) {
Copy(Bushes, bushesCoords[i][0], bushesCoords[i][1], bushesCoords[i][2], bushesCoords[i][3], BushesFrames[i]);
}
}
void LoadExplosion() {
if (!ReadImage("explosion.bmp", Explosion)) {
MessageBox(NULL, "explosion.bmp not found!", "Error", MB_OK);
return;
}
int explosionCoords[6][4] = {
//write coordinates here
};
for (int i = 0; i < 6; i++) {
Copy(Explosion, explosionCoords[i][0], explosionCoords[i][1], explosionCoords[i][2], explosionCoords[i][3], ExplosionFrames[i]);
}
}
void ShowLightEffect() {
if (!ReadImage("girls.bmp", LightEffect)) {
MessageBox(NULL, "girls.bmp not found!", "Error", MB_OK);
return;
}
int startY = 400;
for (int i = 0; i < 20; i++) {
ReadImage("white.bmp", Background);
PasteNon0(LightEffect, 400, startY - i * 10, Background);
DisplayImage(F1, Background);
Sleep(60);
}
}
void AnimateBushes() {
static int bushFrame = 0;
static int bushXOffset = 0;
int bushY = 500;
int bushSpacing = 150;
int numBushes = 6;
bushXOffset = (bushFrame % 2 == 0) ? bushXOffset + 3 : bushXOffset - 3;
for (int i = 0; i < numBushes; i++) {
int bushX = 50 + i * bushSpacing + bushXOffset;
PasteNon0(BushesFrames[bushFrame % 4], bushX, bushY, Background);
}
bushFrame = (bushFrame + 1) % 4;
DisplayImage(F1, Background);
}
void AnimateCloud() {
static int cloudFrame = 0;
static int cloudX = 0;
int cloudY = 50;
ReadImage("white.bmp", Background);
PasteNon0(CloudRun[cloudFrame % 6], cloudX, cloudY, Background);
cloudFrame = (cloudFrame + 1) % 6;
cloudX += 30;
if (cloudX > 1200) {
cloudX = -100;
}
DisplayImage(F1, Background);
}
void ShowMojoDies(int x, int y) {
for (int i = 0; i < 3; i++) {
ReadImage("white.bmp", Background);
AnimateCloud();
AnimateBushes();
PasteNon0(MojoDiesFrames[i], x, y, Background);
DisplayImage(F1, Background);
Sleep(100);
}
}
void ShowExplosion(int x, int y) {
ShowMojoDies(x, y);
for (int i = 0; i < 6; i++) {
ReadImage("white.bmp", Background);
AnimateCloud();
AnimateBushes();
PasteNon0(ExplosionFrames[i], x, y, Background);
DisplayImage(F1, Background);
Sleep(60);
}
}
void AnimateCharacterToMojo(ICBYTES characterRun[], int xStart, int yStart, int mojoX, int mojoY) {
int x = xStart, y = yStart;
int dx = (mojoX - x) / 18, dy = (mojoY - y) / 18;
for (int i = 0; i < 18; i++) {
ReadImage("white.bmp", Background);
AnimateCloud();
AnimateBushes();
PasteNon0(MojoRun[i % 30], mojoX, mojoY, Background);
PasteNon0(characterRun[i], x, y, Background);
DisplayImage(F1, Background);
Sleep(60);
x += dx;
y += dy;
}
for (int i = 0; i < 5; i++) {
ReadImage("white.bmp", Background);
AnimateCloud();
AnimateBushes();
PasteNon0(MojoRun[17 % 30], mojoX, mojoY, Background);
PasteNon0(characterRun[17 - i], x - dx * i, y - dy * i, Background);
DisplayImage(F1, Background);
Sleep(60);
}
}
void PowerpuffAttackMojo() {
int mojoX = 500, mojoY = 200;
int buttercupXStart = 0, buttercupYStart = 300;
int blossomXStart = 0, blossomYStart = 350;
int bubblesXStart = 0, bubblesYStart = 400;
AnimateCharacterToMojo(ButtercupRun, buttercupXStart, buttercupYStart, mojoX, mojoY);
AnimateCharacterToMojo(BlossomRun, blossomXStart, blossomYStart, mojoX, mojoY);
AnimateCharacterToMojo(BubblesRun, bubblesXStart, bubblesYStart, mojoX, mojoY);
ShowExplosion(mojoX, mojoY);
}
void MakePowerpuffMagic() {
PowerpuffAttackMojo();
ShowLightEffect();
}
void ICGUI_main() {
F1 = ICG_FrameThin(5, 140, 450, 430);
LoadAgentRun();
LoadMojoRun();
LoadCloudRun();
LoadExplosion();
LoadBushes();
ICG_Button(400, 5, 160, 55, "Start\n --------------------\n Animation", MakePowerpuffMagic);
ReadImage("white.bmp", Background);
DisplayImage(F1, Background);
}