Doxygen comments added
Dependencies: mbed Gamepad N5110
Diff: Scoring/Scoring.h
- Revision:
- 10:75de0f4da176
- Parent:
- 9:b7a3ec1c7217
- Child:
- 11:c85abe88ad7a
diff -r b7a3ec1c7217 -r 75de0f4da176 Scoring/Scoring.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Scoring/Scoring.h Wed May 08 20:59:02 2019 +0000 @@ -0,0 +1,68 @@ +#ifndef SCORING_H +#define SCORING_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" + +class Scoring { + /* Class Scoring + @brief Class for counting,updating and checking scores + @author Rafeh Ishtiaq + @date May 2019 + */ + public: + /* Constructor */ + Scoring(); + /* Destructor */ + ~Scoring(); + + /* Sets the score + @param score + */ + void set_score(int score); + /* Displays the score and high score after the player has lost + */ + void display_score(N5110 &lcd, Gamepad &pad); + + /* Boolean function to check weather the score is higher or lower than the high score + @param highscore @details The existing high score which is compared to the recent score to check for high score + */ + bool check_for_highscore(int highscore); + /* updates the Highscore + @param highscore @details The current high score + */ + void update_highscore(int highscore); + /* Adds to the score if conditions are met (i.e. when bird gets ahead of a pipe) + @param score @details The existing score + @param pipe_x @details X coordinate of the pipes + @param bird_x @details X coordinate of the position of the bird + @param pipe_width @details Width of the pipe + @returns The new score + */ + int add_score(int score, int pipe_x,int bird_x,int pipe_width); + + /* Checks for the collision between the bird and the pipes + @param bir_y @details Y coordinate of the position of the bird + @param pipe_x @details X coordinate of the pipes + @param pipe_height @details Height of the top pipe + */ + bool check_collisions(int bird_y, int pipe_x, int pipe_height); + + private: + + int _score; + int _highscore; + + + }; + + + + + + + + + +#endif \ No newline at end of file