Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Scratch Booklet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22
At a glance
Powered by AI
Scratch is a programming language used to create interactive stories, games and animations. It uses a drag and drop interface with blocks to write programs.

Scratch is used to create interactive stories, games and animations. It allows students to learn programming concepts in a visual and engaging way.

Sprites are objects in Scratch that you can give instructions to. You can tell sprites to move, play music or react to other sprites.

Facilitator’s Guide by:

g started
t in

wi
t
Ge

th
2.0
Download Scratch 2.0 FREE
computermasti.in/downloads.html

Find us on
facebook.com/computermasti
1. Pre-plan

My friends don’t know


Scratch, how can I make them
understand about the Scratch?

You
can refer to Scratch
Facilitator Guide. It will help a new
user to get familiar with Scratch
Interface. You can also ask them to
go to Scratch website and
explore on their own.

1.1. Get to know Scratch


‘SCRATCH’ as a programming language
Scratch is a programming language developed by the Lifelong Kindergarten Group at the Massachusetts
Institute of Technology (MIT) Media Lab. It is visually appealing, extremely easy to use programming package
allows students to create animations while applying the programming constructs.

The programming language is an open source for free download,


available for Mac, Windows, and Linuxplus. With the help of Scratch,
students can create interactive stories, games, and animations and
even share projects with others on the web.

Scratch programs are made up of objects called ‘sprites’. These sprites


function similarly the way turtle does in Logo.

You can give instructions to a sprite, telling it to move or play music or react to other sprites. To tell a sprite
what to do, you snap together graphic blocks into stacks, called ‘scripts’. When you click on a script, Scratch
runs the blocks from the top of the script to the bottom. These programs are even referred to as SCRATCH
projects.

It facilitates programming logic and algorithmic thinking without the requirement of memorizing syntax
rather it uses drag and drop commands to write the script.

1
Scratch Interface
x-y position
Screen mode Stage To run the script To stop the script Scripts Area of a Sprite

Stage

2
x-y position
of a Mouse

Stage
Sprite

Add new Sprite Paint new Sprite Add new Sprite Blocks Palette 100% Zoom in
from library from file Screen
Zoom out
Menu Tab

Language icon allows you to change the language for the Scratch user interface.
File drop down menu allows you to create a new project, open an existing project, and save projects.
Edit drop down menu provides features such as Undelete, Small stage layout and Turbo mode.
Tips menu will open All tips window which includes useful tips while creating scratch projects.
About menu will allow you to access Scratch website.

Toolbar

Duplicate : This button allows you to duplicate sprites, costumes, sounds, blocks, or scripts.
Delete : This button allows you to delete sprites, costumes, sounds, blocks, and scripts.
Grow : This button allows you to enlarge the sprite.
Shrink : This button allows you to reduce the size of your sprite.
Tips : Click this button then drag and drop it on any element on Scratch interface to see the tips
about the same.

Screen Modes

Clicking on this button you can switch between small and large stage view.

Start & Stop buttons

Clicking on the Green Flag executes all the scripts. The Green Flag remains highlighted while
scripts are running.
Stop sign stops all scripts.

New Sprite Buttons

When you start a new Scratch project, it begins with a single cat sprite. However, you can add a new
Sprite. There are four ways to add a new Sprite:

1. Click on to select a Sprite from the existing list of Sprites and select one.

2. Click on to paint a new Sprite.

3. Click on to upload Sprite from file in the system.

4. Clcik on to capture new Sprite from your system’s camera.

3
Stage

The backdrop or ‘stage’ of the sprite is fixed can also be drawn, taken from the samples or
imported. The ‘stage’ is where you see your animation.

The Stage is 480 units wide and 360 units tall. It is divided
into an x-y grid. The middle of the Stage has an x-coordinate
of 0 and a y-coordinate of 0.
To find out x-y positions on the Stage, move the mouse
(cursor) around and look at the mouse x-y display just
below the Stage.

Ways to change the Backdrop:


1. Click to select a new backdrop from the backdrop library.
2. Click to paint a new backdrop in Paint editor.
3. Click to upload a backdrop from a folder in your computer.
4. Click to capture a backdrop from your system’s camera.

Sprite List

The Sprite List displays thumbnails for all sprites in a project. The name of each sprite appears below its
thumbnail. Refer a screenshot at right.
To see and edit a sprite’s scripts, costumes, and
sounds, click the sprite’s thumbnail in the Sprite List
– or double-click the sprite itself on the Stage. (The
selected sprite is highlighted and outlined in blue in
the Sprite List.)
To show, export, duplicate, or delete a sprite, right-click
on the sprite’s thumbnail in the Sprite List.

Just as a sprite can change its appearance by switching


costumes, the Stage can change its appearance by
switching backdrops. To see and edit the scripts,
backdrops, and sounds associated with the Stage,
click the Stage icon at the left of the Sprite List.

4
Current Sprite Info

Current Sprite Info shows a sprite’s name,


x-y position, direction, rotation styles and show/hide the sprite.
Let us discuss about rotation styles further.

Sprite Rotation Style

You can click the Rotation Style buttons to control how the costume appears as the sprite
changes its direction.
Rotate: The costume will rotate as the sprite changes direction.

Left-right flip: The costume will face either left or right.

No-rotate: The costume will never rotate, even if the sprite changes direction.

Scripts Tab

The Scratch blocks are organized into ten color-coded categories:


Motion, Looks, Sound, Pen, Data, Events, Control, Sensing, Operators
and More Blocks.

Blocks Palette

Motion

Moves sprite forward or backward.

Rotates sprite clockwise.

Rotates sprite counterclockwise.

Points sprite in the specified direction. (0=up, 90=right,


180=down, -90=left)

5
Points sprite toward mouse-pointer or another sprite.

Moves sprite to specified x and y position on Stage.

Moves sprite to the location of the mouse-pointer or another


sprite.

Moves sprite smoothly to a specified position over specified


length of time.

Changes sprite’s x-position by specified amount.

Sets sprite’s x-position to specified value.

Changes sprite’s y-position by specified amount.

Sets sprite’s y-position to specified value.

Turns sprite in opposite direction when sprite touches edge


of Stage.

Reports sprite’s x-position. (Ranges from -240 to 240)

Reports sprite’s y-position. (Ranges from -180 to 180)

Reports sprite’s direction. (0=up, 90=right, 180=down,


-90=left)

6
Blocks Palette

Looks
Changes sprite’s appearance by switching to different
costume.
Changes sprite’s costume to next costume in the costume
list. (If at end of the costume list, jumps back to first
costume.)
Reports sprite’s current costume number.
Changes Stage’s appearance by switching to a different
backdrop.
Reports Stage’s current backdrop name.
Displays sprite’s speech bubble for specified
amount of time.
Displays sprite’s speech bubble. (You can remove speech
bubble by running this block without any text.)
Displays sprite’s thought bubble for specified
amount of time.
Displays sprite’s thought bubble.
Changes a visual effect on a sprite by specified amount.
(Use pull-down menu to choose effect.)
Sets a visual effect to a given number. (Most visual effects
range from 0 to 100.)
Clears all graphic effects for a sprite.

Changes sprite’s size by specified amount.

Sets sprite’s size to specified % of original size.

Reports sprite’s size, as % of original size.

Makes sprite appear on the Stage.


Makes sprite disappear from the Stage. (When sprite is
hidden, other sprites cannot detect it with touching?
block.)
Moves sprite in front of all other sprites.
Moves sprite back a specified number of layers, so that it
can be hidden behind other sprites.

7
Blocks Palette

Sounds
Starts playing a sound, selected from pull-down menu, and
immediately goes on to the next block even as sound is still
playing.
Plays a sound and waits until the sound is finished playing
before continuing with next block.
Stops playing all sounds.
Plays a drum sound, selected from pull-down menu, for
specified number of beats.

Plays a musical note (higher numbers for higher pitches) for


specified number of beats.

Rests (plays nothing) for specified number of beats.


