You haven't explained really what you're trying to do, I'm guessing you're creating a racing game or similar and want to know only the players position
If I'm right so far you can try something like
function position_check(ENTITY* ent){
//me = ???;
if(vec_dist(my.x, endpoint.x)) < vec_dist(ent.x, endpoint.x)){
return(1);
}else{
return(0);
}
}
function update_position(){
while(1){
position = 1;
position += position_check(ai1);
position += position_check(ai2);
wait(1);
}
}
I haven't tested any of this, it's really only for guidance
You'll need to set what me is in the 1st function, and repeat position += position_check(ent_name) as necessary for any additional opponents
Hope this helps