intersects method
Checks if this rectangle intersects with another Rectangle.
Mathematical Operation: Separating axis theorem implementation: Two rectangles DON'T intersect if one is completely outside another's bounds.
Implementation
bool intersects(Rectangle other) {
return !(other.x >= x + width || // Other is right of us
other.x + other.width <= x || // Other is left of us
other.y >= y + height || // Other is below us
other.y + other.height <= y); // Other is above us
}