GoalWork out how long a script takes and use a wait block to make two sprites finish together.
New words
glide · to move smoothly to a place, taking some secondstiming · when things happen and how long they taketotal time · all the waits and glides added together
Explanation
Some blocks take time, and some do not. “go to x: y:” happens at once. “wait (1) seconds” takes 1 second. “glide (2) secs to x: y:” takes 2 seconds. “say [Hi!] for (2) seconds” takes 2 seconds. To find the total time of a script, add up the blocks that take time. If two scripts start together but have different times, the shorter one finishes first. To make them finish together, add a wait block to the shorter script.
Block
Time it takes
go to x: y:
no time
wait (1) seconds
1 second
glide (2) secs to x: y:
2 seconds
say [Hi!] for (2) seconds
2 seconds
Worked examples
This script goes to a place, waits 1 second, glides for 2 seconds and then says “Done!” for 1 second. The total time is 1 + 2 + 1 = 4 seconds. The go to block takes no time.
The boat glides for 3 seconds. The fish glides for only 1 second, so it arrives 2 seconds early. We add “wait (2) seconds” to the fish script. Now the fish waits 2 seconds, then glides for 1 second, and both finish after 3 seconds.
Two dancers can also take turns to speak. Dancer A waits 1 second and then speaks for 2 seconds. Dancer B speaks for 3 seconds. Both scripts take 3 seconds in all, so they finish together.
Class activity
Stopwatch game (with a friend): one of you is the boat, who walks across the room taking exactly 3 seconds. The other is the fish, who must finish at the same moment. A stopwatch or counting “one thousand one, one thousand two…” helps. How long must the fish wait before starting if the fish walk takes 1 second? Try it and check that you arrive together.
Practice
1
How many seconds does this script take?
4 seconds. The go to block takes no time. 2 + 1 + 1 = 4.
2
Script A takes 5 seconds and script B takes 3 seconds. They start together. Which finishes first? What can we add to B so that both finish together?
B finishes first. Add a “wait (2) seconds” block to B, because 3 + 2 = 5.
3
Both scripts start when the space key is pressed. Do they finish at the same time? Which sprite starts speaking first?
Yes, both finish after 3 seconds. Sprite A starts speaking first, after 1 second. Sprite B starts after 2 seconds.
4
Which blocks take no time?
Blocks such as go to x: y: and switch costume to. They happen at once.