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 Losing Condition!

Transcript

In this add-on, you’ll program a reaction for when your friend gets the answer wrong.

First, program the reaction.

You might want the reaction to include sound.

To add a sound to your project, click on the “sounds” tab and the choose sound from library button.

Press the “play” button to hear the sound.

Select one you like, then click “ok” Click back on the scripts tab.

Scratch offers two sound blocks, both in the sound menu The “play sound” block starts to play the sound, then immediately runs the next block.

The sound will stop either when it’s done playing, or when another sound block tries to play.

The “play sound until done” block pauses the rest of the code until the sound finishes playing.

Different blocks are useful for different situations.

You might also switch the backdrop to one that says “you lose.”

To do this, create a new backdrop.

To create a new backdrop, click on the stage in the sprites menu.

Click on “Backdrops,” then choose “paint new backdrop.”

Tinker with the tools available in Scratch.

This example uses the paint bucket to fill the entire stage with one color, then uses the Text tool to write the name of the game and give instructions.

You can also paint with the paintbrush, or draw lines, circles and rectangles.

Change the color using the “color selector” at the bottom of the page.

Name the backdrop you created “losing backdrop.”

Click back on the “scripts” tab.

From the “looks” menu, find the “switch backdrop to” block.

This block allows sprites to change the backdrop.

Place the “switch backdrop to” block in the “else” section of the “if/else” block.

That way, it will be fun when your friend gets the answer wrong.

Click the flag, and choose a truth to test your code.

If your losing condition includes a backdrop change, you’ll notice the backdrop doesn’t return to the original.

To reset to the original backdrop, place the “switch backdrop to” block to the top of your code.

From the dropdown, select the original backdrop.

You can skip this step if you are also doing the “title screen” add-on.

Now it’s your turn: Program a losing condition.

You can: Add sound using the “play sound” or “play sound until done” blocks Add a new backdrop.

Use your creativity to program a fun losing condition for your friend!

Place the losing condition in the “else” section of the “if/else” block.

Choose an Add-On
play_circle_filled
Title Page
arrow_forward
play_circle_filled
Winning Condition!
arrow_forward
play_circle_filled
Losing Condition!
arrow_forward
play_circle_filled
Keep Trying!
arrow_forward
play_circle_filled
Personalize Your Sprite
arrow_forward
play_circle_filled
Add Another Question (Challenge)
arrow_forward
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!