How do I check if an instance of an object is under of another of the same object?

I’m trying to make a duck shooter game where you shoot targets. This is currently the code for handling the events for shooting the targets:


Very basic with almost no other conditions other than checking if the crosshair collides with the targets. This is how it behaves:
2025-01-1523-59-56-ezgif.com-video-to-gif-converter
Now, how do I make it so that the target that was behind the other target is not affected and shot at? The two targets are on the same layer, and it’s hard to check for collision between the same objects.

I would probably use the Object Picking tools extension and use the “pick highest Z order” condition from it. Just ensure your objects on the back row are always at a lower Z order than those in the rows in front of it.

Thank you! That was exactly what I needed. Didn’t know there’s an extension that does exactly what I asked for.