In this two-part add-on, you'll program the character to react to something inside a box.

Click the box sprite, and look inside the costumes tab.

This sprite has a costume that looks like a closed box, a costume that looks like an open box, and a bunch of costumes for what could be inside the box.

In this video, you'll only use the open and closed box costumes.

To animate the box opening, add code to make this sprite change costumes from the closed box to the open box.

Open the looks menu and drag out a switch costume look.

Select the closed box costume from the dropdown menu.

Click this block to test it.

Nothing seems to happen because the sprite is hidden.

Snap a show block under the switch costume block, and test it again.


A closed box shows up.

Move this box to where you'd like it to appear on the screen.

This example puts the box in the lower left corner of the stage.

Next, animate the box to open.

Add another switch costume block to the end of the stack.

Choose the open box costume from the dropdown menu.

Click the new block to test.


Now, the box is open when the program starts.

That's because the costumes are switching so fast, that you never see the closed box.

To fix this, open the control menu, and add a wait block before the second switch costume block.

Click to test.


Now, the box stays closed for a second, then opens.

Tinker with the value in the wait block to control how long the program waits until the box opens.

Next, make the character react to the box opening.

To do this, broadcast a message to the character sprite telling it how to react.

Open the events menu and add a broadcast log.

Choose a reaction from the dropdown menu.

In this example, the character will dance with excitement, but you can use any reaction that fits the personality of your character.

Click the stack to test it out.


When the box opens, the character reacts.

Next, make this animation part of your story.

Click the narrator sprite.

Add some dialogue using a say block to set up opening the box.

Then add either a broadcast block or a broadcast and wait block.

A broadcast and wait block tells the program to wait until the box animation finishes before running any other code.

The broadcast block keeps the code running while the box opens.

This example uses a broadcast block.

Open the dropdown menu and click new message.

Type a message that describes the box animation like open box, then click okay.

Then click the box sprite and add a when I receive block on top of the stack you programmed.

Select your new message from the dropdown menu.

Click the flag to test out the story.

The narrator talks and the box animation appears.


In part two of this add-on, you'll program objects to come out of the box.

Now it's your turn.

Animate the box to open using show, switch costume, and wait blocks.

Program the character to react using a broadcast block.

Make the box animation part of the story by adding some dialogue and a broadcast or a broadcast and wait block to the narrator sprite, and a when I receive block to the box sprite.

Choose an Add-On

Change Setting

In this add-on, you will change your story’s setting.

Mystery Box (Part 1 of 2)

Animate a mystery box to appear!

Mystery Box (Part 2 of 2)

Animate a mystery box to appear!

Animate the Narrator (Part 1 of 2)

Animate the narrator to talk!

Animate the Narrator (Part 2 of 2)

Animate the narrator to talk!

Play a Song

This add-on will show you how to use Scratch to create your own song.

Add Another Character

In this add-on, you add another character to your story to spice it up!


  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!