Jump once only when pressed

davidsalomondavidsalomon Member Posts: 136
edited November -1 in Working with GS (Mac)
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.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    make a attribute called jump.

    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
  • davidsalomondavidsalomon Member Posts: 136
    Thank you very much John.

    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.

  • davidsalomondavidsalomon Member Posts: 136
    Sorry for the watermark in my video, but I had no choice since I still don't have the privilege on buying lots of softwares.
    Next time I'll use QuickTime's screen recorder.
  • davidsalomondavidsalomon Member Posts: 136
    I really hate to do this, but I prefer the response of any of you so I can keep moving forward in my game's creation... BUMP
  • TheGamerTheGamer Member Posts: 94
    As I'm new and not very good at this yet, but I would add a timer to limit when you can press the jump button. Maybe someone has a better suggestion?
  • davidsalomondavidsalomon Member Posts: 136
    All right, email sent!
    Thank you!
Sign In or Register to comment.