> well take the distance from start of line and current position and measure it, if your player is first the distance will be bigger if its not the first but the 2nd then compare the distance that player has and the distance that the AI in first position has and say "if player has distance less then AI1 and bigger then AI2 and AI3 then set pos to 2 and so on. u have to do the math, and events alot of combinations, but with distance is 1 simple way to do it, take as A point to start measure the distance the startup line, and B point the end line, distance will be the space between them.
>
can you give an example?
lets say u have car1 and car2 and point A for finish line
if car1 is at x 300
and car2 at x 150
u can compare two variables 1st variable to compare will be the distance from car1 to finishline and distance of car2 to finishline this is for straight drag races.(and u do next : |distance(car1.x,car1.y,finsihline.x,finishline.y)| < (less ) then next variable will be| distance(car2.x,car2.y,finsihline.x,finishline.y) | set car1.position to 1, set car2.position to 2(the position is your display rank u have in game , not the actuall position.) the logic is => if the distance from car 1 to finish line is smaller then distance of car2 to finish line, the car 1 will be positioned in first place , and car 2 to second place.
also for drag race , you could simple compare the X values only so if car1.x >(greater then ) car2.x then car1 is 1st place