Snake game snake library

Revision:
9:e023c11f7737
Parent:
8:721a8dca7a25
Child:
10:f63560a7e7ed
diff -r 721a8dca7a25 -r e023c11f7737 Snake.cpp
--- a/Snake.cpp	Fri Apr 26 04:46:54 2019 +0000
+++ b/Snake.cpp	Sat Apr 27 06:18:17 2019 +0000
@@ -145,11 +145,11 @@
                 }
         
             printf("updated ");
-            eat();
+            eat(pad);
         }//live loop
 }//end of update
 
-void Snake::eat(){
+void Snake::eat(Gamepad &pad){
     
     Foodpos foodPos = _food.returnPos();
     if(snak._x[_length-1]==foodPos.x && snak._y[_length-1]== foodPos.y)
@@ -159,6 +159,7 @@
             snak._dirc[_length+1]=snak._dirc[_length-1];
             _length=_length+1;//if head == food, _length++
             _food.createfood();//spawn new food
+            Tone_1(pad);
         }
 }//end of addPoint
 
@@ -177,11 +178,15 @@
         init(initx,inity,initl,live);
 //end of deadSnake
 }
-        
+
+void Snake::Tone_1(Gamepad &pad){
+         pad.tone(750.0,0.1);
+         }
+         
 void Snake::check_WallCollision(N5110 &lcd){
     
     if (snak._x[_length] == 0 || snak._x[_length] == WIDTH)//if snake head hits side walls
-        {     
+        {    
             dead(lcd);
         }
     if (snak._y[_length]== FLOOR ||snak._y[_length]== CEILING )//if snake hits top or bottom walls
@@ -195,7 +200,7 @@
     for (int i=0 ;_length<i ;i++){
                                           
                     if (snak._x[_length-1]==snak._x[i] && snak._y[_length-1]==snak._y[i])
-                        {
+                        {   
                             dead(lcd);
                         }
                 }