Yang Meng
/
207_program
Similar to the example code.
Bird/Bird.h@7:f3b57f157655, 2019-05-05 (annotated)
- Committer:
- 2016110307
- Date:
- Sun May 05 16:17:55 2019 +0000
- Revision:
- 7:f3b57f157655
- Parent:
- 4:ed68b20e2075
Final Submission. I have read and agreed with Statement of Academic Integrity.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
2016110307 | 0:97418ec4c37d | 1 | #ifndef BIRD_H |
2016110307 | 0:97418ec4c37d | 2 | #define BIRD_H |
2016110307 | 0:97418ec4c37d | 3 | |
2016110307 | 0:97418ec4c37d | 4 | #include "mbed.h" |
2016110307 | 0:97418ec4c37d | 5 | #include "N5110.h" |
2016110307 | 0:97418ec4c37d | 6 | #include "Gamepad.h" |
2016110307 | 0:97418ec4c37d | 7 | |
2016110307 | 2:533869513c4a | 8 | /** Bird Class |
2016110307 | 2:533869513c4a | 9 | |
2016110307 | 3:19aed51289d1 | 10 | *@brief Library to create the bird |
2016110307 | 3:19aed51289d1 | 11 | *@author Meng Yang |
2016110307 | 3:19aed51289d1 | 12 | *@date May 2017 |
2016110307 | 2:533869513c4a | 13 | |
2016110307 | 2:533869513c4a | 14 | */ |
2016110307 | 0:97418ec4c37d | 15 | |
2016110307 | 0:97418ec4c37d | 16 | class Bird |
2016110307 | 0:97418ec4c37d | 17 | |
2016110307 | 0:97418ec4c37d | 18 | { |
2016110307 | 0:97418ec4c37d | 19 | public : |
2016110307 | 2:533869513c4a | 20 | |
2016110307 | 2:533869513c4a | 21 | /** |
2016110307 | 2:533869513c4a | 22 | *@brief Initialise all the parameters of the bird |
2016110307 | 2:533869513c4a | 23 | */ |
2016110307 | 0:97418ec4c37d | 24 | void init(); |
2016110307 | 2:533869513c4a | 25 | |
2016110307 | 2:533869513c4a | 26 | /** |
2016110307 | 2:533869513c4a | 27 | *@brief Set the speed of the bird |
2016110307 | 2:533869513c4a | 28 | *@param speed |
2016110307 | 2:533869513c4a | 29 | *@details The speed of the bird |
2016110307 | 2:533869513c4a | 30 | */ |
2016110307 | 1:85ab0d979b57 | 31 | void set_speed(int speed); |
2016110307 | 2:533869513c4a | 32 | |
2016110307 | 2:533869513c4a | 33 | /** |
2016110307 | 2:533869513c4a | 34 | *@brief Draw the bird |
2016110307 | 2:533869513c4a | 35 | *@param lcd The name of N5110 object |
2016110307 | 2:533869513c4a | 36 | *@details Use this method to use the functions within N5110.h file |
2016110307 | 2:533869513c4a | 37 | */ |
2016110307 | 0:97418ec4c37d | 38 | void draw(N5110 &lcd); |
2016110307 | 2:533869513c4a | 39 | |
2016110307 | 2:533869513c4a | 40 | /** |
2016110307 | 2:533869513c4a | 41 | *@brief update the data of the bird |
2016110307 | 2:533869513c4a | 42 | *@param pad The name of Gamepad object |
2016110307 | 4:ed68b20e2075 | 43 | *@details Use this method to use the functions within Gamepad.h file |
2016110307 | 2:533869513c4a | 44 | */ |
2016110307 | 0:97418ec4c37d | 45 | void update(Gamepad &pad); |
2016110307 | 2:533869513c4a | 46 | |
2016110307 | 2:533869513c4a | 47 | /** |
2016110307 | 2:533869513c4a | 48 | *@brief set lcd mode when game over |
2016110307 | 2:533869513c4a | 49 | *@param lcd The name of N5110 object |
2016110307 | 2:533869513c4a | 50 | *@details Use this method to use the functions within N5110.h file |
2016110307 | 2:533869513c4a | 51 | */ |
2016110307 | 0:97418ec4c37d | 52 | void background(N5110 &lcd); |
2016110307 | 2:533869513c4a | 53 | |
2016110307 | 2:533869513c4a | 54 | /** |
2016110307 | 2:533869513c4a | 55 | *@brief get position of the bird |
2016110307 | 2:533869513c4a | 56 | *@returns position of the bird |
2016110307 | 2:533869513c4a | 57 | */ |
2016110307 | 0:97418ec4c37d | 58 | int get_y(); |
2016110307 | 0:97418ec4c37d | 59 | |
2016110307 | 0:97418ec4c37d | 60 | |
2016110307 | 0:97418ec4c37d | 61 | |
2016110307 | 0:97418ec4c37d | 62 | private : |
2016110307 | 0:97418ec4c37d | 63 | int _y; |
2016110307 | 0:97418ec4c37d | 64 | int _head; |
2016110307 | 0:97418ec4c37d | 65 | int _speed; |
2016110307 | 0:97418ec4c37d | 66 | |
2016110307 | 0:97418ec4c37d | 67 | }; |
2016110307 | 0:97418ec4c37d | 68 | |
2016110307 | 0:97418ec4c37d | 69 | #endif |
2016110307 | 0:97418ec4c37d | 70 |