On day 2, you used a “say” block to createdialogue. The “say” block in Scratch makes a character say something. However, it cannotreceive a response from the audience. The “ask” block also makes a charactersay something. Unlike the “say” block, however, it collects an answer from the audienceusing a text box. You will make your story interactive using the “ask” block.
To get started, click sensing, and drag out an “ask” block.
Test the block by clicking on it. You’ll see that the sprite asks “What’s yourname?” and a box pops up at the bottom of the stage.
Click the stop sign to stop this code, then change the text of this question to somethinglike, “Would you like to go through the secret door?”
Test this again. You’ll notice that again a text box appears where a user can type hisor her answer. The text a user enters in the box is storedin a variable called “answer.” In computer science, a place in the code thatstores a value, or information like user text, is called a “variable.”
Click the checkbox next to the answer variable to see what’s stored there. To test it,click the “ask” block, then type an answer and press “enter” on your keyboard. Youshould see the answer you entered stored in the answer variable. If you run the code againand enter a different answer, the new answer will replace the old one.
In the next video, you’ll program your story to make a decision based on the audience’s answer.