Glide () Secs to () | |
glide () secs to ( v) | |
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] 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 the Stop () 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)
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)
Following a Sprite for a limited time before reaching it
when gf clicked glide (60) secs to (sprite2 v)
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