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: Ball/Ball.cpp
- Revision:
- 10:dbc149804a06
- Parent:
- 9:e6566d09f087
- Child:
- 11:59119247dd68
--- a/Ball/Ball.cpp Sun May 17 23:00:04 2020 +0000 +++ b/Ball/Ball.cpp Sun May 17 23:28:13 2020 +0000 @@ -142,6 +142,7 @@ void Ball::display_background(){ //draw goal _lcd->drawSprite(7,0,24,70,(int *)goal); + level2(); //draw grass _lcd->drawSprite(1,17,7,7,(int *)grass); _lcd->drawSprite(76,17,7,7,(int *)grass); @@ -160,9 +161,58 @@ // aim triangle base _lcd->drawLine(WIDTH / 2 + 5, 41, WIDTH / 2 - 5, 41, 1); } -void Ball::set_status(bool status){_status = status;} +void Ball::set_status(bool status){ + _status = status; +} -int Ball::get_status() { - int val = _status; +bool Ball::get_status() { + bool val = _status; + return val; +} +void Ball::set_level(int level ){ + _level = level; +} + +int Ball::get_level() { + int val = _level; return val; } + +void Ball::level1() { + _lcd->drawRect(8, 1, 68, 24, FILL_TRANSPARENT); // goal is completely open +} +void Ball::level2() { + _lcd->drawRect(8, 1, 34, 24, FILL_BLACK); // LEFT HALF BLOCKED +} +void Ball::level3() { + _lcd->drawRect(42, 1, 34, 24, FILL_BLACK); // RIGHT HALF BLOCKED +} +void Ball::level4() { + _lcd->drawRect(30, 1, 22, 24, FILL_BLACK); // MIDDLE BLOCKED +} +void Ball::level5() { + _lcd->drawRect(8, 1, 68, 8, FILL_BLACK); // TOP HALF BLOCKED +} +void Ball::level6() { + _lcd->drawRect(8, 16, 68, 8, FILL_BLACK); // BOTTOM HALF BLOCKED +} +void Ball::level7() { + _lcd->drawRect(8, 1, 68, 24, FILL_BLACK); + _lcd->drawRect(25, 8, 30, 14, FILL_WHITE); // CENTRE OPEN +} +void Ball::level8() { + _lcd->drawRect(8, 1, 68, 24, FILL_BLACK); + _lcd->drawRect(8, 1, 25, 12, FILL_WHITE); // TOP LEFT CORNER OPEN +} +void Ball::level9() { + _lcd->drawRect(8, 1, 68, 24, FILL_BLACK); + _lcd->drawRect(50, 1, 25, 12, FILL_WHITE); // TOP RIGHT CORNER OPEN +} +void Ball::level10() { + _lcd->drawRect(8, 1, 68, 24, FILL_BLACK); + _lcd->drawRect(50, 12, 25, 12, FILL_WHITE); + _lcd->drawRect(8, 12, 25, 12, FILL_WHITE); // BOTTOM CORNERS OPEN +} + + +