In my processing program, I have made several circles positioned randomly. I used the distance formula to calculate if the mouse is over a certain area.
However, this algorithm fails when circles overlap because it thinks the mouse is over both circles. What is a way to only detect if the mouse is on the circle on top?
Not sure how you are implementing it, but one option would be to give each of your circles an index. Start at 0 and increment for each circle. Then, when your algorithm checks the circles, only use the circle with the highest index value.