Jumping with Physics

0 favourites
  • 14 posts
From the Asset Store
Jump on candies, collect candies and earn score!!!
  • Has anyone managed to figure out how to implement a proper modern jump system with physics for a platform game?

    I'm currently using a system like this:

    Space is DOWN

    -----Jump =/ 0 > Apply Impulse to Player.Jump*45

    Space is PRESSED

    -----Jump = 0

    ----------Player is Overlapping Floor at offset (0, 10) > Set Player.Jump to 3

    Jump > 0

    ----Every 0.1 seconds > Subtract 1 from Jump

    With this system, you can jump at varying heights based on the duration of the space bar being pressed, and it won't jump while you're in the air.

    The problem with this system is that if you have bounciness on (which looks weird with it off), it's difficult to set a jump if you're moving quickly and jumping from platform to platform. Also, you can "jump" off the sides of platforms. Also, the jump doesn't feel like a jump - it feels more like you're slowly accelerating up whereas a jump feels like a fast impulse (as if you were to just do a Space is Pressed > Set Impulse to X).

    Does anyone have another system that would work for something like this?


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For the first question, make a variable called "canJump", and make it so that when the player is overlapping the floor at an offset, this variable is 10 (this number can be changed later).

    Then, if he is not overlapping the floor and "canJump" is greater than 0, make it subtract 1, so it will go back to 0 very fast when it is not on the floor.

    Now the jump event will require this variable to be greater than 0. This means you can jump even if you just left the floor or because of fast moving or bouncing a little.

    With this you can remove the need of the variable "jump" you are using, and make the first event (the 'space is down') work only when "canJump" is 0, which means the player is already jumping or falling


    For the second one, increase the gravity and the impulse you are giving you object. This will depend on your object's density, so play around with it.

    In an old project of mine, a gravity of 50 and an impulse of 8 is enough for a very fast jump.

  • Hmmm...I'm having trouble getting this to work properly. The problem is that when the player is overlapping with the floor, it continuously sets canJump to 10 depending on the offset. If the offset is set too low, it doesn't work properly with the bounces, but if it's set too high, the canJump variable stays at 10 until it's far enough "away" from the floor which results in random jump heights.

    I tried adding a "trigger once" under the overlapping floor; set canJump to 10 event, but that seems to break it further...

  • Ok I think I got the bouncing to work - the only issues with it now is that if you spam the space bar on first jump, it occassionally will "double jump" (not high, it's just not a smooth jump). Also, if you hold down the space bar, every time the player hits the ground, it immediately jumps again.

    As far as the second problem I'm having with the accelerated jump - increases the impulse would mean I can't set it so if you tap the space bar, it does a small jump, and if you hold down the space bar, it jumps to its full value. That feature is pretty important in my game.

    Any ideas?

  • Can you send me a .capx so I can take a look?

  • Here is the example

    Thanks, 7Soul!

  • Can you upload it to dropbox? I'm getting 400 b/s from this link u.u

    Also, when you reply to someone, use for eg 7Soul so I get a notification

  • 7Soul - Sorry about that; try this link:


  • I think I got it:


    Only changed some events in the "UI" sheet, there are some comments there explaining what I did

  • 7Soul - Thanks for doing this. A couple things I noticed in this - if you spam space bar, it will do a double jump BOTH at an impulse of 8. Also, if you just tap it, the jump launches too high instead of something like super meat boy (ie. barely jumping off the ground). I'm wondering if it's impossible to re-create a platform like jumping system using physics?

  • f you spam space bar, it will do a double jump BOTH at an impulse of 8.

    Add another action to the jump:

    Set 'jump' to 0

    For the rest I guess just a lot of toying around with the values would be enough.

    If you increase the gravity and the strength of the air hang time, I think it will be more like super meat boy

  • 7Soul - I think you're right about toying around with the values. Setting Player.Jump to 0 on the Space is Pressed event doesn't seem to fix the issue. I think it's because of the "character overlapping floor > set jump to 10" event.

  • Maybe add a limit to how often you can jump, like a half-second or so?

  • 7Soul - Thanks for the help!

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