ccc

Dependencies:   mbed FXOS8700Q

Revision:
14:f898d37428b1
Parent:
1:b34f1b9b2b62
--- a/Snake/Snake.cpp	Mon May 06 04:25:09 2019 +0000
+++ b/Snake/Snake.cpp	Mon May 11 10:32:00 2020 +0000
@@ -35,7 +35,7 @@
     {   
         snek._x[i]=x+i;
         snek._y[i]=y;
-        snek._dir[i]=1;
+        snek._dir[i]=4;
     }
     
     snek._x[_length]=x+_length;
@@ -157,24 +157,39 @@
                 }
         
             printf("updated ");
-            addPoint();
+            
         }
 }
 
-void Snake::addPoint(){
-    
-    pos foodPos = _food.returnPos();
-    
-    bool ifcondition=(snek._x[_length-1]==foodPos.x && snek._y[_length-1]== foodPos.y);
-    if (ifcondition)
-        {
-            snek._x[_length+1]=snek._x[_length];
-            snek._y[_length+1]=snek._y[_length];
-            snek._dir[_length+1]=snek._dir[_length-1];
-            _length=_length+1;
-            _food.response();
-        }
-}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 void Snake::deadSnake(N5110 &lcd){//check the condition that the life reduces