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 Let the Audience Decide

Transcript

In this video, you will ask the audience a question and make something happen based on their response.

This makes your story more interactive and lets your audience decide what happens next.

To start, decide what to ask the user and what you want to happen in your story based on their response.

You might ask: What the characters should do next, For information about the object, Or how a character feels.

Select the character in your story to ask the audience a question.

Earlier in this activity, you used a “say” block to create dialogue for your story.

The “say” block in Scratch makes a sprite say something, so you could use it to ask a question.

However, it cannot receive a response from the audience.

The “ask” block, however, both makes a sprite say something and collects an answer using a text box.

You will use the “ask” block to make your project interactive and get your audience involved in telling your story.

Click code tab and the sensing menu, and drag out an “ask” block.

Test the block by clicking on it.

The sprite asks “What’s your name?” and a box appears at the bottom of the stage.

Click the stop sign, and change the text of the question.

To make this easy for your audience, type in a question that can be answered with “yes” or “no.”

In this example, the sprite says “Should we leave?”

The two characters can’t agree on what to do with the object but you should decide what works best for your story.

Use an if/else block to help resolve the conflict by letting the user decide what the characters should do next.

This decision will determine what happens next in the story based on what the audience types.

If the user answers “yes,” then the sprite will do one thing.

If they answer anything else, like “no, maybe, probably, yep, or sure thing,” then the sprite will do something else!

Click the Control menu, and add an “if/else” block below the “ask” block.

To check if the answer is yes, use an “equals” operator from the operators menu.

Add this block inside the “if” portion” of the “if / else” block.

Add the “answer” block from the sensing menu into the first blank, and type “yes” into the other.

Next, tell the computer what to do if “answer” equals yes, then what to do if answer equals anything else.

This example uses “say” blocks from the Looks menu to make the character respond to the user input.

When the user answers “yes” to the question “should we leave?” the first character says “Awesome!

Let’s get out of here!”

If the user types anything else, the character says “Okay, let’s go talk to it.”

Finally, add this code stack to the character sprite’s dialogue.

You can make almost anything happen based on the user's response, like changing the sprite’s appearance, movement, or adding fun sounds.

Feel free to explore using other Looks and Sound blocks to add to your story.

Have fun, and get creative!

Now, it's your turn.

Add an “ask” block to ask the audience a question.

Check the user’s answer using an “if - else” block, an “equals” operator, and the “answer” block.

Add “say” blocks to program different things to happen based on the user's response.

Then, return to this page to select another video to try.

Choose an Add-On
Start here
Continue the Conversation
Add code to both character sprites to continue their conversation.
Code a Color Change
Make the object change colors.
Add Mystery with a Pulsing Object
Make the object grow and shrink repeatedly to look like a pulse.
Add Sounds to Your Story
Add sound to the story when the characters discover the unusual object.
Make Your Object Bounce
Code the object to bounce around the screen.
Paint Your Own Animation
Use the costume editor in Scratch to customize an animation.
Animate a Story Title
Build a title card for the project and animate it before the story begins.
Let the Audience Decide
Ask the audience a question and make something happen based on the response.
Add an Object
Add another object to the story to create more action.
Instructions

Para hacer esta actividad en español, haz clic aquí.

Students
  1. Watch the introduction video.
  2. Open an 'adventure' project link below and add characters and dialogue.
  3. Return to this page and watch more videos below.
Teachers
  1. Visit the Hour of Code teacher resource page for instructions.