Endless runner player detect player drop

Starting to learn/write my first game using Corona/Solar2d game engine. And have a very basic question on how do people handle a such this situation which I assume should be common to any game engine.

I am trying to build an endless runner game, where I have an uneven terrain player have to jump between different height platforms while moving forward. Here is the closest to what I have in mind.

  • How do I find if the player has fallen between the the two platforms while jumping ?
  • How do I change players ā€œyā€ value if it has jumped to higher platform, assuming I am just applying a physics linearimpulse on the player ?

The first thought I have is, create a sensor between the two platforms. i.e. An invisible rectangle with a static body and the ā€˜isSensor’ property set to true. Then use a collision detector and badda bing badda boom you can detect this condition.

https://docs.coronalabs.com/api/type/Body/isSensor.html

1 Like

Thank you let me try this out, any tips for my question #2, how do i move player to the higher platform on the jump, assuming only the platforms are moving to create the parallax effect ?

Hello, you might find this game sample by @ponywolf quite usefull. Here is original blog post. Im sorry for spam if you already know it or it doesnt help you with your questions.

1 Like

Thank you, yes I have been studying the source code of above, but unfortunately it doesn’t answer my questions just yet, or may be I don’t understand it fully … thank you again though

I think this can help you:

1 Like
  1. I personally like the way @roaminggamer suggested.
    You could also use Runtime:addEventListener ( ā€œenterFrameā€, endGameListener) and check characters y coordinate …

  2. What about applyLinearImpulse or applyForce used on character physics body?

1 Like

Thank you all for the guidance, let me run through this and see where I end up…