Snake game food library
Food.cpp
- Committer:
- 1012754868
- Date:
- 2019-04-26
- Revision:
- 2:679ab99f2c0f
- Parent:
- 1:8d4639c9d1b0
File content as of revision 2:679ab99f2c0f:
#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; }