Yang Zhenye 201199680
Dependencies: mbed
Rooney/Rooney.h@9:a5a82b3d1102, 2020-05-15 (annotated)
- Committer:
- yangzhenye
- Date:
- Fri May 15 07:27:23 2020 +0000
- Revision:
- 9:a5a82b3d1102
- Parent:
- 7:a69ae964412c
el17zy Yang Zhenye
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yangzhenye | 4:eb8dca1dc341 | 1 | #ifndef ROONEY_H |
yangzhenye | 4:eb8dca1dc341 | 2 | #define ROONEY_H |
yangzhenye | 4:eb8dca1dc341 | 3 | |
yangzhenye | 4:eb8dca1dc341 | 4 | #include "mbed.h" |
yangzhenye | 4:eb8dca1dc341 | 5 | #include "N5110.h" |
yangzhenye | 4:eb8dca1dc341 | 6 | #include "Gamepad.h" |
yangzhenye | 5:fcad75e9b9e1 | 7 | enum rooneybody{left, right, stand}; |
yangzhenye | 4:eb8dca1dc341 | 8 | class player |
yangzhenye | 4:eb8dca1dc341 | 9 | { |
yangzhenye | 4:eb8dca1dc341 | 10 | public: |
yangzhenye | 4:eb8dca1dc341 | 11 | // Constructor and destructor. |
yangzhenye | 4:eb8dca1dc341 | 12 | /** |
yangzhenye | 4:eb8dca1dc341 | 13 | * @brief Constructor @details Non user specified. |
yangzhenye | 4:eb8dca1dc341 | 14 | */ |
yangzhenye | 4:eb8dca1dc341 | 15 | player(); |
yangzhenye | 4:eb8dca1dc341 | 16 | /** |
yangzhenye | 4:eb8dca1dc341 | 17 | * @brief Destructor @details Non user specified. |
yangzhenye | 4:eb8dca1dc341 | 18 | */ |
yangzhenye | 4:eb8dca1dc341 | 19 | ~player(); |
yangzhenye | 9:a5a82b3d1102 | 20 | /** |
yangzhenye | 9:a5a82b3d1102 | 21 | * @brief Initialises the Rooney. |
yangzhenye | 9:a5a82b3d1102 | 22 | */ |
yangzhenye | 4:eb8dca1dc341 | 23 | void init(); |
yangzhenye | 9:a5a82b3d1102 | 24 | /** |
yangzhenye | 9:a5a82b3d1102 | 25 | * @brief set the rooney position. |
yangzhenye | 9:a5a82b3d1102 | 26 | */ |
yangzhenye | 5:fcad75e9b9e1 | 27 | void set_palyer_x(float joy_x, int speed); |
yangzhenye | 9:a5a82b3d1102 | 28 | /** |
yangzhenye | 9:a5a82b3d1102 | 29 | * @brief get the collision flag. |
yangzhenye | 9:a5a82b3d1102 | 30 | * @param &gamepad @details The gamepad object from Gamepad class. |
yangzhenye | 9:a5a82b3d1102 | 31 | */ |
yangzhenye | 6:4abef55fee88 | 32 | bool collision_flag(); |
yangzhenye | 9:a5a82b3d1102 | 33 | /** |
yangzhenye | 9:a5a82b3d1102 | 34 | * @brief set the rooney body form. |
yangzhenye | 9:a5a82b3d1102 | 35 | */ |
yangzhenye | 5:fcad75e9b9e1 | 36 | int * get_form(rooneybody body); |
yangzhenye | 9:a5a82b3d1102 | 37 | /** |
yangzhenye | 9:a5a82b3d1102 | 38 | * @brief set the rooney body y. |
yangzhenye | 9:a5a82b3d1102 | 39 | */ |
yangzhenye | 4:eb8dca1dc341 | 40 | int get_y(); |
yangzhenye | 9:a5a82b3d1102 | 41 | /** |
yangzhenye | 9:a5a82b3d1102 | 42 | * @brief set the rooney body x. |
yangzhenye | 9:a5a82b3d1102 | 43 | */ |
yangzhenye | 4:eb8dca1dc341 | 44 | int get_x(); |
yangzhenye | 9:a5a82b3d1102 | 45 | /** |
yangzhenye | 9:a5a82b3d1102 | 46 | * @brief set the rooney speed |
yangzhenye | 9:a5a82b3d1102 | 47 | */ |
yangzhenye | 4:eb8dca1dc341 | 48 | int get_speed(); |
yangzhenye | 9:a5a82b3d1102 | 49 | /** |
yangzhenye | 9:a5a82b3d1102 | 50 | * @brief add the score. |
yangzhenye | 9:a5a82b3d1102 | 51 | */ |
yangzhenye | 6:4abef55fee88 | 52 | void add_score(); |
yangzhenye | 9:a5a82b3d1102 | 53 | /** |
yangzhenye | 9:a5a82b3d1102 | 54 | * @brief get the score. |
yangzhenye | 9:a5a82b3d1102 | 55 | */ |
yangzhenye | 6:4abef55fee88 | 56 | int get_score(); |
yangzhenye | 9:a5a82b3d1102 | 57 | /** |
yangzhenye | 9:a5a82b3d1102 | 58 | * @draw form. |
yangzhenye | 9:a5a82b3d1102 | 59 | */ |
yangzhenye | 7:a69ae964412c | 60 | int drawrooney(N5110 &lcd); |
yangzhenye | 4:eb8dca1dc341 | 61 | |
yangzhenye | 4:eb8dca1dc341 | 62 | private: |
yangzhenye | 4:eb8dca1dc341 | 63 | |
yangzhenye | 5:fcad75e9b9e1 | 64 | int _player_x; |
yangzhenye | 5:fcad75e9b9e1 | 65 | int _player_y; |
yangzhenye | 6:4abef55fee88 | 66 | bool _collision_flag; |
yangzhenye | 5:fcad75e9b9e1 | 67 | int _speed; |
yangzhenye | 6:4abef55fee88 | 68 | int _x; |
yangzhenye | 6:4abef55fee88 | 69 | int _y; |
yangzhenye | 6:4abef55fee88 | 70 | int _score; |
yangzhenye | 5:fcad75e9b9e1 | 71 | rooneybody body; |
yangzhenye | 5:fcad75e9b9e1 | 72 | }; |
yangzhenye | 4:eb8dca1dc341 | 73 | #endif |