More about Scratch
Chapter 7
Scratch
• Interactive graphic based programming language.
• A Scratch project is primarily a program file that contains blocks
known as Scripts.
• These projects are saved with the extension *.sb2
Types of Blocks
Based on the uses, there are 6 types of Scratch blocks.
• Hat blocks
• Cap blocks
• Stack blocks
• Reporter blocks
• Conditional blocks
• Looping blocks
Hat block
• The block that shows the beginning of the script.
• They are shaped like a hat.
• Therefore, no block can be placed on top of it.
• All the Hat blocks are present either in Control blocks, Events blocks
or More blocks.
Cap Blocks
• Blocks that are used to stop the execution of a script or a
project.
• No block can be added beneath them.
Stack Blocks
• Blocks comes with a notch on the top and the bottom.
• Therefore, can be kept one over another.
Reporter Blocks
• Reports value.
• Used whenever a script needs a certain value.
• The value can be a number or a string.
• It can also in the form of numbers or values from the drop-
downs.
Conditional Blocks
• This block used whenever the flow of execution needs
to be changed based on a condition.
• Any label that says ‘if’ , ‘when’ or ‘until’, it’s a
conditional block.
Looping Blocks
• Blocks that can be used to repeat a set of blocks N number of times
based on a condition.
• Any label that begins with ‘forever’ or ‘repeat’ is a looping block.
Repeat block
• Used to repeat the blocks within the loop specified number of times.
Forever block
• Used to repeat the blocks within it repeatedly.
• Primarily used in creating games.
Block Categories.
Blocks can be categorised into various types.
• Control blocks
• Sensing blocks
• Variable blocks
Control blocks
• Used to control the execution of the script.
• Golden in colour.
• There are 11 control blocks.
Hat Block Control Block
Stack Block Cap Block
Using Scratch Blocks
Move block
Motion block
• Instructions related to the movement of the Sprite are here
Show a moving Sprite
Open Scratch Motion block Select
Can increase or decrease this number.
Negative number – Makes the Sprite to move to the opposite direction.
Turn Block
Used to give Sprite direction which can be clockwise or anticlockwise.
Motion block select
• This will rotate the Sprite 15 degrees to the right.
Motion block select
• This will rotate the Sprite 15 degrees to the left.
• Negative number – will rotate the Sprite in the opposite direction.
How to make a Sprite dance
Repeat
Block
• Repeat a block specified number of times.
• Available in the Control block.
Say block
• To make a Sprite say a word or a sentence.
• They are purple colour blocks under Looks block.
• Allows the Sprite to display a message in a voice bubble
Say block
• To make a Sprite say a word or a sentence.
• They are purple colour blocks under Looks block.
• Allows the Sprite to display a message in a voice bubble
How to make a Sprite speak
Change colour effect by block
• Looks block can also be used to change colour effects of the Sprite.
Changing the backdrop of the Stage
• New backdrop icons are used to change the background of the stage.
• Can create are own backdrop or choose any backdrop from the
available options.
• Four different ways to do this.
1. Choose background from Library
2. Paint New Backgrounds
3. Upload background from file
4. New backdrop from Camera
Choose background from Library
• You can choose backdrop from the displayed list click Ok
Paint New Backgrounds
• In backdrop window editor can draw your own backdrop
Upload Background from file
• Select the desired backdrop and click on the open button. It will upload to
your backdrop
New backdrop from Camera
• Allows to click a picture from your builtin camera and use it as backdrop.
How to use the costumes tab
• The appearance of the Sprite can be changed.
• Looks block can be used.
Costumes tab New costumes options are displayed
Choose options from library Select the costume category
Select the costume Click ok
• You can also change the appearance of the Sprite by
paint new costume, upload costume from file, new costume from
camera ( available in costume options)
Deleting a Costume
Costume block Select the costume to be deleted
Right click on the mouse Select Delete option