Scratch 2
Scratch 2
i
A m
To program in Scratch, using the instructions under control block.
To change the background of the stage.
Tejas and Jyoti are playing a game while Moz looks on.
The name of the game is ‘Akash – Bhumi – Patal – Pakshi’.
The actions are: Akash – raise both hands up.
Bhumi – Both hands in front.
Patal – Both hands down.
Pakshi – Hands to the sides and flap.
Tejas gives a sequence: Akash – Bhumi – Pataal – Pakshi
Jyoti does the actions in the sequence.
Akash
Patal
Bhumi Pakshi
Bhumi
Akash
x
Pakshi
x
Patal
22
Moz: This is an interesting game. Now
let us use the Paint Editor to draw the
Sprite and Costumes for the game.
S
LL
I
SK
23
Tejas ( pointing to “When green flag clicked” ): Can we use this instruction
to start the program?
Moz: Of course, you can.
24
Tejas and Jyoti take a break and start exercising. Moz makes it fun by
making a game out of it. When Moz says “start”, they start exercising.
When Moz rings a bell, they change the exercise.
When Moz says “stop”, the children stop exercising.
Tejas: That was fun.
Jyoti: Let us write a program for this game.
Moz: I have created a Sprite for Samakonasana, you can use it.
Tejas: Let us try the block “When Flag clicked”.
Tejas moves the block to the script area.
Moz: Ok. Now what do you want the sprite to do when the flag is clicked?
Jyoti: Start exercising.
Tejas: Let us write the instructions for the exercise.
Jyoti: We should also make the Sprite repeat the exercise.
Moz: Good. Now click on the flag and see what happens?
25
Jyoti: Can I write another block and use one of the control keys to start
the execution of the block?
Moz: Yes. Go ahead and write instructions for Kehuni naman.
Moz: Good. Both of you have done well using the control block. When
should one use the control block?
Jyoti: When we want to repeat a set of instructions.
Tejas: And when there are conditions like “wait for 10 seconds” or “When
a key is pressed do something”.
Moz: Correct.
26
Tejas (pointing to the stage icon): What is
this icon?
Moz: It is the stage icon. This icon is used
to change the background of the stage.
Click on the icon and see what happens?
L S
IL
SK
Jyoti: There are no
motion blocks!
Moz: Background of the stage cannot move, so there are no commands in the
motion block. The Stage changes the Background just as a Sprite changes
Costumes. Explore other available instructions for the Background.
Tejas: See the Sprite has more commands under the ‘looks’ and ‘pen’ blocks
than the Background.
27
Tejas: Let us make the Sprite go to school.
Moz: You have to write a separate Script for the Background and the
Sprite.
Jyoti: Then how do we run them together?
Tejas: Suppose we use the same key to start both Scripts, will both the
Scripts start running at the same time?
Moz: Yes. You are correct. Both Scripts will start running together at the
same time.
Jyoti and Tejas plan the sequence for the Sprite and Background as
follows:
Start with a background of a Mall.
Let the Sprite move and say “Oh! This is the Mall”.
Change the Background to a garden.
Let the Sprite move and say “ This is the Five Gardens”.
Change the Background to school.
Let the Sprite move and say “Finally, I have reached school”.
Tejas: When the Sprite moves and says something, it will take about 2
secs (seconds).
Jyoti: So let us change the background after 2 secs.
Tejas: Let us start both the Sprite program and the Background program
with “When flag clicked”.
28
Script for the Background
29
Tejas: Oh! Looks like the Sprite is walking from home to school.
Jyoti: This is fun. Even with limited instructions we can make the Sprite
do quite a few activities.
Tejas: And also make it look real by changing the backgrounds.
Moz: Yes. There are many more instructions in the five blocks of Scratch
that you have learnt.
L S
4. Run the program.
IL
SK
Blocks of scratch and their usage
Motion - Move the Sprite up, down, right, left, forward,or
backward.
Looks - Change the looks of a Sprite or the Background with
Costumes.
Animate the Sprite. Make the Sprite say something using Think or
Say bubble.
Sound - Play a sound or a musical note. Change the volume of the
sound.
Pen - Make the Sprite draw as it moves. Change colour, shade,
thickness of the pen. Stamp Sprite’s image on the stage.
Control block - Repeat some actions. Use conditional instructions
like “when key is pressed”, do something. Include some time gap
between actions.
Info
30
Level III Lesson 5 WORKSHEETS
1. Circle the correct option.
1. To make the Sprite wait for some seconds, you can use the .
Where can you find this instruction?
Control Block Looks Block Motion Block
Pen
Control
Looks
Motion
31
Level III Lesson 5
a. Write scripts to make each fish move in a different direction (up, down, left and
right).
Hint: Use
(90) right
(-90) left
(0) up
(180) down
b. Write a script to make all the fish move in the same direction together?
32
Level III Lesson 5
a. Write the Scripts for a dialogue between the two Sprites. You can use any Sprites
of your choice.
Sprite 1: How are you?
Sprite 2: I am fine, thank you.
b. Write Script to make the Sprite dance to the beat.
Now see if you can run the same program without repeating the commands.
Hint: Explore the instructions under control block.
Use the instruction to clear all the changes you make.
33
Level III Lesson 5
5. Using Paint editor draw two backgrounds of your choice. Now introduce Sprite(s)
and create an animation. Explain the same to the class.
Example:
Group Activity
Hopping game: To play this game the students are divided into groups of three. A
grid (say 5x5) is drawn on the floor and the central square is marked. Two to three
objects are taken and placed on some other squares of the grid. These could be balls
or sweets or any small thing that the class finds attractive. Three students will play
the game together. One student stands on the centre square, and will try to hop to
the squares with the objects in them and pick them up. The student can only hop
according to the instructions of his partners.
The partners stand at the edge of the grid
and give the directions. They can use one of
the following four instructions to guide their
hopping friend: Move forward by some number
of squares, Move backward by some number
of squares, Turn right, Turn left. The
game ends after all the objects in the
grid have been picked up.
Project
Do project 5 given in lesson 7.
Explore!
1. How will you make the Sprite draw concentric circles
(circle within a circle with the same center)?
2. Explore where is the ‘stamp’ option in Scratch.
Use it in a program and see what happens.
34
Teacher’s Level III
Corner Lesson 5
Start the class by revising the terms like Sprite, Looks, Costumes and Motion. Now ask the
question “How do we start a Program/Script?” Double click is the option taught so far.
Now write a Script to change the Costume of the Sprite. Run the program and see how fast
the code is executed. The change in costume is so fast that it will be hardly noticeable.
Ask the students what instructions are required to slow it down!
Introduce the Control block and the commands available under it. “Wait, when green flag,
space or any other key pressed”, are some of the commands that can be introduced now.
Now show the Stage icon. Show how the set of commands under the different blocks like
motion, control, etc. changes the output. Ask why there are no motion commands for the
Stage?
Explain what the Background is and show them how to change it. Tell them that we can
draw Backgrounds using the Paint editor.
Using all these commands and background, modify the Script which was written at the
start of the class. If needed, introduce more commands under Looks, Motion and other
instruction blocks to make a small skit. Let the students observe how the program runs
when the ‘green flag’ is pressed.
Ask the students to write projects and save it under a suitable name.
Further Reading :
http://info.scratch.mit.edu/Support/Scratch_Cards
35