mouse x — Scratch Block Guide
Returns the mouse cursor’s current horizontal coordinate (-240 to 240).
What this block does
Returns the mouse cursor’s current horizontal coordinate (-240 to 240).
Control Breakout paddles, sliders, or horizontal aiming.
- Category: Sensing Blocks
- Key tip: Clamps cleanly at -240 and 240 when the pointer leaves the stage.
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
- Forever
- Set x to mouse x
Try it: Locks the sprite’s horizontal position to the mouse cursor.
Related block guides
Explore other blocks in the same category or return to the full English Block Dictionary.
FAQ
When should I use "mouse x" in Scratch?
Control Breakout paddles, sliders, or horizontal aiming. Clamps cleanly at -240 and 240 when the pointer leaves the stage.
This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.