An Entity that contains velocities and uses a spritesheet for animation. More...
#include <EB_VelocityAnimated.h>
Public Member Functions | |
EB_VelocityAnimated (C_Texture *sprite, C_Vec2 pos, C_Vec2 dimensions, C_Vec2 velocities, int animationFrames, C_Vec2 spriteDimensions, float animationLength, std::string iD, float *universalSpee) | |
Constructs the Velocity Animated Entity. More... | |
~EB_VelocityAnimated () | |
Destructs the Velocity Animated Entity object. More... | |
virtual void | update (float dt)=0 |
A pure virtual function that updates the Entity. More... | |
void | updatePosWithVelocities (float dt) |
Updates the position of the Entity using the velocities. More... | |
void | setVelocities (C_Vec2 velocity) |
Sets the velocities of the Entity. More... | |
C_Vec2 | getVelocities () |
Gets the velocities of the Entity. 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... | |
void | draw (SDL_Renderer *renderer) |
Draws the StormCloud to the screen. 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... | |
Protected Attributes | |
C_Vec2 | velocities |
The velocities of the Entity. 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... | |
Additional Inherited Members | |
Protected Member Functions inherited from EB_Animated | |
virtual void | animate (float dt) |
A virtual function that animates the sprite. More... | |
An Entity that contains velocities and uses a spritesheet for animation.
EB_VelocityAnimated::EB_VelocityAnimated | ( | C_Texture * | sprite, |
C_Vec2 | pos, | ||
C_Vec2 | dimensions, | ||
C_Vec2 | velocities, | ||
int | animationFrames, | ||
C_Vec2 | spriteDimensions, | ||
float | animationLength, | ||
std::string | iD, | ||
float * | universalSpee | ||
) |
Constructs the Velocity Animated Entity.
sprite | A pointer to the objects Texture. |
pos | The position of the Entity. |
dimensions | The dimensions of the Entity. |
velocity | The velocities of the Entity. |
animationFrames | The number of animation frames in the spritesheet. |
spriteDimensions | The dimensions of the sprite. |
animationLength | The length of each animation frame. |
iD | The ID of the Entity type. |
universalSpeed | A pointer for the universal speed of the game. |
EB_VelocityAnimated::~EB_VelocityAnimated | ( | ) |
Destructs the Velocity Animated Entity object.
C_Vec2 EB_VelocityAnimated::getVelocities | ( | ) |
Gets the velocities of the Entity.
void EB_VelocityAnimated::setVelocities | ( | C_Vec2 | velocity | ) |
Sets the velocities of the Entity.
velocities | The inputed velocity. |
|
pure virtual |
A pure virtual function that updates the Entity.
dt | The delta time. |
Implements EB_Animated.
Implemented in EE_Archer, and EE_StormCloud.
void EB_VelocityAnimated::updatePosWithVelocities | ( | float | dt | ) |
Updates the position of the Entity using the velocities.
dt | The delta time. |
|
protected |
The velocities of the Entity.