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: spase_ship/space_ship.h
- Revision:
- 50:f538885a788b
- Parent:
- 49:5b797f126e5c
- Child:
- 51:cb644365d9a3
--- a/spase_ship/space_ship.h Sun Apr 21 14:59:07 2019 +0000 +++ b/spase_ship/space_ship.h Mon Apr 22 13:17:23 2019 +0000 @@ -8,30 +8,86 @@ #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(); //descontractor - space_ship(); - ~space_ship(); - void init(int x,int height,int width); - void draw(N5110 &lcd); - void update(Direction d,float mag); - void add_score(); - int get_score(); - Vector2D get_pos(); + +/*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.*/ + + + + 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 - int _height; - int _width; - int _x; - int _y; - int _speed; - int _score; +/*@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 @@ -66,5 +122,3 @@ - -#endif \ No newline at end of file