Project 548: Homeward Bound

5. Directions for the Underwater Car

Now let's give the robot cars a set of directions so that they know where to go. We will start with our "Underwater Animal" sprite again.
Starting point file for this challenge

Your goal

Steps

1. Plan the drive!

Let's plan out the path we are going to tell the car to take. 

Which of the colored circles will the robot car need to travel to in order to bring the animals home? 

2. Go back to your "Underwater Animal" sprite

Select your "Underwater Animal" sprite again.

3. Add your first direction

Get a "glide 1 secs to random position" block from the dark blue "Motion" tab, and add it to the code after the "wait 1 seconds" block. Then change 'random position' to the first colored circle you want the car to drive to, in this case you want to pick "Red".

4. Test it out!

When you click the green flag, does the robot car drive to the red circle?

5. Add a "wait 0.5 seconds" block

We want our robot car to drive safely, so we are going to tell it to pause for half a second before it drive to the next circle.

6. Add the next instruction and wait

Add a "glide 1 seconds to Dark Orange" block and another "wait 0.5 seconds" after it.

7. Go to Dark Purple and then Lime Green

Add two more instructions with wait blocks after each one. The first one should go to Dark Purple and the second to Lime Green

8. Finish the path!

Once the robot car has reached the colored circle that is closest the animals habitat it still needs one more instruction to take the animal home. In this case, the colored circle closest to the Underwater habitat is Lime Green.

Add a "glide 1 seconds to random position" block, and change 'random position' to "Underwater".  

9. Test it out!

Test out your finished instructions!
When the car touches the Underwater habitat it sends a signal to the next car that it is finished so it can start driving the next animal home. 

You will know your code works if your car does not get sent back to the beginning and if the next car appears at the start after this one has reached the correct habitat.