-
Stop player from jumping
I am making simple platformer and when I press SHIFT he jumps and sometimes he keeps jumping, even after I release the SHIFY key. I only want him to jump once and then maybe a short delay before he can jump again. So using my logic, I want him to jump when I press the SHIFT key but he can't jump again until he collides with the ground. I just can't figure out how to program this in event editor. Any ideas?
-
how are you making him jump now?
-
I would use the pmo object, and set a jump condition if player is on the ground and shift is touched then jump (also restrict to one action when event loops) . Otherwise you can continue to jump even off the screen if you kept pressing jump. Not sure if that advice helps? Dave's question is wise, because it depends what method your using to set up a jump in the first place.
-
1 Attachment(s)
I actually made 2 versions to see if there would be a difference.
1. Using physics engine and the player set to active object>platform. The floor is a quick backdrop object. The default control is set to have player jump when SHIFT is pressed.
2. No physics engine. Player set to active object>platform as well. Floor is active object>static. SHIFT makes player jump as well.
I'm not sure what you mean by "pmo object". Also, I understand what you mean by "set a jump condition if player is on the ground and shift is touched then jump (also restrict to one action when event loops)" but I do not know how to program it in event editor.
I've attached the non-physics version if you want to take a look.
Thanks!
Attachment 17564
-
Sorry - Platform movement object is an extension, works great for cross platform movement control :)
-
You have to take fast loop tutorial
http://www.clickteam.com/tutorials#
Advanced => Custom platform mouvement
-
Thanks Bertard...I just downloaded it!
-
For stop a jump add :
Player press key 2
Detector isn't on backdrop => Set grav to 5
-
1 Attachment(s)
Try this it uses PMO with a delayed jump timer using counter :)
Attachment 17565
-
1 Attachment(s)
I just made an example too >_< - see attached, it has plenty of comments so you can understand how it all works.
-
-
Thank you both for taking the time to make the example files!!! I am downloading them now to take a look!
-
Dave - I have been studying your example files and I am starting to understand all the events. One thing I am uncertain over is line 23 where for the player, the internal flag is set to off. Perhaps it is my lack of understanding of flags in this instance. I have read they are similar to booleens but again I not certain why one is needed in this case.
-
Look for the event where the flag is set to on, the flag is default set to off.
A flag is just an alterable value with two modes: ON and OFF.
-
In this example, when you press shift the flag is set to on, and when you do not press shift the flag is set to off.
This means that every time you want the player to jump from the ground, you need to press shift again. (You can't keep holding shift the whole time.)
This restriction is not in the first frame, only in the second.
Note: in line 23, the flag is not set to off, it is checking if the flag is off.
the flag is set on in line 27, and set off in line 28.
-
Advaith - thanks, I think I understand it now.