playMaker

Author Topic: Lap system  (Read 2045 times)

LogLady

  • Full Member
  • ***
  • Posts: 150
Lap system
« on: December 22, 2017, 10:25:51 PM »
Hi!

For some long time I've been cracking my head trying to figure how to make a checkpoint and lap system that prevents the player to "cheat" running the track backward and completing the track. Right now I have a gameObject that holds an arrayList (array maker) containing the checkpoints of the track. The car player hits the checkpoint gameObject and add 1 to an interger variable and checks if it equals the number of checkpoints. If equals a lap is complete. What is happening is that if the player goes to the checkpoint 9 and run backwards and hit checkpoint 10 (the last checkpoint in this example) a lap is considered complete. If the player run to lets say checkpoint 3 and then run backward 7 times the lap will be considered complete too. How do I prevent this to happen and only count the lap complete if the player runs correctly?

Thanks for your help!

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Lap system
« Reply #1 on: December 23, 2017, 01:19:12 AM »
If this is a single player game, have the triggers (check points) disable after they are hit. Then reset them all, once your total is hit. Then they cannot be used again.

LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Lap system
« Reply #2 on: December 23, 2017, 09:36:52 AM »
Sorry! I forgot to tell that it is a local multiplayer game.

Edit: Even disabling the previous checkpoint and only leaving enabled the next one, the player can enable the last checkpoint and race the track backward to the finish line and a lap would count anyway. Sure, the player would lose the race to the other opponents bug it is buggy and not elegant .  :-\
« Last Edit: December 23, 2017, 10:12:16 AM by LogLady »

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Lap system
« Reply #3 on: December 23, 2017, 11:43:14 AM »
Have for example 3 states on each car in a loop, and 3 checkpoints (or however many you want).

Each checkpoint has an INT variable. 1, 2, 3.

On each car, have 3 states. One, Two and Three.

As the car passes each checkpoint (trigger), check your state (for example State one), does an INT compare for the current check point fsm. If true, go to next state (two). If false, do nothing. This can force each car to go in order.

This would take care of the multi player car problem at least  8)

LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Lap system
« Reply #4 on: December 23, 2017, 04:37:13 PM »
I will give a try. Thanks for your reply!