Set Y to ()
2.0 Set Y to ().png
Category Motion
Type Stack

The Set Y to () block is a Motion block and a Stack block. The block sets its sprite's Y (up and down) position to the specified amount. This block, combined with the Set X to () block, have the same effect as the Go to X: () Y: () block.

Example Uses

If a sprite must go to a certain place, and the sprite's X position is to remain the same, the Set Y to () block can be used instead of the Go to X: () Y: () block — there is no need to set the X position if it does not change.

Another common use of the block is Y scrolling — the sprites have to constantly change their Y position. The Set Y to () block is normally used here.

Other common uses are:

  • Placing platforms to climb up a wall
when gf clicked
  if (mouse down?) then
    set y to (mouse y)
    say [Platform added!] for (2) secs
  • Setting random heights for airplanes
when gf clicked
say [Ready for lift-off!]
set y to (pick random (120) to (180))
  • Resetting the Y position of a slider
when I receive [reset slider position v]
set y to (0)


Main article: List of Block Workarounds

This block can be replicated with either of the following codes:

change y by ((Wanted Y) - (y position))


go to x: (x position) y: (Wanted Y)

See Also