Final Commit

Dependencies:   mbed

Committer:
JRM1986
Date:
Fri Mar 16 13:02:55 2018 +0000
Revision:
6:f3f508cea1c4
Parent:
5:27fcb9b36e7e
Child:
7:c38800a428a6
Basic functions for main, and SnakeEngine introduced but not defined

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JRM1986 2:ea90cec2489a 1 #include "Food.h"
JRM1986 2:ea90cec2489a 2
JRM1986 2:ea90cec2489a 3
JRM1986 2:ea90cec2489a 4 Food::Food()
JRM1986 2:ea90cec2489a 5 {
JRM1986 2:ea90cec2489a 6
JRM1986 2:ea90cec2489a 7 }
JRM1986 2:ea90cec2489a 8
JRM1986 2:ea90cec2489a 9 Food::~Food()
JRM1986 2:ea90cec2489a 10 {
JRM1986 2:ea90cec2489a 11
JRM1986 3:50f01159c61d 12 }
JRM1986 3:50f01159c61d 13
JRM1986 6:f3f508cea1c4 14 Vector2D Food::get_position()
JRM1986 3:50f01159c61d 15 {
JRM1986 6:f3f508cea1c4 16 Vector2D p = {_x,_y};
JRM1986 3:50f01159c61d 17
JRM1986 3:50f01159c61d 18 return p;
JRM1986 3:50f01159c61d 19 }
JRM1986 3:50f01159c61d 20
JRM1986 6:f3f508cea1c4 21 void Food::set_position(Vector2D p)
JRM1986 3:50f01159c61d 22 {
JRM1986 3:50f01159c61d 23 srand(time(NULL));
JRM1986 3:50f01159c61d 24
JRM1986 6:f3f508cea1c4 25 _x = rand() % 84;
JRM1986 6:f3f508cea1c4 26 _x = rand() % 48;
JRM1986 3:50f01159c61d 27
JRM1986 3:50f01159c61d 28 _x = p.x;
JRM1986 3:50f01159c61d 29 _y = p.y;
JRM1986 3:50f01159c61d 30
JRM1986 5:27fcb9b36e7e 31 }
JRM1986 5:27fcb9b36e7e 32
JRM1986 5:27fcb9b36e7e 33 void Food::draw(N5110 &lcd) {
JRM1986 5:27fcb9b36e7e 34
JRM1986 5:27fcb9b36e7e 35 lcd.setPixel(_x,_y,true);
JRM1986 5:27fcb9b36e7e 36
JRM1986 2:ea90cec2489a 37 }