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: Friendly.cpp
- Revision:
- 5:0cd7f779418a
- Parent:
- 4:879c4cb8a7e4
- Child:
- 6:378b5d29e9cf
--- a/Friendly.cpp Wed Mar 15 14:34:43 2017 +0000 +++ b/Friendly.cpp Sat Apr 01 11:44:15 2017 +0000 @@ -18,20 +18,17 @@ void Friendly::draw(N5110 &lcd) // draws friendly ship in screen buffer { - lcd.drawLine(_x,_y,_x,_y+5,1); - lcd.setPixel(_x+1,_y); - lcd.setPixel(_x+1,_y+5); - lcd.setPixel(_x+2,_y+1); - lcd.setPixel(_x+2,_y+4); - lcd.setPixel(_x+3,_y+1); - lcd.setPixel(_x+3,_y+4); - lcd.setPixel(_x+4,_y+2); - lcd.setPixel(_x+4,_y+3); + lcd.drawLine(_x,_y,_x,_y+6,1); + lcd.drawLine(_x+1,_y,_x+3,_y,1); + lcd.drawLine(_x+1,_y+6,_x+3,_y+6,1); + lcd.drawLine(_x+4,_y+1,_x+5,_y+1,1); + lcd.drawLine(_x+4,_y+5,_x+5,_y+5,1); + lcd.drawLine(_x+6,_y+2,_x+6,_y+4,1); } void Friendly::update(Direction d,float mag) { - _speed = int(mag*10.0f); + _speed = int(mag*4.0f); // four-directional movement if (d == N) { @@ -57,8 +54,8 @@ _x = 1; } - if (_x > WIDTH/1.5 - _width - 1) { - _x = WIDTH/1.5 - _width - 1; + if (_x > 78) { + _x = 78; } }