ELEC2645 (2018/19) / Mbed 2 deprecated el17dg

Dependencies:   mbed

Fork of el17dg by Dmitrijs Griskovs

Revision:
35:172db1608332
Parent:
34:754915ce9de5
Child:
36:207ec7db8648
--- a/game/gameovermanager.h	Tue Apr 30 19:24:41 2019 +0000
+++ b/game/gameovermanager.h	Tue Apr 30 20:51:39 2019 +0000
@@ -28,10 +28,7 @@
      * and "youDied" sprite from the right side to the center.  
      */
     void updateAndDraw() {
-        if (!started) {
-            startAnimation();
-        }
-        
+        if (!started) { startAnimation();}
         if (animation_counter < animation_length) {
             if (gamepad.check_event(gamepad.START_PRESSED)) {
                 gameOverLogo.pos.x = game_area_x - 29 + 42;
@@ -45,14 +42,7 @@
         }            
         drawSprite(gameOverLogo.pos, game_over_sprite);
         drawSprite(youDied.pos, you_died_sprite);
-
-        char buffer[32];
-        sprintf(buffer,"Score: %i", GameGlobals::game_score);
-        updateHighScore();
-        lcd.printString(buffer,0,3);   
-        lcd.printString("Press Y",0,4);
-        lcd.printString("to restart",0,5);
-
+        gameOverPostAnimation();
         musicGameOver();
         ledsGameOver();   
     }
@@ -138,6 +128,15 @@
         }
     }
     
+    void gameOverPostAnimation(){
+        char buffer[32];
+        sprintf(buffer,"Score: %i", GameGlobals::game_score);
+        updateHighScore();
+        lcd.printString(buffer,0,3);   
+        lcd.printString("Press Y",0,4);
+        lcd.printString("to restart",0,5);
+    }
+    
     bool started;
     static const int animation_length = 42;
     int animation_counter;