Laila Al Badwawi 200906179 SpaceInvaders I declare this my own independent work and understand the university rules on plagiarism.
Dependencies: mbed
Spaceship/Spaceship.h
- Committer:
- fy14lkaa
- Date:
- 2019-05-09
- Revision:
- 144:0473845a4aaa
- Parent:
- 138:66befaefb27e
- Child:
- 145:e060e890c725
File content as of revision 144:0473845a4aaa:
#ifndef SPACESHIP_H #define SPACESHIP_H #include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "Alien.h" #include "Bullet.h" 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,1,1,1,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0}, {0,0,0,0,1,1,1,1,0,0,1,0,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0}, {0,0,1,1,1,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,0}, {0,1,1,1,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,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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 { 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 setting 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); /** *@brief Gets the postion of the y-cooridante *@returns the position of the y-cooridante in integer which refer to the spaceship */ int get_pos_y(); int get_pos_x(); void read_input(Gamepad &pad); void add_score(); int get_score(); 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 _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