Many graphical programs such as games need some form of collision detection. Not only do we want to move objects around the screen, but we also want to detect when objects touch each other in some ways.
Game objects can have complex shapes, but collisions are usually checked against simpler enclosing shapes. For example, a bounding box or bounding circle can be used to simplify the question of whether two sprites have collided on the screen.
This lab asks you to write a Java function for testing whether two circles have collided. That is, whether they are currently intersecting in 2D space. The program below creates 20 balls with are moving in space.
There is a "stub" method which should check whether one ball has collided with another. Right now the function just returns false. Your job is to finish this function.
To do this, use the x and y locations of the two balls, along with the distance formula:
$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$