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:
- 104:fe20457ef1a9
- Parent:
- 103:cb05154d5025
--- a/spaceship/spaceship.h Sun May 05 13:09:34 2019 +0000 +++ b/spaceship/spaceship.h Sun May 05 13:13:55 2019 +0000 @@ -1,129 +1,57 @@ -#ifndef SPACE_SHIP_H -#define SPACE_SHIP_H +#ifndef SPACESHIP_H +#define SPACESHIP_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 +#include "Bullet.h" -/*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 - */ +/*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}, +}; +*/ + +class Spaceship +{ + +public: + + Spaceship(); + ~Spaceship(); - 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. - - - - + void init(int x_spaceship,int y_spaceship, int speed_spaceship); + void draw(N5110 &lcd); + void update(Direction d,float mag); + void set_pos(int x, int y); + int get_pos_y(); + int get_pos_x(); + //void read_input(Gamepad &pad); + //void add_score(); + //int get_score(); -/*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. - - -}; + + int _x_spaceship; + int _y_spaceship; + int _speed_spaceship; -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + //int _score; + Direction d; + float mag; +}; +#endif \ No newline at end of file