I have created this code to bounce the ball when user clicks on the mouse. But the ball doesn’t bounce as I wanted it to be.
I am attaching the fla also, If anyone can help me I will be glad.
ymov = 10;
ymovball = -200;
gravity = .95;
gravityball = 0.25;
speed = 3;
_root.onEnterFrame = function() {
ymov += gravity;
ball._y += ymov;
if (ball._y > 400) {
ball._y = 400;
ymov = Math.sin(-1/speed);
}
}
ball.onRelease = function() {
ymovball = gravityball + ymovball;
ball._y += ymovball;
ymovball += Math.sin(gravityballymovball)/speed;
}
Thanks in Advance:cons: