Dependencies:   mbed

Revision:
14:652fd55aebcf
Parent:
13:5133f00d2a2d
Child:
15:5bf3f951d337
--- a/Game/Game.cpp	Mon May 18 14:44:43 2020 +0000
+++ b/Game/Game.cpp	Mon May 18 14:54:29 2020 +0000
@@ -20,7 +20,8 @@
 }
 void Game::play() {
     updateLives(); // lights up leds initially
-    while( _lives != 0 || _pad->start_pressed()) {
+    // if all lives are lost or start is pressed game ends
+    while(_lives > 0 && !_pad->start_pressed()) {
         _level = random_level_gen(10);
         printf("Level (in game) = %d \n", _level); 
         _ball->set_level(_level);
@@ -34,6 +35,7 @@
         updateSpeed();
         updateLives();   
     }
+    printf("Reached end of play loop");
 }
 
 void Game::readInput() {
@@ -57,6 +59,9 @@
 }
 void Game::updateLives() {
     switch(_lives){
+        case 0:
+            _pad->leds(0.0);
+            break;
         case 1:
             _pad->leds(0.0);
             _pad->led(1,1.0); //red leds only