Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
64:540aa1602372
Parent:
63:205f0ca48473
Child:
65:2872ca289b49
diff -r 205f0ca48473 -r 540aa1602372 MenuClasses/StartScreen/StartScreen.cpp
--- a/MenuClasses/StartScreen/StartScreen.cpp	Wed May 01 22:35:40 2019 +0000
+++ b/MenuClasses/StartScreen/StartScreen.cpp	Thu May 02 11:30:04 2019 +0000
@@ -276,18 +276,23 @@
     while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) {  //Change this to if button pressed.
         StartScreen::ModeOptions(lcd); //displays to the user what are the mode options
         StartScreen::SelectMode(pad);  //the mode is selected by moving joystick in this function.
-        if (pad.check_event(Gamepad::BACK_PRESSED) == true) {  //This is a very important process, this helps the code to not get stuck in  menu loop.
+
+
+        //This is a very important process, this helps the code to not get stuck in  menu loop.
+        if (pad.check_event(Gamepad::BACK_PRESSED) == true) {
             pad.tone(1000.0,0.1);
             back_pressed = 1;
-            break;
+            break; //if back is pressed, the while loop is escaped.
         } else {
             back_pressed = 0;
         }
     }
     pad.tone(1000.0,0.1);
-    if(back_pressed) {
+    if(back_pressed) { //if back was pressed in the while loop, the previous menu is called.
         main_menu(lcd, pad);
-    } else {
+    }
+
+    else {
         if (g_mode == 2) {  //show instructions to handle motion control.
             StartScreen::motionControlInstructions(lcd);    //this only comes up on the screen is the user selects motion control from menu options.
         }
@@ -350,17 +355,22 @@
     while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) {  //Change this to if button pressed.
         StartScreen::selectSpeedPage(pad);
         StartScreen::showSpeedOptions(lcd);
-        if (pad.check_event(Gamepad::BACK_PRESSED) == true) {  //This is a very important process, this helps the code to not get stuck in  menu loop.
+
+        //This is a very important process, this helps the code to not get stuck in  menu loop.
+        if (pad.check_event(Gamepad::BACK_PRESSED) == true) {
             pad.tone(1000.0,0.1);
             back_pressed = 1;
-            break;
+            break; //if back is pressed, the while loop is escaped.
         } else {
             back_pressed = 0;
         }
     }
-    if(back_pressed) {
+
+    if(back_pressed) { //if back was pressed in the while loop, the previous menu is called.
         game_mode(lcd, pad);
-    } else {
+    }
+
+    else {
         pad.tone(1000.0,0.1);
         lcd.clear();
         wait(1/cs);