Yufan Zhong / Mbed 2 deprecated GOLD_MINER

Dependencies:   mbed

Gold/Gold.h

Committer:
ZhongYufan
Date:
2020-05-12
Revision:
16:e3ecfcd2a389
Parent:
12:07a9f2140d9b
Child:
17:3ba4ec25c4c5

File content as of revision 16:e3ecfcd2a389:

#ifndef GOLD_H
#define GOLD_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Winch.h"
#include "Monster.h"
#include "time.h"

/** Gold Class
@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();
    /** 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:
    int _gold_num;
    int _gold_left;
    int _gold_caught[12];
    int _gold_reached[12];
    int _x[12];
    int _y[12];
    int _gold_speed;
    
};
#endif