This article is about the block. For more information on the value this block reports, see Mouse Y (value).
Mouse Y
mouse y
Category Sensing
Type Reporter

The Mouse Y block is a Sensing block and a Reporter block. The block holds the mouse-pointer's current Mouse Y, or the vertical position of the cursor (relative to the center of the stage).

Note Note: This block will report -180 or 180 if the mouse is below or above the stage.

Example Uses

As this block helps report part of the cursor's position on the screen, it is useful for helping the cursor interact with the stage and sprites:

  • Creating a virtual slider
when I receive [set price v]
repeat until <not <mouse down?>>
  if <(mouse y) > (100)> then
    set y to (100)
    if <(mouse y) < (0)> then
      set y to (0)
      set y to (mouse y)
  set [price v] to (mouse y)
  • With the Mouse X block, giving the cursor's location
say (join (join (join (join [The mouse is positioned at (] (mouse x))[,])(mouse y))[).])
  • Making a grid which objects can snap to
set y to ((round ((mouse y) / (20)))*(20))
  • Creating interactive buttons
when gf clicked
  if <mouse down?> then
    if <<(mouse x) > (50)> and <(mouse x) < (100)>> then
      if <<(mouse y) > (50)> and <(mouse y) < (100)>> then
        broadcast (Button clicked! v)


Main article: List of Block Workarounds

This block can be replicated with the following code:

Note Note: This requires a sprite dedicated to finding the Y position of the mouse.
 go to (mouse-pointer v)
 set [Mouse Y v] to (y position)

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.