Trouble with limiting actor jumping once

Hi all,

I have my jump code set like so:

When key (w) is pressed, do

Timer (0.5 seconds) run to completion (unchecked)

Accelerate (90 degrees) relative to (actor)
with acceleration (3500)

I am having trouble limiting the actor to jump only when contact with floor or walls. I want the jump height to be adjustable so cannot check the 'run to completion' and add in the usual jump boolean after the jump has finished.

Comments

  • BelwasBelwas Member Posts: 22

    No one knows? :(

  • Speedy007Speedy007 Member Posts: 229

    Try using a boolean set so when It is false let him jump and change boolean to true...That way they cant keep jumping ...The set it so when the actor touches the ground of wall the boolean gets changed back to false. Letting him jump again.

  • BelwasBelwas Member Posts: 22

    @Speedy007 said:
    Try using a boolean set so when It is false let him jump and change boolean to true...That way they cant keep jumping ...The set it so when the actor touches the ground of wall the boolean gets changed back to false. Letting him jump again.

    This doesn't work as the actor immediately stops jumping when it leaves the floor as the jump isn't for a fixed time :s

  • Speedy007Speedy007 Member Posts: 229

    Ok...set it as follows... (If you are using a button to jump)

    When touch is pressed and Boolean(lets say Jump) is false turn
    Jump to true..

    Now in the actor that you want to jump set as follows...

    Rule: When jump is true start Timer for 0.5 seconds(or as long as u want) move actor in the direction up...then let gravity pull him back down or have him move down....then when actor touches ground or wall change jump back to false...

    So when you touch the button it will make you actor "jump" for 0.5 seconds. Then he will fall unless he touches the wall or ground then you can jump again...

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

    I have a tutorial below that covers one way of doing single and multiple jumps if you want to check it out:

  • BelwasBelwas Member Posts: 22
    edited September 2014

    I've finally worked it out by simply adding an extra rule with another timer :)

    IF
    key press W is DOWN
    Collision with GROUND
    
    DO
    For 0.5 seconds TO COMPLETION
        For 0.5 seconds NOT TO COMPLETION
             IF
              key press W is DOWN
              DO
              accelerate 90 degrees 2500
    

    Thank you for your suggestions, I will try those both out too when I get on the computer :)

Sign In or Register to comment.