Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
20:1e6338403427
Parent:
19:05cc9f801468
Child:
21:e41126528cc6
--- a/SnakevsBlock/SnakevsBlock.cpp	Mon Apr 08 16:46:14 2019 +0000
+++ b/SnakevsBlock/SnakevsBlock.cpp	Tue Apr 09 05:32:54 2019 +0000
@@ -18,7 +18,7 @@
     foodbuff = 0;
     send=0;
     speed = 1;
-    blockgap = 161;
+    blockgap = 500;
     blockbuff = 0;
     b0 = 1;
     b1 = 1;
@@ -47,7 +47,7 @@
 
 void SnakevsBlock::draw(N5110 &lcd, Gamepad &pad)
 {
-    length = _s.draw(pad, lcd, length); //Draws the Snake.     //Make these snake buffs relative to the snake drops which in turn relate to the game speed
+    length = _s.draw(pad, lcd, length, level); //Draws the Snake.     //Make these snake buffs relative to the snake drops which in turn relate to the game speed
     if(foodbuff >=0)  {
         _f.draw(lcd); //Draws the first food.
         if(foodbuff >=50)  {
@@ -94,8 +94,14 @@
     if(blockbuff == blockgap)  {  //change this while changing the block drop gap
         blockbuff = 0;
     }
+    if(length >= 11)  {  //change this while changing the block drop gap
+        speed = 2;
+    }
+    else  {
+        speed = 1;
+    }
     if(length > 15)  {  //change this while changing the block drop gap
-        blockgap -= 10;
+        blockgap -= 20;
         level += 1;
     }
 }