Scratch Programming: Scratch Is A Programming Language That Makes It Easy To Create

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Scratch Programming

INTRODUCTION

Scratch is a programming language that makes it easy to create


interactive art, stories, simulations, and games and share those
creations online. It allows children to learn coding concepts and create
interactive projects without learning a text based programming
language.

Scratch can be downloaded for free from the following website:


https://scratch.mit.edu

CONCEPTS OF SCRATCH

Scratch works on three main concepts:

1. Sprite:They are the objects that perform actions in a Scratch Project. The default sprite
is the cat (Mascot)

2. Stage:The stage is the background where all the action takes place. The stage is also
known as Canvas.

3. Script: Scripts are the set of program blocks written to apply effects on the sprite.

Each Sprite has its own set of scripts to control its behavior and how it interacts with the other sprites and ev
GETTING STARTED WITH SCRATCH

1. Click on start button

2.Choose all Program option

3.Choose Scratch option

4.Choose Scratch sub-option

INTERFACE ELEMENTS OF SCRATCH

Menu: It is available at the top of the scratch interface.

Block description: Block looks like a puzzle piece shape that is


used to create codes. These blocks are dragged on the script area to
connect each other in the form of a script. Each block has different
shape. There are 10 categories of blocks namely

1. Motion
2. Looks
3. Sound
4. Pen
5. Data
6. Events
7. Control
8. Sensing
9. Operations
10. More blocks or user created blocks

Flags: Flags are used to execute the scripts. The green flag starts the execution whereas the red
flag stops the execution.
Blocks Palette:

It is an area of the graphical user interface located between the stage, sprite pane and scripting
area. Blocks palette display the list of blocks available under that specific category.

Control Block Motion Block Looks Block


Scripts Area: The area on the right side of the project editor where scripts are assembled is
called script area. Blocks from the block palette are dragged into the script area so the script area
displays a stack of blocks connected to each other.

Sprite List: It displays thumbnail for all sprites in a project. The name of each sprite
appears below its thumbnail.

Tabs: Scratch provides three tabs to write a


script for the sprite and add various effects to it.

Sprite Buttons

Sprite buttons are displayed below the stage. There are many built in sprites in Scratch. The
default sprite is Cat (muscat). Following options are available on sprite buttons.

1. Choose new sprite from Library: This button helps in selecting an existing
sprite from scratch

2. Paint new sprite: This button helps to create a new sprite.

3. Upload sprite from file: This button helps to upload a new sprite from file

4. New sprite from camera:This button is used to generate a random sprite on the
stage.
Changing Sprites

Sprites can be changed in four ways in scratch:

1. Loading sprite from the library


2. Loading from a file
3. Painting a sprite
4. Clicking from camera

Loading a Sprite from library:

The steps to load sprite from library are:

1. Click at icon in sprite list below stage


2. Choose the desired sprite from the library and click at it.
3. Click on OK button.

The selected sprite will be placed on the stage.

Loading a Sprite from a file:

1. Click at icon in sprite list below stage.


2. Select a file to upload dialog box appear.Choose the file to upload.
3. Click at open button.

Painting a Sprite:

1. Click at icon in sprite list below stage.


2. Pont the sprite using point tools given.
3. You can delete the old sprite by right clicking at old sprite and choosing the delete
option.
4. Select the painted sprite.

Clicking from Camera:

You can click a photo with a web camera icon to use it as your sprite.

1. Click on camera icon from sprite list.


2. When you see your desired photo, click save it to use it.

Size of sprite can be changed through programming blocks available in Looks category.
CREATING A NEW PROJECT

To create a new Project follow the following


steps:

1. Click on file menu


2. Click on new option

MENU OPTIONS

 New Option: Creates a new project from a


blank template.
 Save Option: Saves the current project.
 Save as a Copy Option: Creates a copy
of the current project.
 Record Project video: The option will
record the project video.
 Share to website: It allows you to share a project.

Example No 1: Write a Scratch program to draw


an Octagon

1. Drag the hat block from event block category

written ‘when clicked’.


2. Drag the clear block from pen category.
3. Drag the pen down block from the pen category.
4. Drag the repeat block from control block category and
change the value as repeat 8.
5. Inside the repeat block, drag mouse 90 steps
block from motion block category.
6. Also drag turn 45 degree block next to move block
inside repeat block from the motion block category.

Working With Different Block Categories:

Blocks are used for creating scripts. Let us understand, how scrips are created in scratch
using blocks.

For writing scripts, select the scripts tab from script area. Now drag the blocks from block
palette of a specific block category and place it in the script area.
Using Motion Block:

Example: Rotate sprite by 30o

Procedure:

1. Click the Motion Tab.

2. Drag the block to the script area


From the blocks palette.
3. Change the value 15 to 30 in the reporter block.

4. Click the block to see the effect On


the stage. The sprite moves 30 degrees, clockwise.

Using Looks Block:

Example: Change the color of the sprite.

Procedure:

1. Click the Looks Tab.

2. Drag the block to the script area


from the blocks palette.
3. Click the block to view the change of color in sprite.

Using Sound Block:

Example: Play the sound of the cat ‘Meaw’ by the sprite.

Procedure:

1. Click on the Sound Tab


2. Drag the block to the script area from the block palette.
3. Click the block and you will hear the sound of the cat.
Using Control Block:

Example: Draw a line with pen after the user wait for 5 seconds.

Procedure:

1. Click on the Control Tab.

2. Drag the block to the script area from the block


palette. Change value 1 to 5.

3. Drag the block from pen block in the script area.


4. Drag the block from motion tab in the script area.
5. Click on the first block to execute the script.

Using Event Block:

Example: Moving sprite 10 steps when (flag) clicked.

Procedure:

1. Click on the events Tab.

2. Drag the block to the script area from the block


palette.
3. Drag the block from motion tab block in the script
area.
4. Click the flagicon to see the effect.The action takes place when the flag is
clicked.

Example: Draw a circle using pen in scratch.

Procedure:

1. Click event tab and drag the block when flagclicked in the
script area.
2. Click the pen tab and drag the block clear and then pen down
block.
3. Click the control tab and drag the block repeat in script area.
4. Change the value in repeat block to 360 degrees.
5. Click the motion tab and drag the block move (1) steps and turn
(1) degrees, the sprite displays a circle.
Practice Session:

1. Fill in the blanks:


a. is the background where all actions takes place.
b. Scratch is a programming language.
c. creates a new project from a blank template.
d. option records the project video.
e. are the objects that perform actions in a scratch project.

2. Multiple Choice Questions:

i. How many degrees are there in a circle?


a. 180 b.90 c.360 d.240
ii. Which category block is used to create your own blocks
a. Pen b.Event c.Data d.More Blocks
iii. Stage in a scratch is a
a. Script b.Screw c.Block d.Sprite
iv. Projects are made up of objects called
a. Food b.Sound c.Data d.Sprite
v. Sprites move and perform actions on the
a. Block Palette b.Background c.Script area d.Script
3. Answer the following questions:
1. Write the steps to start scratch.

2. Write the steps to load sprite from library.


3. Name any five categories of blocks used in scratch.

4. Write the procedure to rotate the sprite by 40o

5. Name the four sprite buttons.

6. What is difference between sprite and script?

7. Define the following terms.


Script Area:

Tab:

Sprite List:

You might also like