Skip to content

Please update your browser

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

Please note: This theme has not been updated to reflect Scratch 3.0. Visit this help article for more info.
Transcript

In this video you'll ask for the user's name.

Later, you'll use the code you just built to animate it.

To start, add an ask block above the repeat loop.

The default question in the ask block is, what is your name?

Click the ask block.

A box pops up at the bottom of the stage where the user can type an answer.

The answer gets stored as a string in the answer variable.

In computer science, a string is a sequence of characters, such as letters, numbers, and punctuation marks.

They can be single letters, words, or sentences.

Next, make your program display the name the user typed in.

To do this, your program will read each letter the user typed, and change the sprite's costume to the costume that matches each letter.

Right now, the program creates five letter sprite clones.

To make it display the number of letters in the user's name, click the operator's menu, and drag out a length of block.

The length of block counts the number of characters in its value box.

For example, type in the string friend.

Click the block.

Friend has a length of six.

Try another string.

The string I like turtles! has a length of 15, including the spaces and the exclamation point.

Placing the answer block inside the length of block counts the number of characters stored in the answer variable.

Add the answer block to the length of block, then place these two blocks in the repeat loop.

Click the flag to test, and type a name in the box.

This example enters the name Quinn, which has five letters.

The length of block counts the number of letters in the user's answer, and creates a clone for each letter, so the program creates five clones.

That looks good, but it would be way cooler if the program animated the user's name.

You'll work on that next.

Now it's your turn.

Ask the user, what is your name?

Create a letter sprite clone for each letter in the user's name.

Instructions
  1. Ask the user, "What is your name?"
  2. Create a letter sprite clone for each letter in the user's name.