Dauphine  0.1
A platforming/stealth game in a medieval fantasy setting, developed with SDL2.
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
DynamicEntity Class Referenceabstract

Subclass of Entity. More...

#include <DynamicEntity.h>

Public Member Functions

 DynamicEntity (const double x_, const double y_, Sprite *const sprite_)
 The constructor. More...
 
virtual ~DynamicEntity ()
 The destructor.
 
virtual void jump ()
 
virtual void applyGravity ()
 
virtual void move (const bool movingLeft_, const bool movingRight_)
 
virtual void slowVx ()
 
virtual void roll ()
 
virtual void aim (Crosshair *const crosshair, double direction)
 
virtual void useBombPotion (BombPotion *const bombPotion, const int strength, const int distance)
 
virtual void setLevelWH (const unsigned int width_, const unsigned int height_)
 
virtual void setCollisionRects (const std::vector< SDL_Rect > &collisionRects_)
 
- Public Member Functions inherited from Entity
virtual ~Entity ()
 The destructor.
 
virtual void update (const double dt_)=0
 Updates the entity. More...
 
virtual void render (const double cameraX_, const double cameraY_)=0
 Renders the entity. More...
 
unsigned int getWidth ()
 
unsigned int getHeight ()
 
SDL_Rect & getAnimationClip ()
 

Public Attributes

double vx
 The dynamic entity's speed on the x axis. More...
 
double vy
 The dynamic entity's speed on the x axis. More...
 
double speed
 Speed that moves dynamic entity on input. More...
 
double maxSpeed
 Dynamic entity max speed. More...
 
bool isGrounded
 Check for if the dynamic entity is on the ground. More...
 
- Public Attributes inherited from Entity
double x
 The position in the x axis. More...
 
double y
 The position in the y axis. More...
 
bool isRight
 The direction in the x axis. More...
 

Protected Member Functions

virtual void updatePosition (const double dt_)
 Updates the position of the dynamic entity Update is based on what input was recieved, and the players velocity. More...
 
std::array< bool,
CollisionSide::SOLID_TOTAL > 
detectCollision ()
 
virtual void handleCollision (std::array< bool, CollisionSide::SOLID_TOTAL > detections_)=0
 Handles the collision.
 
- Protected Member Functions inherited from Entity
 Entity (const double x_, const double y_, Sprite *const sprite_)
 The constructor. More...
 

Protected Attributes

unsigned int levelW
 The width of the level. More...
 
unsigned int levelH
 The height of the level. More...
 
std::vector< SDL_Rect > collisionRects
 
                         The SDL_Rects containing collidable tiles 

positions. More...

 
- Protected Attributes inherited from Entity
Spritesprite
 The Sprite attributed to the entity. More...
 
unsigned int width
 The entitys width, from its sprite. More...
 
unsigned int height
 The entitys height, from its sprite. More...
 
SDL_Rect animationClip
 The current clip on the spritesheet, to determine animation. More...
 
SDL_Rect boundingBox
 

Detailed Description

Subclass of Entity.

The objects of this class are entities, but have physics applied to them (such as velocity).

Constructor & Destructor Documentation

DynamicEntity::DynamicEntity ( const double  x_,
const double  y_,
Sprite *const  sprite_ 
)

The constructor.

Initializes all attributes.

Parameters
x_: position in x axis.
y_: position in y axis.
sprite_: which sprite to use.

Member Function Documentation

std::array< bool, CollisionSide::SOLID_TOTAL > DynamicEntity::detectCollision ( )
protected
Returns
A bool array with the sides the DynamicEntity collided.
void DynamicEntity::setLevelWH ( const unsigned int  width_,
const unsigned int  height_ 
)
virtual
Parameters
width_,height_: Tells the player what the width and height of the level is.
See Also
Level::update()
void DynamicEntity::updatePosition ( const double  dt_)
protectedvirtual

Updates the position of the dynamic entity Update is based on what input was recieved, and the players velocity.

Parameters
dt_: Delta time. Time elapsed between one frame and the other, independent of processing speed.
Todo:
Fix all these magic/weird numbers.

Member Data Documentation

std::vector<SDL_Rect> DynamicEntity::collisionRects
protected

                         The SDL_Rects containing collidable tiles 

positions.

bool DynamicEntity::isGrounded

Check for if the dynamic entity is on the ground.

unsigned int DynamicEntity::levelH
protected

The height of the level.

unsigned int DynamicEntity::levelW
protected

The width of the level.

double DynamicEntity::maxSpeed

Dynamic entity max speed.

double DynamicEntity::speed

Speed that moves dynamic entity on input.

double DynamicEntity::vx

The dynamic entity's speed on the x axis.

double DynamicEntity::vy

The dynamic entity's speed on the x axis.


The documentation for this class was generated from the following files: