C++ Project 2016-2017: Arkanoid
Public Member Functions | List of all members
arkanoid::BallSpeedBlock Class Reference

A "special" Block: when hit with a Ball, speed up or slow down the Ball. More...

#include <ball_speed_block.h>

Inheritance diagram for arkanoid::BallSpeedBlock:
arkanoid::Block arkanoid::Wall arkanoid::Entity arkanoidSFML::BallSpeedBlockSFML

Public Member Functions

 BallSpeedBlock ()
 
 BallSpeedBlock (double x, double y, double speedF=1.5, pair< double, double > size=make_pair(1, 2))
 
 ~BallSpeedBlock ()
 
void update ()
 
void draw () const
 
void effectBall (unique_ptr< Ball > &ball) const
 
- Public Member Functions inherited from arkanoid::Block
 Block ()
 
 Block (double x, double y, pair< double, double > size=make_pair(1, 2))
 
 ~Block ()
 
- Public Member Functions inherited from arkanoid::Wall
 Wall ()
 
 Wall (double x, double y, pair< double, double > size=make_pair(1, 1))
 
 ~Wall ()
 
void update ()
 
void draw () const
 
- Public Member Functions inherited from arkanoid::Entity
 Entity ()
 
 Entity (double x, double y, pair< double, double > newSize=make_pair(1.0, 1.0))
 
virtual ~Entity ()
 
Vector2D getPosition () const
 
void setPosition (double x, double y)
 
void setPosition (const Vector2D &vector)
 
void setSize (pair< double, double > newSize)
 
pair< double, double > getSize () const
 
bool collidesWith (const Entity &other) const
 

Additional Inherited Members

- Protected Attributes inherited from arkanoid::Entity
Vector2D position
 The current position of the Entity (in the 9x7 grid).
 
pair< double, double > size
 The size (width and height respectively) of the Entity.
 

Detailed Description

A "special" Block: when hit with a Ball, speed up or slow down the Ball.

Definition at line 16 of file ball_speed_block.h.

Constructor & Destructor Documentation

◆ BallSpeedBlock() [1/2]

arkanoid::BallSpeedBlock::BallSpeedBlock ( )

Default Constructor.

Initialise the BallSpeedBlock at origin ([0, 0]) in the World.

Definition at line 11 of file ball_speed_block.cpp.

◆ BallSpeedBlock() [2/2]

arkanoid::BallSpeedBlock::BallSpeedBlock ( double  x,
double  y,
double  speedF = 1.5,
pair< double, double >  size = make_pair(1, 2) 
)

Constructor.

Initialise the BallSpeedBlock at a specific position in the World.

Parameters
xThe x position (in the grid) of the BallSpeedBlock.
yThe y position (in the grid) of the BallSpeedBlock.
speedF(optional) The factor of the speed up/down for the Ball.
size(optional) The size (width and height respectively) of the BallSpeedBlock.

Definition at line 13 of file ball_speed_block.cpp.

◆ ~BallSpeedBlock()

arkanoid::BallSpeedBlock::~BallSpeedBlock ( )

Destructor.

Definition at line 15 of file ball_speed_block.cpp.

Member Function Documentation

◆ draw()

void arkanoid::BallSpeedBlock::draw ( ) const
virtual

Do nothing...

Reimplemented from arkanoid::Block.

Definition at line 21 of file ball_speed_block.cpp.

◆ effectBall()

void arkanoid::BallSpeedBlock::effectBall ( unique_ptr< Ball > &  ball) const

Activate this BallSpeedBlock 'speciality': speed up or slow down the Ball, depending on the speed factor.

Parameters
ballThe Ball that will be effected.

Definition at line 25 of file ball_speed_block.cpp.

◆ update()

void arkanoid::BallSpeedBlock::update ( )
virtual

Do nothing...

Reimplemented from arkanoid::Block.

Definition at line 17 of file ball_speed_block.cpp.


The documentation for this class was generated from the following files: