Catalog / Scratch Programming Cheatsheet

Scratch Programming Cheatsheet

A quick reference guide to Scratch, a visual programming language for creating interactive stories, games, and animations. This cheatsheet covers essential blocks, concepts, and best practices.

Motion Blocks

Basic Movement

move (10) steps

Moves the sprite forward by the specified number of steps. Use negative values to move backward.

turn (↻ 15) degrees

Rotates the sprite clockwise by the specified number of degrees.

turn (↺ 15) degrees

Rotates the sprite counter-clockwise by the specified number of degrees.

go to (random position)

Moves the sprite to a random location on the stage.

go to x:(0) y:(0)

Moves the sprite to the specified x and y coordinates.

glide (1) secs to x:(0) y:(0)

Smoothly animates the sprite moving to the specified x and y coordinates over the given number of seconds.

Direction and Rotation

point in direction (90)

Sets the sprite’s direction to the specified angle (0=up, 90=right, 180=down, -90=left).

point towards (mouse-pointer)

Points the sprite towards the mouse pointer or another sprite.

change x by (10)

Changes the sprite’s horizontal position by the specified amount.

set x to (0)

Sets the sprite’s horizontal position to the specified value.

change y by (10)

Changes the sprite’s vertical position by the specified amount.

set y to (0)

Sets the sprite’s vertical position to the specified value.

Edge Bouncing

if on edge, bounce - If the sprite is touching the edge of the stage, it will reverse its direction.

Looks Blocks

Speech and Thought

say (Hello!) for (2) seconds

Displays a speech bubble with the specified text for the given duration.

say (Hello!)

Displays a speech bubble with the specified text indefinitely.

think (Hmm...) for (2) seconds

Displays a thought bubble with the specified text for the given duration.

think (Hmm...)

Displays a thought bubble with the specified text indefinitely.

Costumes and Backdrops

switch costume to (costume1)

Changes the sprite’s appearance to the specified costume.

next costume

Switches to the next costume in the sprite’s costume list.

switch backdrop to (backdrop1)

Changes the stage’s background to the specified backdrop.

next backdrop

Switches to the next backdrop in the stage’s backdrop list.

Effects

change [color v] effect by (25)

Changes the specified visual effect (color, fisheye, whirl, pixelate, mosaic, brightness, ghost) by the given amount.

set [color v] effect to (0)

Sets the specified visual effect to the given value.

clear graphic effects

Removes all visual effects applied to the sprite.

change size by (10)

Changes the sprite’s size by the specified amount.

set size to (100) %

Sets the sprite’s size to the specified percentage.

Visibility

show

Makes the sprite visible.

hide

Hides the sprite from view.

go to [front v] layer

Moves the sprite to the front or back layer, controlling its stacking order.

Control Blocks

Events

when [green flag v] clicked

Starts the script when the green flag is clicked.

when this sprite clicked

Starts the script when the sprite is clicked.

when [space v] key pressed

Starts the script when the specified key is pressed.

when backdrop switches to [backdrop1 v]

Starts the script when the backdrop changes to the specified backdrop.

when [loudness v] > (10)

Starts the script when the loudness (from the microphone) exceeds the specified threshold.

when I receive [message1 v]

Starts the script when a broadcast message is received.

Loops

wait (1) seconds

Pauses the script execution for the specified number of seconds.

repeat (10)

Executes the blocks inside the loop the specified number of times.

forever

Executes the blocks inside the loop indefinitely.

if <(true)> then

Executes the blocks inside the if block only if the condition is true.

if <(true)> then ... else

Executes the blocks inside the if block if the condition is true; otherwise, executes the blocks inside the else block.

wait until <(true)>

Pauses the script execution until the specified condition is true.

repeat until <(true)>

Executes the blocks inside the loop until the specified condition is true.

Stopping Scripts

stop [all v]

Stops the specified scripts (all, this script, other scripts in sprite).

create clone of [myself v]

Creates a clone of the sprite.

delete this clone

Deletes the current clone.

Broadcasting

broadcast [message1 v]

Sends a message to all sprites and the stage without waiting for a response.

broadcast [message1 v] and wait

Sends a message and pauses the script execution until all receiving scripts have finished running.

Sound and Pen Blocks

Sound Blocks

play sound [Meow v] until done

Plays the specified sound and waits until it finishes before continuing the script.

start sound [Meow v]

Starts playing the sound without waiting for it to finish.

stop all sounds

Stops all currently playing sounds.

change volume by (-10)

Changes the volume by the specified amount.

set volume to (100) %

Sets the volume to the specified percentage.

change tempo by (20)

Changes the tempo (speed) of the music by the specified amount.

set tempo to (60) bpm

Sets the tempo to the specified beats per minute.

Pen Blocks

erase all

Clears all pen drawings from the stage.

pen down

Starts drawing when the sprite moves.

pen up

Stops drawing when the sprite moves.

set pen color to (#FF0000)

Sets the pen color to the specified RGB value.

change pen color by (10)

Changes the pen color by the specified amount.

set pen size to (1)

Sets the pen size to the specified value.

change pen size by (1)

Changes the pen size by the specified amount.