This commit is contained in:
2021-03-17 12:34:11 +01:00
parent a3e608b01e
commit 965ed711f7
22 changed files with 2081 additions and 839 deletions

View File

@@ -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;
}