Playing with Sounds
Hmm… something is missing from our animations. Can you guess what?
Sound! With sound, animations become more attractive. Let’s see how you can add sound to your animations.
What is Sound?
A sound is something that you hear when someone speaks, sings, or plays a musical instruments. It can be played, available by importing, built-in sound library, or recording.
In PictoBlox, you can play different sounds by using blocks from the Sound palette which can control a sound’s volume, tempo, and more.
Let’s see how to use them in an animation!
Activity: Adding Sounds
In this activity, we’ll make an animation of a barking dog in which whenever we press the spacebar, the dog will bark and go to a random location on the stage.
Choosing the Backdrop
Follow the steps below to add a backdrop.
And that’s it! The stage has now transformed from a blank space to a colorful jungle!
Choosing the Sprite
Follow the steps below to add a sprite.
- Using choose a sprite button, Choose the Dog1.
- Right-click on the Tobi icon in the sprite palette and delete it.
Now, let’s animate the dog.
Setting the Starting Position
Using the following blocks, we will set the starting position of Dog.
Adding Costumes
As we will be working on two costumes of the dog, we first need to add the costume.
Switching Costumes and Playing Sounds
Next, we create another script. We will use switch costume block from looks palette and play sound block from the sound palette.
Gliding to a Random Position
- To make our Dog sprite glide randomly, We will use glide block from the motion palette.
- To switch back to initial costume, use switch costume block from looks palette.
Sensing the Space Key
- From the Events palette, add the following hat block. It will sense it when we press the space key and make the script run.
The entire script looks like this:
Maximize the stage and enjoy the animation!
Saving the File
Save the file with the name Playing Sounds.
Assignment
Before you move on to the next lesson, a small assignment awaits you!
You must upload the PictoBlox script you made in this activity to the website.
Submitting the assignment is a must in order to receive the certificate after completing the course.
Follow the steps below to upload your assignment:
- Click on Choose File.
- Select the image from the pop-up window that opens up.
- Once the image is selected, click on Upload Assignment.
Good luck!