home *** CD-ROM | disk | FTP | other *** search
- class Enemy8 extends MovieClip
- {
- var gravType = 1;
- var outside = false;
- function Enemy8()
- {
- super();
- }
- function onLoad()
- {
- var _loc1_ = this;
- _root.bonusScore = 2500;
- var _loc3_ = _loc1_._name.split("_");
- _loc1_.id = Number(_loc3_[1]);
- var _loc2_ = _loc1_._parent.spawnPoints[8][_loc1_.id].split(":");
- _loc1_._x = _loc2_[0] * _loc1_._parent.cellsize;
- _loc1_._y = _loc2_[1] * _loc1_._parent.cellsize;
- _loc1_._parent.cells[_loc2_[0]][_loc2_[1]].spawn = undefined;
- if(_loc1_._parent.cells[_loc2_[0]][_loc2_[1]].gravType > 0)
- {
- _loc1_.gravType = _loc1_._parent.cells[_loc2_[0]][_loc2_[1]].gravType;
- _loc1_._rotation = 90 * (_loc1_.gravType - 1);
- }
- else
- {
- _loc1_.gravType = 1;
- }
- _loc1_.xCell = Math.floor(_loc1_._x / _loc1_._parent.cellsize + 0.5);
- _loc1_.yCell = Math.floor(_loc1_._y / _loc1_._parent.cellsize + 0.5);
- if(_loc1_._parent.triggers[_loc1_.id] == undefined)
- {
- _loc1_._parent.triggers[_loc1_.id] = new Object();
- }
- _loc1_._parent.triggers[_loc1_.id].clip = _loc1_;
- _loc1_.createEmptyMovieClip("sprite",1);
- _loc1_.sprite._y = _loc1_._parent.cellsize / 2;
- if(!_loc1_._parent.triggers[_loc1_.id].pushed)
- {
- _loc1_.enemyStatus = "boss2_off";
- }
- else
- {
- _loc1_.enemyStatus = "boss2_on";
- }
- _loc1_.sprite.attachMovie(_loc1_.enemyStatus,"sprite",1);
- }
- function onEnterFrame()
- {
- var _loc1_ = this;
- if(_loc1_.sprite.hitTest(_loc1_._parent.player) && _global.ctrlStatus[_global.ctrlAction])
- {
- if(_loc1_._parent._parent.triggerMemory != _loc1_.id + 1)
- {
- _loc1_.switchTrigger();
- _loc1_._parent._parent.triggerMemory = _loc1_.id + 1;
- }
- }
- else if(_loc1_._parent._parent.triggerMemory == _loc1_.id + 1)
- {
- _loc1_._parent._parent.triggerMemory = 0;
- }
- if(_loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].clip == undefined)
- {
- if(_loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].tile == 2)
- {
- _loc1_.yCell = _loc1_.yCell + 1;
- }
- else if(_loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].tile == 3)
- {
- _loc1_.xCell = _loc1_.xCell - 1;
- }
- else if(_loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].tile == 4)
- {
- _loc1_.yCell = _loc1_.yCell - 1;
- }
- else if(_loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].tile == 5)
- {
- _loc1_.xCell = _loc1_.xCell + 1;
- }
- _loc1_._parent.spawnPoints[8][_loc1_.id] = _loc1_.xCell + ":" + _loc1_.yCell;
- _loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].spawn = 8;
- _loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].spawnId = _loc1_.id;
- §§push(_loc1_.removeMovieClip());
- }
- }
- function switchTrigger()
- {
- var _loc1_ = this;
- _loc1_.soundFX = new Sound(_loc1_);
- _loc1_.soundFX.attachSound("switchTrigger");
- _loc1_.soundFX.start(0,0);
- _loc1_.soundFX.setVolume(20);
- if(_root.bonusScore >= 25)
- {
- _root.bonusScore -= 25;
- }
- if((_loc1_.id == 0 || _loc1_.id == 2 || _loc1_.id == 3 || _loc1_.id == 6) && !_loc1_._parent.triggerPile[0])
- {
- var _loc2_ = true;
- }
- else if((_loc1_.id == 1 || _loc1_.id == 4 || _loc1_.id == 5 || _loc1_.id == 7) && !_loc1_._parent.triggerPile[1])
- {
- _loc2_ = true;
- }
- else if((_loc1_.id == 9 || _loc1_.id == 12 || _loc1_.id == 13 || _loc1_.id == 15) && !_loc1_._parent.triggerPile[2])
- {
- _loc2_ = true;
- }
- else if((_loc1_.id == 8 || _loc1_.id == 10 || _loc1_.id == 11 || _loc1_.id == 14) && !_loc1_._parent.triggerPile[3])
- {
- _loc2_ = true;
- }
- else
- {
- _loc2_ = false;
- }
- if(_loc2_)
- {
- if(_loc1_.enemyStatus != "boss2_on")
- {
- _loc1_.enemyStatus = "boss2_on";
- _loc1_._parent.triggers[_loc1_.id].pushed = true;
- }
- else
- {
- _loc1_.enemyStatus = "boss2_off";
- _loc1_._parent.triggers[_loc1_.id].pushed = false;
- }
- if(_loc1_.id == 0)
- {
- _loc1_._parent.triggers[3].clip.remoteSwitch();
- }
- if(_loc1_.id == 2)
- {
- _loc1_._parent.triggers[0].clip.remoteSwitch();
- }
- if(_loc1_.id == 1)
- {
- _loc1_._parent.triggers[4].clip.remoteSwitch();
- }
- if(_loc1_.id == 4)
- {
- _loc1_._parent.triggers[5].clip.remoteSwitch();
- }
- if(_loc1_.id == 5)
- {
- _loc1_._parent.triggers[7].clip.remoteSwitch();
- }
- if(_loc1_.id == 9)
- {
- _loc1_._parent.triggers[12].clip.remoteSwitch();
- }
- if(_loc1_.id == 12)
- {
- _loc1_._parent.triggers[9].clip.remoteSwitch();
- }
- if(_loc1_.id == 13)
- {
- _loc1_._parent.triggers[15].clip.remoteSwitch();
- }
- if(_loc1_.id == 15)
- {
- _loc1_._parent.triggers[9].clip.remoteSwitch();
- }
- if(_loc1_.id == 8)
- {
- _loc1_._parent.triggers[10].clip.remoteSwitch();
- }
- if(_loc1_.id == 10)
- {
- _loc1_._parent.triggers[8].clip.remoteSwitch();
- _loc1_._parent.triggers[11].clip.remoteSwitch();
- }
- if(_loc1_.id == 11)
- {
- _loc1_._parent.triggers[14].clip.remoteSwitch();
- }
- if(_loc1_.id == 14)
- {
- _loc1_._parent.triggers[8].clip.remoteSwitch();
- }
- _loc1_.sprite.attachMovie(_loc1_.enemyStatus,"sprite",1);
- }
- }
- function remoteSwitch()
- {
- var _loc1_ = this;
- if(_loc1_.enemyStatus != "boss2_on")
- {
- _loc1_.enemyStatus = "boss2_on";
- _loc1_._parent.triggers[_loc1_.id].pushed = true;
- }
- else
- {
- _loc1_.enemyStatus = "boss2_off";
- _loc1_._parent.triggers[_loc1_.id].pushed = false;
- }
- _loc1_.sprite.attachMovie(_loc1_.enemyStatus,"sprite",1);
- }
- }
-