by Fuzzy » Thu Feb 16, 2006 10:19 pm
Distance takes four arguements. It takes two sets of X and Y coordinates, and returns a distance. You use it to set a variable. Here is how you would use it.
HowFar = Distance(supaboy.x,supaboy.y,moon.x,moon.y);
Just for kicks and giggles, here is how to calculate it by hand, so you can use it in real life.
D^2=abs(x1^2-x2^2)+(y1^2-y2^2), see why we let Makslane and GE figure it out for us?
Seriously, if i was standing at x=3 and y=4, and you are at x=0 and y=0, the distance I would be from you is five units away.
D^2=(3^2-0^2)+(4^2-0^2) or
D^2=(9-0)+(16-0) which is equal to
D^2=25.
So now all we have to do is eliminate the ^2. to do that, find the square root of 25, which is 5. D=5! abs means absolute, and it eliminates a negative sign.
Mortal Enemy of IF....THEN(and Inspector Gadget)
Still ThreeFingerPete to tekdino