scratch reference guide
TRANSCRIPT
-
8/6/2019 Scratch Reference Guide
1/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
1
Scratch is developed by the Lielong Kindergarten Group at the MIT Media Lab, with fnancial support
rom the National Science Foundation, Intel Foundation, and the MIT Media Lab research consortia.
1. INTRODUCTION
Scratch is a new programming language that makes it easy to create interactive stories,
games, and animations and share your creations with others on the web.
Tis Reerence Guide provides an overview o the Scratch sotware. I you are just
getting started with Scratch, we encourage you to try the Getting Started Guide rst
(http://scratch.mit.edu/fles/ScratchGettingStarted.pd). Ten, i you want more detailed
inormation, come back to the Reerence Guide.
Te Scratch website has many other resources to help you learn Scratch: Video utorials,
Scratch Cards, and Frequently Asked Questions (FAQs). See http://scratch.mit.edu/howto
For the latest version o this Reerence Guide, see
http://scratch.mit.edu/fles/ScratchReerenceGuide.pd
BASIC INGREDIENTS OF A SCRATCH PROJECTScratch projects are made up o objects called sprites. You can change how a sprite
looks by giving it a dierent costume. You can make a sprite look like a person or a
train or a butterfy or anything else. You can use any image as a costume: you can draw
an image in the Paint Editor, import an image rom your hard disk, or drag in an image
rom a website.
You can give instructions to a sprite, telling it to move or play music or react to other
sprites. o tell a sprite what to do, you snap together graphicblocks into stacks, called
scripts. When you double-click on a script, Scratch runs the blocks rom the top o the
script to the bottom.
-
8/6/2019 Scratch Reference Guide
2/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
2
2. SCRATCH INTERFACE
STAGETe Stage is where you see your stories, games, and animations come to lie. Sprites move
and interact with one another on the Stage.
Te Stage is 480 units wide and 360 units tall. It is divided into an x-y grid. Te middle o
the Stage has an x-coordinate o 0 and a y-coordinate o 0.
o nd out x-y positions on the Stage, move the
mouse around and look at the mouse x-y display
just below the Stage, on the right.
Click the Presentation Mode button to see projects at ull-screen size.
o exit Presentation Mode, press the Esc key.
x
x:240 :180
x:240 :-180
x:-240 :180
x:-240 :-180
ROTATION STylEContro whether costues
rotate with the sprite.
TABSCic tabs to edit scripts,
costues, or sounds.GREEN FlAG
A wa to start scripts.
STAGE
Where our scratch
creations coe to ie.
NEW SPRITE BUTTONS
Create a new character or
object or our project.
SPRITE lIST
Thubnais o a our
sprites. Cic to seect and
edit a sprite.
PRESENTATION mODESCRIPTS AREA
Drag bocs in, snap the
together into scripts.
BlOCkS PAlETTE
Bocs or
prograing
our sprites.
CURRENTSPRITE
INFO TOOlBAR
PROJECT NOTES
-
8/6/2019 Scratch Reference Guide
3/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
3
NEW SPRITE BUTTONSWhen you start a new Scratch project, it begins with a single cat sprite. o create new
sprites, click on these buttons:
Paint your own costume or a new sprite using the Paint Editor.
Select a costume or a new sprite or import an entire sprite.
Get a surprise sprite.
I you want to delete a sprite, select the scissors rom the oolbar and click on the sprite.
Or right-click on the sprite and select delete rom the pop-up menu.
o make a sprite that looks like part o the Stage background, right-click the Stage and
selectgrab screen region for new sprite.
SPRITE lISTTe Sprite List displays thumbnails o all o the sprites in the project. For each sprite, it
shows the sprites name, how many scripts it has, and how many costumes it has.
o see and edit a sprites scripts, costumes, and sounds, click on the sprites thumbnail
in the Sprite List or double-click on the sprite itsel on the Stage. (Te selected sprite is
highlighted and outlined in blue in the Sprite List.) o show, export, duplicate, or delete a
sprite, right-click on the sprites thumbnail in the Sprite List. o show a sprite that is o
the stage or hidden, Shit+click on the sprites thumbnail in the Sprite List - this will bring
the sprite to the middle o the Stage and show it.
You can rearrange the sprites in the Sprite List by dragging the thumbnails.
Just as a sprite can change its appearance by switching costumes, the Stage can change
its appearance by switchingbackgrounds. o see and edit the scripts, backgrounds, and
sounds associated with the Stage, click on the Stage icon at the let o the Sprite List.
-
8/6/2019 Scratch Reference Guide
4/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
4
BlOCkS PAlETTE and SCRIPTS AREAo program a sprite, drag out blocks rom the Blocks Palette to the Scripts Area. o run
a block, double-click on it.
Create scripts (programs) by snapping blocks together into stacks. Double-click anywhere
on the stack to run the whole script, rom top to bottom. o nd out what a block does,
right-click on it, then select help rom the pop-up menu.
When you drag a block around the Scripts Area, a white highlight indicates where you can
drop the block and orm a valid connection with another block. You can insert blocks in the
middle o a stack or at the end.
o move a stack, pick it up rom the top block. I you drag out a block rom the middle oa stack, all o the blocks beneath it will come along with it. o copy a stack o blocks rom
one sprite to another, drag the stack to the thumbnail o the other sprite in the Sprite List.
Some blocks have white editable text elds inside, such as . o change the value,
click inside the white area and edit the number. You can also drop rounded blocks, like
, inside these areas.
Some blocks have pull-down menus, such as . Just click on the to see the
menu, then click again to make a selection.
o clean up the Scripts Area, right-click and select clean up rom the menu. o export a
screenshot o the Scripts Area, right-click and select save picture of scripts.
COSTUmESClick the Costumes tab to see and edit the sprites costumes.
Tis Sprite has two costumes. Te sprites current costume (girl1-walking) is highlighted.
o switch to a dierent costume, simply click on the thumbnail o the costume you want.
-
8/6/2019 Scratch Reference Guide
5/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
5
Tere are three ways to create new costumes:
ClicktopaintanewcostumeinthePaintEditor.
Clicktoimportanimagelefromyourharddisk. Draginoneormoreimagesfromtheweboryourdesktop.
Scratch can recognize many dierent image ormats: JPG, BMP, PNG, and GIF (including
animated GIF).
Each costume has a costume number (displayed to its let). You can rearrange the order o
the costumes by dragging the thumbnails. Te costume numbers will update i you change
their order.
Right-click on a costume thumbnail to convert the costume into a new sprite, or to exporta copy o the costume as a separate le.
SOUNDSClick the Sounds tab to see the sprites sounds.
You can record new sounds and import sound les. Scratch can read MP3 les and
uncompressed WAV, AIF, and AU les (encoded with 8-bits or 16-bits per sample, but not
24-bits per sample).
-
8/6/2019 Scratch Reference Guide
6/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
6
CURRENT SPRITE INFO
Current Sprite Info shows a sprites name, x-y position, direction, and lock state.
You can type in a new name or the sprite.
Te sprites direction indicates which direction the sprite will move when it runs a move block
(0=up, 90=right, 180=down, -90=let). Te blue line on the thumbnail shows the sprites direction.
You can drag this line to change the sprites direction. Double-click on the sprite to set thedirection back to its original state (direction=90).
Click the Lock to change the sprites lock state. An unlocked sprite can be dragged in presentation
mode and the web player.
Click Export to save the sprite as a separate le, allowing it to be imported into another project.
ROTATION STylE
Click the Rotation Style buttons to control how the costume appears as the sprite changes itsdirection.
Rotate: Te costume rotates as the sprite changes direction.
Let-right fip: Te costume aces either let or right.
No-rotate: Te costume never rotates (even as the sprite changes direction).
TOOlBAR
Click on the Toolbar to select a tool, then click on other objects to perorm an action.
Arrow: Normal mode. Pick up and move sprites and blocks.
Duplicate: Duplicate sprites, costumes, sounds, blocks, and scripts. (Shit+click or
multiple.)
Delete: Delete sprites, costumes, sounds, blocks, and scripts. (Shit+click or multiple.)
Grow: Make sprites bigger. (Shit+click or larger size steps.)
Shrink: Make sprites smaller. (Shit+click or larger size steps.)
-
8/6/2019 Scratch Reference Guide
7/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
7
mENU
New, Open, Save, and Save As do what you would expect them to do.
Share! uploads your project to the Scratch website (http://scratch.mit.edu).
Undo allows you to retrieve the last block, script, or sprite you deleted (but does not allow
you to undo most other actions).
Language allows you to select the language o the user interace. While complete
translations are provided or some languages, only the scripts and command blocks aretranslated or others (improved translations will be released on the Scratch website as
they become available). Anyone can add or edit language translations o Scratch. o add
or change a translation, simply edit the les in the locale older within the top level o the
Scratch older. (Please reer to theScratch.pot le or urther instructions.) ranslations
are currently limited to the Latin character set.
Extras gives a pop-up menu with special eatures:
Import Project: Bring all o the sprites and backgrounds rom another project
into this project. Tis eature is useul or combining sprites rom multiple projects.
Start Single Stepping: Te Scratch program runs one step at a time,highlighting each block as it runs. Tis eature can be useul or nding bugs in
programs, and or helping new programmers understand the fow o a program.
Compress Sounds: Compress sounds used in the project, to reduce the overall
le size o the project.
Compress Images: Compress images used in the project, to reduce the overall le
size o the project.
Want Help? brings up a page with links to reerence materials, tutorials, and requently
asked questions. o get help on an individual block, right-click on the block and select help
rom the pop-up menu.
GREEN FlAGTe Green Flag provides a convenient way to start many scripts at the same time. Click
the Green Flag to start all scripts with at the top.
In Presentation Mode, the Green Flag appears as a tiny icon at the top-right corner o
the screen. Pressing the Enter key has the same eect as clicking the Green Flag.
-
8/6/2019 Scratch Reference Guide
8/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
8
PAINT EDITORYou can use the Paint Editor to create or edit costumes and backgrounds.
Te Paint Editor Toolbar has the ollowing tools:
Paintbrush: Paint reehand using the current oreground color. When you click on this
tool, the Options Area shows the brush size. Click to pick a dierent brush size.
Eraser: Erase with reehand strokes. Te areas that you erase become transparent. When
you click on this tool, the Options Area shows the eraser size. Click to pick a dierent
eraser size.
Fill: Fill connected areas with a solid color or gradient. When you click this tool, the
Options Area shows the ll style (solid color, horizontal gradient, vertical gradient, or radial
gradient). Gradients blend rom the selected oreground color to the selected background
color.Rectangle: Draw a lled or outlined rectangle (Shit+drag or a square) using the current
oreground color. When you click this tool, the Options Area shows the ll style (solidor
outlined).
Ellipse: Draw a lled or outlined ellipse (Shit+drag or a circle) using the current
oreground color. When you click this tool, the Options Area shows the ll style (solidor
outlined).
TOOlBAR
OPTIONS AREA
Too settings.
CANVAS
UNDO/REDO
ClEAR
Erase canvas.
SCAlE BUTTONS
Change size o
current seection.
ROTATE BUTTONS
Rotate current
seection.
FlIP BUTTONS
Fip current seection
horizonta or vertica.
CURRENT COlORS
COlOR PAlETTES
Pic the current
coors.
ImPORT
Add iage
ro e.
SET ROTATION CENTER ZOOm
-
8/6/2019 Scratch Reference Guide
9/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
9
Line: Draw a straight line (Shit+drag or a horizontal or vertical line) using the current
oreground color. When you click on this tool, the Options Area shows the brush size.
Click to pick a dierent brush size.Text: Add text to the drawing. When you click on this tool, the Options Area allows you to
change the ont ace and ont size. Each costume can only have one block o text.
Selection: Select a rectangular region, then move it to a new location (press delete to
remove the selection, Shit+delete or Shit+backspace to crop).
Stamp: Select a rectangular region, then copy it to new locations (Shit+click+drag or
repeated stamping).
Eyedropper: Use the tip o the eyedropper to choose the oreground color (click on the
Canvas and drag the eyedropper to pick a color rom outside the Canvas).
Te Current Colors (oreground and background) are shown below the Options Area. You canclick the color swap arrow to exchange the oreground and background colors. Click in one o the
Color Palettes to pick a new oreground color (Shit+click to select a background color).
Click the Set Rotation Center button to select the location within the drawing that will be used
as the center o rotation when the Costume is rotated on the Stage.
Click the Zoom buttons (in or out) to increase or decrease the view magnication o the Canvas.
When the zoom is greater than 100%, scroll bars are used to pan around the Canvas. Zoom does
not change the size o the image.
Click on the Import button to open an image rom le and add it to the Canvas.
Click the Clear button to remove all content rom the Canvas.
o change the size o the Canvas content, or just the current selection, click on the Scale buttons
(grow or shrink). You can Shit+click on the buttons to enter a precise value. Shrinking decreases
the size and resolution o the image.
o rotate the Canvas content, or just the current selection, click on the Rotate buttons (counter-
clockwise or clockwise). You can Shit+click on the buttons to enter a precise value.
o fip the Canvas content, or just the current selection, click on the Flip buttons (horizontal or
vertical).
I you make a mistake, you can click the Undo button repeatedly to undo the last several actions.
I you change your mind, you can click the Redo button to restore the undone actions.
-
8/6/2019 Scratch Reference Guide
10/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
10
3. SCRATCH BlOCkS
TyPES OF BlOCkSTere are three main types o blocks in the Blocks Palette:
Stack Blocks: Tese 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 rom 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: Tese blocks have rounded tops, such as . Tese blocks are placed
at the tops o stacks. Tey wait or an event to happen, such as a key being pressed, then
run the blocks underneath them.
Reporters: Tese blocks, such as and , are designed to t in the input
area o other blocks. Reporters come in two shapes, and t only into holes o the same
shape. Reporters with rounded ends (such as ) report numbers and t inside blocks
with rounded holes (such as ). Reporters with pointed ends (such as )
report boolean values (true or false) and t inside blocks with pointed holes (such as ).
Some reporter blocks have a check box next to them, such as . I you click in the checkbox, a monitor appears on the stage, displaying the current value o the reporter. As the value
o the reporter changes, the monitor updates automatically. A monitor can display the value o
the reporter in several dierent ormats:
a small readout with the name o the reporter
a large readout without any name
a slider that allows you to manipulate the value
o the reporter (available only or variables)
Double-click or right-click on the monitor to change rom one ormat to another.
Te slider ormat is available only or user-created variables. Right-click on the monitor in slider
ormat to adjust its minimum and maximum values.
-
8/6/2019 Scratch Reference Guide
11/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
11
BlOCk DESCRIPTIONSTe Scratch blocks are organized into eight color-coded categories: motion, looks, sound, pen, control,
sensing, numbers, and variables.
motion
Moves sprite orward or backward.
Rotates sprite clockwise.
Rotates sprite counterclockwise.
Points sprite in the specied direction. (0=up, 90=right,
180=down, -90=et)
Points sprite toward mouse-pointer or another sprite.
Moves sprite to specied x and y position on Stage.
Moves sprite to the location o the mouse-pointer
or another sprite.
Moves sprite smoothly to a specied position over
specied length o time.
Changes sprites x-position by specied amount.
Sets sprites x-position to specied value.
Changes sprites y-position by specied amount.
Sets sprites y-position to specied value.
urns sprite in opposite direction when sprite touches
edge o Stage.
Reports sprites x-position. (Ranges ro -240 to 240)
Reports sprites y-position. (Ranges ro -180 to 180)
Reports sprites direction. (0=up, 90=right, 180=down, -90=et)
-
8/6/2019 Scratch Reference Guide
12/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
12
loos
Changes sprites appearance by switching to dierentcostume.
Changes sprites costume to next costume in the cos-
tume list. (I at end o the costue ist, jups bac to rst costue.)
Reports sprites current costume number.
Changes Stages appearance by switching to a dierentbackground.
Changes Stages background to next background in
the background list.
Reports Stages current background number.
Displays sprites speech bubble or speciiedamount o time.
Displays sprites speech bubble.(you can reove speechbubbe b running this boc without an text.)
Displays sprites thought bubble or speciedamount o time.
Displays sprites thought bubble.
Changes a visual eect on a sprite by specied amount.(Use pu-down enu to choose efect.)
Sets a visual eect to a given number.(most visua efectsrange ro 0 to 100.)
Clears all graphic eects or a sprite.
Changes sprites size by specied amount.
Sets sprites size to specied % o original size.
Reports sprites size, as % o original size.
Makes sprite appear on the Stage.
-
8/6/2019 Scratch Reference Guide
13/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
13
Makes sprite disappear rom the Stage. (When sprite ishidden, other sprites cannot detect it with touching? boc.)
Moves sprite in ront o all other sprites.
Moves sprite back a specied number o layers, so thatit can be hidden behind other sprites.
Sound
Starts playing a sound, selected rom pull-down menu,and immediately goes on to the next block even assound is still playing.
Plays a sound and waits until the sound is nishedplaying beore continuing with next block.
Stops playing all sounds.
Plays a drum sound, selected rom pull-down menu,orspecied number o beats.
Plays a musical note (higher nubers or higher pitches) orspecied number o beats.
Sets the type o instrument that the sprite uses orplay noteblocks. (Each sprite has its own instruent.)
Changes sprites sound volume by specied amount.
Sets sprites sound volume to specied value.
Reports sprites sound volume.
Changes sprites tempo by specied amount.
Sets sprites tempo to specied value in beats per min-ute.
Reports sprites tempo in beats per minute.
-
8/6/2019 Scratch Reference Guide
14/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
14
Pen
Clears all pen marks and stamps rom the Stage.
Puts down sprites pen, so it will draw as it moves.
Pulls up sprites pen, so it wont draw as it moves.
Sets pens color, based on choice rom color picker.
Changes pens color by specied amount.
Sets pens color to specied value. (pen-coor=0 at red end o
rainbow, pen-coor=100 at bue end o rainbow)
Changes pens shade by specied amount.
Sets pens shade to specied amount. (pen-shade=0 is verdar, pen-shade=100 is ver ight)
Changes pens thickness.
Sets pens thickness.
Stamps sprites image onto the Stage.
Contro
Runs script below when green fag is clicked.
Runs script below when specied key is pressed.
Runs script below when sprite is clicked.
Waits specied number o seconds, then continueswith next block.
Runs the blocks inside over and over.
Runs the blocks inside a specied number o times.
-
8/6/2019 Scratch Reference Guide
15/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
15
Sends a message to all sprites, triggering them to do
something, and waits until they all nish beore con-
tinuing with next block.
Sends a message to all sprites, then continues with thenext block without waiting or the triggered scripts.
Runs script below when it receives specied broadcast
message.
Continually checks whether condition is true; when-
ever it is, runs the blocks inside.
I condition is true, runs the blocks inside.
I condition is true, runs the blocks inside the ifpor-
tion; i not, runs the blocks inside the else portion.
Waits until condition is true, then runs the blocks
below.
Checks to see i condition is true; i so, runs blocks
inside and checks condition again. I condition is not
true, goes on to the blocks that ollow.
Stops the script.
Stops all scripts in all sprites.
-
8/6/2019 Scratch Reference Guide
16/17REFERENCE GUIhttp://scratch.it.edu
REFERENCE GUIDE
16
Sensing
Reports the x-position o mouse-pointer.
Reports the y-position o mouse-pointer.
Reports true i mouse button is pressed.
Reports true i specied key is pressed.
Reports true i sprite is touching specied sprite, edge,or mouse-pointer. (Seected ro pu-down enu.)
Reports true i sprite is touching specied color. (Cic on
coor patch, then use eedropper to seect coor.)
Reports true i rst color (within sprite) is touchingsecond color (in background or another sprite). (Cic oncoor patch, then use eedropper to seect coor.)
Reports distance rom the specied sprite ormouse-pointer.
Sets the timer to zero.
Reports the value o the timer in seconds. (The tier isawas running.)
Reports a property or variable o another sprite.
Reports the volume (rom 1 to 100) o sounds detectedby the computer microphone.
Reports true i computer microphone detects a soundvolume greater than 30 (on scale o 1 to 100).
Reports the value o specied sensor. To use this boc, ouneed to have a Scratch Board connected to our coputer. See http://
scratch.it.edu/scratchboard
Reports true i specied sensor is pressed. To use thisboc, ou need to have a Scratch Board connected to our coputer.See http://scratch.it.edu/scratchboard
-
8/6/2019 Scratch Reference Guide
17/17
REFERENCE GUIDE
Nubers
Adds two numbers.
Subtracts second number rom rst number.
Multiplies two numbers.
Divides rst number by second number.
Picks a random integer within the specied range.
Reports true i rst number is less than second.
Reports true i two numbers are equal.
Reports true i rst number is greater than second.
Reports true i both conditions are true.
Reports true i either condition is true.
Reports true i condition is alse; reports alse i
condition is true.
Reports result o selected unction (abs, sqrt, sin, cos, tan,
asin, acos, atan, n, og, e^, 10^)applied to specied number.
Reports remainder rom division o rst number bysecond number.
Reports closest integer to a number.
Variabes
Allows you to create and name a new variable. When oucreate a variabe, three bocs are created autoatica (see beow). you
can choose whether the variabe is or a sprites (goba) or just or onesprite (oca).
Deletes all three blocks associated with the variable.
Changes variable by specied amount.
Sets variable to specied number.
Reports value o variable.