I’m using the code below to make a MovieClip rotate and move towards another MovieClip. I’d like to figure out how to instead have the first MovieClip rotate towards the second MovieClip and move sideways, effectively orbiting around the second MovieClip. I’m assuming the math for such a thing is terribly difficult. If someone could help me out with this I’d be quite grateful.
this.rotDir = Math.round(180 - ((Math.atan2(this.focus._x - this._x, this.focus._y - this._y)) * 180 / Math.PI));
this._rotation = this.rotDir; this.speed = 2;
this.velocityX = Math.sin(this._rotation * Math.PI / 180) * this.speed;
this.velocityY = Math.cos(this._rotation * Math.PI / 180) * -this.speed;
this._x += this.velocityX; this._y += this.velocityY;