4. Create a Winning Condition
In this video, you will create a winning condition for your game.
If the two sprites touch, then the user wins this platform game.
To program a winning condition, add another conditional statement. Click the control menu and place an "if" block inside the forever loop.
The rest of the code in this step will be up to you to design and create. Decide what will happen if the sprite gets to its goal. You can program your sprite to say “yay you win!” Or do a backflip! Or even bounce around the stage! It’s up to you!
Make your CS First experience more social and fun by sharing what you created today with the Scratch community. Before you go, hit the “share” button and write a description of your project so others on Scratch can enjoy it.
A big part of computer science is persisting through tough problems. If the first solution you try doesn’t work, try again.
Now it’s your turn: 1. Program an if statement for when the user wins 2. Decide how your sprite should celebrate when it wins Try a few things for your winning condition code. Explore different blocks to see what they do.
Once you have a winning condition that you’re happy with, ask a friend to try your game!