1.8 Do it Together
Predict: Telling a story doing some things together:
Continuing from the question at the end of the previous section, it doesn't seem very natural, on reflection, does it? People don't typically stop acting surprised to say something.
For greater realism, we want the spinning then moving backward action to take place at the same time as the speaking action. That is, we want the person to be saying Aiii! at the same time as he is spinning around then moving backward. We want these actions to be done together rather than done in order. So our new storyboard would look like this:
Do these things in order
beetle moves out from behind the tree
Do these things together
guy spins around once
guy moves backward
guy says "Aiii!"
ringoBeetle moves out from behind the tree
ringoBeetle says "Sorry his leash came off."
This storyboard shows that parts of the animation should happen in order -- one at a time, and parts will happen all at the same time. Note that we tell what instructions are done in what way by indenting them under the description of how to do them. This can be hard to understand at first, particular when a 'do in order' part is mixed with a 'do together' part - as here. In this example, think of the "Do these things together" section as a single instruction. The "Do these things in order" part then has 4 main steps - the beetle moving, then the doing things together, then the ringoBeetle moving and finally the ringoBeetle saying something.
Let's try this out then. Click here if you want to see again exactly what we want to create.
Notice that there's a Do together tile down next to the Do in order tile at the bottom of the screen.
Drag this tile up and drop it in between the beetle move instruction and the first slackerProm instruction.
The Do together tile will slot in between the beetle move tile and the slackerProm turn tile.
Currently it should say within it Do Nothing.
<click on me to make me bigger>
Now drag the three slackerProm instruction tiles into the Do together tile, one at a time.
You should now have a beetle move instruction followed by the Do together tile containing the move up, say, and move down slackerProm tiles.
<click on me to make me bigger>
See how the structure of the Alice code matches the structure of the storyboard!
Now practice your prediction skills. Examine the code carefully.
[Q1.8.1]: Do you think this will work as we hope, with slackerProm spinning around then moving back at the same time as he says "Aiii!"?
And now test your prediction by running the program. What did you get?
It's not what we wanted, is it? The guy didn't move backwards. Instead he kind of turned funnily -- his turning radius was increasing as he turned. If this isn't what you expected, then look at the code very closely to try to explain to yourself why this has happened.
[Q1.8.2]: Why did slackerProm not move as we had expected?
If you're still unsure, then consider what you've asked Alice to do. You've given instructions to turn while moving backward, asking for them to be performed at the same time. So, Alice moves slackerProm 5 meters while he was spinning, changing his turning radius. This is a kind of complex behavior in Alice, but even if you couldn't calculate exactly how far he moves back while spinning, you should get, basically, why it does what it does. The two actions are happening at the same time because they are in a Do Together tile.
Take a moment to consider how you could fix this. Can you see the solution?
If you're not sure, think how the three actions of spinning, moving, and saying something need to be coordinated together. Simply doing them in order isn't enough; simply doing them together isn't either.
[Q1.8.3]: Can you see a solution that involves both doing things together and doing things in order? Please describe it.
How you should have thought about this section:
English:
Spanish: