Think of 22 cars running in circuit.
I can sort them based on the order they reach the finish line.
I start to have problems, because over time, the faster cars start to reach the slower cars.
Making the cars slower latecomers/laggards/lapped (blue flag in F1).
Event (collision car with finish line):
other.position[other.collision]=pilot; other.lap[other.collision]=timeLap; other.timeTotal[other.collision]=timeTotal; other.collision+=1; if(other.collision>22){ other.collision=1; } OBS - The collision event (shown above) is performed on the car. Every variable (other.) Is because it belongs to the finish line.
I use a variable that serves to define which array index will be defined (other.collision).
Draw Event (Finish Line):
repeat(22){ draw_text(1280,100+(20*(i-1)),string(position[i])); draw_text(1430,100+(20*(i-1)),string(lap[i])); draw_text(1530,100+(20*(i-1)),string(timeTotal[i])); i+=1; } i=1; What happens is that when the first car overcomes the last one, it ends up having the index 22. Becoming the last and vice versa.
I tried to use the time, but the faster car does more turns in less time. Time equals or does not work correctly. So I would also have to use the amount of laps.
That's when I got completely confused.
I am trying to use arrays to order them with the bubble sort, but I didn't get anything functional..
I tried a few more things, but I got lost and I don't even know how to explain it to you.