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):
velocity=10-((carNumber-1)*0.01);
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) :
other.orderLapTime[car]=get_timer()-other.discount;
- Discount = this is the exact time when the room starts (cars already start running).
CODE - obj_Finish / Set discount (Create Event):
discount=get_timer();
The display is made with a modifier (multi, to simulate actual track times).
CODE - obj_Finish / Draw time lap (Draw Event):
draw_text(1500,100+(20*(i)),string_format(orderLapTime[i]*obj_Seth.multi/1000000,1,3));
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):
unit+=velocity/60*0.001;
Below the results...
Respective code:
draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,3));
Respective code:
draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,5));
The speed difference between the cars is 0.01.