Project 550: Racing Road

5. Slow down if you drive off the road

If you drive your car off the road, you should slow down. If you go back on the main road, you should set your speed back to normal.
Starting point file for this challenge

Your goal

Steps

1. Build an if-then-else statement

In your car, you'll need a "when green flag clicked" block from the "Events" section. You'll also need a "forever" loop and a "if _ then _ else _" block, both from the "control" section. 

2. Check if the car is touching the grass

Use a "sensing" block called "touching color ___" and put it in the "if" blank. Use the eyedropper tool to select the exact color of your grass. Be sure to watch the gif if you're unsure of how to use the eyedropper tool! 

3. If it is, lower speed as a result

Grab a "variables" block called "set __ to ___" and put it in the "then" blank. Set your speed variable to 3. 

4. Otherwise, set speed back to 10

Grab another "set __ to __" block and put this one in the "else" blank. Set your speed variable back to 10.