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

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.
arrow_forward
  • 1. Platform Games: Intro and Design
  • 2. Use Events to Make the Sprite Jump
  • 3. Move the Sprite Left and Right
  • 4. Create a Winning Condition
  • 5. Add-Ons
  • 6. Reflection
  • 7. Wrap-up: Platform Game
  • 8. Wrap-up: Share Your Project
  • 9. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

In many platform games, the main character can fall to their doom. Right now, this character falls 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 makes it 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 winning condition 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 code in 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.

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!