Hi all! I’m using this bit of random movement code. The thing is im trying to slow down the movement of my object further by increasing the number on the end of the line (highlighted in red) for both the X/Y coordinates. But if I put 12 or above the objects stop after a few moves. Any ideas on why and how to solve this particular bit? Thanks!
newpos = function () {
ranx = Math.round((Math.random ()*250));
rany = Math.round ((Math.random ()*250));
}
newpos();
this.onEnterFrame = function() {
this._x += ((ranx-this._x)/[COLOR=red]11[/COLOR]);
this._y += ((rany-this._y)/[COLOR=red]11[/COLOR]);
if (Math.round(this._x) == ranx || Math.round(this._y) == rany) {
newpos();
}
};