ZIYI CHEN ml17z4c 201214999

Dependencies:   mbed

Revision:
7:8b6f175fcb0e
Child:
8:52e0506e98b8
diff -r 13c43182a848 -r 8b6f175fcb0e Food/Food.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Food/Food.cpp	Tue Apr 30 09:14:17 2019 +0000
@@ -0,0 +1,38 @@
+#include "Food.h"
+
+// nothing doing in the constructor and destructor
+Food::Food()
+{
+
+}
+
+Food::~Food()
+{
+
+}
+
+//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 initialised\n");
+}
+
+int Food::getX()
+{
+    return _x;
+}
+
+int Food::getY()
+{
+    return _y;
+}
+
+void Food::random()
+{
+    _x = rand() % 48;  //randomly generates a number between 0 and 21
+    _y = rand() % 84;  
+}
\ No newline at end of file