ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18lg

Dependencies:   mbed

Committer:
el18lg
Date:
Thu May 28 22:56:46 2020 +0000
Revision:
6:266fb8fc17f4
Parent:
1:bdafa20e71a0
Child:
7:24a3f13ce36d
Snake body now follows the head of my snake;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el18lg 6:266fb8fc17f4 1 #include "Food.h"
el18lg 6:266fb8fc17f4 2
el18lg 6:266fb8fc17f4 3 Food::Food() {
el18lg 6:266fb8fc17f4 4 }
el18lg 6:266fb8fc17f4 5 Food::~Food() {
el18lg 6:266fb8fc17f4 6 }
el18lg 6:266fb8fc17f4 7 void Food::init(){
el18lg 6:266fb8fc17f4 8 srand(time(NULL));
el18lg 6:266fb8fc17f4 9
el18lg 6:266fb8fc17f4 10 _foodx = (rand() % (WIDTH ));
el18lg 6:266fb8fc17f4 11 _foody = (rand() % (HEIGHT ));
el18lg 6:266fb8fc17f4 12 }
el18lg 6:266fb8fc17f4 13
el18lg 6:266fb8fc17f4 14 void Food::draw(N5110 &lcd){
el18lg 6:266fb8fc17f4 15 lcd.drawRect(_foodx, _foody, 2, 2, FILL_BLACK);
el18lg 6:266fb8fc17f4 16 }
el18lg 6:266fb8fc17f4 17
el18lg 6:266fb8fc17f4 18 Vector2D Food::get_f()
el18lg 6:266fb8fc17f4 19 {
el18lg 6:266fb8fc17f4 20 Vector2D f = {_foodx,_foody};
el18lg 6:266fb8fc17f4 21 return f;}