Jamie Slowgrove - AI Assignment 1
Line of Sight & A* path-finding
 All Classes Namespaces Files Functions Variables
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Creature Class Reference

Creates a Creature object that inherits Entity. Creates a Creature object that inherits Entity and contains the details for the Creature. More...

#include <creature.h>

Inheritance diagram for Creature:
Inheritance graph
Collaboration diagram for Creature:
Collaboration graph

Public Member Functions

 Creature (Texture *, Vec2, Vec2, int, int, int, int)
 
 ~Creature ()
 
void updatePosition (float)
 
void setVelocities (Vec2)
 
Vec2 getVelocities ()
 
void displayTiles (SDL_Renderer *, Map *)
 
void collisionUpdate (Map *, float)
 
void collisionUpdate (Entity *, float)
 
- Public Member Functions inherited from Entity
 Entity (Texture *, Vec2, Vec2, int, int, int, int)
 
 ~Entity ()
 
void display (SDL_Renderer *)
 
void setPosition (Vec2)
 
Vec2 getPosition ()
 
int getWidth ()
 
int getHeight ()
 

Protected Member Functions

float collision (Map *, float, float, float, int, int, int, int, char)
 
void displayCollisionTest (SDL_Renderer *, Map *, int, int, int, int)
 

Protected Attributes

Vec2 velocities
 
int minX
 
int maxX
 
int minY
 
int maxY
 
- Protected Attributes inherited from Entity
Vec2 position
 
Vec2 source
 
int spriteWidth
 
int spriteHeight
 
int width
 
int height
 
Texturetexture
 

Detailed Description

Creates a Creature object that inherits Entity. Creates a Creature object that inherits Entity and contains the details for the Creature.

Constructor & Destructor Documentation

Creature::Creature ( Texture inTexture,
Vec2  inPos,
Vec2  inSource,
int  inSpriteW,
int  inSpriteH,
int  w,
int  h 
)

Constructs a Creature object

Parameters
Texture* A pointer to the Texture
Vec2The position of the Creature
Vec2The position of the sprite
intThe sprite width
intThe sprite height
intThe Creature width
intThe Creature height
Creature::~Creature ( )

Destructs the Creature object

Member Function Documentation

float Creature::collision ( Map map,
float  dt,
float  velocity,
float  currentPos,
int  minI,
int  maxI,
int  minJ,
int  maxJ,
char  axis 
)
protected

Tests if the Creature collides with a Wall for a certain direction and performs an act upon the result

Parameters
Map* A pointer to the Map
floatThe delta time
floatThe velocity from the axis to be tested
floatThe position from the axis to be tested
intThe minimum i index
intThe maximum i index
intThe minimum j index
intThe maximum j index
charThe axis being checked
floatReturns the new velocity.

Here is the call graph for this function:

Here is the caller graph for this function:

void Creature::collisionUpdate ( Map map,
float  dt 
)

Tests if the Creature collides with a Wall and performs an act upon the result

Parameters
Map* A pointer to the Map
floatThe delta time

Here is the call graph for this function:

Here is the caller graph for this function:

void Creature::collisionUpdate ( Entity entity,
float  dt 
)

Tests if the Creature collides with an Entity and performs an act upon the result

Parameters
Map* A pointer to the Entity
floatThe delta time

Here is the call graph for this function:

void Creature::displayCollisionTest ( SDL_Renderer *  renderer,
Map map,
int  minI,
int  maxI,
int  minJ,
int  maxJ 
)
protected

Display tiles being tested for collision

Parameters
SDL_Renderer* A pointer to the renderer
Map* A pointer to the Map
intThe minimum i index
intThe maximum i index
intThe minimum j index
intThe maximum j index

Here is the call graph for this function:

Here is the caller graph for this function:

void Creature::displayTiles ( SDL_Renderer *  renderer,
Map map 
)

Display the tiles that the Creature occupies

Parameters
SDL_Renderer* A pointer to the renderer
Map* A pointer to the Map

Here is the call graph for this function:

Here is the caller graph for this function:

Vec2 Creature::getVelocities ( )

Getter # Gets the velocities

Returns
Vec2 The velocities
void Creature::setVelocities ( Vec2  inVelocities)

Setter # Sets the velocities

Parameters
Vec2The new velocities
void Creature::updatePosition ( float  dt)

Updates the Creature position using the velocities and the delta time

Parameters
floatThe delta time

Here is the caller graph for this function:

Member Data Documentation

int Creature::maxX
protected
int Creature::maxY
protected
int Creature::minX
protected

The min and max tiles that the creature is on

int Creature::minY
protected
Vec2 Creature::velocities
protected

The Creature velocities


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