Faizan and Pages fun little game
Dependencies: 4DGL-uLCD-SE mbed SDFileSystem wave_player
Diff: main.cpp
- Revision:
- 1:9eeeb0d8f036
- Parent:
- 0:de9ffb858be9
- Child:
- 2:4c5f409d6bb8
diff -r de9ffb858be9 -r 9eeeb0d8f036 main.cpp --- a/main.cpp Fri Oct 28 17:33:29 2016 +0000 +++ b/main.cpp Sat Oct 29 19:35:46 2016 +0000 @@ -2,6 +2,8 @@ #include "uLCD_4DGL.h" #include "food.h" #include "stack.h" +#include <ctime> +#include <cstdlib> #define BREAD 1 #define LETTUCE 2 @@ -12,10 +14,50 @@ #define BADTOMATO 7 uLCD_4DGL lcd(p9,p10,p11); +vector<Food> foods; +Food collidedFood; +Stack sandwich(64,&lcd); +BusIn left(p7); +BusIn right(p5); +int score; int main() { + score = 0; + left.mode(PullUp); + right.mode(PullUp); + srand(time(NULL)); + + while(1) { - + if (!left) { + sandwich.move(-1); + } + if (!right) { + sandwich.move(+1); + } + if (collisionCheck()) { + // if the collided object is bad + // loss of life + // if the collided object is bread + // close up the sandwich, add the points to the overall score, re draw + // else + // add to stack, remove from falling object list, redraw + } + // every 3 seconds add new food! use timer. + // every .2 second each food should fall a lil bit! use timer. } } + +bool collisionCheck() { + + + // remove foods from vector that are off screen + // find foods that have an (x,y) that is within the range of the top of the stack + // if nothing found w/i the range + // return false + // if something found + // collidedFood = that food item + // return true +} +