v1.4
This commit is contained in:
@@ -9,7 +9,7 @@ double distanceSquared(int x1, int y1, int x2, int y2)
|
||||
}
|
||||
|
||||
// Detector de colisiones entre dos circulos
|
||||
bool checkCollision(Circle &a, Circle &b)
|
||||
bool checkCollision(circle_t &a, circle_t &b)
|
||||
{
|
||||
// Calcula el radio total al cuadrado
|
||||
int totalRadiusSquared = a.r + b.r;
|
||||
@@ -27,7 +27,7 @@ bool checkCollision(Circle &a, Circle &b)
|
||||
}
|
||||
|
||||
// Detector de colisiones entre un circulo y un rectangulo
|
||||
bool checkCollision(Circle &a, SDL_Rect &b)
|
||||
bool checkCollision(circle_t &a, SDL_Rect &b)
|
||||
{
|
||||
//Closest point on collision box
|
||||
int cX, cY;
|
||||
@@ -60,10 +60,10 @@ bool checkCollision(Circle &a, SDL_Rect &b)
|
||||
cY = a.y;
|
||||
}
|
||||
|
||||
//If the closest point is inside the circle
|
||||
//If the closest point is inside the circle_t
|
||||
if (distanceSquared(a.x, a.y, cX, cY) < a.r * a.r)
|
||||
{
|
||||
//This box and the circle have collided
|
||||
//This box and the circle_t have collided
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user