Hi, I am currently making an F-Zero fangame (a racing game) and am having issues with creating the final position system (finding out whether a racer finished 1st, 2nd, 8th, etc.)
I've had little issues with getting the player's position to work. I've created this code that triggers when the player crosses the finish line, and it basically counts how many Racers have finished the race in order to determine the player's final positon)
(Some things to note: The "Racers" family only contains the PlayerMachine and CPU sprites, and "Final_Position" is a family variable. Also the code below continues in the exact same way up until CPU.PickedCount = 14, because this game has 15 racers.)
I've tried using this same system for the CPUs, although I have to make it using the Racers family rather than just the CPUs, as the CPUs are competing against both each other and the player of course. I also want to implement a system where the boolean variable "FinishedRace" (which is also a "Racers" family variable) becomes true once the player reaches the finish line, making the CPU's final position whatever their current position (CurrentPositon) was in the race.
But this system has proved to be very glitchy and unreliable with the CPUs. The main problem I'm running into is multiple racers having the same position at the end of the race. The most common one is both a CPU and the player ending with the same Final_Positon, but sometimes multiple CPUs have the same Final_Position as well. My guess as to why this happens for the CPUs is because of this set of code that makes the CPU's final position whatever their current position is when the player crosses the finish line, as mentioned earlier.
I've been trying to find a way to have two instances of the same sprite compare each other, like having something like:
If Racers.Final_Position = Racers.Final_Position, then add 1 to Racers.Final_Position
But obviously that code wouldn't work, as Construct doesn't allow you to compare two of the same families in that way.
Sorry if I'm not clear about something, but if any of you all could help it would be greatly appreciated! These CPU position bugs have been plaguing my game for a while now