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.
Diff: Gold/Gold.h
- Revision:
- 16:e3ecfcd2a389
- Parent:
- 12:07a9f2140d9b
- Child:
- 17:3ba4ec25c4c5
diff -r c90c1c35ae5c -r e3ecfcd2a389 Gold/Gold.h --- a/Gold/Gold.h Mon May 11 13:23:33 2020 +0000 +++ b/Gold/Gold.h Tue May 12 09:13:04 2020 +0000 @@ -9,25 +9,69 @@ #include "time.h" /** Gold Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the claw in the Pong game -@date Febraury 2017 +@author Yufan Zhong, University of Leeds and SWJTU +@brief Controls the gold in the gold miner game +@date May 2020 */ + class Gold { public: + /** Constructor */ Gold(); + /** Destructor */ ~Gold(); + /** Initialise the gold + * + * This function initialises the components of the gold. + * @param gold_num - number of the gold + */ void init(int gold_num); + /** Draw the golds + * + * This function draws the golds. + * @param lcd - N5110 library + */ void draw(N5110 &lcd); + /** Update the data + * + * This function gets the new positions and number of golds. + */ void update(); + /** Mark the gold which has been caught + * + * This function mark the gold which has been caught. + * @param caught_i - the serial number of the captured gold + */ void gold_caught(int caught_i); + /** Get the number of lifted gold + * + * This function gets the number of lifted gold. + */ int get_reached_num(); + /** Get the number of left golds + * + * This function gets the number of left golds. + */ int get_left_num(); - /// accessors and mutators + /** Get the position of the gold + * + * This function gets the position of the gold with serial number i. + * @param gold_i - the serial number of the gold + */ Vector2D get_pos(int gold_i); + /** Set the position of the gold + * + * This function set the position of the gold. + * @param p - the position of the gold + */ void set_pos(Vector2D p); + /** Set the speed of the caught gold + * + * This function set the speed of the caught gold. + * @param speed - the speed of the gold + */ void set_speed(int speed); private: