i was wonder how do i compare the distances of entities to the player. For example im using a trigger event_scan on the actors, the actors then send their coords to the "player". I need to be able to sort out which of the 5 actors is the closest in order.
function ACTOR
{
if(event_type == event_scan)
checkposition(); //check to see if any other coords have been sent
}
function checkposition
{
coordslot += 1; //ads 1 counter to the coord slots (ALL slots are cleared every wait(1);)
if(coordslot == 1)&&(coordslot < maxslots) //places the coords in slot1 and checks to see if the slot is available
{
//copy the coords of the actor into the slot
coordslot1 = my.pos;
}
if(coordslot ==2 )
{
//copy the coords of the actor into the slot
coordslot2 = my.pos;
}
if(coordslot ==2 )
{
//copy the coords of the actor into the slot
coordslot2 = my.pos;
}
//compare distances of coords
return;
}
so at the moment i have the coords of 3 actors , how do i go about finding which is closest to furthest