The Ball in the Arkanoid game.
More...
#include <ball.h>
|
| Ball () |
|
| Ball (double x, double y, double newSpeed=8.0, pair< double, double > size=make_pair(1.0, 1.0)) |
|
| ~Ball () |
|
void | update () |
|
void | draw () const |
|
void | speedUp (double factor) |
|
void | setInvisible (int period) |
|
template<typename T > |
vector< int > | bounceIfPossible (vector< unique_ptr< T >> const &entities) |
|
void | bounceIfPossible (unique_ptr< Player > const &player) |
|
virtual void | reset () |
|
| 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 |
|
The Ball in the Arkanoid game.
Definition at line 21 of file ball.h.
◆ Ball() [1/2]
Default Constructor.
Initialise the Ball at origin ([0, 0]) in the World.
Definition at line 17 of file ball.cpp.
◆ Ball() [2/2]
arkanoid::Ball::Ball |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
newSpeed = 8.0 , |
|
|
pair< double, double > |
size = make_pair(1.0, 1.0) |
|
) |
| |
Constructor.
Initialise the Ball at a specific position in the World.
- Parameters
-
x | The x position (in the grid) of the Ball. |
y | The y position (in the grid) of the Ball. |
newSpeed | (optional) The speed of the Ball. |
size | (optional) The size (width and height respectively) of the Ball. |
Definition at line 19 of file ball.cpp.
◆ ~Ball()
arkanoid::Ball::~Ball |
( |
| ) |
|
Destructor.
Definition at line 21 of file ball.cpp.
◆ bounceIfPossible() [1/2]
template<typename T >
vector< int > arkanoid::Ball::bounceIfPossible |
( |
vector< unique_ptr< T >> const & |
entities | ) |
|
Checks for all Entity if there's a collision, if there is, then "bounce" off the Entity, i.e. rotate 90° in the right direction.
- Parameters
-
- Returns
- The indeces in the list of the Entity that the Ball collided with.
Definition at line 39 of file ball.cpp.
◆ bounceIfPossible() [2/2]
void arkanoid::Ball::bounceIfPossible |
( |
unique_ptr< Player > const & |
player | ) |
|
Checks if there's a collision with the Player, if there is, make the correct bounce (angle) depending on the point of collision.
- Parameters
-
Definition at line 99 of file ball.cpp.
◆ draw()
void arkanoid::Ball::draw |
( |
| ) |
const |
|
virtual |
◆ reset()
void arkanoid::Ball::reset |
( |
| ) |
|
|
virtual |
◆ setInvisible()
void arkanoid::Ball::setInvisible |
( |
int |
period | ) |
|
Make the Ball invisible for a period of time.
- Parameters
-
period | The period the Ball becomes invisible (in frames). |
Definition at line 34 of file ball.cpp.
◆ speedUp()
void arkanoid::Ball::speedUp |
( |
double |
factor | ) |
|
Change the velocity of the Ball by a factor.
- Parameters
-
Definition at line 27 of file ball.cpp.
◆ update()
void arkanoid::Ball::update |
( |
| ) |
|
|
virtual |
The documentation for this class was generated from the following files:
- src/arkanoid/logic/entity/ball/ball.h
- src/arkanoid/logic/entity/ball/ball.cpp