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

Committer:
yfkwok
Date:
Thu May 09 00:41:05 2019 +0000
Revision:
34:3ddfaa217eca
Parent:
30:0ff3bede5307
09/05/2019 - Last commit before submission

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yfkwok 21:704d938acf5d 1 #ifndef GAME_THREE_H
yfkwok 21:704d938acf5d 2 #define GAME_THREE_H
yfkwok 21:704d938acf5d 3
yfkwok 21:704d938acf5d 4 #include "mbed.h"
yfkwok 21:704d938acf5d 5 #include "N5110.h"
yfkwok 21:704d938acf5d 6 #include "Gamepad.h"
yfkwok 21:704d938acf5d 7 #include "Score.h"
yfkwok 21:704d938acf5d 8 #include "Book.h"
yfkwok 21:704d938acf5d 9 #include "Message.h"
yfkwok 21:704d938acf5d 10
yfkwok 25:31111e6e13ad 11 /** Game Three Class
yfkwok 25:31111e6e13ad 12 * @brief This class is the game engine for the third mini-game
yfkwok 30:0ff3bede5307 13 * @version 2.0
yfkwok 25:31111e6e13ad 14 * @author Yiu Fai Kwok
yfkwok 30:0ff3bede5307 15 * @date May, 2019
yfkwok 25:31111e6e13ad 16 */
yfkwok 25:31111e6e13ad 17
yfkwok 21:704d938acf5d 18 class Game_three
yfkwok 21:704d938acf5d 19 {
yfkwok 21:704d938acf5d 20
yfkwok 21:704d938acf5d 21 public:
yfkwok 21:704d938acf5d 22
yfkwok 21:704d938acf5d 23 /** Constructor */
yfkwok 21:704d938acf5d 24 Game_three();
yfkwok 21:704d938acf5d 25 /** Deconstructor */
yfkwok 21:704d938acf5d 26 ~Game_three();
yfkwok 21:704d938acf5d 27
yfkwok 29:75a05e9f0e8d 28 /**
yfkwok 29:75a05e9f0e8d 29 * @brief Initialize the parameters
yfkwok 29:75a05e9f0e8d 30 * @details Initialize the parameters, count and score in the class
yfkwok 29:75a05e9f0e8d 31 */
yfkwok 28:a6726a3f8e6d 32 void init_para();
yfkwok 29:75a05e9f0e8d 33
yfkwok 29:75a05e9f0e8d 34 /**
yfkwok 29:75a05e9f0e8d 35 * @brief Initialize the randomization
yfkwok 29:75a05e9f0e8d 36 * @param setting r (int)
yfkwok 29:75a05e9f0e8d 37 * @details Initialize the setting (r) to set the randomization of the location of books and messages
yfkwok 29:75a05e9f0e8d 38 */
yfkwok 27:4bcdfb212467 39 void init(Gamepad &pad, int r);
yfkwok 29:75a05e9f0e8d 40
yfkwok 29:75a05e9f0e8d 41 /**
yfkwok 29:75a05e9f0e8d 42 * @brief Render the lcd screen
yfkwok 29:75a05e9f0e8d 43 * @param setting r (int)
yfkwok 29:75a05e9f0e8d 44 * @details Render all objects in game, draw object sprite according to (r) parameter to determine their location
yfkwok 29:75a05e9f0e8d 45 */
yfkwok 27:4bcdfb212467 46 void render(N5110 &lcd, int r);
yfkwok 29:75a05e9f0e8d 47
yfkwok 29:75a05e9f0e8d 48 /**
yfkwok 29:75a05e9f0e8d 49 * @brief Draw function for Game 3
yfkwok 29:75a05e9f0e8d 50 * @param setting r (int)
yfkwok 29:75a05e9f0e8d 51 * @details Draw function of Game 3 which draw all objects to the changing variables of positions according to constant (r)
yfkwok 29:75a05e9f0e8d 52 */
yfkwok 27:4bcdfb212467 53 void draw(N5110 &lcd, int r);
yfkwok 29:75a05e9f0e8d 54
yfkwok 29:75a05e9f0e8d 55 /**
yfkwok 29:75a05e9f0e8d 56 * @brief Read input from Gamepad
yfkwok 29:75a05e9f0e8d 57 * @details Read input from buttons on the Gamepad to determine which item is being selected for the game
yfkwok 29:75a05e9f0e8d 58 */
yfkwok 27:4bcdfb212467 59 void read_input(Gamepad &pad);
yfkwok 29:75a05e9f0e8d 60
yfkwok 29:75a05e9f0e8d 61 /**
yfkwok 29:75a05e9f0e8d 62 * @brief Update the scoring and count
yfkwok 29:75a05e9f0e8d 63 * @param setting r (int)
yfkwok 29:75a05e9f0e8d 64 * @details Update the parameters score and count depending on the setting parameter r compared with which input is read from the Gamepad buttons
yfkwok 29:75a05e9f0e8d 65 */
yfkwok 27:4bcdfb212467 66 void update(Gamepad &pad, int r);
yfkwok 27:4bcdfb212467 67
yfkwok 27:4bcdfb212467 68 /**
yfkwok 27:4bcdfb212467 69 * @brief Get count value
yfkwok 27:4bcdfb212467 70 * @return The current count (int)
yfkwok 29:75a05e9f0e8d 71 * @details The function returns the number of rounds that have taken place in the game to terminate the game loop once count reaches 5
yfkwok 27:4bcdfb212467 72 */
yfkwok 27:4bcdfb212467 73 int get_count();
yfkwok 27:4bcdfb212467 74
yfkwok 29:75a05e9f0e8d 75 /**
yfkwok 29:75a05e9f0e8d 76 * @brief Get score value
yfkwok 29:75a05e9f0e8d 77 * @return The current score (int)
yfkwok 29:75a05e9f0e8d 78 * @details The function returns the score that player has obtained in the game
yfkwok 29:75a05e9f0e8d 79 */
yfkwok 27:4bcdfb212467 80 int get_score();
yfkwok 27:4bcdfb212467 81
yfkwok 27:4bcdfb212467 82 /**
yfkwok 27:4bcdfb212467 83 * @brief Intruction
yfkwok 27:4bcdfb212467 84 * @details The function displays the instructions which describe game rules at the beginning of the game
yfkwok 27:4bcdfb212467 85 */
yfkwok 27:4bcdfb212467 86 void intro(Gamepad &pad, N5110 &lcd);
yfkwok 21:704d938acf5d 87
yfkwok 21:704d938acf5d 88 private:
yfkwok 21:704d938acf5d 89
yfkwok 21:704d938acf5d 90 void background(N5110 &lcd);
yfkwok 27:4bcdfb212467 91 Score music;
yfkwok 27:4bcdfb212467 92 Book book;
yfkwok 27:4bcdfb212467 93 Message message;
yfkwok 27:4bcdfb212467 94 int _set;
yfkwok 27:4bcdfb212467 95 int _select;
yfkwok 27:4bcdfb212467 96 int _count;
yfkwok 27:4bcdfb212467 97 int _score;
yfkwok 21:704d938acf5d 98
yfkwok 21:704d938acf5d 99 };
yfkwok 21:704d938acf5d 100
yfkwok 21:704d938acf5d 101 #endif