C++ Project 2016-2017: Arkanoid
|
An Entity represents an "object" (like Player, Ball, Block, ...) in the game World. More...
#include <entity.h>
Public Member Functions | |
Entity () | |
Entity (double x, double y, pair< double, double > newSize=make_pair(1.0, 1.0)) | |
virtual | ~Entity () |
virtual void | update ()=0 |
virtual void | draw () const =0 |
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 | 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::Entity::Entity | ( | ) |
Default Constructor.
Initialise the Entity at origin ([0, 0]) in the World.
Definition at line 13 of file entity.cpp.
arkanoid::Entity::Entity | ( | double | x, |
double | y, | ||
pair< double, double > | newSize = make_pair(1.0, 1.0) |
||
) |
|
inlinevirtual |
bool arkanoid::Entity::collidesWith | ( | const Entity & | other | ) | const |
Checks if this Entity is intersecting with another Entity.
Definition at line 38 of file entity.cpp.
|
pure virtual |
Draw the Entity.
Implemented in arkanoid::Ball, arkanoid::Player, arkanoidSFML::PlayerSFML, arkanoidSFML::BallSFML, arkanoidSFML::BlockSFML, arkanoidSFML::WallSFML, arkanoid::BallSpeedBlock, arkanoid::PlayerSpeedBlock, arkanoid::World, arkanoid::Block, arkanoid::Wall, arkanoid::InvisBlock, arkanoidSFML::BallSpeedBlockSFML, arkanoidSFML::PlayerSpeedBlockSFML, and arkanoidSFML::InvisBlockSFML.
Vector2D arkanoid::Entity::getPosition | ( | ) | const |
Get the current position of the Entity.
Definition at line 17 of file entity.cpp.
pair< double, double > arkanoid::Entity::getSize | ( | ) | const |
Get the size of the Entity.
Definition at line 34 of file entity.cpp.
void arkanoid::Entity::setPosition | ( | double | x, |
double | y | ||
) |
Set the current position of the Entity.
Definition at line 21 of file entity.cpp.
void arkanoid::Entity::setPosition | ( | const Vector2D & | vector | ) |
Set the current position of the Entity.
vector | The vector who this Entity will be equal to. |
Definition at line 26 of file entity.cpp.
void arkanoid::Entity::setSize | ( | pair< double, double > | newSize | ) |
Set the size of the Entity.
newSize | The new size of the Entity. |
Definition at line 30 of file entity.cpp.
|
pure virtual |
Based on what Entity, the Entity will update itself.
Implemented in arkanoid::Ball, arkanoid::Player, arkanoidSFML::PlayerSFML, arkanoidSFML::BallSFML, arkanoidSFML::BlockSFML, arkanoidSFML::WallSFML, arkanoid::BallSpeedBlock, arkanoid::PlayerSpeedBlock, arkanoid::World, arkanoid::Block, arkanoid::Wall, arkanoid::InvisBlock, arkanoidSFML::BallSpeedBlockSFML, arkanoidSFML::PlayerSpeedBlockSFML, and arkanoidSFML::InvisBlockSFML.