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.
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.
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.
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
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?
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)).
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 :
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)
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!
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’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… and it still disables the autojump…
Here is what I’ve very simply done :
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
Hey! I’m quite proud tonight 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 :