Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
21:e41126528cc6
Parent:
20:1e6338403427
Child:
22:ee698f66146f
--- a/SnakevsBlock/SnakevsBlock.cpp	Tue Apr 09 05:32:54 2019 +0000
+++ b/SnakevsBlock/SnakevsBlock.cpp	Wed Apr 10 04:08:13 2019 +0000
@@ -94,13 +94,13 @@
     if(blockbuff == blockgap)  {  //change this while changing the block drop gap
         blockbuff = 0;
     }
-    if(length >= 11)  {  //change this while changing the block drop gap
+    if(length >= 11)  {  //to make it easier to react to sudden happenings
         speed = 2;
     }
     else  {
         speed = 1;
     }
-    if(length > 15)  {  //change this while changing the block drop gap
+    if(length > 15)  {  //to make progressive levels harder
         blockgap -= 20;
         level += 1;
     }
@@ -158,9 +158,8 @@
         //audio feedback
         pad.tone(1000.0,0.1);
         f_pos.x = rand() % 82;
-        f_pos.y = -2;
-        if(blockbuff<25)  { //change this while changing the block drop gap
-            f_pos.y = -30;
+        if(blockbuff>25)  { //change this while changing the block drop gap
+            f_pos.y = -2;
         }
         length+=1;
         
@@ -192,8 +191,8 @@
         pad.tone(1000.0,0.1);
         ff_pos.x = rand() % 82;
         ff_pos.y = -2;
-        if(blockbuff<25)  { //change this while changing the block drop gap
-            f_pos.y = -30;
+        if(blockbuff>25)  { //change this while changing the block drop gap
+            f_pos.y = -2;
         }
         length+=1;
         
@@ -225,8 +224,8 @@
         pad.tone(1000.0,0.1);
         fff_pos.x = rand() % 82;
         fff_pos.y = -2;
-        if(blockbuff<25)  { //change this while changing the block drop gap
-            f_pos.y = -30;
+        if(blockbuff>25)  { //change this while changing the block drop gap
+            f_pos.y = -2;
         }
         length+=1;