Skip to content

In this video, you'll learn how to add a winning condition to your game.

In the sprites area, click on the stage.

You'll program the win lose condition on the backdrop, rather than on one of the sprites.

Start by programming the winning condition.

First, choose a winning number of points.

This example uses 20.

You and your friend will win if the score reaches 20.

From the control menu, drag out an if/then block.

Remember, an if statement, or conditional, checks whether something is true.

Next, fill in the condition for the computer to check.

In this case, if the score is ever greater than 19, the players will have won.

From the operators menu, place a greater than block inside the diamond shaped space in the if/then block.

On the right side of the greater than block, type the score just before the winning one.

In this example, that's 19.

From the variable menu, place the score variable block in the left side of the greater than block.

I the players have won, the backdrop will change.

From the looks menu, place a switch backdrop to block inside the if block.

Click on the dropdown and select winning backdrop.

Next, make the game constantly check if you and your friend have won.

From the control menu, place a forever loop around the if/then block.

The game will start checking if you and your friend won as soon as the flag is clicked.

From the events menu, place a when flag clicked block above the forever loop.

Click on the green flag to test your code.

Then, earn a winning score with your friend.

The backdrop changes.

But wait!

Objects are still falling from the sky.

To end the game, from the control menu place the stop all block under the switch backdrop to block Test the code by clicking the green flag again.

When you get the high score, the backdrop changes, and the objects stop dropping.


Next, follow similar steps to add a losing condition.

Make the program check if the score is equal to a negative number.

And, if it is, switch the backdrop to the losing backdrop.

If you need help programming the losing condition, ask a neighbor.

Don't worry if your program doesn't work the first time.

Computer scientists like you rarely get their programs to work on their very first try.

They use courage and persistence to learn from their mistakes and keep trying.

Now it's your turn!

Let the players know they've won using if, greater than, score, and switch backdrop to blocks.

Make the game constantly check if the players have won using a forever loop.

Stop the game when the players win using stop all.

Choose an Add-On

It's How You Play the Game

Add a winning condition to your game.

Danger Sprite

Add a sprite that causes you to lose points if you or your friend touches it.


Learn how to design the sprites.

Make Noise

Add sound to your project.

Hello Friend

Make the sprites react when they touch each other.


  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!