-
Bouncing ball down the hill? Help
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 hill slope after bump..
I shoul do something with my gravity var, or that bouncePoint but just cant get it..
I am doing this on Y axis:
Code:
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 continue rolling down now?
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|