
Final Commit
Dependencies: mbed
Food/Food.h@8:a2b431b9b3f7, 2018-03-22 (annotated)
- Committer:
- JRM1986
- Date:
- Thu Mar 22 14:52:08 2018 +0000
- Revision:
- 8:a2b431b9b3f7
- Parent:
- 7:c38800a428a6
- Child:
- 15:4c97fe30f3b7
Function to get random position for food now working; To do next; Snake movement; Snake collision detection;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JRM1986 | 2:ea90cec2489a | 1 | #ifndef FOOD_H |
JRM1986 | 2:ea90cec2489a | 2 | #define FOOD_H |
JRM1986 | 2:ea90cec2489a | 3 | |
JRM1986 | 2:ea90cec2489a | 4 | #include "mbed.h" |
JRM1986 | 3:50f01159c61d | 5 | #include "FXOS8700CQ.h" |
JRM1986 | 3:50f01159c61d | 6 | #include "Gamepad.h" |
JRM1986 | 2:ea90cec2489a | 7 | #include "N5110.h" |
JRM1986 | 2:ea90cec2489a | 8 | |
JRM1986 | 3:50f01159c61d | 9 | |
JRM1986 | 2:ea90cec2489a | 10 | /** Food Class |
JRM1986 | 1:c3fdbc4b1293 | 11 | * @brief Describes the methods and functions for the food |
JRM1986 | 1:c3fdbc4b1293 | 12 | * @author Joshua R. Marshall |
JRM1986 | 1:c3fdbc4b1293 | 13 | * @date Feb, 2018 |
JRM1986 | 2:ea90cec2489a | 14 | */ |
JRM1986 | 2:ea90cec2489a | 15 | |
JRM1986 | 2:ea90cec2489a | 16 | class Food |
JRM1986 | 2:ea90cec2489a | 17 | { |
JRM1986 | 2:ea90cec2489a | 18 | |
JRM1986 | 2:ea90cec2489a | 19 | public: |
JRM1986 | 2:ea90cec2489a | 20 | Food(); // constructor |
JRM1986 | 2:ea90cec2489a | 21 | ~Food(); // destructor |
JRM1986 | 3:50f01159c61d | 22 | |
JRM1986 | 7:c38800a428a6 | 23 | void init(int pos_x, int pos_y); |
JRM1986 | 6:f3f508cea1c4 | 24 | void update(); |
JRM1986 | 6:f3f508cea1c4 | 25 | void draw(N5110 &lcd); // draws the food on the lcd |
JRM1986 | 2:ea90cec2489a | 26 | |
JRM1986 | 8:a2b431b9b3f7 | 27 | Vector2D get_rand_pos(); // gets a random number between 0-48, and 0 - 84 |
JRM1986 | 2:ea90cec2489a | 28 | |
JRM1986 | 2:ea90cec2489a | 29 | private: |
JRM1986 | 2:ea90cec2489a | 30 | |
JRM1986 | 3:50f01159c61d | 31 | int _x; |
JRM1986 | 3:50f01159c61d | 32 | int _y; |
JRM1986 | 2:ea90cec2489a | 33 | |
JRM1986 | 2:ea90cec2489a | 34 | }; |
JRM1986 | 2:ea90cec2489a | 35 | #endif |