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
Diff: spaceship/spaceship.h
- Revision:
- 103:cb05154d5025
- Parent:
- 93:ab36428d0152
- Child:
- 104:fe20457ef1a9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spaceship/spaceship.h Sun May 05 13:09:34 2019 +0000 @@ -0,0 +1,129 @@ +#ifndef SPACE_SHIP_H +#define SPACE_SHIP_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "SpaceInvadersEngine.h" +#include "Alien.h" +#include "bullet.h" + +/** space_ship class +@brief class for spaceship +@version 1.0 +@author Laila Al Badwawi +@date April 2019 +*/ + +class space_ship +{ + + 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 + */ + space_ship(); //constructor + + + ~space_ship(); //destructor + + +/*mutators + //mutator methods defined as methods which advice the users of the class + //to change the value of a member variable in a controlled manner. + Their names are usually pre-fixed with set_ to make this behaviour clear.*/ + + + /** + *@brief initialise an identity for the space_ship + *@param x @details the x-cooridante of space_shipin intger + *@param height @details the height of space_ship in integer + *@param width @details the widthof space_ship in integer + */ + + + + void init(int x,int height,int width); // a mutotor method used to set the following variables (x-cooridante, height and width). + void draw(N5110 &lcd); // a mutotor method used to set the the drawing variable to draw the space ship by using both N5110&lcd libraries. + void update(Direction d,float mag); // a mutotor method used to update the direction of the spaceship and its speed(magniutde). + void add_score(); // a mutotor method used to add the scores of the spaceship.everytime the buliet fires the alien so it inceased the number of scores by 1. + + + + + +/*accessors + An accessor method defined as methods which help users to read the value of a member variable. + Their names are usually prefixed with get_ to make this clearer to the user. + */ + + + int get_score(); // an accessor method used to return the number of tne scores. + Vector2D get_pos(); // an accessor method used to return the position of the spaceship in vector2D. + +private: +//member variables +//parameters + +/*@param +_height +*/ +int _height; // declation of a variable member _width which shows the height of the spaceship. + /*@param + _wedith +*/ + + int _width; // declation of a variable member _width which shows the width of the spaceship. + //@param + //_x + int _x; //declation of a variable member _width which shows the x-cooridante of the spaceship. + /*@param + _y +*/ + int _y; //declation of a variable member _width which shows the y-cooridante of the spaceship. + /*@param + _speed + */ + int _speed; // declation of a variable member _width which shows the speed of the spaceship. + /*@param + _score + */ + int _score; // declation of a variable member _width which shows the speed of the spaceship. + + +}; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +