0% found this document useful (0 votes)
2K views

Scratch Blocks Explained

The document describes various blocks in Scratch related to sprite movement, rotation, teleportation, graphic effects, costumes, backdrops, sounds, pen tools, and variables. It explains what each block does, such as moving the sprite by a number of steps, rotating the sprite to a certain degree, changing costumes and backdrops, playing sounds, changing graphic effects, and drawing with the pen. It also includes blocks for detecting sprite attributes and controlling variables and lists.

Uploaded by

Alexa Fazzini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Scratch Blocks Explained

The document describes various blocks in Scratch related to sprite movement, rotation, teleportation, graphic effects, costumes, backdrops, sounds, pen tools, and variables. It explains what each block does, such as moving the sprite by a number of steps, rotating the sprite to a certain degree, changing costumes and backdrops, playing sounds, changing graphic effects, and drawing with the pen. It also includes blocks for detecting sprite attributes and controlling variables and lists.

Uploaded by

Alexa Fazzini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Move the sprite by a number of steps in the

current direction it is pointed (1 step = 1 pixel).


Change the X/Y coordinate of the sprite by the
specified value. A positive X value moves
(teleports) the sprite to the right, and negative X
Rotate the sprite to 15 degrees clockwise. move it to the left. A positive Y value moves the
sprite up, and a negative Y moves it down.

Rotate the sprite to 15 degrees counterclockwise.

Rotate the sprite in the specified direction:


0 is up. 180 is down. 90 is right. 270 is left.

Rotate sprite toward mouse or another sprite.


Select the sprite from the drop-down list.

Move (teleport) the sprite to the specified X and A very important block! This block allows the
Y coordinates using the center of the sprite. sprite to hit the window border (edge) and
Using this block is equal to two blocks: "Set X to" continue moving in a new direction.
and "Set Y to" simultaneously.

The rotation changes the style of the sprite.


There are three types of rotation: right-left, do
not rotate, all around.
Move (teleport) the sprite to the specified X or Y
coordinates using the center of the sprite.

These blocks return the current value of a sprite’s


X/Y coordinate. They are for receiving data from
Move (teleport) the sprite to the mouse or the a program; they can be inserted into other blocks
location of another sprite. The center of the to check and/or change the X/Y coordinates of a
sprite will be at the tip of the mouse cursor. sprite. These block, as well as all oval blocks, can
use both numbers and variables.

Move smoothly to the specified location, over a


This block is for receiving data from a program. It
set time. To move quickly, use decimal numbers.
returns the current direction of the sprite in
For example, 0.25 is a quarter-second, 0.5 is a
degrees. 0=up. 180=down. 90=right. 270=left.
half second, and 0.1 is one-tenth of a second.
The sprite will display the words in a speech
bubble for a specified number of seconds.

The sprite will display the words in a speech


bubble until it’s told to say something else.

The sprite will display the words in a thought


bubble for a specified number of seconds.

The graphic effect will be change to the specified


The sprite will display the words in a thought value. 0 is off (no effect).
bubble until it’s told to say something else.

All graphic effects will be deleted. The sprite will


Make the sprite visible (show) or invisible (hide). be converted to its original look.

The sprite will change its current costume to a Change the size of the sprite to the specified
costume, selected from the drop-down list. percent. In this case, 10 %.

Sprite will change to the next costume. Set the size of the sprite as a percentage of the
original size.

The current backdrop scene changes to a


backdrop, selected from the drop-down list.
Move the sprite to the top layer (front of stage).

The scene backdrop will be changed to the next


Move the sprite back a number of layers behind it.
backdrop.

The graphic effect will be changed by the given


value (positive = more, negative = less). These blocks detect sprite and backdrop attributes
Graphic effects include: and can be inserted into other blocks.
Start to play a specified sound and then move to Choose from one of 21 different musical
the next block. instruments by using the drop-down list.
1. Piano 12. Flute
2. Electric Piano 13. Wooden Flute
3. Organ 14. Bassoon
4. Guitar 15. Choir
Play the specified sound from the sounds library to 5. Electric Guitar 16. Vibraphone
completion. Then, it moves onto other blocks. 6. Bass 17. Music Box
7. Pizzicato 18. Steel Drum
8. Cello 19. Marimba
9. Trombone 20. Synth Lead
10. Clarinet 21. Synth Pad
11. Saxophone
Silence! Stops all sounds.

