Game codes for Pokemon Academy Yiu Fai Kwok - 201198802 I have read the University Regulations on Plagiarism and state that the work covered by this declaration is my own and does not contain any unacknowledged work from other sources.
Dependencies: mbed FXOS8700CQ mbed-rtos
Game_two/YouTube_files/YouTube.h@34:3ddfaa217eca, 2019-05-09 (annotated)
- Committer:
- yfkwok
- Date:
- Thu May 09 00:41:05 2019 +0000
- Revision:
- 34:3ddfaa217eca
- Parent:
- 19:903d67bb0dea
09/05/2019 - Last commit before submission
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yfkwok | 14:abe64fe0b6a5 | 1 | #ifndef YOUTUBE_H |
yfkwok | 14:abe64fe0b6a5 | 2 | #define YOUTUBE_H |
yfkwok | 14:abe64fe0b6a5 | 3 | |
yfkwok | 14:abe64fe0b6a5 | 4 | #include "mbed.h" |
yfkwok | 14:abe64fe0b6a5 | 5 | #include "N5110.h" |
yfkwok | 14:abe64fe0b6a5 | 6 | #include "Gamepad.h" |
yfkwok | 14:abe64fe0b6a5 | 7 | |
yfkwok | 14:abe64fe0b6a5 | 8 | /** YouTube Class |
yfkwok | 14:abe64fe0b6a5 | 9 | @author Yiu Fai Kwok, University of Leeds |
yfkwok | 14:abe64fe0b6a5 | 10 | @brief Controls the YouTube in Game_2 |
yfkwok | 14:abe64fe0b6a5 | 11 | @date 18/04/2019 |
yfkwok | 14:abe64fe0b6a5 | 12 | */ |
yfkwok | 14:abe64fe0b6a5 | 13 | class YouTube |
yfkwok | 14:abe64fe0b6a5 | 14 | { |
yfkwok | 14:abe64fe0b6a5 | 15 | |
yfkwok | 14:abe64fe0b6a5 | 16 | public: |
yfkwok | 19:903d67bb0dea | 17 | |
yfkwok | 19:903d67bb0dea | 18 | /** Constructor */ |
yfkwok | 14:abe64fe0b6a5 | 19 | YouTube(); |
yfkwok | 19:903d67bb0dea | 20 | /** Deconstructor */ |
yfkwok | 14:abe64fe0b6a5 | 21 | ~YouTube(); |
yfkwok | 19:903d67bb0dea | 22 | |
yfkwok | 19:903d67bb0dea | 23 | /** |
yfkwok | 19:903d67bb0dea | 24 | * @brief Initialize the class parameters |
yfkwok | 19:903d67bb0dea | 25 | * @param speed (int) |
yfkwok | 19:903d67bb0dea | 26 | * @details Initialize the object's position and speed by randomizing a number between 0-7. |
yfkwok | 19:903d67bb0dea | 27 | */ |
yfkwok | 14:abe64fe0b6a5 | 28 | void init(int speed); |
yfkwok | 19:903d67bb0dea | 29 | |
yfkwok | 19:903d67bb0dea | 30 | /** |
yfkwok | 19:903d67bb0dea | 31 | * @brief Draw the object |
yfkwok | 19:903d67bb0dea | 32 | * @details Draw the object according the position _x and _y. |
yfkwok | 19:903d67bb0dea | 33 | */ |
yfkwok | 14:abe64fe0b6a5 | 34 | void draw(N5110 &lcd); |
yfkwok | 19:903d67bb0dea | 35 | |
yfkwok | 19:903d67bb0dea | 36 | /** |
yfkwok | 19:903d67bb0dea | 37 | * @brief Update the object |
yfkwok | 19:903d67bb0dea | 38 | * @details Update the new position of the object determined by the speed parameter and initial position |
yfkwok | 19:903d67bb0dea | 39 | */ |
yfkwok | 14:abe64fe0b6a5 | 40 | void update(); |
yfkwok | 19:903d67bb0dea | 41 | |
yfkwok | 19:903d67bb0dea | 42 | // accessors and mutators |
yfkwok | 19:903d67bb0dea | 43 | /** |
yfkwok | 19:903d67bb0dea | 44 | * @brief Set the object's velocity |
yfkwok | 19:903d67bb0dea | 45 | * @param velocity v (Vector2D) |
yfkwok | 19:903d67bb0dea | 46 | * @details Set the velocity of the object according to the initial set up from the init(int speed) function |
yfkwok | 19:903d67bb0dea | 47 | */ |
yfkwok | 14:abe64fe0b6a5 | 48 | void set_velocity(Vector2D v); |
yfkwok | 19:903d67bb0dea | 49 | |
yfkwok | 19:903d67bb0dea | 50 | /** |
yfkwok | 19:903d67bb0dea | 51 | * @brief Get the object's velocity |
yfkwok | 19:903d67bb0dea | 52 | * @return the current velocity (Vector2D) |
yfkwok | 19:903d67bb0dea | 53 | * @details Get the velocity of the object and return as Vector2D |
yfkwok | 19:903d67bb0dea | 54 | */ |
yfkwok | 14:abe64fe0b6a5 | 55 | Vector2D get_velocity(); |
yfkwok | 19:903d67bb0dea | 56 | |
yfkwok | 19:903d67bb0dea | 57 | /** |
yfkwok | 19:903d67bb0dea | 58 | * @brief Get the object's position |
yfkwok | 19:903d67bb0dea | 59 | * @return the current position (Vector2D) |
yfkwok | 19:903d67bb0dea | 60 | * @details Get the position x and y of the object and return as Vector2D |
yfkwok | 19:903d67bb0dea | 61 | */ |
yfkwok | 14:abe64fe0b6a5 | 62 | Vector2D get_pos(); |
yfkwok | 19:903d67bb0dea | 63 | |
yfkwok | 19:903d67bb0dea | 64 | /** |
yfkwok | 19:903d67bb0dea | 65 | * @brief Set the object's position |
yfkwok | 19:903d67bb0dea | 66 | * @param the value of position p (Vector2D) |
yfkwok | 19:903d67bb0dea | 67 | * @details Set the position x and y of the object according to the input p |
yfkwok | 19:903d67bb0dea | 68 | */ |
yfkwok | 14:abe64fe0b6a5 | 69 | void set_pos(Vector2D p); |
yfkwok | 14:abe64fe0b6a5 | 70 | |
yfkwok | 14:abe64fe0b6a5 | 71 | private: |
yfkwok | 14:abe64fe0b6a5 | 72 | Vector2D _velocity; |
yfkwok | 14:abe64fe0b6a5 | 73 | int _x; |
yfkwok | 14:abe64fe0b6a5 | 74 | int _y; |
yfkwok | 14:abe64fe0b6a5 | 75 | }; |
yfkwok | 14:abe64fe0b6a5 | 76 | #endif |