getClosestClone
Posted: Wed Jul 20, 2005 4:51 am
Actor *getClosestClone( char *actorName, double range)
{
Actor *resultActor = getclone("invalid.0");
Actor *testActor;
int maxClones = 64;
int i = 0;
double testDistance;
double minDistance = range;
while ( i < maxClones )
{
testActor = getclone2( actorName, i );
if ( testActor ->cloneindex != -1 )
{
testDistance = distance ( x, y , testActor->x, testActor->y );
if ( testDistance < minDistance )
{
minDistance = testDistance;
resultActor = testActor;
}
}
i++;
}
return resultActor;
}