Jumping help needed, please.

I am crafting up a platformer and have all movement aspects working as I would like them, with the exception of jumping.

Stuff I have working as it should:
- "Gravity" on actors via an acceleration attribute.
- Jump option only activates when I want it to (while colliding with floor && up is pressed)
- Animation displays only when it should

My issue is the movement that the jump takes/displays. I want to it be a Mega Man style of jump; which is to say, the longer jump is held, the higher you go (up to a maximum). MM jumping is also very precise movement; if you press right you move right, if you let go of right, you stop moving right.

What is happening when I jump is what every tutorial on the internet shows: I tap jump for a millisecond and my character going BOOOOOOOOOOOOING to its maximum jump height and falls back down. If I tap the jump button and tap the right movement key, my character goes BOOOOOOOOOOING toward the right to its maximum jump height and right movement in this gigantic arc.

Does anyone know of any tutorials or have any suggestions on how to tighten this type of movement up?

Answers

  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    Turn down the acceleration. That should help.
  • MissOgynistMissOgynist Member Posts: 5
    Utveckla - When I turn down the acceleration for gravity, the characters are able to jump to crazy heights and gently float back to the ground. If I also turn down their jump values (self.motion.linear velocity.y) I gradually get back to the same issue I am currently having.

    Jamie - I have watched your videos, and while helpful, they are almost the same thing I already have. The jump function has a player jump to a maximum height just by tapping the jump button and then fall back down to the ground.

    What I am looking for would be like:

    decrease Y value;
    only While jump button pressed
    {
    increase Y value (up to maximum Y change);
    }

    * A quick tap on jump would jump up a very short distance while a long press on jump would jump a much higher distance (instead of just having one value that goes to the max value whenever jump is touched).

    Get what I mean? Thanks for the quick responses :D
  • 3itg3itg Member, PRO Posts: 382
    edited April 2013
    try something like a real attribute, and a combo of on touch press and on touch release rules.
    Figure out how sensitive you want your jump to be, and use that as an increment to divide by (whatever you want here, but im doing 5 because it seems reasonable). Im calling it JumpIncrement.
    so rules...
    a jump button:
    **begin rule**
    when touch is pressed,
    change self.JumpTimer to self.Time
    (Using a type of timer replacement here.)
    **rule inside a rule**
    When ALL
    self.Time is greater than (self.JumpTimer + 0.2)
    &
    When game.JumpIncrement does NOT = 1
    Change Attribute game.JumpIncrement to game.JumpIncrement+0.2%1
    Change self.JumpTimer to self.Time
    **end rule inside a rule**
    **end rule**

    **begin rule**
    when ALL
    touch is released
    game.JumpIncrement does NOT = 0

    Change attribute game.PlayerJumping to True.
    **end rule**

    On the Player
    **begin rule**
    When ANY :
    game.JumpIncrement is = 1. (Auto-Jump @ max power)
    game.PlayerJumping is True (A Boolean so you know the jump is ready)

    Use you jump rules here...
    (game.JumpIncrement multiplied by your maximum jump speed (height / whatever))
    game.JumpIncrement * game.JumpHeight
    change game.JumpIncrement to 0 (reset to 0 for the next jump)
    game.PlayerJumping is false (reset to false for the next jump)
    **end rule**

    Having a separate variable with a max value of 1 to do this calculation makes it pretty easy.
    1 = 100% when multiplying against another integer.

    If you have any problems with JumpIncrement exceeding 1, there are several different ways of controlling it, I wont suggest any here, because as soon as I think about it I get several ideas about cool ways to implement it like if you are looking to do a button effect like have a power icon fade in...
    You could constrain your jump to an objects alpha (which also has a max value of one).
    Shooting from the hip here...
    All untested.

    Give it a whirl @MissOgynist and let me know how it goes.
  • 3itg3itg Member, PRO Posts: 382
    edited April 2013
    It got just slightly more complicated when I tested it... but not much, and Im pretty sure its going to come down to how you want your jump to work.
    But this is likely easier to read than my explanation and Ive edited the above post like 5 times already :)
    Edit: Seems like I cant attach a project, looks to have failed and I cant edit one in...
  • 3itg3itg Member, PRO Posts: 382
    edited April 2013
    got it...
    Not much but it should show how Im using my explanation above.
    (And the timer obviously needs to be a little faster than it is.)
  • MissOgynistMissOgynist Member Posts: 5
    3itg - Thanks much for your response and time put towards this question. That is getting closer to what I am looking for, but the only issue that remains with your project file is that jumping would be on an initial delay. Although, I think I might be able to edit what you provided to better suit my jumping inquiry by giving an initial jump value and then having a nested timer such as the one you created.

    I'll let you know if I get something that works well and looks nice from it. :D
  • 3itg3itg Member, PRO Posts: 382
    edited April 2013
    @MissOgynist
    there is a .2 delay the way the timer is structured.

    I did it that way so you could clearly see your jump "Power"...
    Its also because of the fact that I use accelerate for the "Jump Up" and Move for fall back down is not set to a variable, I think its just 300 or something, you could try using your MaxJump integer here as well & Play with the physics settings on the player and the MaxJump value.
    The player is set to 100 density, 10 drag...
    There are lots of different ways to make a toon "Jump" so when shooting from the hip its hard to tell what will work for you exactly.

    Hope you get somewhere with it though, and good luck.
Sign In or Register to comment.