Finding the distance between two objects (ObjA and ObjB) is simple and requires the use of pythagoras theorem (that's the thing in maths all about triangles)

Pythagoras theorem states:
The Square of the Hypotenues of a right angled triangle is equal to the sum of the squares of the other two sides, I.E.:
H = a + o where a and o are the other two sides.

H is basically the distance between the two objects in question.

a and o are the differences in the y co-ordinates and the x-co-ordinates

You will need the Math object or the Amath object for TGF (i'm not sure about MMF, i think they are built in functions)
create a new event in MMF/TGF using the COMPARE TWO GENERAL VALUES box.

Set the top box to SQUAREROOT( ("Xpos of obja" - "Xpos of objB") +
("Ypos of obja" - "Ypos of objB"))
then you can test it against other values (IE a counter, or a set number)

wasn't that simple?