Added a 'collides' method to check if two rectangles collide.