Posted By: ery
race - 11/14/09 19:43
How should I write a code which shows me current positions of the cars during their
racing?
Posted By: FoxHound
Re: race - 11/15/09 04:11
That's just basic panels. Have them display the X and Y of the cars.
Check
http://www.conitec.net/litec/and go to the functions tab for a quick reference.
Posted By: JibbSmart
Re: race - 11/15/09 04:17
I think he means these positions: 1st place, 2nd place, and so on.
Depending on how open your track is, you could have check points (they don't have to be visible to the player) at each corner and turn, and based on which checkpoints they've passed and how close they are to the next one, cars can figure out their place.
For a more complex race with tons of different paths you could resort to A* pathfinding, if you can set it up so that paths can't go back over the finish line (if it's a lap race).
Whoever has the shortest path is leading. You'd only need to re-calculate the paths every few frames or so.
Jibb