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@16:e0542761fc8c, 2019-04-24 (annotated)
- Committer:
- el17m2h
- Date:
- Wed Apr 24 10:33:39 2019 +0000
- Revision:
- 16:e0542761fc8c
- Parent:
- 15:4efa04a6a376
- Child:
- 17:74de8c17ddac
I added another folder for the bullets the doodler can fire controlled by the Y button. I created three bullets and once they reach the end of the screen they will go back and remain at the doodler's position.
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 | 14:529f798adae4 | 18 | void check_floors_collision(); |
el17m2h | 4:8ec314f806ae | 19 | |
el17m2h | 7:0d9cee90ab0d | 20 | private: |
el17m2h | 16:e0542761fc8c | 21 | Bullet _b1; |
el17m2h | 16:e0542761fc8c | 22 | Bullet _b2; |
el17m2h | 16:e0542761fc8c | 23 | Bullet _b3; |
el17m2h | 16:e0542761fc8c | 24 | |
el17m2h | 14:529f798adae4 | 25 | Floors _f; |
el17m2h | 14:529f798adae4 | 26 | Floors _f1; |
el17m2h | 14:529f798adae4 | 27 | Floors _f2; |
el17m2h | 14:529f798adae4 | 28 | Floors _f3; |
el17m2h | 14:529f798adae4 | 29 | Floors _f4; |
el17m2h | 14:529f798adae4 | 30 | Floors _f5; |
el17m2h | 14:529f798adae4 | 31 | Floors _f6; |
el17m2h | 14:529f798adae4 | 32 | Floors _f7; |
el17m2h | 14:529f798adae4 | 33 | Floors _f8; |
el17m2h | 14:529f798adae4 | 34 | Floors _f9; |
el17m2h | 4:8ec314f806ae | 35 | |
el17m2h | 2:360a6c301a4e | 36 | int _floors_height; |
el17m2h | 2:360a6c301a4e | 37 | int _floors_width; |
el17m2h | 4:8ec314f806ae | 38 | |
el17m2h | 2:360a6c301a4e | 39 | // x and y positions of the floors |
el17m2h | 9:5e53bca2a4c2 | 40 | Vector2D _f_pos; |
el17m2h | 11:2041290b5a74 | 41 | Vector2D _f1_pos; |
el17m2h | 11:2041290b5a74 | 42 | Vector2D _f2_pos; |
el17m2h | 11:2041290b5a74 | 43 | Vector2D _f3_pos; |
el17m2h | 11:2041290b5a74 | 44 | Vector2D _f4_pos; |
el17m2h | 11:2041290b5a74 | 45 | Vector2D _f5_pos; |
el17m2h | 11:2041290b5a74 | 46 | Vector2D _f6_pos; |
el17m2h | 11:2041290b5a74 | 47 | Vector2D _f7_pos; |
el17m2h | 11:2041290b5a74 | 48 | Vector2D _f8_pos; |
el17m2h | 11:2041290b5a74 | 49 | Vector2D _f9_pos; |
el17m2h | 5:8814d6de77d0 | 50 | |
el17m2h | 5:8814d6de77d0 | 51 | Doodler _dood; |
el17m2h | 11:2041290b5a74 | 52 | int _doodler_radius; |
el17m2h | 11:2041290b5a74 | 53 | float _doodler_pos_x; |
el17m2h | 11:2041290b5a74 | 54 | float _doodler_pos_y; |
el17m2h | 11:2041290b5a74 | 55 | float _doodler_vel_x; |
el17m2h | 10:e1d2289705ef | 56 | double _doodler_vel_y; |
el17m2h | 5:8814d6de77d0 | 57 | |
el17m2h | 5:8814d6de77d0 | 58 | Direction _d; |
el17m2h | 5:8814d6de77d0 | 59 | float _mag; |
el17m2h | 16:e0542761fc8c | 60 | bool _button_A; |
el17m2h | 16:e0542761fc8c | 61 | bool _button_B; |
el17m2h | 16:e0542761fc8c | 62 | bool _button_X; |
el17m2h | 16:e0542761fc8c | 63 | bool _button_Y; |
el17m2h | 2:360a6c301a4e | 64 | }; |
el17m2h | 2:360a6c301a4e | 65 | #endif |