Sets the type of instrument that the sprite uses for play note
blocks. (Each sprite has its own instrument.)
Changes sprite’s sound volume by specified amount. Volume
ranges from 0 to 100.
Sets sprite’s sound volume to specified value.

Reports sprite’s sound volume.

Changes sprite’s tempo by specified amount.

Sets sprite’s tempo to specified value in beats per minute.

Reports sprite’s tempo in beats per minute.

8
Blocks Palette

Pen

Clears all pen marks and stamps from the Stage.

Puts down sprite’s pen, so it will draw as it moves.

Pulls up sprite’s pen, so it won’t draw as it moves.

Sets pen’s color, based on choice from color picker. Picking


the color also changes the pen shade.

Changes pen’s color by specified amount.

Sets pen’s color to specified value. (pen_color=0 at red end


of rainbow, pen_color=100 at blue end of rainbow. Ranges
from 0 to 200 to go around the color wheel.)

Changes pen’s shade by specified amount.

Sets pen’s shade to specified amount. (pen_shade=0 is very


dark, pen_shade=100 is very light. Default is 50, unless set
with color picker.)

Changes pen’s thickness.

Sets pen’s thickness.

Stamps sprite’s image onto the Stage.

9
Blocks Palette

Data
Allows you to create and name a new variable. When
you create a variable, the blocks for that variable will
appear. You can choose whether the variable is for all
sprites (global) or just for one sprite (local).

Reports value of the variable.

Allows you to create and name a new list. When you


create a list, the blocks for that list will appear. You
can choose whether the list is for all sprites (global)
or just for one sprite (local).

Reports all the items in the list.

Sets the variable to specified value.

Changes the variable by specified amount. If you


have more than one variable, use the pull-down
menu to select the variable name.

Shows the variable monitor on the stage.

Hides the variable monitor so it is not visible on the


stage.

dds the specified item to the end of the list. The


item can be a number or a string of letters and other
characters.
Deletes one or all items from a list. You can choose
from the pull-down menu, or use a number to specify
which item to delete. Choosing ?last? deletes the last
item in the list. Choosing ?all? deletes everything
from the list. Deleting decreases the length of the
list.
Inserts an item at the specified position in the list.
You can choose from the pull-down menu, or use a
number to specify where to insert the item. Choosing
?last? adds the item to the end of the list. Choosing
?any? inserts at a random place in the list. The length
of the list increases by 1.

10
Blocks Palette

Replaces an item in the list with the specified value.


You can choose from the pull-down menu, or use a
number to specify which item to replace. Choosing
?last? replaces the last item on the list. Choosing
?any? replaces a random item in the list. The length
of the list does not change.
Reports the item at the specifed position in the list.
You can choose from the pull-down menu, or use a
number to specify which item to report. Choosing
?any? reports a random item in the list.

Reports how many items are in the list.

Reports true if the list contains the specified item.


(The item must match exactly to report true.)

Shows the list monitor on the stage.

Hides the list monitor so it is not visible on the stage.

11
Blocks Palette

Events

Runs script below when green flag is clicked.

Runs script below when specified key is pressed.

Runs script below when sprite is clicked.

Runs script below when the backdrop changes to the


specified backdrop.
Runs the script below when loudness/timer/video motion
exceeds the specified number(limit).

Runs script below when it receives specified broadcast


message.

Sends a message to all sprites, then continues with the next


block without waiting for the triggered scripts.
Sends a message to all sprites, triggering them to do
something, and waits until they all finish before continuing
with next block.

12
Blocks Palette

Control

Waits specified number of seconds, then continues with


next block.

Runs the blocks inside over and over.

Runs the blocks inside a specified number of times.

If condition is true, runs the blocks inside.

If condition is true, runs the blocks inside the if portion; if


not, runs the blocks inside the else portion.

Waits until condition is true, then runs the blocks below.


Checks to see if condition is false; if so, runs blocks inside
and checks condition again. If condition is true, goes on to
the blocks that follow.

Stops all scripts in all sprites.

