Hey, I'm trying to figure out a way to detect or combine all nearby similar objects, and be able to edit them as a group.
For example, If I wanted to delete objects 1, 2, and 3, (which are all the same object) I would be able to do so by having them know which one is nearby the other. So, deleting object 2 would also delete 1 and 3, since they are touching. Objects 4, 5, and 6 are also the same object, but since they are not touching, they are not effected.
The only way I can think of doing this is by having some recursive script do something like:
But, this seems like an incorrect method, while also being above my skillset to write effectively.
Only other things I can think of are renaming the objects to be similar, but I think that causes the same issue.
Is there a solution that I am overlooking?
For example, If I wanted to delete objects 1, 2, and 3, (which are all the same object) I would be able to do so by having them know which one is nearby the other. So, deleting object 2 would also delete 1 and 3, since they are touching. Objects 4, 5, and 6 are also the same object, but since they are not touching, they are not effected.
The only way I can think of doing this is by having some recursive script do something like:
GML:
Script1
//Pseudo Code
//Look for and delete nearby similar objects
if(place_meeting(x + 40, y, obj)) //if there is a similar object to the right (check other directions too)
{
//Check for nearby objects of this
script1(obj)
//Otherwise, delete this object.
}
Only other things I can think of are renaming the objects to be similar, but I think that causes the same issue.
Is there a solution that I am overlooking?