How do I : limit bounce height

Get help using Construct 2

Post » Mon Nov 10, 2014 8:43 pm

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.
B
5
Posts: 8
Reputation: 241

Post » Mon Nov 10, 2014 9:55 pm

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.
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Tue Nov 11, 2014 7:18 am

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 :-)
B
5
Posts: 8
Reputation: 241

Post » Tue Nov 11, 2014 8:42 am

@iwindows , that would be a bit trickier to set up, but yes, the principle should be the same.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Tue Nov 11, 2014 8:52 am

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?
B
5
Posts: 8
Reputation: 241

Post » Tue Nov 11, 2014 12:44 pm

@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.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829


Return to How do I....?

Who is online

Users browsing this forum: cb130felix, Kermad, Lancifer, Matei511, mongoose665, piddlyPoo, yiuyiu6666 and 3 guests