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