Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
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
If your character does not have an open mouth costume, duplicate a costume, and draw an
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.
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
Click the flag to test.
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.
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.