Project 550: Racing Road

9. Collide into obstacles

The car should be checking if it drives into the obstacle, and if it does, the car's speed should be reduced, and be pushed downwards based off the new speed.
Starting point file for this challenge

Your goal

Steps

1. Create a new if-statement in the car

You'll need a "when green flag clicked" block, a "forever" loop, and a "if _ then _" block. 

2. Check if the car is touching an obstacle

Since you have to check for two different obstacle sprites, you'll need to put an "operators" block called "__ or __" in the "if" blank first. 

Then, grab two of the "touching __" blocks from "sensing" and place them in either "or" blank. Change them to check for either of your obstacle sprites. 

3. If so, set speed back to 10

Putting a "set __ to __" "variables" block in the "then" blank will help us out. 

If we didn't have this block, and you hit a boost and your speed was really high, and then immediately hit an obstacle, you'd get launched backwards at a high speed too. 

4. If so, push the car backwards at the same speed as a result

Add a "motion" block called "change Y by __" in the "then" blank. Change Y by speed * -1 again.