- This article is about the block. For more information on the value this block reports, see Mouse X (value).
As this block helps report where the mouse-pointer's current location, it is useful in sensing things with the mouse.
Some common uses for the Mouse X block:
- Depending on where the mouse is, performing a different action
when [space v] key pressed if <(mouse x) > > then repeat (10) change [ghost v] effect by (10) end wait (1) secs clear graphic effects else change y by (50) wait (0.5) secs change y by (-50) end
- Helping to make a virtual slider
forever if <mouse down?> then set x to (mouse x) end end
- With the Mouse Y block, giving the mouse's location
forever say (join (mouse x) (join [, ] (mouse y)))
- Main article: List of Block Workarounds
This block can be replicated with the following code:
|Note:||This requires a sprite dedicated to finding the X position of the mouse|
forever go to [mouse-pointer v] set [Mouse X v] to (x position)