diff --git a/VSCode/Pong/src/main.cpp b/VSCode/Pong/src/main.cpp index f6ac0c0..32b9945 100755 --- a/VSCode/Pong/src/main.cpp +++ b/VSCode/Pong/src/main.cpp @@ -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 @@ -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; } -} \ No newline at end of file +} + + +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); +}