Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
GameEngine/WinLoose/WinLoose.cpp
- Committer:
- AhmedPlaymaker
- Date:
- 2019-04-26
- Revision:
- 51:387249f9b333
- Parent:
- WinLoose/WinLoose.cpp@ 49:441c32f6603e
- Child:
- 55:df0825049171
File content as of revision 51:387249f9b333:
#include "WinLoose.h" WinLoose::WinLoose() { } WinLoose::~WinLoose() { } int WinLoose::LevelComplete(N5110 &lcd, Gamepad &pad, int level) { level += 1; lcd.clear(); lcd.printString("Level Complete",0,1); lcd.printString("Press Start",10,3); lcd.printString("to Proceed",12,4); lcd.refresh(); pad.init(); //to fix an issue with debouncing. while (pad.check_event(Gamepad::START_PRESSED) == false) { pad.leds_on(); pad.tone(rand()%1001,0.1); //helps to set max freq for random sound wait(0.1); pad.leds_off(); wait(0.1); } WinLoose::displayLevel(lcd, level); return level; } void WinLoose::displayLevel(N5110 &lcd, int level) { lcd.clear(); sprintf(bufferlevel,"%d",level); lcd.printString("Level:",25,1); lcd.printString(bufferlevel,40,3); lcd.refresh(); wait(2); } void WinLoose::GameOver(N5110 &lcd, Gamepad &pad) { pad.init(); while ((pad.check_event(Gamepad::BACK_PRESSED) == false)) { lcd.clear(); lcd.printString("Game",33,1); lcd.printString("Over",33,3); lcd.printString("Press Back",14,5); //Function used to promt the user to Restart. lcd.refresh(); wait(0.1); } //NVIC_SystemReset(); //Software Reset. }