Jump to content

Scratch/Block Reference Guide

From Wikibooks, open books for an open world
Table of Blocks
Block picture Name Description Category Examples
move () steps Moves a sprite forward a specified amount of "steps" in the direction it is facing. Motion move (5) steps

move (7) steps move (2) steps

turn right () degrees Rotates the sprite clockwise a set amount of degrees. Motion turn right (20) degrees

turn right (3) degrees turn right (7) degrees

turn left () degrees Rotates the sprite counterclockwise a set amount of degrees. Motion turn left (30) degrees

turn left (12) degrees turn left (36) degrees

go to () Moves the sprite to the selected location. The location can be a random position, the mouse-pointer, or any sprite. Motion go to (mouse-pointer)

go to (Ground) go to (Arrow)

go to x: () y: () Jumps the sprite to the specified x and y coordinates. Motion go to x: (30) y: (50)

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

glide () secs to () Glides the sprite to the specified position in the specified amount of time. The location can be a random position, the mouse-pointer, or any sprite. Motion glide (2) secs to (mouse-pointer)

glide (0.5) secs to (Grass) glide (5) secs to (random position)

glide () secs to x: () y: () Glides the sprite to the specified x and y coordinates in the specified amount of time. Motion glide (2) secs to x: (-29) y: (23)

glide (10) secs to x: (9) y: (9) glide (0.5) secs to x: (16) y: (-100)

point in direction () Points the sprite in the specified direction. Motion point in direction (180)

point in direction (67) point in direction (-90)

point towards () Points the sprite towards the selected location. The location can be the mouse-pointer or any sprite. Motion point towards (cloud)

point towards (title text) point towards (mouse-pointer)

change x by () Changes the sprite's x coordinate by the specified amount. A positive change will move the sprite to the right while a negative change will move the sprite to the left. Motion change x by (-30)

change x by (60) change x by (32)

set x to () Sets the sprite's x coordinate to the specified value. Motion set x to (180)

set x to (-90) set x to (100)

change y by () Changes the sprite's y coordinate by the specified amount. A positive change will move the sprite up while a negative change will move the sprite down. Motion change y by (20)

change y by (-100) change y by (25)

set y to () Sets the sprite's y coordinate to the specified value. Motion set y to (34)

set y to (-68) set y to (122)

if on edge, bounce Checks if the sprite is on the edge of the stage. If it is, the sprite is "bounced" back into the stage to prevent it from going off the screen. If left-right rotation is enabled (see below block), the sprite will flip around to the other direction when it bounces. If all around rotation is enabled, the sprite will flip upside down and flip to the other direction when it bounces. Motion forever {

if on edge, bounce

}

if (x position < -200) {

if on edge, bounce

}

set rotation style [] Changes the rotation style of the sprite. The style can be left-right (the sprite can only face the left or right), don't rotate (the sprite is not able to rotate), or all around (the sprite can rotate to any direction). Motion forever {

set rotation style [all around]

}

() mod () Returns the remainder (modulo) after the first number is divided by the second. Operators (16) mod (7) = 2

(75) mod (34) = 7

(7) mod (2) = 1

(7) mod (3.3) = 0.3

(1) mod (0.3) = 0.1

add () to [] Adds the specified item to the specified list. Variables (Lists) add ("grapes") to [fruits]
If 'fruits' was the list:
apples
cherries
then 'fruits' would then be
apples
cherries
grapes

add ("16") to [squares]

If 'squares' was the list:
1
4
9
then 'squares' would then be
1
4
9
16
delete () of [] Removes the specified item from the specified list. Variables (Lists) delete (4) from [players]
If 'players' was the list:
1
4
8
10
then 'players' would then be
1
4
8

delete (3) of [words]

If 'words' was the list:
hide
jump
run
seek
then 'words' would then be
hide
jump
seek