ZIYI CHEN ml17z4c 201214999
Dependencies: mbed
Food/Food.h@9:a8b2086a46e5, 2019-05-08 (annotated)
- Committer:
- ziyi11
- Date:
- Wed May 08 20:48:33 2019 +0000
- Revision:
- 9:a8b2086a46e5
- Parent:
- 8:52e0506e98b8
try1
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 | /** The Food class |
ziyi11 | 9:a8b2086a46e5 | 6 | * @brief generate a position of food randomly |
ziyi11 | 9:a8b2086a46e5 | 7 | * @author ZIYI CHEN |
ziyi11 | 9:a8b2086a46e5 | 8 | * @date may 2019 |
ziyi11 | 7:8b6f175fcb0e | 9 | */ |
ziyi11 | 7:8b6f175fcb0e | 10 | |
ziyi11 | 7:8b6f175fcb0e | 11 | class Food |
ziyi11 | 7:8b6f175fcb0e | 12 | { |
ziyi11 | 7:8b6f175fcb0e | 13 | public: |
ziyi11 | 7:8b6f175fcb0e | 14 | |
ziyi11 | 9:a8b2086a46e5 | 15 | /**Constructor*/ |
ziyi11 | 7:8b6f175fcb0e | 16 | Food(); |
ziyi11 | 9:a8b2086a46e5 | 17 | /**Destructor*/ |
ziyi11 | 7:8b6f175fcb0e | 18 | ~Food(); |
ziyi11 | 7:8b6f175fcb0e | 19 | |
ziyi11 | 9:a8b2086a46e5 | 20 | |
ziyi11 | 9:a8b2086a46e5 | 21 | /** Init function |
ziyi11 | 9:a8b2086a46e5 | 22 | * @param set the position of the food (x,y) |
ziyi11 | 9:a8b2086a46e5 | 23 | */ |
ziyi11 | 7:8b6f175fcb0e | 24 | void init(int x, int y); |
ziyi11 | 7:8b6f175fcb0e | 25 | |
ziyi11 | 9:a8b2086a46e5 | 26 | /** Gets x coordinate of the food |
ziyi11 | 9:a8b2086a46e5 | 27 | * @return X coordinate |
ziyi11 | 9:a8b2086a46e5 | 28 | */ |
ziyi11 | 9:a8b2086a46e5 | 29 | int xcoordinate(); |
ziyi11 | 9:a8b2086a46e5 | 30 | |
ziyi11 | 9:a8b2086a46e5 | 31 | /** Gets y coordinate of the food |
ziyi11 | 9:a8b2086a46e5 | 32 | * @return Y coordinate |
ziyi11 | 9:a8b2086a46e5 | 33 | */ |
ziyi11 | 9:a8b2086a46e5 | 34 | int ycoordinate(); |
ziyi11 | 9:a8b2086a46e5 | 35 | |
ziyi11 | 9:a8b2086a46e5 | 36 | /**Generate the location of the food randomly*/ |
ziyi11 | 7:8b6f175fcb0e | 37 | void random(); |
ziyi11 | 9:a8b2086a46e5 | 38 | /**the integer variables _x and _y*/ |
ziyi11 | 7:8b6f175fcb0e | 39 | int _x; |
ziyi11 | 7:8b6f175fcb0e | 40 | int _y; |
ziyi11 | 9:a8b2086a46e5 | 41 | |
ziyi11 | 9:a8b2086a46e5 | 42 | |
ziyi11 | 9:a8b2086a46e5 | 43 | |
ziyi11 | 7:8b6f175fcb0e | 44 | }; |