Game On/Scratch Blocks

From Wiki -
Jump to navigation Jump to search

This is a list of blocks that are useful for Game On.



The block "move ____ steps" causes the sprite to move in the preset direction, a certain number of "steps". A typical noticeable motion is 5-10 steps.


The "turn ___ degrees left/right" blocks cause the sprite's direction to change in either direction, by a certain number of degrees.

Point Toward

The point toward block changes the sprite's direction to point toward a given object, or the mouse.

Point in Direction

This block sets the direction to a given value.

Go To

The "Go To" block sets the position of a sprite in a single block. It is the equivalent of a set X and set Y block combined.

Set X/Y

These blocks set X and Y coordinates individually.

Change X/Y

These blocks increment or decrement the X and Y values. Useful for speed-based advanced motion control.

If On Edge, Bounce

For randomly-moving objects, this block prevents them from collecting on the edges. It does what you would expect.



These blocks change the visibility of a sprite.

Switch Costume

Each sprite can have multiple costumes. This command changes the costume to any costume in the sprite's selection.

Switch Backdrop

The backdrop can be altered from any sprite's code. This block works like Switch Costume.

Change/Set Size

These blocks function to change the size of an object or set it.


Default Sounds

These can be accessed through the "Play Sound" block. There's a variety of soundbites. They must be downloaded from a menu in the Sounds tab.

Recorded Sounds

You can record your own sounds in the Sounds menu. Then, you can play them like default sounds.

Musical Notes and Drums

Scratch offers a musical note system, including volume and tempo controls. There are many drums and instruments which can play any note for any amount of time.


Local and Global Variables

When you first create a variable, you must decide whether it is particular to the sprite in which it is created, or global for the whole program. This cannot be changed!

Showing and Hiding Variables

You can reposition variable displays manually. Moreover, you can change their visibility using these blocks.

Changing and Setting

Scratch offers an assignment block (Set ____ To ____) and an increment/decrement block (Change ____ By ____). Each is fairly self-explanatory.


Flag Event

Any code that has as its header "When <green flag> is clicked" will execute as soon as the program starts.

Click Event

Any code that has as its header "When <this sprite/the backdrop> is clicked" will execute every time the object is clicked by the mouse.

Key Press Event

Any code that has that header will execute when the selected key is pressed.

Message Event and Broadcasts

Sprites can influence each other via broadcasting messages. New messages can be created, and then the sprites will respond the same way no matter who sends a given message.

Control Statements


Scratch offers two wait statements. One sleeps that block of code for a given amount of time. The other waits until a true/false statement becomes true.


Scratch has three loops:

Its forever loop will run until the program ends or a stop statement is reached.
Its repeat ___ times loop will run a set number of times.
Its repeat until loop will run until a certain condition is true.


Scratch offers a simple if-then as well as an if-then-else. These act as in other programming languages.


A stop statement can end all active code in any of the following:

  • All sprites and the backdrop
  • The current sprite
  • All other sprites


There are three clone blocks.

First, a sprite can create a clone of itself or any other sprite.
Second, a clone can delete itself, ending a clone block of code.
Third is the "when I start as a clone" header which is initiated for each new clone.



A sprite can ask if it is touching the mouse, the edge of the screen, or any other sprite (collision handling). It can also ask if it is touching a certain color. Thus, colors can gain significance beyond simple aesthetics.


A sprite can determine whether the mouse is pressed, as well as the mouse's location.


A sprite can determine the distance between it and any object/mouse.

Key Press

A sprite can determine if a given key is being pressed.

Other Sprites

The ____ of ____ offers sprites the opportunity to check on the state of other sprites, such as their position and costume.


Scratch offers a single timer which can be reset to 0 at any time. The sprites can see what time is on the timer.


The backdrop has a block "Ask ____" which gets text input from the user. This input can be accessed via the "answer" block.


Scratch offers the basic arithmetic operators, functions like sine, cosine, square root, and absolute value, boolean operators (and, or, and not), as well as some string functions.

DOs and DON'Ts

Don't: Say/Think

Don't use the say or think blocks on sprites, or the ask block on sprites. The word bubbles produced are unprofessional.

Do: Friction

The following block of code added to a motion loop will create a friction effect: set Speed to (Speed * 0.9)

Advanced Options

Trails with the Pen

Create a trail of any sprite's motion using the pen (green) blocks!

More Blocks

You can define procedures and functions using the Purple section. This can help your code organization.

Lists Mean Levels

Use a list (found under Variables) to define parameters for multiple levels of play.


Scratch can access the current day and time in the Sensing section.

Types of Sprite

The Message

This sprite has text as its costume. It delivers a message, such as winning or losing.

The Player

This sprite uses a forever loop to have continuous motion.

The Autonomous Sprite

This sprite needs to use blocks like If On Edge Bounce to avoid clumping on edges. Use clone to create many of these.

The Button

This sprite uses the Click event and broadcasting to cause major changes in the program.

The Master

An invisible sprite that does heavy processing. This is the core of the program. The backdrop can also take this role.