ELEC2645 (2019/20)
/
ELEC2645_Project_el18jb
test 1 doc
Player/Player.h@7:530ca713d2b2, 2020-05-26 (annotated)
- Committer:
- joebarhouch
- Date:
- Tue May 26 01:45:20 2020 +0000
- Revision:
- 7:530ca713d2b2
- Parent:
- 5:928c2eee4109
- Child:
- 8:d19b30a6cd69
Fully functional game physics with floor collision and jumps
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joebarhouch | 2:f22cb01c43bc | 1 | #ifndef PLAYER_H |
joebarhouch | 2:f22cb01c43bc | 2 | #define PLAYER_H |
joebarhouch | 2:f22cb01c43bc | 3 | |
joebarhouch | 2:f22cb01c43bc | 4 | #include "mbed.h" |
joebarhouch | 2:f22cb01c43bc | 5 | #include "N5110.h" |
joebarhouch | 2:f22cb01c43bc | 6 | #include "Gamepad.h" |
joebarhouch | 2:f22cb01c43bc | 7 | #include "Bitmap.h" |
joebarhouch | 2:f22cb01c43bc | 8 | |
joebarhouch | 2:f22cb01c43bc | 9 | |
joebarhouch | 2:f22cb01c43bc | 10 | |
joebarhouch | 2:f22cb01c43bc | 11 | |
joebarhouch | 2:f22cb01c43bc | 12 | class Player |
joebarhouch | 2:f22cb01c43bc | 13 | { |
joebarhouch | 2:f22cb01c43bc | 14 | public: |
joebarhouch | 2:f22cb01c43bc | 15 | Player(); |
joebarhouch | 2:f22cb01c43bc | 16 | ~Player(); |
joebarhouch | 2:f22cb01c43bc | 17 | |
joebarhouch | 3:e4e1cbf750b6 | 18 | void init(int x, int y); |
joebarhouch | 3:e4e1cbf750b6 | 19 | //bool health; |
joebarhouch | 7:530ca713d2b2 | 20 | |
joebarhouch | 3:e4e1cbf750b6 | 21 | //bool is_jumping(); |
joebarhouch | 2:f22cb01c43bc | 22 | void draw(N5110 &lcd); |
joebarhouch | 5:928c2eee4109 | 23 | bool floorCollide(); |
joebarhouch | 7:530ca713d2b2 | 24 | void update(Direction d, float mag, int Ypos, bool fall, bool jump); |
joebarhouch | 3:e4e1cbf750b6 | 25 | Vector2D get_pos(); |
joebarhouch | 2:f22cb01c43bc | 26 | |
joebarhouch | 2:f22cb01c43bc | 27 | private: |
joebarhouch | 2:f22cb01c43bc | 28 | int _vx; |
joebarhouch | 2:f22cb01c43bc | 29 | int _vy; |
joebarhouch | 2:f22cb01c43bc | 30 | int _playerX; |
joebarhouch | 2:f22cb01c43bc | 31 | int _playerY; |
joebarhouch | 5:928c2eee4109 | 32 | bool _floorCollision; |
joebarhouch | 3:e4e1cbf750b6 | 33 | char _dir; |
joebarhouch | 2:f22cb01c43bc | 34 | |
joebarhouch | 2:f22cb01c43bc | 35 | }; |
joebarhouch | 2:f22cb01c43bc | 36 | |
joebarhouch | 2:f22cb01c43bc | 37 | #endif |