![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test 1 doc
Engine/Engine.h@8:d19b30a6cd69, 2020-05-26 (annotated)
- Committer:
- joebarhouch
- Date:
- Tue May 26 22:15:42 2020 +0000
- Revision:
- 8:d19b30a6cd69
- Parent:
- 7:530ca713d2b2
- Child:
- 9:9830d3a78572
Implemented enemies with AI that walk around with physics
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 | 8:d19b30a6cd69 | 10 | #include <vector> |
joebarhouch | 3:e4e1cbf750b6 | 11 | |
joebarhouch | 6:00d20886e4f8 | 12 | void drawMap(N5110 &lcd); |
joebarhouch | 6:00d20886e4f8 | 13 | |
joebarhouch | 3:e4e1cbf750b6 | 14 | class Engine |
joebarhouch | 3:e4e1cbf750b6 | 15 | { |
joebarhouch | 3:e4e1cbf750b6 | 16 | |
joebarhouch | 3:e4e1cbf750b6 | 17 | public: |
joebarhouch | 3:e4e1cbf750b6 | 18 | Engine(); |
joebarhouch | 3:e4e1cbf750b6 | 19 | ~Engine(); |
joebarhouch | 3:e4e1cbf750b6 | 20 | |
joebarhouch | 3:e4e1cbf750b6 | 21 | void init(); |
joebarhouch | 3:e4e1cbf750b6 | 22 | void read_input(Gamepad &pad); |
joebarhouch | 3:e4e1cbf750b6 | 23 | void update(Gamepad &pad); |
joebarhouch | 3:e4e1cbf750b6 | 24 | void draw(N5110 &lcd); |
joebarhouch | 7:530ca713d2b2 | 25 | void floorCollide(); |
joebarhouch | 8:d19b30a6cd69 | 26 | void spawnEnemy(); |
joebarhouch | 8:d19b30a6cd69 | 27 | void efloorCollide(); |
joebarhouch | 8:d19b30a6cd69 | 28 | void ennemyCollide(); |
joebarhouch | 7:530ca713d2b2 | 29 | |
joebarhouch | 8:d19b30a6cd69 | 30 | |
joebarhouch | 7:530ca713d2b2 | 31 | private: |
joebarhouch | 8:d19b30a6cd69 | 32 | vector <Enemy> enemies; |
joebarhouch | 6:00d20886e4f8 | 33 | //player object |
joebarhouch | 3:e4e1cbf750b6 | 34 | Player _p; |
joebarhouch | 3:e4e1cbf750b6 | 35 | // player coordinates |
joebarhouch | 3:e4e1cbf750b6 | 36 | int _px; |
joebarhouch | 3:e4e1cbf750b6 | 37 | int _py; |
joebarhouch | 8:d19b30a6cd69 | 38 | |
joebarhouch | 8:d19b30a6cd69 | 39 | Vector2D player; |
joebarhouch | 8:d19b30a6cd69 | 40 | |
joebarhouch | 8:d19b30a6cd69 | 41 | //gamepad |
joebarhouch | 3:e4e1cbf750b6 | 42 | Direction _d; |
joebarhouch | 3:e4e1cbf750b6 | 43 | float _mag; |
joebarhouch | 8:d19b30a6cd69 | 44 | |
joebarhouch | 8:d19b30a6cd69 | 45 | //physics |
joebarhouch | 7:530ca713d2b2 | 46 | bool _jump; |
joebarhouch | 8:d19b30a6cd69 | 47 | int _oldY; |
joebarhouch | 7:530ca713d2b2 | 48 | int _Ypos; |
joebarhouch | 7:530ca713d2b2 | 49 | bool _fall; |
joebarhouch | 8:d19b30a6cd69 | 50 | bool _c; |
joebarhouch | 8:d19b30a6cd69 | 51 | |
joebarhouch | 8:d19b30a6cd69 | 52 | //enemy |
joebarhouch | 8:d19b30a6cd69 | 53 | bool _efall; |
joebarhouch | 8:d19b30a6cd69 | 54 | int _eYpos; |
joebarhouch | 8:d19b30a6cd69 | 55 | bool _e; |
joebarhouch | 8:d19b30a6cd69 | 56 | |
joebarhouch | 8:d19b30a6cd69 | 57 | |
joebarhouch | 3:e4e1cbf750b6 | 58 | }; |
joebarhouch | 3:e4e1cbf750b6 | 59 | |
joebarhouch | 3:e4e1cbf750b6 | 60 | #endif |