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 Splash! You Lose

Transcript

In many platform games, the main character falls to their doom when the player loses.

In this video, you'll program your own losing condition.

To start, create a dangerous place to fall, like water or lava.

You could draw your dangerous place right on the game backdrop, but creating a new sprite makes it easier to position the danger element on the screen, edit it, and program it.

Click draw new sprite.

In this example, the dangerous place is a blue line that looks like water, but you can draw any kind of dangerous place you want.

Next, program something to happen if the character touches the dangerous place sprite.

Code the losing condition next to the winning condition to keep your code organized.

Click control and place an if statement inside your forever 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 statement to indicate that the player lost the game.

This example says you lose, and stops the rest of the program from running.

Add your own messaging code to program the losing condition for your game.

Be creative.

Now it's your turn.

Create a dangerous place sprite, then make something happen if the player's sprite touches the dangerous place sprite using if and touching blocks.

Choose an Add-On
Time to Celebrate!
Create a wild winning celebration using some of these ideas.
Moving Platforms
Make your game more challenging by creating moving platforms.
Shrinking 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.
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!
Attributions
  • The song “Magic Marker” is © YouTube-- CC-BY-SA 4.0 does not apply.