NEW Explore the Scratch Block Dictionary, tutorials, textbook, and classroom guides

Start learning →

set x to (0) — Scratch Block Guide

📌 What you will learn

Moves the sprite horizontally to a specific x coordinate while keeping its current y coordinate.

What this block does

Moves the sprite horizontally to a specific x coordinate while keeping its current y coordinate.

Perfect for Breakout/Pong paddles that track the mouse horizontally along a fixed height.

  • Category: Motion Blocks
  • Key tip: Use "set x" for snapping to a lane; use "change x" for relative stepping.

Working Scratch example

Try building this small script in the Scratch editor, predict what will happen, then click the green flag to test it.

Example using set x to (0)
  1. When green flag clicked
  2. Set y to -140
  3. Forever
  4. Set x to mouse x

Try it: The paddle follows the mouse left and right along the bottom of the screen.

Related block guides

Explore other blocks in the same category or return to the full English Block Dictionary.

Back to Motion Blocks See the overview and patterns for Motion Blocks. Learn more → Scratch Block Dictionary (All Categories) Browse Motion, Looks, Sound, Events, Control, Sensing, Operators, Variables, and Extensions. Learn more →

FAQ

When should I use "set x to (0)" in Scratch?

Perfect for Breakout/Pong paddles that track the mouse horizontally along a fixed height. Use "set x" for snapping to a lane; use "change x" for relative stepping.

This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.