Doxygen comments added
Dependencies: mbed Gamepad N5110
FlappyBirdEngine/Scoring.cpp
- Committer:
- rafeh
- Date:
- 2019-05-07
- Revision:
- 9:b7a3ec1c7217
- Parent:
- FlappyBirdEngine/FlappyBirdEngine.cpp@ 8:d91564c0f337
File content as of revision 9:b7a3ec1c7217:
#include "Scoring.h" void Scoring::get_score(int score) { _score=score; } bool Scoring::check_for_highscore(int highscore) { _highscore=highscore; if (_score>_highscore) return true; else return false; } void Scoring::update_highscore(int highscore) { _highscore=highscore; } int Scoring::add_score(int score, int pipe_x,int bird_x,int pipe_width) { //_score=score; if(pipe_x<(bird_x+pipe_width) && pipe_x>(bird_x+pipe_width-2)) { _score=_score+1; } return _score; } void Scoring::display_score(N5110 &lcd, Gamepad &pad) { lcd.clear(); char score_display[16]; char highscore_display[20]; sprintf(score_display,"Score : %d",_score); lcd.printString(score_display,0,0); sprintf(highscore_display,"High Score : %d",_highscore); lcd.printString(highscore_display,1,1); while ( pad.check_event(Gamepad::A_PRESSED) == false) { pad.leds_on(); wait(0.1); pad.leds_off(); wait(0.1); lcd.refresh(); } }