Skip to content

Please update your browser

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

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.

Choose an Add-On
play_circle_filled
Start Screen
Add a starting screen with instructions for your game.
arrow_forward
play_circle_filled
Keeping Score
Keep track of how long a racer stays alive and display the score.
arrow_forward
play_circle_filled
Cheer On
Create a sprite that cheers on the racer.
arrow_forward
play_circle_filled
Extreme Tricks
Program your racer to do a cool trick at the press of a button.
arrow_forward
play_circle_filled
Power Ups
Create a power up that shrinks the racer.
arrow_forward
play_circle_filled
Crash Sound
Add a sound that plays when the racer crashes into an obstacle.
arrow_forward
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an add-on, and click "Watch" to learn how to customize your project.
  2. When you finish, come back to the add-ons screen and try another add-on!