![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Li Ruofan 201199450
Dependencies: mbed Gamepad Joystick
shot/shot.h@3:cf9fead9c3f4, 2020-05-14 (annotated)
- Committer:
- DannyLee
- Date:
- Thu May 14 13:12:28 2020 +0000
- Revision:
- 3:cf9fead9c3f4
- Child:
- 6:cbd9e1f26a10
aaa
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DannyLee | 3:cf9fead9c3f4 | 1 | #ifndef BULLET_H |
DannyLee | 3:cf9fead9c3f4 | 2 | #define BULLET_H |
DannyLee | 3:cf9fead9c3f4 | 3 | |
DannyLee | 3:cf9fead9c3f4 | 4 | #include "mbed.h" |
DannyLee | 3:cf9fead9c3f4 | 5 | #include "N5110.h" |
DannyLee | 3:cf9fead9c3f4 | 6 | #include "Joystick.h" |
DannyLee | 3:cf9fead9c3f4 | 7 | #include "Bitmap.h" |
DannyLee | 3:cf9fead9c3f4 | 8 | /** Bullet Class |
DannyLee | 3:cf9fead9c3f4 | 9 | @brief Library for one of the objects bullet of star war, University of Leeds |
DannyLee | 3:cf9fead9c3f4 | 10 | @author Huang Xinjie |
DannyLee | 3:cf9fead9c3f4 | 11 | @date May 2019 |
DannyLee | 3:cf9fead9c3f4 | 12 | */ |
DannyLee | 3:cf9fead9c3f4 | 13 | |
DannyLee | 3:cf9fead9c3f4 | 14 | class Bullet{ |
DannyLee | 3:cf9fead9c3f4 | 15 | |
DannyLee | 3:cf9fead9c3f4 | 16 | public: |
DannyLee | 3:cf9fead9c3f4 | 17 | /** Constructor */ |
DannyLee | 3:cf9fead9c3f4 | 18 | Bullet(); |
DannyLee | 3:cf9fead9c3f4 | 19 | |
DannyLee | 3:cf9fead9c3f4 | 20 | /** Destructor */ |
DannyLee | 3:cf9fead9c3f4 | 21 | ~Bullet(); |
DannyLee | 3:cf9fead9c3f4 | 22 | |
DannyLee | 3:cf9fead9c3f4 | 23 | /** Initialize the position and the size of the bullet |
DannyLee | 3:cf9fead9c3f4 | 24 | * @param the value of horizontal position x (int) |
DannyLee | 3:cf9fead9c3f4 | 25 | * @param the value of vertical position x (int) |
DannyLee | 3:cf9fead9c3f4 | 26 | * @param the number of columns of bullet image (int) |
DannyLee | 3:cf9fead9c3f4 | 27 | * @param the number of rows of bullet image (int) |
DannyLee | 3:cf9fead9c3f4 | 28 | */ |
DannyLee | 3:cf9fead9c3f4 | 29 | void init(int x,int y,int sizeX,int sizeY); |
DannyLee | 3:cf9fead9c3f4 | 30 | |
DannyLee | 3:cf9fead9c3f4 | 31 | /** draw the image of the bullet |
DannyLee | 3:cf9fead9c3f4 | 32 | * @param lcd (N5110) |
DannyLee | 3:cf9fead9c3f4 | 33 | */ |
DannyLee | 3:cf9fead9c3f4 | 34 | void draw(N5110 &lcd); //draw the bullet |
DannyLee | 3:cf9fead9c3f4 | 35 | |
DannyLee | 3:cf9fead9c3f4 | 36 | /** Update the position of the bullet */ |
DannyLee | 3:cf9fead9c3f4 | 37 | void update(); |
DannyLee | 3:cf9fead9c3f4 | 38 | |
DannyLee | 3:cf9fead9c3f4 | 39 | /** get the position of bullet in the lcd |
DannyLee | 3:cf9fead9c3f4 | 40 | * @return the current postion of bullet |
DannyLee | 3:cf9fead9c3f4 | 41 | */ |
DannyLee | 3:cf9fead9c3f4 | 42 | Vector2D getPos(); |
DannyLee | 3:cf9fead9c3f4 | 43 | private: |
DannyLee | 3:cf9fead9c3f4 | 44 | int _x; |
DannyLee | 3:cf9fead9c3f4 | 45 | int _y; |
DannyLee | 3:cf9fead9c3f4 | 46 | int _width; |
DannyLee | 3:cf9fead9c3f4 | 47 | int _height; |
DannyLee | 3:cf9fead9c3f4 | 48 | int _velocity; //default velocity is 3 |
DannyLee | 3:cf9fead9c3f4 | 49 | }; |
DannyLee | 3:cf9fead9c3f4 | 50 | #endif |