3
Two characters, one project
Computing 2: Unit 1, pp. 8–23
GoalRead and plan a project with two characters, each with its own script.
New words
project · a bigger program that you plan and makescript · the blocks that belong to one charactercompare · to look at two things to see how they are the same or different
Explanation
A project can have more than one character. Each character has its own script. One character can start on the green flag, and another can start on tap. Plan each script with its own algorithm. Test one character at a time. Then run the whole project and watch the characters together.
Worked examples
A dog and a ball. The dog starts on the green flag. The ball starts when you tap it.
Which program matches this algorithm for a balloon: start on the green flag, move up 4, spin left 3, stop? Program A matches. Program B starts on tap and has a half turn.
If two characters both start on the green flag, they both start at the same time when you press it.
Class activity
Puppet show: make two paper puppets, each with a script card. Puppet 1: start on clap, move across 3 steps, say “Hi!”. Puppet 2: start on tap, hop 2 times, spin around once. Perform both scripts with a friend. Then change one card so that both start on the same clap. What happens now?
Practice
1
Which character starts when you tap it?
The Bee.
2
Both characters start on the green flag. What happens when you press it?
Both start at the same time. The fish moves right 3 and the star moves up 2.
3
Write the algorithm for the Owl.
1 Start on tap. 2 Spin left 3. 3 Say “Hoo!”. 4 Stop.
4
Why is it a good idea to test one character at a time?
It is easier to find a mistake when only one script is running.