Skip to content

Please update your browser

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

Transcript

After the first video, you wrote scripted responses to planned interview questions.

Sometimes, though, an athlete might not have something planned to say in response to an interviewer’s question. This add-on will show you how to have the user give the answer to an interviewer question. To start, select the interviewer sprite. From the “sensing” menu, drag out an “ask” block. The “ask” block works like the “say” block, but rather than simply saying words, it also allows a user to type a response into a text box. Click on the “ask” block to see what it does. A box shows up at the bottom of the stage. Type some text in the box, then press enter. The variable named “answer” now has the value of what you typed. To see what is stored in the “answer” variable, click the checkbox next to “answer.” You’ll see the answer you just typed. Use this ask/answer pair to ask an interview question and have the user type an answer. Place the “ask” block at the end of the interviewer sprite’s code stack. Type a question into the blank in the “ask” block.

In this example, the interviewer sprite asks, “What contributed to your success in this club?” Run the code. The interviewer asks the question, then the box for the answer shows up. Any code blocks after the "ask" block won’t run until the user types an answer and presses enter. Next, let the athlete sprite know when the user has finished typing the answer using a “broadcast” block.

From the “events” menu, place a “broadcast” block under the “ask” block. Open the dropdown and click “new message.” Name the message something that makes sense, like “answer the question,” then click “OK.” Now, have the athlete sprite repeat the answer the user gave to the interview question. Select the athlete. From the “events” menu, drag out a “when I receive” block. From the dropdown, select the message you created.

Under this block, make the sprite say the answer that the user typed. From the “looks” menu, place a “say” block under the “when I receive” block. From the “sensing” menu, place “answer” inside the “say” block.

Test the code. The interviewer asks the question, and a box pops up on the stage. You type an answer, press enter, and the athlete says the answer you typed. Cool.

Alright, here’s the gameplan: Add an “ask” block with a new question to the interviewer’s script. Put a “broadcast” block with a new message below the “ask” block. Make the athlete say the user’s typed answer when it receives the broadcasted message.

Choose an Add-On
Hot Seat
Make the user answer an interview question!
Highlights
Show off the athlete's coolest move of the game.
Funky Phrases
Prompt your athlete to say random things!
Photobomb (Challenge)
Program a sprite to pop onto the stage and interrupt the interview.
Gatorade Shower (Challenge)
Dump Gatorade on your athlete's head.
Flash Photography
Have fans take pictures of the victorious athlete.
arrow_backward Back
Next arrow_forward
Instructions
  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!