# Need help in bounce ball game

**URL:** <https://forum.kirupa.com/t/need-help-in-bounce-ball-game/208484>\
**Category:** programming\
**Created:** [November 29, 2006, 6:42am UTC](https://forum.kirupa.com/t/need-help-in-bounce-ball-game/208484 "2006-11-29T06:42:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mangesh](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mangesh](https://forum.kirupa.com/u/Mangesh)\
**Post date:** [November 29, 2006, 6:42am UTC](https://forum.kirupa.com/t/need-help-in-bounce-ball-game/208484/1 "2006-11-29T06:42:41Z")

</div>

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(gravityball_ymovball)/speed;  
}

Thanks in Advance:cons:
