In many platform games, the main character can fall to their doom. Right now, this characterfalls off a platform, and the player can just try again. It’s time to give this game a“losing” condition. Watch this screencast to learn how to do that, then try on your own.
First, there needs to be a dangerous place to fall, like water or lava.
To do this, create a new sprite.
You could draw your “dangerous place” right on the game backdrop, but creating a new sprite makesit easier to position the danger element on the screen, edit, and program it.
In this example, the dangerous place will be a blue line like water,but you can draw any kind of “dangerous place” you want.
Now, something needs to happen IF the character touches this “dangerous place” sprite.
There are a few different ways to program this if statement, but because the winningcondition is programmed for the player sprite, the losing condition should be, too.
Computer scientists often work together on programs, so it’s a good idea to organize your codein a way that makes sense and is easy for other people to find and work with.
Putting winning condition next to the losing condition seems like a good way to organize this code.
Click on control, and place an "if statement" below the winning condition inside your "forever" loop.
Go to sensing, and drag out a “touching” block.
Change the value to the name of the “danger sprite.” In this case: Sprite 1.
Now, inside the "if statement", put what should happen when the character loses.
It could be something like saying, “you lose” and stopping the rest of the program from running.
Choose an Add-On
Time to Celebrate!
Create a wild winning celebration using some of these ideas.
Make your game more challenging by creating moving platforms.
Create a shrinking platform to increase your game's difficulty.
Splash! You Lose
Create a way for the player to lose in your game.
Add Some Tunes
Add some background music to your game.
Bug Fix: Land on Your Feet...or Not
Fix the bug that allows things other than a sprite's feet to keep it on a platform.