Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
35 views20 pages

Class 5 Computer CH 7 An Introduction To Scratch

comp ch 7

Uploaded by

pravin.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views20 pages

Class 5 Computer CH 7 An Introduction To Scratch

comp ch 7

Uploaded by

pravin.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

7 An Introduction to Scratch

.. LET'S LEARN ABOUT ...


We love cartoons! Don't we?
You love seeing them animate Features of Scratch
and do funny activities. Starting Scratch
Do you know how they Parts of the Scratch Window
are animated? It is done
Working with a Script
by using a programming
Using Blocks in Scratch
language. Scratch is one
such programming language Saving a Project
that helps to develop Opening aSaved Project
cartoons and games. In this A Closing Scratch
chapter, you will learn about
Scratch 3.0 in detail.

You are given a task in class to find the perimeter of arectangle. You
plan the following steps to complete it.
1. Write the formula to calculate the perimeter as P = 2 x(L + B).
2 Put values of length (L = 7) and breadth (B = 5) into the formula.
3. Calculate the perimeter (P), and you get the result as P= 24.
Tou have solved the problem by breaking it down into simple steps.
This step-by-step
method of solving a problem is called an algorithm.
Now, imagine yourself as aa computer. You (the computer) are given
these instructions in alanguage
language that you understand. You will follow
these
instructions one by one to calculate the perimeter. The instructions
en to you are collectively called a program. Just as this algorithm
105
is written in the English language, computer prgrams are written in a
computer programming language that a computer understands.
The step-by-step instructions given to the computer using a
programming language to perform a task is called programming.

FEATURES OF SCRATCH
Ihere are many computer programming languages that can be used
to give instructions to acomputer. Scratch is an example of one such
programming language with the following facts and features:
Scratch is avisual programming language that was created for
children to understand the basics of computer programming.
It was first launched as a desktop application in 2007 by the Lifelong
Kindergarten Group at Massachusetts Institute of Technology (MIT)
Media Lab.
AVA'S COOL TIP
It is easy to learn and You can download the free
use.
Scratch app from the given link.
It can be accessed https://scratch.mit.edu/download
online as a tool or can
be downloaded for free.
It can be used to create games, digital stories, animations, and so on.
It is compatible with the Windows,
macOS, and Linux operating systems. Seratch 3

ScratchJr-Open Source Commun...

O Settings

STARTING SCRATCH Skype

S Siype for Business


Snip &Sketch
To start Scratch, follow these steps. Scltaire Collection
Sticky Notes
1. Click on the Start button.
2. Click on Scratch 3. TightVNC

Tips

The Scratch window appears on the O Type here to search

Screen (Fig. 7.2). 4 Fig. 7.1 Starting Scratch


106
AVA'S COOL TIP
You can also open Scratch by double-clicking
on the Scratch 3 shortcut icon on the desktop.

PARTS OF THE SCRATCH WINDOW


To Scratch windovw has many parts, such as a Sprite, Stage, Blocks
palette,
Code or Script area, and so on.
Menu bar Green flag button Red stop button
uris Sh Pt

Cotasos eSond
Co

Mtion

Blocks
menu Sprite
Blocks
palette
snang Stage
Code/Script
Area Sprite
pane
Sprite list

Fig. 7.2 The Scratch window


Sprite: A Sprite is a small cartoon character present on the stage
of the Scratch window. Scratch has many built-in Sprites which
you can add or remove from a project. It is used to perform all
the actions in aScratch program. The default Sprite in Scratch is
the cat.

Stage: The white area on which a Sprite is seen is called stage.


The Sprite moves and performs all the actions on the stage. The
Stage is the area where you see the result.
107
Blocks Menu: It lists the different categories of blocks. Each blocl.
category is colour-coded with a specific colour. This helps you
identify the block menu easily.
Blocks Palette: These are the puzzle pieces used to create project
It contains a set of blocks that are used to program a Sprite. There
are different blocks for each block menu.

Menu Bar: It is the topmost bar of the Scratch window. It includes


the options to save, open, and edit a project.
Green Flag Button: It is the button which when clicked, runs the
scripts in the project.
Red Stop Button: It is the button which when clicked, stops the
running project immediately.
Script: Ascript is formed when two or more blocks are joined to
perform a task. Ascript is placed on the script area.
Code or Script Area: When the blocks are dragged from their
category, they are dropped in the Script area. It is the place where
ascript is created to program a Sprite.

WORKING WITH A SCRIPT

Ascript is also called a program. Let us learn how to create and run
ascript.

Creating a Script
Before you start creating projects in Scratch, it is important to learn how
to drag and drop blocks in the script area.
In Fiqure 7.3, the blocks are dragged and dropped in the script area and
further joined to create a script. When you drag a block from the blocks
palette, do not leave the mouse button till you drop it in the script
area. When you join two blocks together, a shadow appears. This is to
help you place the blocks at the correct position.
108
rtch 129.t

Ttoriats
Serstch Projt File Edit Tutoriats Serateh Proeed
4 Sounds
Costumes 4 Sounds
Costames

Meto
Motion

Motion
move 10 sepa
Loors Moe t10 opa
1s dogrees torr 15 degrees
C o e s
Seune

S15 degrees
Events

b
+ Fig. 7.3 Dragging and dropping blocks

Rearranging a Script
Once
thescript is created, you can move it anywhere on the script area.
To move
the stack of blocks, click on the first block and drag the script
place it.
where you want to
To delete the block or the entire script, right-click on it and choose the
pelete Block option (Fig. 7.4). Similarly, you move 100 steps
the
can create aduplicate of the block on turn 60 degre

script area. You can also split the script into


Duplicate
Add Comment
Dokate Block

parts by clicking and dragging any block or


+Fig. 7.4 Rearranging a script
set of blocks from it.

Running a Script
Click on any block of the script to run it. To execute the script multiple
times you need to click on the blocks again and again.

LET'S REVIEW
Write T for True and F for False.
.Scratch is aprogramming language created for children.
2. The white
area on which a Sprite is seen is called stage.
When red stop button clicked, it will run the scripts in the project.
The default Sprite in Scratch is the cat.
5. You cannot remove all the scripts from the script area.

109
USING BLOCKS IN SCRATCH
All the blocks in the Scratch window have aunique purpose. The blocks
are joined together to make aproject. Let us make some projects in
Scratch using different blocks.

Project 1: Moving a Sprite


ASprite can easily move, turn, change position, and rotate on the stage.
The Motion block menu contains blocks that make a Sprite do various
movements on the stage. All the blocks in this menuare medium-blue
in colour. Some commonly used blocks from the Motion block menu are
listed in the table below.

Table 7.1 Motion blocks


Block Description
This block moves a Sprite ten steps forward. You can change
move 10 steps
the number of steps by typing inside the white-editable
field of the block.
This block can be used to turn aSprite by some degrees
turn 15 degrees
in the clockwise direction. The Motion block menu also
has another block that can be used to turn a Sprite in the
anticlockwise direction.

if on edge, bounce
This block bounces back the Sprite if, while moving, the
Sprite touches the edge of the stage.
Let us create a Scratch project using the blocks from the Motion block
menu.

1. Open Scratch window. The Sprite appears on the stage.


2. The Motion block menu list is already open. Click on the blocks from
the list and place it one after the other as shown in Figure 7.5.
3. You can change the value inside the blocks. Click inside the
white-editable field of the block, and type the number you want
to enter. The block wilautomatically update the numbe.
(110
have created a script to program the Sprite. To run the
Now, you
4 click on any block in the script that you have created.
script

the script multiple times, you need to click on the script


Torun
again
and again. Observe that the Sprite moves in circular motion.
Soh L

oratsSca

Castues

Moion

10

move 100 steps

turm 60 degrees
b npon

+Fig. 7.5 Moving a Sprite

Project 2: Drawing with the Sprite


The blocks from the Pen block menu allow a Sprite to draw as it moves
on the stage. As the name of the menu Suggests, these blocks add a
pen to the Sprite in a project. All the blockS are dark-green in colour.
These blocks can be combined with other blocks to draw colourful
figures on the stage. The blocks can increase or decrease the size of the
pen, change the colour and shade of the pen, clear the drawing from
ne stage, and so on. Some common blocks in the Pen block menu are
listed in Table 7.2.
Table 7.2 Pen blocks

Block Description
pen down This block adds a pen to the Sprite. As the Sprite
moves on the stage, it dravws a line along with it.
sel pen size to 1 This block sets the thickness of the pen to aspecitic
number. Greater number equals to greater thickness.
111)
Block Description
change pen color v by 10
This block changes the colour of the pen by a
specified amount.
Let us create a project in Scratch using the blocks from the Pen
block menu.
1. Open a newproject in Scratch by clicking on the File menu and
selecting the New option.
2. Click on Add Extension present on bottom-left corner of the
Scratch window. The Choose an Extension window appears (Fig. 7.6).
DScratch 329.1
X

Back Choose an Extension

Music Pen Video Sensing


Play instruments and drums Draw with your spr1tes Sense motion with the camera.

Text to Speech Translate Makey Makey


Make your projects tak Translate text into many languages Make anything into a key
Requires Collaboration wth Requires Collaboratian wth Collabor aton ith
Amazon Web Services Google JoyLabz

4Fig. 7.6 Choose an Extension window


3. Click on the Pen block menu.
4. The Pen block gets added to the Blocks menu. Drag and drop the
blocks to create a script similar to Figure 7.7. You can change the
white-editable fields of the blocks.
5 Keep clicking on the script till the Sprite draws with its pen as it
moves all over the stage.
Cese

movo 30 sleps
um2 125 degrees

pen down

set pen sze to 5


rr
O a n d u n poston Change on color
by 10

mOve 30 stens

bm125 deqrees
Ton edoe bounce

set rotation style loll-nght

Fig. 7.7 Drawing with the Sprite

Project 3: Making a Copy of a Sprite


The Stamp block in the Pen block menu creates a duplicate copy of the
Sorite present on the stage. lo create a copy of a Sprite, follow these steps:
1. Open a new project in Scratch.
2. Carefully drag and drop the blocks in the script area.
3. Change the white-editable fields of the blocks.
4. Now, cick on the script multiple times to run it. The Sprite creates
a copy of itself every time you run the script.
Tutorials Scrtch Prolect

JCostues

movo 100seps

stamp

pen down

Change pen color by


Cge kby
ton edge bounce

Fig. 7.8 Creating a duplicate copy of aSprite


113
Project 4: Controlling a Script
The blocks in the Control block menu are used to control the execution
of ascript. The blocks from the Control block menu can be used to
insert a pause in-between a script.
repeat the blocks in a script.
run ascript without a pause.
Let us use the Control blocks in ascript and see how it works.
1. Click on the Control block menu. Drag the forever block from the
blocks palette and place it on the script area.
2. Now, click on the Motion block menu to open the list. Drag and
drop the blocks as shown in Figure 7.9 on the script area one by
one. Place the blocks inside the forever block. It will allow the
Script to run without any pause.
3. Now, click on the Looks block menu to open the list and drag
and drop the block as shown in Figure 7.9.
4. Edit the white-editable field of the blocks. Click on the script to
execute it. Now move the mouse anywhere on the stage. The
Sprite moves and rolls with the mouse and changes its colour.
To stop the script from running, just click on it once.
Bsutch L291

Fle Tutorials Scratch Project

Code Cosunes 4 Sounds

Looks

Iorever

movo 20 sleps

furn 15 degrees

ifon edge, bounce

dhango xby 10

chango yby
MyEes baap
gotoouse pointer

dange ly 1 change color etfoct by 10

h°¡c e d

+Fig. 7.9 Controlling a script


Observe
that.a bright light appears over the script when it runs
Note:
withouta pause.

INFO BOX
AVA'S COOL TIP
can use
the Looks blocks menu to
You

:change
the appearance of the Sprite. The red stop button
purple- -coloured blocks change located at the upper-left
These
colour of the Sprite, increase its size, corner of the stage is
the
from the stage, and so on. It also used to stop the script
:hide it
that display text on the stage. while executing.
has blocks

o<< AVAS PRACTICE TIME


O Logical Thinking
NEP
Make a project in Scratch using the waitwait 5 sec block from the Control
block menu.
Steps:
The Control block menu has the wait wait Bsocs block that is used to give
apause in-between a script.
The Looks block menu has blocks that change the appearance of a Sprite.
The sprites can have multiple appearances or looks. These appearances
are called the costumes of a Sprite. The next costume next costume block
IS used to change the costume of a Sprite. You can check the number of
COstumes of a Sprite by
clicking on the Costumes
tat The default
Sprite has two different
COstumes. Let us use both Ion odye, toue

the blocks discussed


here set pea sine t

to make a project
the Sprite walks where hang pen c

draws on the and


stage.
(115
Project 5: Adding Sound to a Project
The pink-coloured blocks are from the Sound blocks palette. These hl
are used to add sound effects to a project. You can alsO choose and da
any sound available in the Scratch library. Apart from the available sound
effects, you can also record and upload a new sOund in your project.
Let us add the 'Meow' sound in a Scratch project using the Sound
blocks menu.
1. Drag the blocks from the respective blocks palette and place
them on the script area as shown in Figure 7.10.
2. Click on the script to execute it. The "meow" sound plays in
the background as the script runs.
Sgth 1231

Soh Pujct

Coo
CosAses Sounde

Sound

move 20

15 degrees

pen down

set pen sze to 10

change pen color 10

play sound MeoWuntl done Serilet


1y

Fveuts

4Fig. 7.10 Adding sound to ascript


Let us create aScratch project to add any Sound available in the
Scratch library.
1. Click on the Sounds tab.
2. Upon hovering the mouse on the Choose
a Sound section, a pop-up appearS. Choose a Sound

Here you will find four buttons-Choose


aSound, Record, Surprise, and Upload 4Fig. 7.11 Choose a
Sound respectively (Fig. 7.11). Sound option
116
3. CClick on the Choose a Sound button. The Choose a Sound
window appears (Fig. 7.12).

Choose a Sound
Back

Animals Etects Loops Notes Percussion Space Sports Volce Wacky

) D)
AElec Bass AElec Gutar AElec Piano AGudar
A Bass AMinor UK APiano

)
A Trombone ATrumpel Afro Sting Alert Ahen Creak1
ASax Alen Creak2

) D)
BBass BElec Bass BElec Guitar BElec Pano B Guitar B Piano BSax

Fig. 7.12 Choose a Sound window

4. Select any one option, and cick on it. The new sound gets
added to the list (Fig. 7.13).
O Seratch 3A1 X

Tetorials Scpatchi Prolect

Costes Sound8

AElec Guar
Cogy Cogy to Nes

ACre Qua

4
Saten Fade in Fade eut Reverse

Sackdn

Spnte

4Fig. 7.13 The new sound added


117
SAVING A PROJECT
To save a Scratch project, follow these steps.
1. Click on the File tab and select the
Save to your computer option Bsutch 329.1

Fde Edn Tutoriats


(Fig. 7.14). The Save As dialog box Coda
Sgtch Proet

appears (Fig. 7.15). Votio


Cdreco
Load hom your conputer

Save to your computer


Looks

2. Type aname in the File name box LGcks

and click on Save button. Fig. 7.14 Saving a project


Save As

« Documents > Scratch 3 Prosects


Search Scratch 3Proiects
Organize - New folder

Narme
This PC Date modified ype
3D Objects No items match vour search
Desktop
Documents
Downloads
Musác
INFO BOX
F Ptues

Videos All the files in Scratch 3.0


Local Dsk (C)
Network are saved with the .sb3
Fle nameScratch Proiet
extension.
Save as type Scrath 3 Project

a Hide Folders
Cancel

+ Fig. 7.15 The Save As dialog box

OPENING A SAVED PROJECT


To open aproject saved in Scratch, follow these steps.
1. Click on the File tab.
2. Click on the Load from your computer option.

OSratch 329.1

File Edil Tutorials Scratch Project


New
Code

drecior Load trom yourconputer


Moton
Save to your computer
Looks
LogKs

+Fig. 7.16 Opening a saved project


118
Select
the desired project from the Open dialog box and click on
3 the Open button.

O Open

A « Documents > Scratch 3Projects o Search Scratch 3Projects

New folder
Organize

Scratch 3 Projects Name Date modified ype

AOneDrive - Personal
OMyProject 1 7/13/2022 1014 PM S83 File
OMy Project2 7/13/2022 1015 PMM SB3 Fle
This PC

3D Objects
EDesktop

Documents
Downloads

Muskc
E Pictures

Videos
Local Disk (C)

File name My Projet 2 Custor; Files

Open Cancel

+Fig. 7.17The Open dialog box

CLOSING SCRATCH

After aproject is completed, you need to click on the Close buttonX


located on the upper-right corner of the Scratch window.

o« FLASHBACK
* Scratch is avisual programming larnguage created for children to
understand the basics of computer programming.
* ASprite is a small cartoon character present on the stage of the
Scratch window.
3 The default Sprite in Scratch is the cat.
Ihe Motion block menu contains blocks that makes a Sprite do various
movements on the stage.
*Ine blocks from the Pen block menu allow a Sprite to draw as it
moves on the stage.
119
The blocks in the Looks blocks menu are used to change the
appearance
of the Sprite.
The blocks in the Control block menu are used to control the
execution
of a script.
The blocks in the Sound block menu are used to add sound effects in
aproject.

EXERCISES
A. Tick (/) the correct answers.
1. Which of the following is the file extension of
a Scratch 3.0 project?
a. sb2 b. sbp C. sb3
2. Which of the following is the default Sprite in
Scratch?
a. Dog b. Pen C. Cat
3. Which of the following blocks creates the
duplicate copy of a Sprite?
a. Pen Down b. Stamp C. Forever
4. Which is the correct colour for the blocks in
the Motion block menu?
a. Medium-blue b. Green
C. Purple
5. Which of the following block menus allow a
Sprite to draw as it
moves on the stage?
Motion b. Control C. Pen

B. Fill in the blanks.

qreen visual Looks costumes stage

1. Scratch is a programming language.


2. The white area on which a Sprite is seen is called
120
blocks in the Pen block menu are in colour.
Allthe
3
The
blocks menu allows you to change the
4
appearance of the Sprite.
appearances of a Sprite are called the
5. The

Write T for True and Ffor False.


C
Sprite cannot rotate on the stage.
1. The
2.
The values of the coordinates Xand y are visible in
the Sprite pane.
The pink-coloured blocks are from the Looks block menu.
3.
A The blocks in the Control menu are used to control
the execution of a script.
s The Close button is located at the upper-right corner
of the Scratch windovw.

D. Answer the following questions.


1. What is a Sprite in Scratch?

2. Briefly explain the process of creating ascript in Scratch.

O Explain the purpose of the Motion block menu.

121
30
4. Explain the use of the dark-green coloured blocks in Scratch

5. Write the steps to open a saved project in Scratch 3.0.

AVA'S ACTIVITY ZONE


Experiential Learning,
Logical Thinking NEP
A. Create the following scripts in Scratch and run them.
1. 2.
erase al
orever

pen dowr

tun 20 dogyoes move 50 stops


set rotalion stye al auound tun 50 degoos
ova
Don duwn

mo 10 slops
change pen color 20
on edgo, bomce
sel pen size lo 10
change pencolor by 1

3. 4
foevor

turn 5 degreos Wa 001 scovs

move 100
Inove 10 sleps

f on edge. tounce
tum 100 degrues

pen down
Don down

change pen color by 35


change pen color by 10
sot pen sre to 5
tun 15 dogiees

122
Write the scripts in Scratch to generate the following output.
B
2.
1.

Lab Activity o Technical Skills,


Critical Thinking NEP
Onen Scratch and create the script given below. Run the script and see
that the Sprite draws a colourful circle on the stage.
X
BSeratch 329.1

File Edit Tutorias Scratch Prolect

d Sounds

Pen

erase al

Looks

oreMer

move 20 steps

tum 15 degrees
sel pen color to
pen down
Jperso
Garge pen color 10

set pen size to 10


sel pen color
Change pen color by 20
Sncite Sorite 81
dange pen ceby1
Shca

et pen s le
Baosgu

Sore

Now, use other blocks to draw atriangle, square and rectangle on


the stage.

Group Discussion (ritical Thinking,


Communication NEP
Conduct group discussion on the following topics:
You can draw
anything on the stage in a Scratch project.
123
DiscusSs about the blocks that are commonly used to move a Sprito
on the stage.

Self-Reflection

Tick () in the appropriate column.


Terms lgot it! L Ineed help!
Understanding the features of Scratch 3.0
Knowing the parts of the Scratch window
Creating, rearranging, and running a script
Using Motion, Pen, Control, and Sound
blocks in Scratch
Saving a project
Opening a saved project

124

You might also like