Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
25:e827f1a8fadc
Parent:
24:1c118b071430
Child:
30:461231877c89
--- a/Snake/Snake.cpp	Wed Apr 10 10:59:15 2019 +0000
+++ b/Snake/Snake.cpp	Wed Apr 10 14:37:05 2019 +0000
@@ -77,7 +77,6 @@
             wait(0.1);
         }
         lcd.clear();
-        char bufferlevel[14];
         sprintf(bufferlevel,"%d",level);
         lcd.printString("Level:",25,1);
         lcd.printString(bufferlevel,40,3);
@@ -290,6 +289,7 @@
 {
     _speed = speed;  //Speed changes depending on how much you push the joystick.(As Of Now)
     
+    //this makes all of the snake beeds chained together by making the lower ones drag towards where the top one was in the previous loop
     for(int i=0; i<=13; i++)  {
         if(length > i+1)  {
             if ((_x[i] > _x[i+1])&&(b[i+1] == 1)&&(b[i] == 1))  {
@@ -300,7 +300,7 @@
             }
         }
     }
- 
+   //this makes the controls of W/E directions only exclusive to the top beed in the snake
     for(int i=14; i>=0; i--)  {
             if((length == i+1)&&(b[i] == 1))  {
                 if (d == E) {
@@ -323,7 +323,7 @@
             }
     }
     
-    //Limits set so that the sprite does not travel off the screen.
+    //Limits set so that the snake does not travel off the screen.
     for(int i=0; i<=14; i++)  {
             if (_x[i] <= 0) {
                 _x[i] = 0;