π§± What every block does
The blocks you will actually use, grouped the way Scratch groups them and coloured the way Scratch colours them. Keep this page open beside the editor.
Motion
Moving and turning a sprite
move 10 steps | goes forward in whatever direction it is pointing |
|---|---|
turn 15 degrees | rotates, clockwise or anticlockwise |
go to x: y: | jumps to an exact spot |
glide 1 secs to x: y: | slides there smoothly β the difference between a jump and an animation |
if on edge, bounce | turns around at the wall |
point in direction 90 | 90 is right, β90 is left, 0 is up |
Looks
Costumes, size, colour and speech
say Hello! for 2 secs | a speech bubble |
|---|---|
switch costume to | changes the drawing β two costumes swapped quickly is animation |
next costume | the simplest animation block there is |
change size by 10 | grows or shrinks |
change colour effect by 25 | the quickest way to make something look magical |
show / hide | makes a sprite appear and disappear |
Events
What starts a piece of code
when green flag clicked | the start of almost every program |
|---|---|
when space key pressed | keyboard control |
when this sprite clicked | makes anything into a button |
when I receive message1 | lets one sprite tell another what to do |
broadcast message1 | sends that message β the way scenes and levels are switched |
Control
Repeating, waiting and deciding
wait 1 seconds | the pause that makes timing possible |
|---|---|
repeat 10 | does something a fixed number of times |
forever | never stops β the heart of every game loop |
if β¦ then | does something only when a condition is true |
if β¦ then β¦ else | one thing or the other |
create clone of myself | makes a copy while the program runs β how you fire bullets or drop raindrops |
Sensing
Noticing the mouse, the keyboard and other sprites
touching Sprite1? | collision β the basis of every catching or dodging game |
|---|---|
touching colour? | how a maze game knows you hit a wall |
key space pressed? | checks a key inside a loop, which feels smoother than the event block |
ask β¦ and wait | gets typed input from the player |
answer | what they typed |
timer | counts seconds since the program started |
Operators
Sums, comparisons and text
+ β Γ / | arithmetic |
|---|---|
pick random 1 to 10 | the block that makes a game different every time |
< = > | comparisons, used inside if blocks |
and / or / not | combining conditions |
join apple banana | sticks two pieces of text together |
Variables
Remembering a number or a word
set score to 0 | always do this at the start, or yesterday's score stays |
|---|---|
change score by 1 | the scoring block |
show variable score | puts it on the screen |
add thing to list | a list remembers many values β high scores, questions, words |
item 1 of list | reads one of them |
My Blocks
Making your own block
define draw square | gives a name to a piece of code you use more than once |
|---|---|
draw square | runs it β the same idea as a function in Python or a method in Java |
Every block is documented in full on the Scratch Wiki β, which is where to look when you need the exact behaviour.