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
shot/shot.h@4:b12a49f0b730, 2020-04-14 (annotated)
- Committer:
- el19zf
- Date:
- Tue Apr 14 05:47:23 2020 +0000
- Revision:
- 4:b12a49f0b730
- Child:
- 5:6774b7272e85
add a shot class to create a series of shots moving different directions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el19zf | 4:b12a49f0b730 | 1 | #ifndef SHOT_H |
el19zf | 4:b12a49f0b730 | 2 | #define SHOT_H |
el19zf | 4:b12a49f0b730 | 3 | |
el19zf | 4:b12a49f0b730 | 4 | #include "mbed.h" |
el19zf | 4:b12a49f0b730 | 5 | #include "Gamepad.h" |
el19zf | 4:b12a49f0b730 | 6 | #include "N5110.h" |
el19zf | 4:b12a49f0b730 | 7 | #include <vector> |
el19zf | 4:b12a49f0b730 | 8 | |
el19zf | 4:b12a49f0b730 | 9 | /** shot class |
el19zf | 4:b12a49f0b730 | 10 | @set several kinds of shot and come from all around |
el19zf | 4:b12a49f0b730 | 11 | @author Zeyu Feng |
el19zf | 4:b12a49f0b730 | 12 | @13 April 2020 |
el19zf | 4:b12a49f0b730 | 13 | */ |
el19zf | 4:b12a49f0b730 | 14 | |
el19zf | 4:b12a49f0b730 | 15 | class shot { |
el19zf | 4:b12a49f0b730 | 16 | |
el19zf | 4:b12a49f0b730 | 17 | public: |
el19zf | 4:b12a49f0b730 | 18 | //constructor |
el19zf | 4:b12a49f0b730 | 19 | shot(); |
el19zf | 4:b12a49f0b730 | 20 | //destructor |
el19zf | 4:b12a49f0b730 | 21 | ~shot(); |
el19zf | 4:b12a49f0b730 | 22 | |
el19zf | 4:b12a49f0b730 | 23 | void init(); |
el19zf | 4:b12a49f0b730 | 24 | |
el19zf | 4:b12a49f0b730 | 25 | int rand_dir();//random direction of shot |
el19zf | 4:b12a49f0b730 | 26 | |
el19zf | 4:b12a49f0b730 | 27 | int rand_type();//give a random number from 0 - 3 |
el19zf | 4:b12a49f0b730 | 28 | |
el19zf | 4:b12a49f0b730 | 29 | void gen_shot();//3 types direction |
el19zf | 4:b12a49f0b730 | 30 | |
el19zf | 4:b12a49f0b730 | 31 | void shot_move(); |
el19zf | 4:b12a49f0b730 | 32 | |
el19zf | 4:b12a49f0b730 | 33 | void draw(N5110 &lcd); |
el19zf | 4:b12a49f0b730 | 34 | |
el19zf | 4:b12a49f0b730 | 35 | |
el19zf | 4:b12a49f0b730 | 36 | private: |
el19zf | 4:b12a49f0b730 | 37 | |
el19zf | 4:b12a49f0b730 | 38 | std::vector<Vector2D> _p; |
el19zf | 4:b12a49f0b730 | 39 | |
el19zf | 4:b12a49f0b730 | 40 | |
el19zf | 4:b12a49f0b730 | 41 | |
el19zf | 4:b12a49f0b730 | 42 | }; |
el19zf | 4:b12a49f0b730 | 43 | #endif |
el19zf | 4:b12a49f0b730 | 44 | |
el19zf | 4:b12a49f0b730 | 45 | |
el19zf | 4:b12a49f0b730 | 46 | |
el19zf | 4:b12a49f0b730 | 47 |