Inaktivitäts funktion und bug fix
This commit is contained in:
parent
d4c822b242
commit
ecab940541
1 changed files with 24 additions and 4 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,3 +474,15 @@ 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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue