How to make it possible to jump only on a certain object

I want to make collision work but if I use jumping code, The character can still jump in mid-air. How can I make sure that the character can only jump on certain objects?

Well, make it so that if the jump key is pressed and the player is touching the platform, then they can jump. I recommend putting this code in the platform itself so that you wouldn’t need to name every platform in the project

1 Like

uSe mY plATForMeR ENginE

ok in a nutshell you only allow the player to jump when its y velocity is 0. in cases like in my platformer engine, you check if its y velocity is the object’s gravity because of the way the collision works. It might be a different thing in your case.

If you do this, I’m guessing the player can jump up walls and stick on the ceiling if the player holds the jump key. the player is touching the platform, so it will let the player jump anyway.

Wall climbing is kinda neat. I’m leaving that in. Kinda like an intentional bug.

1 Like