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.
Dependencies: mbed
Diff: Food/Food.cpp
- Revision:
- 6:266fb8fc17f4
- Parent:
- 1:bdafa20e71a0
- Child:
- 7:24a3f13ce36d
--- a/Food/Food.cpp Thu May 28 16:29:55 2020 +0000
+++ b/Food/Food.cpp Thu May 28 22:56:46 2020 +0000
@@ -0,0 +1,21 @@
+#include "Food.h"
+
+Food::Food() {
+ }
+ Food::~Food() {
+ }
+void Food::init(){
+ srand(time(NULL));
+
+_foodx = (rand() % (WIDTH ));
+_foody = (rand() % (HEIGHT ));
+}
+
+ void Food::draw(N5110 &lcd){
+ lcd.drawRect(_foodx, _foody, 2, 2, FILL_BLACK);
+ }
+
+ Vector2D Food::get_f()
+{
+ Vector2D f = {_foodx,_foody};
+ return f;}
\ No newline at end of file