AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Short programs and resets

Week 2 · Unit 1: Making programs clear · 3 lessons
3

Reset the size

Computing 3: Unit 1, pp. 8–27
GoalUse the set size block to put a sprite back to its normal size every time the program starts.
New words
size · how big a sprite looks; a new sprite has size 100change size by · adds to (or takes away from) the size the sprite has nowset size to · gives the sprite exactly that size, whatever it was before
Explanation

Some programs make a sprite bigger or smaller. “change size by (15)” adds 15 to the size the sprite has now. Click the flag again and it adds 15 more, so the sprite keeps growing. “set size to (100) %” is different. It makes the size exactly 100, whatever it was before. Most new sprites start at size 100. Put “set size to (100) %” just after the hat block, together with the go to block. Then every run starts in the same way.

No resetwhenclickedchange size by15change size by15change size by15With resetwhenclickedset size to100%change size by15change size by15change size by15
Worked examples
ClickNo resetWith reset
1st145145
2nd190145
3rd235145
A sunflower sprite starts at size 100 and the program adds 15 three times, which is 45 in all. Look at the size after each click. Without a reset it grows every time. With the reset it is always 145.
50%100%150%
“set size to” can use any number. Size 100 is the normal size. Size 50 makes the sprite half as big. Size 150 makes it one and a half times as big.
whenclickedgo to x:0y:0set size to100%wait1secondschange size by15change size by15change size by15
Put the resets straight after the hat block. Then the action blocks follow. The wait lets us see the start before the sprite starts to grow.
Class activity

Paper program (with a friend): use a sheet of paper for a score pad. The sprite starts at size 100. Read the program “change size by 20, change size by 20” and write the size after each click, with no reset: 140, 180, 220. Then add the card “set size to 100” at the start and run it again. What is the size after each click now?

Practice
1
A sprite starts at size 100. The program adds 5 four times. It is run 3 times with no reset. What size is the sprite at the end?
whenclickedchange size by5change size by5change size by5change size by5
2
Now the block “set size to (100) %” is added after the hat block. What size is the sprite after 3 clicks?
whenclickedset size to100%change size by5change size by5change size by5change size by5
3
The sprite must always finish at size 75. Which block goes in the empty slot so that it works every time?
whenclicked?change size by-25wait1seconds
4
What is the difference between “change size by (10)” and “set size to (10) %”?