Huummmmmmmmm...
Is there a special reason why this code works for calculating the closest object to my but not recognizes the first one ?
I mean, closestSlotToMe is calculated allright, but when the closest one is the slotID 1, it doesnt work
The are 9 slots..
Code:
function getClosest_Slot()
{
var i;
var idist;
while ( i < 10)
{
if(slotsHandle[i])
{
you = ptr_for_handle(slotsHandle[i]);
if(you)
{
if(vec_dist(my.x,you.x) < idist)
{
closestSlotToMe = you;
}
idist = vec_dist(my.x,you.x);
}
}
i += 1;
}
return (idist);
}