Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
20:1e6338403427
Parent:
19:05cc9f801468
Child:
21:e41126528cc6
diff -r 05cc9f801468 -r 1e6338403427 Snake/Snake.cpp
--- a/Snake/Snake.cpp	Mon Apr 08 16:46:14 2019 +0000
+++ b/Snake/Snake.cpp	Tue Apr 09 05:32:54 2019 +0000
@@ -28,7 +28,7 @@
 }
 
 
-int Snake::draw(Gamepad &pad, N5110 &lcd, int length)
+int Snake::draw(Gamepad &pad, N5110 &lcd, int length, int level)
 {   
     if(m == 0){
         _x = WIDTH/2;  //Spawns player sprite near the middle of the screen.
@@ -245,6 +245,26 @@
         lcd.printString("Level Complete",0,1);
         lcd.refresh();
         wait(1);
+        lcd.clear();
+        lcd.printString("Press Start",3,1);
+        lcd.printString("to Proceed",5,3);
+        lcd.refresh();
+        int sound = 1000;
+        while ( pad.check_event(Gamepad::START_PRESSED) == false) {
+            pad.leds_on();
+            pad.tone(rand()%sound,0.1);
+            wait(0.1);
+            pad.leds_off();
+            wait(0.1);
+        }
+        wait(1);
+        lcd.clear();
+        char bufferlevel[14];
+        sprintf(bufferlevel,"%d",level);
+        lcd.printString("Level:",25,1);
+        lcd.printString(bufferlevel,40,3);
+        lcd.refresh();
+        wait(2);
         length = 3;
     }
     return length;