How do I : limit bounce height

0 favourites
  • 6 posts
From the Asset Store
Bounce the ball and try to keep it bouncing and prevent it from falling down for as long as you can.
  • I have ball which has bullet and physic behaviour and I would like to limit the height it can bounce regardless of the height it was dropped from. So if it falls 100m, 25m, 1m or 50cm, it should always bounce 75cm high.

    I have no idea how to do this, could someone point me in the right direction to look. TIA.

  • I don't know about the bullet, but with physics you can remove the bounciness from the object properties and add an impulse to create the bounce. You'll have to experiment with the power to find this 75cm height though. Physics calculate the mass based on the density setting and the actual size of the Sprite. So, if you change the size of the Sprite, you'll get different bounce from the same impulse value.

    See the attached example.

  • that's great thanks a lot!

    and to get a left/right bounce I just add an impulse at layout start, then check for collision with a wall and reverse the x direction

  • iwindows , that would be a bit trickier to set up, but yes, the principle should be the same.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ah, eli0s thanks for the feedback, I'll experiment, its a shame that I cant impart some force on a bullet as I think this will provide better CPU performance, If I have 50+ bouncing balls on screen at once, plus the solids are really physics immoveables. I'll have a play around, maybe a sinewave and bullet will also achieve the same effect?

  • iwindows , unfortunately I can't find a way to achieve the same result with the Bullet behavior. You can add a speed and an angle of motion upon collision with the walls, but the tricky part is to make a bounce depending on the angle of motion that each Ball has. I never quite understood how to do that, perhaps someone else, more clever than me can add to this.

    As for the Sine behavior, I think that this will only make things more complicated. Either find a way to apply a speed and an angle of motion with the Bullet behavior, or use Physics that does the calculations for you.

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