Play the drum for a number or fraction of beats. In


the drop-down list, select one of eighteen drums. Change the volume by the specified percentage.
In this case, 10% quieter. Change adds the
specified number to the current volume.

Wait (rest) for a number or fraction of beats.

Set the required volume level, as a percentage of


system level. Set ignores what the current value of
Play the note for a number or fraction of beats. the variable was before and sets a new value.
Either type in a number or press a key on the
virtual piano. 60 = “Middle C.” Adding or
subtracting 1 = moving 1 “half step.” To move
This block detects the current loudness as a
up/down an octave, add/subtract 12.
percentage. It can be used as a variable.

Change the tempo beat by a specified number of


beats per minute.

Set the tempo at a specified number of beats per


minute (bpm).

This block detects the current tempo as a number


of beats per minute. It can be used as a variable.
The PEN is a Scratch feature that allows a sprite
to draw lines and shapes and plot colored pixels.
When the pen is down, any movement the sprite
Change the pen shade by a specified percent.
makes is traced with the pen.

Set the pen shade to a specified percent. The


Clears (erases) all pen drawings from the stage. default is 50 (set color), but can range from 0
(completely black) to 100 (completely white):
0 --------------------------- 50 --------------------------- 100

Print a “stamp” or an image of the sprite as it looks


now, on the stage. The stamp remains on the
stage, even if the background changes.
Change the pen size (width) by a number of pixels.

Place the pen in the “draw” position. After this


command, all actions with a pen will be
Set the pen size (width) to a specific number of
accompanied by a line on a stage.
pixels. Pen sizes range from 0 to 255:
0 ----------------- 125 ---------------- 255

Move the pen up from the stage so it will not draw


lines as the sprite moves.

Set the pen color. To use the eyedropper tool, first


click the colored square and then click anywhere
in Scratch that has the desired color.

Change the pen color by a specified amount. The


change of color is the same as "color effect".

To draw a square using the pen:


Set the pen color in according to the table:
0 -------------------------- 100 --------------------------- 200
variable: a placeholder for a piece
of information that can change

Blocks of variables are not visible until you create Blocks of lists are not visible until you create a list
a variable with the “Make a Variable” button. Use with the “Make a List” button. Use descriptive
descriptive names, like score, lives, and length. names, like items, names, and answers.

This is a list. If checked, it is


This is the variable itself. In this case, it is named shown on the stage:
“a.” When used in a program, this oval block
returns the current value of the variable.

If the variable is checked, its value will be


displayed on the stage:
Add one more item to the list. The list item can be
either numerical or text.

Set variable value. Value can be any type, Delete an item from list.
numerical or text. It is possible to choose any
variable by means of the drop-down menu.

Insert an item into the list at a specific order


(number), thus all items will be offset. Inserted
Change variable value by a specified number (for value can be either numerical or text.
example, add one to the score variable in a game).
It is possible to choose any variable by means of
the drop-down menu. Use numbers only. A text
value will cause a “NaN” error. Replace a specific item in a list, thus all subsequent
elements will be unchanged.

This block returns the current value of the item in


the list with the specified order/number.
The variable will be shown on the screen, and a
checkmark appears.

This block returns the length of the list, which is


the number of items it includes.

The variable will be hidden and the checkmark will This is a logic value. It assigns the value "true" if
be removed. the list includes an item with the specified value.

The list will be shown on the screen and checked


(show list) or hidden and unchecked (hide list).
event: an action that causes something
to happen (like a button or trigger)

A BROADCAST is a message that is sent through


the Scratch program, activating receiving scripts.
Broadcast messages are “behind the scenes” cues
that allow sprites to communicate directly with
This block starts (triggers) a script of blocks. It each other and the stage. These communications
starts whenever the green flag is clicked. You will are invisible and silent triggers that allow the
use this block a lot! action of one sprite to start the action of another.

This block starts (triggers) a script of blocks when a


This block starts (triggers) a script of block when it
key is pressed. You can specify A – Z, 0 – 9, space,
receives a specific broadcast message.
arrow keys, or any key.

