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
Eng.h@9:2836fc3d9ede, 2020-05-18 (annotated)
- Committer:
- el18jgb
- Date:
- Mon May 18 12:41:06 2020 +0000
- Revision:
- 9:2836fc3d9ede
- Parent:
- 8:0b9a824c75fe
- Child:
- 10:6c574b8524df
added falling spikes to be avoided;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el18jgb | 4:6f898b000797 | 1 | #ifndef ENG_H |
el18jgb | 4:6f898b000797 | 2 | #define ENG_H |
el18jgb | 4:6f898b000797 | 3 | |
el18jgb | 4:6f898b000797 | 4 | #include "mbed.h" |
el18jgb | 4:6f898b000797 | 5 | #include "N5110.h" |
el18jgb | 4:6f898b000797 | 6 | #include "Gamepad.h" |
el18jgb | 5:c37f4ed2cad3 | 7 | #include "Aim.h" |
el18jgb | 4:6f898b000797 | 8 | #include "Heston.h" |
el18jgb | 7:04a7826ff7e4 | 9 | #include "Pup.h" |
el18jgb | 9:2836fc3d9ede | 10 | #include "Spikes.h" |
el18jgb | 4:6f898b000797 | 11 | |
el18jgb | 4:6f898b000797 | 12 | // gap from edge of screen |
el18jgb | 4:6f898b000797 | 13 | #define GAP 2 |
el18jgb | 4:6f898b000797 | 14 | |
el18jgb | 4:6f898b000797 | 15 | class Eng |
el18jgb | 4:6f898b000797 | 16 | { |
el18jgb | 4:6f898b000797 | 17 | |
el18jgb | 4:6f898b000797 | 18 | public: |
el18jgb | 5:c37f4ed2cad3 | 19 | Eng(); |
el18jgb | 4:6f898b000797 | 20 | ~Eng(); |
el18jgb | 4:6f898b000797 | 21 | |
el18jgb | 4:6f898b000797 | 22 | void init(); |
el18jgb | 4:6f898b000797 | 23 | void read_input(Gamepad &pad); |
el18jgb | 8:0b9a824c75fe | 24 | void update(Gamepad &pad, int fire, N5110 &lcd); |
el18jgb | 4:6f898b000797 | 25 | void draw(N5110 &lcd); |
el18jgb | 4:6f898b000797 | 26 | |
el18jgb | 7:04a7826ff7e4 | 27 | void powerup(N5110 &lcd, Gamepad &pad); |
el18jgb | 8:0b9a824c75fe | 28 | void print_score(N5110 &lcd); |
el18jgb | 7:04a7826ff7e4 | 29 | |
el18jgb | 9:2836fc3d9ede | 30 | void check_s_hit(); |
el18jgb | 9:2836fc3d9ede | 31 | |
el18jgb | 7:04a7826ff7e4 | 32 | void tik(); |
el18jgb | 7:04a7826ff7e4 | 33 | |
el18jgb | 4:6f898b000797 | 34 | private: |
el18jgb | 4:6f898b000797 | 35 | |
el18jgb | 5:c37f4ed2cad3 | 36 | void check_hit(Gamepad &pad); |
el18jgb | 5:c37f4ed2cad3 | 37 | //void check_miss(Gamepad &pad); |
el18jgb | 5:c37f4ed2cad3 | 38 | //void print_scores(N5110 &lcd); |
el18jgb | 4:6f898b000797 | 39 | |
el18jgb | 4:6f898b000797 | 40 | Heston _h1; |
el18jgb | 5:c37f4ed2cad3 | 41 | //Heston _h2; |
el18jgb | 5:c37f4ed2cad3 | 42 | //Heston _h3; |
el18jgb | 4:6f898b000797 | 43 | |
el18jgb | 5:c37f4ed2cad3 | 44 | int _hest_width; |
el18jgb | 5:c37f4ed2cad3 | 45 | int _hest_height; |
el18jgb | 5:c37f4ed2cad3 | 46 | //int _ball_size; |
el18jgb | 5:c37f4ed2cad3 | 47 | //int _speed; |
el18jgb | 4:6f898b000797 | 48 | |
el18jgb | 4:6f898b000797 | 49 | // positions |
el18jgb | 4:6f898b000797 | 50 | int _h1x; |
el18jgb | 5:c37f4ed2cad3 | 51 | //int _h2x; |
el18jgb | 5:c37f4ed2cad3 | 52 | //int _h3x; |
el18jgb | 5:c37f4ed2cad3 | 53 | //int _h2y; |
el18jgb | 4:6f898b000797 | 54 | int _h1y; |
el18jgb | 5:c37f4ed2cad3 | 55 | //int _h3y; |
el18jgb | 4:6f898b000797 | 56 | |
el18jgb | 4:6f898b000797 | 57 | Aim _aim; |
el18jgb | 4:6f898b000797 | 58 | |
el18jgb | 7:04a7826ff7e4 | 59 | Pup _pup; |
el18jgb | 7:04a7826ff7e4 | 60 | |
el18jgb | 7:04a7826ff7e4 | 61 | int pupon; |
el18jgb | 7:04a7826ff7e4 | 62 | |
el18jgb | 4:6f898b000797 | 63 | Direction _d; |
el18jgb | 4:6f898b000797 | 64 | float _mag; |
el18jgb | 7:04a7826ff7e4 | 65 | |
el18jgb | 7:04a7826ff7e4 | 66 | int _tok; |
el18jgb | 7:04a7826ff7e4 | 67 | |
el18jgb | 7:04a7826ff7e4 | 68 | bool flag; |
el18jgb | 9:2836fc3d9ede | 69 | bool spike_f; |
el18jgb | 9:2836fc3d9ede | 70 | |
el18jgb | 9:2836fc3d9ede | 71 | Spikes _s1; |
el18jgb | 9:2836fc3d9ede | 72 | Spikes _s2; |
el18jgb | 4:6f898b000797 | 73 | |
el18jgb | 4:6f898b000797 | 74 | }; |
el18jgb | 4:6f898b000797 | 75 | |
el18jgb | 4:6f898b000797 | 76 | #endif |