James Heavey / Mbed 2 deprecated 2665-Breakout-Game

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Paddle Class Reference

Paddle Class Reference

Paddle Class. More...

#include <Paddle.h>

Public Member Functions

 Paddle ()
 Constructor declaration.
 ~Paddle ()
 Destructor declaration.
void init (int y, int height, int width)
 Initialise Paddle attributes.
void draw (N5110 &lcd)
 Draws the Paddle at at its current coordinates on the LCD.
void update (Direction d, float mag)
 Update the Paddle's velocity according to the Gamepad input, then update coordinates accordingly.
void lose_life ()
 Decrement the variable _lives.
void inc_life ()
 Increment the variable _lives.
void reset_lives ()
 Set the variable _lives to 6.
int get_lives ()
 Retrieves the Paddle's lives remaining.
void set_tilt ()
 Sets the varible _tilt to true.
void set_joy ()
 Set the variable _tilt to false.
void set_sens (float sens)
 Set the variable _sens.
void recentre ()
 Set the _x coordinate to the middle of the screen.
Vector2D get_pos ()
 Retrieves the Paddle's x and y velocities.

Detailed Description

Paddle Class.

Author:
James Heavey, University of Leeds Controls the paddle in the Breakout game
Date:
May 2019

Definition at line 17 of file Paddle.h.


Constructor & Destructor Documentation

Paddle (  )

Constructor declaration.

Definition at line 5 of file Paddle.cpp.

~Paddle (  )

Destructor declaration.

Definition at line 10 of file Paddle.cpp.


Member Function Documentation

void draw ( N5110 lcd )

Draws the Paddle at at its current coordinates on the LCD.

Parameters:
lcda N5110 pointer

Definition at line 29 of file Paddle.cpp.

int get_lives (  )

Retrieves the Paddle's lives remaining.

Returns:
the variable _lives

Definition at line 73 of file Paddle.cpp.

Vector2D get_pos (  )

Retrieves the Paddle's x and y velocities.

Returns:
a vector of the x and y velocities

Definition at line 97 of file Paddle.cpp.

void inc_life (  )

Increment the variable _lives.

Definition at line 85 of file Paddle.cpp.

void init ( int  y,
int  height,
int  width 
)

Initialise Paddle attributes.

Parameters:
yinitialises the _y value at the correct value on screen
heightsets the height of the paddle
widthsets the width of the paddle

Definition at line 15 of file Paddle.cpp.

void lose_life (  )

Decrement the variable _lives.

Definition at line 79 of file Paddle.cpp.

void recentre (  )

Set the _x coordinate to the middle of the screen.

Definition at line 116 of file Paddle.cpp.

void reset_lives (  )

Set the variable _lives to 6.

Definition at line 91 of file Paddle.cpp.

void set_joy (  )

Set the variable _tilt to false.

Definition at line 110 of file Paddle.cpp.

void set_sens ( float  sens )

Set the variable _sens.

Parameters:
senssets _sens to local variable sens

Definition at line 122 of file Paddle.cpp.

void set_tilt (  )

Sets the varible _tilt to true.

Definition at line 104 of file Paddle.cpp.

void update ( Direction  d,
float  mag 
)

Update the Paddle's velocity according to the Gamepad input, then update coordinates accordingly.

Parameters:
pada Gamepad pointer

Definition at line 35 of file Paddle.cpp.