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_one/Coin_files/Coin.h@17:5d8ff39a0e49, 2019-04-21 (annotated)
- Committer:
- yfkwok
- Date:
- Sun Apr 21 11:02:28 2019 +0000
- Revision:
- 17:5d8ff39a0e49
- Parent:
- 16:4e49f5cb972e
- Child:
- 21:704d938acf5d
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 | 2:464c7e62d97d | 1 | #ifndef COIN_H |
yfkwok | 2:464c7e62d97d | 2 | #define COIN_H |
yfkwok | 2:464c7e62d97d | 3 | |
yfkwok | 2:464c7e62d97d | 4 | #include "mbed.h" |
yfkwok | 2:464c7e62d97d | 5 | #include "N5110.h" |
yfkwok | 2:464c7e62d97d | 6 | #include "Gamepad.h" |
yfkwok | 2:464c7e62d97d | 7 | |
yfkwok | 2:464c7e62d97d | 8 | /** Coin Class |
yfkwok | 2:464c7e62d97d | 9 | @author Yiu Fai Kwok, University of Leeds |
yfkwok | 2:464c7e62d97d | 10 | @brief Controls the coin in Game_1 |
yfkwok | 2:464c7e62d97d | 11 | @date 25/03/2019 |
yfkwok | 2:464c7e62d97d | 12 | */ |
yfkwok | 2:464c7e62d97d | 13 | class Coin |
yfkwok | 2:464c7e62d97d | 14 | { |
yfkwok | 2:464c7e62d97d | 15 | |
yfkwok | 2:464c7e62d97d | 16 | public: |
yfkwok | 16:4e49f5cb972e | 17 | /** Constructor */ |
yfkwok | 2:464c7e62d97d | 18 | Coin(); |
yfkwok | 16:4e49f5cb972e | 19 | /** Deconstructor */ |
yfkwok | 2:464c7e62d97d | 20 | ~Coin(); |
yfkwok | 16:4e49f5cb972e | 21 | |
yfkwok | 16:4e49f5cb972e | 22 | |
yfkwok | 16:4e49f5cb972e | 23 | /** |
yfkwok | 16:4e49f5cb972e | 24 | * @brief Initialize the class parameters |
yfkwok | 17:5d8ff39a0e49 | 25 | * @param speed (int) |
yfkwok | 16:4e49f5cb972e | 26 | * @details Initialize the coin's position and speed |
yfkwok | 16:4e49f5cb972e | 27 | */ |
yfkwok | 2:464c7e62d97d | 28 | void init(int speed); |
yfkwok | 16:4e49f5cb972e | 29 | |
yfkwok | 16:4e49f5cb972e | 30 | /** |
yfkwok | 16:4e49f5cb972e | 31 | * @brief Draw the object - coin in Game 1 |
yfkwok | 16:4e49f5cb972e | 32 | * @details Draw the block on lcd screen |
yfkwok | 16:4e49f5cb972e | 33 | */ |
yfkwok | 2:464c7e62d97d | 34 | void draw(N5110 &lcd); |
yfkwok | 16:4e49f5cb972e | 35 | |
yfkwok | 16:4e49f5cb972e | 36 | /** |
yfkwok | 16:4e49f5cb972e | 37 | * @brief Update the coin |
yfkwok | 16:4e49f5cb972e | 38 | * @details Update the coin position |
yfkwok | 16:4e49f5cb972e | 39 | */ |
yfkwok | 2:464c7e62d97d | 40 | void update(); |
yfkwok | 16:4e49f5cb972e | 41 | |
yfkwok | 16:4e49f5cb972e | 42 | // accessors and mutators |
yfkwok | 16:4e49f5cb972e | 43 | /** |
yfkwok | 16:4e49f5cb972e | 44 | * @brief Set the speed - coin in Game 1 |
yfkwok | 17:5d8ff39a0e49 | 45 | * @param speed (int) |
yfkwok | 16:4e49f5cb972e | 46 | * @details Set the speed of the coin according to the level of difficulty determined by year |
yfkwok | 16:4e49f5cb972e | 47 | */ |
yfkwok | 2:464c7e62d97d | 48 | void set_velocity(int speed); |
yfkwok | 16:4e49f5cb972e | 49 | |
yfkwok | 16:4e49f5cb972e | 50 | /** |
yfkwok | 16:4e49f5cb972e | 51 | * @brief Get the speed |
yfkwok | 17:5d8ff39a0e49 | 52 | * @return the value of speed (int) |
yfkwok | 16:4e49f5cb972e | 53 | * @details Return the speed of the coin |
yfkwok | 16:4e49f5cb972e | 54 | */ |
yfkwok | 2:464c7e62d97d | 55 | int get_velocity(); |
yfkwok | 16:4e49f5cb972e | 56 | |
yfkwok | 16:4e49f5cb972e | 57 | /** |
yfkwok | 16:4e49f5cb972e | 58 | * @brief Get the position |
yfkwok | 17:5d8ff39a0e49 | 59 | * @return The current position (Vector2D) |
yfkwok | 16:4e49f5cb972e | 60 | * @details Return the position of the coin |
yfkwok | 16:4e49f5cb972e | 61 | */ |
yfkwok | 2:464c7e62d97d | 62 | Vector2D get_pos(); |
yfkwok | 16:4e49f5cb972e | 63 | |
yfkwok | 16:4e49f5cb972e | 64 | /** |
yfkwok | 16:4e49f5cb972e | 65 | * @brief Set the position |
yfkwok | 17:5d8ff39a0e49 | 66 | * @param The position p (Vector2D) |
yfkwok | 17:5d8ff39a0e49 | 67 | * @details Set the position of the coin |
yfkwok | 16:4e49f5cb972e | 68 | */ |
yfkwok | 2:464c7e62d97d | 69 | void set_pos(Vector2D p); |
yfkwok | 2:464c7e62d97d | 70 | |
yfkwok | 2:464c7e62d97d | 71 | private: |
yfkwok | 2:464c7e62d97d | 72 | int _speed; |
yfkwok | 2:464c7e62d97d | 73 | int _x; |
yfkwok | 2:464c7e62d97d | 74 | int _y; |
yfkwok | 2:464c7e62d97d | 75 | }; |
yfkwok | 2:464c7e62d97d | 76 | #endif |