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