-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStarship.ino
50 lines (44 loc) · 1.35 KB
/
Starship.ino
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
void explodingCircle (int x, int y, int r, uint16_t color, bool fill) {
matrix.drawCircle(x, y, r, color);
if (fill) {
matrix.fillCircle(x, y, r, color);
}
updateScreen();
delay(200);
for (int i = 0; i < 0.5 * r; i++) {
matrix.clear();
for (int i = 0; i < 0.5 * r; i++) {
matrix.drawPixel(random(x + i, x + i + 2), random(y + i, y + 1 + 2), color);
}
updateScreen();
delay(30);
}
}
void drawShipTL (int x, int y, float s, uint16_t color, bool Show) {
// Left side
matrix.drawLine(x, y, round(x + s), y, color);
// long
matrix.drawLine(x, y, x, round(y + (4 * s)), color);
matrix.drawLine(x, round(y + (4 * s)), round(x + s), round(y + (4 * s)), color);
// Middle
int rX = x + (9 * s);
int rY = round(y + round((4 * s) / 2.0));
// int mY = round(y / 2.0);
matrix.drawLine(x, rY, rX, rY, color);
matrix.fillCircle((round((rX - x) / 2.0) + x), rY, (s * 2), color);
// Right side
// long
matrix.drawLine(rX, y, rX, round(y + (4 * s)), color);
matrix.drawLine(rX, y, rX - s, y, color);
matrix.drawLine(rX, round(y + (4 * s)), rX - s, round(y + (4 * s)), color);
if (Show) {
updateScreen();
}
}
void drawShip (int x, int y, float s, uint16_t color, bool Show) {
int X = x;
int Y = y;
X -= round(4.5 * s);
Y -= round((round(y + (4 * s)) - y) / 2.0);
drawShipTL (X, Y, s, color, Show);
}