Here when the mouse touches a coloured line a variable is set to true. If all checkpoints are TRUE when you cross the finish line then a lap is added
Variables need to be reset at the start of each track and the checkpoints reset after each completed lap.