# Bouncing down the hill

**URL:** <https://forum.kirupa.com/t/bouncing-down-the-hill/330159>\
**Category:** flash\
**Created:** [December 7, 2012, 8:20pm UTC](https://forum.kirupa.com/t/bouncing-down-the-hill/330159 "2012-12-07T20:20:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![duchman](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@duchman](https://forum.kirupa.com/u/duchman)\
**Post date:** [December 7, 2012, 8:20pm UTC](https://forum.kirupa.com/t/bouncing-down-the-hill/330159/1 "2012-12-07T20:20:53Z")

</div>

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 &lt;= bouncePoint) {            
                gravity *= -(speed + jump) * f;                    
                ball.y = bouncePoint;
                // and how to roll down now?
            }
```
