Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Paddle Class Reference

Paddle Class , Controls for the paddle in the Breakout game, inherits from GameObject, because the paddle is a game object. More...

#include <Paddle.h>

Inherits GameObject.

Public Member Functions

 Paddle ()
 Constructor.
 ~Paddle ()
 Destructor.
void controlPaddle (Gamepad &pad)
 Determines control method for paddle.
virtual void move ()
 Controls movement of paddle.
void reset ()
 Resets paddle to initial starting point.
float getSpeed ()
 Gets the speed of the paddle.
void setSpeed (float value)
 Sets the speed of the paddle.
Vector2DgetVelocity ()
 Gets the velocity of the game object.
virtual void draw (N5110 &lcd)
 Draws the game object.
const Vector2DgetPos () const
 Gets the x and y coordinates of game object.
int getW ()
 Gets the width of the game object.
int getH ()
 Gets the height of the game object.
void setW (int value)
 Sets the width of any game object.

Protected Attributes

Vector2D pos
 width and height of any game object

Detailed Description

Paddle Class , Controls for the paddle in the Breakout game, inherits from GameObject, because the paddle is a game object.

Author:
Kostadin Chakarov, University of Leeds
Date:
March 2019

Definition at line 21 of file Paddle.h.


Constructor & Destructor Documentation

Paddle (  )

Constructor.

Definition at line 3 of file Paddle.cpp.

~Paddle (  )

Destructor.

Definition at line 8 of file Paddle.cpp.


Member Function Documentation

void controlPaddle ( Gamepad pad )

Determines control method for paddle.

Definition at line 12 of file Paddle.cpp.

void draw ( N5110 lcd ) [virtual, inherited]

Draws the game object.

Reimplemented in PowerUp.

Definition at line 20 of file GameObject.cpp.

int getH (  ) [inherited]

Gets the height of the game object.

Returns:
the height of the game object

Definition at line 34 of file GameObject.h.

const Vector2D & getPos (  ) const [inherited]

Gets the x and y coordinates of game object.

Definition at line 11 of file GameObject.cpp.

float getSpeed (  )

Gets the speed of the paddle.

Returns:
the speed of the paddle

Definition at line 38 of file Paddle.h.

Vector2D& getVelocity (  ) [inherited]

Gets the velocity of the game object.

Returns:
the velocity of the game object

Definition at line 61 of file GameObject.h.

int getW (  ) [inherited]

Gets the width of the game object.

Returns:
the width of the game object

Definition at line 30 of file GameObject.h.

void move (  ) [virtual]

Controls movement of paddle.

Reimplemented from GameObject.

Definition at line 19 of file Paddle.cpp.

void reset (  )

Resets paddle to initial starting point.

Definition at line 39 of file Paddle.cpp.

void setSpeed ( float  value )

Sets the speed of the paddle.

Parameters:
value- sets the speed equal to it

Definition at line 42 of file Paddle.h.

void setW ( int  value ) [inherited]

Sets the width of any game object.

Parameters:
value- sets the width of the game objects equal to it

Used for the power-up features

Definition at line 39 of file GameObject.h.


Field Documentation

Vector2D pos [protected, inherited]

width and height of any game object

Definition at line 42 of file GameObject.h.