Stop-motion animation
Stopping the Playback
One of the challenges of this script is knowing when to stop the playback. It'd be easy to put everything into a forever
block and just let it play. Alternatively, if you use a repeat
block, you could repeat the loop one time for each costume. For me, that would be repeat(72)
. After you get all the frames photographed, this might be a reasonable solution; however, if you decide to remove five costumes, the timing will be off.
In my script, I chose to calculate the end of the loop based on the costume number. Each costume has a number, which is different from the name. By setting up the photo #
variable to track the times through the loop, I can compare the photo #
and costume #
values. If they're not the same, then the loop stops and all the scripts end. This works because even if you delete a costume, the physical number of the costumes are updated so that there are no missing numbers missing from the costume list.
Adding Sound
Using the idea of costume numbers, it's time to think about sound effects. As Figure 3 shows, I'm playing a sound when costume number 55 displays. The play sound(Screech)
block will start to play the sound, but the script continues to run as the sound finishes. In my animation, this frame represents a collision, which is why I want to insert a screech.
I'm also using background music. For that, I use the play sound(Eggs) until done
block inside a forever
loop. This ensures the music will replay if the animation is longer than the music track I choose. It will end when the stop all
block runs at the end of the animation.
Before you can use a sound in your Scratch scripts, you need to import it. To import sound into your project, click on the Sounds tab and then click the Import button. Scratch includes a library of sounds, or your can add your own from your filesystem. In the Import Sound dialog box, if you single-click on the sound, Scratch will preview it for you.
After you import the sound, it displays on the Sounds tab for the sprite, and it will be available as an option in the play sound()
blocks. The sound you import for one sprite will not be available to the other sprites in your project, which means you need to import sounds for each sprite individually.
« Previous 1 2 3 4 Next »
Buy this article as PDF
Pages: 4
(incl. VAT)