Week 25 · Unit 10: Be a game developer · 3 lessons
3
Stamps, pens and play time
Computing 4: Unit 10, pp. 138–151
GoalUse the pen blocks to draw and stamp, trace a pen script, and describe how to keep game playing healthy.
New words
pen down · a block that makes a sprite draw a line when it movesstamp · a block that leaves a copy of the sprite’s picture on the stageerase all · a block that clears every pen line and stamp from the stage
Explanation
Scratch has pen blocks that you add as an extension. With pen down, the sprite draws a line wherever it moves. Pen up stops the line. The stamp block leaves a copy of the sprite’s picture where it is, and the sprite can then move on and stamp again. Erase all clears the stage. A repeat loop with a stamp and a move makes a row of pictures. A sub-routine can draw a shape that several scripts use. Games are good for quick reactions and planning, but too much play tires our eyes, steals sleep and keeps us from playing outside. Take breaks.
Worked examples
A flower garden. Script: go to x: −150, y: 0, then repeat 6 times: stamp, change x by 50. The sprite stamps a flower, steps 50 to the right and stamps again. Stamps are at −150, −100, −50, 0, 50 and 100. The sprite itself ends at −150 + 6 × 50 = 150.
Stamps in a square. The sprite starts at x: 0, y: 0 facing 90. In each round it turns ↻ 90, moves 60 and stamps. Round 1 faces 180 (down) and stamps at (0, −60). Round 2 faces 270 and stamps at (−60, −60). Round 3 faces 0 (up) and stamps at (−60, 0). Round 4 faces 90 and stamps at (0, 0), where it began.
This is the script for the square of stamps. When you make or play games, plan the time as well: a break every 30 minutes, time outside, and stopping in time to sleep.
Class activity
Card stamps (with a friend): cut a small star or leaf from card. This is your stamp. Put it on a big sheet of paper and trace around it with a pencil each time you “stamp”. Follow this script with a ruler and a card: turn right 90 degrees, move 6 cm, stamp. Do this 4 times in all. Do you get a square of stamps? Then write a script that makes a row of 5 stamps and try that. Last, make a play-time plan for your week together.
Practice
1
A sprite starts at x: −100, y: 0 facing 90. It follows this script. Describe the line it draws and say where it ends and which way it faces.
It draws a line 50 to the right (to x = −50), turns down and draws 50 down (to y = −50), turns left and draws 50 to the left (to x = −100, y = −50). It ends at (−100, −50) facing 0 (up), after turning 90 degrees three times.
2
Write a script that stamps 5 stars in a row, 40 steps apart, starting at x: −80. Where does the sprite end?
when green flag clicked, go to x: −80 y: 0, then repeat (5): stamp, change x by 40. The last stamp is at −80 + 4 × 40 = 80, and the sprite ends at x = 120.
3
The programmer wanted 4 stamps in a row, but the stage shows only the sprite. Find the missing block.
The loop has no stamp block, so nothing is left behind. Add stamp inside the repeat, before change x by 30.
4
Give two things you can do to play games in a healthy way.
For example: take a break every 30 minutes, look at something far away, play outside every day, and stop early enough to get a good night’s sleep.