A simple asteroids-like game utilizing various Mbed-compatible sensors
Dependencies: mbed 4DGL-uLCD-SE PinDetect
Diff: overlap.cpp
- Revision:
- 0:f2cc64948895
diff -r 000000000000 -r f2cc64948895 overlap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlap.cpp Fri Nov 30 04:49:11 2018 +0000 @@ -0,0 +1,17 @@ +#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; +} \ No newline at end of file