Jump once only when pressed
Hello, I've been having some issues trying to make my player jump once when the 'jump' button is pressed.
If the button is pressed, I want the player to jump once.
If the button is still pressed, I don't want the player to continue jumping but wait until the button is released.
Once the button is released, everything goes back to normal so the player will jump if it's pressed again.
Basically, to jump many times, I want the user to press many times the button jump, and if the player happens to be in the floor at the time the 'jump' button is pressed, then jumping will be true.
If the button is pressed, I want the player to jump once.
If the button is still pressed, I don't want the player to continue jumping but wait until the button is released.
Once the button is released, everything goes back to normal so the player will jump if it's pressed again.
Basically, to jump many times, I want the user to press many times the button jump, and if the player happens to be in the floor at the time the 'jump' button is pressed, then jumping will be true.
Comments
Make a rule in your jump button when touch is pressed-
change attribute jump to 1
then open the otherwise section of that rule and put a change attribute behavior changing attribute jump to 0
then in your character have a rule when attribute jump=1
-change attribute self motion linear velocity y to 400 (or whatever number you want)
then just have a constant accelerate behavior in the down direction in your player to simulate gravity
I'm still having some problems making my player jump correctly.
Doing what you told me did the job, but if I pressed the Jump button on the air, then it'll still jump so I did an attribute saying that if the player overlaps or collides with the floor, then jump, but now it does the same thing of jumping and jumping and jumping if the button is pressed.
Here's a video so you understand me better:
Turn up your volume to hear the clicks if you want.
Next time I'll use QuickTime's screen recorder.
Thank you!