This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. |
- This article or section documents an outdated version of Scratch (version 1.4). For this article in the current version (version 3.0), see Blocks (3.0). For this article in Scratch 2.0, see Blocks (2.0).
- This article is about the programming blocks. For other uses, see Blocks (disambiguation).
Blocks are puzzle-piece shapes that are used to create code in Scratch. The blocks connect to each other like a jigsaw puzzle, where each data type (event, command, reported value, reported boolean, or script end) has its own shape and a specially shaped slot for it to be inserted into — this prevents syntax errors. Series of connected blocks are called scripts.
There were ten categories of blocks: Control, Motion, Looks, Sound, Pen, Sensing, Operators, Variables, List and Motor (although there were some other categories and blocks in some Scratch modifications). Only eight were shown at the top.
In total, there were four hat blocks, six C blocks, twenty-six reporter blocks, thirteen Boolean blocks, two cap blocks and seventy-five stack blocks.
Block Shapes
There were six different block shapes: Hat, Stack, Boolean, Reporter, C and Cap.
Hat Blocks
- Main article: Hat Block
Hat blocks were the blocks that start every script. They were shaped with a rounded top and a bump at the bottom — this is so you could only place blocks below them. There were four Hat blocks, and they could be found in the Control category.
Stack Blocks
- Main article: Stack Block
Stack blocks are the blocks that perform the main commands. They are shaped with a notch at the top and a bump on the bottom — this is so blocks can be placed above and below them. There are 75 Stack blocks — the most common block shape.
Boolean Blocks
- Main article: Boolean Block
Boolean blocks are the conditions — they are either true or false. It is like asking your friend: "Does 2 + 2 = 4?", and they would either tell you "Yes" or "No". With a hexagonal shape, there are 13 of these blocks.
Reporter Blocks
- Main article: Reporter Block
Reporter blocks are the values. Reporter blocks can hold numbers and strings. It is like asking a friend, for example, "What is 2 + 2?", and they would answer "4". It isn't just equations however, it can report a variable, for example, "What is a random number". They may answer: "15". Shaped with rounded edges, there are 26 of these blocks — not counting the theoretically infinite amount of Reporter blocks that can be made for each variable and list.
C Blocks
- Main article: C Block
C blocks are blocks that are made up of "C's". Also known as "Wrap blocks", these blocks loop the blocks within the Cs or check if a condition is true. There are six C blocks, and they can be found in the Control category. C blocks can be bumped at the bottom, or capped.
Cap Blocks
- Main article: Cap Block
Cap blocks are the blocks that stop scripts. They are shaped with a notch at the top and a flat bottom — this is so you cannot place any blocks below them. There are two Cap blocks, and they can both be found in the Control category.
List of Blocks
There are 128 blocks in Scratch 1.4.
Motion Blocks
- Main article: Motion Blocks
Motion blocks are the blocks that control a sprite's movement. There are 16 Motion blocks in Scratch 1.4.
Scratch 1.4 has the following thirteen Motion Stack blocks:
move () steps
— Moves the sprite forward the amount of steps.turn cw () degrees
— Turns the sprite (clockwise) the specified amount.turn ccw () degrees
— Turns the sprite (counter-clockwise) the specified amount.point in direction ( v)
— Points the sprite in the direction.point towards [ v]
— Points the sprite towards the mouse-pointer or another sprite.go to x:() y:()
— Moves the sprite to the specified X and Y position.go to [ v]
— Moves the sprite to the mouse-pointer or another sprite.glide () secs to x:() y:()
— Glides the sprite to the location, taking as long as the specified amount of time.change x by ()
— Changes the sprite's X position by the amount.set x to ()
— Sets the sprite's X position to the amount.change y by ()
— Changes the sprite's Y position by the amount.set y to ()
— Sets the sprite's Y position to the amount.if on edge, bounce
— If touching the edge of the screen, the sprite's direction flips over.
Scratch 1.4 has the following three Motion Reporter blocks:
(x position)
— The X position of the sprite.(y position)
— The Y position of the sprite.(direction)
— The direction of the sprite.
Motor Blocks
- Main article: Motor Blocks
Motor blocks are extra Motion blocks that are used with the LEGO Education WeDo Robotics Kit. There are five of these blocks, and they are only available in Scratch 1.4.
Scratch 1.4 has the following five Motor Stack blocks:
motor on for () secs:: #1b50b9
— Turns the motor on for the specified amount of time.motor on:: #1b50b9
— Turns the motor on.motor off:: #1b50b9
— Turns the motor off.motor power ():: #1b50b9
— Sets the motor's power to the amount.motor direction [ v]:: #1b50b9
— Sets the motor's direction to the amount.
Looks Blocks
- Main article: Looks Blocks
Looks blocks are the blocks that control a sprite's look. There are 20 Looks blocks in Scratch 1.4. Three of the 17 sprite Looks blocks have their stage analog.
Scratch 1.4 has the following seventeen Looks Stack blocks:
switch to costume [ v]:: looks
/switch to background [ v]:: looks
— Changes the sprite's/stage's costume/background to the specified one.next costume
/next background:: looks
— Changes the sprite's/stage's costume/background to the next one in the costume list.say [] for () secs
— A speech bubble appears over the sprite and stays for the specified amount of time.say []
— A speech bubble appears over the sprite and will not go away over time. It can be removed using say(), and defining no value.think [] for () secs
— A thought bubble appears over the sprite and stays for the specified amount of time.think []
— A thought bubble appears over the sprite and will not go away over time.change [ v] effect by ()
— Changes the specified effect by the amount.set [ v] effect to ()
— Sets the specified effect to the amount.clear graphic effects
— Clears all graphic effects on the sprite.change size by ()
— Changes the sprite's size by the amount.set size to ()%
— Sets the sprite's size to the amount.show
— Shows the sprite.hide
— Hides the sprite.go to front
— Puts a sprite in the front.go back () layers
— Changes the sprite's layer value by the amount.
Scratch 1.4 has the following three Looks Reporter blocks:
(costume #)
/(background #:: looks)
— The number of the sprite/stage's current costume/background in the list.(size)
— The sprite's size.
Sound Blocks
- Main article: Sound Blocks
Sound blocks are the blocks that control sound and MIDI functions. There are 13 Sound blocks in Scratch 1.4.
Scratch 1.4 has the following eleven Sound Stack blocks:
play sound [ v]
— Plays a sound without pausing the script.play sound [ v] until done
— Plays a sound and pauses the script until it finishes.stop all sounds
— Stops all playing sounds.play drum ( v) for () beats
— Plays the specified drum for the amount of beats.rest for () beats
— Pauses the script for the amount of time.play note ( v) for () beats
— Plays the note for the amount of beats.set instrument to ( v)
— Sets the instrument to the specified one.change volume by ()
— Changes the volume by the amount.set volume to ()%
— Sets the volume to the amount.change tempo by ()
— Changes the tempo by the amount.set tempo to () bpm
— Sets the tempo to the amount.
Scratch 1.4 has the following two Sound Reporter blocks:
Pen Blocks
- Main article: Pen Blocks
Pen blocks are the blocks that control the pen. There are 11 Pen blocks in Scratch 1.4.
Scratch 1.4 has the following eleven Pen Stack blocks:
clear
— Removes all pen marks put on the screen.pen down
— Puts the sprite's pen down.pen up
— Puts the sprite's pen up.set pen color to [#FF0000]
— Sets the pen color to the specified color shown on the picture.change pen color by ()
— Changes the pen color by the amount.set pen color to ()
— Sets the pen color to the amount.change pen shade by ()
— Changes the pen shade by the amount.set pen shade to ()
— Sets the pen shade to the amount.change pen size by ()
— Changes the pen size by the amount.set pen size to ()
— Sets the pen size to the amount.stamp
— Pens the sprite's image on the screen. Can be removed using clear.
Control Blocks
- Main article: Control Blocks
Control blocks are the blocks that control scripts. There are 16 Control blocks in Scratch 1.4.
Note: | In Scratch 2.0, the triggering blocks were seperated into a new category Events Blocks. |
Scratch 1.4 has the following four Control Hat blocks:
when gf clicked:: control
— When the flag is clicked, the script activates.when [ v] key pressed:: control
— When the specified key is pressed, the script activates.when Sprite1 clicked:: control hat
— When the sprite is clicked, the script activates.when I receive [ v]:: control
— When the broadcast is received, the script activates.
Scratch 1.4 has the following four Control Stack blocks:
wait () secs:: control
— Pauses the script for the amount of time.broadcast [ v]:: control
— Sends a broadcast throughout the Scratch program, activating When I Receive () blocks that are set to that broadcast.broadcast [ v] and wait:: control
— Like the Broadcast () block, but pauses the script until all scripts activated by the broadcast are completed.wait until <>:: control
— Pauses the script until the condition is true.
Scratch 1.4 has the following six Control C blocks:
forever:: control
— A loop that will never end.repeat ():: control
— A loop that repeats the specified amount of times.forever if <>:: control
— A loop that will always check the condition, like putting an If () block inside a Forever block.if <>:: control
— Checks the condition so that if the condition is true, the blocks inside it will activate.if <> { } else { }:: control
— Checks the condition so that if the condition is true, the blocks inside the first C will activate and if the condition is false, the blocks inside the second C will activate.repeat until <>:: control
— A loop that will stop once the condition is true.
Scratch 1.4 has the following two Control Cap blocks:
stop script:: control
— Stops the script.stop all @stopSign:: cap control
— Stops all scripts throughout the Scratch program.
Trigger Blocks
In the Experimental Viewer, all of the Hat Blocks and Broadcast blocks are in this section.
Sensing Blocks
- Main article: Sensing Blocks
Sensing blocks are the blocks that detect things. There are 17 Sensing blocks in Scratch 1.4.
Scratch 1.4 has the following two Sensing Stack blocks:
ask [] and wait
— An input box appears — you type the value in and it stores the value in the answer variable.reset timer
— Resets the timer.
Scratch 1.4 has the following seven Sensing Boolean blocks:
<touching [ v]?>
— The condition for checking if the sprite is touching the mouse-pointer or another sprite.<touching color [#FF0000]?>
— The condition for checking if the sprite is touching a specific color.<color [#FF0000] is touching [#FF0000]?>
— The condition for checking if a color on the sprite is touching a specific color.<mouse down?>
— The condition for checking if the mouse is down.key [ v] pressed?
— The condition for checking if the specified key is being pressed.<loud?:: sensing>
— The condition for checking if the microphone input is loud.<sensor [ v]?:: sensing>
— The condition for checking various input on a Sensor Board.
Scratch 1.4 has the following eight Sensing Reporter blocks:
(answer)
— The most recent input with the Ask () And Wait block.(mouse x)
— The mouse-pointer's X position.(mouse y)
— The mouse-pointer's Y position.(distance to [ v])
— The distance from the sprite to the mouse-pointer or another sprite.(timer)
— How much time has passed since the Scratch program was opened or the timer reset.([ v] of [ v])
— The X position, Y position, direction, costume, size or volume of the stage or a sprite.loudness
— How loud the noise is that the microphone is sensing.([ v] sensor value:: sensing)
— Various values for things with a Sensor Board — and other Scratch programs' variables with Mesh.
Operators Blocks
- Main article: Operators Blocks
Operators blocks are the blocks that perform math functions and string handling. There are 17 Operators blocks in Scratch 1.4.
Scratch 1.4 has the following six Operators Boolean blocks:
<[] < []>
— The condition for checking if a value is less than the other.<[] = []>
— The condition for checking if two values are equal.[] > []
— The condition for checking if a value is greater than the other.<<> and <>>
— Joins two conditions.<<> or <>>
— Joins two conditions, but they function separately.<not <>>
— Makes the condition checked if it is false, not true.
Scratch 1.4 has the following eleven Operators Reporter blocks:
(() + ())
— The value of the addition.(() - ())
— The value of the subtraction.(() * ())
— The value of the multiplication.(() / ())
— The value of the division.(pick random () to ())
— Picks a random number between the two limits.(join [] [])
— The two values put right next to each other.(letter () of [])
— The specified character of the value.(length of [])
— The length of the value.(() mod ())
— The remainder of the division.(round ())
— Rounds the value to the nearest whole number.([ v] of ():: operators)
— The absolute value (abs), square root (sqrt), sine (sin), cosine (cos), tangent (tan), asine (asin), acosine (acos), atangent (atan), natural logarithm (ln), logarithm (log), exponential function (e^), or base 10 exponential function (10^) of a specified value.
Right clicking some of the blocks will yield more choices of its type.
Variables Blocks
- Main article: Variables Blocks
Variables blocks are the blocks that hold values and strings. There are 5 Variables blocks in Scratch 1.4.
Scratch 1.4 has the following four Variables Stack blocks:
set [ v] to []
— Sets the specified variable to the amount.change [ v] by ()
— Changes the specified variable by the amount.show variable [ v]
— Shows the variable's Stage Monitor.hide variable [ v]
— Hides the variable's Stage Monitor.
Scratch 1.4 has the following Variables Reporter block:
(:: variables)
— The variable's value.
List Blocks
- Main article: List Blocks
List blocks are the blocks that manage lists. They are stored in the Variables category. There are eight List blocks in Scratch 1.4.
Scratch 1.4 has the following four List Stack blocks:
add [] to [ v]
— Adds an item to the list (the item goes at the bottom of the list of items) with the specified content in it.delete ( v) of [ v]
— Deletes the item of the list.insert [] at ( v) of [ v]
— Adds an item to the list (the item goes where you specify in the list of items) with the specified content in it.replace item ( v) of [ v] with []
— Replaces the item's content with the specified content.
Scratch 1.4 has the following 3 List Reporter blocks:
(:: list)
— The list's value.(item ( v) of [ v])
— The item's value.(length of [ v])
— How many items there are in the specified list.
Scratch 1.4 has the following List Boolean block:
<[ v] contains []>
— The condition for checking if an item's content is the specified text.
Scratch Block Plugin
- Main article: Block Plugin (2.0)
The Scratch Block Plugin allows blocks and scripts to be used in the Scratch Forums and Scratch Wiki, as well as other sites with the included Javascript. They look like this:
when flag clicked go to x: (0) y: (0) // center the sprite for the first stamp stamp forever set x to (pick random (-240) to (240)) stamp wait (0.2) secs change [color v] effect by (pick random (5) to (14)) end
These blocks were put in place on 27 January 2012 by JSO, a Community Moderator on the Scratch Forums. They were made to replace the "ancient" forum blocks, which had not been updated since the release of Scratch 1.2.