set x to (0) — Scratch Block Guide
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.
- When green flag clicked
- Set y to -140
- Forever
- 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.
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.