|
@@ -646,11 +646,12 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2
|
|
// Check collision between two rectangles
|
|
// Check collision between two rectangles
|
|
bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2)
|
|
bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2)
|
|
{
|
|
{
|
|
|
|
+ bool collision = false;
|
|
|
|
+
|
|
if ((rec1.x <= (rec2.x + rec2.width) && (rec1.x + rec1.width) >= rec2.x) &&
|
|
if ((rec1.x <= (rec2.x + rec2.width) && (rec1.x + rec1.width) >= rec2.x) &&
|
|
- (rec1.y <= (rec2.y + rec2.height) && (rec1.y + rec1.height) >= rec2.y))
|
|
|
|
- return true;
|
|
|
|
- else
|
|
|
|
- return false;
|
|
|
|
|
|
+ (rec1.y <= (rec2.y + rec2.height) && (rec1.y + rec1.height) >= rec2.y)) collision = true;
|
|
|
|
+
|
|
|
|
+ return collision;
|
|
}
|
|
}
|
|
|
|
|
|
// Check collision between two circles
|
|
// Check collision between two circles
|