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);
|
||||
byte getPlayerMovement(byte playerId);
|
||||
void endGame();
|
||||
void attentionLight();
|
||||
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
|
@ -155,6 +157,11 @@ void loop()
|
|||
if (isButtonPressed()) {
|
||||
gameState = GAME_STATE_INIT;
|
||||
}
|
||||
else if (millis() - lastDrawUpdate > 10000)
|
||||
{
|
||||
resetLEDs();
|
||||
attentionLight();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -342,13 +349,14 @@ void updateGame()
|
|||
Serial.printf("Punkte Player Red %d\n", pointsPlayerRed);
|
||||
toggleLed(0,10+i,LED_TYPE_POINTS_RED);
|
||||
}
|
||||
if(pointsPlayerBlue == 5 )
|
||||
if(pointsPlayerBlue == 5)
|
||||
{
|
||||
|
||||
pointsPlayerBlue = 0;
|
||||
pointsPlayerRed = 0;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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