Stephen Ralph / Mbed 2 deprecated Asteroids

Dependencies:   mbed 4DGL-uLCD-SE PinDetect

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers overlap.cpp Source File

overlap.cpp

00001 #include "ScreenObject.h"
00002 #include "uLCD_4DGL.h"
00003 extern uLCD_4DGL uLCD;
00004 bool overlap(ScreenObject & a, ScreenObject & b){
00005     #define EARTH_WIDTH 10
00006     #define EARTH_HEIGHT 10
00007     #define ASTEROID_HEIGHT 12
00008     #define ASTEROID_WIDTH 15
00009 //    int w = a.xpos;
00010 //    uLCD.printf("%i", w);
00011     if ( ((a.xpos + 6) > (b.xpos)) && ((a.xpos) <= (b.xpos+10)) ){
00012         if ( ((a.ypos) <= (b.ypos+6)) && ((a.ypos+6) >= (b.ypos)) ){
00013             return true;
00014         }
00015     }
00016     return false;
00017 }