Li Saiwen 201089052

Dependencies:   mbed Gamepad N5110

Food/Food.cpp

Committer:
1012754868
Date:
2019-05-05
Revision:
7:cafa0b96e8d3
Parent:
3:7b28047013d2

File content as of revision 7:cafa0b96e8d3:

#include "Food.h"

Foodpos food;


Food::Food(){
    
}
    
Food::~Food(){
    
}
void Food::init(){
        food.x=50;
        food.y=25;
}
    
void Food::drawfood(N5110 &lcd){
    
        lcd.setPixel(food.x,food.y);
            
}
    
void Food::createfood(){
        
        srand(time(NULL));
        food.x=(rand()%81)+2;
        food.y=(rand()%27)+10;
    
}

Foodpos Food::returnPos(){
    
        Foodpos p = { food.x, food.y};
        return p;   
        
}