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>
|
| 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) |
|
Collision::~Collision |
( |
| ) |
|
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
-
int | the index of the Block that has been collided with |
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
-
int | the index of the Block that has been collided with |
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
-
float | the updated position |
int | the max position along the current axis |
int | the min position along the opposite axis |
int | the max position along the opposite axis |
void Collision::endGoalAction |
( |
int |
i | ) |
|
End goal collision action Performs the action that happens when the player collides with the end goal Block
- Parameters
-
int | the index of the Block that has been collided with |
void Collision::enemyCollision |
( |
int |
index, |
|
|
float |
deltaTime |
|
) |
| |
Enemy collision test Tests if the enemy has collided with a wall
- Parameters
-
float | the delta time |
char | the axis to test |
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
-
float | the updated position |
int | the min position along the current axis |
int | the min position along the opposite axis |
int | the max position along the opposite axis |
int | the index of the enemy |
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
-
float | the updated position |
int | the max position along the current axis |
int | the min position along the opposite axis |
int | the max position along the opposite axis |
int | the index of the enemy |
void Collision::gemAction |
( |
int |
i | ) |
|
Gem collision action Performs the action that happens when the player collides with a Gem
- Parameters
-
int | the index of the Gem that has been collided with |
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
-
float | the updated position |
int | the max position along the current axis |
int | the min position along the opposite axis |
int | the max position along the opposite axis |
void Collision::playerCollisionTest |
( |
float |
deltaTime, |
|
|
char |
axis |
|
) |
| |
Player collision test Tests if the Player collides with an object.
- Parameters
-
float | the delta time |
char | the axis to test |
void Collision::playerCreatureCollisionTest |
( |
float |
deltaTime | ) |
|
Player creature collision test Tests if the Player collides with a creature.
- Parameters
-
float | the delta time |
char | the axis to test |
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
-
float | the updated position |
int | the max position along the current axis |
int | the min position along the opposite axis |
int | the max position along the opposite axis |
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
-
float | the updated position |
int | a reference to the minimum pap position |
int | a reference to the maximum pap position |
float | the extra that needs to be added to the map coordinates, this depends on where the background is |
The documentation for this class was generated from the following files:
- PGGAssignment1SDL/collision.h
- PGGAssignment1SDL/collision.cpp