-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfireworks.h
More file actions
52 lines (45 loc) · 1.24 KB
/
fireworks.h
File metadata and controls
52 lines (45 loc) · 1.24 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
char fireworks[] = "\\|/";
int startFirework(int lines, int cols){
int pozY, pozX;
pozY = lines;
pozX = rand() % cols;
mvprintw(pozY - 1, pozX, "%c", fireworks[1]);
refresh();
return pozX;
}
int moveFirework(int pozY, int pozX){
int nextPozX = rand() % 3;
pozX = pozX + nextPozX - 1;
while (pozX < 0) {
pozX++;
}
mvprintw(pozY - 1, pozX, "%c", fireworks[nextPozX]);
refresh();
return pozX;
}
void explodeFirework1(int pozY, int pozX){
mvprintw(pozY, pozX, "0");
refresh();
}
void explodeFirework2a(int pozY, int pozX){
mvprintw(pozY - 1, pozX - 1, "\\");
mvprintw(pozY - 1, pozX, "|");
mvprintw(pozY - 1, pozX + 1, "/");
mvprintw(pozY, pozX - 2, "--");
mvprintw(pozY, pozX + 1, "--");
mvprintw(pozY + 1, pozX - 1, "/");
mvprintw(pozY + 1, pozX, "|");
mvprintw(pozY + 1, pozX + 1, "\\");
refresh();
}
void explodeFirework3a(int pozY, int pozX){
mvprintw(pozY - 2, pozX - 2, "\\");
mvprintw(pozY - 2, pozX, "|");
mvprintw(pozY - 2, pozX + 2, "/");
mvprintw(pozY, pozX - 3, "--");
mvprintw(pozY, pozX + 2, "--");
mvprintw(pozY + 2, pozX - 2, "/");
mvprintw(pozY + 2, pozX, "|");
mvprintw(pozY + 2, pozX + 2, "\\");
refresh();
}