SandCastleIcon.png This page has links to websites or programs not trusted by Scratch or hosted by Wikipedia. Remember to stay safe while using the Internet, as we can't guarantee the safety of other websites.
Glide () Secs to ()
3.0 Glide () Secs to ().PNG
Category Motion
Type Stack
Introduced in 3.0

The Glide () Secs to () block is a Motion Block and a Stack Block that was introduced in Scratch 3.0.[1][2] The block moves its sprite at a steady pace to the specified sprite or the mouse-pointer from a drop-down - this is similar to the sprite in a direction and repeatedly using Move () Steps, but with more precision. The first space is a number input, and the second space can set to a sprite, random position, and mouse-pointer. A downside to the block is that, while gliding, it pauses the script so that nothing else can happen during this time. A glide can only be interrupted by a stopping scripts block, and the If on Edge, Bounce block will fail to work its intended function while a sprite is gliding.

Example uses

Making a Sprite glide to another sprite

when gf clicked
glide (3) secs to [sprite2 v]::motion

Gliding to random positions to create pen lines

when gf clicked
pen down
set pen color to (pick random (0) to (360))
repeat (50)
glide (3) secs to [random position v]::motion

Following a Sprite for a limited time before reaching it

when gf clicked
glide (60) secs to [sprite2 v]::motion

Workarounds

The Glide () Secs to X: () Y: () block can be used to get the same effect:

when gf clicked
glide (5) secs to x: ([x position v] of [Sprite2 v]) y: ([y position v] of [Sprite2 v])

The Glide () Secs to X: () Y: () block and Pick Random () to () operator can be combined to make the sprite move to random places:

when gf clicked
forever
glide (2) secs to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))
end

See Also

References

  1. https://llk.github.io/scratch-gui/develop/
  2. https://github.com/LLK/scratch-gui/issues/598