How do I make a ball bounce to variable heights

Get help using Construct 2

Post » Fri Mar 17, 2017 4:14 pm

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
B
4
Posts: 10
Reputation: 220

Post » Fri Mar 17, 2017 4:33 pm

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?)
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Fri Mar 17, 2017 4:43 pm

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?
B
4
Posts: 10
Reputation: 220

Post » Fri Mar 17, 2017 5:09 pm

Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Fri Mar 17, 2017 5:39 pm

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?
B
4
Posts: 10
Reputation: 220

Post » Fri Mar 17, 2017 6:23 pm

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.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Fri Mar 17, 2017 9:52 pm

Works like a charm. Thank you very much :-)
B
4
Posts: 10
Reputation: 220


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, RobertMKD, Syazanie Amirin and 10 guests