Pause and Resume Music
This tutorial will explain how to make resume/pause custom blocks that give users the ability to pause and resume sounds in a project.
Pausing Sounds
This script will make sounds pause:
Another way this can be done is to put this block at the end, which still has the same effect:
This works because the pitch effect blocks can slow down and speed up sounds. However, the minimum the pitch effect can go is a value -360, meaning that it is impossible to fully pause sounds using the pitch effect blocks. That is the reason the set volume to 0 block is needed, otherwise the sound would still be heard. While it may be impossible to fully pause sounds this way, this method will still get very close.
Resuming Sounds
This script will make the sounds resume:
This code just reverts the effects of the "pause sound" custom block.
Music
The music is optional:
External Links
- Pause/Play ANY Audio File! on Scratch