Ok, heres that bouncing ball again…
I know how to do regular bouncing, if ball reached the target, do *= - on velocity and set that position to balls position…
But I am tryin to roll the ball down the hill,(lets say 45 degrees) bump a rock, bounce few times down that hill, and should continue going down the hill…
I rolled ball down the hill nicely, but after I bounced it of a rock, it kept bouncing flat on x axis, not folowing the steep hill after bump…
I shoul do something with my gravity var, but just cant get it…
I am doing this on Y axis:
var bouncePoint:Number = 45;
var gravity:Number = 1;
ball.y -= gravity;
if (bump) {
ball.y += (speed + jump) * f;
gravity += 0.05;
}
if (ball.y <= bouncePoint) {
gravity *= -(speed + jump) * f;
ball.y = bouncePoint;
// and how to roll down now?
}