![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
ZIYI CHEN ml17z4c 201214999
Dependencies: mbed
Food/Food.h@8:52e0506e98b8, 2019-05-06 (annotated)
- Committer:
- ziyi11
- Date:
- Mon May 06 00:06:15 2019 +0000
- Revision:
- 8:52e0506e98b8
- Parent:
- 7:8b6f175fcb0e
- Child:
- 9:a8b2086a46e5
add game.h and game.cpp although it still has some errors
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ziyi11 | 7:8b6f175fcb0e | 1 | #include "mbed.h" |
ziyi11 | 7:8b6f175fcb0e | 2 | #include "N5110.h" |
ziyi11 | 7:8b6f175fcb0e | 3 | #include "Gamepad.h" |
ziyi11 | 7:8b6f175fcb0e | 4 | |
ziyi11 | 7:8b6f175fcb0e | 5 | |
ziyi11 | 7:8b6f175fcb0e | 6 | /** The Food class |
ziyi11 | 7:8b6f175fcb0e | 7 | * @brief generate a position of the food for snake |
ziyi11 | 7:8b6f175fcb0e | 8 | * @author ZiYi Chen |
ziyi11 | 7:8b6f175fcb0e | 9 | * @date May, 2019 |
ziyi11 | 7:8b6f175fcb0e | 10 | */ |
ziyi11 | 7:8b6f175fcb0e | 11 | |
ziyi11 | 7:8b6f175fcb0e | 12 | class Food |
ziyi11 | 7:8b6f175fcb0e | 13 | { |
ziyi11 | 7:8b6f175fcb0e | 14 | public: |
ziyi11 | 7:8b6f175fcb0e | 15 | |
ziyi11 | 8:52e0506e98b8 | 16 | |
ziyi11 | 7:8b6f175fcb0e | 17 | Food(); |
ziyi11 | 7:8b6f175fcb0e | 18 | |
ziyi11 | 8:52e0506e98b8 | 19 | |
ziyi11 | 7:8b6f175fcb0e | 20 | ~Food(); |
ziyi11 | 7:8b6f175fcb0e | 21 | |
ziyi11 | 7:8b6f175fcb0e | 22 | void init(int x, int y); |
ziyi11 | 7:8b6f175fcb0e | 23 | |
ziyi11 | 7:8b6f175fcb0e | 24 | int getX(); |
ziyi11 | 7:8b6f175fcb0e | 25 | |
ziyi11 | 7:8b6f175fcb0e | 26 | int getY(); |
ziyi11 | 7:8b6f175fcb0e | 27 | |
ziyi11 | 7:8b6f175fcb0e | 28 | void random(); |
ziyi11 | 7:8b6f175fcb0e | 29 | |
ziyi11 | 7:8b6f175fcb0e | 30 | private: |
ziyi11 | 7:8b6f175fcb0e | 31 | |
ziyi11 | 7:8b6f175fcb0e | 32 | int _x; |
ziyi11 | 7:8b6f175fcb0e | 33 | int _y; |
ziyi11 | 7:8b6f175fcb0e | 34 | }; |