ELEC2645 (2019/20)
/
ELEC2645_Project_el18jb
test 1 doc
Engine/Engine.h@13:cb5ed2f0cbd5, 2020-05-27 (annotated)
- Committer:
- joebarhouch
- Date:
- Wed May 27 04:36:22 2020 +0000
- Revision:
- 13:cb5ed2f0cbd5
- Parent:
- 12:eb8d30593e95
- Child:
- 14:58887d7e1072
Coin reset
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joebarhouch | 3:e4e1cbf750b6 | 1 | #ifndef ENGINE_H |
joebarhouch | 3:e4e1cbf750b6 | 2 | #define ENGINE_H |
joebarhouch | 3:e4e1cbf750b6 | 3 | |
joebarhouch | 3:e4e1cbf750b6 | 4 | #include "mbed.h" |
joebarhouch | 3:e4e1cbf750b6 | 5 | #include "N5110.h" |
joebarhouch | 3:e4e1cbf750b6 | 6 | #include "Gamepad.h" |
joebarhouch | 3:e4e1cbf750b6 | 7 | #include "Player.h" |
joebarhouch | 5:928c2eee4109 | 8 | #include "Platform.h" |
joebarhouch | 8:d19b30a6cd69 | 9 | #include "Enemy.h" |
joebarhouch | 11:b3024ab59fa5 | 10 | #include "Coin.h" |
joebarhouch | 8:d19b30a6cd69 | 11 | #include <vector> |
joebarhouch | 3:e4e1cbf750b6 | 12 | |
joebarhouch | 6:00d20886e4f8 | 13 | void drawMap(N5110 &lcd); |
joebarhouch | 6:00d20886e4f8 | 14 | |
joebarhouch | 3:e4e1cbf750b6 | 15 | class Engine |
joebarhouch | 3:e4e1cbf750b6 | 16 | { |
joebarhouch | 3:e4e1cbf750b6 | 17 | |
joebarhouch | 3:e4e1cbf750b6 | 18 | public: |
joebarhouch | 3:e4e1cbf750b6 | 19 | Engine(); |
joebarhouch | 3:e4e1cbf750b6 | 20 | ~Engine(); |
joebarhouch | 3:e4e1cbf750b6 | 21 | |
joebarhouch | 3:e4e1cbf750b6 | 22 | void init(); |
joebarhouch | 3:e4e1cbf750b6 | 23 | void read_input(Gamepad &pad); |
joebarhouch | 3:e4e1cbf750b6 | 24 | void update(Gamepad &pad); |
joebarhouch | 3:e4e1cbf750b6 | 25 | void draw(N5110 &lcd); |
joebarhouch | 7:530ca713d2b2 | 26 | void floorCollide(); |
joebarhouch | 8:d19b30a6cd69 | 27 | void spawnEnemy(); |
joebarhouch | 12:eb8d30593e95 | 28 | bool enemyCollide(); |
joebarhouch | 13:cb5ed2f0cbd5 | 29 | bool fellDown(); |
joebarhouch | 12:eb8d30593e95 | 30 | bool koed(); |
joebarhouch | 11:b3024ab59fa5 | 31 | void gameOver(N5110 &lcd); |
joebarhouch | 12:eb8d30593e95 | 32 | void coinTaken(); |
joebarhouch | 12:eb8d30593e95 | 33 | |
joebarhouch | 12:eb8d30593e95 | 34 | |
joebarhouch | 8:d19b30a6cd69 | 35 | |
joebarhouch | 7:530ca713d2b2 | 36 | private: |
joebarhouch | 10:9317a62bd4d0 | 37 | |
joebarhouch | 6:00d20886e4f8 | 38 | //player object |
joebarhouch | 3:e4e1cbf750b6 | 39 | Player _p; |
joebarhouch | 3:e4e1cbf750b6 | 40 | // player coordinates |
joebarhouch | 3:e4e1cbf750b6 | 41 | int _px; |
joebarhouch | 3:e4e1cbf750b6 | 42 | int _py; |
joebarhouch | 8:d19b30a6cd69 | 43 | |
joebarhouch | 8:d19b30a6cd69 | 44 | Vector2D player; |
joebarhouch | 8:d19b30a6cd69 | 45 | |
joebarhouch | 12:eb8d30593e95 | 46 | // coin object |
joebarhouch | 12:eb8d30593e95 | 47 | Coin coin; |
joebarhouch | 13:cb5ed2f0cbd5 | 48 | Vector2D coinPos; |
joebarhouch | 12:eb8d30593e95 | 49 | |
joebarhouch | 8:d19b30a6cd69 | 50 | //gamepad |
joebarhouch | 3:e4e1cbf750b6 | 51 | Direction _d; |
joebarhouch | 3:e4e1cbf750b6 | 52 | float _mag; |
joebarhouch | 8:d19b30a6cd69 | 53 | |
joebarhouch | 8:d19b30a6cd69 | 54 | //physics |
joebarhouch | 7:530ca713d2b2 | 55 | bool _jump; |
joebarhouch | 7:530ca713d2b2 | 56 | int _Ypos; |
joebarhouch | 7:530ca713d2b2 | 57 | bool _fall; |
joebarhouch | 8:d19b30a6cd69 | 58 | bool _c; |
joebarhouch | 8:d19b30a6cd69 | 59 | |
joebarhouch | 8:d19b30a6cd69 | 60 | //enemy |
joebarhouch | 10:9317a62bd4d0 | 61 | vector <Enemy> enemies; |
joebarhouch | 8:d19b30a6cd69 | 62 | |
joebarhouch | 13:cb5ed2f0cbd5 | 63 | //deaths |
joebarhouch | 12:eb8d30593e95 | 64 | bool ko1; |
joebarhouch | 12:eb8d30593e95 | 65 | bool ko2; |
joebarhouch | 12:eb8d30593e95 | 66 | |
joebarhouch | 8:d19b30a6cd69 | 67 | |
joebarhouch | 3:e4e1cbf750b6 | 68 | }; |
joebarhouch | 3:e4e1cbf750b6 | 69 | |
joebarhouch | 3:e4e1cbf750b6 | 70 | #endif |