Yufan Zhong / Mbed 2 deprecated GOLD_MINER

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Claw.h Source File

Claw.h

00001 #ifndef CLAW_H
00002 #define CLAW_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Winch.h"
00008 #include "Monster.h"
00009 
00010 /** Claw Class
00011 @brief Controls the claw in the gold miner game 
00012 @author Yufan Zhong, University of Leeds and SWJTU
00013 @date May 2020
00014 */ 
00015 
00016 
00017 class Claw
00018 {
00019 
00020 public:
00021     /** Constructor */
00022     Claw();
00023     
00024     /** Destructor */
00025     ~Claw();
00026     
00027     /** Initialise the claw
00028     *   @param  winch_width - The width of the winch
00029     */
00030     void init(int winch_width);
00031     
00032     /** Draw the claw
00033     *   @param  lcd - N5110 library
00034     */
00035     void draw(N5110 &lcd);
00036     
00037     /** Update the data
00038     *   @param  winch_pos - the position of the winch
00039     */
00040     void update(Vector2D winch_pos);
00041     
00042     /** Add the current score
00043     */
00044     void add_now_score();
00045     
00046     /** Get the current score
00047     *   @return the current score
00048     */
00049     int get_now_score();
00050     
00051     /** Set the velocity of claw
00052     *   @param  v - the velocity of the claw
00053     */
00054     void set_velocity(float v);
00055     
00056     /** Get the velocity
00057     *   @return the claw velocity
00058     */
00059     float get_velocity();
00060     
00061     /** Get the position of the claw
00062     *   @return the position of the claw.
00063     */
00064     Vector2D get_pos();
00065     
00066     /** Set position of the claw
00067     *   @param  p - position of the claw
00068     */
00069     void set_pos(Vector2D p);
00070     
00071     
00072     
00073 private:
00074     int _winch_width;
00075     int _x0;
00076     int _y0;
00077     int _x1;
00078     int _y1;
00079     float _velocity_y;
00080     int _now_score;
00081     int _speed_x;
00082     
00083 };
00084 #endif