# Make the player die after a long fall with StencylWorks

I already showed you how easy is to create a platform game with StencylWorks and even how to include a double jump feature.

Anyway, in some platform games you need to make the player die if falling from high places.

Try to play this prototype:

You can play with ARROW keys, and perform double jumps.

If you fall down the left cliff, you will die (actually, you turn gray for couple of seconds – that’s how I show you would have died).

If you fall down the right cliff, you won’t die.

If you jump from the right cliff and fall down, you will die.

This happens because there’s a maximum falling height. If you’re falling for more than such height, you will die.

To make this kind of behavior, first we need some attributes:

is falling is a Boolean variable to determine whether the player is falling or not

falling start is the y coordinate in pixels of the player when it begins to fall

deadly height is the height, in pixels, of the deadly height. Also notice this attribute is not hidden so it can be set when the behavior is added to the player:

Then, this is the behavior:

As you can see it’s just a matter of checking if player’s y speed is greater than zero (the player is moving down, so it’s falling), and once it hits the ground again, calculating for how long it kept on falling.

215 GAME PROTOTYPES EXPLAINED WITH SOURCE CODE
// 1+2=3
// 10000000
// 2 Cars
// 2048
// Avoider
// Ballz
// Block it
// Blockage
// Bloons
// Boids
// Bombuzal
// Breakout
// Bricks
// Columns
// CubesOut
// Dots
// DROP'd
// Dudeski
// Eskiv
// Filler
// Fling
// Globe
// HookPod
// Hundreds
// InkTd
// Iromeku
// Lumines
// Magick
// MagOrMin
// Maze
// Memdot
// Nano War
// Nodes
// o:anquan
// Ononmin
// Pacco
// Phyballs
// Platform
// Poker
// Pool
// Poux
// Pudi
// qomp
// Racing
// Renju
// SameGame
// Security
// Sling
// Slingy
// Sokoban
// Splitter
// Sproing
// Stack
// Stairs
// Stringy
// Sudoku
// Tetris
// Threes
// Toony
// Turn
// TwinSpin
// vvvvvv
// Wordle
// Worms
// Yanga
// Zhed
// zNumbers