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.
Diff: element/element.cpp
- Revision:
- 12:80e737144104
- Parent:
- 10:ae5f62a1e40e
--- a/element/element.cpp Wed May 08 20:16:29 2019 +0000
+++ b/element/element.cpp Wed May 08 21:03:33 2019 +0000
@@ -14,7 +14,7 @@
_foodpos.x=foodx;
_foodpos.y=foody;
for(int i=0;i<n;i++){
- _snakebody[i].x=snakex+2*i;
+ _snakebody[i].x=snakex+i;
_snakebody[i].y=snakey;
}
@@ -23,8 +23,8 @@
{
srand(time(NULL));
- _foodpos.x=rand()%(WIDTH-2);
- _foodpos.y=rand()%(HEIGHT-2);
+ _foodpos.x=rand()%(WIDTH-10);
+ _foodpos.y=rand()%(HEIGHT-10);
}
@@ -36,7 +36,7 @@
void element::draw(N5110 &lcd,int n){
lcd.drawRect(_foodpos.x,_foodpos.y,_size,_size,FILL_BLACK);
for(int i=0;i<n;i++){
- lcd.drawRect(_snakebody[i].x,_snakebody[i].y,3,3,FILL_BLACK);
+ lcd.drawRect(_snakebody[i].x,_snakebody[i].y,2,2,FILL_BLACK);
}
}
void element::input(Gamepad &pad){