0 Favourites

How do I Calculate Jump Height?

  • When I touch screen. I want my player jump to "Max Jump Line".

    I have bullet behavior on grounds.

    I used platform behavior for jump.

    Grounds have Jump-thru.

    CAPX

  • Here is the formula you must use: V^2 = u^2 + 2aS which becomes: u = sqrt(2aS)

    Where S is the distance, u is jump strength, and a is gravity, and v is the final velocity which in your case will always be zero.

    Okay so this is how it will work, Make a Global variable called S, a , U

    When user presses the Jump key/touch:

    • set S to the distance from max jump line to the player(player.y - maxJumpline.y).
    • set "a" to the gravity/9.81 of the player(player.behaviour.platform.gravity/9.81) ~ assuming that gravity = x * 9.81, you might fave to test this
    • Set U to sqrt(2aS)
    • Set jump strength to U
    • Simulate player to jump
  • x = 8 worked fine. Thx.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Here is the formula you must use: V^2 = u^2 + 2aS which becomes: u = sqrt(2aS)

    .....

    I have problems with walls. When my grounds going down and my player collide with any walls, It is problem. Do you know any solution for this?

    1. I want this every time.

    2. This is problem. I don't want this.

    I tried pin behavior. It is sets position not looking good sometimes.

    I tried gravity set 10000 this times when I try to jump it is not jumping to line.

  • Sorry I am not sure what your are asking here. Are you saying that when the player hits the walls when jumping/while in jump the player does not reach the max jump line? If so, then are you using the "Bound to layout" behaviour? The "Bound to layout" behaviour messes up the jumping and gravity so instead just use 2 large beams with a solid behaviour on either side of the layout for the walls. To keep the walls in sync with the player, Just set the walls.y to player.y(assuming that the walls hotspot is in the middle for the walls)

  • Quasar

    Please consider posting your .capx to cut down on pointless guesswork. It will be a benefit to you and anyone trying to help.

  • zenox98, Reuben

    I add my capx.

    No, max jump line working fine.

    My problem; when my player on floor and collide with wall; Platform behavior using "wall sliding". I don't want wall sliding.

    I mean I don't want this.

  • I spent some time trying different ways but still got no answer to this problem. I am sure there is some kind of way. But seeing that it probably nor going to be found you can always program you own platform behaviour(Not a new plugin or anything but in construct itself). I have had similar problems with the platform behaviour so I usually make my own, Here:

    Complex platform behaviour without the construct 2 provide behaviour. Take a look at this and coppy some of the mechanics and add some.

    Hope this works for you:)

  • Reuben

    Thx for all. I will try that capx codes.

    or

    I will try to hack platform behavior for disable wall sliding.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)