Yang Hongxiao 201199678
Dependencies: mbed
Bullet.h@1:a6ead8050c23, 2020-05-14 (annotated)
- Committer:
- YHX
- Date:
- Thu May 14 17:00:34 2020 +0000
- Revision:
- 1:a6ead8050c23
Yang Hongxiao; el17hy; 201199678
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
YHX | 1:a6ead8050c23 | 1 | #ifndef BULLET_H |
YHX | 1:a6ead8050c23 | 2 | #define BULLET_H |
YHX | 1:a6ead8050c23 | 3 | |
YHX | 1:a6ead8050c23 | 4 | #include "mbed.h" |
YHX | 1:a6ead8050c23 | 5 | #include "N5110.h" |
YHX | 1:a6ead8050c23 | 6 | #include "Gamepad.h" |
YHX | 1:a6ead8050c23 | 7 | #include "Platform.h" |
YHX | 1:a6ead8050c23 | 8 | /** The bullet Class |
YHX | 1:a6ead8050c23 | 9 | * @brief This program define the bullets |
YHX | 1:a6ead8050c23 | 10 | * @author Yang Hongxiao |
YHX | 1:a6ead8050c23 | 11 | * @date 15/5/2020 |
YHX | 1:a6ead8050c23 | 12 | */ |
YHX | 1:a6ead8050c23 | 13 | |
YHX | 1:a6ead8050c23 | 14 | class Bullet |
YHX | 1:a6ead8050c23 | 15 | { |
YHX | 1:a6ead8050c23 | 16 | |
YHX | 1:a6ead8050c23 | 17 | public: |
YHX | 1:a6ead8050c23 | 18 | /** Constructor */ |
YHX | 1:a6ead8050c23 | 19 | Bullet(); |
YHX | 1:a6ead8050c23 | 20 | /** Destructor */ |
YHX | 1:a6ead8050c23 | 21 | ~Bullet(); |
YHX | 1:a6ead8050c23 | 22 | /** Set the inital value |
YHX | 1:a6ead8050c23 | 23 | * @param the value of the bullet size (int r),the value of the bullet speed (int vv), |
YHX | 1:a6ead8050c23 | 24 | */ |
YHX | 1:a6ead8050c23 | 25 | void init(int r,int vv); |
YHX | 1:a6ead8050c23 | 26 | /** draw the bullet |
YHX | 1:a6ead8050c23 | 27 | * @param the screen(N5110 &lcd) |
YHX | 1:a6ead8050c23 | 28 | */ |
YHX | 1:a6ead8050c23 | 29 | void draw(N5110 &lcd); |
YHX | 1:a6ead8050c23 | 30 | /** Set the update value |
YHX | 1:a6ead8050c23 | 31 | * @param none |
YHX | 1:a6ead8050c23 | 32 | */ |
YHX | 1:a6ead8050c23 | 33 | void update(); |
YHX | 1:a6ead8050c23 | 34 | /** Set the velocity value |
YHX | 1:a6ead8050c23 | 35 | * @param the velocity(Vector2D v) |
YHX | 1:a6ead8050c23 | 36 | */ |
YHX | 1:a6ead8050c23 | 37 | void set_velocity(Vector2D v); |
YHX | 1:a6ead8050c23 | 38 | /** Get the velocity |
YHX | 1:a6ead8050c23 | 39 | * @return the current velocity |
YHX | 1:a6ead8050c23 | 40 | */ |
YHX | 1:a6ead8050c23 | 41 | Vector2D get_velocity(); |
YHX | 1:a6ead8050c23 | 42 | /** Get the position |
YHX | 1:a6ead8050c23 | 43 | * @return the current position |
YHX | 1:a6ead8050c23 | 44 | */ |
YHX | 1:a6ead8050c23 | 45 | Vector2D get_pos(); |
YHX | 1:a6ead8050c23 | 46 | /** Set the position value |
YHX | 1:a6ead8050c23 | 47 | * @param the position(Vector2D p) |
YHX | 1:a6ead8050c23 | 48 | */ |
YHX | 1:a6ead8050c23 | 49 | void set_pos(Vector2D p); |
YHX | 1:a6ead8050c23 | 50 | |
YHX | 1:a6ead8050c23 | 51 | private: |
YHX | 1:a6ead8050c23 | 52 | |
YHX | 1:a6ead8050c23 | 53 | Vector2D _velocity; |
YHX | 1:a6ead8050c23 | 54 | int _r; |
YHX | 1:a6ead8050c23 | 55 | int _x; |
YHX | 1:a6ead8050c23 | 56 | int _y; |
YHX | 1:a6ead8050c23 | 57 | }; |
YHX | 1:a6ead8050c23 | 58 | #endif |