AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Dance routines

Week 10 · Unit 4: Be a designer · 3 lessons
1

Start and finish together

Computing 3: Unit 4, pp. 60–78
GoalPlan scripts for two sprites so that they begin together, begin in the right places and finish together.
New words
routine · a set of moves done in the same orderstatic · not movingfinish together · end at the same moment
Explanation

When two sprites perform together, each one needs its own script. Both scripts start with the same event, so they begin at the same time. Each script starts with a go to block, so the sprite is in its right place on every run. Then we count the time each script takes. If one script is shorter, we add a wait block so both finish at the same moment. A sprite with no script, such as a tree, is static. It does not move, but it is still part of the picture.

Butterflywhenspacekey pressedgo to x:-80y:-60glide1secs to x:-80y:60glide1secs to x:-80y:-60Beewhenspacekey pressedgo to x:80y:-60glide2secs to x:80y:60
Worked examples
SecondsButterfly: yBee: y
0−60−60
1600
2−6060
The butterfly goes up in 1 second and comes down in 1 second, so its script takes 2 seconds. The bee glides up slowly in 2 seconds. Both finish after 2 seconds, but they are in different places: the butterfly is down at y: −60 and the bee is at the top.
Both scripts begin with the go to block. If we press the space key a second time, the sprites jump back to their start places before they move. Without this reset they would begin where they stopped.
x 240−240y 180−180static treemovesmoves
The picture has a tree that never moves. It has no script, so it is static. It is not a mistake. Many projects have background objects that just stand there.
Class activity

Two dancers (with a friend): plan a routine on paper. Each dancer has a start spot, marked with a book or a shoe. On “Go!” both dancers do their own moves, such as “walk 3 steps, spin, clap”. The routine must take the same time for both, so use a count of beats: each move lasts 1 beat. Add a “wait” where one dancer has fewer moves. Test it and see if you finish together.

Practice
1
Dancer A waits 1 second and then glides for 2 seconds. Dancer B only glides for 2 seconds. They start together. What should be added to B so that they finish together?
Awhenspacekey pressedwait1secondsglide2secs to x:100y:0Bwhenspacekey pressedglide2secs to x:-100y:0
2
In the butterfly script from the explanation, where is the butterfly after 1 second?
3
Why does each script start with a go to block?
4
A project has a sprite that is a drum with no script. Is that a mistake?
x 240−240y 180−180drum: no scriptdancerdancer