A activates when a clone is created. It only runs in the newly


created clone, not previous clones or the parent.
Clones(creates a duplicate) the sprite it runs in.

Deletes the clone it runs in.

13
Blocks Palette

Sensing
Reports true if sprite is touching specified sprite, edge, or
mouse-pointer. (Selected from pull-down menu.)
Reports true if sprite is touching specified color. (Click on
color patch, then use eyedropper to select color.)
Reports true if first color (within sprite) is touching second
color (in background or another sprite). (Click on color
patch, then use eyedropper to select color.)
Reports distance from the specified sprite or mouse-pointer.

Asks a question on the screen and stores keyboard input in


the . Causes the program to wait until Enter key is pressed
or check mark is clicked.
Reports distance from the specified sprite or mouse-pointer.
 Reports true if specified key is pressed.

Reports true if mouse button is pressed.

Reports the x-position of mouse-pointer.

Reports the y-position of mouse-pointer.


Reports the volume (from 1 to 100) of sounds detected by
the computer microphone.
It gets values of the video, either motion, or direction, on
either the Stage, or the current sprite..
It can turn the video stream on, off, or on flipped
horizontally, depending on the argument.
It sets the transparency of the video stream to a certain
value.
Reports the value of the timer in seconds. (The timer is
always running.)
Sets the timer to zero.

Reports a property or variable of another sprite.

It reports either the current local year, month, date, day


of the week, hour, minutes, or seconds, depending on
the argument.
It reported the number of days since the start of Scratch
(May 15, 2007)
It reports an ID unique to each user for each project.

14
Blocks Palette

Operators

Adds two numbers.

Subtracts second number from first number.

Multiplies two numbers.

Divides first number by second number.

Picks a random integer within the specified range.

Reports true if first value is less than second.

Reports true if two values are equal.

Reports true if first value is greater than second.

Reports true if both conditions are true.

Reports true if either condition is true.

Reports true if condition is false; reports false if condition is


true.
Reports result of selected function (abs, sqrt, sin, cos,
tan, asin, acos, atan, ln, log, e^, 10^) applied to specified
number.
Reports remainder from division of first number by second
number.

Reports closest integer to a number.

Reports result of selected function (abs, sqrt, sin, cos,


tan, asin, acos, atan, ln, log, e^, 10^) applied to specified
number.
Reports remainder from division of first number by second
number.

Reports closest integer to a number.

15
Blocks Palette

More Blocks

16
Costumes Tab

This tab allows you to edit the costume of the sprites. You can simply click on the thumbnail
of the costume you want to switch to a different costume.

Ways to change the Costume:


1. Click to select a new costume from the backdrop library.
2. Click to paint a new costume in Paint editor.
3. Click to upload a costume from a folder in your computer.
4. Click to capture a costume from your system’s camera.

Paint Editor has two types of modes to create/ edit a costume.


Costume in Vector Mode Costume in Bitmap Mode

Creating/Editing a Costume in Creating/Editing a Costume in


Vector Mode Bitmap Mode
Click button Click button
Select tools from the following: Select tools from the following:

17
Sounds Tab

You can record new sounds or import sound files for the script on the Sounds tab.
Sound block has instructions to make the Sprite speak, add musical notes and so on.
Record
Library Import Import

Play Stop Record

Adding Sound
1. Click ‘Sounds’ tab.

2. Click the icon choose a sound from library.


3. Select sound from the Sound library.

Various types of Blocks

There are three main types of blocks in the Blocks Palette.


Stack Blocks:
• • These blocks have bumps on the bottom and/or notches on the top, such as .
• • You can snap these blocks together into stacks.
• • Some stack blocks have an input area inside them, where you can type a number (such as
10 in the block) or choose an item from a pull-down menu (such as pop in the
block).
• • Some stack blocks, such as, have a C-shaped “mouth” where you can insert
other stack blocks.
Hats:
• • These blocks have rounded tops, such as .
• • These blocks are placed at the tops of stacks.
• • They wait for an event to happen, such as a key being pressed, then run the blocks underneath
them.

