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?
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;
}
}
}