Set the jump so it can only be used once

LuiscriLuiscri Member Posts: 40

Hi, I have introduced the jump option in my game by the "Change attribute > linear velocity > Y", when I press the space button, but the problem is that whenever I press it, the character jump, and that can be done as many times as you want. I would like that the jump could only be used once until you touch the floor or the platform again. How can I do that?
Thank you for your answers.

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Add a second condition to your jump rule that also checks to make sure the player is touching your ground platform in addition to pressing the space bar.

    If you need a tutorial see:

  • LuiscriLuiscri Member Posts: 40
    edited November 2014

    Do I use the collision behavior or should I use another one? Srry for asking but Im new on this.
    Thank you by the way dude :)

    EDIT: Using the collision behavior the character doesnt jump at all, its as if he was shaking. Which one should I use?

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Set up a rule something like:

    When space bar is pressed AND player overlaps or collides platform
    
    Jump
    

    That is not real code of course since I don't know your actors names.

    The tutorial posted shows it in detail if you need more information.

  • LuiscriLuiscri Member Posts: 40

    I used that rule but the problem is that as while you are jumping the character is not overlaping or colliding the platform it stop jumping and fall to the platform again altough you are pressing the space button. I dont know if I have explained myself.

    Can you tell me the minute where its explained in the video you added? English is not my native language so I have some troubles on following the video.
    Thank you so much.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Here is a sample project, the player will only jump when it is touching the platform. If you are using the windows version and not able to open this mac file, here is a screen shot of the behaviors on the player. The main behavior of interest is the rule and it's conditions.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    The picture didn't upload, here it is...

  • LuiscriLuiscri Member Posts: 40
    edited November 2014

    That was what I set, but I repeat that with that behaviors the character doesnt jump at all, it only does a kind of shake because with that set when the actor (character in this case) stop being in contact with the platform it also stop jumping because the condition "ovelap or collide with platform" stops happening. Another idea of how can I make it?

    EDIT: Ok, I managed to do it. The problem was that you have to consider on the initial condition the buttons being up for a 0 velocity, and set the movement on the "else/otherwise" section. Its explained on the video jamie_c added on the minute 9-11. Thank you for the help.

Sign In or Register to comment.