This is what I have so far. If moves the ball to the new point but doesn’t make it go to the next.
onClipEvent (load){
width=720;
height=480;
this._x=Math.round(Math.random()*width);
this._x=Math.round(Math.random()*height);
newx=Math.round(1+Math.random()*width);
newy=Math.round(1+Math.random()*height);
}
onClipEvent (enterFrame){
speedx=Math.abs(newx-this._x);
speedy=Math.abs(newy-this._y);
if (this._x<newx){
signx=speedx;
}else{
signx=-speedx;
}
if (this._y<newy){
signy=speedx;
}else{
signy-speedy;
}
if (speedx<newy+1){
this._x+=signx/2;
}else{
newx=Math.round(1+Math.random()*width);
}
if (speedy<newy+1){
this._y+=signy/2;
}else{
newy=Math.round(1+Math.random()*height);
}
}
What’s wrong, as far as I can tell it should work fine…:bounce: