How to measure jump height of a player from the floor while falling?

I want to make a action so that if player jumps from more than a certain height then he dies. Only way it will be possible in my mind will be measuring player height while falling.

Measuring y position of the level does not work as Its a like a platformer game, so there are platforms at all heights in the level. I want somthing that will work everywhere and will measure the distance between the player and floor(which is different everywhere)

Take the Y position of the player when the jump starts, and check the difference between it and the Y position when the player lands.

1 Like

I agree with MrMen, that’s probably the easiest way to do it.

An alternative method would be two events based around the “Player is falling” condition.

  • First subevent would track the Y position of the player as a variable once they are in the “is falling” state (with the trigger once condition).
  • Second subevent would compare the Y position of the player against that variable from the prior subevent + a certain amount based off whatever you decide. (e.g. Y position of player >= YourVariableHere+300) would mean that the player has fallen 300 pixels from when they started falling. At that point you can do whatever actions you want, including tracking some form of death state.
1 Like

Another 2 Methods I found

  1. Start a timer while falling, if for example time is more than 2 sec, player dies.
  2. Putting a object around the player, make it hidden, when falling, check if the object is in collision with the floor or base platform.

Is this the best and simplest way to do it?
Or is there a way to do it with less variables

First save a variable of player’s y position(+1000) when he starts to fall (trigger once)

Then when player is on floor add the y position(+200) to another variable

Then make 3rd Variable that will be equal to. subtracting the 2nd variable from the first

Then if the 3rd variable is for example greater than 500 player dies

You just need 1 variable (I’ve made it an object variable) :

You’ll need to add the appropriate actions in the last event.