0 Favourites

How do I Fix this Jumping motion?

  • I've been looking at ways to incoporate a Sonic style jumping to my game, where the height/power of the jump is determined by how long the user touches the screen.

    I found a helpful solution to this by MrGoatsnake here (remove the space between the slash next to https: and the space after www.) -

    http:/ /www. scirra.com/forum/simulate-change-keyboard-buttons-to-touch-screen_t106759

    This thing with this is when i tap the screen (mouse click in this case) the player does do a small jump, which is what i want but i don't like the way the jump occurs. When the player does the small jump, it looks as if it's hitting an invisible block and just coming straight back down (best way i could describe it ) When the player does a high jump by holding the jump button, the jump looks fine.

    I would like to fix this jumping motion so that the small jump looks like a small jump rather than how i described it. Is there any way to do this?

    I hope i've made it clear what i'm looking for, might be a bit confusing.

    I've provided the capx file from that thread, credit goes to MrGoatsnake.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • tomhaiger Credit really goes to Scirra's great community. I dug that explanation up from deeper in the forums. I am glad you found it.

    To address the "invisible wall," the reason it looks like it is hitting something is the abruptness of the change to the player's Y vector; from Y to 1/4 of Y. At 1/4 acceleration upward, gravity takes over really quick.

    You can tweak the change in the Y vector so the jump will drop off slower. I have attached a version where I have Y/2 instead of Y/4 and it feels a little less like a wall.

  • tomhaiger You inspired me enough to write this up in a tutorial for people looking around on the site.

    I hope Ashley can correct me on any of the physics if I'm wrong. I took a good guess at what I thought Construct is doing. I tried to simplify my explanation as well but its been a few years since I developed my own physics engine in graduate school. I'm a bit rusty.

  • Thanks MrGoatsnake It seems to be better now, and with such a simple change

    Also great job with the tutorial. Thanks for taking the time out to do this, i'm sure this will help a lot of people out.

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