var list = ds_list_create(); // Create a temporary list for the instances at the location
var inst = instance_place(x,y,object); // Get the first instance in the location
while (inst != noone) { // As long as there is an instance at this location, perform the loop code
ds_list_add(list,inst); // Add the instance to the list
inst.x += 1000; // Move the instance
inst = instance_place(x,y,object); // Check if there is another instance at the original location
}
var list_size = ds_list_size(list); // Get the how many instances where found (which is equivalent to the list size)
for (var i=0;i<list_size;i++) {
with (list[| i]) { // Using the ID's that we previously stored in the list
x -= 1000; // We move them all back to where they were
// Do any manipulation/checks you want to happen to specific instances here
}
}
ds_list_destroy(list); // After that, make sure to destroy your list so you don't have a memory leak