Laila Al Badwawi 200906179 SpaceInvaders I declare this my own independent work and understand the university rules on plagiarism.
Dependencies: mbed
Diff: Alien/Alien.h
- Revision:
- 133:eed60548d170
- Parent:
- 130:4ce67451d0c1
- Child:
- 137:fe80c0f2da9d
--- a/Alien/Alien.h Mon May 06 14:35:54 2019 +0000 +++ b/Alien/Alien.h Wed May 08 18:54:03 2019 +0000 @@ -1,34 +1,138 @@ #ifndef Alien_H #define Alien_H - - #include "mbed.h" #include "Gamepad.h" #include "N5110.h" -#include "Bullet.h" + + + + + + +const int alien2[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,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,1,1,1,1,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,1,1,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,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,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0}, + {1,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0}, + {0,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0}, + {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0}, + {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,1,1,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,1,0,0,0,1,1,1,1,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}, + {1,1,0,0,0,1,1,0,0,0,0,1,1,0,0,0,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,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, +}; + +/** Alien class +@brief class for Alien +@version 1.0 +@author Laila Al Badwawi +@date April 2019 +*/ class Alien { public: Alien(); ~Alien(); + /** + *@brief initialise an identity for the Alien + *@param x_alien @details the x-cooridante of Alien in intger + *@param y_alien @details the y-cooridante of Alien in integer + *@param speed_alien @details the speed of Alien in integer + */ void init(int x_alien,int y_alien, int speed_alien); + /** + *@brief drawing the Alien + *@param draw @details drawing the Alien by using N5110&lcd librarieas + */ void draw(N5110 &lcd); + /** + *@brief updating the position of the Alien + *@param update @details update the position of the Alien. + */ void update(Direction d,float mag); + + + + void set_pos(int x, int y); + + int get_pos_y(); + int get_pos_x(); + void add_score(); + int get_score(); + void read_input(Gamepad &pad); + bool isAlive(); + void setAlive(bool alive); + private: + /**member variables + parameters of Alien's class + */ + /* + *@param (_x_alien) a private variable of class Alien that represents the x-cooridante of the alien + */ int _x_alien; - //int _alien[12][10]; + + /* + *@param (_y_alien)a private variable of class Alien that represents the y-cooridante of the alien + */ + int _y_alien; + int _alien2; + /* + *@param (_speed_alien)a private variable of class Alien that represents the speed of the alien + + */ int _speed_alien; - //int _hit_enemy; + + /*@param + (_score) a private variable of class Alien that representsn by alien + */ + int _score; + + /*@param + (_alive) a private variable of class Alien that represents the Alive alien + */ + + bool _alive; + + /*@param + (_direcation) a private variable of class Alien that represents of alien + */ Direction d; + + /*@param + (_mag) float a private variable of class Alien that represents magnitude of the alien + */ float mag; }; #endif \ No newline at end of file