SCRATCH
PROGRAMMING
Prakriti Dhang
03-06-2020
SCRATCH
• Developed by MIT media lab.
• Visual programming language.
• Learning environment.
• Allows to create interactive, media-rich projects.
• Allows to create animated stories, educational projects,
games, and simulations.
DOWNLOADS
• Offline version: Work from anywhere. And no internet is
required to build the projects. Can upload your project to
your online account.
Https://scratch.mit.edu/download
• Online Version: Requires internet. Sign in to start new
projects.
https://scratch.mit.edu/
TYPES OF BLOCKS IN SCRATCH
Blocks
Command
Blocks
Function
Blocks
Trigger
Blocks
Control
Blocks
Have a notch on
the top and a
matching bump
on the button.
Do not have
notches.
Returns a
value.
Have rounded
top.
Run blocks
below them.
Have opening
to hold other
blocks.
SCRATCH ENVIRONMENT
WHOLE VIEW
STAGE CURRENT SPRITE PANEL
SPRITE LIST CODE BLOCKS PALETTE
START PROGRAM
STOP PROGRAM
STAGE
Where your Scratch Programs run. It has
• One or more backgrounds (images on the background of the
screen)
• Any code blocks associates with it.
SPRITE
Any object that goes on the stage is a sprite. In Scratch, the sprite is:
• The image on the stage
• Any alternative costumes (looks) it has
• Any sounds associates with it
• Any code blocks associates with it The current sprite is the one that
is selected in the sprite list.
CODE BLOCKS PALETTE
Code in Scratch comes as blocks, that you click together to make
programs. You choose blocks from the code blocks palette and drag
them into the current sprite panel, then click them together. There
are 10 categories of blocks, which are colour coded, and you can
select each category from the list at the top of the code blocks
palette.
CODE BLOCK PALETTE
Motion blocks:
These blocks control the movement of the sprite
Looks blocks:
This category includes several blocks of code that can be used to
modify the appearance of a sprite. With these blocks, you can apply
graphic effects to the sprite, change the color of the sprite, or change
the size of the sprite.
Sound blocks:
These blocks add and control sound in your Scratch
project.
Event blocks:
These blocks control when and how the scripts are activated. With
these, you can control whether a script starts running when the user clicks
the green flag or a sprite
Control blocks:
These blocks control how the scripts run. For example, you can
pause the script for a specified amount of time or you can repeat a sequence
of blocks a specified number of times.
Sensing blocks:
These blocks are used if you need to detect things in your scripts. Some of
these blocks also allow interaction with a webcam or interaction with the
user.
Operators blocks:
These blocks perform math functions, such as adding, subtracting, and
dividing numbers. You can also perform operations on strings of
characters, such as comparing them and adding multiple sentences or
words to create a new sentence.
Pen blocks:
These blocks control the pen, which you can use to draw on the
stage.
CHANGE BACKDROP AND COSTUMES
To change background:
1. Click on the white rectangle shape named “stage 1
backdrop”
2. Click on choose from backdrop library.
3. Select a backdrop and click ok.
To change costume:
1. Click on the cat sprite.
2. Click on choose from library.
3. Select from options and click ok
MOTION AND DRAWING
EVENT PALETTE
• Use to start or
activate the program.
• You can choose how
you want to activate
your program.
MOTION PALETTE
• Use to move the sprite around the stage
TYPES OF MOTIONS COMMANDS
• Absolute Motion
Scratch has four absolute motion commands: Go to, glide to, set x to,
and set y to. These commands tell your sprite exactly where to go.
• Relative Motion
You can move a sprite on the stage using relative motion commands:
move three steps, then turn right, then move two steps.
• Other motion commands
Point towards; if on edge, bounce; and set rotation style.
EXAMPLE 1
1. Moves 50 steps
2. Turns 45 degree
PEN PALETTE
• Pen command is used to see the actual path of sprite
travels.
• Allows to control the pen’s size, pen’s color and pen’s
shade.
• Draw geometric figures.
• Moving and turning a sprite on the stage using the arrow
keys.
PEN PALETTE
• Set pen color: click the command and click anywhere to
choose a color.
• Set pen size: to increase or decrease the font size of the
pen
• Pen down: draws the figure.
• Pen Up: when use pen up, no figure is drawn.
EXAMPLE 2
• Draw a line using pen commands
CONTROL PALETTE
• Duplicating your script can make your program longer.
• Use repeat command from control palette to avoid
writing the code multiple times.
Without use of repeat command:
• Move 100 distance and turn 120° anticlockwise.
• Move 100 distance and turn 120° anticlockwise.
• Move 100 distance and turn 120° anticlockwise.
With repeat command:
• Repeat 3
Move 100 distance and turn 120° anticlockwise.
EXAMPLE 3: DRAW A TRIANGLE
PRACTICE 1
• Try out other commands in event palette to see how it
works.
• Try out other commands in motion palette to see how it
works.
• Try out other commands in pen palette to see how it
works.
• Try out other commands in control palette to see how it
works.
PRACTICE 2
1. Move your sprite 100 steps and turn the sprite 60
degree using right arrow key. Add a 5 seconds wait
between the move and turn.
2. Draw a pentagon and hexagon using repeat block.
3. Create a project: a cat is catching a muffin. [Hints: Use
motion palette, control palette, events palette, pen
palette
THANK YOU

Start developing projects with Scratch Programming

  • 1.
  • 2.
    SCRATCH • Developed byMIT media lab. • Visual programming language. • Learning environment. • Allows to create interactive, media-rich projects. • Allows to create animated stories, educational projects, games, and simulations.
  • 3.
    DOWNLOADS • Offline version:Work from anywhere. And no internet is required to build the projects. Can upload your project to your online account. Https://scratch.mit.edu/download • Online Version: Requires internet. Sign in to start new projects. https://scratch.mit.edu/
  • 4.
    TYPES OF BLOCKSIN SCRATCH Blocks Command Blocks Function Blocks Trigger Blocks Control Blocks Have a notch on the top and a matching bump on the button. Do not have notches. Returns a value. Have rounded top. Run blocks below them. Have opening to hold other blocks.
  • 5.
  • 6.
    STAGE CURRENT SPRITEPANEL SPRITE LIST CODE BLOCKS PALETTE START PROGRAM STOP PROGRAM
  • 7.
    STAGE Where your ScratchPrograms run. It has • One or more backgrounds (images on the background of the screen) • Any code blocks associates with it. SPRITE Any object that goes on the stage is a sprite. In Scratch, the sprite is: • The image on the stage • Any alternative costumes (looks) it has • Any sounds associates with it • Any code blocks associates with it The current sprite is the one that is selected in the sprite list. CODE BLOCKS PALETTE Code in Scratch comes as blocks, that you click together to make programs. You choose blocks from the code blocks palette and drag them into the current sprite panel, then click them together. There are 10 categories of blocks, which are colour coded, and you can select each category from the list at the top of the code blocks palette.
  • 8.
  • 9.
    Motion blocks: These blockscontrol the movement of the sprite Looks blocks: This category includes several blocks of code that can be used to modify the appearance of a sprite. With these blocks, you can apply graphic effects to the sprite, change the color of the sprite, or change the size of the sprite. Sound blocks: These blocks add and control sound in your Scratch project. Event blocks: These blocks control when and how the scripts are activated. With these, you can control whether a script starts running when the user clicks the green flag or a sprite Control blocks: These blocks control how the scripts run. For example, you can pause the script for a specified amount of time or you can repeat a sequence of blocks a specified number of times.
  • 10.
    Sensing blocks: These blocksare used if you need to detect things in your scripts. Some of these blocks also allow interaction with a webcam or interaction with the user. Operators blocks: These blocks perform math functions, such as adding, subtracting, and dividing numbers. You can also perform operations on strings of characters, such as comparing them and adding multiple sentences or words to create a new sentence. Pen blocks: These blocks control the pen, which you can use to draw on the stage.
  • 11.
    CHANGE BACKDROP ANDCOSTUMES To change background: 1. Click on the white rectangle shape named “stage 1 backdrop” 2. Click on choose from backdrop library. 3. Select a backdrop and click ok. To change costume: 1. Click on the cat sprite. 2. Click on choose from library. 3. Select from options and click ok
  • 12.
  • 13.
    EVENT PALETTE • Useto start or activate the program. • You can choose how you want to activate your program.
  • 14.
    MOTION PALETTE • Useto move the sprite around the stage
  • 15.
    TYPES OF MOTIONSCOMMANDS • Absolute Motion Scratch has four absolute motion commands: Go to, glide to, set x to, and set y to. These commands tell your sprite exactly where to go. • Relative Motion You can move a sprite on the stage using relative motion commands: move three steps, then turn right, then move two steps. • Other motion commands Point towards; if on edge, bounce; and set rotation style.
  • 16.
    EXAMPLE 1 1. Moves50 steps 2. Turns 45 degree
  • 17.
    PEN PALETTE • Pencommand is used to see the actual path of sprite travels. • Allows to control the pen’s size, pen’s color and pen’s shade. • Draw geometric figures. • Moving and turning a sprite on the stage using the arrow keys.
  • 18.
    PEN PALETTE • Setpen color: click the command and click anywhere to choose a color. • Set pen size: to increase or decrease the font size of the pen • Pen down: draws the figure. • Pen Up: when use pen up, no figure is drawn.
  • 19.
    EXAMPLE 2 • Drawa line using pen commands
  • 20.
    CONTROL PALETTE • Duplicatingyour script can make your program longer. • Use repeat command from control palette to avoid writing the code multiple times.
  • 21.
    Without use ofrepeat command: • Move 100 distance and turn 120° anticlockwise. • Move 100 distance and turn 120° anticlockwise. • Move 100 distance and turn 120° anticlockwise. With repeat command: • Repeat 3 Move 100 distance and turn 120° anticlockwise.
  • 22.
    EXAMPLE 3: DRAWA TRIANGLE
  • 23.
    PRACTICE 1 • Tryout other commands in event palette to see how it works. • Try out other commands in motion palette to see how it works. • Try out other commands in pen palette to see how it works. • Try out other commands in control palette to see how it works.
  • 24.
    PRACTICE 2 1. Moveyour sprite 100 steps and turn the sprite 60 degree using right arrow key. Add a 5 seconds wait between the move and turn. 2. Draw a pentagon and hexagon using repeat block. 3. Create a project: a cat is catching a muffin. [Hints: Use motion palette, control palette, events palette, pen palette
  • 25.