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

The Player in the Arkanoid game that represents a "rectangle". More...

#include <player.h>

Inheritance diagram for arkanoid::Player:
arkanoid::Entity arkanoidSFML::PlayerSFML

Public Member Functions

 Player ()
 
 Player (double x, double y, double newSpeed=15.0, pair< double, double > size=make_pair(2.0, 1.0))
 
 ~Player ()
 
void update ()
 
void draw () const
 
void speedUp (double factor)
 
virtual void reset ()
 
- 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
 

Protected Attributes

Vector2D velocity
 
double speed
 
Vector2D origin
 The initial position of the Player.
 
double originalSpeed
 
bool notMoving
 
int speedUpDuration
 In frames.
 
- 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

The Player in the Arkanoid game that represents a "rectangle".

Definition at line 17 of file player.h.

Constructor & Destructor Documentation

◆ Player() [1/2]

arkanoid::Player::Player ( )

Default Constructor.

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

Definition at line 12 of file player.cpp.

◆ Player() [2/2]

arkanoid::Player::Player ( double  x,
double  y,
double  newSpeed = 15.0,
pair< double, double >  size = make_pair(2.0, 1.0) 
)

Constructor.

Initialise the Player at a specific position in the World.

Parameters
xThe x position (in the grid) of the Player.
yThe y position (in the grid) of the Player.
newSpeed(optional) The speed of the Player.
size(optional) The size (width and height respectively) of the Player.

Definition at line 14 of file player.cpp.

◆ ~Player()

arkanoid::Player::~Player ( )

Destructor.

Definition at line 16 of file player.cpp.

Member Function Documentation

◆ draw()

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

Do nothing...

Implements arkanoid::Entity.

Definition at line 20 of file player.cpp.

◆ reset()

void arkanoid::Player::reset ( )
virtual

Reset the position of the Player to the one of the starting position. (-> call this method when the Player missed the Ball).

Reimplemented in arkanoidSFML::PlayerSFML.

Definition at line 30 of file player.cpp.

◆ speedUp()

void arkanoid::Player::speedUp ( double  factor)

Change the velocity of the Player by a factor.

Parameters
factorThe factor.

Definition at line 22 of file player.cpp.

◆ update()

void arkanoid::Player::update ( )
virtual

Do nothing...

Implements arkanoid::Entity.

Definition at line 18 of file player.cpp.


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