I want to evenly distribute a random amount of circles with random diameter on the screen for. This level doesn't scroll so the users screen resolution sets the limits. Further I would like the circles to be as big as possible to fill out the screen.
I have no problem writing the code for collision detection and so on, my problem is the basic theory to solve this kind of problem.
My current approach doesn't work properly because the problem could be the following thing, where (1) is the first circle and (2) is the second circle and | is the "wall" or screen edge.
So if 1 and 2 overlap, I would move 1 half of the overlapping distance to the left, 2 with the other half to the right. I then see that 2 is already at the wall and can't be moved, so 1 must move the whole overlapping distance to the left.
How would I correctly approach this situation?