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
BotAI Class Reference

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

#include <botAI.h>

Inheritance diagram for BotAI:
Inheritance graph
Collaboration diagram for BotAI:
Collaboration graph

Public Member Functions

 BotAI (Texture *, Vec2, Vec2, int, int, int, int, Map *)
 
 ~BotAI ()
 
void playerLineOfSight (Player *, Map *)
 
virtual void updateMovement (Player *, Map *, float)
 
void drawPath (SDL_Renderer *, Vec2 target)
 
Vec2 getLastNodePosition ()
 
bool getRunning ()
 
- Public Member Functions inherited from Creature
 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

void updateMovementVelocities (float, bool)
 
- Protected Member Functions inherited from Creature
float collision (Map *, float, float, float, int, int, int, int, char)
 
void displayCollisionTest (SDL_Renderer *, Map *, int, int, int, int)
 

Protected Attributes

AStaraStar
 
Vec2 moveTarget
 
Vec2 nextPosition
 
Vec2 lastNode
 
bool running
 
- Protected Attributes inherited from Creature
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 BotAI object that inherits Creature. Creates a BotAI object that inherits Creature and contains the details for the BotAI.

Constructor & Destructor Documentation

BotAI::BotAI ( Texture inTexture,
Vec2  inPos,
Vec2  inSource,
int  inSpriteW,
int  inSpriteH,
int  w,
int  h,
Map map 
)

Constructs a BotAI object

Parameters
Texture* A pointer to the Texture
Vec2The position of the BotAI
Vec2The position of the sprite
intThe sprite width
intThe sprite height
intThe BotAI width
intThe BotAI height
Map* A pointer to the map

Here is the call graph for this function:

BotAI::~BotAI ( )

Destructs the BotAI object

Member Function Documentation

void BotAI::drawPath ( SDL_Renderer *  renderer,
Vec2  target 
)

Draw the path of the BotAI from the target

Parameters
SDL_Renderer* A pointer to the renderer
Vec2The position of the target

Here is the call graph for this function:

Here is the caller graph for this function:

Vec2 BotAI::getLastNodePosition ( )

Getter # Get the last target node

Returns
Vec2 The last nodes position

Here is the caller graph for this function:

bool BotAI::getRunning ( )

Getter # Get the value of running

Returns
bool The value of running

Here is the caller graph for this function:

void BotAI::playerLineOfSight ( Player player,
Map map 
)

Virtual # Test if the player is in sight

Parameters
Player* A pointer to the player
Map* A pointer to the map

Here is the call graph for this function:

Here is the caller graph for this function:

void BotAI::updateMovement ( Player player,
Map map,
float  dt 
)
virtual

Virtual # Update the next movement of the BotAI

Parameters
Player* A pointer to the Player
Map* A pointer to the map
floatThe delta time

Reimplemented in BotB.

Here is the call graph for this function:

Here is the caller graph for this function:

void BotAI::updateMovementVelocities ( float  dt,
bool  check 
)
protected

Update the movement velocities of the BotAI

Parameters
floatThe delta time
boolThe test boolean

Here is the caller graph for this function:

Member Data Documentation

AStar* BotAI::aStar
protected

The A* pathfinding

Vec2 BotAI::lastNode
protected
Vec2 BotAI::moveTarget
protected
Vec2 BotAI::nextPosition
protected
bool BotAI::running
protected

If the BotAI is currently running


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