Skip to content

Please update your browser

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

3. Reply

Transcript

To create a response text message from your friend, click on the "friend" sprite.

When you send a text, you see each character you type one at a time on the screen.

When you receive a text, you see the full message all at once when it arrives.

To program your friend’s response, drag out a “say” block, and type what you imagine your friend would say.

Try it out!

Great.

The "friend" sprite says the response.

Next, make a sound play when the text message arrives.

Click the sounds tab, and choose a sound from the library, or use one of the sounds included in the starter project.

Once you select a sound, click the scripts tab and the sound menu Drag a “play sound” block above the “say” block to play the sound before the message shows.

Try it out!

The sound plays as the message appears, but this happens only when you click the stack to test it.

Next, make the message appear as a result of the message sent by the "you" sprite.

Select the “you” sprite.

Click on the events menu, drag out a "broadcast and wait" block, and snap it onto the end of the block stack.

Broadcast blocks allow a sprite to send a message to other sprites telling them that it is time to run a specific stack of code.

This "broadcast and wait" block will send a message to the "friend" sprite that it's time to say the response.

The program will wait until the "friend" sprite completes running the code before running the next block in the stack.

Click "new message," and enter the message name "2."

Next, instruct the friend sprite to respond to this broadcasted message.

Click on the Friend sprite, drag out a "when I receive" block, put it at the top of the stack, and choose "2" from the dropdown menu.

When the flag is clicked, the "you" sprite says a line, then broadcasts to the "friend" sprite that it is time to talk.

The "friend" sprite says a line, then the "you" sprite continues any additional code.

Try it out!

[pop] Great!

The "you" sprite talks, then the "friend" sprite responds...

but the Friend sprite responds really fast!

Select the friend sprite, and add “wait” blocks to make it look like your friend is really taking a second to type a message back.

[pop] Now, it's your turn!

Create your friend’s response using "When I receive," “say,” “play sound,” and “wait” blocks.

Tell the friend sprite it is time to talk using a "broadcast and wait" block.

arrow_backward Back
Next arrow_forward
Instructions
  1. Create your friend's response using "When I receive," "say," "play sound," and "wait" blocks.
  2. Tell the friend sprite it is time to talk using a "broadcast and wait" block.