18
Reporters

These blocks, such as and , are designed to fit in the input area of
other blocks.
• • Reporters with rounded ends (such as or ) report numbers or strings and
fit in blocks with rounded or rectangular holes (such as or ).
• • Reporters with pointed ends (such as ) report boolean values (true or false) and
fit inside blocks with pointed or rectangular holes (such as or ).
• • Click on any reporter block to see its current value.
• • Some reporter blocks have a check box next to them, such as . If you click in
the check box, a monitor appears on the stage, displaying the current value of the reporter.
As the value of the reporter changes, the monitor updates automatically. A monitor can
display the value of the reporter in several different formats:
−− a small readout with the name of the reporter.
−− a large readout without any name.
−− a slider that allows you to manipulate the value of the reporter (available only
for variables).
• • Double-click or right-click (Mac: Ctrl+click) on a monitor to change from one format to
another.
• • The slider format is available only for user-created variables. Right-click (Mac: Ctrl+click) on
the monitor in slider format to adjust its minimum and maximum values.

Lists, Strings and Keyboard Input


Lists
• • You can create and manipulate lists in Scratch.
• • Lists can store numbers as well as strings of letters and other characters.
• • To create a list, go to the Variables blocks category and click .
• • Once you make a list, several list blocks will appear.
• • The list blocks are described in the Block Descriptions section of this guide.
• • When you create a list, a list monitor will appear on the stage.
• • A list monitor shows all the items in a given list. You can type items directly into a list
monitor.
• • At first the list will be empty, with length 0. To add to the list, click the + button on the
bottom left of the list monitor. The length will increase by 1. Alternatively, you can add to
the list using the list blocks (e.g. ).
• • You can resize the list monitor from the bottom right-hand corner.
Strings
• • Strings are made of letters, words, or other characters (e.g., apple; October 2009; You win!).
•• Strings can be stored in variables or lists (such as or ).
•• You can join together strings using .
•• You can compare strings using the following blocks: , or .
•• Strings are evaluated as 0 in mathematical operation blocks (such as: ) and in blocks
that expect a number (such as and ).

19
Keyboard Input
You can use to prompt a user to type in a response on the keyboard. The
response is stored in . The question appears on the screen and the program waits
until the Enter key is pressed or the check mark is clicked.

The question The question


appears in a voice appears in a voice
balloon when used balloon when used
in a sprite. in a sprite.

is shared by all sprites (global) and is replaced each time runs. If you want to
save the current , you can store it in a variable or list.

Scripts Area

If you have to program a sprite, then drag blocks from the Blocks Palette to the Scripts Area. To run
a block and click on it.
Create scripts (programs) by snapping blocks together into stacks. Click anywhere on the stack to
run the whole script, from top to bottom.
To find out what a block does, right-click on it, then select help from the pop-up menu.
When you drag a block around the Scripts Area, a white highlight indicates where you can drop
the block and form a valid connection with another block.
To move a stack, pick it up from the top block. If you drag out a block from the middle of a stack,
all of the blocks beneath it will come along with it. To copy a stack of blocks from one sprite to
another, drag the stack to the thumbnail of the other sprite in the Sprite List.
Some blocks have white editable text fields inside, such as . To change the value,
click inside the white area and type in a number. You can also drop rounded blocks, like
, inside these areas.
Some blocks also have pull-down menus, such as . Click to see the menu,
then click again to make a selection.
• • To clean up the Scripts Area, right-click and select clean up from the menu.
• • To export a screenshot of the Scripts Area, right-click and select save picture of scripts.
• • To add a comment to the Scripts Area, right-click and select add comment. A yellow comment
• • area will appear, and you can type in text.

• • To resize the width of the comment area, use the handle on the right edge. Click the triangle
at the top-left to collapse or expand the comment area.
• • Comments can be added anywhere in the Scripts area, and you can move them around by
dragging them.
• • To attach a comment to a block, drag the comment on top of the block.
• • To detach the comment, drag the comment away from the block.

20

You might also like