ELEC2645 (2017/18) / Mbed OS el16ajm

Food/Food.cpp

Committer:
Andrew_M
Date:
2018-05-08
Revision:
15:130900e5c268
Parent:
7:c1e0593bfc99
Child:
17:2a909f7da973

File content as of revision 15:130900e5c268:

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

int Food::getX()
{
    return _x;
}

int Food::getY()
{
    return _y;
}

void Food::random()
{
    _x = rand() % 22;  //randomly generates a number between 0 and 21
    _y = rand() % 22;  
}