2. LEARNING OBJECTIVES
At the end of this topic Students will be comfortable in using
Sensing blocks
Using Mathematical Operators
Comparing values
Generating random Numbers
Changing Location Randomly
Bouncing the Ball Up and Down
Making a Variable
Making Decision
Applying Condition
3. INTRODUCTION
Scratch is a visual programming environment that makes it easy
to create interactive stories, games, art and animations.
For coding in Scratch you won’t need to write lines of code
because they’ll be provided in blocks.
4. BASIC CODE BLOCKS OF SCRATCH
Motion : These blocks control the motion of a sprite.
Looks : these blocks help user to change the
appearance of the sprite.
Sound: these blocks help add sounds to our project
and control them.
Events: These blocks help to trigger actionin in any
project.
5. CONTI..
Controls: These blocks help to have control over the
code such as conditions and loops.
Sensing: These blocks help our code be alive. It helps
the sprite detect things and sense them
Operators: These blocks help in all mathematical
operations such as addition, subtraction,
multiplication etc. and OR , AND .
Variables: These blocks help in the list and variable
operations.
13. Click on Sensing set
and get the Ask and
wait command.
Also click on the
answer check box to
make it show on the
display window.
The answer box is the
storage in memory,
that is variable.
SENSING COMMAND AND INPUT
https://www.youtube.com/watch?v=1Pswt
tcxCko
14. MOVING THE SPRITE ON A
RANDOM POSITION
When you place these
blocks in your code. It will
move the sprite on a
random position.
15. BOUNCING BALL GAME
Delete the default sprite
and select the ball in
sprites.
Add the shown blocks in
your code.
Watch the video to make another ball game:
https://www.youtube.com/watch?v=BlmBDrnhd2I
16. MAKING DECISIONS IN SCRATCH
To make decisions we use if-then
and If-then-else blocks from control
sections.
In if block we add condition and
the correct answer is added inside
the if block if the condition is true.
For Example:
17. HANDS ON PRACTICE
1. Make the cat sprite fly towards your
mouse pointer.
2. Create Guess the number game. In this
game the player has to guess the
number which computer picks.