Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Engine/Engine.h@6:848d1e4c1a31, 2019-04-13 (annotated)
- Committer:
- el17m2h
- Date:
- Sat Apr 13 19:50:00 2019 +0000
- Revision:
- 6:848d1e4c1a31
- Parent:
- 5:8814d6de77d0
- Child:
- 7:0d9cee90ab0d
I created a jump function in the doodler file in order to make the doodler constantly jump vertically if it collides with any of the floors.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17m2h | 2:360a6c301a4e | 1 | #ifndef ENGINE_H |
el17m2h | 2:360a6c301a4e | 2 | #define ENGINE_H |
el17m2h | 2:360a6c301a4e | 3 | |
el17m2h | 2:360a6c301a4e | 4 | #include "mbed.h" |
el17m2h | 2:360a6c301a4e | 5 | #include "N5110.h" |
el17m2h | 2:360a6c301a4e | 6 | #include "Gamepad.h" |
el17m2h | 2:360a6c301a4e | 7 | #include "Floors.h" |
el17m2h | 4:8ec314f806ae | 8 | #include "Doodler.h" |
el17m2h | 2:360a6c301a4e | 9 | |
el17m2h | 2:360a6c301a4e | 10 | class Engine{ |
el17m2h | 2:360a6c301a4e | 11 | public: |
el17m2h | 2:360a6c301a4e | 12 | Engine(); |
el17m2h | 2:360a6c301a4e | 13 | ~Engine(); |
el17m2h | 4:8ec314f806ae | 14 | void init(int floors_width, int floors_height, int doodler_radius); |
el17m2h | 5:8814d6de77d0 | 15 | void read_input(Gamepad &pad); |
el17m2h | 5:8814d6de77d0 | 16 | void update(Gamepad &pad); |
el17m2h | 2:360a6c301a4e | 17 | void draw(N5110 &lcd); |
el17m2h | 2:360a6c301a4e | 18 | |
el17m2h | 2:360a6c301a4e | 19 | private: |
el17m2h | 6:848d1e4c1a31 | 20 | void check_floors_collision(Gamepad &pad); |
el17m2h | 4:8ec314f806ae | 21 | |
el17m2h | 2:360a6c301a4e | 22 | Floors _f1; |
el17m2h | 2:360a6c301a4e | 23 | Floors _f2; |
el17m2h | 2:360a6c301a4e | 24 | Floors _f3; |
el17m2h | 2:360a6c301a4e | 25 | Floors _f4; |
el17m2h | 2:360a6c301a4e | 26 | Floors _f5; |
el17m2h | 2:360a6c301a4e | 27 | Floors _f6; |
el17m2h | 2:360a6c301a4e | 28 | Floors _f7; |
el17m2h | 2:360a6c301a4e | 29 | Floors _f8; |
el17m2h | 2:360a6c301a4e | 30 | Floors _f9; |
el17m2h | 2:360a6c301a4e | 31 | Floors _f10; |
el17m2h | 2:360a6c301a4e | 32 | |
el17m2h | 4:8ec314f806ae | 33 | |
el17m2h | 2:360a6c301a4e | 34 | int _x; |
el17m2h | 2:360a6c301a4e | 35 | int _y; |
el17m2h | 2:360a6c301a4e | 36 | int _floors_height; |
el17m2h | 2:360a6c301a4e | 37 | int _floors_width; |
el17m2h | 4:8ec314f806ae | 38 | int _doodler_radius; |
el17m2h | 4:8ec314f806ae | 39 | |
el17m2h | 2:360a6c301a4e | 40 | // x and y positions of the floors |
el17m2h | 2:360a6c301a4e | 41 | int _f1x; |
el17m2h | 2:360a6c301a4e | 42 | int _f2x; |
el17m2h | 2:360a6c301a4e | 43 | int _f3x; |
el17m2h | 2:360a6c301a4e | 44 | int _f4x; |
el17m2h | 2:360a6c301a4e | 45 | int _f5x; |
el17m2h | 2:360a6c301a4e | 46 | int _f6x; |
el17m2h | 2:360a6c301a4e | 47 | int _f7x; |
el17m2h | 2:360a6c301a4e | 48 | int _f8x; |
el17m2h | 2:360a6c301a4e | 49 | int _f9x; |
el17m2h | 2:360a6c301a4e | 50 | int _f10x; |
el17m2h | 2:360a6c301a4e | 51 | int _f1y; |
el17m2h | 2:360a6c301a4e | 52 | int _f2y; |
el17m2h | 2:360a6c301a4e | 53 | int _f3y; |
el17m2h | 2:360a6c301a4e | 54 | int _f4y; |
el17m2h | 2:360a6c301a4e | 55 | int _f5y; |
el17m2h | 2:360a6c301a4e | 56 | int _f6y; |
el17m2h | 2:360a6c301a4e | 57 | int _f7y; |
el17m2h | 2:360a6c301a4e | 58 | int _f8y; |
el17m2h | 2:360a6c301a4e | 59 | int _f9y; |
el17m2h | 2:360a6c301a4e | 60 | int _f10y; |
el17m2h | 2:360a6c301a4e | 61 | |
el17m2h | 5:8814d6de77d0 | 62 | |
el17m2h | 5:8814d6de77d0 | 63 | Doodler _dood; |
el17m2h | 5:8814d6de77d0 | 64 | |
el17m2h | 5:8814d6de77d0 | 65 | Direction _d; |
el17m2h | 5:8814d6de77d0 | 66 | float _mag; |
el17m2h | 2:360a6c301a4e | 67 | }; |
el17m2h | 2:360a6c301a4e | 68 | #endif |