A few issues with ladders

So I’m making a 2d platformer and I have a few issues that I want to fix

  1. How do I make my player only go up and down? So how do I disable left and right movement when on ladder?
  2. Is there a way to adjust the climbing speed?
  3. Whenever you press up key and jump key at the same time, the character goes up the ladder very quickly. How do I stop this?
  1. You can turn off the default controls in the behaviour. Then add events with conditions that test for a particular keypress (e.g. space), and actions that simulate a keypress (e.g. jump key pressed).

    So, test if the player is on a ladder when testing for the left and right keypresses

  1. Adjust jump speed via the behaviour by editing the object properties window.

  1. For the jump key, check if the player is not on the ladder (invert the is-on-ladder condition) and only simulate the jump key pressed if all conditions are met:

image

Can you explain and describe number 1 in more detail? I’m still having trouble with the code

You know where you add the platformer character behaviour to your object? That’s where you uncheck the default controls option.

And to add the conditions, just use the example in my screen snip, but replace “Space” with the direction key, and replace the “simulate pressing jump key…” with "Simulate pressing " and the direction key

Oh sorry I should have been more specific. So when my character is on the ladder, I can move up, down, left, and right. But I don’t want to move left and right and only want it to go up and down. How do disable left and right movement on ladders?

No, I understood exactly what you’re after. And my little screen shot has the information on how to do it. The only difference is that in the screen shot, it only allows jumping when not on the ladder. You’ll need to modify the event in my screen shot to cater for the left and right key presses.


By unchecking the default controls option, and creating events to capture the keypresses. When pressing the left or right keys, check the character isn’t on the ladder before simulating the left and right key press. I’ve already shown how to do it for space bar and jumping.

Alright, thanks for the help