Search Unity

Racing Game Race Positions

Discussion in 'Scripting' started by JacksonTheXtremeGamer, Jul 13, 2020.

  1. JacksonTheXtremeGamer

    JacksonTheXtremeGamer

    Joined:
    Jun 15, 2019
    Posts:
    108
    I managed to get everything in order. Now what you might want to know is how to do racer positions for your game. And the answer is very simple: First you need to make an ‘if’ statement checking if your lap count is higher than, lower than, or equal to the other racers. For example if your lap counter is higher than your opponent’s, have a return value of 1 so that when playtesting, you will find a suitable result. If your lap count’s even with your opponent’s however, you might need a variable to check how many checkpoints you passed, and if that amount is equal, make a variable to check how close both you and the NPC are to the next checkpoint by using the Distance function. If all three are in the negatives, have a return value of 0. I’ll try and see if I post the code later on to show you what I mean.
     
    Last edited: Jul 13, 2020