Skip to content

Please update your browser

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

2. Start the Conversation

Transcript

In this video, you will create a new block, or procedure, that displays text one letter at a time in the “say” bubble to look like you are texting.

There is even an add-on you can use later to animate moving thumbs for texting like you see here.

The starter project contains two android sprites that will represent you and your friend.

The project also contains starter code.

The define “text message” block has code that displays one letter at a time in a say bubble.

In order to run this “text message” code, call the procedure with a “Text Message” block.

This starter code was created using the “make a block” button under the more blocks menu.

The "Make a Block" button automatically creates a purple "Define" block in the script window and adds a new purple block in the "More Blocks" menu.

Adding code to the "Define" stack tells the computer what instructions to carry out when it runs the block.

Every time the new block runs in any part of the program, those instructions will happen, without you building the same code multiple times.

To start, create the first text message in your future conversation.

This example uses the “tell your friend good news” story starter.

Drag out a "Text Message" block from the more blocks menu.

Type in the line of text that you would say to your friend.

Click this block to test.

Great!

Your text displays one letter at a time as though you are typing it on a phone.

The "Text Message" block passes the message you wrote to the "Define Text Message" procedure.

The procedure receives the text message and counts its length.

Next, the code moves through the text one letter at a time, displaying it using the “say” block.

As the "Text Message" procedure does this, it stores information in variables, so it can track what needs to be said and decide which letter to show next.

Finally, add a "when flag clicked" block to start your program.

Now, it's your turn!

Think about the story starter prompt you chose.

Drag out a "Text Message" block, and enter the first line of text that you would send to your friend.

Add a "when flag clicked" block to the top of the stack.

In the next video, you'll learn how to make your friend’s response to your text!

arrow_backward Back
Next arrow_forward
Instructions
  1. Think about the story starter prompt you chose.
  2. Drag out a "Text Message" block, and enter the first line of text that you would send to your friend.
  3. Add a "when flag clicked" block to the top of the stack.