home *** CD-ROM | disk | FTP | other *** search
- class DisassembledBubble extends MovieClip
- {
- var _id;
- var _holdMovement;
- var _followDelay;
- var intMaxSpeed;
- var _isReady;
- var intFollowCounter;
- var intTargetX;
- var intTargetY;
- function DisassembledBubble()
- {
- super();
- this._id = Number(this._name.substr(0,this._name.length - 3));
- this._holdMovement = false;
- this._followDelay = 0;
- this.intMaxSpeed = this.RandNum(6,10);
- this._isReady = true;
- }
- function onEnterFrame()
- {
- this.UpdateTarget();
- if(this._holdMovement == false)
- {
- if(this.intFollowCounter < 1)
- {
- var _loc3_ = new Vector();
- _loc3_._x = this.intTargetX - this._x;
- _loc3_._y = this.intTargetY - this._y;
- var _loc2_ = _loc3_.GetLength();
- if(_loc2_ <= 4)
- {
- this._isReady = true;
- }
- else
- {
- this._isReady = false;
- }
- if(_loc2_ <= 1)
- {
- this._x = this.intTargetX;
- this._y = this.intTargetY;
- this.intFollowCounter = this._followDelay;
- }
- else
- {
- _loc2_ /= 6;
- if(_loc2_ > this.intMaxSpeed)
- {
- _loc2_ = this.intMaxSpeed;
- }
- _loc3_.ConvertToUnitVector();
- _loc3_.Scale(_loc2_);
- this._x += _loc3_._x;
- this._y += _loc3_._y;
- }
- }
- else
- {
- this.intFollowCounter = this.intFollowCounter - 1;
- }
- }
- }
- function SetCounter(argAmount)
- {
- this.intFollowCounter = this._followDelay = argAmount;
- }
- function ForceStop()
- {
- this.intFollowCounter = 0;
- }
- function UpdateTarget()
- {
- var targetClip = eval("_root.avatar.gun." + this._id + "_reg");
- var point = {x:targetClip._x,y:targetClip._y};
- _root.avatar.gun.localToGlobal(point);
- var vecStart = new Vector();
- this.intTargetX = point.x;
- this.intTargetY = point.y;
- }
- function RandNum(minVal, maxVal)
- {
- return Math.round(Math.random() * (maxVal - minVal)) + minVal;
- }
- }
-