ITC LAB 6 - Scratch + Algorithms
ITC LAB 6 - Scratch + Algorithms
LAB # 6
Introduction to Block Based Programming and Algorithm
Objectives:
To learn the logic building in programming
To learn how computer follow instructions
To write an algorithm before programming
Block-based-programming:
Introduction to Scratch:
Scratch is a visual programming language that allows students to create their own interactive stories,
games and animations. As students design Scratch projects, they learn to think creatively, reason
systematically, and work collaboratively. Scratch was created by the Lifelong Kindergarten group at
MIT Media lab and is available for free download at https://scratch.mit.edu. Once Scratch is
downloaded to a computer, you do not need Internet access to create a project.
1
Introduction to Computing LAB 6: Block based Programming and Algorithm
From main screen you can create new projects, explore other people's projects, catch up on what your
friends have been doing, and access your own projects.
Create New Project:
Every time you create something in Scratch, you'll be working on a project. You can create as many
projects as you like, share them and copy them. Each project stands alone and can't be linked to other
projects.
Scripts:
Scripts are what make your assets do stuff in Scratch. They consist of blocks of code that you drag into
position on the canvas, and come under ten categories:
1. Motion: scripts that position your sprites and make them move.
2. Looks: scripts that change the way your sprites look, including changing their costume and
hiding them.
3. Sound: scripts to play sounds and change the volume.
4. Events: these make things happen, and include the start flag being clicked, the user clicking on
a sprite or a broadcast which you can create and have your sprites react to.
2
Introduction to Computing LAB 6: Block based Programming and Algorithm
What is Motion
When we say that something is in motion, we usually mean that it is moving. But motion has a special
meaning in science. In science, motion is a change in position compared to a place or an object that is
not moving. The place or object that is not moving is called the frame of reference.
3
Introduction to Computing LAB 6: Block based Programming and Algorithm
Now we are going to create a little story with two sprites with using looks block.
Steps:
Add 2 Sprites, Cat and Butterfly.
Then code cat with these set of blocks.
The Wait block pauses the script for the specified amount of seconds.
4
Introduction to Computing LAB 6: Block based Programming and Algorithm
- Click the image you want to choose, and then click the
OK button.
- Your backdrop is added to the Stage, behind the cat, and
the Paint Editor opens on the right so you can edit the
background if you want to.
Backdrop Library
What is Algorithm?
The word algorithm derives from the name of the mathematician, Mohammed ibn-Musa al-
Khwarizmi, who was part of the royal court in Baghdad and who lived from about 780 to 850. Al-
Khwarizmi's work is the likely source for the word algebra as well.
An algorithm is a set of well-defined instructions in sequence to solve a problem.
Algorithms can be widely used in various areas, computer programming, mathematics and daily lives.
STEPS:
1: Drag when flag clicked block from Events into the script area.
2: Then go to the Sensing block and select the ask name and wait block and arrange it right below the
when flag clicked block.
3: Then go to the Looks section which is the purple section and drag the say Hello for 2 seconds and
arrange it right below.
4: Now insert join block from Operators block into the say hello block on hello column.
5: Then go again to the Sensing block and select the answer block and insert into the banana section
and write Hello in the apple section.
5
Introduction to Computing LAB 6: Block based Programming and Algorithm
When we type answer in text box, it will join your answer with Hello… like this,
6
Introduction to Computing LAB 6: Block based Programming and Algorithm
Lab Task
6.1) Write an algorithm for to Animate your name with separate letters sprite.
6.2) Create a block code to Animate your name with separate letters sprite.
6.3) Create a block code that runs horse with moving clouds effect. Select Unicorn sprite and
change its costumes to make it moving.
6.4) Create a block of code for click the balloon game to pop it with sound effect at random position.
6.5) Write an algorithm for click the balloon game to pop it with sound effect at random position.