GoalPlan, build and test a two-sprite dance routine, with resets, a static object and matching times.
New words
plan · to decide what to do before you starttest · to run a program and check that it worksimprove · to make something better
Explanation
A good project starts with a plan. Choose two sprites and a backdrop. Write the steps for each sprite in a table. Start each script with the same event and a reset. Check that the two routines take the same time. Add a static object if you like. Then test: do they start together, finish together and begin in the same places each time? Last, improve the program by joining blocks that repeat, or by using a repeat block, so it is concise.
Fish
Crab
Start
space key
space key
Reset
go to x: −80, y: 0
go to x: 80, y: 0
Moves
up 1 s, down 1 s, twice
turn 90°, wait 1 s, four times
Time
4 seconds
4 seconds
Worked examples
Here are the scripts from the plan. The fish goes up and down twice. Each glide takes 1 second, so the fish takes 4 seconds. The crab turns 90 degrees and waits 1 second, four times. It takes 4 seconds, and it ends facing the way it started.
The first plan for the fish had no repeat block. It had two ups and two downs, 4 glide blocks, plus the go to and the hat: 6 blocks. With the repeat it has 5 blocks. The same dance, fewer blocks.
Test the show. Press the key and watch: do both sprites start together? Do they stop at the same time? Press the key again: do they begin from their start places? If something is wrong, find the block that causes it, edit it, and test again.
Class activity
Dance show on paper (with a friend): plan a routine for two sprites in a table like the one above. Write the start event, the reset, the moves and the total time for each. Check that both times match, or add a wait. Then act the show out, one of you for each sprite. Does it work? Improve your plan and try again. If you have a computer or tablet, build it in Scratch.
Practice
1
A kite and an owl start together. Do their scripts finish together? If not, how can you fix it?
No. The kite takes 3 × (1 + 1) = 6 seconds and the owl takes 2 × 2 = 4 seconds. Add “wait (2) seconds” to the owl’s script so both take 6 seconds.
2
The crab’s repeat is changed to 3. What happens? How can we fix it?
The crab then takes only 3 seconds, so it finishes early, and it ends facing a different way. Change the repeat back to 4.
3
Which blocks make sure the dancers start in the same places each run?
The go to blocks right after the hat blocks.
4
Name two things to check when you test a dance show.
Check that the sprites start together and finish together, and that each run begins from the same start places.