Inaktivitäts funktion und bug fix

This commit is contained in:
nimeissn 2022-05-18 19:08:34 +02:00
parent d4c822b242
commit ecab940541

View file

@ -88,6 +88,8 @@ void playTone(byte type);
void toggleLed(byte x, byte y, byte type); void toggleLed(byte x, byte y, byte type);
byte getPlayerMovement(byte playerId); byte getPlayerMovement(byte playerId);
void endGame(); void endGame();
void attentionLight();
#include <Arduino.h> #include <Arduino.h>
@ -155,6 +157,11 @@ void loop()
if (isButtonPressed()) { if (isButtonPressed()) {
gameState = GAME_STATE_INIT; gameState = GAME_STATE_INIT;
} }
else if (millis() - lastDrawUpdate > 10000)
{
resetLEDs();
attentionLight();
}
break; break;
} }
} }
@ -342,13 +349,14 @@ void updateGame()
Serial.printf("Punkte Player Red %d\n", pointsPlayerRed); Serial.printf("Punkte Player Red %d\n", pointsPlayerRed);
toggleLed(0,10+i,LED_TYPE_POINTS_RED); toggleLed(0,10+i,LED_TYPE_POINTS_RED);
} }
if(pointsPlayerBlue == 5 ) if(pointsPlayerBlue == 5)
{ {
pointsPlayerBlue = 0; pointsPlayerBlue = 0;
pointsPlayerRed = 0; pointsPlayerRed = 0;
for (int i =0; i<200; i++) for (int i =0; i<200; i++)
{ {
pixels.setPixelColor(i, 0,0,255); pixels.setPixelColor(i, 0,0,55);
} }
} }
@ -358,7 +366,7 @@ void updateGame()
pointsPlayerRed = 0; pointsPlayerRed = 0;
for (int i =0; i<200; i++) for (int i =0; i<200; i++)
{ {
pixels.setPixelColor(i, 255,0,0); pixels.setPixelColor(i, 55,0,0);
} }
@ -465,4 +473,16 @@ void playTone(byte type)
} }
break; break;
} }
} }
void attentionLight()
{
int n = random(0,200);
int r = random(0,250);
int g = random(0,250);
int b = random(0,250);
pixels.setPixelColor(n,Color(r,g,b));
pixels.show();
delay(1000);
}