Please update your browser
Your browser version is not supported by this site. CS First may not work properly. Learn more.
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 drop down 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 test.
The sprite's mouth repeatedly opens and closes,
like it's talking.
Broadcast a message to tell the sprite to move it's 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 will repeat a lot of code.
To save time, create a function.
Make a block and name the block, talk.
Click add string input.
Name the string input, sentence,
and click okay.
Program the talk block to move the character's mouth
and say a sentence each time it's 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.
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 eight.
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.
Animate a tear falling from the character's face.
Add stars spinning around the character's head.
Animate a heart effect.
Animate the characters' mouths to move when they speak.
Program confetti, snow, hearts, or stars to fall from the sky.
Ask the user a question and program a response.
Sign in to track your progress and earn badges