overlaps method
- Rectangle other
Check if this rectangle overlaps with another rectangle
Implementation
bool overlaps(Rectangle other) {
return x < other.x + other.width &&
x + width > other.x &&
y < other.y + other.height &&
y + height > other.y;
}