Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Bulle de pensée (Part 1 of 2)

Transcript

In this add-on, you will program the android sprite to show a thought bubble with emoticons that 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 picture that shows a facial expression or other image to convey an emotion, like a smiling face to 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 might feel 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 “switch costume” 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 thought bubble. Drag out another “switch costume” block, and select “blank.” Click to run it. 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 an emotion. In this example, the blank costume will show at the beginning, so 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 dropdown, 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 “say” blocks run and the message broadcasts to tell the “switch costume” block to run. Awesome! Repeat these steps for any other emoticon you want to 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. Cool! Once you’ve programmed this, click the watch button for part two of this add-on, in which you’ll create and program your own 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 costume Program the bubble costume to start on “blank” using a “when flag clicked” block and a “switch costume” block. Repeat this process to display other emoticons.

Choisir une extension
Apparition d'objets
Bulle de pensée (Part 1 of 2)
Bulle de pensée (Part 2 of 2)
Couleur mania
arrow_backward Retour
Suivant arrow_forward
Instructions
  1. Choisis une extension, et clique sur "Regarder" pour découvrir comment la créer.
  2. Une fois que tu as terminé une extension, essayes-en une autre !