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@15:876c047a6ec9, 2019-04-06 (annotated)
- Committer:
- lewisgw
- Date:
- Sat Apr 06 17:13:37 2019 +0000
- Revision:
- 15:876c047a6ec9
- Child:
- 21:20478f086bc2
There is now a coin to collect generated in a random position on the map. The number of coins you collect is displayed at the top of the screen.
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 | 15:876c047a6ec9 | 13 | Coin(); |
lewisgw | 15:876c047a6ec9 | 14 | ~Coin(); |
lewisgw | 15:876c047a6ec9 | 15 | |
lewisgw | 15:876c047a6ec9 | 16 | void init(); |
lewisgw | 15:876c047a6ec9 | 17 | void generate_coin(); |
lewisgw | 15:876c047a6ec9 | 18 | void update_coin(int rand_x, int rand_y); |
lewisgw | 15:876c047a6ec9 | 19 | int * get_coin_sprite(); |
lewisgw | 15:876c047a6ec9 | 20 | int get_coin_x(); |
lewisgw | 15:876c047a6ec9 | 21 | int get_coin_y(); |
lewisgw | 15:876c047a6ec9 | 22 | |
lewisgw | 15:876c047a6ec9 | 23 | private: |
lewisgw | 15:876c047a6ec9 | 24 | int _x; |
lewisgw | 15:876c047a6ec9 | 25 | int _y; |
lewisgw | 15:876c047a6ec9 | 26 | int _coin_counter; |
lewisgw | 15:876c047a6ec9 | 27 | bool _rotate_coin; |
lewisgw | 15:876c047a6ec9 | 28 | |
lewisgw | 15:876c047a6ec9 | 29 | }; |
lewisgw | 15:876c047a6ec9 | 30 | #endif |