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@54:095eae44895b, 2019-04-26 (annotated)
- Committer:
- fy14lkaa
- Date:
- Fri Apr 26 00:19:57 2019 +0000
- Revision:
- 54:095eae44895b
- Parent:
- 53:db66345d6755
added a private variable in SpaceInvaders.h (Alien _A1;) for SpaceInvaders 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 | 54:095eae44895b | 12 | @brief Controls the bullet in the SpaceInvaders game |
| fy14lkaa | 22:6d3c3f2715d0 | 13 | @date April 2019 |
| fy14lkaa | 54:095eae44895b | 14 | */ |
| fy14lkaa | 22:6d3c3f2715d0 | 15 | |
| fy14lkaa | 54:095eae44895b | 16 | class bullet |
| fy14lkaa | 22:6d3c3f2715d0 | 17 | { |
| fy14lkaa | 22:6d3c3f2715d0 | 18 | |
| fy14lkaa | 22:6d3c3f2715d0 | 19 | public: |
| fy14lkaa | 52:84e89553c606 | 20 | // constructors |
| fy14lkaa | 54:095eae44895b | 21 | //string Variables of this type are able to store sequences of characters, |
| fy14lkaa | 54:095eae44895b | 22 | //such as words or sentences. |
| fy14lkaa | 54:095eae44895b | 23 | /** |
| fy14lkaa | 54:095eae44895b | 24 | *@constucter creat a defult bullet |
| fy14lkaa | 54:095eae44895b | 25 | */ |
| fy14lkaa | 54:095eae44895b | 26 | |
| fy14lkaa | 54:095eae44895b | 27 | bullet(); //constructor |
| fy14lkaa | 54:095eae44895b | 28 | ~bullet(); //destructor |
| fy14lkaa | 54:095eae44895b | 29 | |
| fy14lkaa | 54:095eae44895b | 30 | /*mutators |
| fy14lkaa | 54:095eae44895b | 31 | //mutator methods defined as methods which advice the users of the class |
| fy14lkaa | 54:095eae44895b | 32 | //to change the value of a member variable in a controlled manner. |
| fy14lkaa | 54:095eae44895b | 33 | Their names are usually pre-fixed with set_ to make this behaviour clear.*/ |
| fy14lkaa | 54:095eae44895b | 34 | |
| fy14lkaa | 54:095eae44895b | 35 | /** |
| fy14lkaa | 54:095eae44895b | 36 | *@brief initialise an identity for the bullet |
| fy14lkaa | 54:095eae44895b | 37 | *@param size @details size of bullet in intger |
| fy14lkaa | 54:095eae44895b | 38 | *@param speed @details the speed of bulletin integer |
| fy14lkaa | 54:095eae44895b | 39 | */ |
| fy14lkaa | 52:84e89553c606 | 40 | void init(int size,int speed); |
| fy14lkaa | 54:095eae44895b | 41 | /** |
| fy14lkaa | 54:095eae44895b | 42 | *@brief drawing the bullet |
| fy14lkaa | 54:095eae44895b | 43 | *@param draw @details drawing the bullet by using N5110&lcd librarieas |
| fy14lkaa | 54:095eae44895b | 44 | **/ |
| fy14lkaa | 54:095eae44895b | 45 | |
| fy14lkaa | 25:70c70192eae5 | 46 | void draw(N5110 &lcd); |
| fy14lkaa | 54:095eae44895b | 47 | /** |
| fy14lkaa | 54:095eae44895b | 48 | *@brief updating the position of the bullet |
| fy14lkaa | 54:095eae44895b | 49 | *@param update @details update the position of the bullet. |
| fy14lkaa | 54:095eae44895b | 50 | **/ |
| fy14lkaa | 54:095eae44895b | 51 | void update(); |
| fy14lkaa | 54:095eae44895b | 52 | |
| fy14lkaa | 54:095eae44895b | 53 | /** |
| fy14lkaa | 54:095eae44895b | 54 | *@brief sitting up the velocity the of the bullet |
| fy14lkaa | 54:095eae44895b | 55 | *@param _velocity @details set the velocity the of the bullet in Vector2D |
| fy14lkaa | 54:095eae44895b | 56 | **/ |
| fy14lkaa | 29:3cc490f4ffb9 | 57 | void set_velocity(Vector2D v); |
| fy14lkaa | 54:095eae44895b | 58 | /** |
| fy14lkaa | 54:095eae44895b | 59 | *@brief sitting up the position the of the bullet |
| fy14lkaa | 54:095eae44895b | 60 | *@param _pos @details set the position the of the bullet in Vector2D |
| fy14lkaa | 54:095eae44895b | 61 | **/ |
| fy14lkaa | 29:3cc490f4ffb9 | 62 | void set_pos(Vector2D p); |
| fy14lkaa | 54:095eae44895b | 63 | |
| fy14lkaa | 54:095eae44895b | 64 | /** |
| fy14lkaa | 54:095eae44895b | 65 | *@brief sitting up the velocity the of the bullet |
| fy14lkaa | 54:095eae44895b | 66 | *@return the velocity of the bullet in Vector2D |
| fy14lkaa | 54:095eae44895b | 67 | **/ |
| fy14lkaa | 54:095eae44895b | 68 | Vector2D get_pos(); |
| fy14lkaa | 54:095eae44895b | 69 | /** |
| fy14lkaa | 54:095eae44895b | 70 | *@brief sitting up the position the of the bullet |
| fy14lkaa | 54:095eae44895b | 71 | *@return the postion of the bullet in Vector2D |
| fy14lkaa | 54:095eae44895b | 72 | **/ |
| fy14lkaa | 54:095eae44895b | 73 | Vector2D get_velocity(); |
| fy14lkaa | 30:9688950d9f38 | 74 | |
| fy14lkaa | 54:095eae44895b | 75 | private: |
| fy14lkaa | 54:095eae44895b | 76 | //member variables |
| fy14lkaa | 54:095eae44895b | 77 | //parameters |
| fy14lkaa | 54:095eae44895b | 78 | |
| fy14lkaa | 54:095eae44895b | 79 | /*@param |
| fy14lkaa | 54:095eae44895b | 80 | _velocity |
| fy14lkaa | 54:095eae44895b | 81 | */ |
| fy14lkaa | 53:db66345d6755 | 82 | Vector2D _velocity; // declation of a variable member _velocity which shows the velocity of the Alien in Vector2D. |
| fy14lkaa | 54:095eae44895b | 83 | /*@param |
| fy14lkaa | 54:095eae44895b | 84 | _size |
| fy14lkaa | 54:095eae44895b | 85 | */ |
| fy14lkaa | 53:db66345d6755 | 86 | int _size; // declation of a variable member _size which shows the size of the Alien. |
| fy14lkaa | 54:095eae44895b | 87 | /*@param |
| fy14lkaa | 54:095eae44895b | 88 | _x |
| fy14lkaa | 54:095eae44895b | 89 | */ |
| fy14lkaa | 54:095eae44895b | 90 | |
| fy14lkaa | 53:db66345d6755 | 91 | int _x; ////declation of a variable member _x which shows the x-cooridante of the Alien. |
| fy14lkaa | 53:db66345d6755 | 92 | /*@param |
| fy14lkaa | 54:095eae44895b | 93 | _y |
| fy14lkaa | 54:095eae44895b | 94 | */ |
| fy14lkaa | 53:db66345d6755 | 95 | int _y; //declation of a variable member _y which shows the y-cooridante of the Alien. |
| fy14lkaa | 53:db66345d6755 | 96 | |
| fy14lkaa | 30:9688950d9f38 | 97 | }; |
| fy14lkaa | 30:9688950d9f38 | 98 | #endif |