Rally X
ELEN3009 Project by Justin Wernick and David Schneider
|
Object for handling collisions between GameObjects. More...
#include <CollisionDetector.h>
Public Member Functions | |
void | checkCollisions (list< PlayerCar > &players, list< EnemyCar > &enemies, list< Checkpoint > &checkpoints, list< Rock > &rocks, list< Smokescreen > &smokescreens) |
Checks for collisions between all relevant pairs of objects, and calls the relevant collision function if one is found. | |
Private Member Functions | |
void | collision (PlayerCar &player, Checkpoint &checkpoint) |
Collision between a PlayerCar and a Checkpoint. | |
void | collision (PlayerCar &player, EnemyCar &enemy) |
Collision between a PlayerCar and an EnemyCar. | |
void | collision (PlayerCar &player, Rock &rock) |
Collision between a PlayerCar and a Rock. | |
void | collision (EnemyCar &enemy, Smokescreen &smokescreen) |
Collision between an EnemyCar and a Smokescreen. |
Object for handling collisions between GameObjects.
Collisions between all relevant objects are checked and the appropriate methods on the GameObjects are called when a collision occurs.
Definition at line 22 of file CollisionDetector.h.
void CollisionDetector::checkCollisions | ( | list< PlayerCar > & | players, |
list< EnemyCar > & | enemies, | ||
list< Checkpoint > & | checkpoints, | ||
list< Rock > & | rocks, | ||
list< Smokescreen > & | smokescreens | ||
) |
Checks for collisions between all relevant pairs of objects, and calls the relevant collision function if one is found.
A collision occurs if the distance between two object's x values is less than 1, and the distance between their y values is also less than 1.
[in,out] | players | List of PlayerCars, that can collide with EnemieCars, Checkpoints, or Rocks. |
[in,out] | enemies | List of EnemyCars, that can collide with PlayerCars, or Smokescreens. |
[in,out] | checkpoints | List of Checkpoints, that can collide with PlayerCars. |
[in,out] | rocks | List of Rocks, that can collide with PlayerCars. |
[in,out] | smokescreens | List of Smokescreens, that can collide with EnemyCars. |
Definition at line 3 of file CollisionDetector.cpp.
void CollisionDetector::collision | ( | PlayerCar & | player, |
Checkpoint & | checkpoint | ||
) | [private] |
Collision between a PlayerCar and a Checkpoint.
[in,out] | player | PlayerCar involved in the collision. |
[in,out] | checkpoint | Checkpoint involved in the collision. |
Definition at line 44 of file CollisionDetector.cpp.
void CollisionDetector::collision | ( | EnemyCar & | enemy, |
Smokescreen & | smokescreen | ||
) | [private] |
Collision between an EnemyCar and a Smokescreen.
[in,out] | enemy | EnemyCar involved in the collision. |
[in,out] | smokescreen | Smokescreen involved in the collision. |
Definition at line 61 of file CollisionDetector.cpp.