SCRATCH: DRAWING A RECTANGLE
We are going to create a program in Scratch to draw rectangles.
Before starting with Scratch, we need to think what do we need in order to create or define a
rectangle. So, draw a flowchart where a way to draw a rectangle is described.
The flow chart describes an algorithm in a graphic form. We can use this algorithm to create the
program in Scratch.
Scratch
Sprite:
• Remove the beginning sprite
• Choose a new sprite by clicking here →
• Choose the pencil
• Go to the Costumes tab, select
the pencil and place the end of
the pencil in the circle which
mark the centre of the sprite
Code:
• As you may have guessed, we will need two variables (base,
height). So, create them in the variable section.
• The first block you have to use is “When green
flag clicked”. It defines the moment when a part
of code will be executed
• Place the pencil in the starting position
• Use the block “say..” to tell the user what the
program is going to do
• To get the data from a user you will need the
block “ask… and wait”
• And you will be able to use the block “answer”
to define the value of the base and then the height
• You already have all the necessary data to draw a rectangle. Now we need to activate an
extension in Scratch:
◦ Click on “add extension” and select the one with the pen
• To use the pen you have to use the block “pen down” and when you want to stop drawing
you have to use the block “pen up”.
◦ So, first you will need the “pen down” block
◦ Then, the pencil has to move to a new position using
the block “glide”
◦ Use this block 4 times to move to the four vertices
• Try your program so you are sure it is correct.
• When you finish the program take a screenshot of the code and stage.
• Copy the screenshots in a Writer document and save it as:
Surname_Name_Scratch1