ZIYI CHEN ml17z4c 201214999

Dependencies:   mbed

Food/Food.cpp

Committer:
ziyi11
Date:
2019-04-30
Revision:
7:8b6f175fcb0e
Child:
8:52e0506e98b8

File content as of revision 7:8b6f175fcb0e:

#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;  
}