home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / staticshock.swf / scripts / DefineSprite_977 / frame_3 / DoAction.as
Encoding:
Text File  |  2005-11-09  |  5.2 KB  |  210 lines

  1. function scanForSpace()
  2. {
  3.    var _loc2_ = this;
  4.    if(inkey(32))
  5.    {
  6.       _parent.skipSFX.start();
  7.       delete _loc2_.onEnterFrame;
  8.       _loc2_.onEnterFrame = function()
  9.       {
  10.          var _loc1_ = titleMod.getVolume();
  11.          if(_loc1_ > 0)
  12.          {
  13.             _loc1_ -= 8;
  14.             titleMod.setVolume(_loc1_);
  15.          }
  16.          else
  17.          {
  18.             titleMod.setVolume(0);
  19.             titleMusicFlag = false;
  20.             titleMod.stop();
  21.             delete this.onEnterFrame;
  22.          }
  23.       };
  24.       _root.tracking();
  25.       gotoAndStop("onePlayerStart");
  26.       play();
  27.    }
  28. }
  29. function toggleDifficulty()
  30. {
  31.    var _loc1_ = _parent;
  32.    var _loc2_ = this;
  33.    delete _loc2_.onPress;
  34.    _loc1_.selectSFX2.start();
  35.    if(_loc1_.difficulty == "Normal")
  36.    {
  37.       _loc1_.difficulty = "Hard";
  38.    }
  39.    else
  40.    {
  41.       _loc1_.difficulty = "Normal";
  42.    }
  43.    difficultyToggle.playMode.text = _loc1_.difficulty;
  44.    difficultyToggle.cnt = 0;
  45.    difficultyToggle.onEnterFrame = function()
  46.    {
  47.       if(++this.cnt == 5)
  48.       {
  49.          delete this.onEnterFrame;
  50.          difficultyToggle.onPress = toggleDifficulty;
  51.       }
  52.    };
  53. }
  54. function checkEnteredCode()
  55. {
  56.    var _loc1_ = _root;
  57.    var _loc2_ = this;
  58.    var _loc3_ = codeBox.inputTxt.text.toLowerCase();
  59.    if(_loc3_ == "amped")
  60.    {
  61.       if(_loc1_.invincible == false)
  62.       {
  63.          _loc1_.invincible = true;
  64.          codeBox.codeResult.text = "INFINITE HEALTH CHEAT UNLOCKED!";
  65.          healthCheatMC._visible = true;
  66.          healthCheatMC.gotoAndStop(2);
  67.       }
  68.       else
  69.       {
  70.          _loc1_.invincible = false;
  71.          codeBox.codeResult.text = "INFINITE HEALTH CHEAT DEACTIVATED!";
  72.          healthCheatMC._visible = false;
  73.          healthCheatMC.gotoAndStop(1);
  74.       }
  75.    }
  76.    else if(_loc3_ == "surge")
  77.    {
  78.       if(_loc1_.infStaticJuice == false)
  79.       {
  80.          _loc1_.infStaticJuice = true;
  81.          codeBox.codeResult.text = "INFINITE DISK POWER CHEAT UNLOCKED!";
  82.          diskCheatMC._visible = true;
  83.          diskCheatMC.gotoAndStop(2);
  84.       }
  85.       else
  86.       {
  87.          _loc1_.infStaticJuice = false;
  88.          codeBox.codeResult.text = "INFINITE DISK POWER CHEAT DEACTIVATED!";
  89.          diskCheatMC._visible = false;
  90.          diskCheatMC.gotoAndStop(1);
  91.       }
  92.    }
  93.    else if(_loc3_ == "overload")
  94.    {
  95.       if(_loc1_.levelSkip == false)
  96.       {
  97.          _loc1_.levelSkip = true;
  98.          codeBox.codeResult.text = "LEVEL SKIP CHEAT UNLOCKED - PRESS \"L\" DURING PLAY TO WARP!";
  99.          levelSkipIcon._visible = true;
  100.          levelSkipIcon.gotoAndStop(2);
  101.       }
  102.       else
  103.       {
  104.          _loc1_.levelSkip = false;
  105.          codeBox.codeResult.text = "LEVEL SKIP CHEAT DEACTIVATED!";
  106.          levelSkipIcon._visible = false;
  107.          levelSkipIcon.gotoAndStop(1);
  108.       }
  109.    }
  110.    else
  111.    {
  112.       codeBox.inputTxt.text = "";
  113.       codeBox.codeResult.text = "CODE NOT RECOGNISED!";
  114.    }
  115.    if(codeBox.codeResult.text == "CODE NOT RECOGNISED!")
  116.    {
  117.       codeBox.cnt = 0;
  118.       _parent.selectSFX.start();
  119.       _loc2_.onEnterFrame = function()
  120.       {
  121.          if(++this.cnt == frameRate * 2)
  122.          {
  123.             delete this.onEnterFrame;
  124.             codeBox.codeResult.text = "";
  125.          }
  126.       };
  127.    }
  128.    else
  129.    {
  130.       delete codeBox.unlockButton.onPress;
  131.       _parent.heartBounceSFX.start();
  132.       codeBox.cnt = 0;
  133.       codeBox.onEnterFrame = function()
  134.       {
  135.          if(++this.cnt == frameRate * 7)
  136.          {
  137.             delete this.onEnterFrame;
  138.             delete codeBox.clseButton.onPress;
  139.             codeBox._visible = false;
  140.          }
  141.       };
  142.    }
  143. }
  144. playButton.onPress = function()
  145. {
  146.    _parent.skipSFX.start();
  147.    this.onEnterFrame = function()
  148.    {
  149.       var _loc1_ = titleMod.getVolume();
  150.       if(_loc1_ > 0)
  151.       {
  152.          _loc1_ -= 8;
  153.          titleMod.setVolume(_loc1_);
  154.       }
  155.       else
  156.       {
  157.          titleMusicFlag = false;
  158.          titleMod.setVolume(0);
  159.          titleMod.stop();
  160.          delete this.onEnterFrame;
  161.       }
  162.    };
  163.    _root.tracking();
  164.    gotoAndStop("onePlayerStart");
  165.    play();
  166. };
  167. difficultyToggle.onPress = toggleDifficulty;
  168. codeButton.onPress = function()
  169. {
  170.    var _loc1_ = _parent;
  171.    codeBox.inputTxt.text = "";
  172.    codeBox.codeResult.text = "";
  173.    codeBox.inputTxt.onSetFocus = function(oldFocus)
  174.    {
  175.       this.text = "";
  176.    };
  177.    codeBox._visible = true;
  178.    _loc1_.heartCollectedSFX.start();
  179.    Selection.setFocus(codeBox.inputTxt.text);
  180.    codeBox.onEnterFrame = function()
  181.    {
  182.       if(inkey(27))
  183.       {
  184.          codeBox._visible = false;
  185.          delete this.onEnterFrame;
  186.          _parent.selectSFX.start();
  187.       }
  188.       else if(inkey(13))
  189.       {
  190.          checkEnteredCode();
  191.          _parent.selectSFX.start();
  192.       }
  193.    };
  194.    codeBox.clseButton.onPress = function()
  195.    {
  196.       codeBox._visible = false;
  197.       _parent.selectSFX.start();
  198.       delete codeBox.onEnterFrame;
  199.    };
  200.    codeBox.unlockButton.onPress = checkEnteredCode;
  201. };
  202. helpButton.onPress = function()
  203. {
  204.    instructionsHolder.gotoAndStop(1);
  205.    instructionsHolder._visible = true;
  206.    _parent.heartCollectedSFX.start();
  207. };
  208. this.onEnterFrame = scanForSpace;
  209. stop();
  210.