library for SnekGame
Diff: Food.cpp
- Revision:
- 1:8d4639c9d1b0
- Parent:
- 0:337503f9282c
--- a/Food.cpp Fri May 05 11:55:49 2017 +0000 +++ b/Food.cpp Fri May 05 15:19:10 2017 +0000 @@ -1,40 +1,37 @@ #include "Food.h" -//posXY food; +posXY food; Food::Food(){ - - - - } +} Food::~Food(){ - - - - - } +} void Food::init(){ - - - - - - - } + food.x=48;//set first food + food.y=25; +}//end of init -void Food::draw(){ - +void Food::draw(N5110 &lcd){ - - - } + lcd.setPixel(food.x,food.y);//draw food + +}//end of draw void Food::respawn(){ - + + srand(time(NULL));//randomly respawn food + food.x=(rand()%81)+2; + food.y=(rand()%27)+10; +}//end of respawn + +posXY Food::returnPos(){ + posXY p = { food.x, food.y}; + return p; + } \ No newline at end of file