ELEC2645 (2018/19) / Mbed 2 deprecated el18jz_

Dependencies:   mbed

Revision:
4:0f2006e9c8f8
Parent:
0:07c4fef6c0af
--- a/move/Move.cpp	Wed May 08 22:18:51 2019 +0000
+++ b/move/Move.cpp	Thu May 09 02:37:14 2019 +0000
@@ -56,7 +56,7 @@
        lcd.drawRect(2*food.a, 2*food.b,2,2,FILL_BLACK);
 }
 
-
+// This function control the dirction and the movement
 void Move::update(Gamepad &pad) {
     _d = pad.get_direction();
     
@@ -90,8 +90,8 @@
         lcd.init();
             lcd.printString("Game Over",0,1);
             char buffer1[14];
-            sprintf(buffer1,"Your score:%2d",_length - 5);
-            lcd.printString(buffer1,0,2); 
+            sprintf(buffer1,"Your score:%2d",_length - 5);//As snake length will increase the same as score if one food 
+            lcd.printString(buffer1,0,2);                 //for 1 score, so i simpley use length to repersant score.
             lcd.printString("Press Start", 0 , 3);
             lcd.printString("to restart", 0 , 4);
         lcd.refresh();
@@ -103,6 +103,7 @@
         }
         initial();
         getfood();
+        menu.menus(lcd,pad);
         }
         
         for (int i =0; i < _length - 2; i++) {
@@ -124,6 +125,7 @@
                 }
             initial();
             getfood();
+            menu.menus(lcd,pad);
             }
         }
     }