Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back La scatola misteriosa (Part 1 of 2)


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. Click the “scripts” tab. Open the “looks” menu, and drag out a “switch costume” block. 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 again. Great! A closed box shows up. Move the box to where you’d like it to appear on the screen-- this example puts the box in the lower left corner.

Next, animate the box to open. Add another “switch costume” block to the end of the stack. Choose the “opened box” costume from the dropdown menu. Click the new block to test. Hmm.. 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 the flag to test. Great! 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” block. Choose a reaction from the dropdown menu. In this example, the character will dance in excitement, but you can use any reaction that fits the personality of your character.

Click the stack to test it out. Great! 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 “OK.”

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.

Great! 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.

Hide the box at the end of the animation using a “hide” block.

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

In part 2 of this add-on, you’ll program objects to come out of the box!

Scegli un’estensione
Cambia ambientazione
Con questo componente, potrai cambiare l'ambientazione della storia.
La scatola misteriosa (Part 1 of 2)
Fai comparire una scatola misteriosa!
La scatola misteriosa (Part 2 of 2)
Fai comparire una scatola misteriosa!
Anima il narratore (Part 1 of 2)
Anima il narratore facendolo parlare!
Anima il narratore (Part 2 of 2)
Anima il narratore facendolo parlare!
Suona una canzone
Questo componente ti mostrerà come creare una canzone originale su Scratch.
Aggiungi un altro personaggio
Con questo componente, potrai ravvivare la storia aggiungendo un altro personaggio!
arrow_backward Indietro
Avanti arrow_forward
  1. Scegli un componente aggiuntivo e fai clic su "Guarda" per scoprire come costruirlo.
  2. Una volta terminato un componente aggiuntivo, scegline un altro da provare!