Simple vertical scrolling space shooter game using navigation switch (joystick), uLCD-144-G2, and a pushbutton switch.
Dependencies: 4DGL-uLCD-SE PinDetect mbed
Display/Player.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 PLAYER_H |
jaspinall3 | 0:5c666e5cd22d | 2 | #define PLAYER_H |
jaspinall3 | 0:5c666e5cd22d | 3 | |
jaspinall3 | 0:5c666e5cd22d | 4 | #define CockpitColor 0x660000 |
jaspinall3 | 0:5c666e5cd22d | 5 | #define GlareColor 0x666666 |
jaspinall3 | 0:5c666e5cd22d | 6 | #define BodyColor 0x999999 |
jaspinall3 | 0:5c666e5cd22d | 7 | #define WingColor 0x333333 |
jaspinall3 | 0:5c666e5cd22d | 8 | #define GunColor 0xB50000 |
jaspinall3 | 0:5c666e5cd22d | 9 | #define Engine1Color 0xFF3300 |
jaspinall3 | 0:5c666e5cd22d | 10 | #define Engine2Color 0xFFFF00 |
jaspinall3 | 0:5c666e5cd22d | 11 | #define HealthColor 0xFF0000 |
jaspinall3 | 0:5c666e5cd22d | 12 | |
jaspinall3 | 0:5c666e5cd22d | 13 | #include "mbed.h" |
jaspinall3 | 0:5c666e5cd22d | 14 | #include "Circle.h" |
jaspinall3 | 0:5c666e5cd22d | 15 | #include "Rectangle.h" |
jaspinall3 | 0:5c666e5cd22d | 16 | #include "Point.h" |
jaspinall3 | 0:5c666e5cd22d | 17 | |
jaspinall3 | 0:5c666e5cd22d | 18 | class Player { |
jaspinall3 | 0:5c666e5cd22d | 19 | public: |
jaspinall3 | 0:5c666e5cd22d | 20 | Player(int x, int y, uLCD_4DGL *uLCD); |
jaspinall3 | 0:5c666e5cd22d | 21 | void drawPlayer(); |
jaspinall3 | 0:5c666e5cd22d | 22 | void addX(int dx); |
jaspinall3 | 0:5c666e5cd22d | 23 | void addY(int dy); |
jaspinall3 | 0:5c666e5cd22d | 24 | Point hitBoxStart(); |
jaspinall3 | 0:5c666e5cd22d | 25 | Point hitBoxDim(); |
jaspinall3 | 0:5c666e5cd22d | 26 | Point getLeftGunLoc(); |
jaspinall3 | 0:5c666e5cd22d | 27 | Point getRightGunLoc(); |
jaspinall3 | 0:5c666e5cd22d | 28 | void damage(int dmg); |
jaspinall3 | 0:5c666e5cd22d | 29 | int getHealth(); |
jaspinall3 | 0:5c666e5cd22d | 30 | |
jaspinall3 | 0:5c666e5cd22d | 31 | private: |
jaspinall3 | 0:5c666e5cd22d | 32 | int _x; |
jaspinall3 | 0:5c666e5cd22d | 33 | int _y; |
jaspinall3 | 0:5c666e5cd22d | 34 | int _health; |
jaspinall3 | 0:5c666e5cd22d | 35 | Circle _cockpit; |
jaspinall3 | 0:5c666e5cd22d | 36 | Circle _glare; |
jaspinall3 | 0:5c666e5cd22d | 37 | Rectangle _body; |
jaspinall3 | 0:5c666e5cd22d | 38 | Rectangle _leftWing; |
jaspinall3 | 0:5c666e5cd22d | 39 | Rectangle _rightWing; |
jaspinall3 | 0:5c666e5cd22d | 40 | Rectangle _leftGun; |
jaspinall3 | 0:5c666e5cd22d | 41 | Rectangle _rightGun; |
jaspinall3 | 0:5c666e5cd22d | 42 | Rectangle _engine1; |
jaspinall3 | 0:5c666e5cd22d | 43 | Rectangle _engine2; |
jaspinall3 | 0:5c666e5cd22d | 44 | Rectangle _healthBar; |
jaspinall3 | 0:5c666e5cd22d | 45 | uLCD_4DGL *_uLCDptr; |
jaspinall3 | 0:5c666e5cd22d | 46 | }; |
jaspinall3 | 0:5c666e5cd22d | 47 | |
jaspinall3 | 0:5c666e5cd22d | 48 | #endif |