Doxygen comments added
Dependencies: mbed Gamepad N5110
Scoring/Scoring.h@16:95e3706790e5, 2019-05-09 (annotated)
- Committer:
- rafeh
- Date:
- Thu May 09 14:14:37 2019 +0000
- Revision:
- 16:95e3706790e5
- Parent:
- 15:fc6b40fceb4f
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rafeh | 9:b7a3ec1c7217 | 1 | #ifndef SCORING_H |
rafeh | 9:b7a3ec1c7217 | 2 | #define SCORING_H |
rafeh | 7:05f433e196d6 | 3 | |
rafeh | 7:05f433e196d6 | 4 | #include "mbed.h" |
rafeh | 7:05f433e196d6 | 5 | #include "N5110.h" |
rafeh | 7:05f433e196d6 | 6 | #include "Gamepad.h" |
rafeh | 16:95e3706790e5 | 7 | /** Scoring Class |
rafeh | 10:75de0f4da176 | 8 | @brief Class for counting,updating and checking scores |
rafeh | 10:75de0f4da176 | 9 | @author Rafeh Ishtiaq |
rafeh | 10:75de0f4da176 | 10 | @date May 2019 |
rafeh | 10:75de0f4da176 | 11 | */ |
rafeh | 12:736e8561b81e | 12 | class Scoring { |
rafeh | 12:736e8561b81e | 13 | |
rafeh | 10:75de0f4da176 | 14 | public: |
rafeh | 11:c85abe88ad7a | 15 | /** Constructor */ |
rafeh | 10:75de0f4da176 | 16 | Scoring(); |
rafeh | 11:c85abe88ad7a | 17 | /** Destructor */ |
rafeh | 10:75de0f4da176 | 18 | ~Scoring(); |
rafeh | 7:05f433e196d6 | 19 | |
rafeh | 11:c85abe88ad7a | 20 | /** Sets the score |
rafeh | 10:75de0f4da176 | 21 | @param score |
rafeh | 10:75de0f4da176 | 22 | */ |
rafeh | 10:75de0f4da176 | 23 | void set_score(int score); |
rafeh | 11:c85abe88ad7a | 24 | /** Displays the score and high score after the player has lost |
rafeh | 10:75de0f4da176 | 25 | */ |
rafeh | 10:75de0f4da176 | 26 | void display_score(N5110 &lcd, Gamepad &pad); |
rafeh | 7:05f433e196d6 | 27 | |
rafeh | 11:c85abe88ad7a | 28 | /** Boolean function to check weather the score is higher or lower than the high score |
rafeh | 10:75de0f4da176 | 29 | @param highscore @details The existing high score which is compared to the recent score to check for high score |
rafeh | 10:75de0f4da176 | 30 | */ |
rafeh | 14:9a9ac55616c4 | 31 | bool check_for_highscore(int score,int highscore); |
rafeh | 11:c85abe88ad7a | 32 | /** updates the Highscore |
rafeh | 10:75de0f4da176 | 33 | @param highscore @details The current high score |
rafeh | 10:75de0f4da176 | 34 | */ |
rafeh | 7:05f433e196d6 | 35 | void update_highscore(int highscore); |
rafeh | 13:6ba6a9805161 | 36 | /** Adds to the score if conditions are met |
rafeh | 10:75de0f4da176 | 37 | @param score @details The existing score |
rafeh | 10:75de0f4da176 | 38 | @param pipe_x @details X coordinate of the pipes |
rafeh | 10:75de0f4da176 | 39 | @param bird_x @details X coordinate of the position of the bird |
rafeh | 10:75de0f4da176 | 40 | @param pipe_width @details Width of the pipe |
rafeh | 10:75de0f4da176 | 41 | @returns The new score |
rafeh | 10:75de0f4da176 | 42 | */ |
rafeh | 8:d91564c0f337 | 43 | int add_score(int score, int pipe_x,int bird_x,int pipe_width); |
rafeh | 7:05f433e196d6 | 44 | |
rafeh | 15:fc6b40fceb4f | 45 | /** Checks for the collision between the bird and the pipes by checking for overlaps |
rafeh | 10:75de0f4da176 | 46 | @param bir_y @details Y coordinate of the position of the bird |
rafeh | 10:75de0f4da176 | 47 | @param pipe_x @details X coordinate of the pipes |
rafeh | 10:75de0f4da176 | 48 | @param pipe_height @details Height of the top pipe |
rafeh | 10:75de0f4da176 | 49 | */ |
rafeh | 10:75de0f4da176 | 50 | bool check_collisions(int bird_y, int pipe_x, int pipe_height); |
rafeh | 10:75de0f4da176 | 51 | |
rafeh | 7:05f433e196d6 | 52 | private: |
rafeh | 7:05f433e196d6 | 53 | |
rafeh | 7:05f433e196d6 | 54 | int _score; |
rafeh | 7:05f433e196d6 | 55 | int _highscore; |
rafeh | 7:05f433e196d6 | 56 | |
rafeh | 10:75de0f4da176 | 57 | |
rafeh | 7:05f433e196d6 | 58 | }; |
rafeh | 7:05f433e196d6 | 59 | |
rafeh | 7:05f433e196d6 | 60 | |
rafeh | 7:05f433e196d6 | 61 | |
rafeh | 7:05f433e196d6 | 62 | |
rafeh | 7:05f433e196d6 | 63 | |
rafeh | 7:05f433e196d6 | 64 | |
rafeh | 7:05f433e196d6 | 65 | |
rafeh | 7:05f433e196d6 | 66 | |
rafeh | 7:05f433e196d6 | 67 | |
rafeh | 7:05f433e196d6 | 68 | #endif |