Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Coin/Coin.h@21:20478f086bc2, 2019-04-20 (annotated)
- Committer:
- lewisgw
- Date:
- Sat Apr 20 14:46:50 2019 +0000
- Revision:
- 21:20478f086bc2
- Parent:
- 15:876c047a6ec9
- Child:
- 25:aa145767fda5
Fully documented and commented all classes and functions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lewisgw | 15:876c047a6ec9 | 1 | /** Coin Class |
lewisgw | 15:876c047a6ec9 | 2 | * @brief Generates a coin for the skateboarder to collect * @author Lewis Wooltorton |
lewisgw | 15:876c047a6ec9 | 3 | * @date April 2019 |
lewisgw | 15:876c047a6ec9 | 4 | */ |
lewisgw | 15:876c047a6ec9 | 5 | |
lewisgw | 15:876c047a6ec9 | 6 | #ifndef COIN_H |
lewisgw | 15:876c047a6ec9 | 7 | #define COIN_H |
lewisgw | 15:876c047a6ec9 | 8 | |
lewisgw | 15:876c047a6ec9 | 9 | #include "mbed.h" |
lewisgw | 15:876c047a6ec9 | 10 | |
lewisgw | 15:876c047a6ec9 | 11 | class Coin { |
lewisgw | 15:876c047a6ec9 | 12 | public: |
lewisgw | 21:20478f086bc2 | 13 | // Constructor and Destructor. |
lewisgw | 21:20478f086bc2 | 14 | /** |
lewisgw | 21:20478f086bc2 | 15 | * @brief Constructor @details Non user specified. |
lewisgw | 21:20478f086bc2 | 16 | */ |
lewisgw | 15:876c047a6ec9 | 17 | Coin(); |
lewisgw | 21:20478f086bc2 | 18 | /** |
lewisgw | 21:20478f086bc2 | 19 | * @brief Destructor @details Non user specified. |
lewisgw | 21:20478f086bc2 | 20 | */ |
lewisgw | 15:876c047a6ec9 | 21 | ~Coin(); |
lewisgw | 15:876c047a6ec9 | 22 | |
lewisgw | 21:20478f086bc2 | 23 | // Mutators. |
lewisgw | 21:20478f086bc2 | 24 | /** |
lewisgw | 21:20478f086bc2 | 25 | * @breif Initialises Coin object. |
lewisgw | 21:20478f086bc2 | 26 | */ |
lewisgw | 15:876c047a6ec9 | 27 | void init(); |
lewisgw | 21:20478f086bc2 | 28 | /** |
lewisgw | 21:20478f086bc2 | 29 | * @breif Sets the Coin coordinates. |
lewisgw | 21:20478f086bc2 | 30 | * @param rand_x @details a random number that determines the x coordinate |
lewisgw | 21:20478f086bc2 | 31 | * @param rand_y @details a random number that determines if the Coin is generated on the upper or lower platforms |
lewisgw | 21:20478f086bc2 | 32 | */ |
lewisgw | 21:20478f086bc2 | 33 | void set_coin(int rand_x, int rand_y); |
lewisgw | 21:20478f086bc2 | 34 | |
lewisgw | 21:20478f086bc2 | 35 | // Accessors. |
lewisgw | 21:20478f086bc2 | 36 | /** |
lewisgw | 21:20478f086bc2 | 37 | * @breif Gets the Coin sprite. |
lewisgw | 21:20478f086bc2 | 38 | * @returns The Coin sprite (an integer array) |
lewisgw | 21:20478f086bc2 | 39 | */ |
lewisgw | 21:20478f086bc2 | 40 | int * get_coin_sprite(); |
lewisgw | 21:20478f086bc2 | 41 | /** |
lewisgw | 21:20478f086bc2 | 42 | * @breif Gets the x coordinate. |
lewisgw | 21:20478f086bc2 | 43 | * @returns The x coordinate of the Coin |
lewisgw | 21:20478f086bc2 | 44 | */ |
lewisgw | 21:20478f086bc2 | 45 | int get_coin_x(); |
lewisgw | 21:20478f086bc2 | 46 | /** |
lewisgw | 21:20478f086bc2 | 47 | * @breif Gets the y coordinate. |
lewisgw | 21:20478f086bc2 | 48 | * @returns The y coordinate of the Coin |
lewisgw | 21:20478f086bc2 | 49 | */ |
lewisgw | 21:20478f086bc2 | 50 | int get_coin_y(); |
lewisgw | 21:20478f086bc2 | 51 | |
lewisgw | 21:20478f086bc2 | 52 | // Member Methods. |
lewisgw | 21:20478f086bc2 | 53 | /** |
lewisgw | 21:20478f086bc2 | 54 | * @breif Generates the coin. @details Selects the coin sprite |
lewisgw | 21:20478f086bc2 | 55 | */ |
lewisgw | 15:876c047a6ec9 | 56 | void generate_coin(); |
lewisgw | 15:876c047a6ec9 | 57 | |
lewisgw | 15:876c047a6ec9 | 58 | private: |
lewisgw | 15:876c047a6ec9 | 59 | int _x; |
lewisgw | 15:876c047a6ec9 | 60 | int _y; |
lewisgw | 15:876c047a6ec9 | 61 | int _coin_counter; |
lewisgw | 15:876c047a6ec9 | 62 | bool _rotate_coin; |
lewisgw | 15:876c047a6ec9 | 63 | }; |
lewisgw | 21:20478f086bc2 | 64 | #endif |