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
Bullet/Bullet.h@11:1eb7f53bd2ec, 2020-05-29 (annotated)
- Committer:
- ChenZirui
- Date:
- Fri May 29 04:12:32 2020 +0000
- Revision:
- 11:1eb7f53bd2ec
- Parent:
- 10:f5a48bbe07b8
- Child:
- 15:7ca2d1b2bd0e
not final
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ChenZirui | 5:7207c9b70108 | 1 | #ifndef Bullet_H |
| ChenZirui | 5:7207c9b70108 | 2 | #define Bullet_H |
| ChenZirui | 5:7207c9b70108 | 3 | |
| ChenZirui | 5:7207c9b70108 | 4 | #include "mbed.h" |
| ChenZirui | 5:7207c9b70108 | 5 | #include "N5110.h" |
| ChenZirui | 5:7207c9b70108 | 6 | #include "Gamepad.h" |
| ChenZirui | 5:7207c9b70108 | 7 | #include "Board.h" |
| ChenZirui | 5:7207c9b70108 | 8 | |
| ChenZirui | 5:7207c9b70108 | 9 | /** Bullet Class |
| ChenZirui | 7:f61ac963eb07 | 10 | @author Chen Zirui, University of Leeds |
| ChenZirui | 7:f61ac963eb07 | 11 | @brief Bullet data and its functions list,initialisation,drawing,updating,positing setting and speed reading |
| ChenZirui | 7:f61ac963eb07 | 12 | @date May 2020 |
| ChenZirui | 5:7207c9b70108 | 13 | */ |
| ChenZirui | 5:7207c9b70108 | 14 | class Bullet |
| ChenZirui | 5:7207c9b70108 | 15 | { |
| ChenZirui | 5:7207c9b70108 | 16 | |
| ChenZirui | 5:7207c9b70108 | 17 | public: |
| ChenZirui | 10:f5a48bbe07b8 | 18 | /**inialisation */ |
| ChenZirui | 7:f61ac963eb07 | 19 | void init(int x,int size,int speed,int height); //initial datas of bullet |
| ChenZirui | 11:1eb7f53bd2ec | 20 | /**draw a bullet*/ |
| ChenZirui | 11:1eb7f53bd2ec | 21 | void draw(N5110 &lcd); |
| ChenZirui | 11:1eb7f53bd2ec | 22 | /**update data*/ |
| ChenZirui | 11:1eb7f53bd2ec | 23 | void update(N5110 &lcd); //update bullet position |
| ChenZirui | 11:1eb7f53bd2ec | 24 | /** set velocity */ |
| ChenZirui | 11:1eb7f53bd2ec | 25 | void set_velocity(Vector2D v); |
| ChenZirui | 11:1eb7f53bd2ec | 26 | /**speed data reading */ |
| ChenZirui | 11:1eb7f53bd2ec | 27 | Vector2D get_velocity(); |
| ChenZirui | 11:1eb7f53bd2ec | 28 | /**position reading */ |
| ChenZirui | 11:1eb7f53bd2ec | 29 | Vector2D get_pos(); |
| ChenZirui | 11:1eb7f53bd2ec | 30 | /**position setting */ |
| ChenZirui | 11:1eb7f53bd2ec | 31 | void set_pos(Vector2D p); |
| ChenZirui | 5:7207c9b70108 | 32 | |
| ChenZirui | 5:7207c9b70108 | 33 | private: |
| ChenZirui | 7:f61ac963eb07 | 34 | // all parameters about bullet |
| ChenZirui | 5:7207c9b70108 | 35 | Vector2D _velocity; |
| ChenZirui | 5:7207c9b70108 | 36 | int _size; |
| ChenZirui | 5:7207c9b70108 | 37 | int _x; |
| ChenZirui | 5:7207c9b70108 | 38 | int _y; |
| ChenZirui | 7:f61ac963eb07 | 39 | float X; |
| ChenZirui | 7:f61ac963eb07 | 40 | float Y; |
| ChenZirui | 5:7207c9b70108 | 41 | |
| ChenZirui | 5:7207c9b70108 | 42 | }; |
| ChenZirui | 5:7207c9b70108 | 43 | #endif |