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@7:f61ac963eb07, 2020-05-29 (annotated)
- Committer:
- ChenZirui
- Date:
- Fri May 29 02:55:37 2020 +0000
- Revision:
- 7:f61ac963eb07
- Parent:
- 6:b393cfe4e0a7
- Child:
- 10:f5a48bbe07b8
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 | 7:f61ac963eb07 | 18 | |
ChenZirui | 7:f61ac963eb07 | 19 | void init(int x,int size,int speed,int height); //initial datas of bullet |
ChenZirui | 7:f61ac963eb07 | 20 | void draw(N5110 &lcd); //draw a bullet |
ChenZirui | 7:f61ac963eb07 | 21 | void update(N5110 &lcd); //ubdate bullet position |
ChenZirui | 7:f61ac963eb07 | 22 | void set_velocity(Vector2D v); //velocity setting |
ChenZirui | 7:f61ac963eb07 | 23 | Vector2D get_velocity(); //speed data reading |
ChenZirui | 7:f61ac963eb07 | 24 | Vector2D get_pos(); //position reading |
ChenZirui | 7:f61ac963eb07 | 25 | void set_pos(Vector2D p); //position setting |
ChenZirui | 5:7207c9b70108 | 26 | |
ChenZirui | 5:7207c9b70108 | 27 | private: |
ChenZirui | 7:f61ac963eb07 | 28 | // all parameters about bullet |
ChenZirui | 5:7207c9b70108 | 29 | Vector2D _velocity; |
ChenZirui | 5:7207c9b70108 | 30 | int _size; |
ChenZirui | 5:7207c9b70108 | 31 | int _x; |
ChenZirui | 5:7207c9b70108 | 32 | int _y; |
ChenZirui | 7:f61ac963eb07 | 33 | float X; |
ChenZirui | 7:f61ac963eb07 | 34 | float Y; |
ChenZirui | 5:7207c9b70108 | 35 | |
ChenZirui | 5:7207c9b70108 | 36 | }; |
ChenZirui | 5:7207c9b70108 | 37 | #endif |