Skip to content

Please update your browser

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

3. Mehr über Mode sagen

Transcript

In this video, you will program the android sprite to say more about its fashion.

First, click the costumes tab. Sprites can have multiple costumes. To select a costume that you like for your story, just click it! Next, click on the scripts tab and add another “say” block to your block stack. Type in text to continue the story and make the sprite say another statement about its fashion sense.

Think about colors, patterns, your favorite outfit, sneakers, whatever it is that you want to share about fashion. Once you’ve added the “say” block, click the flag to try it out. Interesting. There are 2 “say” blocks, but the sprite only said the text from the last one! This kind of unexpected behavior in code is called a bug.

Computer scientists test their code frequently to find bugs like this one, so they can fix them. In this example, the bug happens because the sprite says both “say” blocks so quickly, you can't see them. To make the sprite say the phrases more slowly, click the control menu, and drag out "wait" blocks. Place one “wait” block after each “say” block in your code stack.

Change the value in the “wait” block to set how long the sprite will pause between statements. A larger number will create a longer pause, while a smaller one will make the pause shorter. For example, enter a longer wait time if you have long sentences to give your viewers time to read everything your android says.

Try it out. Great! Now the sprite waits after saying each statement.

In computer science, it often takes more than one try to find the right solution to a problem.

Keep coding, testing, and trying solutions until you find the one that works.

Add more say and wait blocks to continue the story. Be creative and share what you like about fashion. Test your code often by clicking the flag. Great!

Take a moment now to make sure you are signed in to the cs first website using the username and password from your passport. If you are *not* signed in, you won’t receive a digital badge for completing this activity, so be sure to sign in!

Now, it's your turn! Continue your fashion story starter by adding more “say” and “wait” blocks. After you're done, return to this tab, and click the green arrow to learn how to customize the appearance of your sprite and more with add-ons!

arrow_backward Zurück
Weiter arrow_forward
Anweisungen
  1. Wählt eine Android-Figur und ein Kostüm im Tab „Kostüme“ aus.
  2. Fügt weitere Blöcke „sage“ und „warte“ zu eurer Modegeschichte hinzu.