09Apr
2019
0
Coding for kids: drawing shapes using loops in Scratch

Coding for kids: drawing shapes using loops in SCRATCH

Coding for kids: drawing shapes using loops in SCRATCH is our third post in the series of projects designed specifically for primary school students and coding educators with little or no coding experience.

 

Today let’s learn how to add a new sprite and use loops to make the program repeat things over and over.

Adding another sprite

Scratch has many other sprites than a cat that you can use in your projects. You can even draw your own sprites!

 

Coding for kids: drawing shapes using loops in Scratch 1

 

To add a new sprite to your project, you can click on one of the options by the words “New Sprite:” in the Sprites area of the screen.

Clicking the Paint new sprite icon opens up the Scratch drawing editor where you can draw anything you want. You can also make text sprites.

Coding for kids: drawing shapes using loops in Scratch 2

 

Click on the icon for Choose sprite from library allows you to choose a sprite from a list.

We chose Beetle sprite from the library.

Drawing shapes using loops

A loop is a way of making your program to do something repetitive.

Remember we learned how to draw a square and you needed to write a program like this:

Scratch: draw shapes 3

You may already noticed a pattern of “Move” and “Turn” blocks: the program takes 8 separate instructions (code blocks), some of them repeat themselves. You can optimize this square drawing program with a loop. A loop makes programming much easier, you just need 3 instructions but repeated 4 times.

Click on the Scripts tab in the centre of the Scratch screen and choose the Control group.  Drag a Repeat block onto the script area on the right.

Coding for kids: drawing shapes using loops in Scratch 4

Change the number of loops to repeat to 4 because a square has 4 sides and 4 angles. Click on the Motion group and drag a Move and a Turn blocks under the Repeat block. Don’t forget to change the number of steps and the degrees of turn to 90.  Drag a Pen down block from the Pen group on the top.

Coding for kids: drawing shapes using loops in Scratch 5

Click on any block to run your program and watch your Beetle sprite to draw a square.

Don’t forget to save your work by clicking the File menu at the top of the page on the left.

Coding for kids: drawing shapes using loops in Scratch 6

Practicing loops

Challenge 1

Change the number of loops to repeat to 20 and see what happens.

Challenge 2

How about drawing a hexagon? A hexagon has 6 sides and 6 angles of 120°. Remember that Scratch uses the measurement of the exterior angles, meaning that you need to use “Turn” block with 60° value for an individual angle of a hexagon. Here is how your program will look like.

Coding for kids: drawing shapes using loops in Scratch 7