Dependencies:
mbed
« Back to documentation index
Gold Class Reference
Gold Class.
More...
#include <Gold.h >
Public Member Functions
Gold ()
Constructor.
~Gold ()
Destructor.
void init (int gold_num)
Initialise the gold.
void draw (N5110 &lcd)
Draw the golds.
void update ()
Update the data.
void gold_caught (int caught_i)
Mark the gold which has been caught.
int get_reached_num ()
Get the number of lifted gold.
int get_left_num ()
Get the number of left golds.
Vector2D get_pos (int gold_i)
Get the position of the gold.
void set_pos (Vector2D p)
Set the position of the gold.
void set_speed (int speed)
Set the speed of the caught gold.
Detailed Description
Gold Class.
Controls the gold in the gold miner game
Author: Yufan Zhong, University of Leeds and SWJTU
Date: May 2020
Definition at line 17 of file Gold.h .
Constructor & Destructor Documentation
Constructor.
Definition at line 3 of file Gold.cpp .
Destructor.
Definition at line 8 of file Gold.cpp .
Member Function Documentation
void draw
(
N5110 &
lcd )
Draw the golds.
Parameters:
Definition at line 29 of file Gold.cpp .
Get the number of left golds.
Returns: the number of left golds.
Definition at line 75 of file Gold.cpp .
Get the position of the gold.
Parameters:
gold_i - the serial number of the gold
Returns: the position of the gold
Definition at line 82 of file Gold.cpp .
Get the number of lifted gold.
Returns: the number of lifted gold.
Definition at line 63 of file Gold.cpp .
void gold_caught
(
int
caught_i )
Mark the gold which has been caught.
Parameters:
caught_i - the serial number of the captured gold
Definition at line 57 of file Gold.cpp .
void init
(
int
gold_num )
Initialise the gold.
Parameters:
gold_num - number of the gold
Definition at line 13 of file Gold.cpp .
Set the position of the gold.
Parameters:
p - the position of the gold
Definition at line 89 of file Gold.cpp .
void set_speed
(
int
speed )
Set the speed of the caught gold.
Parameters:
speed - the speed of the gold
Definition at line 99 of file Gold.cpp .
Update the data.
Definition at line 40 of file Gold.cpp .