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
bullet/bullet.h@52:84e89553c606, 2019-04-22 (annotated)
- Committer:
- fy14lkaa
- Date:
- Mon Apr 22 14:59:49 2019 +0000
- Revision:
- 52:84e89553c606
- Parent:
- 31:5c9309ddf84c
- Child:
- 53:db66345d6755
added comments to bullet.h to explain the public and private members of bullet class.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| fy14lkaa | 31:5c9309ddf84c | 1 | #ifndef BULLET_H |
| fy14lkaa | 31:5c9309ddf84c | 2 | #define BULLET_H |
| fy14lkaa | 31:5c9309ddf84c | 3 | |
| fy14lkaa | 31:5c9309ddf84c | 4 | |
| fy14lkaa | 21:5b953e368fba | 5 | #include "mbed.h" |
| fy14lkaa | 21:5b953e368fba | 6 | #include "N5110.h" |
| fy14lkaa | 21:5b953e368fba | 7 | #include "Gamepad.h" |
| fy14lkaa | 28:4786e81ce3e3 | 8 | #include "Alien.h" |
| fy14lkaa | 21:5b953e368fba | 9 | |
| fy14lkaa | 22:6d3c3f2715d0 | 10 | /** bullet Class |
| fy14lkaa | 22:6d3c3f2715d0 | 11 | @author Laila Al Badwawi, University of Leeds |
| fy14lkaa | 22:6d3c3f2715d0 | 12 | @brief Controls the bullet in the SpaceInvaders game |
| fy14lkaa | 22:6d3c3f2715d0 | 13 | @date April 2019 |
| fy14lkaa | 22:6d3c3f2715d0 | 14 | */ |
| fy14lkaa | 22:6d3c3f2715d0 | 15 | |
| fy14lkaa | 22:6d3c3f2715d0 | 16 | class bullet |
| fy14lkaa | 22:6d3c3f2715d0 | 17 | { |
| fy14lkaa | 22:6d3c3f2715d0 | 18 | |
| fy14lkaa | 22:6d3c3f2715d0 | 19 | public: |
| fy14lkaa | 52:84e89553c606 | 20 | // constructors |
| fy14lkaa | 52:84e89553c606 | 21 | //string Variables of this type are able to store sequences of characters, |
| fy14lkaa | 52:84e89553c606 | 22 | //such as words or sentences. |
| fy14lkaa | 52:84e89553c606 | 23 | /** |
| fy14lkaa | 52:84e89553c606 | 24 | *@constucter creat a defult bullet |
| fy14lkaa | 52:84e89553c606 | 25 | */ |
| fy14lkaa | 52:84e89553c606 | 26 | |
| fy14lkaa | 52:84e89553c606 | 27 | bullet(); //constructor |
| fy14lkaa | 52:84e89553c606 | 28 | ~bullet(); //destructor |
| fy14lkaa | 52:84e89553c606 | 29 | |
| fy14lkaa | 52:84e89553c606 | 30 | /*mutators |
| fy14lkaa | 52:84e89553c606 | 31 | //mutator methods defined as methods which advice the users of the class |
| fy14lkaa | 52:84e89553c606 | 32 | //to change the value of a member variable in a controlled manner. |
| fy14lkaa | 52:84e89553c606 | 33 | Their names are usually pre-fixed with set_ to make this behaviour clear.*/ |
| fy14lkaa | 52:84e89553c606 | 34 | |
| fy14lkaa | 52:84e89553c606 | 35 | /** |
| fy14lkaa | 52:84e89553c606 | 36 | *@brief initialise an identity for the bullet |
| fy14lkaa | 52:84e89553c606 | 37 | *@param size @details size of bullet in intger |
| fy14lkaa | 52:84e89553c606 | 38 | *@param speed @details the speed of bulletin integer |
| fy14lkaa | 52:84e89553c606 | 39 | */ |
| fy14lkaa | 52:84e89553c606 | 40 | void init(int size,int speed); |
| fy14lkaa | 52:84e89553c606 | 41 | /** |
| fy14lkaa | 52:84e89553c606 | 42 | *@brief drawing the bullet |
| fy14lkaa | 52:84e89553c606 | 43 | *@param draw @details drawing the bullet by using N5110&lcd librarieas |
| fy14lkaa | 52:84e89553c606 | 44 | **/ |
| fy14lkaa | 23:bfda24746bd4 | 45 | |
| fy14lkaa | 25:70c70192eae5 | 46 | void draw(N5110 &lcd); |
| fy14lkaa | 52:84e89553c606 | 47 | /** |
| fy14lkaa | 52:84e89553c606 | 48 | *@brief updating the position of the bullet |
| fy14lkaa | 52:84e89553c606 | 49 | *@param update @details update the position of the bullet. |
| fy14lkaa | 52:84e89553c606 | 50 | **/ |
| fy14lkaa | 26:2801e3268228 | 51 | void update(); |
| fy14lkaa | 52:84e89553c606 | 52 | |
| fy14lkaa | 52:84e89553c606 | 53 | /** |
| fy14lkaa | 52:84e89553c606 | 54 | *@brief sitting up the velocity the of the bullet |
| fy14lkaa | 52:84e89553c606 | 55 | *@param _velocity @details set the velocity the of the bullet in Vector2D |
| fy14lkaa | 52:84e89553c606 | 56 | **/ |
| fy14lkaa | 29:3cc490f4ffb9 | 57 | void set_velocity(Vector2D v); |
| fy14lkaa | 52:84e89553c606 | 58 | /** |
| fy14lkaa | 52:84e89553c606 | 59 | *@brief sitting up the position the of the bullet |
| fy14lkaa | 52:84e89553c606 | 60 | *@param _pos @details set the position the of the bullet in Vector2D |
| fy14lkaa | 52:84e89553c606 | 61 | **/ |
| fy14lkaa | 29:3cc490f4ffb9 | 62 | void set_pos(Vector2D p); |
| fy14lkaa | 52:84e89553c606 | 63 | |
| fy14lkaa | 52:84e89553c606 | 64 | /** |
| fy14lkaa | 52:84e89553c606 | 65 | *@brief sitting up the velocity the of the bullet |
| fy14lkaa | 52:84e89553c606 | 66 | *@return the velocity of the bullet in Vector2D |
| fy14lkaa | 52:84e89553c606 | 67 | **/ |
| fy14lkaa | 28:4786e81ce3e3 | 68 | Vector2D get_pos(); |
| fy14lkaa | 52:84e89553c606 | 69 | /** |
| fy14lkaa | 52:84e89553c606 | 70 | *@brief sitting up the position the of the bullet |
| fy14lkaa | 52:84e89553c606 | 71 | *@return the postion of the bullet in Vector2D |
| fy14lkaa | 52:84e89553c606 | 72 | **/ |
| fy14lkaa | 30:9688950d9f38 | 73 | Vector2D get_velocity(); |
| fy14lkaa | 30:9688950d9f38 | 74 | |
| fy14lkaa | 30:9688950d9f38 | 75 | private: |
| fy14lkaa | 30:9688950d9f38 | 76 | |
| fy14lkaa | 30:9688950d9f38 | 77 | Vector2D _velocity; |
| fy14lkaa | 30:9688950d9f38 | 78 | int _size; |
| fy14lkaa | 30:9688950d9f38 | 79 | int _x; |
| fy14lkaa | 30:9688950d9f38 | 80 | int _y; |
| fy14lkaa | 30:9688950d9f38 | 81 | }; |
| fy14lkaa | 30:9688950d9f38 | 82 | #endif |