Dauphine  0.1
A platforming/stealth game in a medieval fantasy setting, developed with SDL2.
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
Enemy Class Reference

Public Types

enum  EStates : uint8_t {
  IDLE = 0, AERIAL, PATROLLING, CURIOUS,
  ALERT
}
 

Public Member Functions

 Enemy (const double x_, const double y_, Sprite *const sprite_, const bool patrol_, const double patrolLength_)
 The constructor.
 
virtual ~Enemy ()
 The destructor.
 
virtual void update (const double dt_)
 Updates the player. More...
 
virtual void render (const double cameraX_, const double cameraY_)
 Renders the player. More...
 
void initializeStates ()
 
void destroyStates ()
 
void changeState (const EStates state_)
 
- Public Member Functions inherited from DynamicEntity
 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.
 
unsigned int getWidth ()
 
unsigned int getHeight ()
 
SDL_Rect & getAnimationClip ()
 

Public Attributes

double patrolX
 
bool left
 
double originalX
 
bool patrol
 
double patrolLength
 
- Public Attributes inherited from DynamicEntity
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...
 

Static Public Attributes

static double px = 0.0
 
static double py = 0.0
 
static double alertRange = 300.0
 
static double curiousRange = 600.0
 

Private Member Functions

virtual void handleCollision (std::array< bool, CollisionSide::SOLID_TOTAL > detections_)
 Handles the collision.
 

Private Attributes

StateEnemycurrentState
 
std::map< EStates, StateEnemy * > statesMap
 

Additional Inherited Members

- Protected Member Functions inherited from DynamicEntity
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 ()
 
- Protected Attributes inherited from DynamicEntity
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...

 

Member Function Documentation

void Enemy::render ( const double  cameraX_,
const double  cameraY_ 
)
virtual

Renders the player.

Uses the player's sprite render method.

See Also
Sprite::render
Parameters
cameraX_: The x position of the camera.
cameraY_: The y position of the camera.

Implements Entity.

void Enemy::update ( const double  dt_)
virtual

Updates the player.

See Also
Player::updateInput, Player::updatePosition
Parameters
dt_: Delta time. Time elapsed between one frame and the other, independent of processing speed.

Implements Entity.


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