How do I make a ball bounce to variable heights

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I'm struggling with this.... I want to be able to hold down a key and make my on screen player (which is a ball) jump up and then fall back to ground and bounce. If the key is held down, the ball will continue to bounce higher each time after touching the ground. When the key is released the bouncing slows to a stop just like if you dropped a ball on the ground it bounces less and less until it stops. The action I am trying to create is like bouncing a basketball but each time you hit the ball to the ground you do it a little harder so the ball bounces higher each time. Can anyone help please

    O

    ____ 1st bounce

    O

    _____ 2nd bounce

    O

    __________ 3rd bounce

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What do you have so far? It helps if you share your capx with what you have attempted.

    There are many ways to do this, but it depends on how you chose to implement your movement (platform, physics, custom?)

  • I am using platform control for the ball but I have been totally unsuccessful it getting it to bounce more than just once and haven't been able to get a second bounce at a greater height. I've tried a few things but I'm new to C2 so need a little help. What is the best way to get the bounce behavior I am looking for using platform?

  • Thanks so much for that, it's perfect! The only thing left is to limit the bounce to a maximum height. Any pointers on this please?

  • Sure, you're going to use the min() expression. Sounds kinda backwards, but min() will give you the lower of the two numbers, thus setting a maximum value when you're using one variable that constantly increases.

    So you would use min(Sprite.Platform.JumpStrength+200, x), where x is your maximum jump strength.

  • Works like a charm. Thank you very much

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