Contains the data and functions for the player. More...
#include <EP_Player.h>
Public Member Functions | |
EP_Player (C_Texture *sprite, C_Vec2 pos, C_Vec2 dimensions, C_Texture *archerSprite, C_Vec2 archerPos, C_Vec2 archerDimensions, C_Vec2 screenDimensions, C_Texture *fireSprite, SDL_Colour minTint, SDL_Colour maxTint, float *universalSpeed) | |
Constructs the Player object. More... | |
~EP_Player () | |
Destructs the Player object. More... | |
void | update (float dt) |
A function that updates the Player. More... | |
void | input (SDL_Event &incomingEvent, C_Vec2 mousePos) |
A function that handles the Player input. More... | |
void | draw (SDL_Renderer *renderer) |
A function that draws the Player to the screen. More... | |
void | increaseHealth () |
A function that increases the Player health by 1. More... | |
void | decreaseHealth () |
A function that decreases the Player health by 1. More... | |
int | getHealth () |
Returns the health of the Player. More... | |
void | increaseCoins () |
A function that increases the Player coins by 1. More... | |
int | getCoins () |
Returns the number coins of the Player. More... | |
bool | entityCollisionTest (C_Vec2 entityPos, C_Vec2 entityDimensions) |
A function to test if the player has collided with an Entity. More... | |
void | setFireArrow (bool fireArrow) |
Sets the value of the archer fireArrow boolean. More... | |
bool | getFireArrow () |
Gets the value of the archer fireArrow boolean. More... | |
void | setFiring (bool firing) |
Sets the value of the archer firing boolean. More... | |
bool | getFiring () |
Gets the value of the archer firing boolean. More... | |
void | setFlaming (bool flamingPowerUp) |
Sets the value of the flamingPowerUp boolean. More... | |
bool | getFlaming () |
Gets the value of the flamingPowerUp boolean. More... | |
void | setTimeSlow (bool timeSlowPowerUp) |
Sets the value of the timeSlowPowerUp boolean. More... | |
bool | getTimeSlow () |
Gets the value of the timeSlowPowerUp boolean. More... | |
void | activateShield () |
Activates the Player shield. More... | |
Public Member Functions inherited from EB_Animated | |
EB_Animated (C_Texture *sprite, C_Vec2 pos, C_Vec2 dimensions, int animationFrames, C_Vec2 spriteDimensions, float animationLength, std::string iD, float *universalSpee) | |
Constructs the Animated Entity. More... | |
~EB_Animated () | |
Destructs the Animated Entity object. More... | |
Public Member Functions inherited from EB_Entity | |
EB_Entity (C_Texture *sprite, C_Vec2 pos, C_Vec2 dimensions, std::string iD, float *universalSpeed) | |
Constructs the Entity object. More... | |
~EB_Entity () | |
Destructs the Entity object. More... | |
void | setPosition (C_Vec2 pos) |
Sets the position of the Entity. More... | |
void | setX (float x) |
Sets the x position of the Entity. More... | |
void | setY (float y) |
Sets the y position of the Entity. More... | |
void | setDimensions (C_Vec2 dimensions) |
Sets the dimensions of the Entity. More... | |
void | setWidth (float width) |
Sets the width of the Entity. More... | |
void | setHeight (float height) |
Sets the height of the Entity. More... | |
C_Vec2 | getPosition () |
Gets the position of the Entity. More... | |
C_Vec2 | getDimensions () |
Gets the dimensions of the Entity. More... | |
Private Attributes | |
bool | pressed |
The user commands for the Player. More... | |
C_Vec2 | offset |
An offset for the position of the player from the position the player was pressed. More... | |
C_Vec2 | screenDimensions |
The screen Dimensions. More... | |
int | health |
The health of the player. More... | |
int | maxHealth |
The max health of the player. More... | |
int | coins |
The current number of coins of the player. More... | |
int | maxCoins |
EP_PlayerArcher * | archer |
The Player Archer. More... | |
C_Vec2 | archerOffset |
An offset for the position of the player archer from the position the player. More... | |
bool | flamingPowerUp |
A boolean for if the player has the flaming power up active. More... | |
C_Timer | flamingPowerUpTimer |
The flamingPowerUp timer. More... | |
PS_ParticleEffect * | fireEffect |
The fire particle effect. More... | |
C_Vec2 | fireEffectOffset |
An offset for the position of the fire effect from the position the player. More... | |
bool | shield |
A bool for if the Player shield is active. More... | |
C_Audio * | healthLossSounds [3] |
The array of hit audio. More... | |
C_Audio * | shieldLossSound |
The shield loss audio. More... | |
bool | timeSlowPowerUp |
A boolean for if the player has the time slow power up active. More... | |
C_Timer | timeSlowPowerUpTimer |
The timeSlowPowerUp timer. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from EB_Animated | |
virtual void | animate (float dt) |
A virtual function that animates the sprite. More... | |
Protected Attributes inherited from EB_Animated | |
int | animationFrames |
The number of animation frames in the spritesheet. More... | |
C_Vec2 | spriteDimensions |
The dimensions of the sprite in the spritesheet. More... | |
C_Vec2 | spriteIndex |
The index of the current sprite in the spritesheet. More... | |
C_Timer | animationTimer |
The animation timer. More... | |
Protected Attributes inherited from EB_Entity | |
C_Texture * | sprite |
A pointer to the Entity Texture. More... | |
C_Vec2 | pos |
The position of the Entity. More... | |
C_Vec2 | dimensions |
The dimensions of the Entity. More... | |
std::string | iD |
The ID of the type of Entity. More... | |
float * | universalSpeed |
A pointer for the universal speed of the game. More... | |
Contains the data and functions for the player.
EP_Player::EP_Player | ( | C_Texture * | sprite, |
C_Vec2 | pos, | ||
C_Vec2 | dimensions, | ||
C_Texture * | archerSprite, | ||
C_Vec2 | archerPos, | ||
C_Vec2 | archerDimensions, | ||
C_Vec2 | screenDimensions, | ||
C_Texture * | fireSprite, | ||
SDL_Colour | minTint, | ||
SDL_Colour | maxTint, | ||
float * | universalSpeed | ||
) |
Constructs the Player object.
sprite | A pointer to the objects Texture. |
pos | The position of the Player. |
dimensions | The dimensions of the Player. |
archerSprite | A pointer to the Player Archer Texture. |
archerPos | The position of the Player Archer. |
archerDimensions | The dimensions of the Player Archer. |
screenDimensions | The dimensions of the screen. |
fireSprite | A pointer to the particles Texture. |
minTint | The minimum tint for the fire particles. |
maxTint | The maximum tint for the fire particles. |
universalSpeed | A pointer for the universal speed of the game. |
EP_Player::~EP_Player | ( | ) |
Destructs the Player object.
void EP_Player::activateShield | ( | ) |
Activates the Player shield.
void EP_Player::decreaseHealth | ( | ) |
A function that decreases the Player health by 1.
|
virtual |
A function that draws the Player to the screen.
renderer | A pointer to the SDL renderer. |
Reimplemented from EB_Animated.
A function to test if the player has collided with an Entity.
entityPos | The position of the Entity. |
entityDimensions | The dimensions of the Entity. |
int EP_Player::getCoins | ( | ) |
Returns the number coins of the Player.
bool EP_Player::getFireArrow | ( | ) |
Gets the value of the archer fireArrow boolean.
bool EP_Player::getFiring | ( | ) |
Gets the value of the archer firing boolean.
bool EP_Player::getFlaming | ( | ) |
Gets the value of the flamingPowerUp boolean.
int EP_Player::getHealth | ( | ) |
Returns the health of the Player.
bool EP_Player::getTimeSlow | ( | ) |
Gets the value of the timeSlowPowerUp boolean.
void EP_Player::increaseCoins | ( | ) |
A function that increases the Player coins by 1.
void EP_Player::increaseHealth | ( | ) |
A function that increases the Player health by 1.
void EP_Player::input | ( | SDL_Event & | incomingEvent, |
C_Vec2 | mousePos | ||
) |
A function that handles the Player input.
incomingEvent | A reference to the incoming SDL event. |
mousePos | the position of the mouse. |
void EP_Player::setFireArrow | ( | bool | fireArrow | ) |
Sets the value of the archer fireArrow boolean.
coinSpawn | The new value of fireArrow. |
void EP_Player::setFiring | ( | bool | firing | ) |
Sets the value of the archer firing boolean.
coinSpawn | The new value of firing. |
void EP_Player::setFlaming | ( | bool | flamingPowerUp | ) |
Sets the value of the flamingPowerUp boolean.
flamingPowerUp | The new value of flamingPowerUp. |
void EP_Player::setTimeSlow | ( | bool | timeSlowPowerUp | ) |
Sets the value of the timeSlowPowerUp boolean.
flamingPowerUp | The new value of timeSlowPowerUp. |
|
virtual |
A function that updates the Player.
dt | The delta time. |
Implements EB_Animated.
|
private |
The Player Archer.
|
private |
An offset for the position of the player archer from the position the player.
|
private |
The current number of coins of the player.
|
private |
The fire particle effect.
|
private |
An offset for the position of the fire effect from the position the player.
|
private |
A boolean for if the player has the flaming power up active.
|
private |
The flamingPowerUp timer.
|
private |
The health of the player.
|
private |
The array of hit audio.
|
private |
The maximum number of coins that the player can get. This is mainly to make sure that the number does not leave its boundaries on the screen
|
private |
The max health of the player.
|
private |
An offset for the position of the player from the position the player was pressed.
|
private |
The user commands for the Player.
|
private |
The screen Dimensions.
|
private |
A bool for if the Player shield is active.
|
private |
The shield loss audio.
|
private |
A boolean for if the player has the time slow power up active.
|
private |
The timeSlowPowerUp timer.