In other languages

Help the wiki!

The Scratch Wiki is made by and for Scratchers. Do you want to contribute?

Learn more about joining as an editor!

See discussions in the Community Portal

Go to () (block)

"Go to" redirects here. For the block that makes a sprite go to a specific coordinate, see Go to X: () Y: () (block).
Go to ()
2.0 Go to ().png
Category Motion
Type Stack

The Go to () block is a Motion block and a Stack block. The block sets its sprite's X and Y position to that of the mouse-pointer, an arbitrary coordinate, or another sprite — in other words, it moves the sprite to a random position, the mouse-pointer, or another sprite.

Example Uses

The Go to X: () Y: () block does not simply move sprites to specific objects - the Go to () block, however, can move sprites to other sprites or the mouse-pointer.

Some common uses for the Go to () block:

forever
go to [mouse-pointer v]
  • A piece of clothing that must stay with the sprite that wears it
forever
go to [person v]
  • Preventing a sprite from moving
forever
go to [Sprite1 v]
  • Controlling a pencil with the mouse
forever 
if <mouse down?> then
go to [mouse-pointer v]
pen down
else
pen up
  • Changing the position of objects on a hidden treasure game
when green flag clicked
go to [random position v]

Workaround

Main article: List of Block Workarounds

With the sprite going to the mouse-pointer:

go to x: (mouse x) y: (mouse y)

With the sprite going to another sprite:

go to x: ([x position v] of [wanted sprite v]) y: ([y position v] of [wanted sprite v])

With the sprite going to a random position:

go to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))

See Also

  • This page was last modified on 20 June 2017, at 22:03.