In this add-on, you will program the android sprite to show a thought bubble with emoticonsthat show how it is 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 picturethat shows a facial expression or other image to convey an emotion, like a smiling faceto show happiness or a frowning face for 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 mightfeel happy, sad, or 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 you chose. Drag out a “switchcostume” block. Click the dropdown, 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 thoughtbubble. Drag out another “switch costume” block, and select “blank.” Click to runit. Cool. You now have two code blocks to switch costumes.
Next, choose a place in your program where your sprite will change costumes to show anemotion. In this example, the blank costume will show at the beginning, so add a “whenflag 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 tellcode when to run, by sending a message in one part of the program, and receiving itin another.
Click the android sprite. From the events menu, add a “broadcast” block at the pointin the code where the costume will change. Click the dropdown, and create a new messagethat matches the name of your costume change. Then, click the bubble sprite, and add a “whenI receive” block to the “switch costume” block, and select the name of the messageyou created. Test this code by clicking on the code stackin the Android sprite. The “say” blocks run and the message broadcasts to tell the“switch costume” block to run. Awesome! Repeat these steps for any other emoticonyou want to show. Add a “switch costume” block, and select the costume. Switch to thetalking 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 “switchcostume” block. Cool! Once you’ve programmed this, clickthe watch button for part two of this add-on, in which you’ll create and program yourown emoticons! Now, 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 costumeProgram the bubble costume to start on “blank” using a “when flag clicked” block anda “switch costume” block. Repeat this process to display other emoticons.