Project 550: Racing Road

3. (Group Activity) Review Variables

Why do we need a "speed" variable? This variable isn't keeping track of anything like score or lives ... but it will make coding a lot faster for us later.
This challenge doesn't have a starting point

Steps

1. Click surprise to get 3 random sprites

We'll be deleting these later so it really doesn't matter what your sprites are.

2. Tell all of the sprites to lower smoothly down the screen

Grab a "when green flag clicked" and connect a "repeat __" loop. Inside the repeat loop, put a "change Y by __" block. Change Y by -10. Do this for all 3 of your random sprites.

3. Test it out!

Okay, that's nice! But what if we change our minds and don't like how fast it is after all?

4. Change the speed

Change all of their "change Y by __" blocks from -10 to -3 instead.

5. Change the speed for all the sprites 5 more times

Just kidding! That'd be super annoying. Instead, create a variable called "speed." Pick one sprite and initialize "speed" to -3.

Then, in all your random sprites, drop the "speed" bubble in the "change Y by __" blank. 

6. Change the speed variable 3 times and test

Find the code where you initialize "speed" to -3 and change -3 to any other number. Then press the green flag. This is way easier. It's only one number to change. All the other sprites will be automatically updated because they're using the "speed" variable. 

7. Set up for the next challenge

Go ahead and delete all those tester sprites. Then, go to your car sprite and initialize your new speed variable to 10 at the start of the game.