Library containing the Game Engine
Diff: GameEngine.cpp
- Revision:
- 13:63013a418903
- Parent:
- 12:6eeb06ed7c6b
- Child:
- 14:84d2f115062e
diff -r 6eeb06ed7c6b -r 63013a418903 GameEngine.cpp --- a/GameEngine.cpp Thu May 04 09:54:21 2017 +0000 +++ b/GameEngine.cpp Thu May 04 11:36:35 2017 +0000 @@ -34,12 +34,13 @@ _ttt.draw(lcd); //Draws the third target. _hb.draw(lcd); //Draws the health bar. + //Code to print score on game screen. char bufferscore[14]; sprintf(bufferscore,"%d",score); lcd.printString(bufferscore,1,0); - + //Losing condition and losing screen. if(_hb.ZeroHP == 1){ //Checks if health bar is empty. //Working lcd.clear(); @@ -50,7 +51,7 @@ lcd.refresh(); while(1){ - if(pad.check_event(Gamepad::A_PRESSED)){ + if(pad.check_event(Gamepad::A_PRESSED)){ //Waits for A button to be pressed. NVIC_SystemReset(); //Software Reset. } @@ -155,6 +156,7 @@ //If states check if the projectile has collided with any of the three //targets, if so the target and the projectile's location is reset. + //Score is also updated. if ( ((proj_pos.y == t_pos.y) ||