In many platform games, the main characterfalls to their doom when the player loses.
In this video, you'll program your own losing condition.
To start, create a dangerous placeto fall, like water or lava.
You could draw your dangerous place right on thegame backdrop, but creating a new sprite makes iteasier to position the danger elementon the screen, edit it, and program it.
Click draw new sprite.
In this example, the dangerous place is a blue linethat looks like water, but you can drawany kind of dangerous place you want.
Next, program something to happen if the charactertouches the dangerous place sprite.
Code the losing condition next to the winningcondition to keep your code organized.
Click control and place an if statement inside yourforever loop below the winning condition.
Go to sensing and drag out a touching block.
Tinch the value to the name of the dangerous sprite.
Next, add code inside the if statementto indicate that the player lost the game.
This example says you lose, and stopsthe rest of the program from running.
Add your own messaging code to programthe losing condition for your game.
Be creative.
Now it's your turn.
Create a dangerous place sprite, then make somethinghappen if the player's sprite touches thedangerous place sprite using if and touching blocks.
Choose an Add-On
play_circle_filled
Time to Celebrate!
Create a wild winning celebration using some of these ideas.
arrow_forward
play_circle_filled
Moving Platforms
Make your game more challenging by creating moving platforms.
arrow_forward
play_circle_filled
Shrinking Platforms
Create a shrinking platform to increase your game's difficulty.
arrow_forward
play_circle_filled
Splash! You Lose
Create a way for the player to lose in your game.
arrow_forward
play_circle_filled
Add Some Tunes
Add some background music to your game.
arrow_forward
play_circle_filled
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.