home *** CD-ROM | disk | FTP | other *** search
- class Bullet extends MovieClip
- {
- var moveX;
- var moveY;
- var _damage;
- var _holdMovement;
- var _type;
- var halfX;
- var halfY;
- var arrEnemiesImmune;
- var starBurstTimer;
- var removeCallback;
- var arrBusted;
- function Bullet()
- {
- super();
- this.moveX = 0;
- this.moveY = 0;
- this._damage = 1;
- this._holdMovement = false;
- this._type = 1;
- this.halfX = this._x;
- this.halfY = this._y;
- this.arrEnemiesImmune = new Array();
- this.starBurstTimer = 45;
- }
- function SetMovement(myX, myY)
- {
- this.moveX = myX;
- this.moveY = myY;
- }
- function onEnterFrame()
- {
- if(this._holdMovement == false)
- {
- this.halfX = this._x + this.moveX / 2;
- this.halfY = this._y + this.moveY / 2;
- this._x += this.moveX;
- this._y += this.moveY;
- if(this.GetDistance() > _root.bg.inside._width / 2)
- {
- if(this._type == 7)
- {
- _root.game.SmallDamageBurst(this._x,this._y);
- }
- else if(this._type == 8)
- {
- this.CleanupBusted();
- }
- this.removeCallback(this._name);
- this.removeMovieClip();
- }
- if(this._type == 4)
- {
- if(this.starBurstTimer > 0)
- {
- this.starBurstTimer = this.starBurstTimer - 1;
- }
- else
- {
- this.PerformStarBurst();
- }
- }
- }
- }
- function EventHitEnemy(enemyName)
- {
- if(this._type == 5)
- {
- _root.game.DamageBurst(this._x,this._y,10);
- }
- else if(this._type == 6)
- {
- _root.game.SmallDamageBurst(this._x,this._y);
- }
- else if(this._type == 7)
- {
- _root.game.SmallDamageBurst(this._x,this._y);
- }
- else if(this._type == 9)
- {
- var _loc3_ = new Vector();
- _loc3_._x = this._x;
- _loc3_._y = this._y;
- _root.game.LeachPickupBubbles(_loc3_);
- _root.game.Effect_Leech(this._x,this._y);
- }
- }
- function GetDistance()
- {
- var _loc4_ = this._x - _root.bg._x;
- var _loc3_ = this._y - _root.bg._y;
- return Math.sqrt(_loc4_ * _loc4_ + _loc3_ * _loc3_);
- }
- function AddImmunity(strName)
- {
- this.arrEnemiesImmune.push(strName);
- }
- function GetImmune(strEnemyName)
- {
- var _loc2_ = 0;
- while(_loc2_ < this.arrEnemiesImmune.length)
- {
- if(this.arrEnemiesImmune[_loc2_] == strEnemyName)
- {
- return true;
- }
- _loc2_ = _loc2_ + 1;
- }
- return false;
- }
- function PerformStarBurst()
- {
- var _loc3_ = 0;
- while(_loc3_ < 360)
- {
- _root.game.SpawnStartBurstShard(this._x,this._y,_loc3_);
- _loc3_ += 10;
- }
- this.removeCallback(this._name);
- this.removeMovieClip();
- }
- function AddBusted(strBulletName)
- {
- this.arrBusted.push(strBulletName);
- _root[strBulletName].SetMovement(this.moveX,this.moveY);
- _root[strBulletName].removeCallback = undefined;
- }
- function PauseUnPauseBusted(blnPause)
- {
- var _loc3_ = 0;
- while(_loc3_ < this.arrBusted.length)
- {
- _root[this.arrBusted[_loc3_]]._holdMovement = blnPause;
- _loc3_ = _loc3_ + 1;
- }
- }
- function CleanupBusted()
- {
- var _loc3_ = 0;
- while(_loc3_ < this.arrBusted.length)
- {
- _root[this.arrBusted[_loc3_]].removeMovieClip();
- _loc3_ = _loc3_ + 1;
- }
- }
- function MoveBusted(vecMoveThis)
- {
- var _loc3_ = 0;
- while(_loc3_ < this.arrBusted.length)
- {
- _root[this.arrBusted[_loc3_]]._x += vecMoveThis._x;
- _root[this.arrBusted[_loc3_]]._y += vecMoveThis._y;
- _loc3_ = _loc3_ + 1;
- }
- }
- }
-