# Help with collision detection!

**URL:** <https://forum.kirupa.com/t/help-with-collision-detection/206123>\
**Category:** Uncategorized\
**Created:** [November 5, 2006, 3:58pm UTC](https://forum.kirupa.com/t/help-with-collision-detection/206123 "2006-11-05T15:58:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![regen](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@regen](https://forum.kirupa.com/u/regen)\
**Post date:** [November 5, 2006, 3:58pm UTC](https://forum.kirupa.com/t/help-with-collision-detection/206123/1 "2006-11-05T15:58:55Z")

</div>

i have placed a sphere at co-ordinates x 150 y 300 the multiple movie clips controlled by this .as file should bounce off the sphere but i cant get it to work… help please?

```auto
dynamic class scripts.ing extends MovieClip{
    
    var yfall = 0
    var grav = 0.3
    var bounce = 0;
    var xincr
    var sra = 100
    
    function ing(){
        
        
        _x = 255
        _y = 110
        yfall = - random(20)/2.0
        
        xincr = random(10) - 5
    }
    
    
    function updateIng(){
        
        var dis = Math.sqrt ((150)*(_x) + (300)*(_y));
        
        yfall = yfall + grav
        
        if(dis < sra){
            yfall = -yfall
            xincr = -xincr
        }

        
        if(_y + yfall > 755){
            bounce++
            yfall =- yfall*0.5
            }
            
            
            
            
        _y = _y + yfall
        
        
        if(_x + xincr > 470){
            xincr = -xincr*1.2
        }
        if(_x + xincr < 20){
            xincr = -xincr*1.2
        }
        
        _x = _x + xincr;
        
        
        myspeed = Math.sqrt(xincr*xincr + yfall+yfall)
        if(bounce >= 2){
            
                return true;
                
            
            
        }
        
        
        }
        
    }
        
    

```
