add collision detection between ball and y axis

also added a function which returns true or false depending of whether
two rectangles intersect.