How to STOP Auto-Jump by holding JUMP button?

After searching for a solution in the forums, I did found some based on making variables and use them for some sort of Reset / cooldown…
But since it’s been some time I’m curious if I’m missing something and maybe things have updated and changed, maybe become much simple to do:

With the built-in Platformer (not using the Default Controls)
Is there an option I’m missing to stop that LOOP from keep jumping?

When I tried “Only Once” it will change the height of the jump (so I need to manually enter a larger number) but it doesn’t feel good.
Also, it’s loosing the Sustain: “hold long for MAX height jump”

So, I’m curious if I miss something maybe the Platformer behavior had an update with this feature as a toggle ON/OFF or if there is a more simple way I can do that without build a cooldown system for the jump?

What is the best way to do it, examples / screenshots will be VERY helpful so I can follow and try for myself.

Thanks ahead!

To clarify a bit, there are no loops involved here.

The default behavior as designed that is if the jump button is held, as soon as your jump completes and the object is back on the ground, the jump will trigger again.

That said, here’s the most common ways I recommend it. Both of these also include Coyote Time logic, and are designed around Jump Sustain.

Purely through events:


(Note the coyote time is set super long for testing, normally you want that timer to be closer to 0.083 seconds for ~5 frames of coyote time)

Using the advanced jump extension:

In either case you’ll want to ensure the default controls are disabled to set these up. If you don’t need jump sustain it becomes a bit easier, and you can see an example of that in the not-a-vania example in the engine.

2 Likes

Thanks for sharing :pray: I will do some experiments.

I hope that in the future we’ll have an easier way to control it as an update option to the default platform behavior.

Necro Necro
But it was 1st forum post i found on google when i searched “gdevelop autojump”

So to any1 who will face same problem i found this to be pretty straight forward

Since you have platformer character behavior on your player
You add platformer remap behavior
And with these 2 events it prevents auto jump when holding jump button
Top event requires NOT having trigger once

IF you want to jump with SPACE but not auto-jump
DISABLE DEFAULT CONTROLS in platformer behavior
And simply remap jump key to space

Edit part 1
If someone want to have default controls but still disable auto jump for remapped controls and default controls
I edited remap behavior to allow secondary keys

1st disable default controls then you just add them left right up down jump
And now change in events

Here is the logic I use to remove bunny hop. Z key is what I’m using for Jump.

Hey! On the same topic, I tried @Gaskinmoo 's solution but it doesn’t work with gamepad extension. I tried other solutions (using variables) but nothing I did worked with the gamepad extension. Probably I did something wrong! Could anyone just let me know if that’s doable?

Cheers!

Marraw

I tried this way but the jump isn’t very natural anymore (the player falls abruptly when the “falling” starts) so it is not great…

My events above work with gamepad and keyboard, and are an extrapolation of what is used in my not-a-vania example in the engine.

Trying to use workarounds by disabling behaviors is just going to do things such as break gravity or other inputs (as you’re experiencing).

I’d recommend using the method I have above, and just ensure that you use an “or” advanced condition whenever there is something that says “Space key is pressed” and add in your gamepad button. (If there is an inverted “Space Key is pressed” you will not use OR, you will instead also add an inverted (gamepad button for jump is pressed)).

I set simulate jump key for gamepad and add variable to it as you see

And rest is same crap from my post above with addition of shoving in that variable

@Silver-Streak and @ZeroX4 Thank you guys, so this is definitely on my end :smiley: As I expected! I’ll make the corrections you suggested!
Thanks!

2 Likes

Hi guys!
Sorry to be such a drag! I’ve tried both solutions and somehow, I can’t make them work…
Let me post the events. Oh, I disabled “default controls”.
Solution n°1 :

It works with Space but doesn’t with the “x” key or the gamepad A button.

Solution n°2 :

This solution works with the “x” key but not with the A button or space…

I really don’t get it!

Would you have any clues?

Cheers!

You are using built in remaper
I pasted here How to STOP Auto-Jump by holding JUMP button? - #4 by ZeroX4
Link to post with edited version of it which allows you to remap for 2 keys not 1

So you use that extension then you disable default controls then you do what i have on screenshot (the one that shows up down left right space and WASD X)

And now all should work

Oh damn! I didn’t realise that! Thanks! I’ll try that as soon as possible!
I’m sure you guessed I’m fairly new to Gdevelop but I’m looking forward to understanding it way more!

Thanks for your help!

1 Like

Hi again! Sorry to come back to you so soon! But that really bothers me and I really don’t understand what I do wrong. Maybe it has something to do with my gamepad or the way I set the gamepad extension… I really don’t know…
So, I’ve tested things in a blank project so that to remove any chance of other events circumventing things in an unexpected way…
With the new elements you’ve given me, now both the “x” et the “space” keys are working really well. Sadly, no such “luck” with the gamepad button. Let me post my events…

To further test this, I’ve printed to screen the value of the Variable GAMEPAD_JUMP_OFF and I get the expected results : “false” from the start then it turns “true” when the Player starts falling and goes back to “false” when I release the keys/buttons.
These values are (of course) the same for “x”, “space” and the A button. However, the autojump doesn’t disable for the gamepad even if the GAMEPAD_JUMP_OFF stays “true”…

I don’t get it at all :smiley:

For illustration purposes : Preview of TestingGround 2023-12-08 16-34-45

1st of all look how my event for gamepad looks and how yours

It should contain only condition for gamepad

Next

We have pretty much same event setup so it should work

2023-12-08_15_57_x7jjAWk9kc_Idle

BTW you uploaded 10 sec video

Hey! Thanks again for your help!
Yes, you’re right, the video I linked wasn’t the right one! I corrected the link! Sorry about that!

I did exactly as you showed me, here are the events :

But, on my end, it stil doesn’t work…

I’m sorry if I’m going too far with this but as this is just a Testing project, I can share the link and if you have time/feel like it, you can have a look…cause I’m fairly stuck!

Hi again!
I don’t know why but I went to mess up with the Gamepad extension and I applied the logic directly into the Gamepad mapper and it seems it disabled the autojump…I tried adding the AdvancedJump extension (just to see if I was going to run into troubles later…) and the double jump works as well… :thinking: and it still disables the autojump…
Here is what I’ve very simply done :

do you think it will cause troubles later down the line?

1 Like

I just wanna say ONLY difference between our events are that you have your gamepad connected as 1 mine is 2

It SHOULD NOT play any role but that is only difference i can spot
SO MAYBE who knows?
Anyway your solution with messing with extension is kinda clever
If it works stick to it
If something will break cause of it
You can revert your changes and then try to figure other way to block auto jumping
But for now if it works then do not care and just accept it

1 Like

Hey! I’m quite proud tonight :smiley: After a few hours of work and a lot of trials and errors, I successfully modified the Gamepad Extension so that I only have to tick a checkbox to activate/deactivate AutoJump!
Here is what it looks like :

This is a very modest work and I’m sure, not very elegant coding but as far as I know, after many tests, everything seems to work fine!

Let me know if sharing this would interest someone!

1 Like

It is Auto-Jump not Autojump
Change that and now i am not kidding

Offer it to be implemented to official extension

Me is proud