home *** CD-ROM | disk | FTP | other *** search
Text File | 2005-11-09 | 36.6 KB | 1,603 lines |
- function playerInit()
- {
- bullFlag1 = bullFlag2 = false;
- bullet1._visible = bullet2._visible = false;
- bulletCollideFlag1 = bulletCollideFlag2 = false;
- reloadCnt = playerCollisionFlipFlop = playingDyingCnt = sbReloadCnt = staticNRGInc = 0;
- activeBullets = new Array();
- tellTarget(smartBombMC)
- {
- _visible = false;
- _xscale = _yscale = _alpha = 100;
- _X = -1000;
- }
- numberOfSBUsed = numberOfSaves = 0;
- inertiaHMax = 30;
- inertiaUMax = 10;
- inertiaDMax = 8;
- levelCompletedFlag = false;
- playerPrevSpeed = playerPrevSpeedOld = 0;
- inertia = vInertia = vertSpeed = gravity = 0;
- playerInputFunc = playerInputWalking;
- scrollSpeed = 2;
- prevDir = Right;
- prevVDir = 0;
- takeOffCnt = 0;
- runningAnimation = false;
- jumpingAnimation = false;
- grounded = true;
- jumpingPossibleFlag = true;
- myVerticalFunction = null;
- playerHeartMC = null;
- tellTarget(player)
- {
- _Y = 200;
- _X = 268;
- _visible = true;
- colour.reset();
- gotoAndStop("standingRight");
- play();
- staticBlast._visible = false;
- staticBlast.gotoAndStop(1);
- }
- radarSurround._x = 258;
- playerRadarBlip._x = 294;
- playerRadarBlip._y = player._y / 7 + 354;
- invincibleFlag = true;
- invincibleCnt = invincibleCnt2 = invincibleBright = 0;
- baddieToPlayerFunc = baddieToPlayerCheck;
- playerRadarBlip._visible = true;
- infoBar.livesText.text = lives;
- infoBar.zapCap.text = smartBombs;
- }
- function playerHide()
- {
- tellTarget(player)
- {
- _visible = false;
- gotoAndStop(1);
- }
- playerRadarBlip._visible = false;
- bullFlag1 = bullFlag2 = false;
- bullet1._visible = bullet2._visible = false;
- }
- function playerInput()
- {
- if(levelSkip == true)
- {
- if(inkey(76))
- {
- playerInputFunc = null;
- playerDyingCnt = 0;
- arrowIndicator._visible = true;
- arrowIndicator.gotoAndStop(3);
- arrowIndicatorFunc = null;
- levelCompletedSetUp();
- }
- }
- var _loc1_ = false;
- if(inkey(37))
- {
- moveLeft();
- _loc1_ = true;
- }
- else if(inkey(65))
- {
- moveLeft();
- _loc1_ = true;
- }
- else if(inkey(39))
- {
- moveRight();
- _loc1_ = true;
- }
- else if(inkey(68))
- {
- moveRight();
- _loc1_ = true;
- }
- if(_loc1_ == false)
- {
- handleInertia();
- }
- var _loc2_ = false;
- if(inkey(38))
- {
- moveUp();
- _loc2_ = true;
- }
- else if(inkey(87))
- {
- moveUp();
- _loc2_ = true;
- }
- else if(inkey(40))
- {
- moveDown();
- _loc2_ = true;
- }
- else if(inkey(83))
- {
- moveDown();
- _loc2_ = true;
- }
- if(_loc2_ == false)
- {
- handleGravity();
- }
- checkForShooting();
- }
- function checkForShooting()
- {
- if(reloadCnt <= 0)
- {
- if(inkey(32))
- {
- shoot();
- }
- }
- else
- {
- reloadCnt--;
- }
- if(++staticNRGInc == 15)
- {
- staticNRGInc = 0;
- staticNRG++;
- if(staticNRG >= 200)
- {
- staticNRG = 200;
- infoBar.staticEnergy.gotoAndStop(1);
- }
- else
- {
- infoBar.staticEnergy.gotoAndStop(20 - int(staticNRG / 10));
- }
- }
- if(sbReloadCnt <= 0)
- {
- if(inkey(88))
- {
- smartBombInit();
- }
- else if(inkey(191))
- {
- smartBombInit();
- }
- }
- else
- {
- sbReloadCnt--;
- }
- }
- function playerInputWalking()
- {
- if(levelSkip == true)
- {
- if(inkey(76))
- {
- playerInputFunc = null;
- playerDyingCnt = 0;
- arrowIndicator._visible = true;
- arrowIndicator.gotoAndStop(3);
- arrowIndicatorFunc = null;
- levelCompletedSetUp();
- }
- }
- var _loc1_ = false;
- if(inkey(37))
- {
- moveLeftW();
- _loc1_ = true;
- }
- else if(inkey(65))
- {
- moveLeftW();
- _loc1_ = true;
- }
- else if(inkey(39))
- {
- moveRightW();
- _loc1_ = true;
- }
- else if(inkey(68))
- {
- moveRightW();
- _loc1_ = true;
- }
- if(_loc1_ == false)
- {
- if(handleInertia() == true)
- {
- if(jumpingAnimation != true)
- {
- if(runningAnimation != false)
- {
- runningAnimation = false;
- if(prevDir == Right)
- {
- player.gotoAndPlay("standingRight");
- }
- else
- {
- player.gotoAndPlay("standingLeft");
- }
- }
- }
- }
- }
- var _loc2_ = false;
- if(inkey(38))
- {
- moveUpW();
- _loc2_ = true;
- }
- else if(inkey(87))
- {
- moveUpW();
- _loc2_ = true;
- }
- if(_loc2_ == false)
- {
- handleGravityW();
- }
- checkForShooting();
- }
- function moveUpW()
- {
- if(jumpingPossibleFlag)
- {
- if(staticNRG <= 25)
- {
- speedVert = 0;
- jumpingPossibleFlag = false;
- jumpingSFX.start();
- if(prevDir == Right)
- {
- player.gotoAndPlay("jumpingRight");
- }
- else
- {
- player.gotoAndPlay("jumpingLeft");
- }
- runningAnimation = false;
- jumpingAnimation = true;
- myVerticalFunction = jumping;
- }
- else
- {
- diskPowerUpSFX.start();
- if(prevDir == Right)
- {
- player.gotoAndPlay("liftingOffRight");
- }
- else
- {
- player.gotoAndPlay("liftingOffLeft");
- }
- player._y -= 8;
- inertia = scrollSpeed = 0;
- jumpingPossibleFlag = true;
- grounded = false;
- myVerticalFunction = null;
- takeOffCnt = 0;
- playerInputFunc = waitingToTakeOff;
- }
- }
- }
- function waitingToTakeOff()
- {
- if(++takeOffCnt == 16)
- {
- takeOffCnt = 0;
- runningAnimation = false;
- playerInputFunc = playerInput;
- }
- }
- function waitingToLand()
- {
- if(++takeOffCnt == 18)
- {
- takeOffCnt = 0;
- runningAnimation = false;
- if(levelCompletedFlag != true)
- {
- playerInputFunc = playerInputWalking;
- }
- else
- {
- levelCompletedFlag = false;
- playerInputFunc = null;
- grounded = true;
- if(prevDir == Right)
- {
- player.gotoAndPlay("victoryRight");
- vicTestFrame = 275;
- }
- else
- {
- player.gotoAndStop("victoryLeft");
- vicTestFrame = 299;
- }
- }
- }
- }
- function jumping()
- {
- if(speedVert == vertSpeedMax)
- {
- if(prevDir == Right)
- {
- player.gotoAndStop("jumpEndingRight");
- }
- else
- {
- player.gotoAndStop("jumpEndingLeft");
- }
- jumpingPossibleFlag = false;
- myVerticalFunction = falling;
- }
- else
- {
- player._y -= jumpSinus[speedVert++];
- }
- }
- function falling()
- {
- if(--speedVert < 0)
- {
- speedVert = 0;
- }
- player._y += jumpSinus[speedVert];
- if(player._y >= 200)
- {
- player._y = 200;
- grounded = true;
- speedVert = 0;
- jumpingPossibleFlag = true;
- myVerticalFunction = null;
- if(playerInputFunc == null)
- {
- if(prevDir == Right)
- {
- player.gotoAndPlay("gettingUpRight");
- }
- else
- {
- player.gotoAndPlay("gettingUpLeft");
- }
- takeOffCnt = 14;
- playerInputFunc = waitingToLand;
- }
- else if(prevDir == Right)
- {
- player.gotoAndPlay("jumpEndingRight2");
- }
- else
- {
- player.gotoAndPlay("jumpEndingLeft2");
- }
- jumpingAnimation = runningAnimation = false;
- }
- }
- function moveLeftW()
- {
- if(prevDir != Right)
- {
- if(runningAnimation == false)
- {
- if(jumpingAnimation != true)
- {
- runningAnimation = true;
- player.gotoAndPlay("runningLeft");
- }
- }
- prevDir = Left;
- if(++inertia > inertiaHMax)
- {
- inertia = inertiaHMax;
- }
- if(inertia % 3 == true)
- {
- if(++scrollSpeed > 6)
- {
- scrollSpeed = 6;
- }
- }
- scroller.scrollLeft(scrollSpeed);
- artplayField._x += scrollSpeed;
- if(artplayField._x > 2292)
- {
- artplayField._x -= 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x += int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x >= 0)
- {
- backgroundMC.skyLine._x -= 600;
- }
- }
- }
- else
- {
- inertia -= 4;
- if(inertia % 4 == true)
- {
- if(--scrollSpeed < 2)
- {
- scrollSpeed = 2;
- }
- }
- if(inertia <= 0)
- {
- inertia = 0;
- scrollSpeed = 2;
- prevDir = Left;
- if(jumpingAnimation != true)
- {
- player.gotoAndPlay("turningLeft");
- }
- }
- scroller.scrollRight(scrollSpeed);
- artplayField._x -= scrollSpeed;
- if(artplayField._x < -2292)
- {
- artplayField._x += 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x -= int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x <= -600)
- {
- backgroundMC.skyLine._x += 600;
- }
- }
- }
- }
- function moveRightW()
- {
- if(prevDir != Left)
- {
- if(runningAnimation == false)
- {
- if(jumpingAnimation != true)
- {
- runningAnimation = true;
- player.gotoAndPlay("runningRight");
- }
- }
- prevDir = Right;
- if(++inertia > inertiaHMax)
- {
- inertia = inertiaHMax;
- }
- if(inertia % 3 == true)
- {
- if(++scrollSpeed > 6)
- {
- scrollSpeed = 6;
- }
- }
- scroller.scrollRight(scrollSpeed);
- artplayField._x -= scrollSpeed;
- if(artplayField._x < -2292)
- {
- artplayField._x += 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x -= int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x <= -600)
- {
- backgroundMC.skyLine._x += 600;
- }
- }
- }
- else
- {
- inertia -= 4;
- if(inertia % 4 == true)
- {
- if(--scrollSpeed < 2)
- {
- scrollSpeed = 2;
- }
- }
- if(inertia <= 0)
- {
- inertia = 0;
- scrollSpeed = 2;
- prevDir = Right;
- if(jumpingAnimation != true)
- {
- player.gotoAndPlay("turningRight");
- }
- }
- scroller.scrollLeft(scrollSpeed);
- artplayField._x += scrollSpeed;
- if(artplayField._x > 2292)
- {
- artplayField._x -= 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x += int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x >= 0)
- {
- backgroundMC.skyLine._x -= 600;
- }
- }
- }
- }
- function moveUp()
- {
- prevVDir = Up;
- if(++vInertia > inertiaUMax)
- {
- vInertia = inertiaUMax;
- }
- if(vInertia % 2 == true)
- {
- if(++vertSpeed > 8)
- {
- vertSpeed = 8;
- }
- }
- player._y -= vertSpeed;
- if(player._y <= 8)
- {
- player._y = 8;
- }
- if(infStaticJuice == false)
- {
- staticNRG -= 0.5;
- }
- if(staticNRG <= 0)
- {
- staticNRG = 0;
- infoBar.staticEnergy.gotoAndStop(21);
- speedVert = vertSpeedMax;
- myVerticalFunction = falling;
- inertia = scrollSpeed = 0;
- diskPowerDownSFX.start();
- if(prevDir == Right)
- {
- player.gotoAndPlay("noStaticRight");
- }
- else
- {
- player.gotoAndPlay("noStaticLeft");
- }
- playerInputFunc = null;
- }
- else
- {
- infoBar.staticEnergy.gotoAndStop(20 - int(staticNRG / 10));
- }
- staticNRGInc = 0;
- gravity = 0;
- }
- function moveDown()
- {
- prevVDir = Down;
- if(++vertSpeed > inertiaDMax)
- {
- vertSpeed = inertiaDMax;
- }
- player._y += vertSpeed;
- if(player._y > 200)
- {
- diskPowerDownSFX.start();
- player._y = 200;
- if(prevDir == Right)
- {
- player.gotoAndPlay("landingRight");
- }
- else
- {
- player.gotoAndPlay("landingLeft");
- }
- inertia = scrollSpeed = 0;
- grounded = true;
- playerInputFunc = waitingToLand;
- }
- gravity = 0;
- }
- function handleGravity()
- {
- if(vInertia > 0)
- {
- vInertia--;
- if(vInertia % 2 == true)
- {
- if(--vertSpeed < 0)
- {
- vertSpeed = vInertia = 0;
- }
- }
- if(prevVDir == Up)
- {
- player._y -= vertSpeed;
- if(player._y <= 8)
- {
- player._y = 8;
- }
- }
- }
- else
- {
- gravity += 0.05;
- player._y += gravity;
- if(player._y > 200)
- {
- diskPowerDownSFX.start();
- player._y = 200;
- if(prevDir == Right)
- {
- player.gotoAndPlay("landingRight");
- }
- else
- {
- player.gotoAndPlay("landingLeft");
- }
- inertia = scrollSpeed = 0;
- playerInputFunc = waitingToLand;
- }
- }
- }
- function moveRight()
- {
- if(prevDir != Left)
- {
- prevDir = Right;
- if(++inertia > inertiaHMax)
- {
- inertia = inertiaHMax;
- }
- if(inertia % 3 == true)
- {
- if(++scrollSpeed > 14)
- {
- scrollSpeed = 14;
- }
- }
- scroller.scrollRight(scrollSpeed);
- artplayField._x -= scrollSpeed;
- if(artplayField._x < -2292)
- {
- artplayField._x += 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x -= int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x <= -600)
- {
- backgroundMC.skyLine._x += 600;
- }
- }
- }
- else
- {
- inertia -= 4;
- if(inertia % 4 == true)
- {
- if(--scrollSpeed < 2)
- {
- scrollSpeed = 2;
- }
- }
- if(inertia <= 0)
- {
- inertia = 0;
- scrollSpeed = 2;
- prevDir = Right;
- player.gotoAndPlay("turningRightFlying");
- }
- scroller.scrollLeft(scrollSpeed);
- artplayField._x += scrollSpeed;
- if(artplayField._x > 2292)
- {
- artplayField._x -= 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x += int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x >= 0)
- {
- backgroundMC.skyLine._x -= 600;
- }
- }
- }
- }
- function moveLeft()
- {
- if(prevDir != Right)
- {
- prevDir = Left;
- if(++inertia > inertiaHMax)
- {
- inertia = inertiaHMax;
- }
- if(inertia % 3 == true)
- {
- if(++scrollSpeed > 14)
- {
- scrollSpeed = 14;
- }
- }
- scroller.scrollLeft(scrollSpeed);
- artplayField._x += scrollSpeed;
- if(artplayField._x > 2292)
- {
- artplayField._x -= 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x += int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x >= 0)
- {
- backgroundMC.skyLine._x -= 600;
- }
- }
- }
- else
- {
- inertia -= 4;
- if(inertia % 4 == true)
- {
- if(--scrollSpeed < 2)
- {
- scrollSpeed = 2;
- }
- }
- if(inertia <= 0)
- {
- inertia = 0;
- scrollSpeed = 2;
- prevDir = Left;
- player.gotoAndPlay("turningLeftFlying");
- }
- scroller.scrollRight(scrollSpeed);
- artplayField._x -= scrollSpeed;
- if(artplayField._x < -2292)
- {
- artplayField._x += 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x -= int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x <= -600)
- {
- backgroundMC.skyLine._x += 600;
- }
- }
- }
- }
- function handleInertia()
- {
- if(--inertia <= 0)
- {
- inertia = 0;
- scrollSpeed = 2;
- return true;
- }
- if(inertia % 6 == true)
- {
- if(--scrollSpeed < 2)
- {
- scrollSpeed = 2;
- inertia = 0;
- }
- }
- if(prevDir == Right)
- {
- scroller.scrollRight(scrollSpeed);
- artplayField._x -= scrollSpeed;
- if(artplayField._x < -2292)
- {
- artplayField._x += 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x -= int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x <= -600)
- {
- backgroundMC.skyLine._x += 600;
- }
- }
- if(grounded == true)
- {
- if(jumpingAnimation != true)
- {
- if(runningAnimation == false)
- {
- runningAnimation = true;
- player.gotoAndPlay("runningRight");
- }
- }
- }
- }
- else
- {
- scroller.scrollLeft(scrollSpeed);
- artplayField._x += scrollSpeed;
- if(artplayField._x > 2292)
- {
- artplayField._x -= 4584;
- }
- if(enhanced == true)
- {
- backgroundMC.skyLine._x += int(scrollSpeed / 4);
- if(backgroundMC.skyLine._x >= 0)
- {
- backgroundMC.skyLine._x -= 600;
- }
- }
- if(grounded == true)
- {
- if(jumpingAnimation != true)
- {
- if(runningAnimation == false)
- {
- runningAnimation = true;
- player.gotoAndPlay("runningLeft");
- }
- }
- }
- }
- }
- function shoot()
- {
- var _loc1_ = checkFreeBullet();
- if(_loc1_ != false)
- {
- if(infStaticJuice == false)
- {
- staticNRG -= 2;
- }
- if(staticNRG <= 0)
- {
- staticNRG = 0;
- infoBar.staticEnergy.gotoAndStop(21);
- if(grounded != true)
- {
- speedVert = vertSpeedMax;
- myVerticalFunction = falling;
- inertia = scrollSpeed = 0;
- diskPowerDownSFX.start();
- if(prevDir == Right)
- {
- player.gotoAndPlay("noStaticRight");
- }
- else
- {
- player.gotoAndPlay("noStaticLeft");
- }
- playerInputFunc = null;
- }
- }
- else
- {
- infoBar.staticEnergy.gotoAndStop(20 - int(staticNRG / 10));
- }
- staticNRGInc = 0;
- playerShootSFX.start();
- reloadCnt = 12;
- _loc1_._y = player._y + 184;
- _loc1_._visible = true;
- _loc1_.gotoAndPlay(1);
- if(prevDir == Right)
- {
- if(grounded != true)
- {
- _loc1_._x = player._x + 360;
- }
- else
- {
- _loc1_._x = player._x + 340;
- _loc1_._y = player._y + 188;
- }
- _loc1_.movePlayerBulletFunc = moveBulletRight;
- _loc1_._xscale = 100;
- }
- else
- {
- if(grounded != true)
- {
- _loc1_._x = player._x - 268;
- }
- else
- {
- _loc1_._x = player._x - 248;
- _loc1_._y = player._y + 188;
- }
- _loc1_.movePlayerBulletFunc = moveBulletLeft;
- _loc1_._xscale = -100;
- }
- this["bulletCollideFlag" + _loc1_.num] = false;
- activeBullets.push(_loc1_);
- }
- }
- function checkFreeBullet()
- {
- if(bullFlag1 == false)
- {
- bullFlag1 = true;
- return bullet1;
- }
- if(bullFlag2 == false)
- {
- bullFlag2 = true;
- return bullet2;
- }
- return false;
- }
- function bulletHandler()
- {
- var _loc3_ = this;
- if(activeBullets.length != 0)
- {
- var _loc1_ = undefined;
- var _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < activeBullets.length)
- {
- _loc1_ = activeBullets[_loc2_];
- if(_loc1_.movePlayerBulletFunc(_loc1_) == "dead")
- {
- _loc1_._visible = _loc3_["bullFlag" + _loc1_.num] = false;
- _loc3_["bulletCollideFlag" + _loc1_.num] = false;
- _loc1_.gotoAndStop(1);
- activeBullets.splice(_loc2_,1);
- _loc2_ = _loc2_ - 1;
- }
- }
- }
- }
- function moveBulletRight(mc)
- {
- var _loc2_ = mc;
- if(_loc2_._currentframe == _loc2_._totalframes)
- {
- return "dead";
- }
- if(_root["bulletCollideFlag" + _loc2_.num] != true)
- {
- if(onScreenBaddies.length != 0)
- {
- var _loc1_ = undefined;
- var _loc3_ = -1;
- while((_loc3_ = _loc3_ + 1) != onScreenBaddies.length)
- {
- _loc1_ = onScreenBaddies[_loc3_];
- if(_loc1_.currentStatus == 1)
- {
- if(_loc2_.hitTest(_loc1_.hitAreaMC2))
- {
- baddieHit(_loc1_,1);
- _root["bulletCollideFlag" + _loc2_.num] = true;
- break;
- }
- }
- }
- }
- }
- }
- function moveBulletLeft(mc)
- {
- var _loc2_ = mc;
- if(_loc2_._currentframe == _loc2_._totalframes)
- {
- return "dead";
- }
- if(_root["bulletCollideFlag" + _loc2_.num] != true)
- {
- if(onScreenBaddies.length != 0)
- {
- var _loc1_ = undefined;
- var _loc3_ = -1;
- while((_loc3_ = _loc3_ + 1) != onScreenBaddies.length)
- {
- _loc1_ = onScreenBaddies[_loc3_];
- if(_loc1_.currentStatus == 1)
- {
- if(_loc2_.hitTest(_loc1_.hitAreaMC2))
- {
- baddieHit(_loc1_,1);
- _root["bulletCollideFlag" + _loc2_.num] = true;
- break;
- }
- }
- }
- }
- }
- }
- function smartBombInit()
- {
- var _loc3_ = this;
- if(smartBombs != 0)
- {
- smartBombSFX.start();
- smartBombs--;
- numberOfSBUsed++;
- infoBar.zapCap.text = smartBombs;
- sbReloadCnt = 20;
- smartBombAcc = 0;
- player.gotoAndStop(player._currentframe);
- if(onScreenBaddies.length != 0)
- {
- var _loc1_ = undefined;
- var _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) != onScreenBaddies.length)
- {
- _loc1_ = onScreenBaddies[_loc2_];
- _loc1_.anim.gotoAndStop(_loc1_.anim._currentframe);
- }
- }
- tellTarget(smartBombMC)
- {
- _visible = true;
- _X = _loc3_.player._x + _width / 2;
- _Y = _loc3_.player._y + _height / 2;
- }
- _loc3_.onEnterFrame = smartBombHandler;
- }
- }
- function smartBombHandler()
- {
- smartBombAcc += 2;
- tellTarget(smartBombMC)
- {
- _xscale = _yscale = _yscale + this.smartBombAcc;
- _alpha--;
- }
- if(smartBombMC._width >= 1000)
- {
- smartBombEnd();
- }
- else if(onScreenBaddies.length != 0)
- {
- var _loc1_ = undefined;
- var _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) != onScreenBaddies.length)
- {
- _loc1_ = onScreenBaddies[_loc2_];
- if(_loc1_.currentStatus != 3)
- {
- if(smartBombMC.hitTest(_loc1_.hitAreaMC))
- {
- baddieHit(_loc1_,100);
- }
- }
- }
- }
- }
- function smartBombEnd()
- {
- tellTarget(smartBombMC)
- {
- _visible = false;
- _xscale = _yscale = _alpha = 100;
- _X = -1000;
- }
- player.gotoAndPlay(player._currentframe);
- this.onEnterFrame = master;
- }
- function baddieToPlayerCheck()
- {
- if(invincibleFlag == true)
- {
- if(++invincibleCnt > 2)
- {
- invincibleCnt = 0;
- if(++invincibleCnt2 == 15)
- {
- invincibleFlag = false;
- invincibleBright = 0;
- player.colour.reset();
- }
- else
- {
- if(invincibleBright == 0)
- {
- invincibleBright = 100;
- }
- else
- {
- invincibleBright = 0;
- }
- player.colour.setBrightness(invincibleBright);
- }
- }
- }
- else if(invincible != true)
- {
- if(++playerCollisionFlipFlop == 1)
- {
- if(onScreenBaddies.length != 0)
- {
- var _loc2_ = undefined;
- var _loc1_ = -1;
- while(true)
- {
- if((_loc1_ = _loc1_ + 1) != onScreenBaddies.length)
- {
- _loc2_ = onScreenBaddies[_loc1_];
- if(_loc2_.currentStatus != 1)
- {
- continue;
- }
- if(!player.hitAreaMC.hitTest(_loc2_.hitAreaMC))
- {
- continue;
- }
- baddieHit(_loc2_,1,true);
- invincibleFlag = true;
- invincibleCnt = 0;
- invincibleCnt2 = 6;
- if(grounded != true)
- {
- playerBounceFlip = false;
- if(prevDir == Left)
- {
- if(_loc2_._x < playerRelativePos.x)
- {
- playerBounceFlip = true;
- prevDir = Right;
- }
- }
- else if(_loc2_._x > playerRelativePos.x)
- {
- playerBounceFlip = true;
- prevDir = Left;
- }
- inertia = 14;
- playerInputFunc = playerBounce;
- }
- if(difficulty == "Hard")
- {
- loseEnergy(40);
- }
- else
- {
- loseEnergy(25);
- }
- }
- }
- }
- }
- else
- {
- playerCollisionFlipFlop = 0;
- if(activeBadBullets.length != 0)
- {
- _loc1_ = -1;
- while((_loc1_ = _loc1_ + 1) != activeBadBullets.length)
- {
- _loc2_ = activeBadBullets[_loc1_];
- if(player.hitAreaMC.hitTest(_loc2_.hitAreaMC))
- {
- if(difficulty == "Hard")
- {
- loseEnergy(20);
- }
- else
- {
- loseEnergy(10);
- }
- _loc2_.gotoAndStop(2);
- activeBadBullets[_loc1_].moveBaddieBulletFunc = bulletDying;
- break;
- }
- }
- }
- }
- }
- }
- function playerBounce()
- {
- if(handleInertia() == true)
- {
- if(playerBounceFlip == true)
- {
- playerBounceFlip = false;
- if(prevDir == Left)
- {
- prevDir = Right;
- }
- else
- {
- prevDir = Left;
- }
- }
- playerInputFunc = playerInput;
- gravity = 0;
- }
- gravity += 0.5;
- player._y += gravity;
- if(player._y > 200)
- {
- player._y = 200;
- if(prevDir == Right)
- {
- player.gotoAndPlay("landingRight");
- }
- else
- {
- player.gotoAndPlay("landingLeft");
- }
- inertia = scrollSpeed = 0;
- playerInputFunc = waitingToLand;
- }
- }
- function loseEnergy(amount)
- {
- stamina -= amount;
- if(stamina < 10)
- {
- infoBar.staminaBar.gotoAndStop(21);
- playerInputFunc = playerKilled;
- }
- else
- {
- infoBar.staminaBar.gotoAndStop(20 - int(stamina / 10));
- invincibleFlag = true;
- invincibleCnt = 0;
- invincibleCnt2 = 13;
- }
- }
- function playerKilled()
- {
- attractMode.killInGameMusic();
- baddieToPlayerFunc = null;
- invincibleFlag = false;
- invincibleBright = 0;
- player.colour.reset();
- playerRadarBlip._visible = arrowIndicator._visible = false;
- arrowIndicatorFunc = null;
- lives--;
- xtraLifeArrays[livesOffset] = 0;
- infoBar.livesText.text = lives;
- stamina = 200;
- numberOfAttempts++;
- playingDyingCnt = 0;
- if(grounded == true and myVerticalFunction == null)
- {
- if(prevDir == Right)
- {
- player.gotoAndPlay("dyingRight1");
- }
- else
- {
- player.gotoAndPlay("dyingLeft1");
- }
- playerInputFunc = playerDying;
- }
- else
- {
- diskPowerDownSFX.start();
- if(prevDir == Right)
- {
- player.gotoAndPlay("noStaticRight");
- }
- else
- {
- player.gotoAndPlay("noStaticLeft");
- }
- playerInputFunc = playerDyingFalling;
- }
- myVerticalFunction = null;
- }
- function playerDyingFalling()
- {
- if(++vertSpeed > inertiaDMax)
- {
- vertSpeed = inertiaDMax;
- }
- player._y += vertSpeed;
- if(player._y > 200)
- {
- player._y = 200;
- if(prevDir == Right)
- {
- player.gotoAndPlay("dyingRight2");
- }
- else
- {
- player.gotoAndPlay("dyingLeft2");
- }
- playerInputFunc = playerDying;
- inertia = scrollSpeed = 0;
- grounded = true;
- }
- }
- function playerDying()
- {
- var _loc2_ = this;
- var _loc1_ = -1;
- while((_loc1_ = _loc1_ + 1) < activeBadBullets.length)
- {
- activeBadBullets[_loc1_].gotoAndStop(2);
- activeBadBullets[_loc1_].moveBaddieBulletFunc = bulletDying;
- }
- if(++playingDyingCnt >= frameRate * 2)
- {
- playingDyingCnt = 0;
- delete _loc2_.onEnterFrame;
- if(lives != 0)
- {
- if(baddieHandlerfunc == levelCompletedDelay)
- {
- tellTarget(attractMode)
- {
- gotoAndStop("levelDone");
- play();
- }
- }
- else
- {
- wipeRunningFlag = true;
- tellTarget(attractMode.wipe)
- {
- _visible = true;
- gotoAndPlay(2);
- }
- continueGame();
- }
- }
- else
- {
- _loc2_.playingDyingCnt = 0;
- _loc2_.onEnterFrame = function()
- {
- if(++this.playingDyingCnt == frameRate)
- {
- this.playingDyingCnt = 0;
- gameOver();
- }
- };
- }
- }
- }
- function increaseScore(mc)
- {
- score += mc.points;
- infoBar.scoreText.text = score;
- livesOffset = int(score / 25000);
- if(livesOffset > 0)
- {
- if(lives < 9)
- {
- if(xtraLifeArrays[livesOffset - 1] == 0)
- {
- xtraLifeArrays[livesOffset - 1] = 1;
- lives++;
- extralifeSpeechSFX.start();
- infoBar.livesText.text = lives;
- arrowIndicator.gotoAndStop(4);
- arrowIndicator._visible = true;
- arrowIndicatorCnt = - frameRate;
- arrowIndicatorFunc = displayArrow;
- }
- }
- }
- }
- function levelCompletedSetUp()
- {
- if(playerInputFunc != playerDying)
- {
- attractMode.killInGameMusic();
- playerInputFunc = null;
- levelCompletedFlag = true;
- tempInvincible = invincible;
- invincible = true;
- var _loc1_ = -1;
- while((_loc1_ = _loc1_ + 1) < activeBadBullets.length)
- {
- activeBadBullets[_loc1_].gotoAndStop(2);
- activeBadBullets[_loc1_].moveBaddieBulletFunc = bulletDying;
- }
- var _loc2_ = undefined;
- _loc1_ = 0;
- while((_loc1_ = _loc1_ + 1) != 12)
- {
- _loc2_ = speedEffectHolder.attachMovie("attractStar","aS" + _loc1_,_loc1_);
- }
- speedEffectHolder._alpha = 100;
- collectAllCircuitboardsSFX.start();
- if(grounded == true)
- {
- if(prevDir == Right)
- {
- player.gotoAndPlay("victoryRight");
- vicTestFrame = 275;
- }
- else
- {
- player.gotoAndStop("victoryLeft");
- vicTestFrame = 299;
- }
- }
- baddieHandlerfunc = levelCompletedDelay;
- }
- }
- function levelCompletedDelay()
- {
- var _loc3_ = this;
- if(grounded == true)
- {
- if(player._currentframe == vicTestFrame)
- {
- player.play();
- }
- }
- else
- {
- falling();
- }
- var _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < grabberbaddieStorage.length)
- {
- grabberbaddieStorage[_loc2_].func();
- }
- _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < planterbaddieStorage.length)
- {
- planterbaddieStorage[_loc2_].func();
- }
- _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < minebaddieStorage.length)
- {
- minebaddieStorage[_loc2_].func();
- }
- if(hunterbaddieStorage.currentStatus != 3)
- {
- hunterbaddieStorage.func();
- }
- _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < activeBadBullets.length)
- {
- activeBadBullets[_loc2_].gotoAndStop(2);
- activeBadBullets[_loc2_].moveBaddieBulletFunc = bulletDying;
- }
- if(++_loc3_.playerDyingCnt == frameRate)
- {
- var _loc1_ = undefined;
- _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < grabberbaddieStorage.length)
- {
- _loc1_ = grabberbaddieStorage[_loc2_];
- if(_loc1_.currentStatus == 4)
- {
- _loc1_.pU_lifeSpan = 1;
- }
- else
- {
- _loc1_.func = grabberTumbling;
- _loc1_.anim.baddieAnim.gotoAndStop(10);
- _loc1_.radarBlip.gotoAndStop(2);
- _loc1_.colour.reset();
- }
- }
- _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < planterbaddieStorage.length)
- {
- _loc1_ = planterbaddieStorage[_loc2_];
- if(_loc1_.currentStatus == 4)
- {
- _loc1_.pU_lifeSpan = 1;
- }
- else
- {
- _loc1_.func = planterTumbling;
- if(_loc1_.hdir == 1)
- {
- _loc1_.anim.baddieAnim.gotoAndStop(27);
- }
- else
- {
- _loc1_.anim.baddieAnim.gotoAndStop(26);
- }
- _loc1_.radarBlip.gotoAndStop(2);
- _loc1_.colour.reset();
- }
- }
- _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < minebaddieStorage.length)
- {
- _loc1_ = minebaddieStorage[_loc2_];
- if(_loc1_.currentStatus == 4)
- {
- _loc1_.pU_lifeSpan = 1;
- }
- else
- {
- _loc1_.func = mineTumbling;
- _loc1_.anim.baddieAnim.gotoAndStop(3);
- _loc1_.radarBlip.gotoAndStop(2);
- _loc1_.colour.reset();
- }
- }
- _loc2_ = -1;
- while((_loc2_ = _loc2_ + 1) < walkerbaddieStorage.length)
- {
- _loc1_ = walkerbaddieStorage[_loc2_];
- if(_loc1_.currentStatus == 4)
- {
- _loc1_.pU_lifeSpan = 1;
- }
- else
- {
- _loc1_.func = null;
- if(_loc1_.hdir == 1)
- {
- _loc1_.anim.baddieAnim.gotoAndStop(19);
- }
- else
- {
- _loc1_.anim.baddieAnim.gotoAndStop(20);
- }
- _loc1_.radarBlip.gotoAndStop(2);
- _loc1_.colour.reset();
- }
- }
- if(hunterbaddieStorage.currentStatus != 3)
- {
- _loc1_ = hunterbaddieStorage;
- _loc1_.func = hunterTumbling;
- if(_loc1_.hdir == 1)
- {
- _loc1_.anim.baddieAnim.gotoAndStop(3);
- }
- else
- {
- _loc1_.anim.baddieAnim.gotoAndStop(4);
- }
- _loc1_.radarBlip.gotoAndStop(2);
- _loc1_.colour.reset();
- }
- }
- else
- {
- if(_loc3_.playerDyingCnt >= frameRate * 2)
- {
- if(speedEffectHolder._alpha > 0)
- {
- speedEffectHolder._alpha -= 2;
- }
- else if(speedEffectHolder.aS3 != undefined)
- {
- _loc2_ = 0;
- while((_loc2_ = _loc2_ + 1) != 12)
- {
- speedEffectHolder["aS" + _loc2_].removeMovieClip();
- }
- }
- }
- if(_loc3_.playerDyingCnt == frameRate * 4)
- {
- killAllBaddies();
- tellTarget(attractMode.wipe)
- {
- _visible = true;
- gotoAndPlay(2);
- }
- }
- else if(_loc3_.playerDyingCnt == frameRate * 5)
- {
- playerHide();
- invincible = tempInvincible;
- _loc3_.playingDyingCnt = 0;
- delete _loc3_.onEnterFrame;
- if(level % 2 == true)
- {
- bumpLevel2();
- }
- else
- {
- attractMode.gotoAndStop("levelDone");
- }
- }
- }
- }
-