Someone recently asked a similar question!
You can use this extension which has this built-in block to get distance between sprites (and lots of other handy stuff )
As for your own code, the reason it’s not working is because you called the radius check function only in the “On start” block! If you put it in a “Forever” block, it will work like this!