![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Doxygen comments added
Dependencies: mbed Gamepad N5110
Scoring/Scoring.h@11:c85abe88ad7a, 2019-05-08 (annotated)
- Committer:
- rafeh
- Date:
- Wed May 08 21:10:18 2019 +0000
- Revision:
- 11:c85abe88ad7a
- Parent:
- 10:75de0f4da176
- Child:
- 12:736e8561b81e
doxygen comments;
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 | 7:05f433e196d6 | 7 | |
rafeh | 9:b7a3ec1c7217 | 8 | class Scoring { |
rafeh | 11:c85abe88ad7a | 9 | /** Class Scoring |
rafeh | 10:75de0f4da176 | 10 | @brief Class for counting,updating and checking scores |
rafeh | 10:75de0f4da176 | 11 | @author Rafeh Ishtiaq |
rafeh | 10:75de0f4da176 | 12 | @date May 2019 |
rafeh | 10:75de0f4da176 | 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 | 7:05f433e196d6 | 31 | bool check_for_highscore(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 | 11:c85abe88ad7a | 36 | /** Adds to the score if conditions are met (i.e. when bird gets ahead of a pipe) |
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 | 11:c85abe88ad7a | 45 | /** Checks for the collision between the bird and the pipes |
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 |