ZIYI CHEN ml17z4c 201214999

Dependencies:   mbed

Committer:
ziyi11
Date:
Thu May 09 14:48:43 2019 +0000
Revision:
14:60c31d25d895
Parent:
13:08bdb4cffacd
can not add doc;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ziyi11 13:08bdb4cffacd 1 #include "Food.h"
ziyi11 13:08bdb4cffacd 2
ziyi11 13:08bdb4cffacd 3
ziyi11 13:08bdb4cffacd 4 Food::Food()
ziyi11 13:08bdb4cffacd 5 {
ziyi11 13:08bdb4cffacd 6
ziyi11 13:08bdb4cffacd 7 }
ziyi11 13:08bdb4cffacd 8
ziyi11 13:08bdb4cffacd 9 Food::~Food()
ziyi11 13:08bdb4cffacd 10 {
ziyi11 13:08bdb4cffacd 11
ziyi11 13:08bdb4cffacd 12 }
ziyi11 13:08bdb4cffacd 13
ziyi11 13:08bdb4cffacd 14
ziyi11 13:08bdb4cffacd 15
ziyi11 13:08bdb4cffacd 16 void Food::init(int x, int y)
ziyi11 13:08bdb4cffacd 17 {
ziyi11 13:08bdb4cffacd 18 _x = x;
ziyi11 13:08bdb4cffacd 19 _y = y;
ziyi11 13:08bdb4cffacd 20
ziyi11 13:08bdb4cffacd 21 }
ziyi11 13:08bdb4cffacd 22
ziyi11 13:08bdb4cffacd 23 int Food::xcoordinate()
ziyi11 13:08bdb4cffacd 24 {
ziyi11 13:08bdb4cffacd 25 return _x;
ziyi11 13:08bdb4cffacd 26 }
ziyi11 13:08bdb4cffacd 27
ziyi11 13:08bdb4cffacd 28 int Food::ycoordinate()
ziyi11 13:08bdb4cffacd 29 {
ziyi11 13:08bdb4cffacd 30 return _y;
ziyi11 13:08bdb4cffacd 31 }
ziyi11 13:08bdb4cffacd 32
ziyi11 13:08bdb4cffacd 33 void Food::random()
ziyi11 13:08bdb4cffacd 34 {
ziyi11 13:08bdb4cffacd 35 _x = rand() % 40;
ziyi11 13:08bdb4cffacd 36 _y = rand() % 20;
ziyi11 13:08bdb4cffacd 37 }