This block sends a broadcast message.

This block starts (triggers) a script when this sprite


is clicked.
This block sends a broadcast message and waits to
continue running the scripts until other sprites run
the scripts waiting for the broadcast messages.
This block starts (triggers) a script when the After these run, the scripts continue.
background switches to a specific backdrop.
To learn how broadcast messaging works,
write the following scripts for the cat:

This block starts (triggers) a script when the


microphone detects a particular level of loudness
(range: 0 to 100). By clicking the drop-down menu,
you can also select a timer (number of seconds) or
video motion (range: 0 to 100) as trigger.

By pressing "space" key, the first script will send the


message ("meow"), and it waits for the second script.
The second script runs, causing the cat to say “Meow!”
for two seconds. After the cat meows, the first script
continues running, and it hides the cat.

See example projects that use broadcast messages


at http://scratch.mit.edu/studios/202853/.
Then, try to code your own joke or story project
by creating your own project in Scratch.
The script will pause (wait) for the specified
number of seconds. You can use decimals for
shorter lengths of time (0.5 = half second). This loop repeatedly executes (runs) the code
inside until the condition in block heading
becomes true. Then, it will stop running.

This loop block tells a sprite to execute (run) the


code inside the block over and over again a
specified number of times.

This block stops scripts from running. It works like


a “quit” or “exit” button. From the drop-down
menu, select whether to stop all scripts, a
particular (this) script, or all scripts for a sprite.
This loop block tells a sprite to execute (run) the
code inside the block over and over again forever
CLONING is a feature that allows a sprite to
(all the time).
create duplicates of itself while the project is
running. Clones are copies of a sprite with their
own separate scripts. They inherit the original
scripts, costumes, sounds, and properties from the
original (parent) sprite.

