Yufan Zhong / Mbed 2 deprecated GOLD_MINER

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Claw Class Reference

Claw Class Reference

Claw Class. More...

#include <Claw.h>

Public Member Functions

 Claw ()
 Constructor.
 ~Claw ()
 Destructor.
void init (int winch_width)
 Initialise the claw.
void draw (N5110 &lcd)
 Draw the claw.
void update (Vector2D winch_pos)
 Update the data.
void add_now_score ()
 Add the current score.
int get_now_score ()
 Get the current score.
void set_velocity (float v)
 Set the velocity of claw.
float get_velocity ()
 Get the velocity.
Vector2D get_pos ()
 Get the position of the claw.
void set_pos (Vector2D p)
 Set position of the claw.

Detailed Description

Claw Class.

Controls the claw in the gold miner game

Author:
Yufan Zhong, University of Leeds and SWJTU
Date:
May 2020

Definition at line 17 of file Claw.h.


Constructor & Destructor Documentation

Claw (  )

Constructor.

Definition at line 3 of file Claw.cpp.

~Claw (  )

Destructor.

Definition at line 8 of file Claw.cpp.


Member Function Documentation

void add_now_score (  )

Add the current score.

Definition at line 48 of file Claw.cpp.

void draw ( N5110 lcd )

Draw the claw.

Parameters:
lcd- N5110 library

Definition at line 34 of file Claw.cpp.

int get_now_score (  )

Get the current score.

Returns:
the current score

Definition at line 54 of file Claw.cpp.

Vector2D get_pos (  )

Get the position of the claw.

Returns:
the position of the claw.

Definition at line 73 of file Claw.cpp.

float get_velocity (  )

Get the velocity.

Returns:
the claw velocity

Definition at line 66 of file Claw.cpp.

void init ( int  winch_width )

Initialise the claw.

Parameters:
winch_width- The width of the winch

Definition at line 21 of file Claw.cpp.

void set_pos ( Vector2D  p )

Set position of the claw.

Parameters:
p- position of the claw

Definition at line 80 of file Claw.cpp.

void set_velocity ( float  v )

Set the velocity of claw.

Parameters:
v- the velocity of the claw

Definition at line 60 of file Claw.cpp.

void update ( Vector2D  winch_pos )

Update the data.

Parameters:
winch_pos- the position of the winch

Definition at line 40 of file Claw.cpp.