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: main.cpp
- Revision:
- 31:c95f1b1d6423
- Parent:
- 29:42651f87522b
- Child:
- 32:eff573ad8e42
--- a/main.cpp Sat Apr 27 13:07:25 2019 +0000 +++ b/main.cpp Sat Apr 27 18:57:06 2019 +0000 @@ -76,6 +76,7 @@ gamepad.init(); lcd.init(); lcd.setContrast(0.55); + classic.init(ball, map); brick.init(RADIUS, ball); opt.init(); map.init(); @@ -147,7 +148,16 @@ void classic_mode(){ classic.init(ball, map); - while(!(map.check_wall_collision(gamepad, ball))){ + bool collision = false; + while(!(collision)){ + if(classic.finished()){ + classic.mode_complete(lcd, gamepad, fps); + break; + } + if(map.check_wall_collision(gamepad, ball)){ + collision = classic.mode_failed(lcd, gamepad, ball, map); + if(!(collision)){ classic.init(ball, map); } + } classic.classic_update(ball, accelerometer, map); lcd.clear(); classic.classic_draw(lcd, map, ball);