Lesson 2 of 3
Follow one block at a time from a known start
One idea at a time. Try the example, then keep going.
Big ideas · 1 of 5
Big ideas
Do this: Read the steps. Then try following a short script on paper.
SequenceThe order of the steps.Exactly: The order in which instructions execute. Changing this order can change the result.See this in Key words means the order in which instructions run. In these small scripts, read the connected blocks from top to bottom. Changing their order can change the result.
TracingWalking through code one step at a time.Exactly: Writing the starting state, reading one instruction, recording the new state, and continuing in order.Mix-up alert: Record what the code does, not the result you wish it produced.See this in Key words means following the instructions one at a time and recording what happens. First write the starting state, such as the sprite's position before the script runs.
x is the sprite's horizontal position. go to x:0 y:0 sets a known position. change x by 20 adds 20 to the current x. Positive changes move right; negative changes move left. We keep y at 0 in these examples.
After each block, write the new position. Use that position as the starting point for the next block. A start block triggers the script; it does not itself reset the position.
If each green-flag run must finish at the same position, ResetPut something back to a known start.Exactly: In our position examples, set the sprite's starting position before movement, using go to x:0 y:0.Mix-up alert: Reset when the goal needs it, such as finishing at the same position each flag run. It is not a rule for every program.See this in Key words the position first. Put go to x:0 y:0 before the change blocks. Without a reset, another run can add more movement. Not every program has the same reset requirement.
Do this: Cover the answer. Work out each new x on paper.
Omar uses the online Scratch editor on a Chromebook. His mascot starts at x:40, y:0. Its only script is when green flag clicked, go to x:0 y:0, change x by 20, then change x by -5. He traces before running: the start block leaves x at 40; go to sets x to 0; the next block makes x 20; the last makes x 15. The y position stays 0. Another complete flag run ends at x:15 again because the script resets first.
Do this: Say what each block would do from x:8, y:0.
From x:8, change x by 20 gives x:28. It adds to the old x. From the same start, go to x:0 y:0 gives x:0 and y:0. It sets a position. The number in a change block is an amount to add, not a destination.
Step-through
Do this: Before each next step, predict x. Then check the recorded state.
Trace Omar's one script from x:40, y:0. Each step records the position after that block. No other script moves the sprite.
The when green flag clicked block starts the script. Position is still x:40, y:0. Starting is not resetting.
From other sites
Do this: Pick one to see the same ideas another way.
Scratch Team, about 1 minute
Watch for:
Video not loading? It might be blocked on this wifi. Try it at home.
Ready when you are.
Activity 1 of 5 · 0 of 5 activities done
Write it
Do this: Explain the starting state and block order, then compare.
Start here if it helps: The green flag starts the script, but...
Your answer is not saved anywhere. It disappears when you leave the page.
Flashcards
Do this: Work out the answer before you flip. Use paper for the positions.
Card 1 of 15
0 Know it0 Still learning
Which step comes first?
On the card: Enter or Space flips. Left and Right move. After revealing, 1 marks Still learning and 2 marks Know it. Tab reaches every control.
What is sequence?
The order in which instructions run.
What are the three actions in a trace?
Write the start state, read one block, and record the new state. Continue block by block.
What does x describe in these examples?
The sprite's horizontal position. Positive changes move right; negative changes move left.
From x:35, y:0, what does go to x:0 y:0 do?
It sets x to 0 and y to 0.
From x:12, what does change x by 20 give?
x:32, because 12 + 20 = 32.
From x:18, what does change x by -6 give?
x:12. A change of -6 moves left by 6.
Which ends at x:10: go to x:0 y:0 then change x by 10, or those blocks in reverse?
Go to first, then change by. Reversing them ends at x:0.
Your script must finish at the same position on each flag run. What should come before its change blocks?
A position reset, such as go to x:0 y:0.
Does clicking the green flag reset x by itself?
No. The script needs a block that sets the position if a reset is required.
Before following any movement blocks, what position should you record?
The starting state: the sprite's position before the script runs.
After tracing one block, which position do you use for the next block?
The new position you just recorded.
Omar's mascot starts at x:40, y:0. What is its position just after the start block, before go to?
Still x:40, y:0. The start signal does not reset the position.
From x:8, does change x by 20 give the same result as go to x:0 y:0?
No. The change gives x:28. The go to block sets x:0, y:0.
In Omar's worked example, does y change during the trace?
No. The y position stays 0.
Why does another complete run of Omar's script finish at x:15 again?
The script resets to a known position before the change blocks.
True or false
Do this: Choose True or False. Check each explanation.
Self-test
Do this: Answer each question and read the explanation before moving on.
8 questions. One at a time.
Practice, not a grade. No timer. Your best score stays in this browser.
Match
Do this: Choose a word, then choose its meaning.
Connect the ideas
0 / 4 connectedChoose a term, then its meaning. Or drag its grip. Use Tab and Enter or Space; Escape clears.
Classwork
Your next step
Started on another device?
Homework · 10 points
Opening your homework…
Practice it: You did 0 of 5 activities.
You decide when you have finished. This is your study progress, not a grade.
Before you move on
Your teacher gets your work only when you turn it in on Classroom.
Not marked finished yet.
Two ready posts. Nothing is saved or sent. Make one Classroom assignment for each step you assign, using the points shown below and its own due date. Copy its post and paste it into the assignment's instructions.
Classwork
Worth 10 points.
https://gradebridge-beryl.vercel.app/learn/csc/programming-with-scratch/sequence-and-tracing#classwork
Homework
Worth 10 points.
https://gradebridge-beryl.vercel.app/learn/csc/programming-with-scratch/sequence-and-tracing#homework
After students turn it in, open Check student work
Download their files from the assignment's Drive folder, then open them in Check student work.