Jumping Behaviour Not Working As Expected

I have created a project that tries to stop the user from jumping whilst on a ladder. In fact, I don’t want them jumping while at the base of the ladder before they push the Up key.

The basic code is:

I’ve added code to check the values of the Jump Speed and you can see that in the video:
https://youtu.be/1455dt8jmxg

The error occurs when you move the zombie into the ladder zone (within 200 pixels of the ladder. It correctly sets the jump speed to 0. If you move back out without attempting to climb the ladder or jump (just move left again) it will successfully jump once outside the 200 pixel ladder zone.

However, if you move into the ladder zone, attempt to jump (nothing happens as the jump speed = 0), then move back out of the zone (jump speed will = 600 again) and attempt to jump…no jump.

The variable you can see on the screen is the current value of Jump Speed for ZombiePlayer. Would love to have this solved as it is a major drawback for my students!

I am not sure to well understand what you want to do but i notice your first event autorize the player to jump with a greater force (cf. when the player is far away of the ladder distance > 200 pixels))
Is it what you really want to do?

Why don’t you try when Zombieplayer is in collision with ladder set jumpSpeed to 0

Hi, yes I have built this project just to show the problem. I want the player to jump normally (Jump Speed=600) when it is not near the ladder, and not jump at all (Jump Speed = 0) when it is near the ladder.
The player CAN jump if you move near the ladder, then move away from the ladder and press the jump key (SPACE).

The player CANNOT jump after going near the ladder IF you attempt to jump (press the SPACE key) while near the ladder and then move away from the ladder. It still will not jump.

Hi, yes, that works better but this problem behaviour still exists.

If you move to the ladder, press SPACE the zombie won’t jump (as expected). If you then move back away from the ladder without attempting to climb the ladder the zombie won’t jump when you press SPACE. It seems like it is a bug to me.

For the game my students are making, they need an exclusion zone around the ladder to prevent the zombie jumping onto the ladder halfway up and cutting down their climbing time!

The problem is that you can only jump once until you get back on the ground, so when you jump at 0, the jump toggle is enabled, but since you don’t get back on the ground, the toggle remains enabled.

You should be able to fix by adding a “allow player to jump again” below the 600, with a trigger once.

Although, would probably be cleaner to set up custom controls and disable the jump button as needed.

Add a variable can_jump = 1, then change it to 0|1 depending on the actions you need
like if player is bellow 600 and can_jump = 1 then allow player to jump again, Trigger once and change can_jump =0

Thanks for the input - it makes sense. I tested it by making the Jump Speed =50 instead of =0, and you can visibly see the zombie jump. Problem is, once you move the zombie left (but don’t climb the ladder) the Jump Speed does increase to 600 as expected, but the zombie still can’t jump!

The problem with setting up custom controls is it defeats the purpose of having a Jump Speed and a Ladder Climb Speed (and other settings too). It might however be the only workaround that works…

PS: Just tried the Trigger Once sub-condition, and it works. This is the best workaround, but I still feel this is a bug behaviour. The jump speed should only affect the ability to get the jump started, not impact the ability for a jump to occur at all.

Thanks everyone for the input.

I tried with 50, indeed the problem remains, but I don’t see the player jump.
With 100, I see the player do a mini-jump and the problem is gone. I guess it depends on the gravity setting too.

It’s a bug okay, but a very minor bug with a workaround… I’d prefer the devs focus on other things. :wink:
Anyway, thanks for reporting. I posted it on the Github under a similar bug as I suspect the cause is the same.

1 Like

Gruk, is a bug in relation to Distance instruction or gravity?

Thanks

In my opinion, the problem is this:

The value of 0 prevents the switch of the jump counter, so another jump is forbidden unless using “allow jumping again”.