![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Doxygen comments added
Dependencies: mbed Gamepad N5110
FlappyBirdEngine/FlappyBirdEngine.cpp
- Committer:
- rafeh
- Date:
- 2019-05-07
- Revision:
- 8:d91564c0f337
- Parent:
- 7:05f433e196d6
File content as of revision 8:d91564c0f337:
#include "FlappyBirdEngine.h" void FlappyBirdEngine::get_score(int score) { _score=score; } bool FlappyBirdEngine::check_for_highscore(int highscore) { _highscore=highscore; if (_score>_highscore) return true; else return false; } void FlappyBirdEngine::update_highscore(int highscore) { _highscore=highscore; } int FlappyBirdEngine::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 FlappyBirdEngine::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(); } }