Which child is the closest parent

Hi guys

Well, I have an instance "A" that looks at the nearest instance of a parent object "B". The parent object has three children "1", "2", "3". I need to have the instance "A" to be
able to deduct whether the parent object "B" is in the form of child "1", "2" or "3".

In my step event for instance "A" I have:

GML:
closest_enemy = instance_nearest(x, y, obj_B_parent);
...any advice on how to tell which child the nearest parent "B" is, is very welcome!

Thanks!
 
You could run a check on the object_index
Code:
switch (closest_enemy.object_index) {
   case 1: // Replace these numbers with the object names of the children
       
   break;
   case 2:
   
   break;
}
 
Top