| Line 16... |
Line 16... |
| 16 |
|
16 |
|
| 17 |
Cube_Clear();
|
17 |
Cube_Clear();
|
| 18 |
Cube_Overlay_Clear();
|
18 |
Cube_Overlay_Clear();
|
| 19 |
|
19 |
|
| 20 |
// Draw player 1 light trail
|
20 |
// Draw player 1 light trail
|
| 21 |
uint32_t index = 0;
|
21 |
uint32_t index;
|
| 22 |
Cube_Set_Pixel(data_p->p1_body[index].z, data_p->p1_body[index].x, data_p->p1_body[index].y, TRON_PLAYER_1_HEAD);
|
- |
|
| 23 |
for (index = 1; index < data_p->length; index++) {
|
22 |
for (index = 0; index < data_p->length - 1; index++) {
|
| 24 |
Cube_Set_Pixel(data_p->p1_body[index].z, data_p->p1_body[index].x, data_p->p1_body[index].y, TRON_PLAYER_1_COLOR);
|
23 |
Cube_Set_Pixel(data_p->p1_body[index].z, data_p->p1_body[index].x, data_p->p1_body[index].y, TRON_PLAYER_1_COLOR);
|
| 25 |
}
|
24 |
}
|
| - |
|
25 |
Cube_Set_Pixel(data_p->p1_body[data_p->length-1].z, data_p->p1_body[data_p->length-1].x, data_p->p1_body[data_p->length-1].y, TRON_PLAYER_1_HEAD);
|
| 26 |
|
26 |
|
| 27 |
// Draw player 2 light trail
|
27 |
// Draw player 2 light trail
|
| 28 |
index = 0;
|
- |
|
| 29 |
Cube_Set_Pixel(data_p->p2_body[index].z, data_p->p2_body[index].x, data_p->p2_body[index].y, TRON_PLAYER_2_HEAD);
|
- |
|
| 30 |
for (index = 1; index < data_p->length; index++) {
|
28 |
for (index = 0; index < data_p->length - 1; index++) {
|
| 31 |
Cube_Set_Pixel(data_p->p2_body[index].z, data_p->p2_body[index].x, data_p->p2_body[index].y, TRON_PLAYER_2_COLOR);
|
29 |
Cube_Set_Pixel(data_p->p2_body[index].z, data_p->p2_body[index].x, data_p->p2_body[index].y, TRON_PLAYER_2_COLOR);
|
| 32 |
}
|
30 |
}
|
| - |
|
31 |
Cube_Set_Pixel(data_p->p2_body[data_p->length-1].z, data_p->p2_body[data_p->length-1].x, data_p->p2_body[data_p->length-1].y, TRON_PLAYER_2_HEAD);
|
| 33 |
}
|
32 |
}
|
| 34 |
|
33 |
|
| 35 |
void Tron_Main(void) {
|
34 |
void Tron_Main(void) {
|
| 36 |
// Main function, loops and delays while updating the frame every x milliseconds
|
35 |
// Main function, loops and delays while updating the frame every x milliseconds
|
| 37 |
Tron_Update_Direction(0x04,0x04);
|
36 |
Tron_Update_Direction(0x04,0x04);
|
| Line 127... |
Line 126... |
| 127 |
data_p->p1_body[data_p->length - 1] = data_p->p1_direction;
|
126 |
data_p->p1_body[data_p->length - 1] = data_p->p1_direction;
|
| 128 |
data_p->p2_body[data_p->length - 1] = data_p->p2_direction;
|
127 |
data_p->p2_body[data_p->length - 1] = data_p->p2_direction;
|
| 129 |
|
128 |
|
| 130 |
Cube_Clear();
|
129 |
Cube_Clear();
|
| 131 |
// Draw player 1 light trail
|
130 |
// Draw player 1 light trail
|
| 132 |
index = 0;
|
- |
|
| 133 |
Cube_Set_Pixel(data_p->p1_body[index].z, data_p->p1_body[index].x, data_p->p1_body[index].y, TRON_PLAYER_1_HEAD);
|
- |
|
| 134 |
for (index = 1; index < data_p->length; index++) {
|
131 |
for (index = 0; index < data_p->length - 1; index++) {
|
| 135 |
Cube_Set_Pixel(data_p->p1_body[index].z, data_p->p1_body[index].x, data_p->p1_body[index].y, TRON_PLAYER_1_COLOR);
|
132 |
Cube_Set_Pixel(data_p->p1_body[index].z, data_p->p1_body[index].x, data_p->p1_body[index].y, TRON_PLAYER_1_COLOR);
|
| 136 |
}
|
133 |
}
|
| - |
|
134 |
Cube_Set_Pixel(data_p->p1_body[data_p->length-1].z, data_p->p1_body[data_p->length-1].x, data_p->p1_body[data_p->length-1].y, TRON_PLAYER_1_HEAD);
|
| 137 |
|
135 |
|
| 138 |
// Draw player 2 light trail
|
136 |
// Draw player 2 light trail
|
| 139 |
index = 0;
|
- |
|
| 140 |
Cube_Set_Pixel(data_p->p2_body[index].z, data_p->p2_body[index].x, data_p->p2_body[index].y, TRON_PLAYER_2_HEAD);
|
- |
|
| 141 |
for (index = 1; index < data_p->length; index++) {
|
137 |
for (index = 0; index < data_p->length - 1; index++) {
|
| 142 |
Cube_Set_Pixel(data_p->p2_body[index].z, data_p->p2_body[index].x, data_p->p2_body[index].y, TRON_PLAYER_2_COLOR);
|
138 |
Cube_Set_Pixel(data_p->p2_body[index].z, data_p->p2_body[index].x, data_p->p2_body[index].y, TRON_PLAYER_2_COLOR);
|
| 143 |
}
|
139 |
}
|
| - |
|
140 |
Cube_Set_Pixel(data_p->p2_body[data_p->length-1].z, data_p->p2_body[data_p->length-1].x, data_p->p2_body[data_p->length-1].y, TRON_PLAYER_2_HEAD);
|
| 144 |
|
141 |
|
| 145 |
// Indicate the point of collision and reset to idle mode
|
142 |
// Indicate the point of collision and reset to idle mode
|
| 146 |
if (p1_collision || p2_collision) {
|
143 |
if (p1_collision || p2_collision) {
|
| 147 |
uint32_t ind = data_p->length - 1;
|
144 |
uint32_t ind = data_p->length - 1;
|
| 148 |
if (p1_collision)
|
145 |
if (p1_collision)
|