Adjusting volume
Sometimes we'll want to be able to change the volume of a sound in the running program using specific blocks. We're going to take the recipe we just finished and add two commands. One will increase volume, the other will decrease volume. We'll use the arrow keys on the keyboard to accomplish this.
Getting ready
Open up the last recipe we worked on. The only purpose of using the last recipe is that we have a variety of sounds to hear. We could actually use any other program with sound as well.
How to do it...
These steps will get this recipe set for us:
Be sure you are in the Script area for the sprite with sound. The volume we will change is specific to each sprite.
- We need the volume reset each time the program starts, so drag in the block. It should be placed once under each top hat block we had before. It will in total look like the following screenshot:
- Under the Events blocks, drag over two blocks.
Change one to show up arrow and the other to say down arrow.
Return to...