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

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 center project contains two android sprites that will represent you and your friend.

The project also contains starter code.

The defined 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 defined block in a script window and adds a new block in the More Blocks menu.

Adding code to the defined stack tells the computer what instructions to carry out when it runs a 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 defined text message procedure.

The procedure receives a text message and counts its length.

Next, the code moves through the text one letter 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 started prompt you chose.

Drag out a Text Message block and into the first line of the text that 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.

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.