I need to calculate distance between MOBILE and STATIC in some scripts, so I can't use Distace() function, because it calculates only distance between two objects. (Solution is to put a coin item at location of static, chceck Distance(), and remove the coin... But this is a lot of additional calculations in a loop.)
How should look function like Distance(x1, y1, x2, y2)?
I've tried use this

but this function does'nt work proper in some cases.
Does anyone know what calculations sholud I do to check distance betwen two coorditanes like in Distance()?