One of the great aspects of the computer science community is that you can borrow and remix other people’s ideas. One way to do this in Scratch is by using the backpack. In this add-on, you’ll add a fireworks sprite to your backpack, then add it to your program, and decide when to run its code.
Click the fireworks link next to the introduction video on this page. This project contains a fireworks sprite that already contains code. Click the flag to run the code.
Wow! That's pretty awesome. Next, make sure that you’re signed in to Scratch. If you’re not signed in, you won’t be able to add the firework to your backpack.
Open the backpack by clicking the backpack menu at the very bottom of the screen.
If you’ve never added anything to your backpack, it will be empty.
Click and drag the fireworks sprite into your backpack.
Next, switch back to your original project, make sure your work is saved, and refresh the page. Open your backpack again, and drag the fireworks sprite into your project. Click the flag to try it out.
Awesome, the fireworks sprite and all of its code is now copied into your project! It’s pretty distracting to have fireworks playing for the entire program though, so decide when you want these fireworks to play. In this example, the fireworks will play at the end of the story. To do this, broadcast a new message at the end of the story, which is the bottom of the “conclusion” block stack. Call the message something like “end.”
Then, select the fireworks sprite. Replace the “when flag clicked” block with a “when I receive” block, and change the value to “end.”
To play the fireworks during the middle of the story, select a different message, like body or conclusion. Click the flag to test.
Great! The fireworks play at the right time in the story!
Now, it’s your turn: Open the fireworks project next to this video.
Be sure that you’re signed in to Scratch, open your backpack, and drag in the fireworks sprite. Switch back to your original project, refresh, and drag the sprite out of your backpack. Program the fireworks to run by broadcasting and receiving a message.