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
Score/Score.h@31:0d2c19a285f6, 2019-05-08 (annotated)
- Committer:
- yfkwok
- Date:
- Wed May 08 03:03:46 2019 +0000
- Revision:
- 31:0d2c19a285f6
- Parent:
- 17:5d8ff39a0e49
- Child:
- 32:58def659f463
08/05/2019 - Graduation music and animation added, game loops back to title screen after graduation. Game finished, need to added final documentation.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yfkwok | 2:464c7e62d97d | 1 | #ifndef SCORE_H |
yfkwok | 2:464c7e62d97d | 2 | #define SCORE_H |
yfkwok | 2:464c7e62d97d | 3 | |
yfkwok | 2:464c7e62d97d | 4 | #include "Gamepad.h" |
yfkwok | 2:464c7e62d97d | 5 | #include "mbed.h" |
yfkwok | 2:464c7e62d97d | 6 | #include "Notes.h" |
yfkwok | 4:5bc9c4363d31 | 7 | #include "N5110.h" |
yfkwok | 4:5bc9c4363d31 | 8 | #include "Squirtle.h" |
yfkwok | 10:adff3c804985 | 9 | #include "Charmander.h" |
yfkwok | 12:71683453f66a | 10 | #include "Bulbasaur.h" |
yfkwok | 2:464c7e62d97d | 11 | |
yfkwok | 16:4e49f5cb972e | 12 | /** Score Class |
yfkwok | 16:4e49f5cb972e | 13 | * @author Yiu Fai Kwok, University of Leeds |
yfkwok | 16:4e49f5cb972e | 14 | * @version 1.0 |
yfkwok | 16:4e49f5cb972e | 15 | * @brief Score class containing all in-game background music files |
yfkwok | 16:4e49f5cb972e | 16 | * @date 20/04/2019 |
yfkwok | 16:4e49f5cb972e | 17 | */ |
yfkwok | 16:4e49f5cb972e | 18 | |
yfkwok | 2:464c7e62d97d | 19 | class Score |
yfkwok | 2:464c7e62d97d | 20 | { |
yfkwok | 2:464c7e62d97d | 21 | public: |
yfkwok | 16:4e49f5cb972e | 22 | |
yfkwok | 16:4e49f5cb972e | 23 | /** Constructor */ |
yfkwok | 2:464c7e62d97d | 24 | Score(); |
yfkwok | 16:4e49f5cb972e | 25 | /** Deconstructor */ |
yfkwok | 2:464c7e62d97d | 26 | ~Score(); |
yfkwok | 16:4e49f5cb972e | 27 | |
yfkwok | 16:4e49f5cb972e | 28 | /** |
yfkwok | 16:4e49f5cb972e | 29 | * @brief Title screen music |
yfkwok | 16:4e49f5cb972e | 30 | * @details Background music played during title screen |
yfkwok | 16:4e49f5cb972e | 31 | */ |
yfkwok | 2:464c7e62d97d | 32 | void title_music(Gamepad &pad); |
yfkwok | 16:4e49f5cb972e | 33 | |
yfkwok | 16:4e49f5cb972e | 34 | /** |
yfkwok | 16:4e49f5cb972e | 35 | * @brief Level up music |
yfkwok | 16:4e49f5cb972e | 36 | * @details Background music played when player advance in level or year |
yfkwok | 16:4e49f5cb972e | 37 | */ |
yfkwok | 2:464c7e62d97d | 38 | void level_up(Gamepad &pad); |
yfkwok | 16:4e49f5cb972e | 39 | |
yfkwok | 16:4e49f5cb972e | 40 | /** |
yfkwok | 16:4e49f5cb972e | 41 | * @brief Congratulation music |
yfkwok | 16:4e49f5cb972e | 42 | * @details Background music played when player succesfully completed a mission |
yfkwok | 16:4e49f5cb972e | 43 | */ |
yfkwok | 2:464c7e62d97d | 44 | void congrats(Gamepad &pad); |
yfkwok | 16:4e49f5cb972e | 45 | |
yfkwok | 16:4e49f5cb972e | 46 | /** |
yfkwok | 16:4e49f5cb972e | 47 | * @brief Coin music |
yfkwok | 16:4e49f5cb972e | 48 | * @details Background music played when player successfully collected a coin in Game 1 |
yfkwok | 16:4e49f5cb972e | 49 | */ |
yfkwok | 2:464c7e62d97d | 50 | void coin(Gamepad &pad); |
yfkwok | 16:4e49f5cb972e | 51 | |
yfkwok | 16:4e49f5cb972e | 52 | /** |
yfkwok | 16:4e49f5cb972e | 53 | * @brief Evolution animation and music |
yfkwok | 17:5d8ff39a0e49 | 54 | * @param character cha (int) |
yfkwok | 17:5d8ff39a0e49 | 55 | * @param the value of year (int) |
yfkwok | 16:4e49f5cb972e | 56 | * @details Background music played when player's character enters evolution, dependent on character selected (cha) and year of which player is currently in (year), initiate animation for evolution. |
yfkwok | 16:4e49f5cb972e | 57 | */ |
yfkwok | 4:5bc9c4363d31 | 58 | void evolution_music(Gamepad &pad, N5110 &lcd, int cha, int year); |
yfkwok | 16:4e49f5cb972e | 59 | |
yfkwok | 16:4e49f5cb972e | 60 | /** |
yfkwok | 16:4e49f5cb972e | 61 | * @brief Congratulation music for evolution |
yfkwok | 31:0d2c19a285f6 | 62 | * @param character cha (int) |
yfkwok | 31:0d2c19a285f6 | 63 | * @param the value of year (int) |
yfkwok | 16:4e49f5cb972e | 64 | * @details Background music played when player's character succesfully evolves, draw sprite of the evolved character |
yfkwok | 16:4e49f5cb972e | 65 | */ |
yfkwok | 4:5bc9c4363d31 | 66 | void congrats(Gamepad &pad, N5110 &lcd, int cha, int year); |
yfkwok | 16:4e49f5cb972e | 67 | |
yfkwok | 16:4e49f5cb972e | 68 | /** |
yfkwok | 16:4e49f5cb972e | 69 | * @brief Draw sprite of pokemon |
yfkwok | 17:5d8ff39a0e49 | 70 | * @param character cha (int) |
yfkwok | 17:5d8ff39a0e49 | 71 | * @param the value of year (int) |
yfkwok | 17:5d8ff39a0e49 | 72 | * @param the value of x (int) |
yfkwok | 17:5d8ff39a0e49 | 73 | * @param the value of y (int) |
yfkwok | 16:4e49f5cb972e | 74 | * @details Draw sprite of character depending on character selected (cha) and the year at which the player is in (year). Location of the sprite is determined by x and y to generate the moving name title. |
yfkwok | 16:4e49f5cb972e | 75 | */ |
yfkwok | 12:71683453f66a | 76 | void draw(N5110 &lcd, int cha, int year, int x, int y); |
yfkwok | 16:4e49f5cb972e | 77 | |
yfkwok | 16:4e49f5cb972e | 78 | /** |
yfkwok | 16:4e49f5cb972e | 79 | * @brief Draw sprite of evolved pokemon |
yfkwok | 17:5d8ff39a0e49 | 80 | * @param character cha (int) |
yfkwok | 17:5d8ff39a0e49 | 81 | * @param the value of year (int) |
yfkwok | 16:4e49f5cb972e | 82 | * @details Draw sprite of evolved character according to year (year) and character selected (cha) |
yfkwok | 16:4e49f5cb972e | 83 | */ |
yfkwok | 4:5bc9c4363d31 | 84 | void draw_cong(N5110 &lcd, int cha, int year); |
yfkwok | 16:4e49f5cb972e | 85 | |
yfkwok | 16:4e49f5cb972e | 86 | /** |
yfkwok | 16:4e49f5cb972e | 87 | * @brief Music for winning |
yfkwok | 16:4e49f5cb972e | 88 | * @details Background music played when player wins a mini game |
yfkwok | 16:4e49f5cb972e | 89 | */ |
yfkwok | 5:bc0691d02fd5 | 90 | void win(Gamepad &pad); |
yfkwok | 16:4e49f5cb972e | 91 | |
yfkwok | 16:4e49f5cb972e | 92 | /** |
yfkwok | 16:4e49f5cb972e | 93 | * @brief Music for EXAM introduction |
yfkwok | 16:4e49f5cb972e | 94 | * @details Background music played when player enters the EXAM |
yfkwok | 16:4e49f5cb972e | 95 | */ |
yfkwok | 5:bc0691d02fd5 | 96 | void exam_intro(Gamepad &pad); |
yfkwok | 16:4e49f5cb972e | 97 | |
yfkwok | 16:4e49f5cb972e | 98 | /** |
yfkwok | 16:4e49f5cb972e | 99 | * @brief Music for EXAM running in parallel to the exam |
yfkwok | 17:5d8ff39a0e49 | 100 | * @param state (bool) |
yfkwok | 17:5d8ff39a0e49 | 101 | * @details Background music played during the EXAM, stops when the boolean variable state becomes false |
yfkwok | 16:4e49f5cb972e | 102 | */ |
yfkwok | 5:bc0691d02fd5 | 103 | void gym(Gamepad &pad, bool state); |
yfkwok | 2:464c7e62d97d | 104 | |
yfkwok | 31:0d2c19a285f6 | 105 | /** |
yfkwok | 31:0d2c19a285f6 | 106 | * @brief Draw sprite for graduation |
yfkwok | 31:0d2c19a285f6 | 107 | * @param character cha (int) |
yfkwok | 31:0d2c19a285f6 | 108 | * @param the value of year (int) |
yfkwok | 31:0d2c19a285f6 | 109 | * @param position x (int) |
yfkwok | 31:0d2c19a285f6 | 110 | * @details Draw sprite and animation for the graduation credit scene according to character picked |
yfkwok | 31:0d2c19a285f6 | 111 | */ |
yfkwok | 31:0d2c19a285f6 | 112 | void draw_grad(N5110 &lcd, int cha, int year, int x); |
yfkwok | 31:0d2c19a285f6 | 113 | |
yfkwok | 31:0d2c19a285f6 | 114 | /** |
yfkwok | 31:0d2c19a285f6 | 115 | * @brief Graduation animation and music |
yfkwok | 31:0d2c19a285f6 | 116 | * @param character cha (int) |
yfkwok | 31:0d2c19a285f6 | 117 | * @param the value of year (int) |
yfkwok | 31:0d2c19a285f6 | 118 | * @details Background music played when player graduates, dependent on character selected (cha), initiate animation for the graduation. |
yfkwok | 31:0d2c19a285f6 | 119 | */ |
yfkwok | 31:0d2c19a285f6 | 120 | void graduation(Gamepad &pad, N5110 &lcd, int cha); |
yfkwok | 31:0d2c19a285f6 | 121 | |
yfkwok | 2:464c7e62d97d | 122 | private: |
yfkwok | 4:5bc9c4363d31 | 123 | Squirtle _s1; |
yfkwok | 10:adff3c804985 | 124 | Charmander _c1; |
yfkwok | 12:71683453f66a | 125 | Bulbasaur _b1; |
yfkwok | 2:464c7e62d97d | 126 | }; |
yfkwok | 2:464c7e62d97d | 127 | #endif |