C++ Project 2016-2017: Arkanoid
|
The Player in the Arkanoid game that represents a "rectangle". More...
#include <player.h>
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. | |
arkanoid::Player::Player | ( | ) |
Default Constructor.
Initialise the Player at origin ([0, 0]) in the World.
Definition at line 12 of file player.cpp.
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.
x | The x position (in the grid) of the Player. |
y | The 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.
arkanoid::Player::~Player | ( | ) |
Destructor.
Definition at line 16 of file player.cpp.
|
virtual |
|
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.
void arkanoid::Player::speedUp | ( | double | factor | ) |
Change the velocity of the Player by a factor.
factor | The factor. |
Definition at line 22 of file player.cpp.
|
virtual |