Faizan and Pages fun little game

Dependencies:   4DGL-uLCD-SE mbed SDFileSystem wave_player

Revision:
7:7cbff8cf583b
Parent:
4:c00da0b158c4
--- a/stack.cpp	Mon Oct 31 03:09:56 2016 +0000
+++ b/stack.cpp	Mon Oct 31 04:05:14 2016 +0000
@@ -14,7 +14,7 @@
 #define BADTOMATO 7
 
 #define MAX(i) std::max(i,0)
-#define MIN(i) std::min(i,107)
+#define MIN(i) std::min(i,90)
 
 
 Stack::Stack(int location, uLCD_4DGL * uLCD) {
@@ -22,7 +22,7 @@
     Food bread(uLCD);
     stackOfFood.push_back(bread);
     lcd = uLCD;
-    top = 4;
+    top = 122;
 }
 
 void Stack::move(int dx) {
@@ -47,18 +47,19 @@
 
 void Stack::erase() {
     // ERASE
-    lcd->filled_rectangle(x, 4, x + 16, top - 1, BLACK);
+    lcd->filled_rectangle(x - 1, 125, x + 17, 126, BLACK);
+    lcd->filled_rectangle(x, top, x + 16, 124, BLACK);
 }
 
 void Stack::draw() {
     // DRAW (loop thru food vector)
-    lcd->filled_rectangle(x - 1, 1, x + 17, 3, WHITE);
-    int j = 4;
+    lcd->filled_rectangle(x - 1, 125, x + 17, 126, WHITE);
+    int j = 122;
     for (int i = 0; i < stackOfFood.size(); i++) {
         stackOfFood[i].x = x;
         stackOfFood[i].y = j;
         stackOfFood[i].draw();
-        j += 4;
+        j -= 4;
     }
 }