In the room there are 22 cars. All cars have a different speed.
The cars are numbered from 1 to 22 with the help of the variable carNumber.
CODE - obj_Car / Set car speed (Create Event):
Here's how there is a difference in car placement near the end of the lap:
However, even with this difference, the times of many cars are repeated:
The detection of lap time looks like this.
CODE - obj_Car / Time lap (Collision with obj_Finish) :
- Discount = this is the exact time when the room starts (cars already start running).
CODE - obj_Finish / Set discount (Create Event):
The display is made with a modifier (multi, to simulate actual track times).
CODE - obj_Finish / Draw time lap (Draw Event):
Even taking the multiplication and increasing the number of decimal places, there are still many repeated times:
Some inconsistencies including. Cars with slower speeds marking faster times.
I could slow down the base speed (10) to solve such a problem, but I already think in the long run. The races can't take so long. In addition I intend to give the player the option to set the speed with which the race takes place (a multiplier, more frames, etc).
It could also increase the difference between the speeds (0.01 to 0.05), but I would like a general resolution, so that I can notice through the lap time, if only by one thousandth (0.001).
EDIT 1 - Attempts made based on answers and comments from Bálint and TomTsagk:
That is what I tried to do.
CODE - obj_Car / lap time (Step Event):
Below the results...
The speed difference between the cars is 0.01.