Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

PowerUp Class Reference

PowerUp Class Reference

PowerUp Class , Creates the power ups in the Breakout game. More...

#include <Map.h>

Inherits GameObject.

Public Member Functions

 PowerUp (float x, float y, PowerUpType &pUpType)
 Constructor.
 ~PowerUp ()
 Destructor - empty.
void giveBonus (Paddle &paddle, Ball &ball)
 Determines the bonus depending on the type of the powerup.
virtual void draw (N5110 &lcd)
 Draws each powerup on the LCD after type has been assigned.
virtual void move ()
 Controls the movement physics of non-static game object.
Vector2DgetVelocity ()
 Gets the velocity of 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

PowerUp Class , Creates the power ups in the Breakout game.

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

Definition at line 128 of file Map.h.


Constructor & Destructor Documentation

PowerUp ( float  x,
float  y,
PowerUpType pUpType 
)

Constructor.

Parameters:
xthe initial x-position of the PowerUp
ythe initial y-position of the PowerUp
pUpTypethe type of the PowerUp

Definition at line 119 of file Map.cpp.

~PowerUp (  )

Destructor - empty.

Definition at line 145 of file Map.h.


Member Function Documentation

void draw ( N5110 lcd ) [virtual]

Draws each powerup on the LCD after type has been assigned.

Reimplemented from StaticGameObject.

Definition at line 129 of file Map.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.

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 giveBonus ( Paddle paddle,
Ball ball 
)

Determines the bonus depending on the type of the powerup.

Definition at line 148 of file Map.h.

void move (  ) [virtual, inherited]

Controls the movement physics of non-static game object.

Reimplemented from StaticGameObject.

Reimplemented in Ball, and Paddle.

Definition at line 25 of file GameObject.cpp.

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.