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.
Objects/Objects.h@15:807eba7c7811, 2019-05-07 (annotated)
- Committer:
- ll16o2l
- Date:
- Tue May 07 18:01:54 2019 +0000
- Revision:
- 15:807eba7c7811
- Parent:
- 8:c3153fd4d8ce
Re-organised the documentation and finished the project.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ll16o2l | 2:888634fff8ff | 1 | #ifndef Objects_H |
| ll16o2l | 2:888634fff8ff | 2 | #define Objects_H |
| ll16o2l | 2:888634fff8ff | 3 | |
| ll16o2l | 2:888634fff8ff | 4 | #include "mbed.h" |
| ll16o2l | 2:888634fff8ff | 5 | #include "N5110.h" |
| ll16o2l | 2:888634fff8ff | 6 | #include "Gamepad.h" |
| ll16o2l | 2:888634fff8ff | 7 | #include "Player.h" |
| ll16o2l | 2:888634fff8ff | 8 | |
| ll16o2l | 8:c3153fd4d8ce | 9 | /** Objects Class |
| ll16o2l | 15:807eba7c7811 | 10 | |
| ll16o2l | 15:807eba7c7811 | 11 | @brief Controls the objects in the Dodge game |
| ll16o2l | 15:807eba7c7811 | 12 | |
| ll16o2l | 15:807eba7c7811 | 13 | @brief Revisions 1.0 |
| ll16o2l | 15:807eba7c7811 | 14 | |
| ll16o2l | 15:807eba7c7811 | 15 | |
| ll16o2l | 15:807eba7c7811 | 16 | @author Oliver Luong, University of Leeds |
| ll16o2l | 15:807eba7c7811 | 17 | @date 22/04/2019 |
| ll16o2l | 2:888634fff8ff | 18 | */ |
| ll16o2l | 2:888634fff8ff | 19 | class Objects |
| ll16o2l | 2:888634fff8ff | 20 | { |
| ll16o2l | 2:888634fff8ff | 21 | |
| ll16o2l | 2:888634fff8ff | 22 | public: |
| ll16o2l | 15:807eba7c7811 | 23 | /** Contructor / Destructor */ |
| ll16o2l | 2:888634fff8ff | 24 | Objects(); |
| ll16o2l | 2:888634fff8ff | 25 | ~Objects(); |
| ll16o2l | 15:807eba7c7811 | 26 | |
| ll16o2l | 15:807eba7c7811 | 27 | // Methods |
| ll16o2l | 15:807eba7c7811 | 28 | /** |
| ll16o2l | 15:807eba7c7811 | 29 | This method will be used to initialise the objects variables. |
| ll16o2l | 15:807eba7c7811 | 30 | Saves global variables to local variables. |
| ll16o2l | 15:807eba7c7811 | 31 | @param size fetched from the dodge engine. |
| ll16o2l | 15:807eba7c7811 | 32 | @param speed fetched from the dodge engine. |
| ll16o2l | 15:807eba7c7811 | 33 | */ |
| ll16o2l | 2:888634fff8ff | 34 | void init(int size,int speed); |
| ll16o2l | 15:807eba7c7811 | 35 | |
| ll16o2l | 15:807eba7c7811 | 36 | /** |
| ll16o2l | 15:807eba7c7811 | 37 | This method will be used to draw the objects to the LCD. |
| ll16o2l | 15:807eba7c7811 | 38 | */ |
| ll16o2l | 2:888634fff8ff | 39 | void draw(N5110 &lcd); |
| ll16o2l | 15:807eba7c7811 | 40 | |
| ll16o2l | 15:807eba7c7811 | 41 | /** |
| ll16o2l | 15:807eba7c7811 | 42 | This method will be used to update the objects position. |
| ll16o2l | 15:807eba7c7811 | 43 | */ |
| ll16o2l | 2:888634fff8ff | 44 | void update(); |
| ll16o2l | 15:807eba7c7811 | 45 | |
| ll16o2l | 15:807eba7c7811 | 46 | /** |
| ll16o2l | 15:807eba7c7811 | 47 | This method will be used to set the velocity of the objects. |
| ll16o2l | 15:807eba7c7811 | 48 | @param v velocity fectched from get_velocity |
| ll16o2l | 15:807eba7c7811 | 49 | */ |
| ll16o2l | 2:888634fff8ff | 50 | void set_velocity(Vector2D v); |
| ll16o2l | 15:807eba7c7811 | 51 | |
| ll16o2l | 15:807eba7c7811 | 52 | /** |
| ll16o2l | 15:807eba7c7811 | 53 | This method will be used to return the velocity when called. |
| ll16o2l | 15:807eba7c7811 | 54 | */ |
| ll16o2l | 2:888634fff8ff | 55 | Vector2D get_velocity(); |
| ll16o2l | 15:807eba7c7811 | 56 | |
| ll16o2l | 15:807eba7c7811 | 57 | |
| ll16o2l | 2:888634fff8ff | 58 | Vector2D get_pos(); |
| ll16o2l | 15:807eba7c7811 | 59 | |
| ll16o2l | 15:807eba7c7811 | 60 | /** |
| ll16o2l | 15:807eba7c7811 | 61 | This method will be used to set the postion of the objects. |
| ll16o2l | 15:807eba7c7811 | 62 | @param p, stores the x and y component of postion. |
| ll16o2l | 15:807eba7c7811 | 63 | */ |
| ll16o2l | 2:888634fff8ff | 64 | void set_pos(Vector2D p); |
| ll16o2l | 2:888634fff8ff | 65 | |
| ll16o2l | 2:888634fff8ff | 66 | private: |
| ll16o2l | 2:888634fff8ff | 67 | |
| ll16o2l | 2:888634fff8ff | 68 | Vector2D _velocity; |
| ll16o2l | 15:807eba7c7811 | 69 | |
| ll16o2l | 15:807eba7c7811 | 70 | // Variables |
| ll16o2l | 2:888634fff8ff | 71 | int _size; |
| ll16o2l | 2:888634fff8ff | 72 | int _x; |
| ll16o2l | 2:888634fff8ff | 73 | int _y; |
| ll16o2l | 2:888634fff8ff | 74 | int _x_edge; |
| ll16o2l | 2:888634fff8ff | 75 | int _y_edge; |
| ll16o2l | 2:888634fff8ff | 76 | }; |
| ll16o2l | 2:888634fff8ff | 77 | #endif |