Li Saiwen 201089052
Dependencies: mbed Gamepad N5110
Food/Food.cpp
- Committer:
- 1012754868
- Date:
- 2019-05-02
- Revision:
- 3:7b28047013d2
- Child:
- 7:cafa0b96e8d3
File content as of revision 3:7b28047013d2:
#include "Food.h" Foodpos food; Food::Food(){ } Food::~Food(){ } void Food::init(){ food.x=48;//set first food food.y=25; }//end of init void Food::drawfood(N5110 &lcd){ lcd.setPixel(food.x,food.y);//draw food }//end of draw void Food::createfood(){ srand(time(NULL));//randomly respawn food food.x=(rand()%81)+2; food.y=(rand()%27)+10; }//end of respawn Foodpos Food::returnPos(){ Foodpos p = { food.x, food.y}; return p; }