Ending A Race Based on How Many Laps the Player has completed?

Another question, this one being pretty self-explanatory:
How do I go about creating a system that can determine whether or not a player has won a race based on how many laps the player has completed?

I have a lap counter already implemented in my racing game (currently going under the name “Super Sprint”), but I currently don’t know how to end a race based on the number of laps the player has completed.

Any help would be greatly appreciated, Preferably with links, screenshots, etc. that could provide some aid, if possible.

1 Like

How does your lap counter work?

Here is my idea, it is pretty basic but it could help. If you have more specific info or a game link, I could probably help in more detail:

  1. Have a block or variable that records the amount of laps a player has completed.
  2. Have it always output to a Filter behavior.
  3. Have the filter output if the player has greater than or equal to the required number of laps to win. It should output to code that ends the race.
1 Like

Here is a screenshot showcasing the code of my lap counter:

Hope this helps. :slightly_smiling_face:

1 Like

Check this out:

I’ll give it a try. Thank you! ^^


Feel free to add things and change it to better fit what you want it to exactly do. For example, you could also output the laps completed to a label to show on the screen how many they have done. Or, you can add other things after the Filter depending on what you want to have happen when someone wins.

Let me know if you have other questions

1 Like

@johnpost should be right. I’ve seen this used numerous times. Good luck on your racing game!

1 Like

And since this topic is of no more use…
Come join our militia! Lol