GoalUse the pen blocks and the move and turn blocks to draw lines and corners.
New words
pen down · a pen block that makes the sprite draw a line when it movespen up · a pen block that lifts the pen so the sprite moves without drawingdirection · the way a sprite faces: 90 is right, 180 is down, −90 is left and 0 is up
Explanation
A sprite can draw if we give it a pen. The pen blocks are in the Pen group, which you add as an extension. When “pen down” runs, the sprite leaves a line behind it wherever it moves. When “pen up” runs, it moves without drawing. The block “erase all” wipes the drawing from the stage. A sprite starts facing direction 90, which is to the right. The block “turn ↻ (90) degrees” turns it clockwise but does not move it. The sprite only draws when it moves, so the order of the blocks matters: pen down must come before the move.
Worked examples
This script draws the line in the picture above: from x: −50 to x: 50, because the sprite moves 100 steps to the right with the pen down.
To draw a corner we turn between two moves. The sprite starts at x: −40, y: 30, draws 60 steps to the right, turns 90 degrees clockwise so that it faces down, and draws 40 steps. The picture shows the line the pen leaves.
Use “pen up” to jump to a new place without drawing. This script draws two short lines, one above the other. The sprite lifts the pen before it goes to the second start place.
Class activity
Be the pen (with a friend): you are the sprite and use a pencil on paper. Your friend reads the commands: “pen down, move 6 steps (6 cm), turn right 90 degrees, move 4 steps, pen up, move 3 steps, pen down, move 4 steps”. Use a ruler for each move and the corner of a card to turn exactly a quarter. Lift the pencil on “pen up”. What did you draw? Swap and write your own commands for a letter L.
Practice
1
What does the block “pen down” do?
It makes the sprite draw a line behind it when it moves.
2
The sprite starts at x: −50, y: 0 facing right. Where does the line end and how long is it?
At x: 20. The line is 70 steps long.
3
Which script draws a line? Why does the other script draw nothing?
B draws a line. In A the sprite moves before the pen is down, so nothing is drawn.
4
The sprite faces right and runs “turn ↻ (90) degrees” and then “move (30) steps”. In which direction does it move?