Faizan and Pages fun little game

Dependencies:   4DGL-uLCD-SE mbed SDFileSystem wave_player

main.cpp

Committer:
fkhan39
Date:
2016-10-29
Revision:
1:9eeeb0d8f036
Parent:
0:de9ffb858be9
Child:
2:4c5f409d6bb8

File content as of revision 1:9eeeb0d8f036:

#include "mbed.h"
#include "uLCD_4DGL.h"
#include "food.h"
#include "stack.h"
#include <ctime>
#include <cstdlib>

#define BREAD 1
#define LETTUCE 2
#define CHEESE 3
#define TOMATO 4
#define BADLETTUCE 5
#define BADCHEESE 6
#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
}