Sprite proximity detection

Is there a way to get an image sprite to detect the nearest other image sprite.
For example, in a game, if we want the hero move towards the nearest enemy sprite, how do you detect the nearest other sprite?
Right now we are using pick random from a list of enemies but would prefer it to be more selective.

Welcome Amy.

You could try Calculate Distance within a Canvas that can calculate the 'distance' between two ImageSprites etc.

This is great! Thank you for that solution.


closest_sprite.aia (164.5 KB)
sample run

Thank you for the fast suggestions!