How to know when the player object falls between tiles in 2D game to take decesion of gameover
I am writing my first 2D game (Like mario) with tiles. When users fails to jump proper he falls between the tiles. Presently he is falling in space for ever when he fails to jump.
How to handle when user fall from a tile to space and make the Game Over.
Even telling the approach is also fine for me.
Answer by Commoble · Mar 16, 2017 at 05:48 AM
There's two ways to detect this.
1) Put a an object with a trigger collider down in the pits. If the player enters its trigger area, initiate your Game Over stuff.
2) Alternatively, have the player object detect when it's below a certain height. This is less flexible, but easier to set up if you don't need the flexibility.
There's a million different ways to do a Game Over cinematic, so what happens once you detect that the player has fallen into the pit is up to you.
Your answer
Follow this Question
Related Questions
OnCollisionEnter2D not getting called 2 Answers
Unable to stop animation upon collision (2d, animation, rigidbody) 0 Answers
Ui Collision Detection 0 Answers
I have two different objects I would like to check when A and B gameObjects are collided ? 1 Answer
Changing light color between players when they collide (BOLT) 0 Answers