Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Need help with a snap block
- Botcho_Otkho
- Scratcher
1000+ posts
Need help with a snap block
Hello,few days ago i opened snap after a long time,and i saw this block i never seen before.
warp {}::greyWhat is this block for? Thanks.
I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
- Scratch---Cat
- Scratcher
1000+ posts
Need help with a snap block
It does the same as this:
run script {
} without screen refresh :: control
Last edited by Scratch---Cat (Oct. 16, 2018 07:06:10)
Download Scratch 2.0 | Check your messages | Check my messages
_____________________________________________________________________________________________________
If you want to subscribe to this forum topic, please click the
{} Follow Discussion :: ring sensingbutton below this forum post! Thanks!
- jokebookservice1
- Scratcher
1000+ posts
Need help with a snap block
Let's say we have the following script
You might think it behaves in the same way as this:
However, it isn't. At the end of each loop iteration, Snap! will update the screen and artificially pause for a bit. This makes the sprite smoothly glide across the screen, rather than jump in one go 100 pixels.
The little pauses can be useful if you're animating, but they can slow down your script when you don't want them. “warp” disables these pauses.
Is therefore exactly the same (in terms of behavior) as:
However, don't put any infinite loops or ‘wait’ blocks inside, as it might hang (it's trying to execute its contents as fast as it can – it'll struggle to do that with an infinite loop).
repeat (100)
move (1) steps
end
You might think it behaves in the same way as this:
move (100) steps
However, it isn't. At the end of each loop iteration, Snap! will update the screen and artificially pause for a bit. This makes the sprite smoothly glide across the screen, rather than jump in one go 100 pixels.
The little pauses can be useful if you're animating, but they can slow down your script when you don't want them. “warp” disables these pauses.
warp {
repeat (100)
move (1) steps
end
} :: grey
Is therefore exactly the same (in terms of behavior) as:
move (100) steps
However, don't put any infinite loops or ‘wait’ blocks inside, as it might hang (it's trying to execute its contents as fast as it can – it'll struggle to do that with an infinite loop).
Last edited by jokebookservice1 (Oct. 16, 2018 11:50:28)
- Discussion Forums
- » Advanced Topics
- » Need help with a snap block