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

Start learning →

mouse x — Scratch Block Guide

📌 What you will learn

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.

Example using mouse x
  1. When green flag clicked
  2. Forever
  3. 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.

Back to Sensing Blocks See the overview and patterns for Sensing 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 "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.