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: Fruit/Fruit.cpp
- Revision:
- 15:47ea86f1ed70
- Parent:
- 13:4026781772cb
- Child:
- 18:e58a1f8e72ad
--- a/Fruit/Fruit.cpp Sun May 06 12:58:00 2018 +0000
+++ b/Fruit/Fruit.cpp Mon May 07 11:57:22 2018 +0000
@@ -11,14 +11,7 @@
}
-void Fruit::init(int size){
- //position of the fruit at Y axis and X axis in the LCD screen which are 84 and 48 , initial position of fruit
-
- _size = size;
- _posx = WIDTH/2 - _size/2;
- _posy = HEIGHT/2 - _size/2;
-
-}
+
void Fruit::reborn(){//randomise the location of the fruit after it is ate by the sanke
srand(time(NULL));
@@ -27,9 +20,9 @@
}
-void Fruit::draw(N5110 &lcd){//the map
- lcd.drawRect(_posx ,_posy ,_size ,_size ,FILL_BLACK);
-
+void Fruit::draw(N5110 &lcd)
+{
+ lcd.setPixel(_posx ,_posy );
}
Vector2D Fruit::get_pos(){//get the similar from Pong