Simple vertical scrolling space shooter game using navigation switch (joystick), uLCD-144-G2, and a pushbutton switch.
Dependencies: 4DGL-uLCD-SE PinDetect mbed
Display/Enemy.h@0:5c666e5cd22d, 2016-03-17 (annotated)
- Committer:
- jaspinall3
- Date:
- Thu Mar 17 20:47:11 2016 +0000
- Revision:
- 0:5c666e5cd22d
March 17, 2016 Vertical Scrolling Space Shooter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jaspinall3 | 0:5c666e5cd22d | 1 | #ifndef ENEMY_H |
jaspinall3 | 0:5c666e5cd22d | 2 | #define ENEMY_H |
jaspinall3 | 0:5c666e5cd22d | 3 | |
jaspinall3 | 0:5c666e5cd22d | 4 | #define EnemyCockpitColor 0x3300FF |
jaspinall3 | 0:5c666e5cd22d | 5 | #define EnemyGlareColor1 0x330000 |
jaspinall3 | 0:5c666e5cd22d | 6 | #define EnemyGlareColor2 0xCC3300 |
jaspinall3 | 0:5c666e5cd22d | 7 | #define EnemyGunColor 0xCCCCCC |
jaspinall3 | 0:5c666e5cd22d | 8 | #define EnemyEngineColor 0xFFFFFF |
jaspinall3 | 0:5c666e5cd22d | 9 | #define HealthColor 0xFF0000 |
jaspinall3 | 0:5c666e5cd22d | 10 | |
jaspinall3 | 0:5c666e5cd22d | 11 | #include "mbed.h" |
jaspinall3 | 0:5c666e5cd22d | 12 | #include "Circle.h" |
jaspinall3 | 0:5c666e5cd22d | 13 | #include "Rectangle.h" |
jaspinall3 | 0:5c666e5cd22d | 14 | #include "Point.h" |
jaspinall3 | 0:5c666e5cd22d | 15 | |
jaspinall3 | 0:5c666e5cd22d | 16 | class Enemy { |
jaspinall3 | 0:5c666e5cd22d | 17 | public: |
jaspinall3 | 0:5c666e5cd22d | 18 | void fireToggle(); |
jaspinall3 | 0:5c666e5cd22d | 19 | Enemy(int x, uLCD_4DGL *uLCD); |
jaspinall3 | 0:5c666e5cd22d | 20 | void drawEnemy(); |
jaspinall3 | 0:5c666e5cd22d | 21 | void addY(int dy); |
jaspinall3 | 0:5c666e5cd22d | 22 | void damage(int dmg); |
jaspinall3 | 0:5c666e5cd22d | 23 | int getY(); |
jaspinall3 | 0:5c666e5cd22d | 24 | int getHealth(); |
jaspinall3 | 0:5c666e5cd22d | 25 | Point hitBoxStart(); |
jaspinall3 | 0:5c666e5cd22d | 26 | Point hitBoxDim(); |
jaspinall3 | 0:5c666e5cd22d | 27 | Point getGunLoc(); |
jaspinall3 | 0:5c666e5cd22d | 28 | |
jaspinall3 | 0:5c666e5cd22d | 29 | |
jaspinall3 | 0:5c666e5cd22d | 30 | private: |
jaspinall3 | 0:5c666e5cd22d | 31 | int _x; |
jaspinall3 | 0:5c666e5cd22d | 32 | int _y; |
jaspinall3 | 0:5c666e5cd22d | 33 | int _health; |
jaspinall3 | 0:5c666e5cd22d | 34 | |
jaspinall3 | 0:5c666e5cd22d | 35 | Circle _cockpit; |
jaspinall3 | 0:5c666e5cd22d | 36 | Circle _glare1; |
jaspinall3 | 0:5c666e5cd22d | 37 | Circle _glare2; |
jaspinall3 | 0:5c666e5cd22d | 38 | Rectangle _gun; |
jaspinall3 | 0:5c666e5cd22d | 39 | Rectangle _engine; |
jaspinall3 | 0:5c666e5cd22d | 40 | Rectangle _healthBar; |
jaspinall3 | 0:5c666e5cd22d | 41 | uLCD_4DGL *_uLCDptr; |
jaspinall3 | 0:5c666e5cd22d | 42 | }; |
jaspinall3 | 0:5c666e5cd22d | 43 | |
jaspinall3 | 0:5c666e5cd22d | 44 | #endif |