How do I simulate 'bouncing' higher the farther you fall

  • Greetings,

    I have a sprite that is not solid and if the Platform collides with it a 'Jump' function is simulated. I have attached an image of my current setup.

    A problem I have encountered with this is holding the 'Jump' key while colliding with the sprite that makes you jump stops you from jumping and nothing happens. I'm also trying to make it so the farther you fall onto the sprite that makes you jump, the higher you jump (to a point).

    I've been trying to solve this for a while. Thank you for your help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi varr. Can you grab the ypos at the top of the fall and compare it with the ypos at the bottom of the fall then use the distance in some kind of "power" formula?

  • Instead of changing jump strength and jumping you could just set the Yvelocity directly.

    So to replicate the bounce you have you could do something like

    Set Yvelocity to -500

    Or since you want it to bounce based on height you can just invert the Yvelocity to do a bounce.

    Set Yvelocity to -abs(Yvelocity)

  • Thanks for the replies! I'll play around with both. -abs stands for absolute? That would make the 'bounce' based on the highest value for Yvelocity at the time it's set? I am a very huge newbie when it comes to coding.

  • R0J0hound I found your ball_bounce.capx over at

    Forgive me for being such a blockhead, but how do you decrease the bouncing momentum overtime? (So it won't bounce forever) Many thanks!

  • bloodshot

    Just multiply the speed by an value between 0 and 1 when it bounces

    Set Yvelocity to -0.5*abs(Yvelocity)

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