A simple asteroids-like game utilizing various Mbed-compatible sensors

Dependencies:   mbed 4DGL-uLCD-SE PinDetect

overlap.cpp

Committer:
sralph3
Date:
2019-01-03
Revision:
8:137330cfe63d
Parent:
0:f2cc64948895

File content as of revision 8:137330cfe63d:

#include "ScreenObject.h"
#include "uLCD_4DGL.h"
extern uLCD_4DGL uLCD;
bool overlap(ScreenObject & a, ScreenObject & b){
    #define EARTH_WIDTH 10
    #define EARTH_HEIGHT 10
    #define ASTEROID_HEIGHT 12
    #define ASTEROID_WIDTH 15
//    int w = a.xpos;
//    uLCD.printf("%i", w);
    if ( ((a.xpos + 6) > (b.xpos)) && ((a.xpos) <= (b.xpos+10)) ){
        if ( ((a.ypos) <= (b.ypos+6)) && ((a.ypos+6) >= (b.ypos)) ){
            return true;
        }
    }
    return false;
}