Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this video, you'll enable the program
to handle both uppercase and lowercase letters
and program a message for the user.
The starter project contains a function
that converts uppercase letters to a lowercase letters.
It uses a string of letters, just like the answer variable.
The string is called alphabet,
and it includes all lowercase letters.
The function selects a letter from the string.
Then, it searches through the letters of the alphabet
to find the letter that matches it.
It then sets another variable called letter
to the lowercase version of the letter.
After you use this function,
the variable letter will contain
the lowercase version of the letter you passed in.
The function is defined in the starter project,
but you still need to call it
to convert any uppercase letters
the user inputs to lowercase letters.
From the more blocks menu,
add a lowercase block above the switch costume block.
Drag the letter of-block out of the switch costume block,
into the lowercase block.
This will change the each letter
the user types into a lowercase letter
and stores the new letter in the letter variable.
Add the letter variable into the switch costume block.
Click the flag to test and type in a name.
Next, choose a backdrop
and program a short message for the user.
You can choose one of the backdrops in the starter project.
Pick one from the scratch library or draw your own.
This example uses the summer backdrop
from the starter project.
Next, add a character to your animation.
This example uses a blue Giga sprite from the Backpack.
Use a sprite from the sprite library, an image you may have,
a character you drew in the paint editor,
or a sprite from your own backpack.
Next, program the sprite to start talking
after the letters begin to animate.
Click the letter sprite and add a broadcast block
to the bottom of the code stack.
Name the message something unique
or use the default message, message1.
Program the character to receive that message
and start talking.
Select the character sprite
and add a when I receive message.
Make sure the message you created
is selected in the drop down menu.
Add a save block.
Program the character to greet the user
with the name they typed in.
Add a join block.
In the first blank, write something like, hey.
Add a space after your greeting.
In the other blank, add the answer block.
Click the flag and type in a name to test.
Great, the character says, hey Quinn.
Add more save blocks to your message.
This example says, you're awesome,
I hope you have the best day ever.
Your message can say whatever you'd like.
Now it's your turn.
Use the lowercase function to convert
any uppercase letters to lowercase letters.
Add a new sprite.
Broadcast a message after the animation
to tell the new sprite to talk.
Program the sprite to greet the user
with the name they input.
Add your own custom message.