Project 114: Ant Racing

10. Add timers for each racer

Create variables to track the how long it takes each racer to reach the finish line
Starting point file for this challenge

Your goal

Steps

1. Create time variables for each racer

In order to keep track of the amount of time each racer takes to reach the finish line, we need to create new variables. This can be done in the orange "variables" section. Click the "Make a Variable" button and name your variables "Racer 1 Time" and "Racer 2 Time".

2. Add a "When green flag clicked" block

You can find the block in the yellow "events" section.

3. Start each time at 0

At the start, set the time variables to 0.

4. Add a "change my variable by 0.1" block

You want your timer variables to go up as time passes, so we need to add to them. You can find this block in the orange "variables" section. You need to change the variable in that block to the timer variable for each racer.
To add another layer of precision, you want to go up by 0.1 seconds at a time.

5. Repeat your code with a "repeat until __" block

You want your variable to be constantly changing, not just go up once. To do that you need a "repeat until __" block from the "control" section.

6. Add a "touching finish line" block

You want to stop adding to each racer's time once they reach the finish line, so use a "touching mouse-pointer" in the "sensing" section. You need to change "mouse-pointer" in the sensing block to "finish line".

7. Add a "wait" block

You only want to add 0.1 to your time every 0.1 seconds, to do this add a "wait 0.1 seconds" block from the "control" section inside your "repeat until" loop.