Laila Al Badwawi 200906179 SpaceInvaders I declare this my own independent work and understand the university rules on plagiarism.
Dependencies: mbed
Alien/Alien.h@51:cb644365d9a3, 2019-04-22 (annotated)
- Committer:
- fy14lkaa
- Date:
- Mon Apr 22 14:27:24 2019 +0000
- Revision:
- 51:cb644365d9a3
- Parent:
- 28:4786e81ce3e3
- Child:
- 52:84e89553c606
added comments on Alien.h to explain the public and private member of the class Alien.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fy14lkaa | 28:4786e81ce3e3 | 1 | #ifndef Alien_H |
fy14lkaa | 28:4786e81ce3e3 | 2 | #define Alien_H |
fy14lkaa | 28:4786e81ce3e3 | 3 | |
fy14lkaa | 28:4786e81ce3e3 | 4 | |
fy14lkaa | 28:4786e81ce3e3 | 5 | |
fy14lkaa | 28:4786e81ce3e3 | 6 | #include "mbed.h" |
fy14lkaa | 28:4786e81ce3e3 | 7 | #include "Gamepad.h" |
fy14lkaa | 28:4786e81ce3e3 | 8 | #include "N5110.h" |
fy14lkaa | 28:4786e81ce3e3 | 9 | #include "SpaceInvadersEngine.h" |
fy14lkaa | 28:4786e81ce3e3 | 10 | |
fy14lkaa | 51:cb644365d9a3 | 11 | /** Alien class |
fy14lkaa | 51:cb644365d9a3 | 12 | @brief class for spaceship |
fy14lkaa | 51:cb644365d9a3 | 13 | @version 1.0 |
fy14lkaa | 51:cb644365d9a3 | 14 | @author Laila Al Badwawi |
fy14lkaa | 51:cb644365d9a3 | 15 | @date April 2019 |
fy14lkaa | 51:cb644365d9a3 | 16 | */ |
fy14lkaa | 28:4786e81ce3e3 | 17 | |
fy14lkaa | 28:4786e81ce3e3 | 18 | class Alien |
fy14lkaa | 28:4786e81ce3e3 | 19 | { |
fy14lkaa | 28:4786e81ce3e3 | 20 | public: |
fy14lkaa | 51:cb644365d9a3 | 21 | // constructors |
fy14lkaa | 51:cb644365d9a3 | 22 | //string Variables of this type are able to store sequences of characters, |
fy14lkaa | 51:cb644365d9a3 | 23 | //such as words or sentences. |
fy14lkaa | 51:cb644365d9a3 | 24 | /** |
fy14lkaa | 51:cb644365d9a3 | 25 | *@constucter creat a defult Alien |
fy14lkaa | 51:cb644365d9a3 | 26 | */ |
fy14lkaa | 51:cb644365d9a3 | 27 | |
fy14lkaa | 51:cb644365d9a3 | 28 | |
fy14lkaa | 51:cb644365d9a3 | 29 | Alien(); //constructor |
fy14lkaa | 51:cb644365d9a3 | 30 | |
fy14lkaa | 51:cb644365d9a3 | 31 | ~Alien(); //descontractor |
fy14lkaa | 28:4786e81ce3e3 | 32 | |
fy14lkaa | 51:cb644365d9a3 | 33 | |
fy14lkaa | 51:cb644365d9a3 | 34 | /*mutators |
fy14lkaa | 51:cb644365d9a3 | 35 | //mutator methods defined as methods which advice the users of the class |
fy14lkaa | 51:cb644365d9a3 | 36 | //to change the value of a member variable in a controlled manner. |
fy14lkaa | 51:cb644365d9a3 | 37 | Their names are usually pre-fixed with set_ to make this behaviour clear.*/ |
fy14lkaa | 51:cb644365d9a3 | 38 | |
fy14lkaa | 51:cb644365d9a3 | 39 | /** |
fy14lkaa | 51:cb644365d9a3 | 40 | *@brief initialise an identity for the Alien |
fy14lkaa | 51:cb644365d9a3 | 41 | *@param size @details size of Alien in intger |
fy14lkaa | 51:cb644365d9a3 | 42 | *@param speed @details the speed of Alien in integer |
fy14lkaa | 51:cb644365d9a3 | 43 | */ |
fy14lkaa | 28:4786e81ce3e3 | 44 | void init(int size,int speed); |
fy14lkaa | 51:cb644365d9a3 | 45 | /** |
fy14lkaa | 51:cb644365d9a3 | 46 | *@brief drawing the Alien |
fy14lkaa | 51:cb644365d9a3 | 47 | *@param draw @details drawing the Alien by using N5110&lcd librarieas |
fy14lkaa | 51:cb644365d9a3 | 48 | **/ |
fy14lkaa | 51:cb644365d9a3 | 49 | |
fy14lkaa | 28:4786e81ce3e3 | 50 | void draw(N5110 &lcd); |
fy14lkaa | 51:cb644365d9a3 | 51 | |
fy14lkaa | 51:cb644365d9a3 | 52 | /** |
fy14lkaa | 51:cb644365d9a3 | 53 | *@brief updating the position of the Alien |
fy14lkaa | 51:cb644365d9a3 | 54 | *@param update @details update the position of the Alien. |
fy14lkaa | 51:cb644365d9a3 | 55 | **/ |
fy14lkaa | 28:4786e81ce3e3 | 56 | void update(); |
fy14lkaa | 51:cb644365d9a3 | 57 | |
fy14lkaa | 51:cb644365d9a3 | 58 | /** |
fy14lkaa | 51:cb644365d9a3 | 59 | *@brief sitting up the velocity the of the Alien |
fy14lkaa | 51:cb644365d9a3 | 60 | *@param _velocity @details set the velocity the of the Alien in Vector2D |
fy14lkaa | 51:cb644365d9a3 | 61 | **/ |
fy14lkaa | 51:cb644365d9a3 | 62 | |
fy14lkaa | 28:4786e81ce3e3 | 63 | void set_velocity(Vector2D v); |
fy14lkaa | 51:cb644365d9a3 | 64 | |
fy14lkaa | 51:cb644365d9a3 | 65 | /** |
fy14lkaa | 51:cb644365d9a3 | 66 | *@brief sitting up the position the of the Alien |
fy14lkaa | 51:cb644365d9a3 | 67 | *@param _pos @details set the position the of the Alien in Vector2D |
fy14lkaa | 51:cb644365d9a3 | 68 | **/ |
fy14lkaa | 51:cb644365d9a3 | 69 | void set_pos(Vector2D p); |
fy14lkaa | 51:cb644365d9a3 | 70 | /** |
fy14lkaa | 51:cb644365d9a3 | 71 | *@brief sitting up the velocity the of the Alien |
fy14lkaa | 51:cb644365d9a3 | 72 | *@return the velocity of the Alien in Vector2D |
fy14lkaa | 51:cb644365d9a3 | 73 | **/ |
fy14lkaa | 51:cb644365d9a3 | 74 | |
fy14lkaa | 28:4786e81ce3e3 | 75 | Vector2D get_velocity(); |
fy14lkaa | 51:cb644365d9a3 | 76 | /** |
fy14lkaa | 51:cb644365d9a3 | 77 | *@brief sitting up the position the of the Alien |
fy14lkaa | 51:cb644365d9a3 | 78 | *@return the postion of the Alien in Vector2D |
fy14lkaa | 51:cb644365d9a3 | 79 | **/ |
fy14lkaa | 51:cb644365d9a3 | 80 | |
fy14lkaa | 28:4786e81ce3e3 | 81 | Vector2D get_pos(); |
fy14lkaa | 51:cb644365d9a3 | 82 | |
fy14lkaa | 28:4786e81ce3e3 | 83 | private: |
fy14lkaa | 51:cb644365d9a3 | 84 | //member variables |
fy14lkaa | 51:cb644365d9a3 | 85 | //parameters |
fy14lkaa | 28:4786e81ce3e3 | 86 | |
fy14lkaa | 51:cb644365d9a3 | 87 | /*@param |
fy14lkaa | 51:cb644365d9a3 | 88 | _velocity |
fy14lkaa | 51:cb644365d9a3 | 89 | */ |
fy14lkaa | 51:cb644365d9a3 | 90 | Vector2D _velocity; // declation of a variable member _velocity which shows the velocity of the Alien in Vector2D. |
fy14lkaa | 51:cb644365d9a3 | 91 | /*@param |
fy14lkaa | 51:cb644365d9a3 | 92 | _size |
fy14lkaa | 51:cb644365d9a3 | 93 | */ |
fy14lkaa | 51:cb644365d9a3 | 94 | int _size; // declation of a variable member _size which shows the size of the Alien. |
fy14lkaa | 51:cb644365d9a3 | 95 | /*@param |
fy14lkaa | 51:cb644365d9a3 | 96 | _x |
fy14lkaa | 51:cb644365d9a3 | 97 | */ |
fy14lkaa | 51:cb644365d9a3 | 98 | |
fy14lkaa | 51:cb644365d9a3 | 99 | int _x; ////declation of a variable member _x which shows the x-cooridante of the Alien. |
fy14lkaa | 51:cb644365d9a3 | 100 | |
fy14lkaa | 51:cb644365d9a3 | 101 | /*@param |
fy14lkaa | 51:cb644365d9a3 | 102 | _y |
fy14lkaa | 51:cb644365d9a3 | 103 | */ |
fy14lkaa | 51:cb644365d9a3 | 104 | int _y; //declation of a variable member _y which shows the y-cooridante of the Alien. |
fy14lkaa | 28:4786e81ce3e3 | 105 | }; |
fy14lkaa | 28:4786e81ce3e3 | 106 | #endif |