-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprintSpaceShip.ino
84 lines (81 loc) · 5.42 KB
/
printSpaceShip.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
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
void printSpaceShip() {
int BoostColor = 0;
int SpaceShip [][SpaceShipW] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 1, 1, 3, 3, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 2, 1, 0, 2, 1, 1, 1, 1, 2, 0, 1, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 2, 0, 0, 2, 1, 1, 1, 1, 2, 0, 0, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 1, 4, 4, 4, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
for (i = 0; i < SpaceShipH; i = i + 1) {
for (j = 0; j < SpaceShipW; j = j + 1) {
if (SpaceShip[i][j] != 0) {
if (SpaceShip[i][j] == 1) {
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(238, 213, 183));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(238, 213, 183));
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(238, 213, 183));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(238, 213, 183));
}
if (SpaceShip[i][j] == 2) {
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(105, 105, 105));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(105, 105, 105));
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(105, 105, 105));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(105, 105, 105));
}
if (SpaceShip[i][j] == 3) {
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(198, 226, 255));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(198, 226, 225));
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(198, 226, 225));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(198, 226, 225));
}
if (SpaceShip[i][j] == 5) {
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, RED);
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, RED);
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, RED);
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, RED);
}
if (SpaceShip[i][j] == 4) {
if (BoostColor < 5) {
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(255, 165, 0));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(255, 165, 0));
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(255, 165, 0));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(255, 165, 0));
}
if (BoostColor > 4) {
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(255, 0, 0));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, M5.Lcd.color565(255, 0, 0));
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(255, 0, 0));
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, M5.Lcd.color565(255, 0, 0));
}
if (BoostColor == 10) {
BoostColor = 0;
}
else {
BoostColor ++;
}
}
}
else {
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, BLACK);
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 - LevelPosPlus, BLACK);
M5.Lcd.drawPixel(PosSpaceShip + j * 2, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, BLACK);
M5.Lcd.drawPixel(PosSpaceShip + j * 2 + 1, TFTH - SpaceShipH * 2 + i * 2 + 1 - LevelPosPlus, BLACK);
}
}
}
}