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
shot/shot.h
- Committer:
- el19zf
- Date:
- 2020-05-14
- Revision:
- 13:eb60628db8bf
- Parent:
- 11:494cc44777fe
- Child:
- 15:3571beaaeed8
File content as of revision 13:eb60628db8bf:
#ifndef SHOT_H #define SHOT_H #include "mbed.h" #include "Gamepad.h" #include "N5110.h" #include <vector> #include <time.h> #include <stdlib.h> /** shot class @set several kinds of shot and come from all around @author Zeyu Feng @13 April 2020 */ /**struct of shot position type and direction*/ struct shot_posandtype { int x; int y; int type; int dir; }; class shot { public: /**constructor*/ shot(); /**destructor*/ ~shot(); /**generate first 10 shots*/ void init(); /**produce a random_pos(21,0)(42,0)(63,0)(21,45)(42,45)(63,45) *@param vector_i(shot_posandtype*) */ void init_pos(shot_posandtype* i); /**move shots in their own directions*/ void update(N5110 &lcd); /**generate shots as time goes on*/ void update_shot(); /**draw updated shots*/ void draw(N5110 &lcd); /**if beyoud border, delete it and generate new one, keep total number constant*/ void delete_shot(); /**control difficulty of game(size) *@param timerflag(int) *@param increment(float) *@param max(int) */ void gen_shot(int timer_flag, float increment, int max); /**accessors resize shots *@param size(int) */ void set_size(int size); /**mutators get size *@return current size */ int get_size(); private: std::vector<shot_posandtype> _p; int _size; float _size_f; }; #endif