This conditional block checks a logical test (if


something is true. It only executes (runs) the code
inside if the condition in the block heading (top
line) is true. If not, it skips the code inside. This block runs scripts when a clone is created. It
only runs in the newly created clone, not previous
clones or the parent clone.

This block will clone the sprite it runs in. The drop-
down menu allows you to select other sprites.

This conditional block executes (runs) the code


inside the first space if the condition in the block
heading (top line) is true. If not, it executes the This block deletes the clone it runs in.
code in the second space (the “else” part).
loop: the action of doing something
over and over again
This block stops scripts from running (waits) until conditional: a statement that only
the condition inside becomes true. If it is already runs under certain conditions or
true, there is no pause or wait.
situations
Check if a sprite or clone is touching another Measure the X and Y coordinates of the mouse
sprite, the mouse cursor, or the edge of the stage. cursor.

Check if a sprite is touching a particular color. The Measure the volume from the microphone input.
color can be selected with the eyedropper tool by Range: 0 to 100.
clicking the colored square and then clicking the
desired color. If the sprite is the same color, the
sensor accepts the value “true.” Turn video sensing on, off, or on-flipped (video is
flipped horizontally).

Check if one color is touching another color. These


colors can be selected using the eyedropper tool.
Set the transparency of the video output. 0 is
completely opaque. 100 is completely transparent
(see through).
Calculate the distance (in pixels) from the current
sprite to another sprite chosen from the drop-
down menu, or to mouse pointer.
Measure the number of motions from the video
sensing on a particular sprite or on the stage. You
can also measure direction, instead of motion.
Display a question (e.g., “What’s your name?”),
and wait for the user to respond before continuing
the script. To answer, the user will type a response Measure the number of seconds elapsed.
and click Enter.

Reset the timer. Assign 0 seconds to the timer.

This variable stores the value entered by user from


the “ask” block input.

Measure different sprite attributes.


Check if a particular key is pressed. You can specify
A – Z, 0 – 9, space, arrow keys, or any key.
Measure the number current date and time, or
the number of days passed since the year 2000.

Check if the (left) mouse button is clicked.

Retrieve and store the username from the current


Scratch user.
This rounding operator removes the remainder
from a division problem. It returns an integer
number without any fraction.
Add, subtract, multiply, or divide numbers and/or
variables. You can put these blocks inside other Returns the square root of a
blocks, and inside each other. number or variable.
Other math functions are
available from the drop-
down menu:
Pick a random number in a specified range.  abs = absolute value
 floor = round down
 ceiling = round up
less than
 sqrt = square root
 sin = sine
equal to  cos = cosine
 tan = tangent
greater than  asin = arcsine
Check for equivalence or relative value. Type in  acos = arcosine
numbers, or add in variables. Use with control  atan = arctangent
blocks to make logic tests.  ln = natural log
 log = logarithm
 e^ = ex
 10^ = 10x
Checks whether both conditions are true.

Checks whether either one of the conditions (or


more than one) is true.

Checks if the condition is false.


More Blocks allows you to build your own blocks,
or functions, that you can use again and again.
No blocks will appear, until you create them.
Join two text (or number) strings together.

Return a character with the specified number from


a text string. In this case, “w.”
Build, or define, your custom block. The script
under this heading block will execute every time
the custom block is run.
Measure the length of the text (or number) string.
Return the number of letters or characters.
Runs custom block code.

function: a piece of code that you


This modulo (modulus) operator reports the
remainder of a division operation.
can easily call over and over again
KEY VOCABULARY
 abstraction: Pulling out specific differences to make one solution work for multiple problems.
 algorithm: A set of instructions that can be performed with or without a computer.
 backdrop: One out of possibly many frames, or backgrounds, of the Stage.
 backpack: A Scratch feature that can be used to conveniently transfer media and/or scripts between
projects.
 broadcast: A message that is sent through the Scratch program, activating receiving scripts.
 cloning: A Scratch feature that allows a sprite to create duplicates of itself while the project is
running. Clones are copies of a sprite with their own separate scripts.
 computer science: A field in which people use the power of computers to solve big problems.
 conditionals: A statement that only runs under certain conditions or situations. The computational
concept of making decisions based on conditions (e.g., current variable values).
 costume: One out of possibly many “frames” or alternate appearances of a sprite. A sprite can
change its look to any of its costumes.
 debugging: Finding and fixing errors (bugs) in programs.
 events: The computational concept of one thing causing another thing to happen.
 function: A piece of code that you can easily call over and over again.
 loops: The computational concept of running the same sequence multiple times.
 operators: The computational concept of supporting mathematical and logical expressions.
 paint editor: Scratch's built-in image editor. Many Scratchers create their own sprites, costumes, and
backdrops using it.
 pair programming: A programming methodology in which developers pair up and work side-by-side
on a project. The driver controls the computer, and the navigator provides guidance.
 parallelism: The computational concept of making things happen at the same time.
 persistence: Trying again and again, even when something is really hard.
 project editor: A feature of the Scratch online community that allows projects to be modified. This
includes the script area (where scripts are assembled), the sprite area (where sprites can be
manipulated), and the stage area (where sprites are positioned and backgrounds can be accessed).
 program: An algorithm that had been coded into something that can be run by a machine.
 remix: A creative work that is derived from an original work. A remix typically introduces new
content or stylistic elements, while retaining a degree of similarity to the original work.
 scripts: One or more Scratch blocks connected together to form a sequence. Scripts begin with an
event block that responds to input (e.g., mouse click, broadcast). When triggered, additional blocks
connected to the event block are executed one at a time.
 sensing: One of the ten categories of Scratch blocks. They are color-coded light-blue, and are used to
detect different forms of input (e.g., mouse position) or program state (e.g., sprite position).
 sequence: The computational concept of identifying a series of steps for a task.
 sprite: A media object that performs actions on the stage in a Scratch project.
 stage: The background of a Scratch project. The stage can have scripts, backdrops (costumes), and
sounds, similar to a sprite.
 studio: A user-created gallery in the Scratch online community that can be used to highlight projects
contributed by one or many users.
 testing and debugging: The computational practice of making sure things work – and finding and
solving problems when they arise.
 tips window: Built directly into the Project Editor, the Tips Window is a form of getting help.
 variables and lists: A changeable value or collection of values recorded in Scratch’s memory.
Variables can store one value at a time, while lists can store multiple values.
 video sensing: A Scratch feature that makes use of video from a webcam to detect motion or display
video input on the stage.

You might also like