Bb3 Charecter Jump

Discussion in 'How Can I...?' started by eliesleiman, Aug 4, 2018.

  1. eliesleiman

    eliesleiman Boxer

    Joined:
    Oct 5, 2015
    Messages:
    6
    Likes Received:
    1
    Hi all

    kindly I am trying to figure how I can let the object or character only jump once when I press the screen

    as for now if I keep pressing the character keeps on going up

    in the character model I add touch than link it to jump settings x y z

    but there is no jump count

    any idea

    thanks mush
     
  2. snowflake

    snowflake Boxer

    Joined:
    Jul 27, 2018
    Messages:
    7
    Likes Received:
    0
    Hi eliesleiman.

    We are still missing a lot of node to control this kind of flow out of the box.
    But its pretty easy to extend a node to support this kind of feature.

    e.x
    In this sample I have added an Attribute on the default Jump - Movement node.
    And added a little logic, so every time the Collision node is activated.
    The Jump node is informed to reset the _canJump variable.

    ResetJump.png
    As far as I can tell exporting and sharing custom nodes is not something we can do in the current version.
    But we can export the asset with the nodes attached to it. So here is the sample.

    If you still have problems then share your BB3 file
     

    Attached Files:

  3. Jackazoid

    Jackazoid Avid Boxer

    Joined:
    Sep 7, 2017
    Messages:
    176
    Likes Received:
    72
    In the Actor you can just use Start --> IfCollide (All or floor or whatever) --> Touch --> Jump
    Now it only jumps after it touches whatever you want it to jump on once (every collide)
     
  4. jmiller8031

    jmiller8031 Avid Boxer

    Joined:
    Feb 23, 2018
    Messages:
    218
    Likes Received:
    82
    Actually, to confuse you even more:p, I would use velocity checks to initiate jumping. Well, I would really use raycasts, but I don’t know if that is available yet.

    The issue with collision checks is that if the timing of the collision is out of sync with when the game logic would check for the collision, which could happen if your frame rate drops while playing or if you’re moving too fast, the game will stop working as it should and you will get unwanted behavior. There is also the issues of overlapping collision shapes and hitting corners of collision shapes that could cause odd behavior. You have to remember that the player could potentially be tapping on the screen rapidly at any time and you have to account for that as you design stuff.

    So the logic to figure out is as follows:

    First off, right when you touch the jump button you need to store the players initial vector position in a variable. You also need a Boolean variable to enable jumps. Finally, a second Boolean to check if you’re falling.

    If the players vertical velocity is at or around zero(you can use a small range to keep the pacing of the action snappy) and you’re not in the air you would then enable jumping. To do that you check a few following conditions.

    If the players vertical velocity is positive (moving upward) you are already jumping and can’t jump again. Jump Boolean is false.

    If the player is at the jump apex(as high as you can go) your upward velocity will be at or near zero again. Your position will be different though so you use that stored original position to check against the new position to see if they’re different. If they are the player cannot jump again. Jump Boolean is still false.

    If the players vertical velocity is negative( coming down from a jump or falling off a ledge) you can’t jump. Jump Boolean is false. You would also set the falling Boolean variable at this stage to true.

    Finally, you check if your players vertical velocity was ever negative with the falling Boolean, if it was and the velocity is now zero again, you reset the position variable with the new position data and the falling Boolean to false. The player can now jump again so you set the jump Boolean to true.
     

Share This Page