A simple asteroids-like game utilizing various Mbed-compatible sensors
Dependencies: mbed 4DGL-uLCD-SE PinDetect
overlap.cpp@0:f2cc64948895, 2018-11-30 (annotated)
- Committer:
- sralph3
- Date:
- Fri Nov 30 04:49:11 2018 +0000
- Revision:
- 0:f2cc64948895
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sralph3 | 0:f2cc64948895 | 1 | #include "ScreenObject.h" |
sralph3 | 0:f2cc64948895 | 2 | #include "uLCD_4DGL.h" |
sralph3 | 0:f2cc64948895 | 3 | extern uLCD_4DGL uLCD; |
sralph3 | 0:f2cc64948895 | 4 | bool overlap(ScreenObject & a, ScreenObject & b){ |
sralph3 | 0:f2cc64948895 | 5 | #define EARTH_WIDTH 10 |
sralph3 | 0:f2cc64948895 | 6 | #define EARTH_HEIGHT 10 |
sralph3 | 0:f2cc64948895 | 7 | #define ASTEROID_HEIGHT 12 |
sralph3 | 0:f2cc64948895 | 8 | #define ASTEROID_WIDTH 15 |
sralph3 | 0:f2cc64948895 | 9 | // int w = a.xpos; |
sralph3 | 0:f2cc64948895 | 10 | // uLCD.printf("%i", w); |
sralph3 | 0:f2cc64948895 | 11 | if ( ((a.xpos + 6) > (b.xpos)) && ((a.xpos) <= (b.xpos+10)) ){ |
sralph3 | 0:f2cc64948895 | 12 | if ( ((a.ypos) <= (b.ypos+6)) && ((a.ypos+6) >= (b.ypos)) ){ |
sralph3 | 0:f2cc64948895 | 13 | return true; |
sralph3 | 0:f2cc64948895 | 14 | } |
sralph3 | 0:f2cc64948895 | 15 | } |
sralph3 | 0:f2cc64948895 | 16 | return false; |
sralph3 | 0:f2cc64948895 | 17 | } |