Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Food.cpp
00001 #include "Food.h" 00002 00003 pos food; 00004 00005 00006 Food::Food(){ 00007 00008 } 00009 00010 Food::~Food(){ 00011 00012 } 00013 void Food::init(){ 00014 00015 food.x=7; 00016 food.y=30; 00017 }//set the initial foof position 00018 00019 void Food::draw(N5110 &lcd){ 00020 00021 lcd.setPixel(food.x,food.y); 00022 00023 }//draw the food on the screen 00024 00025 void Food::response(){ 00026 00027 srand(time(NULL)); 00028 food.x=(rand()%35)+5; 00029 food.y=(rand()%28)+3; 00030 } 00031 00032 pos Food::returnPos(){ 00033 00034 pos a = { food.x, food.y}; 00035 return a; 00036 00037 }//report position of food
Generated on Mon Jul 18 2022 14:19:10 by
