I am having trouble keeping my randomly spawned objects from overlapping I tried to have it check for collison with other instances using if object at and having it change x coordinate until it gets one that won't collide but i doesn't seem to work nothing spawns anymore my noob attempt looks like this
num_objects = 8
repeat ( num_objects){
var _x = irandom(room_width)
var _y = 700
var l3654631B_0 = instance_place(obj_spikes.x, obj_spikes.y, obj_spikes);
if ((l3654631B_0 > 0))
{
while ((l3654631B_0 > 0)) {
var _x = irandom(room_width)
var _y = 700 // code here
}
instance_create_layer(_x, _y, "Instances",obj_spikes) // replace "my_object_here" with the real name of your object.
}
}
num_objects = 8
repeat ( num_objects){
var _x = irandom(room_width)
var _y = 700
var l3654631B_0 = instance_place(obj_spikes.x, obj_spikes.y, obj_spikes);
if ((l3654631B_0 > 0))
{
while ((l3654631B_0 > 0)) {
var _x = irandom(room_width)
var _y = 700 // code here
}
instance_create_layer(_x, _y, "Instances",obj_spikes) // replace "my_object_here" with the real name of your object.
}
}