Randomly placing objects without touching

Uses collideCircleCircle() to detect if the objects are on top of eachother, if so, it tries to get a new location to live. It continually tries until all objects have their own place. If the objects are too big or there are too many, it will continually forever try to place them. You could add in a decay or some other factor to ignore the object if it tries to place it to the screen a number of times and fails...


        loading...