A simple showcase of rectangle and circle collision. Made to demonstrate something to a friend lol See inside for a custom block to put in your backpack :3 === Explanation === This algorithm works in 2 parts: - Find the closest point to the circle in the rectangle - Check the distance between this point and the circle 1 : The closest point To find the closest point in the rectangle, the idea is to take the circle's center, and cap it to the rectangle (for example, if the circle center is before the rectangle in the X axis, the closest point is on the left border of the rectangle) 2 : The distance To know if we hit the circle, we check the distance between the closest point and the circle center point using pythagoras theorem. Distance = sqrt((circlex - closestx)² + (circley - closesty)²) If the distance is under the radius of the circle, then we've hit the circle !