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: lib/GameEngine/GameEngine.cpp
- Revision:
- 12:50a7abf21f18
- Parent:
- 11:b288d01533cc
- Child:
- 13:94abfe83a294
--- a/lib/GameEngine/GameEngine.cpp Tue May 07 23:01:46 2019 +0000 +++ b/lib/GameEngine/GameEngine.cpp Wed May 08 01:28:25 2019 +0000 @@ -19,15 +19,33 @@ void GameEngine::gameengine_run(Gamepad &pad, N5110 &lcd, Barrel &barrel, Banana &banana, Donkey &dky) { wait_ms(250); + barrel_x = 0; + barrel_y = 0; + banana_x = 0; + banana_y = 0; running = 1; - while (running == 1 || (pad.check_event(Gamepad::BACK_PRESSED) == false)) { + banana_time = 0; + barrel_time = 0; + score = 0; + while (running == 1) { //printf("Game State"); lcd.clear(); - lcd.printString("Game",0,0); dky.donkeykong_movement(pad, lcd); barrel.barrel_drop(pad, lcd, dky); banana.banana_drop(pad, lcd, barrel, dky); + //printf("state %d", running); lcd.refresh(); wait_ms(1.0f/24); } -} \ No newline at end of file +} + +void GameEngine::gameengine_score(Gamepad &pad, N5110 &lcd, Banana &banana) { + lcd.clear(); + lcd.printString("Game Over!",14,0); + lcd.printString("Score:",0,2); + char buffer[14]; + sprintf(buffer,"%i",score); + lcd.printString(buffer,40,2); + lcd.refresh(); + wait(5); +}