
150 6. Collisions and Entities
and the other entity’s center. We will see how to use the collision vector later in this chapter
when we look at game physics.
//========================================================================
// Circular collision detection method
// Called by collision(), default collision detection method
// Post: returns true if collision, false otherwise
// sets collisionVector if collision
//========================================================================
bool Entity::collideCircle(Entity &ent, VECTOR2 &collisionVector)
{
// Difference between centers
distSquared = *getCenter() - *ent.getCenter();
distSquared.x = ...