Skip to content
Snippets Groups Projects
Commit ab69cf8a authored by Malte Schmitz's avatar Malte Schmitz
Browse files

Show points with spaces in between

parent d9baff01
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ void handleInternalWinAnimation();
Task taskInternalWinAnimation(8, 2000, &handleInternalWinAnimation);
void handleBlinkPoint();
// blink point task starts the screensaver when done
Task taskBlinkPoint(333, 30*3, &handleBlinkPoint);
Task taskBlinkPoint(333, 60*3, &handleBlinkPoint);
void handleScreensaver();
Task taskScreensaver(TASK_IMMEDIATE, TASK_FOREVER, &handleScreensaver);
......@@ -101,16 +101,23 @@ int state = STATE_PAUSE;
void show() {
pixels.clear();
if (state == STATE_PAUSE) {
for (int i = 0; i < greenLength; i++) {
pixels.setPixelColor(i, 0x00FF00);
}
if (singlePlayer) {
for (int i = NEOPIXEL_LEN / 2; i < NEOPIXEL_LEN; i++) {
pixels.setPixelColor(i, 0x0000FF);
}
} else {
for (int i = NEOPIXEL_LEN - greenLength - 1; i < NEOPIXEL_LEN; i++) {
pixels.setPixelColor(i, 0x00FF00);
}
int points = pointsInternal;
if (lastPointInternal && hideLastPoint) {
points = max(0, points - 1);
}
for (int i = 0; i < points; i++) {
for (int i = greenLength + 1; i < greenLength + 1 + 2 * points; i += 2) {
pixels.setPixelColor(i, 0xFFFF00);
}
......@@ -118,7 +125,7 @@ void show() {
if (!lastPointInternal && hideLastPoint) {
points = max(0, points - 1);
}
for (int i = NEOPIXEL_LEN - 1 - points; i < NEOPIXEL_LEN; i++) {
for (int i = NEOPIXEL_LEN - 1 - greenLength - 2 * points; i < NEOPIXEL_LEN - 1 - greenLength; i += 2) {
pixels.setPixelColor(i, 0xFFFF00);
}
}
......@@ -250,7 +257,7 @@ void externalMissed() {
void internalMissed() {
state = STATE_MISSED;
taskBlinkPoint.abort();
if (!singlePlayer) {
if (singlePlayer) {
pointsExternal = 0;
pointsInternal = 0;
lastPointInternal = false;
......@@ -350,7 +357,7 @@ void handleWinAnimation(bool external) {
if (untilSpawn <= 0 && random(10) == 0) {
for (int i = 0; i < NUM_WIN_POSITIONS; i++) {
if (winPositions[i] == -1) {
winPositions[i] = 7;
winPositions[i] = 0;
winLengths[i] = 0;
winColors[i] = colors[random(NUM_COLORS)];
break;
......@@ -374,10 +381,10 @@ void handleWinAnimation(bool external) {
}
}
// show points
for (int i = 0; i < pointsInternal; i++) {
for (int i = 0; i < 2 * pointsInternal; i += 2) {
pixels.setPixelColor(i, 0xFFFF00);
}
for (int i = NEOPIXEL_LEN - 1 - pointsExternal; i < NEOPIXEL_LEN; i++) {
for (int i = NEOPIXEL_LEN - 1 - 2 * pointsExternal; i < NEOPIXEL_LEN; i += 2) {
pixels.setPixelColor(i, 0xFFFF00);
}
pixels.show();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment