Jamie Slowgrove - PGG Assignment 1 - SDL
 All Classes Functions
Public Member Functions | List of all members
Collision Class Reference

Creates an Collision object. The Collision object is for use with detecting Collision. Used help from http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/ in the type 2 section. More...

#include <collision.h>

Collaboration diagram for Collision:
Collaboration graph

Public Member Functions

 Collision (Player *, MapLoader *, Background *, Audio *, Audio *)
 
 ~Collision ()
 
void playerCollisionTest (float, char)
 
void gemAction (int)
 
void blockActionX (int)
 
void blockActionY (int)
 
void endGoalAction (int)
 
void roundingCheck (float, int &minMap, int &maxMap, float)
 
void leftTest (float, int, int, int)
 
void rightTest (float, int, int, int)
 
void downTest (float, int, int, int)
 
void playerCreatureCollisionTest (float)
 
void enemyCollision (int index, float deltaTime)
 
void enemyLeftTest (float, int, int, int, int)
 
void enemyRightTest (float, int, int, int, int)
 

Detailed Description

Creates an Collision object. The Collision object is for use with detecting Collision. Used help from http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/ in the type 2 section.

Constructor & Destructor Documentation

Collision::Collision ( Player inputPlayer,
MapLoader inputMap,
Background inputBackground,
Audio inGem,
Audio inHurt 
)

Constructs an Collision object Constructs the Collision object.

Parameters
Player* pointer to the Player
MapLoader* pointer to the MapLoader
Background* pointer to the Background
Audio* pointer to the Audio that plays when a gem is collected
Audio* pointer to the Audio that plays when a life is lost
Collision::~Collision ( )

De-constructs an Collision object De-constructs the Collision object

Member Function Documentation

void Collision::blockActionX ( int  i)

Block collision action on the x xis Performs the action that happens when the player collides with a Block on the x axis

Parameters
intthe index of the Block that has been collided with

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::blockActionY ( int  i)

Block collision action on the y axis Performs the action that happens when the player collides with a Block on the y axis

Parameters
intthe index of the Block that has been collided with

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::downTest ( float  updatedPosition,
int  maxCurrentAxis,
int  minOppositeAxis,
int  maxOppositeAxis 
)

The test and action to apply if the player is going down This could proberally be converted into a single function along with rightTest() and leftTest(), time permitting.

Parameters
floatthe updated position
intthe max position along the current axis
intthe min position along the opposite axis
intthe max position along the opposite axis

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::endGoalAction ( int  i)

End goal collision action Performs the action that happens when the player collides with the end goal Block

Parameters
intthe index of the Block that has been collided with

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::enemyCollision ( int  index,
float  deltaTime 
)

Enemy collision test Tests if the enemy has collided with a wall

Parameters
floatthe delta time
charthe axis to test

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::enemyLeftTest ( float  updatedPosition,
int  minCurrentAxis,
int  minOppositeAxis,
int  maxOppositeAxis,
int  index 
)

The test and action to apply if the enemy is going left This could be converted into a single function along with all the player and enemy directional test, time permitting.

Parameters
floatthe updated position
intthe min position along the current axis
intthe min position along the opposite axis
intthe max position along the opposite axis
intthe index of the enemy

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::enemyRightTest ( float  updatedPosition,
int  maxCurrentAxis,
int  minOppositeAxis,
int  maxOppositeAxis,
int  index 
)

The test and action to apply if the enemy is going right This could be converted into a single function along with all the player and enemy directional test, time permitting.

Parameters
floatthe updated position
intthe max position along the current axis
intthe min position along the opposite axis
intthe max position along the opposite axis
intthe index of the enemy

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::gemAction ( int  i)

Gem collision action Performs the action that happens when the player collides with a Gem

Parameters
intthe index of the Gem that has been collided with

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::leftTest ( float  updatedPosition,
int  minCurrentAxis,
int  minOppositeAxis,
int  maxOppositeAxis 
)

The test and action to apply if the player is going left This could be converted into a single function along with rightTest() and downTest(), time permitting.

Parameters
floatthe updated position
intthe max position along the current axis
intthe min position along the opposite axis
intthe max position along the opposite axis

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::playerCollisionTest ( float  deltaTime,
char  axis 
)

Player collision test Tests if the Player collides with an object.

Parameters
floatthe delta time
charthe axis to test

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::playerCreatureCollisionTest ( float  deltaTime)

Player creature collision test Tests if the Player collides with a creature.

Parameters
floatthe delta time
charthe axis to test

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::rightTest ( float  updatedPosition,
int  maxCurrentAxis,
int  minOppositeAxis,
int  maxOppositeAxis 
)

The test and action to apply if the player is going right This could be converted into a single function along with leftTest() and downTest(), time permitting.

Parameters
floatthe updated position
intthe max position along the current axis
intthe min position along the opposite axis
intthe max position along the opposite axis

Here is the call graph for this function:

Here is the caller graph for this function:

void Collision::roundingCheck ( float  updatedPosition,
int &  minMap,
int &  maxMap,
float  extra 
)

Checks which way the position is rounded Checks which way the position is rounded and corrects the numbers accordingly

Parameters
floatthe updated position
inta reference to the minimum pap position
inta reference to the maximum pap position
floatthe extra that needs to be added to the map coordinates, this depends on where the background is

Here is the caller graph for this function:


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