In this add on you'll program the android sprite to
show a thought bubble with emoticons that show how
it's feeling as it talks.
To start, click the thought bubble sprite,
then the costumes tab.
This sprite has several emoticon costumes.
An emoticon is a picture that shows a facial expression,
or other image to convey an emotion,
like a smiling face to show happiness,
or frowning face to show sadness.
Choose a costume to display in your project.
Think about what your android might feel at different times.
Is there a time when it might feel happy, sad,
silly for example.
The bubble sprite is hidden on the stage.
To make it show, click the scripts tab,
the looks menu,
and the show block.
Next, program the bubble sprite to change to the costume
Drag out a switch costume block.
Click the drop down and select the name of the costume
that will display.
Click the block to run it.
Great, the costume shows.
Program another costume change.
In this example the story will start with an empty
Drag out another switch costume block,
and select blank.
Click to run it.
you now have two code blocks to switch costumes.
Next, choose a place in your program where your sprite
will change costumes to show an emotion.
In this example, the blank costume
will show at the beginning.
Add a when flag clicked block above the
switch costume blank block.
In this example, the other costume will change
after the sprite says a fashion statement.
To do this, use broadcast and when I receive blocks.
Broadcast blocks tell code when to run
by sending a message in one part of the program,
and receiving it in another.
Click the android sprite.
From the events menu, add a broadcast block
at the point in the code where the costume will change.
Click the drop down,
and create a new message that matches the name
of your costume change.
Then click the bubble sprite and add a when I receive
block to the switch costume block,
and select the name of the message you created.
Test this code by clicking on the code stack
in the android sprite.
The saved blocks run in the message broadcast
to tell the switch costume block to run.
Repeat these steps for any other emotion you wanna show.
Add a switch costume block and select the costume.
Switch to the talking sprite,
add a broadcast block,
and create a message for that costume change.
Then, add a when I receive block with the name
of that message to the switch costume block.
Once you've programmed this,
click part two of this add-on
in which you'll create and program your own emoticons.
Not it's your turn.
Program the thought bubble sprite to change costumes
using a switch costume block.
Use broadcast and when I receive blocks
to change the bubble sprite's costume.
Program the bubble costume to start on blank
using a when flagged clicked block,
and a switch costume block.
Repeat this process to display other emoticons.
Sign in to track your progress and earn badges