home *** CD-ROM | disk | FTP | other *** search
Text File | 2008-09-02 | 48.4 KB | 1,143 lines |
- class Enemy extends MovieClip
- {
- var _type;
- var blnBossHead;
- var gunFlagOne;
- var gunFlagTwo;
- var guns;
- var arrEvents;
- var arrSeekers;
- var haltMovie;
- var safetyTurn;
- var numSpeed;
- var numFramesToTurn;
- var numAmountToTurn;
- var minFramesToHoldTurning;
- var setToFrame2;
- var enemyOff;
- var countMachineGun;
- var mGunCount;
- var stunCounter;
- var stickyCounter;
- var strStickyRef;
- var intInfectedCounter;
- var strInfectedRef;
- var blnInfected;
- var intInfectMax;
- var blnInfectImmune;
- var maxLife;
- var numLife;
- var numLastAngle;
- var okStop;
- var isItTime;
- var customFunction1;
- function Enemy()
- {
- super();
- this._type = 1;
- this.blnBossHead = false;
- this.gunFlagOne = true;
- this.gunFlagTwo = true;
- this.guns = new Array();
- this.arrEvents = new Array();
- this.arrSeekers = new Array();
- this.haltMovie = false;
- this.safetyTurn = false;
- this.numSpeed = 0.25;
- this.numFramesToTurn = 0;
- this.numAmountToTurn = 0;
- this.minFramesToHoldTurning = 0;
- this.setToFrame2 = false;
- this.enemyOff = false;
- this.countMachineGun = 0;
- this.mGunCount = 0;
- this.stunCounter = 0;
- this.stickyCounter = 0;
- this.strStickyRef = "";
- this.intInfectedCounter = 0;
- this.strInfectedRef = "";
- this.blnInfected = false;
- this.intInfectMax = 13;
- this.blnInfectImmune = false;
- this.ConfigureEnemy();
- this.maxLife = this.numLife;
- this.gotoAndStop(this.numLife);
- }
- function ConfigureEnemy()
- {
- this.numLife = 1;
- this.numSpeed = 2;
- this.arrEvents.push({name:"Death Award",triggerValue:0,hit:false,custom:false,action:"EVENT_Bubbles",values:Array(5,10)});
- }
- function onEnterFrame()
- {
- if(!this.enemyOff)
- {
- if(this.stunCounter <= 0)
- {
- if(this.stickyCounter <= 0)
- {
- this.mGunDelay();
- if(this.haltMovie == false)
- {
- this.numLastAngle = this.GetAnglePos();
- if(this.blnBossHead == true)
- {
- this.TurnHead();
- }
- else
- {
- this.MoveMe();
- }
- var _loc5_ = this.AboutToExit();
- if(this.numFramesToTurn == 0 || _loc5_ == true && this.safetyTurn == false)
- {
- if(_loc5_ == true)
- {
- var _loc4_ = this.GetAnglePos();
- if(_loc4_ < 0)
- {
- if(_loc4_ < this.numLastAngle)
- {
- this.numAmountToTurn = Math.round(Math.random() * -90) - 90;
- }
- else
- {
- this.numAmountToTurn = Math.round(Math.random() * 90) + 90;
- }
- }
- else if(_loc4_ > this.numLastAngle)
- {
- this.numAmountToTurn = Math.round(Math.random() * 90) + 90;
- }
- else
- {
- this.numAmountToTurn = Math.round(Math.random() * -90) - 90;
- }
- this.numFramesToTurn = Math.round(Math.abs(this.numAmountToTurn) / this.numSpeed);
- this.numAmountToTurn = this.numSpeed * (this.numAmountToTurn / Math.abs(this.numAmountToTurn));
- this.minFramesToHoldTurning = 90;
- this.safetyTurn = true;
- }
- }
- else
- {
- this.numFramesToTurn = this.numFramesToTurn - 1;
- this._rotation += this.numAmountToTurn;
- }
- }
- if(this.minFramesToHoldTurning > 0)
- {
- this.minFramesToHoldTurning = this.minFramesToHoldTurning - 1;
- }
- else if(this.numFramesToTurn == 0)
- {
- var _loc3_ = Math.round(Math.random() * 1000);
- if(_loc3_ < 20)
- {
- _loc3_ = Math.round(Math.random() * 200) - 100;
- this.numFramesToTurn = Math.round(Math.abs(_loc3_) / this.numSpeed);
- this.numAmountToTurn = this.numSpeed * (_loc3_ / Math.abs(_loc3_));
- this.safetyTurn = false;
- }
- }
- }
- else
- {
- this.stickyCounter = this.stickyCounter - 1;
- }
- if(_root.game.SafeToFire() == true)
- {
- this.OperateWeapons();
- }
- }
- else if(this.stunCounter > 0)
- {
- this.stunCounter = this.stunCounter - 1;
- }
- if(this.blnInfected == true)
- {
- if(this.intInfectedCounter == 0)
- {
- this.ReceiveDamage(1,"");
- this.intInfectedCounter = this.intInfectMax;
- }
- this.intInfectedCounter = this.intInfectedCounter - 1;
- }
- }
- }
- function TurnHead()
- {
- var _loc3_ = new Vector();
- _loc3_._x = _root.avatar._x - this._x;
- _loc3_._y = _root.avatar._y - this._y;
- var _loc4_ = _loc3_.AngleToAlign(this._rotation,1,1);
- this._rotation += _loc4_;
- if(this._rotation < 60)
- {
- this._rotation = 60;
- }
- if(this._rotation > 120)
- {
- this._rotation = 120;
- }
- }
- function Stun(amountTime)
- {
- this.stunCounter = amountTime;
- }
- function Sticky(amountTime)
- {
- this.stickyCounter = amountTime;
- }
- function OperateWeapons()
- {
- var i = 0;
- while(i < this.guns.length)
- {
- if(this.guns[i].type == 1)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- ObjRef._rotation = myDegrees - this._rotation;
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 2)
- {
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRefTwo.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.SpawnUnit("Enemy_Seeker",posVector,this._name);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 3)
- {
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRefTwo.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.SpawnUnit("Enemy_2",posVector,this._name);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 4)
- {
- if(this.guns[i].counter < 1)
- {
- if(this.GetDistance2Avatar() <= this.guns[i].size)
- {
- _root.ReportAvatarDamage(this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 5)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- ObjRef._rotation = myDegrees - this._rotation;
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter1");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter2");
- var pointThree = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointThree);
- posVector._x = pointThree.x;
- posVector._y = pointThree.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter3");
- var pointFour = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointFour);
- posVector._x = pointFour.x;
- posVector._y = pointFour.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 6)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- ObjRef._rotation = myDegrees - this._rotation;
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter1");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation - 30,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter2");
- var pointThree = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointThree);
- posVector._x = pointThree.x;
- posVector._y = pointThree.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter3");
- var pointFour = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointFour);
- posVector._x = pointFour.x;
- posVector._y = pointFour.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 30,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 7)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- ObjRef._rotation = myDegrees - this._rotation;
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter1");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter2");
- var pointThree = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointThree);
- posVector._x = pointThree.x;
- posVector._y = pointThree.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter3");
- var pointFour = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointFour);
- posVector._x = pointFour.x;
- posVector._y = pointFour.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter4");
- var pointFive = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointFive);
- posVector._x = pointFive.x;
- posVector._y = pointFive.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter5");
- var pointSix = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointSix);
- posVector._x = pointSix.x;
- posVector._y = pointSix.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 8)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- ObjRef._rotation = myDegrees - this._rotation;
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter1");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation - 60,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter2");
- var pointThree = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointThree);
- posVector._x = pointThree.x;
- posVector._y = pointThree.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation - 30,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter3");
- var pointFour = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointFour);
- posVector._x = pointFour.x;
- posVector._y = pointFour.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter4");
- var pointFive = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointFive);
- posVector._x = pointFive.x;
- posVector._y = pointFive.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 30,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter5");
- var pointSix = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointSix);
- posVector._x = pointSix.x;
- posVector._y = pointSix.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 60,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 9)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- ObjRef._rotation = myDegrees - this._rotation;
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter1");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation - 60,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter2");
- var pointThree = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointThree);
- posVector._x = pointThree.x;
- posVector._y = pointThree.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation - 30,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter3");
- var pointFour = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointFour);
- posVector._x = pointFour.x;
- posVector._y = pointFour.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter4");
- var pointFive = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointFive);
- posVector._x = pointFive.x;
- posVector._y = pointFive.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 30,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter5");
- var pointSix = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointSix);
- posVector._x = pointSix.x;
- posVector._y = pointSix.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 60,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter6");
- var pointSeven = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointSeven);
- posVector._x = pointSeven.x;
- posVector._y = pointSeven.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 90,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter7");
- var pointEight = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointEight);
- posVector._x = pointEight.x;
- posVector._y = pointEight.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 120,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter8");
- var pointNine = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointNine);
- posVector._x = pointNine.x;
- posVector._y = pointNine.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 150,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter9");
- var pointTen = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTen);
- posVector._x = pointTen.x;
- posVector._y = pointTen.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 180,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- ObjRefTwo = eval("this." + this.guns[i].name + ".emitter10");
- var pointEleven = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointEleven);
- posVector._x = pointEleven.x;
- posVector._y = pointEleven.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation + 210,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 10)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShootSpecial("mine",posVector,0,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 11)
- {
- if(this.DoesSeekerExist(this.guns[i].name) == false)
- {
- if(this.guns[i].counter < 1)
- {
- var spawnedName = "";
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRefTwo.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- spawnedName = _root.SpawnUnit("Enemy_Orbital_Seeker",posVector,this._name);
- this.arrSeekers.push({name:spawnedName,from:this.guns[i].name});
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- }
- else if(this.guns[i].type == 12)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- ObjRef._rotation = myDegrees - this._rotation;
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShootSpecial("sticky",posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- else if(this.guns[i].type == 13)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- ObjRef._rotation = myDegrees - this._rotation;
- this.okStop = false;
- if(this.isItTime)
- {
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- }
- else if(this.guns[i].type == 14)
- {
- if(this.DoesSeekerExist(this.guns[i].name) == false)
- {
- if(this.guns[i].counter < 1)
- {
- var spawnedName = "";
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRefTwo.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- spawnedName = _root.SpawnUnit("Enemy_Sapper",posVector,this._name);
- this.arrSeekers.push({name:spawnedName,from:this.guns[i].name});
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- }
- else if(this.guns[i].type != 15)
- {
- if(this.guns[i].type == 16)
- {
- if(this.DoesSeekerExist(this.guns[i].name) == false)
- {
- if(this.guns[i].counter < 1)
- {
- var spawnedName = "";
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRefTwo.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- spawnedName = _root.SpawnUnit("Enemy_Leecher",posVector,this._name);
- this.arrSeekers.push({name:spawnedName,from:this.guns[i].name});
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- }
- else if(this.guns[i].type == 17)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- this.okStop = false;
- if(!this.isItTime)
- {
- ObjRef.gotoAndPlay(1);
- }
- if(this.isItTime)
- {
- if(this.guns[i].counter < 1)
- {
- ObjRef._rotation += 5;
- if(this.isItTime)
- {
- if(!this.setToFrame2)
- {
- ObjRef.gotoAndPlay(2);
- this.setToFrame2 = true;
- }
- }
- else
- {
- ObjRef.gotoAndPlay(1);
- }
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- }
- else if(this.guns[i].type == 18)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- var point = {x:ObjRef._x,y:ObjRef._y};
- _root[this._name].localToGlobal(point);
- var startPoint = {x:this._x,y:this._y};
- startPoint.x += ObjRef._x;
- startPoint.y += ObjRef._y;
- var vecDirection = new Vector();
- vecDirection._x = _root.avatar._x - point.x;
- vecDirection._y = _root.avatar._y - point.y;
- var myRadians = Math.atan2(vecDirection._y,vecDirection._x);
- var myDegrees = 360 * myRadians / 6.283185307179586;
- this.okStop = false;
- if(!this.isItTime)
- {
- ObjRef.gotoAndPlay(1);
- }
- if(this.isItTime)
- {
- if(this.guns[i].counter < 1)
- {
- ObjRef._rotation += 20;
- if(this.isItTime)
- {
- if(!this.setToFrame2)
- {
- ObjRef.gotoAndPlay(2);
- this.setToFrame2 = true;
- }
- }
- else
- {
- ObjRef.gotoAndPlay(1);
- }
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRef.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.EnemyShoot(posVector,ObjRef._rotation + this._rotation,this.guns[i].speed,this.guns[i].size,this.guns[i].damage);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- }
- else if(this.guns[i].type == 19)
- {
- if(this.DoesSeekerExist(this.guns[i].name) == false)
- {
- if(this.guns[i].counter < 1)
- {
- var spawnedName = "";
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRefTwo.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- spawnedName = _root.SpawnUnit("Enemy_Health_Leecher",posVector,this._name);
- this.arrSeekers.push({name:spawnedName,from:this.guns[i].name});
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- }
- else if(this.guns[i].type == 20)
- {
- if(this.guns[i].counter < 1)
- {
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name + ".emitter");
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRefTwo.localToGlobal(pointTwo);
- posVector._x = pointTwo.x;
- posVector._y = pointTwo.y;
- _root.SpawnUnit("Enemy_96",posVector,this._name);
- this.guns[i].counter = Math.round(Math.random() * (this.guns[i].fireTimerMax - this.guns[i].fireTimerMin)) + this.guns[i].fireTimerMin;
- }
- else
- {
- this.guns[i].counter--;
- }
- }
- }
- i++;
- }
- }
- function mGunDelay()
- {
- this.mGunCount = this.mGunCount + 1;
- if(this.mGunCount > 150)
- {
- this.isItTime = true;
- if(this.mGunCount > 250)
- {
- this.isItTime = false;
- this.mGunCount = 0;
- }
- }
- else
- {
- this.setToFrame2 = false;
- this.isItTime = false;
- }
- }
- function ReportLifeIncrease(amountLife)
- {
- this.numLife += amountLife;
- if(this.numLife > this.maxLife)
- {
- this.numLife = this.maxLife;
- }
- this.gotoAndStop(this.numLife);
- }
- function ReceiveDamage(amountDamage, bulletName)
- {
- var returnValue = false;
- this.numLife -= amountDamage;
- var i = 0;
- while(i < this.arrEvents.length)
- {
- if(this.numLife <= this.arrEvents[i].triggerValue && this.arrEvents[i].hit == false || this.arrEvents[i].triggerValue == -1)
- {
- this.arrEvents[i].hit = true;
- if(this.arrEvents[i].custom == true)
- {
- this.customFunction1 = this.arrEvents[i].action;
- this.customFunction1();
- }
- else
- {
- if(this.arrEvents[i].action == "EVENT_Bubbles")
- {
- var bubbleVector = new Vector();
- bubbleVector._x = this._x;
- bubbleVector._y = this._y;
- _root.game.DropPickupBubbles(this.arrEvents[i].values[0],bubbleVector,this.arrEvents[i].values[1],1);
- }
- if(this.arrEvents[i].action == "EVENT_Bubbles_Large")
- {
- var bubbleVector = new Vector();
- bubbleVector._x = this._x;
- bubbleVector._y = this._y;
- _root.game.DropPickupBubbles(this.arrEvents[i].values[0],bubbleVector,this.arrEvents[i].values[1],2);
- }
- if(this.arrEvents[i].action == "EVENT_Bubbles_Ultra")
- {
- var bubbleVector = new Vector();
- bubbleVector._x = this._x;
- bubbleVector._y = this._y;
- _root.game.DropPickupBubbles(this.arrEvents[i].values[0],bubbleVector,this.arrEvents[i].values[1],3);
- }
- else if(this.arrEvents[i].action == "EVENT_DropGun")
- {
- this.RemoveGun(this.arrEvents[i].values);
- }
- else if(this.arrEvents[i].action == "EVENT_SpeedChange")
- {
- this.numSpeed = this.arrEvents[i].values;
- }
- else if(this.arrEvents[i].action == "EVENT_Spawn")
- {
- var myPos = new Vector();
- myPos._x = this._x;
- myPos._y = this._y;
- var t = 0;
- while(t < this.arrEvents[i].values[1])
- {
- _root.SpawnUnit(this.arrEvents[i].values[0],myPos,this._name);
- t++;
- }
- }
- else if(this.arrEvents[i].action == "EVENT_SeekersDie")
- {
- var t = 0;
- while(t < this.arrSeekers.length)
- {
- _root[this.arrSeekers[t].name].Terminate();
- t++;
- }
- }
- }
- }
- i++;
- }
- if(bulletName != "")
- {
- var i = 0;
- while(i < this.guns.length)
- {
- if(this.guns[i].type == 15)
- {
- if(this.guns[i].damage == 0)
- {
- var ObjRef = eval("this." + this.guns[i].name);
- if(ObjRef.hitTest(_root[bulletName]._x,_root[bulletName]._y,true))
- {
- ObjRef.inside.gotoAndPlay("hit");
- var posVector = new Vector();
- var ObjRefTwo = eval("this." + this.guns[i].name);
- var pointTwo = {x:ObjRefTwo._x,y:ObjRefTwo._y};
- ObjRefTwo._parent.localToGlobal(pointTwo);
- var s = 0;
- while(s < 8)
- {
- var theta = Math.round(Math.random() * 360);
- var R = Math.round(Math.random() * (ObjRefTwo._width - 15));
- posVector._x = R * Math.cos(theta) + pointTwo.x;
- posVector._y = R * Math.sin(theta) + pointTwo.y;
- _root.SpawnUnit("Enemy_Seeker",posVector,this._name);
- s++;
- }
- this.guns[i].damage = 1;
- }
- }
- }
- i++;
- }
- if(_root[bulletName]._type == 3)
- {
- this.Sticky(120);
- this.strStickyRef = _root.game.Effect_Sticky(this._x,this._y);
- }
- }
- if(this.numLife < 1)
- {
- if(this.blnInfected == true)
- {
- _root.game.Gun_SpawnInfectors(this._x,this._y,this.RandNum(1,3));
- }
- if(this.strStickyRef != "")
- {
- _root.game.RemoveEffect(this.strStickyRef);
- }
- if(this.strInfectedRef != "")
- {
- _root.game.RemoveEffect(this.strInfectedRef);
- }
- returnValue = true;
- _root.ReportDeath(this._name);
- this.removeMovieClip();
- }
- else
- {
- this.gotoAndStop(this.numLife);
- }
- return returnValue;
- }
- function ReportSeekerDeath(strName)
- {
- var _loc2_ = 0;
- while(_loc2_ < this.arrSeekers.length)
- {
- if(strName == this.arrSeekers[_loc2_].name)
- {
- this.arrSeekers.splice(_loc2_,1);
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function DoesSeekerExist(gunName)
- {
- var _loc3_ = false;
- var _loc2_ = 0;
- while(_loc2_ < this.arrSeekers.length)
- {
- if(gunName == this.arrSeekers[_loc2_].from)
- {
- _loc3_ = true;
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- return _loc3_;
- }
- function RemoveGun(strName)
- {
- var _loc2_ = 0;
- while(_loc2_ < this.guns.length)
- {
- if(strName == this.guns[_loc2_].name)
- {
- this.guns.splice(_loc2_,1);
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function MoveMe()
- {
- var _loc2_ = new Vector();
- _loc2_._x = Math.cos(3.141592653589793 * this._rotation / 180) * this.numSpeed + this._x;
- _loc2_._y = Math.sin(3.141592653589793 * this._rotation / 180) * this.numSpeed + this._y;
- this._x = _loc2_._x;
- this._y = _loc2_._y;
- }
- function GetAnglePos()
- {
- var _loc3_ = new Vector();
- _loc3_._x = this._x - _root.bg._x;
- _loc3_._y = this._y - _root.bg._y;
- var _loc4_ = Math.atan2(_loc3_._y,_loc3_._x);
- var _loc5_ = 360 * _loc4_ / 6.283185307179586;
- return _loc5_;
- }
- function GetDistance()
- {
- var _loc4_ = this._x - _root.bg._x;
- var _loc3_ = this._y - _root.bg._y;
- return Math.sqrt(_loc4_ * _loc4_ + _loc3_ * _loc3_);
- }
- function GetDistance2Avatar()
- {
- var _loc4_ = this._x - _root.avatar._x;
- var _loc3_ = this._y - _root.avatar._y;
- return Math.sqrt(_loc4_ * _loc4_ + _loc3_ * _loc3_);
- }
- function AboutToExit()
- {
- var _loc5_ = false;
- var _loc6_ = Math.cos(3.141592653589793 * this._rotation / 180) * (this._width + 30 * this.numSpeed) + this._x;
- var _loc7_ = Math.sin(3.141592653589793 * this._rotation / 180) * (this._width + 30 * this.numSpeed) + this._y;
- var _loc4_ = _loc6_ - _root.bg._x;
- var _loc3_ = _loc7_ - _root.bg._y;
- if(Math.sqrt(_loc4_ * _loc4_ + _loc3_ * _loc3_) > _root.bg.inside._width / 2)
- {
- _loc5_ = true;
- }
- return _loc5_;
- }
- function TurnOff()
- {
- this.enemyOff = true;
- }
- function TurnOn()
- {
- this.enemyOff = false;
- }
- function PredictTargetLocation(intDistance, intSpeed)
- {
- var _loc2_ = {x:0,y:0};
- if(this.stunCounter <= 0 && this.stickyCounter <= 0)
- {
- var _loc3_ = intDistance / intSpeed;
- _loc2_.x = Math.cos(3.141592653589793 * this._rotation / 180) * this.numSpeed;
- _loc2_.y = Math.sin(3.141592653589793 * this._rotation / 180) * this.numSpeed;
- _loc2_.x *= _loc3_;
- _loc2_.y *= _loc3_;
- }
- _loc2_.x += this._x;
- _loc2_.y += this._y;
- return _loc2_;
- }
- function Infect()
- {
- if(this.blnInfectImmune == false)
- {
- if(this.blnInfected == false)
- {
- var _loc4_ = new flash.geom.Transform(this);
- var _loc3_ = new flash.geom.ColorTransform(1,1,1,1,150,-40,-60,0);
- _loc4_.colorTransform = _loc3_;
- this.strInfectedRef = _root.game.Effect_Infect(this._x,this._y,this._name);
- this.blnInfected = true;
- this.intInfectedCounter = this.intInfectMax;
- }
- }
- }
- function RandNum(minVal, maxVal)
- {
- return Math.round(Math.random() * (maxVal - minVal)) + minVal;
- }
- }
-