x1#,y1# and z1# are the coordinates for the first object, and x2#,y2# and z2# are the coordinates for the second object. This is called pythagoruses theorum, it works in 3d aswell as 2d (2d you just use x# and y#)...
dist# = sqrt((x1# - x2#)^2 + (y1# - y2#)^2 + (z1# - z2#)^2)
BTW, pythagoruses theorum states that the on any right angled triangle, the square of the hypotinuse (the longest side, or the one opposite to the right angle) is equal to the sum of the squares of the other two sides.
z^2 = y^2 + x^2
or
z = sqrt(y^2 + x^2)
Diagram.... 1 is the first object, 2 is second object.
x
------1
| /
| /
y | / z
| /
|/
2
<<or>>
x1#-x2#
------1
| /
| /
y1#-y2# | / z
| /
|/
2
Thats in 2D, I couldn't draw 3D but that is the same, just an extra component...
w^2 = x^2 + y^2 + z^2
       or
w = sqrt(x^2 + y^2 + z^2)
cuRant PRogekt: a three-de map editer
Why the hell'd you ask me for crying out loud!?!
Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM