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 add-on, you will animate the character's mouth to move while it talks.

This example will use Giga.

To start, the character needs two costumes -- one with a closed mouth and one with an open mouth.

If your character does not have an open mouth costume, duplicate a costume, and draw an open mouth.

This example uses the ellipse shape and the reshape tool to create a mouth.

Next, program the sprite to repeatedly switch costumes to look like it's talking.

Add a "repeat" loop, and place two "switch costume" blocks inside it.

Select the costume with the open mouth in the first dropdown menu and the one with the closed mouth in the other.

Place "wait" blocks under each “switch costume” block, and type in 0.1.

Click the block stack to test.

Great!

The sprite's mouth repeatedly opens and closes, like it's talking.

Broadcast a message to tell the sprite to move its mouth.

Add a "broadcast" block above the first "say" block, and name the message "talk."

Add a "when I receive" block above the "repeat" loop, and make sure the "talk" message is selected.

Click the flag to test.

Great!

The mouth moves, but not for exactly the right amount of time.

You could add a "broadcast" block before each "say" block to make the mouth move for the entire time the sprite talks.

But, this would repeat a lot of code.

To save time, create a function.

Make a block and name the block "talk."

Click the options dropdown, and select "add string input."

Name the string input "sentence," and click OK.

Program the "talk" block to move the character's mouth and say a sentence each time it is called.

Under the define block, move the "broadcast" block that is currently above the "say" block.

Under this, add another "say" block, and drag the "sentence" parameter into it.

Next, call the "talk" block.

The talk blocks will replace the "say" blocks.

Add the text from each "say" block into a "talk" block.

Then, delete the "say" blocks.

Click the "when I receive" block stack to test.

Great!

If the mouth keeps moving after the dialogue ends or stops moving too soon, adjust the number in the repeat value.

This example uses a value of 8.

If you would like, add more "talk" blocks to make a longer message.

Now, it's your turn.

Make sure the sprite has costumes with an open mouth and a closed mouth.

Animate the character by repeatedly switching costumes.

Broadcast a message to move the character's mouth.

Define a talk function.

Replace the "say" blocks with "talk" blocks.

Choose an Add-On
play_circle_filled
So Much Emotion
Animate a tear falling from the character's face.
arrow_forward
play_circle_filled
Ouch!
Add stars spinning around the character's head.
arrow_forward
play_circle_filled
Show Some Love
Animate a heart effect.
arrow_forward
play_circle_filled
Chit Chat
Animate the characters' mouths to move when they speak.
arrow_forward
play_circle_filled
Confetti
Program confetti, snow, hearts, or stars to fall from the sky.
arrow_forward
play_circle_filled
User Interaction
Ask the user a question and program a response.
arrow_forward
arrow_backward Back
Next arrow_forward
Instructions
  1. Watch the video to preview the add-ons.
  2. Choose an add-on, and click "watch" to learn how to build it.
  3. After you finish, come back to this page and try another one!