ZIYI CHEN ml17z4c 201214999
Dependencies: mbed
Diff: Food/Food.cpp
- Revision:
- 9:a8b2086a46e5
- Parent:
- 8:52e0506e98b8
--- a/Food/Food.cpp Mon May 06 00:06:15 2019 +0000 +++ b/Food/Food.cpp Wed May 08 20:48:33 2019 +0000 @@ -1,6 +1,6 @@ #include "Food.h" -// nothing doing in the constructor and destructor + Food::Food() { @@ -11,28 +11,27 @@ } -//No major comments are needed as all fucntions are simple and self explanatory + void Food::init(int x, int y) { _x = x; _y = y; - printf("Food init\n"); } - -int Food::getX() +int Food::xcoordinate() { return _x; } -int Food::getY() +int Food::ycoordinate() { return _y; } + void Food::random() { - _x = rand() % 48; //randomly generates a number between 0 and 21 - _y = rand() % 84; -} + _x = rand() % 40; + _y = rand() % 20; +} \ No newline at end of file