home *** CD-ROM | disk | FTP | other *** search
- function init()
- {
- _global.scroller = new scrollerEngine();
- scroller.init(map1Parameters);
- totalPlayFieldWidth = 4592;
- coverMC.onEnterFrame = function()
- {
- coverMC._alpha -= 20;
- if(coverMC._alpha < 0)
- {
- coverMC.unloadMovie();
- }
- };
- loadingHolder = 1;
- loadLevel();
- }
- function loadLevel()
- {
- artplayField["container" + loadingHolder].loadMovie(fileNameStorage[loadingHolder - 1]);
- artplayField.preloaderDelay = 0;
- artplayField.onEnterFrame = function()
- {
- if(++this.preloaderDelay == 5)
- {
- this.onEnterFrame = preloadLevel;
- }
- };
- }
- function preloadLevel()
- {
- var _loc1_ = Math.floor(artplayField["container" + loadingHolder].getBytesLoaded() / artplayField["container" + loadingHolder].getBytesTotal() * 100);
- if(_loc1_ == 100)
- {
- delete this.onEnterFrame;
- levelsLoaded[loadingHolder - 1] = true;
- artplayField["container" + loadingHolder]._visible = false;
- if(++loadingHolder != fileNameStorage.length + 1)
- {
- loadLevel();
- }
- }
- }
- function tracking()
- {
- var _loc1_ = new Date().getTime();
- loadMovieNum("http://www.gamezhero.com/online/staticShock/tracker.swf?" + _loc1_,10000);
- }
- function attract()
- {
- radarSurround._visible = infoBar._visible = infoBar2._visible = false;
- playerHide();
- tellTarget(attractMode)
- {
- gotoAndPlay(2);
- }
- }
- function startGame()
- {
- score = 0;
- infoBar.scoreText.text = score;
- level = 1;
- lives = 3;
- infoBar.livesText.text = lives;
- xtraLifeArrays = new Array(0,0,0,0,0,0,0,0,0);
- livesOffset = 0;
- cheated = false;
- stamina = 200;
- infoBar.staminaBar.gotoAndStop(1);
- staticNRG = 200;
- infoBar.staticEnergy.gotoAndStop(1);
- backGroundOffset = numberOfCollectedCircuits = 0;
- smartBombs = 3;
- if(difficulty == "Hard")
- {
- numberOfCircuits = 5;
- }
- else
- {
- numberOfCircuits = 3;
- }
- numberOfAttempts = 1;
- infoBar2.circuitsText.text = numberOfCollectedCircuits + "/" + numberOfCircuits;
- infoBar.zapCap.text = smartBombs;
- currentIntroFrame = 1;
- artplayField.container1._visible = artplayField.container2._visible = artplayField.container3._visible = false;
- this.onEnterFrame = function()
- {
- if(attractMode.wipe._currentframe == 15)
- {
- delete this.onEnterFrame;
- attractMode.gotoAndPlay("getReady");
- attractMode.wipe.gotoAndPlay("out");
- }
- };
- }
- function preContinueGame()
- {
- attractMode.gotoAndPlay(1);
- bgNumber = backgroundStorage[backGroundOffset][0];
- backgroundMC.gotoAndStop(backgroundStorage[backGroundOffset][0]);
- radarSurround._visible = infoBar._visible = infoBar2._visible = true;
- scroller.resetScroller();
- lampPostFrame = backgroundStorage[backGroundOffset][1];
- continueGame();
- }
- function continueGame()
- {
- arrowIndicator._visible = false;
- arrowIndicatorCnt = 0;
- arrowIndicatorFunc = null;
- backgroundMC.gotoAndStop(backgroundStorage[backGroundOffset][0]);
- backgroundMC.skyLine._x = -300;
- artplayField.container1._visible = artplayField.container2._visible = artplayField.container3._visible = false;
- if(bgNumber != 1)
- {
- var _loc1_ = undefined;
- for(_loc1_ in artplayField)
- {
- artplayField[_loc1_]._visible = false;
- }
- artplayField["container" + (bgNumber - 1)]._visible = true;
- }
- else
- {
- artplayField._visible = true;
- }
- lampPostFrame = backgroundStorage[backGroundOffset][1];
- scroller.startXPos = 44;
- scroller.resetScroller();
- scroller.xUpdate = scroller.xBoundary = false;
- artplayField._x = radarMap._x = 0;
- artBasedHandler();
- staticNRG = 200;
- infoBar.staticEnergy.gotoAndStop(1);
- if(stamina == 200)
- {
- infoBar.staminaBar.gotoAndStop(1);
- }
- else
- {
- infoBar.staminaBar.gotoAndStop(20 - int(stamina / 10));
- }
- numberOfCollectedCircuits = 0;
- infoBar2.circuitsText.text = numberOfCollectedCircuits + "/" + numberOfCircuits;
- playerInit();
- killAllBaddies();
- humanInit();
- baddieInit();
- if(wipeRunningFlag == true)
- {
- wipeRunningFlag = false;
- tellTarget(attractMode.wipe)
- {
- gotoAndStop("out");
- play();
- }
- var wipeCnt = 0;
- this.onEnterFrame = function()
- {
- if(++wipeCnt == 28)
- {
- attractMode.initInGameMusic();
- plotStartLevelMessageBar();
- }
- };
- }
- else
- {
- this.onEnterFrame = master;
- }
- }
- function plotStartLevelMessageBar()
- {
- var _loc1_ = this;
- messageBar.messageTextField.text = "";
- messageBar.messageTextField._x = 52;
- messageBar._visible = true;
- messageBar.gotoAndPlay(1);
- var cnt = 0;
- var textPos = 0;
- var textToPlot = "COLLECT " + numberOfCircuits + " CIRCUIT PARTS TO DEACTIVATE MICROBOTS";
- _loc1_.onEnterFrame = function()
- {
- var _loc1_ = this;
- if(++cnt == 15)
- {
- _loc1_.onEnterFrame = function()
- {
- cnt = 0;
- messageBar.messageTextField.text += textToPlot.charAt(textPos++);
- messageBar.messageTextField.text += textToPlot.charAt(textPos++);
- if(textPos >= textToPlot.length)
- {
- this.onEnterFrame = function()
- {
- if(++cnt == 35)
- {
- messageBar.play();
- }
- else if(cnt == 45)
- {
- this.onEnterFrame = master;
- }
- };
- }
- };
- }
- };
- }
- function gameOver()
- {
- var _loc1_ = this;
- messageBar.messageTextField.text = "";
- messageBar.messageTextField._x = 252;
- messageBar._visible = true;
- messageBar.gotoAndPlay(1);
- var cnt = 0;
- var textPos = 0;
- var textToPlot = "GAME OVER";
- gameOverMod.start();
- _loc1_.onEnterFrame = function()
- {
- var _loc1_ = this;
- if(++cnt == 15)
- {
- _loc1_.onEnterFrame = function()
- {
- cnt = 0;
- messageBar.messageTextField.text += textToPlot.charAt(textPos++);
- if(textPos == textToPlot.length)
- {
- this.onEnterFrame = function()
- {
- if(++cnt == frameRate * 2)
- {
- messageBar.play();
- }
- else if(cnt == frameRate * 2 + 10)
- {
- killAllBaddies();
- delete this.onEnterFrame;
- attract();
- }
- };
- }
- };
- }
- };
- }
- function bumpLevel()
- {
- level++;
- if(numberOfCircuits != 9)
- {
- numberOfCircuits++;
- }
- numberOfAttempts = 1;
- infoBar2.circuitsText.text = numberOfCollectedCircuits + "/" + numberOfCircuits;
- if(++backGroundOffset > backgroundStorage.length - 1)
- {
- backGroundOffset = 0;
- }
- currentIntroFrame = introFrames[backGroundOffset];
- attractMode.gotoAndPlay("getReady");
- }
- function bumpLevel2()
- {
- level++;
- if(numberOfCircuits != 9)
- {
- numberOfCircuits++;
- }
- infoBar2.circuitsText.text = numberOfCollectedCircuits + "/" + numberOfCircuits;
- if(++backGroundOffset > backgroundStorage.length - 1)
- {
- backGroundOffset = 0;
- }
- currentIntroFrame = introFrames[backGroundOffset];
- attractMode.gotoAndPlay("getReady3");
- }
- function displayArrow()
- {
- if(++arrowIndicatorCnt == frameRate * 2)
- {
- arrowIndicatorCnt = 0;
- arrowIndicatorFunc = null;
- arrowIndicator._visible = false;
- }
- }
- function pauseCheck()
- {
- var _loc3_ = this;
- if(pausedKeyCheckDelay == 0)
- {
- if(inkey(80))
- {
- pausedKeyCheckDelay = 10;
- if(pauseFlag == false)
- {
- pauseFlag = pauseText._visible = true;
- pausedFunc = _loc3_.onEnterFrame;
- _loc3_.onEnterFrame = pauseCheck;
- tellTarget(player)
- {
- anim.gotoAndStop(anim._currentframe);
- }
- var _loc1_ = undefined;
- var _loc2_ = 0;
- for(_loc2_ in spritePlayField)
- {
- if(typeof spritePlayField[_loc2_] == "movieclip")
- {
- _loc1_ = spritePlayField[_loc2_];
- _loc1_.anim.baddieAnim.gotoAndStop(_loc1_.anim.baddieAnim._currentframe);
- if(_loc1_.anim.baddieAnim.wings != undefined)
- {
- _loc1_.anim.baddieAnim.body.gotoAndStop(_loc1_.anim.baddieAnim.body._currentframe);
- _loc1_.anim.baddieAnim.wings.gotoAndStop(_loc1_.anim.baddieAnim.wings._currentframe);
- }
- }
- }
- }
- else
- {
- pauseFlag = pauseText._visible = false;
- _loc2_ = 0;
- for(_loc2_ in spritePlayField)
- {
- if(typeof spritePlayField[_loc2_] == "movieclip")
- {
- _loc1_ = spritePlayField[_loc2_];
- if(_loc1_.animDelay == undefined)
- {
- _loc1_.anim.baddieAnim.gotoAndPlay(_loc1_.anim.baddieAnim._currentframe);
- }
- if(_loc1_.anim.baddieAnim.wings != undefined)
- {
- _loc1_.anim.baddieAnim.body.gotoAndPlay(_loc1_.anim.baddieAnim.body._currentframe);
- _loc1_.anim.baddieAnim.wings.gotoAndPlay(_loc1_.anim.baddieAnim.wings._currentframe);
- }
- }
- }
- tellTarget(player)
- {
- anim.gotoAndPlay(anim._currentframe);
- }
- _loc3_.onEnterFrame = pausedFunc;
- }
- }
- else if(inkey(81))
- {
- if(pauseFlag == true)
- {
- pauseFlag = pauseText._visible = false;
- delete _loc3_.onEnterFrame;
- killAllBaddies();
- playerHide();
- if(score > bestScore)
- {
- bestScore = score;
- bestScoreString = insertZeros(bestScore);
- saveData();
- }
- arrowIndicator._visible = false;
- infoBar.extraLifeText._visible = false;
- attract();
- }
- }
- }
- else
- {
- pausedKeyCheckDelay--;
- }
- }
-