ECE2035 Project 2

Dependencies:   mbed mbed-rtos SDFileSystem

Revision:
10:1994adcfc86f
Parent:
9:f1d34ef049c5
--- a/fruit.cpp	Tue Apr 20 13:46:45 2021 +0000
+++ b/fruit.cpp	Tue Apr 20 18:15:22 2021 +0000
@@ -42,7 +42,7 @@
     // M->y = 0;
     //each fruit has its own tick
     //pc.printf("rand\n");
-    M->type = rand() % 3;
+    M->type = rand() % 4;
     switch (M->type)
     {
     case 0:
@@ -54,6 +54,8 @@
     case 2:
         M->draw = draw_banana;
         break;
+    case 3:
+        M->draw = draw_apple;
     default:
         break;
     }
@@ -138,9 +140,8 @@
         //pc.printf("Fruit %d: - (%d, %d),(%d, %d)\n", count, newFruit->box.topLeft.x, newFruit->box.topLeft.y, newFruit->box.bottomRight.x, newFruit->box.bottomRight.y);
         if(newFruit->status == FRUIT_SLICED ||
             newFruit->box.topLeft.x > 127 ||
-            newFruit->box.topLeft.y > 127 || 
-            newFruit->box.bottomRight.x <= 0  || 
-            newFruit->box.bottomRight.y <= 0)
+            newFruit->box.topLeft.y > 120 || 
+            newFruit->box.topLeft.x <= 0)
         {
             //cover the last fruit location
             draw_nothing(newFruit->box);