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 Fai il tifo

Transcript

In this add-on, you will create a sprite that says random phrases to cheer on the racer.

To start, add a new sprite using the “Choose sprite from library” button. Select any sprite you want to be the cheerleader. This example uses Dan.

Now, create a list of phrases for the sprite to say. To do this, open the “data” menu and click “make a list.” Name the list something descriptive, like “Happy Cheers.”

Click “ok.”

After creating the list, two items appeared: a bunch of blocks and a grey box with the list name on the stage. To add a phrase to the list, click the “plus” sign in the grey box, and start typing. Add at least 4 phrases to the list.

Next, make the sprite say a random phrase from this list. Open the “looks” menu, and add a “say for 2 seconds” block. Then, open the “data” menu, and add an “item of” block to the “say” block. Open the dropdown menu, and select “random.” The block now reads “say item random of Happy Cheers for 2 seconds.”

Click on the block and watch what happens. Great! The sprite says a random phrase from the list every time the block is clicked. Next, make the sprite say phrases at random times. To do this, put a “forever” loop around the “say” block, and add a “wait” block. Insert a “pick random” block from the “operators” menu inside the “wait” block, and set the wait time to whatever you want. This example will wait a random time between 2 and 5 seconds. Then, add a “when flag clicked” block to the top of the “forever” loop.

Test out your code by clicking the flag. Great! The cheerleading sprite says phrases at random times! However, the list and the sprite are in the way of the game. To hide the list from view, open the “data” menu and uncheck the box next to the list name.

Hide the cheerleading sprite when it’s not saying anything by adding a “show” block before the “say” block and a “hide” block after the “say” block. Move the sprite to where you want it to appear.

Now test out your game. Nice! It works! Here’s the gameplan: Add a sprite to be the cheerleader. Create a list of phrases for the sprite to say. Make the sprite say random phrases at random times using a “say for 2 seconds” block, an “item of” block, a “when flag clicked” block, a “forever” block, a “wait” block, and a “pick random” block.

Hide the list and the sprite from view so they don’t cover up the game.

Scegli un’estensione
Schermata iniziale
Aggiungi una schermata iniziale con le regole del gioco.
Tieni il punteggio
Registra per quanto tempo lo skater rimane in vita e mostra il punteggio.
Fai il tifo
Crea uno sprite che fa il tifo per lo skater.
Acrobazie
Ordina allo skater di fare un'acrobazia quando si preme un tasto.
Power-up
Crea un power-up per rimpicciolire lo skater.
Schianto sonoro
Riproduci un suono quando lo skater va a schiantarsi contro un ostacolo.
arrow_backward Indietro
Avanti arrow_forward
Istruzioni
  1. Scegli un componente aggiuntivo e fai clic su "Guarda" per imparare a personalizzare il tuo progetto.
  2. Quando hai terminato, torna sulla schermata dei componenti aggiuntivi e prova un altro componente aggiuntivo!