User mini profile

- Wed 13 Sep 2017, 08:29#63265
I was following the tutorial for a platformer game, and noticed that the character will bounce if the player is still holding down the jump button when they land on the ground. Since holding down the jump button increases the duration of the jump, this can become rather annoying if your trying to time your movements while crossing a difficult area. Is there any particular way to prevent the player character from jumping once they come into contact with the ground, while still holding the button down?In other words, have it so that the player only jumps when the button is pressed, and not when it's held down or released.

User mini profile

The parent event (event 1) will be launched each time you press Space for the first time, if you hold the key down the event won't keep launching until you release Space and press it again.The sub-event only runs after the parent runs, so each time you press Space for the first time the parent will be launched, it has no actions but the sub-event will be launched too and the player jumps, if you hold down Space the parent won't run so the sub-event won't run

User mini profile

- Fri 15 Sep 2017, 09:14#63295
I'm not sure why, but it didn't seem to work for me, after playing around with it I managed to get it to work though.I have a double jump command for the character, which I thought might have been interfering in some way, so I tried deleting that, but it still didn't work. I also tried it on a fresh platformer game, but it didn't work there either.However, when I replace 'Player is on Floor' with 'Player is Jumping' and set the action to 'Ignore default controls for Player: yes', it seemed to work, but the player controls for left and right were frozen and I had to reset all of the movement simulations, it also stopped the ladder function from working altogether.The solution seemed to be having the condition 'Player is on Floor' with 'Ignore default controls for Player: yes' as an action, and also having the condition 'Player is Jumping' with 'Ignore default controls for Player: no' as an action; each as their own independent conditions, and keeping the simulations for left and right movement.So basically:

There is probably a better way than this, but it seems to do the trick for now.

Thank you for the help! ^_^I would never have thought of looking in the platform behavior area. ^_^;

User mini profile

- Wed 20 Sep 2017, 20:41#63402
Sorry for the late response, I've been a bit under the weather. ^_^;

I just tried both, but it didn't work do to the variables, so I switched the numbers 0 and 2 around and it worked.The problem I'm actually having is not related to this issue, I did managed to fix the bouncing issue, the problem is the way I went about it was by using the 'Ignore default controls for player' command, which disables other functions and has to be rest afterwords.Basically, what I'm trying to figure out is how to get the same result, without having to use that particular command.

User mini profile

- Sat 23 Sep 2017, 01:42#63425
I had a play and it was trickier than I thought because the platformer behaviour overrides everything else, so it was necessary to set the jump speed as well as the Jumps variable. It was easy to stop a bounce, but not while still allowing a double-jump. Sub-events did the trick in the end.

Anyway, the pic below shows how to change events 9 and 10. You can then delete events 11 and 12.

nobounce.gif (23.42 KiB) Viewed 112 times

As a side note, if you are using the platformer behaviour with default keys then you don't need the "simulate pressing" actions. The player will jump when space is pressed, or run when left is pressed, regardless of what's in the events.

About GDevelop & GDevApp

GDevelop is the open source game creator that enables you to make your games without coding. We also created GDevApp, an awesome, easy to use game creator available online, directly from your browser and your mobile devices!