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: Playing 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.
Let’s Code
Follow the steps below:
- Create a New file in PictoBlox:
- Follow the step if you are working on Windows, macOS, or Linux:
- Open PictoBlox and create a new file.
- Select the coding environment as Block Coding.
- Open PictoBlox and create a new file.
- Follow the step if you are working on Windows, macOS, or Linux:
- Click the Choose a Backdrop button. Select the Jungle backdrop from the library.
The stage has now transformed from a blank space to a colorful jungle! - 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.
Dog Costumes
As we will be working on two costumes for the dog, we first need to add the costume.
- Click on Costumes tab.
- You will see two costumes of dogs that are already added.
Dog Script
- Add the switch costume to () block into the scripting area from the Looks Select dog1-b as a costume.
- Snap the play sound () until done block from the Sound.
- To make our dog sprite glide randomly, we will use a glide () secs to () block from the Motion Select the option to random position.
- To switch back to the initial costume, use switches the switch costume to () block Set the costume this time as dog1-a.
- From the Events palette, add the when () key pressed hat block. The block will sense it when we press the space key and make the script run.
Maximize the stage and enjoy the animation!
Save the project file as Playing Sound.
Assignment
Before moving on to the next lesson, a small assignment awaits you!
You must upload the PictoBlox program you created in this activity to the website. Submitting the assignment is a must to receive the certificate after completing the course.
Follow the steps below to upload your assignment:
- Click on Browse.
- Search and Select your saved Project file(.sb3) and Click Open.
- Click on Upload to submit the assignment.
Good luck!