|Go to X: () Y: ()|
go to x: () y: ()
The Go to X: () Y: () block is a Motion Block and a Stack Block. The block sets its sprite's X and Y position to the specified amounts. This block is related to the Set X to () and the Set Y to () blocks — it is the same as the two blocks combined, as shown in the workaround.
This block has no animation in its movement — it is the simplest way to move a sprite around the screen without displaying any animation (i.e. gliding). Therefore, this block is used whenever a sprite needs to jump to another spot.
Sprites often have to jump to places — this block is the simplest way to do so.
Some common uses for the Go to X: () Y: () block:
- Moving a sprite
go to x: (73) y: (84)
- Resetting the sprite's position at the beginning of a project or stage
when gf clicked go to x: (73) y: (84)
- Moving to places for stamping in One Sprite One Script projects
when I receive [Stamp picture v] switch costume to (Background v) go to x: (73) y: (84) stamp next costume go to x: (83) y: (114) stamp next costume go to x: (95) y: (144) stamp
- Main article: List of Block Workarounds
This block can be replicated with the following code:
glide (0) secs to x: (X amount) y: (Y amount)
The following alleged workaround is a common mistake made by many new Scratchers:
set x to (X amount) set y to (Y amount)
However, this workaround is not accurate while using the pen. If you use this code, you will see the difference:
when [a v] key pressed pen up go to x: (0) y: (0) pen down go to x: (100) y: (100) when [b v] key pressed pen up go to x: (0) y: (0) pen down set x to (100) set y to (100)