Sk8dududu
Member
I need to make a room where upon entering, it creates approximately 20 circular objects at random locations.
The issue is that placing them truly random isn't aesthetically pleasing because it creates clusters, instead I want them somewhat evenly spread out.
I attempted to make it so they could not spawn on top of each other so that it would automatically be even, but then they never overlap which is kind of essential.
This picture is what I am aiming for.
For the object I have it set so that it creates a bubble using a random sprite and setting it to a random size, all I need to to figure out the "random" spawn locations. I don't want any of them to overlap past the center point of the object, and not to be empty spaces in the room.
This is what I have already even though I'll likely need to change it.
This is a controller alarm I'm using to spawn them.
And this is the objects create event to check if it should stay or not.
The issue is that placing them truly random isn't aesthetically pleasing because it creates clusters, instead I want them somewhat evenly spread out.
I attempted to make it so they could not spawn on top of each other so that it would automatically be even, but then they never overlap which is kind of essential.
This picture is what I am aiming for.
For the object I have it set so that it creates a bubble using a random sprite and setting it to a random size, all I need to to figure out the "random" spawn locations. I don't want any of them to overlap past the center point of the object, and not to be empty spaces in the room.
This is what I have already even though I'll likely need to change it.
This is a controller alarm I'm using to spawn them.
Code:
instance_create(irandom_range(50,490),irandom_range(50,910),obj_bubble);
if instance_count < 20
{
alarm_set(0,5);
}
Code:
image_xscale = random_range(0.50,1);
image_yscale = image_xscale;
depth = - 10;
if instance_nearest(x,y,obj_bubble) < 350
{
instance_destroy();
}
Last edited: