![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
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
Start/Start.h@17:5d8ff39a0e49, 2019-04-21 (annotated)
- Committer:
- yfkwok
- Date:
- Sun Apr 21 11:02:28 2019 +0000
- Revision:
- 17:5d8ff39a0e49
- Parent:
- 5:bc0691d02fd5
- Child:
- 25:31111e6e13ad
21/04/2019 - Add Doxygen comments for the following classes: Exam, Characters, Score and Start
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yfkwok | 17:5d8ff39a0e49 | 1 | /** Start Class |
yfkwok | 17:5d8ff39a0e49 | 2 | * @brief This class is the starting menu for selecting the character of the game |
yfkwok | 17:5d8ff39a0e49 | 3 | * @version 1.0 |
yfkwok | 17:5d8ff39a0e49 | 4 | * @author Yiu Fai Kwok |
yfkwok | 17:5d8ff39a0e49 | 5 | * @date Match, 2019 |
yfkwok | 17:5d8ff39a0e49 | 6 | */ |
yfkwok | 2:464c7e62d97d | 7 | #ifndef START_H |
yfkwok | 2:464c7e62d97d | 8 | #define START_H |
yfkwok | 2:464c7e62d97d | 9 | |
yfkwok | 2:464c7e62d97d | 10 | #include "N5110.h" |
yfkwok | 2:464c7e62d97d | 11 | #include "Gamepad.h" |
yfkwok | 2:464c7e62d97d | 12 | #include "Charmander.h" |
yfkwok | 2:464c7e62d97d | 13 | #include "Squirtle.h" |
yfkwok | 2:464c7e62d97d | 14 | #include "Bulbasaur.h" |
yfkwok | 2:464c7e62d97d | 15 | |
yfkwok | 2:464c7e62d97d | 16 | class Start |
yfkwok | 2:464c7e62d97d | 17 | { |
yfkwok | 2:464c7e62d97d | 18 | |
yfkwok | 2:464c7e62d97d | 19 | public: |
yfkwok | 17:5d8ff39a0e49 | 20 | /** Constructor */ |
yfkwok | 2:464c7e62d97d | 21 | Start(); |
yfkwok | 17:5d8ff39a0e49 | 22 | /** Deconstructor */ |
yfkwok | 2:464c7e62d97d | 23 | ~Start(); |
yfkwok | 2:464c7e62d97d | 24 | |
yfkwok | 17:5d8ff39a0e49 | 25 | /** |
yfkwok | 17:5d8ff39a0e49 | 26 | * @brief Initialize the class |
yfkwok | 17:5d8ff39a0e49 | 27 | * @details Initialize the objects positions. |
yfkwok | 17:5d8ff39a0e49 | 28 | */ |
yfkwok | 5:bc0691d02fd5 | 29 | void init(Gamepad &pad); |
yfkwok | 17:5d8ff39a0e49 | 30 | |
yfkwok | 17:5d8ff39a0e49 | 31 | /** |
yfkwok | 17:5d8ff39a0e49 | 32 | * @brief Update the objects |
yfkwok | 17:5d8ff39a0e49 | 33 | * @details Update the objects on the lcd screen depending on the object being selected and joystick input |
yfkwok | 17:5d8ff39a0e49 | 34 | */ |
yfkwok | 2:464c7e62d97d | 35 | void starter_update(Gamepad &pad); |
yfkwok | 17:5d8ff39a0e49 | 36 | |
yfkwok | 17:5d8ff39a0e49 | 37 | /** |
yfkwok | 17:5d8ff39a0e49 | 38 | * @brief Draw the objects |
yfkwok | 17:5d8ff39a0e49 | 39 | * @details Draw the objects, the characters, their alternative sprites and the selection box |
yfkwok | 17:5d8ff39a0e49 | 40 | */ |
yfkwok | 2:464c7e62d97d | 41 | void starter_draw(N5110 &lcd); |
yfkwok | 17:5d8ff39a0e49 | 42 | |
yfkwok | 17:5d8ff39a0e49 | 43 | /** |
yfkwok | 17:5d8ff39a0e49 | 44 | * @brief Updates the selector |
yfkwok | 17:5d8ff39a0e49 | 45 | * @return position of selection box (Vector2D) |
yfkwok | 17:5d8ff39a0e49 | 46 | * @details Updates the location of the selection box by reading the input from the Gamepad's joystick control |
yfkwok | 17:5d8ff39a0e49 | 47 | */ |
yfkwok | 2:464c7e62d97d | 48 | Vector2D update_select(Gamepad &pad); |
yfkwok | 17:5d8ff39a0e49 | 49 | |
yfkwok | 17:5d8ff39a0e49 | 50 | /** |
yfkwok | 17:5d8ff39a0e49 | 51 | * @brief Update postion of Bulbasaur |
yfkwok | 17:5d8ff39a0e49 | 52 | * @return position of Bulbasaur (int) |
yfkwok | 17:5d8ff39a0e49 | 53 | * @details Update the position of Bulbasaur when it is selected to create animation |
yfkwok | 17:5d8ff39a0e49 | 54 | */ |
yfkwok | 2:464c7e62d97d | 55 | int update_animation_b(Gamepad &pad); |
yfkwok | 17:5d8ff39a0e49 | 56 | |
yfkwok | 17:5d8ff39a0e49 | 57 | /** |
yfkwok | 17:5d8ff39a0e49 | 58 | * @brief Update postion of Charmander |
yfkwok | 17:5d8ff39a0e49 | 59 | * @return position of Charmander (int) |
yfkwok | 17:5d8ff39a0e49 | 60 | * @details Update the position of Charmander when it is selected to create animation |
yfkwok | 17:5d8ff39a0e49 | 61 | */ |
yfkwok | 2:464c7e62d97d | 62 | int update_animation_c(Gamepad &pad); |
yfkwok | 17:5d8ff39a0e49 | 63 | |
yfkwok | 17:5d8ff39a0e49 | 64 | /** |
yfkwok | 17:5d8ff39a0e49 | 65 | * @brief Update postion of Squirtle |
yfkwok | 17:5d8ff39a0e49 | 66 | * @return position of Squirtle (int) |
yfkwok | 17:5d8ff39a0e49 | 67 | * @details Update the position of Squirtle when it is selected to create animation |
yfkwok | 17:5d8ff39a0e49 | 68 | */ |
yfkwok | 2:464c7e62d97d | 69 | int update_animation_s(Gamepad &pad); |
yfkwok | 17:5d8ff39a0e49 | 70 | |
yfkwok | 17:5d8ff39a0e49 | 71 | /** |
yfkwok | 17:5d8ff39a0e49 | 72 | * @brief Update parameter alt |
yfkwok | 17:5d8ff39a0e49 | 73 | * @return current value of alt (int) |
yfkwok | 17:5d8ff39a0e49 | 74 | * @details Update the parameter alt which determines which position the sprite should be drawn |
yfkwok | 17:5d8ff39a0e49 | 75 | */ |
yfkwok | 2:464c7e62d97d | 76 | int update_alt(); |
yfkwok | 17:5d8ff39a0e49 | 77 | |
yfkwok | 17:5d8ff39a0e49 | 78 | /** |
yfkwok | 17:5d8ff39a0e49 | 79 | * @brief Set postion of selection box |
yfkwok | 17:5d8ff39a0e49 | 80 | * @param position of selection box p (Vector2D) |
yfkwok | 17:5d8ff39a0e49 | 81 | * @details Function to set the position of the selection box |
yfkwok | 17:5d8ff39a0e49 | 82 | */ |
yfkwok | 2:464c7e62d97d | 83 | void set_pos(Vector2D p); |
yfkwok | 17:5d8ff39a0e49 | 84 | |
yfkwok | 17:5d8ff39a0e49 | 85 | /** |
yfkwok | 17:5d8ff39a0e49 | 86 | * @brief Set postion of the three characters |
yfkwok | 17:5d8ff39a0e49 | 87 | * @param position of Charmander pos_cy (int) |
yfkwok | 17:5d8ff39a0e49 | 88 | * @param position of Squirtle pos_sy (int) |
yfkwok | 17:5d8ff39a0e49 | 89 | * @param position of Bulbasaur pos_by (int) |
yfkwok | 17:5d8ff39a0e49 | 90 | * @details Function to set the position of the three characters |
yfkwok | 17:5d8ff39a0e49 | 91 | */ |
yfkwok | 2:464c7e62d97d | 92 | void set_pos_csb(int pos_cy, int pos_sy, int pos_by); |
yfkwok | 17:5d8ff39a0e49 | 93 | |
yfkwok | 17:5d8ff39a0e49 | 94 | /** |
yfkwok | 17:5d8ff39a0e49 | 95 | * @brief Set parameter alt |
yfkwok | 17:5d8ff39a0e49 | 96 | * @return the value of alt (int) |
yfkwok | 17:5d8ff39a0e49 | 97 | * @details Set the parameter alt which determines which position the sprite should be drawn |
yfkwok | 17:5d8ff39a0e49 | 98 | */ |
yfkwok | 2:464c7e62d97d | 99 | void set_alt(int alt); |
yfkwok | 17:5d8ff39a0e49 | 100 | |
yfkwok | 17:5d8ff39a0e49 | 101 | /** |
yfkwok | 17:5d8ff39a0e49 | 102 | * @brief Return the Character selected |
yfkwok | 17:5d8ff39a0e49 | 103 | * @param the value of position of selection box p (Vector2D) |
yfkwok | 17:5d8ff39a0e49 | 104 | * @return current value of select (int) |
yfkwok | 17:5d8ff39a0e49 | 105 | * @details Takes in the position of the selection box to determine which character has been selected. Return 0 when Bulbasaur is selected, 1 for Squirtle and 2 for Charmander. |
yfkwok | 17:5d8ff39a0e49 | 106 | */ |
yfkwok | 2:464c7e62d97d | 107 | int get_select(Vector2D p); |
yfkwok | 17:5d8ff39a0e49 | 108 | |
yfkwok | 17:5d8ff39a0e49 | 109 | /** |
yfkwok | 17:5d8ff39a0e49 | 110 | * @brief Display description |
yfkwok | 17:5d8ff39a0e49 | 111 | * @param value of select (int) |
yfkwok | 17:5d8ff39a0e49 | 112 | * @details Display the descrption of the character being selected when information is being required |
yfkwok | 17:5d8ff39a0e49 | 113 | */ |
yfkwok | 2:464c7e62d97d | 114 | void intro(int select,Gamepad &pad, N5110 &lcd); |
yfkwok | 2:464c7e62d97d | 115 | |
yfkwok | 2:464c7e62d97d | 116 | private: |
yfkwok | 2:464c7e62d97d | 117 | Charmander _c1; |
yfkwok | 2:464c7e62d97d | 118 | Squirtle _s1; |
yfkwok | 2:464c7e62d97d | 119 | Bulbasaur _b1; |
yfkwok | 2:464c7e62d97d | 120 | int _pos_x; |
yfkwok | 2:464c7e62d97d | 121 | int _pos_y; |
yfkwok | 2:464c7e62d97d | 122 | int _pos_cy; |
yfkwok | 2:464c7e62d97d | 123 | int _pos_sy; |
yfkwok | 2:464c7e62d97d | 124 | int _pos_by; |
yfkwok | 2:464c7e62d97d | 125 | int _alt; |
yfkwok | 2:464c7e62d97d | 126 | }; |
yfkwok | 2:464c7e62d97d | 127 | |
yfkwok | 2:464c7e62d97d | 128 | #endif |