Laila Al Badwawi 200906179 SpaceInvaders I declare this my own independent work and understand the university rules on plagiarism.
Dependencies: mbed
Diff: Spaceship/Spaceship.h
- Revision:
- 133:eed60548d170
- Parent:
- 131:2084e4a8338f
--- a/Spaceship/Spaceship.h Mon May 06 14:35:54 2019 +0000 +++ b/Spaceship/Spaceship.h Wed May 08 18:54:03 2019 +0000 @@ -8,19 +8,47 @@ #include "Bullet.h" -/*int spaceship_2[10][12]= { - {0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,1,1,0,0,0,0,0,0,0}, - {0,0,0,1,1,0,0,0,0,0,0,0}, - {0,1,1,1,1,1,1,1,0,0,0,0}, - {0,1,1,1,1,1,1,1,1,0,0,0}, - {0,1,1,1,1,1,1,1,1,1,1,0}, - {0,1,1,1,1,1,1,1,1,0,0,0}, - {0,1,1,1,1,1,1,1,0,0,0,0}, - {0,0,0,1,1,0,0,0,0,0,0,0}, - {0,0,0,1,1,0,0,0,0,0,0,0}, + +const int spaceship2[32][32]= { + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,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,0,0,0}, + {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, }; + + + +/** Spaceship class +@brief class for spaceship +@version 1.0 +@author Laila Al Badwawi +@date April 2019 */ class Spaceship @@ -28,13 +56,44 @@ public: + /** constructors + *string Variables of this type are able to store sequences of characters, + *such as words or sentences. + */ + + + /*@constucter creat a defult a Spaceship + */ + Spaceship(); + + /** + *@constucter creat a defult a spaceship + */ ~Spaceship(); + /** + *@brief initialise an identity for the spaceship + *@param x_spaceship @details the x-cooridante of spaceship in intger + *@param y_spaceship @details the y-cooridante of spaceship in integer + *@param speed_spaceship @details the speed of spaceship in integer + */ void init(int x_spaceship,int y_spaceship, int speed_spaceship); + + /** + *@brief drawing the spaceship + *@param draw @details drawing the spaceship by using N5110&lcd librarieas + */ void draw(N5110 &lcd); + /** + *@brief updating the position of the spaceship + *@param update @details update the position of the spaceship. + */ void update(Direction d,float mag); + /**@brief sitting up the position the of the spaceship + *@param set_pos @details set the position the of the spaceship in x-cooridante and y-cooridante + */ void set_pos(int x, int y); int get_pos_y(); int get_pos_x(); @@ -45,13 +104,31 @@ private: - + /* + *@param (_x_spaceship) a private variable of class Spaceship that represents the x-cooridante of the spaceship + */ int _x_spaceship; + /* + *@param (_x_spaceship) a private variable of class spaceship that represents the x-cooridante of the spaceship + */ int _y_spaceship; + + /* + *@param (_speed_spaceship) declation of a variable private member which shows the speed of the spaceship. + */ + int _speed_spaceship; - - //int _score; + + int _spaceship2; + int _score; + + /*@param + (_direcation) a private variable of class spaceship that represents of spaceship + */ Direction d; + /*@param + (_mag) float a private variable of class spaceship that represents magnitude of the spaceship + */ float mag; }; #endif \ No newline at end of file