Li Ruofan 201199450
Dependencies: mbed Gamepad Joystick
Diff: shot/shot.h
- Revision:
- 3:cf9fead9c3f4
- Child:
- 6:cbd9e1f26a10
diff -r 5969f78a25ba -r cf9fead9c3f4 shot/shot.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/shot/shot.h Thu May 14 13:12:28 2020 +0000 @@ -0,0 +1,50 @@ +#ifndef BULLET_H +#define BULLET_H + +#include "mbed.h" +#include "N5110.h" +#include "Joystick.h" +#include "Bitmap.h" +/** Bullet Class +@brief Library for one of the objects bullet of star war, University of Leeds +@author Huang Xinjie +@date May 2019 +*/ + +class Bullet{ + +public: + /** Constructor */ + Bullet(); + + /** Destructor */ + ~Bullet(); + + /** Initialize the position and the size of the bullet + * @param the value of horizontal position x (int) + * @param the value of vertical position x (int) + * @param the number of columns of bullet image (int) + * @param the number of rows of bullet image (int) + */ + void init(int x,int y,int sizeX,int sizeY); + + /** draw the image of the bullet + * @param lcd (N5110) + */ + void draw(N5110 &lcd); //draw the bullet + + /** Update the position of the bullet */ + void update(); + + /** get the position of bullet in the lcd + * @return the current postion of bullet + */ + Vector2D getPos(); +private: + int _x; + int _y; + int _width; + int _height; + int _velocity; //default velocity is 3 +}; +#endif \ No newline at end of file