Goal: Give the cars a hidden part of each lap.
Vocabulary: ht, st, wait
We can add some commands to the programmed colors so that the cars will disappear for little while and then come back. (This way it will seem as if they are continuing the race on another part of the track which we can't see.)
- Add this at the beginning of the instructions for each color:
ht wait random 50 st
Ht means "hide turtle." The turtle will disappear.
Wait random 50 means, "Wait a random amount of time that is less than 50." Each number is 1/10 of a second. Wait 10 is one second. Wait 50 is five seconds. So each car will disappear for up to five seconds and will not be moving during that time.
St means "show turtle." The turtle will appear again.
Then the turtle will finish running the instructions (adding 1 to its lap-counting box) and will continue racing. Every time a car touches its starting line, it will again be hidden for up to five seconds before it continues racing.
- We need to add st to the reset procedure to be sure that we can see the cars again when we start over.
- A car runs faster when it is the only one moving. So we will slow down the cars by changing their instructions to fd random 3.
What happens if you change the number after wait?
What happens if you change the number after fd random in the OnClick rule of each turtle's backpack?
Can you "fix" the race so that one car has an advantage over the other?
On Your Own - Project Ideas
Can you make another animation in which an object disappears when it touches a color? Can you make it reappear when it touches another color? (Can you make an airplane disappear as it passes through clouds? or an animal disappear as it passes through a hollow log?)