home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / blackknight.swf / scripts / frame_33 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  38.9 KB  |  1,313 lines

  1. function EncrpytString(strVal)
  2. {
  3.    var _loc7_ = "aHfEjcDebChGiAfIjDbEjacD";
  4.    var _loc8_ = _loc7_.length;
  5.    var _loc11_ = "0";
  6.    var _loc3_ = "";
  7.    var _loc9_ = strVal.length;
  8.    var _loc1_ = 0;
  9.    _loc3_ = "";
  10.    var _loc4_ = undefined;
  11.    var _loc6_ = undefined;
  12.    var _loc2_ = undefined;
  13.    var _loc5_ = 0;
  14.    nCnt = 0;
  15.    while(nCnt < _loc9_)
  16.    {
  17.       _loc4_ = strVal.charCodeAt(nCnt);
  18.       if(_loc4_ >= 128)
  19.       {
  20.          _loc4_ = "X";
  21.       }
  22.       _loc6_ = _loc7_.charCodeAt(_loc1_);
  23.       _loc1_ += 1;
  24.       if(_loc1_ >= _loc8_)
  25.       {
  26.          _loc1_ = 0;
  27.       }
  28.       _loc2_ = _loc4_ % 16 + _loc6_;
  29.       _loc3_ += String.fromCharCode(_loc2_);
  30.       _loc5_ += _loc2_;
  31.       _loc6_ = _loc7_.charCodeAt(_loc1_);
  32.       _loc1_ += 1;
  33.       if(_loc1_ >= _loc8_)
  34.       {
  35.          _loc1_ = 0;
  36.       }
  37.       _loc2_ = Math.floor(_loc4_ / 16) + _loc6_;
  38.       _loc3_ += String.fromCharCode(_loc2_);
  39.       _loc5_ += _loc2_;
  40.       nCnt++;
  41.    }
  42.    _loc5_ %= 256;
  43.    _loc6_ = _loc7_.charCodeAt(_loc1_);
  44.    _loc1_ += 1;
  45.    if(_loc1_ >= _loc8_)
  46.    {
  47.       _loc1_ = 0;
  48.    }
  49.    _loc2_ = _loc5_ % 16 + _loc6_;
  50.    _loc3_ += String.fromCharCode(_loc2_);
  51.    _loc6_ = _loc7_.charCodeAt(_loc1_);
  52.    _loc1_ += 1;
  53.    if(_loc1_ >= _loc8_)
  54.    {
  55.       _loc1_ = 0;
  56.    }
  57.    _loc2_ = Math.floor(_loc5_ / 16) + _loc6_;
  58.    _loc3_ += String.fromCharCode(_loc2_);
  59.    return _loc3_;
  60. }
  61. function AppendUrlParam(strUrl, strParam)
  62. {
  63.    if(strUrl.indexOf("?") > 0)
  64.    {
  65.       return strUrl + "&" + strParam;
  66.    }
  67.    return strUrl + "?" + strParam;
  68. }
  69. function GetUrlParam(strUrl, strParam)
  70. {
  71.    var _loc4_ = strUrl.toLowerCase();
  72.    var _loc1_ = _loc4_.indexOf(strParam);
  73.    var _loc5_ = strParam.length;
  74.    if(_loc1_ > 0)
  75.    {
  76.       var _loc3_ = undefined;
  77.       var _loc2_ = _loc4_.indexOf("&",_loc1_ + _loc5_);
  78.       if(_loc2_ > 0)
  79.       {
  80.          _loc3_ = _loc2_ - _loc1_;
  81.       }
  82.       else
  83.       {
  84.          _loc3_ = strUrl.length - _loc1_;
  85.       }
  86.       return strUrl.substr(_loc1_ + _loc5_,_loc3_);
  87.    }
  88.    return "";
  89. }
  90. function GetBaseUrl(strUrl)
  91. {
  92.    var _loc1_ = strUrl.toLowerCase();
  93.    var _loc2_ = _loc1_.length;
  94.    var _loc3_ = _loc1_.indexOf("?",0);
  95.    if(_loc3_ > 0)
  96.    {
  97.       _loc2_ = _loc3_;
  98.    }
  99.    var _loc4_ = "download";
  100.    if(_loc1_.substr(0,4) == "http")
  101.    {
  102.       _loc4_ = strUrl.substr(7,_loc2_ - 7);
  103.    }
  104.    return _loc4_;
  105. }
  106. function formatTime(seconds)
  107. {
  108.    var _loc6_ = false;
  109.    if(seconds < 0)
  110.    {
  111.       _loc6_ = true;
  112.       seconds = Math.abs(seconds);
  113.    }
  114.    var _loc3_ = (seconds % 60).toString();
  115.    if(_loc3_.length == 1)
  116.    {
  117.       _loc3_ = "0" + _loc3_;
  118.    }
  119.    var _loc5_ = Math.floor(seconds / 3600).toString();
  120.    if(_loc5_ > 0)
  121.    {
  122.       var _loc1_ = (Math.floor(seconds / 60) % 60).toString();
  123.       if(_loc1_.length == 1)
  124.       {
  125.          _loc1_ = "0" + _loc1_;
  126.       }
  127.       var _loc4_ = _loc5_ + ":" + _loc1_ + ":" + _loc3_;
  128.    }
  129.    else
  130.    {
  131.       _loc1_ = Math.floor(seconds / 60).toString();
  132.       _loc4_ = _loc1_ + ":" + _loc3_;
  133.    }
  134.    if(_loc6_)
  135.    {
  136.       _loc4_ = "-" + _loc4_;
  137.    }
  138.    return _loc4_;
  139. }
  140. function setgamequality(q)
  141. {
  142.    _root.gamequality = q;
  143.    if(q == 1)
  144.    {
  145.       background.b1._visible = true;
  146.       background.b2._visible = true;
  147.       background.t1._visible = true;
  148.       background.t2._visible = true;
  149.       background.m1._visible = true;
  150.       background.m2._visible = true;
  151.    }
  152.    else if(q == 2)
  153.    {
  154.       background.b1._visible = false;
  155.       background.b2._visible = false;
  156.       background.t1._visible = true;
  157.       background.t2._visible = true;
  158.       background.m1._visible = true;
  159.       background.m2._visible = true;
  160.    }
  161.    else if(q == 3)
  162.    {
  163.       background.b1._visible = false;
  164.       background.b2._visible = false;
  165.       background.t1._visible = true;
  166.       background.t2._visible = true;
  167.       background.m1._visible = false;
  168.       background.m2._visible = false;
  169.    }
  170. }
  171. function resetSounds()
  172. {
  173.    chime1 = new Sound(sounds.chime);
  174.    chime1.attachSound("chime1");
  175.    chime1.setVolume(30 * sfxmute);
  176.    chime2 = new Sound(sounds.chime);
  177.    chime2.attachSound("chime2");
  178.    chime2.setVolume(30 * sfxmute);
  179.    coinexplode = new Sound(sounds.coinexplode);
  180.    coinexplode.attachSound("coinexplode");
  181.    coinexplode.setVolume(40 * sfxmute);
  182.    cashregister = new Sound(sounds.cashregister);
  183.    cashregister.attachSound("cashregister");
  184.    cashregister.setVolume(60 * sfxmute);
  185.    coinbounce1 = new Sound(sounds.coinbounce);
  186.    coinbounce1.attachSound("coinbounce1");
  187.    coinbounce1.setVolume(40 * sfxmute);
  188.    coinbounce2 = new Sound(sounds.coinbounce);
  189.    coinbounce2.attachSound("coinbounce2");
  190.    coinbounce2.setVolume(40 * sfxmute);
  191.    smash = new Sound(sounds.smashmc);
  192.    smash.attachSound("clocktick");
  193.    smash.setVolume(0 * sfxmute);
  194.    smallhit = new Sound(sounds.hitmc);
  195.    smallhit.attachSound("smallhitpiece");
  196.    smallhit.setVolume(30 * musicmute);
  197.    bighit = new Sound(sounds.hitmc);
  198.    bighit.attachSound("bighitpiece");
  199.    bighit.setVolume(30 * musicmute);
  200.    medhit = new Sound(sounds.hitmc);
  201.    medhit.attachSound("mediumhitpiece");
  202.    medhit.setVolume(30 * musicmute);
  203.    medbighit = new Sound(sounds.hitmc);
  204.    medbighit.attachSound("mediumbighitpiece");
  205.    medbighit.setVolume(30 * musicmute);
  206. }
  207. HiScoreSaveURL = "http://www.arcadetown.com/blackknight/hs.asp";
  208. HiScoreOpenURL = "http://www.arcadetown.com/blackknight/view_high_scores.asp";
  209. LinkDownload = "http://www.arcadetown.com/partner/download.asp?gameid=blackknight&aid=" + GetUrlParam(_url,"aid=") + "&refer=" + _root.GetBaseUrl(_url);
  210. LinkMoreGames = "http://www.arcadetown.com/index.asp?gameid=blackknight&aid=" + GetUrlParam(_url,"aid=") + "&refer=" + _root.GetBaseUrl(_url);
  211. LinkArcadetown = LinkMoreGames;
  212. sfxmute = 1;
  213. musicmute = 1;
  214. curweapon = 1;
  215. basespeed = 1.3;
  216. destp = 0;
  217. penalty = 0;
  218. char1.gotoAndStop(2);
  219. cansound = true;
  220. rootonMouseDown = function()
  221. {
  222.    if(penalty == 0 && !flying && piggy == 0)
  223.    {
  224.       char1.hitting = true;
  225.       didhit = false;
  226.       char1.gotoAndStop(10);
  227.       holding = true;
  228.       destp = 21;
  229.       combocount = 0;
  230.       cansound = true;
  231.       powerlevel = 0;
  232.    }
  233. };
  234. rootonMouseUp = function()
  235. {
  236.    if(holding)
  237.    {
  238.       secondhits = 0;
  239.       if(powerup > 12 && penalty == 0)
  240.       {
  241.          char1.hitting = true;
  242.          char1.gotoAndStop(9);
  243.          penalty = 0;
  244.          flying = true;
  245.          farleft = char1._x;
  246.          cansound = true;
  247.       }
  248.       powerlevel = powerup;
  249.       destp = 0;
  250.       holding = false;
  251.    }
  252. };
  253. powermult = new Array(0,0,2,5,10);
  254. hittermove = function()
  255. {
  256.    if(char1.hitting && _root.canhit)
  257.    {
  258.       if(this._x > 10 && this.invincible == 0 && this._visible && (this.hitTest(char1.anim.arm.club.hitregion) || flying && this._x < char1._x + 200 && this._x > farleft - 50))
  259.       {
  260.          didhit = true;
  261.          if(flying)
  262.          {
  263.             secondhits++;
  264.             this.hits = 0;
  265.          }
  266.          if(this.hits <= 0)
  267.          {
  268.             consecutive++;
  269.             combocount++;
  270.          }
  271.          extracoins = 0;
  272.          if(combocount > 1)
  273.          {
  274.             extracoins = combocount;
  275.             _root.levelshower.label.l_txt.text = "+" + extracoins * 10 + " Smash Bonus!";
  276.             _root.levelshower.gotoAndPlay(2);
  277.          }
  278.          this.hits -= curweapon / 2;
  279.          var _loc4_ = Math.floor(powerup / 3) + 1;
  280.          if(_loc4_ == 1 && cansound)
  281.          {
  282.             cansound = false;
  283.             _root.smallhit.start(0,0);
  284.          }
  285.          else if(_loc4_ == 2 && cansound)
  286.          {
  287.             cansound = false;
  288.             _root.medhit.start(0,0);
  289.          }
  290.          else if(_loc4_ == 3 && cansound)
  291.          {
  292.             cansound = false;
  293.             _root.medbighit.start(0,0);
  294.          }
  295.          else if(_loc4_ >= 4 && cansound)
  296.          {
  297.             cansound = false;
  298.             _root.bighit.start(0,0);
  299.          }
  300.          if(this.hits > 0)
  301.          {
  302.             this.dx = 30;
  303.             this.dy = -10;
  304.             this.invincible = 30;
  305.             this.hs.start(0,0);
  306.          }
  307.          else
  308.          {
  309.             var _loc6_ = Math.floor(powerlevel / 6) + 1;
  310.             extracoins += (curweapon - 1) * curweapon;
  311.             if(this.coins == -1)
  312.             {
  313.                makeCoins(this._x,this._y,random(7 + 15 * hasamulet) + powermult[_loc6_] + extracoins);
  314.             }
  315.             else
  316.             {
  317.                makeCoins(this._x,this._y,this.coins + powermult[_loc6_] + extracoins);
  318.             }
  319.             if(this.pcount > 0)
  320.             {
  321.                makeExplosion(this._x,this._y,this.particle,this.pcount,this.gravity);
  322.             }
  323.             else if(this.pcount <= 0)
  324.             {
  325.                if(this.drawlayer == 0)
  326.                {
  327.                   var _loc5_ = backexplosions;
  328.                }
  329.                else
  330.                {
  331.                   _loc5_ = explosions;
  332.                }
  333.                if(flying && this.bighit != "")
  334.                {
  335.                   var _loc3_ = _loc5_.attachMovie(this.bighit,"p" + curpart,curpart);
  336.                }
  337.                else
  338.                {
  339.                   _loc3_ = _loc5_.attachMovie(this.particle,"p" + curpart,curpart);
  340.                }
  341.                if(this.pcount == -1)
  342.                {
  343.                   _loc3_.gotoAndStop(_root.gamequality);
  344.                   explode(_loc3_);
  345.                }
  346.                _loc3_._x = this._x;
  347.                _loc3_._y = this._y;
  348.                _loc3_.dx = 5;
  349.                _loc3_.onEnterFrame = function()
  350.                {
  351.                   this._x -= this.dx * _root.smult;
  352.                   if(this._x < - this._width)
  353.                   {
  354.                      this.removeMovieClip();
  355.                   }
  356.                };
  357.                curpart++;
  358.             }
  359.             if(this.particle == "barrelpiece" && random(5) == 2)
  360.             {
  361.                bonus._x = this._x;
  362.                bonus._y = this._y;
  363.                bonus.dx = 25;
  364.                bonus.dy = -14;
  365.                bonus.gotoAndStop(random(3) + 1);
  366.                bonus.onEnterFrame = function()
  367.                {
  368.                   this._x += this.dx * _root.smult;
  369.                   this._y += this.dy;
  370.                   this.dy += 1;
  371.                   this.dx = this.dx - 1;
  372.                   if(this._y > 337)
  373.                   {
  374.                      this._y = 337;
  375.                      this.dy = 0;
  376.                   }
  377.                   if(this.dx < -5)
  378.                   {
  379.                      this.dx = -5;
  380.                   }
  381.                   if(this.hitTest(char1) && this.dx == -5)
  382.                   {
  383.                      if(this._currentframe == 1)
  384.                      {
  385.                         amuleticon._visible = true;
  386.                         hasamulet = true;
  387.                      }
  388.                      else if(this._currentframe == 2)
  389.                      {
  390.                         oilicon._visible = true;
  391.                         hasoil = true;
  392.                      }
  393.                      else if(this._currentframe == 3)
  394.                      {
  395.                         tonicicon._visible = true;
  396.                         hastonic = true;
  397.                      }
  398.                      this._x = -100;
  399.                      delete this.onEnterFrame;
  400.                   }
  401.                };
  402.             }
  403.             this.s.start(0,0);
  404.             this.init();
  405.             this._visible = false;
  406.             numhit++;
  407.             score += this.points * 10 * combocount;
  408.             updateText();
  409.          }
  410.       }
  411.    }
  412.    if(this.invincible > 0)
  413.    {
  414.       this.invincible = this.invincible - 1;
  415.    }
  416.    if(this.dx > 0)
  417.    {
  418.       this._x += this.dx;
  419.       this.dx = this.dx - 1;
  420.       this.who._rotation += 12;
  421.    }
  422.    this._y += this.dy;
  423.    this.dy = this.dy + 1;
  424.    if(this._y > 317)
  425.    {
  426.       this._y = 317;
  427.       this.dy = 0;
  428.    }
  429.    if(this._x < - this._width)
  430.    {
  431.       this.removeMovieClip();
  432.    }
  433.    this._x -= this.spd * _root.smult;
  434. };
  435. numparts = 10;
  436. curpart = 0;
  437. maxparts = 150;
  438. makeExplosion = function(x, y, piece, pcnt, grav)
  439. {
  440.    var _loc3_ = 0;
  441.    while(_loc3_ < pcnt)
  442.    {
  443.       var _loc2_ = explosions.attachMovie(piece,"p" + curpart,curpart);
  444.       _loc2_._x = x;
  445.       _loc2_._y = y;
  446.       _loc2_.dx = -3 + _loc3_ * 1.5;
  447.       _loc2_.dy = - Math.random() * 20 - 10;
  448.       _loc2_.dr = - random(20) - 20;
  449.       _loc2_._rotation = random(180);
  450.       if(grav == 1)
  451.       {
  452.          _loc2_.dx = -1 + _loc3_ * 0.5;
  453.          _loc2_.dy = - Math.random() * 10 - 8;
  454.          _loc2_.dr = -10;
  455.       }
  456.       else if(grav == 0)
  457.       {
  458.          var _loc4_ = Math.random() * 5 + 2;
  459.          var _loc5_ = Math.random() * 6.28;
  460.          _loc2_.dx = Math.cos(_loc5_) * _loc4_;
  461.          _loc2_.dy = Math.sin(_loc5_) * _loc4_;
  462.          _loc2_.dr = 0;
  463.       }
  464.       _loc2_.gr = grav;
  465.       _loc2_.onEnterFrame = function()
  466.       {
  467.          this._x += this.dx * basespeed;
  468.          this._y += this.dy * basespeed;
  469.          this.dy += this.gr * basespeed;
  470.          if(this.gr == 1 && this.dy > 4)
  471.          {
  472.             this.dy = 4;
  473.          }
  474.          this._rotation += this.dr;
  475.          if(this._y > 400)
  476.          {
  477.             this.removeMovieClip();
  478.          }
  479.          if(this.gr == 0)
  480.          {
  481.             this._alpha -= 3;
  482.             if(this._alpha <= 0)
  483.             {
  484.                this.removeMovieClip();
  485.             }
  486.          }
  487.       };
  488.       curpart++;
  489.       curpart %= maxparts;
  490.       _loc3_ = _loc3_ + 1;
  491.    }
  492. };
  493. explode = function(mc)
  494. {
  495.    for(var _loc3_ in mc)
  496.    {
  497.       if(typeof mc[_loc3_] == "movieclip")
  498.       {
  499.          mc[_loc3_].dx = Math.random() * 10 - 3;
  500.          mc[_loc3_].dy = Math.random() * 20 - 20;
  501.          mc[_loc3_].dr = Math.random() * 20 - 10;
  502.          mc[_loc3_].onEnterFrame = function()
  503.          {
  504.             this._x += this.dx * basespeed;
  505.             this._y += this.dy * basespeed;
  506.             this.dy += 1 * basespeed;
  507.             this._rotation += this.dr;
  508.             if(this._y > 200)
  509.             {
  510.                delete this.onEnterFrame;
  511.                this.removeMovieClip();
  512.             }
  513.          };
  514.       }
  515.    }
  516. };
  517. moneyValues = new Array(1,5,10);
  518. makeCoins = function(x, y, inpcnt)
  519. {
  520.    var _loc10_ = Math.ceil(inpcnt / 2);
  521.    var _loc6_ = new Array();
  522.    var _loc9_ = _loc10_;
  523.    _loc6_[2] = Math.floor(_loc9_ / 10);
  524.    _loc9_ -= _loc6_[2] * 10;
  525.    _loc6_[1] = Math.floor(_loc9_ / 5);
  526.    _loc9_ -= _loc6_[1] * 5;
  527.    _loc6_[0] = _loc9_;
  528.    if(_loc6_[0] > 2)
  529.    {
  530.       _loc6_[0] = 0;
  531.       _loc6_[1] = _loc6_[1] + 1;
  532.    }
  533.    if(random(3) == 1)
  534.    {
  535.       coinexplode.start(0,0);
  536.    }
  537.    var _loc4_ = 0;
  538.    while(_loc4_ < _loc6_.length)
  539.    {
  540.       var _loc5_ = 0;
  541.       while(_loc5_ < _loc6_[_loc4_])
  542.       {
  543.          var _loc3_ = explosions.attachMovie("coin" + _loc4_,"p" + curpart,curpart);
  544.          _loc3_.gotoAndPlay(random(5) + 1);
  545.          _loc3_._x = x;
  546.          _loc3_._y = y;
  547.          _loc3_._xscale = _loc3_._yscale = 125;
  548.          _loc3_.dx = Math.random() * 10 + 14;
  549.          _loc3_.dy = - Math.random() * 10 - 3;
  550.          _loc3_.dr = - random(20) - 20;
  551.          _loc3_.val = moneyValues[_loc4_];
  552.          _loc3_.onEnterFrame = function()
  553.          {
  554.             this._x += this.dx * basespeed;
  555.             this._y += this.dy * basespeed;
  556.             this.dy += 0.5 * basespeed;
  557.             this.dx *= 0.96;
  558.             this._x -= 5 * _root.smult;
  559.             if(this._y > 365)
  560.             {
  561.                this.dy *= -0.5;
  562.                this._y = 365;
  563.                if(this.dy < -2 && random(9) == 1)
  564.                {
  565.                   if(random(2) == 0)
  566.                   {
  567.                      coinbounce1.start(0,0);
  568.                   }
  569.                   else
  570.                   {
  571.                      coinbounce2.start(0,0);
  572.                   }
  573.                }
  574.             }
  575.             if(this._x < char1._x + 70 && this.dx < 5)
  576.             {
  577.                this.dx = (bag._x + bag._width / 2 - this._x) / 25;
  578.                this.dy = (bag._y + bag._height / 2 - this._y) / 25;
  579.                this.cnt = 25;
  580.                if(random(2) == 1)
  581.                {
  582.                   cashregister.start(0,0);
  583.                }
  584.                this.onEnterFrame = function()
  585.                {
  586.                   this._x += this.dx;
  587.                   this._y += this.dy;
  588.                   this.cnt = this.cnt - 1;
  589.                   if(this.cnt == 0)
  590.                   {
  591.                      money += this.val;
  592.                      updateText();
  593.                      this.removeMovieClip();
  594.                   }
  595.                };
  596.             }
  597.          };
  598.          curpart++;
  599.          curpart %= maxparts;
  600.          _loc5_ = _loc5_ + 1;
  601.       }
  602.       _loc4_ = _loc4_ + 1;
  603.    }
  604. };
  605. initMe = function(which)
  606. {
  607.    this.gotoAndStop(which);
  608.    this.spd = speeds[this._currentframe];
  609.    this.particle = particles[this._currentframe];
  610.    this.bighit = bighits[this._currentframe];
  611.    this.pcount = partcount[this._currentframe];
  612.    this.hits = requiredhits[this._currentframe];
  613.    this.points = pointvalue[this._currentframe];
  614.    this.breaksound = breaksounds[this._currentframe];
  615.    this.hitsound = hitsounds[this._currentframe];
  616.    this.coins = coinvalue[this._currentframe];
  617.    this.gravity = gravities[this._currentframe];
  618.    this.drawlayer = drawlayers[this._currentframe];
  619.    if(this.pcount == -1)
  620.    {
  621.       this.whox.gotoAndStop(3);
  622.    }
  623.    if(sfxmute)
  624.    {
  625.       this.s = new Sound(this);
  626.       this.s.setVolume(80 * sfxmute);
  627.       this.hs = new Sound(this);
  628.       this.hs.setVolume(80 * sfxmute);
  629.    }
  630.    if(this.hitsound == "barrelbreak")
  631.    {
  632.       this.hs.setVolume(40 * sfxmute);
  633.    }
  634.    if(this.breaksound == "barrelbreak")
  635.    {
  636.       this.s.setVolume(40 * sfxmute);
  637.    }
  638.    if(this.hitsound == "manhit" || this.hitsound == "womanhit" || this.hitsound == "oldmanhit" || this.hitsound == "oldwomanhit")
  639.    {
  640.       var _loc2_ = random(4);
  641.       if(_loc2_ < 2)
  642.       {
  643.          this.hitsound += _loc2_;
  644.          this.breaksound += _loc2_;
  645.       }
  646.       else
  647.       {
  648.          this.hitsound = "manhit";
  649.          this.hitsound = "manhit";
  650.       }
  651.       this.s.setVolume(110 * sfxmute);
  652.       this.hs.setVolume(110 * sfxmute);
  653.    }
  654.    this.s.attachSound(this.breaksound);
  655.    this.hs.attachSound(this.hitsound);
  656.    this.invincible = 0;
  657. };
  658. speeds = new Array();
  659. particles = new Array();
  660. bighits = new Array();
  661. gravities = new Array();
  662. hitsounds = new Array();
  663. breaksounds = new Array();
  664. partcount = new Array();
  665. requiredhits = new Array();
  666. pointvalue = new Array();
  667. coinvalue = new Array();
  668. drawlayers = new Array();
  669. var icnt = 0;
  670. newItemType = function(mspeeds, mparticles, mbighits, mgravities, mhitsounds, mbreaksounds, mpartcount, mrequiredhits, mpointvalue, mcoinvalue, mlayer)
  671. {
  672.    speeds[icnt] = mspeeds;
  673.    particles[icnt] = mparticles;
  674.    bighits[icnt] = mbighits;
  675.    gravities[icnt] = mgravities;
  676.    hitsounds[icnt] = mhitsounds;
  677.    breaksounds[icnt] = mbreaksounds;
  678.    partcount[icnt] = mpartcount;
  679.    requiredhits[icnt] = mrequiredhits;
  680.    pointvalue[icnt] = mpointvalue;
  681.    coinvalue[icnt] = mcoinvalue;
  682.    drawlayers[icnt] = mlayer;
  683.    icnt++;
  684. };
  685. newItemType(0,"","",0,"","",0,0,0,0,1);
  686. newItemType(6,"redbird","",1,"bird2","bird2",6,1,10,2,1);
  687. newItemType(5,"bluebird","",1,"bird2","bird2",6,0,5,1,1);
  688. newItemType(7,"oldmanhit","oldmanhitbig",2,"oldmanhit","oldmanhit",0,0,5,1,1);
  689. newItemType(5,"barrelpiece","",2,"thud","barrelbreak",6,1.5,5,-1,1);
  690. newItemType(5,"treefall","treefallbig",2,"thud","thud",0,0,5,1,1);
  691. newItemType(7,"doghit","",2,"dogyelp","dogyelp",0,0,5,1,1);
  692. newItemType(7,"pighit","",2,"pigsqueal","pigsqueal",0,1,10,1,1);
  693. newItemType(5,"hayparticle","",1,"thud","thud",9,0,5,2,0);
  694. newItemType(8,"blackbird","",1,"crow","crow",6,1.5,10,3,1);
  695. newItemType(7,"oldmanworld2hit","oldmanworld2hitbig",2,"oldmanhit","oldmanhit",0,0,5,1,1);
  696. newItemType(7,"youngwomanhit","youngwomanhitbig",2,"womanhit","womanhit",0,0,5,2,1);
  697. newItemType(7,"youngwomanworld2hit","youngwomanworld2hitbig",2,"womanhit","womanhit",0,0,5,2,1);
  698. newItemType(6,"oldwomanhit","oldwomanhitbig",2,"oldwomanhit","oldwomanhit",0,0,5,1,1);
  699. newItemType(6,"oldwomanworld2hit","oldwomanworld2hitbig",2,"oldwomanhit","oldwomanhit",0,0,5,1,1);
  700. newItemType(7,"youngmanhit","youngmanhitbig",2,"manhit","manhit",0,0,10,2,1);
  701. newItemType(7,"youngmanworld2hit","youngmanworld2hitbig",2,"manhit","manhit",0,0,10,2,1);
  702. newItemType(5,"bucketparticle","",2,"thud","barrelbreak",6,0,5,2,1);
  703. newItemType(5,"world1smallpotpiece","",2,"barrelbreak","barrelbreak",6,0,5,5,1);
  704. newItemType(5,"world1bigpotpiece","",2,"barrelbreak","barrelbreak",6,1,10,7,1);
  705. newItemType(5,"rockparticle","",2,"thud","thud",5,0,5,2,0);
  706. newItemType(5,"scarecrow","",2,"thud","thud",-1,0,5,3,1);
  707. newItemType(5,"suitofarmor","",2,"armor","armor",-1,0,5,4,0);
  708. newItemType(5,"chair","",2,"barrelbreak","barrelbreak",-1,0,5,2,0);
  709. newItemType(5,"bigcandle","",2,"barrelbreak","barrelbreak",-1,0,5,3,0);
  710. newItemType(7,"oldmanworld3hit","oldmanworld3hitbig",2,"oldmanhit","oldmanhit",0,0,5,2,1);
  711. newItemType(6,"oldwomanworld3hit","oldwomanworld3hitbig",2,"oldwomanhit","oldwomanhit",0,0,5,5,1);
  712. newItemType(7,"youngmanworld3hit","youngmanworld3hitbig",2,"manhit","manhit",0,0,5,4,1);
  713. newItemType(7,"youngwomanworld3hit","youngwomanworld3hitbig",2,"womanhit","womanhit",0,0,5,3,1);
  714. newItemType(5,"world3bluevasepiece","",2,"barrelbreak","barrelbreak",5,0,5,4,1);
  715. newItemType(5,"world3redvasepiece","",2,"barrelbreak","barrelbreak",5,1,10,7,1);
  716. newItemType(5,"boxshoppe","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  717. newItemType(7,"witchmad","witchmad",2,"witchhit","witchhit",0,0,0,0,1);
  718. newItemType(5,"watermelonstand","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  719. newItemType(5,"fragileshop","",2,"glassbreak","glassbreak",-1,0,10,10,0);
  720. newItemType(5,"cutefurrystand","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  721. newItemType(5,"dungeonshop","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  722. newItemType(5,"crateshop","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  723. newItemType(5,"farmersmarket","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  724. newItemType(5,"blacksmith","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  725. newItemType(5,"cartwheels","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  726. newItemType(5,"souvenirshop","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  727. newItemType(5,"mapstours","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  728. newItemType(5,"banquetsmash","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  729. newItemType(5,"bookshelfsmash","",2,"barrelbreak","barrelbreak",-1,0,10,10,0);
  730. world = 1;
  731. worldCreatures = new Array();
  732. worldCreatures[1] = new Array([1],[2],[3],[4],[36,35],[5],[11],[13],[15],[18],[19],[1],[2],[3],[4],[5],[33,34],[11],[13],[15],[18],[19],[1],[2],[3],[4],[5],[11],[13],[15],[18],[19],[32]);
  733. worldCreatures[2] = new Array([4],[8],[9],[10],[37,38],[12],[14],[16],[17],[20],[21],[4],[8],[9],[10],[40,39],[12],[14],[16],[17],[20],[21],[4],[8],[9],[10],[12],[14],[16],[17],[20],[21],[32]);
  734. worldCreatures[3] = new Array([4],[22],[23],[41,42],[24],[25],[26],[27],[28],[29],[30],[4],[22],[23],[43,44],[24],[25],[26],[27],[28],[29],[30],[4],[22],[23],[24],[25],[26],[27],[28],[29],[30],[32]);
  735. consecutives = new Array("Combo!","Double Combo!","Triple Combo!","Smash Combo!","Super Smash Combo!","Medieval Combo!","Regal Combo!","Royal Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!","Ultra Combo!");
  736. tipMessages = new Array("Try not to swing and miss, always aim for a target!","Click and hold down mouse button to power up and Get Medieval!","Smash all the items in a shop for extra gold!","Watch out for Matilda the witch, sheΓÇÖll zap you if you hit her!","Buy bigger weapons in Ye Olde Weapon Shoppe to do more damage!","Armor Oil helps you recover faster from a missed swing!","The Lucky Medallion will get you more gold with each swing!","The Strength Potion helps you Get Medieval faster!","Who said taxes aren\'t fun?","Order \'Heroing for Dummies\' Now!!!","Two things in life are certain, taxes and more taxes.","Two more things in life are certain, taxes and axes.","Open helmet before kissing maidens.","Do not kiss the frog.","Always put on gloves with the spikes pointing out.","Always wash your chain mail in cold water to avoid shrinkage.","The last knight to the round table clears it off after the feast.","A tax refund? Off with your head!","Laugh *with* the Jester, not at him, he is a tortured soul.","Ignore the funny man behind the curtain.","Warning: Objects in mirror may appear smashed.","1) Take single bite of pork leg.  2) Toss it over your shoulder.");
  737. lastone = 0;
  738. generateHitter = function()
  739. {
  740.    myInterval(0,-100);
  741.    lastone += random(2) + 1;
  742.    lastone %= worldCreatures[world].length;
  743.    var _loc4_ = lastone;
  744.    var _loc5_ = 800 + random(300);
  745.    timeadd = -1500;
  746.    var _loc3_ = 0;
  747.    while(_loc3_ < worldCreatures[world][_loc4_].length)
  748.    {
  749.       var _loc2_ = worldCreatures[world][_loc4_][_loc3_];
  750.       if(drawlayers[_loc2_] == 0)
  751.       {
  752.          var _loc1_ = backhitters.attachMovie("hitter_mc","hit" + hitternum,hitternum);
  753.       }
  754.       else
  755.       {
  756.          _loc1_ = hitters.attachMovie("hitter_mc","hit" + hitternum,hitternum);
  757.       }
  758.       _loc1_._y = 318;
  759.       _loc1_._x = _loc5_;
  760.       _loc1_.onEnterFrame = hittermove;
  761.       _loc1_.init = initMe;
  762.       if(_loc2_ != 32 || _loc2_ == 32 && level > 3)
  763.       {
  764.          _loc1_.init(_loc2_);
  765.       }
  766.       _loc5_ += _loc1_._width + 20;
  767.       _loc1_.mynum = hitternum;
  768.       hitternum++;
  769.       lastGenerated = _loc1_;
  770.       timeadd += 1500;
  771.       _loc3_ = _loc3_ + 1;
  772.    }
  773.    hitgen = myInterval(generateHitter,1000 + timeadd);
  774. };
  775. _root.createEmptyMovieClip("myintervalmc",2345);
  776. myInterval = function(func, delay)
  777. {
  778.    myintervalmc.func = func;
  779.    myintervalmc.delay = Math.floor(delay / 20);
  780. };
  781. myintervalmc.onEnterFrame = function()
  782. {
  783.    if(this.delay == 0)
  784.    {
  785.       this.func();
  786.       this.delay = this.delay - 1;
  787.    }
  788.    else if(this.delay > 0)
  789.    {
  790.       this.delay = this.delay - 1;
  791.    }
  792. };
  793. updateText = function()
  794. {
  795.    status_txt.text = money * 10 + " of " + hittarget * 10;
  796.    lev_txt.text = "Level " + level;
  797.    score_txt.text = score + " pts";
  798. };
  799. _root.smult = basespeed;
  800. _root.setMask("mainmask");
  801. _root.createEmptyMovieClip("sounds",399);
  802. sounds.createEmptyMovieClip("smashmc",0);
  803. sounds.createEmptyMovieClip("songmc",1);
  804. sounds.createEmptyMovieClip("hitmc",2);
  805. sounds.createEmptyMovieClip("chime",3);
  806. sounds.createEmptyMovieClip("coinexplode",4);
  807. sounds.createEmptyMovieClip("cashregister",5);
  808. sounds.createEmptyMovieClip("coinbounce",6);
  809. sounds.createEmptyMovieClip("objsounds",7);
  810. sounds.createEmptyMovieClip("talkmc",8);
  811. resetSounds();
  812. titlescreen.swapDepths(101);
  813. goalscreen.swapDepths(99);
  814. weaponshop.swapDepths(98);
  815. story.swapDepths(97);
  816. instructions.swapDepths(96);
  817. nextlevel = function()
  818. {
  819.    world++;
  820.    if(world > 3)
  821.    {
  822.       world = 1;
  823.    }
  824.    var _loc2_ = 0.5 + percplus / 7;
  825.    if(_loc2_ > 1.1 && curweapon < 6)
  826.    {
  827.       _loc2_ = 1.1;
  828.    }
  829.    if(_loc2_ > 1 && curweapon == 6)
  830.    {
  831.       _loc2_ = 1;
  832.    }
  833.    percplus++;
  834.    var _loc3_ = Math.floor(mostgot * _loc2_);
  835.    var _loc4_ = level * 20 + 35 + (curweapon - 1) * _loc2_ * 60;
  836.    if(_loc3_ < _loc4_)
  837.    {
  838.       _loc3_ = _loc4_;
  839.    }
  840.    hittarget += _loc3_;
  841.    if(hittarget < money + level * 50)
  842.    {
  843.       hittarget = money + level * 50;
  844.    }
  845.    hittarget = Math.floor(hittarget / 5) * 5;
  846.    startamount = money;
  847.    numhit = 0;
  848.    level++;
  849.    updateText();
  850.    _root.smult = 0;
  851.    distwalked = 0;
  852.    maxtime = 60;
  853.    piggy = 0;
  854.    song.stop();
  855.    song = new Sound(sounds.songmc);
  856.    song.attachSound("transitionsong");
  857.    song.setVolume(50 * musicmute);
  858.    song.start(0,9999);
  859.    _root.createEmptyMovieClip("backexplosions",5);
  860.    _root.createEmptyMovieClip("explosions",7);
  861.    background.farback.gotoAndStop(world);
  862.    background.m1.gotoAndStop(world);
  863.    background.m2.gotoAndStop(world);
  864.    background.m1.x = 0;
  865.    background.m2.x = background.m1._width - 4;
  866.    background.t1.gotoAndStop(world);
  867.    background.t2.gotoAndStop(world);
  868.    background.g1.gotoAndStop(world);
  869.    background.g2.gotoAndStop(world);
  870.    background.b1.gotoAndStop(7 * (world - 1) + 1);
  871.    background.b2.gotoAndStop(7 * (world - 1) + 1);
  872.    delete _root.onMouseUp;
  873.    delete _root.onMouseDown;
  874.    delete char1.onEnterFrame;
  875.    amuleticon._visible = hasamulet;
  876.    oilicon._visible = hasoil;
  877.    tonicicon._visible = hastonic;
  878.    _quality = "HIGH";
  879.    goalscreen.parchment.gotoAndPlay(1);
  880.    goalscreen.hiscorebox._visible = false;
  881.    goalscreen.parchment.page.title_txt.text = "Thy Goal";
  882.    goalscreen.parchment.page.missiontext.text = "Thou Must Collect " + hittarget * 10 + " Gold Pieces in Tax for thy King.";
  883.    if(level < tipMessages.length)
  884.    {
  885.       goalscreen.parchment.page.tip_txt.text = "Tip: " + tipMessages[level - 1];
  886.    }
  887.    else
  888.    {
  889.       goalscreen.parchment.page.tip_txt.text = "";
  890.    }
  891.    goalscreen.onRelease = function()
  892.    {
  893.       song.stop();
  894.       song2 = new Sound(sounds.songmc);
  895.       song2.attachSound("song" + world);
  896.       song2.setVolume(50 * musicmute);
  897.       song2.start(0,9999);
  898.       _root.smult = basespeed;
  899.       stime = getTimer();
  900.       levelshower.label.l_txt.text = "Round " + level;
  901.       levelshower.gotoAndPlay(2);
  902.       destp = 0;
  903.       penalty = 0;
  904.       char1.gotoAndStop(2);
  905.       cansound = true;
  906.       consecutive = 0;
  907.       holding = false;
  908.       spacebar = false;
  909.       powerup = 0;
  910.       numhit = 0;
  911.       char1._x = char1.sx;
  912.       _root.onMouseUp = rootonMouseUp;
  913.       _root.onMouseDown = rootonMouseDown;
  914.       char1.onEnterFrame = char1onEnterFrame;
  915.       _root.createEmptyMovieClip("backhitters",4);
  916.       _root.createEmptyMovieClip("hitters",6);
  917.       hitternum = 0;
  918.       hitgen = myInterval(generateHitter,1000);
  919.       generateHitter();
  920.       circlewipe(goalscreen);
  921.       delete goalScreen.onRelease;
  922.    };
  923. };
  924. doGoalMet = function()
  925. {
  926.    _quality = "HIGH";
  927.    _root.smult = 0;
  928.    goalscreen.parchment.gotoAndPlay(1);
  929.    goalscreen.hiscorebox._visible = false;
  930.    goalscreen.parchment.page.title_txt.text = "Thy Results";
  931.    goalscreen.parchment.page.missiontext.text = "Thou hast collected " + money * 10 + " Gold Pieces. Thy King is pleased.";
  932.    goalscreen.parchment.page.tip_txt.text = "";
  933.    lastroundgot = money - startamount;
  934.    if(lastroundgot > mostgot)
  935.    {
  936.       mostgot = lastroundgot;
  937.    }
  938.    goalscreen.onRelease = function()
  939.    {
  940.       doWeaponShop();
  941.       delete goalScreen.onRelease;
  942.    };
  943.    circlewipe(undefined,goalscreen);
  944. };
  945. doGoalFail = function()
  946. {
  947.    _root.smult = 0;
  948.    song.stop();
  949.    song2 = new Sound(sounds.songmc);
  950.    song2.attachSound("firedmusic");
  951.    song2.setVolume(50 * musicmute);
  952.    song2.start(0,9999);
  953.    smash.setVolume(0);
  954.    _quality = "HIGH";
  955.    goalscreen.parchment.gotoAndPlay(1);
  956.    goalscreen.parchment.page.title_txt.text = "Thy Pink Slip";
  957.    goalscreen.parchment.page.missiontext.text = "Thou did not collect enough tribute! Thou art Fired!";
  958.    goalscreen.parchment.page.tip_txt.text = "";
  959.    delete goalscreen.onRelease;
  960.    goalscreen.onRelease = function()
  961.    {
  962.       goalscreen.hiscorebox._visible = true;
  963.       goalscreen.hiscorebox.score_txt.text = money * 10;
  964.       delete goalscreen.onRelease;
  965.    };
  966.    circlewipe(undefined,goalscreen);
  967. };
  968. doWeaponShop = function()
  969. {
  970.    song.stop();
  971.    song2 = new Sound(sounds.songmc);
  972.    song2.attachSound("shopmusic");
  973.    song2.setVolume(50 * musicmute);
  974.    song2.start(0,9999);
  975.    weaponshop.weapon7._visible = true;
  976.    weaponshop.weapon8._visible = true;
  977.    weaponshop.weapon9._visible = true;
  978.    hasamulet = false;
  979.    hasoil = false;
  980.    hastonic = false;
  981.    circlewipe(goalscreen,weaponshop);
  982.    weaponshop.init();
  983.    weaponshop.doneButton.onRelease = function()
  984.    {
  985.       nextlevel();
  986.       circlewipe(weaponshop,goalscreen);
  987.       delete this.onRelease;
  988.    };
  989. };
  990. _quality = "HIGH";
  991. levelshower.stop();
  992. consecshower.stop();
  993. char1.sx = char1._x;
  994. char1.sy = char1._y;
  995. char1.swapDepths(10);
  996. char1.yoff = 0;
  997. char1.dy = 0;
  998. makePiggy = function()
  999. {
  1000.    piggy = 120;
  1001.    flying = false;
  1002.    powerup = 0;
  1003.    destp = 0;
  1004.    holding = false;
  1005.    char1.hitting = false;
  1006.    char1.gotoAndStop(11);
  1007.    makeExplosion(char1._x + 75,char1._y + 100,"sparkle",10,0);
  1008. };
  1009. char1onEnterFrame = function()
  1010. {
  1011.    var _loc3_ = Key.isDown(32);
  1012.    if(!spacebar && _loc3_)
  1013.    {
  1014.       spacebar = true;
  1015.       _root.onMouseDown();
  1016.    }
  1017.    if(spacebar && !_loc3_)
  1018.    {
  1019.       spacebar = false;
  1020.       _root.onMouseUp();
  1021.    }
  1022.    sec = maxtime - Math.floor((getTimer() - stime) / 1000);
  1023.    timedisp_txt.text = formatTime(sec);
  1024.    if(piggy > 0)
  1025.    {
  1026.       piggy--;
  1027.       if(piggy == 1)
  1028.       {
  1029.          makeExplosion(char1._x + 75,char1._y + 100,"sparkle",10,0);
  1030.          this.gotoAndStop(1);
  1031.       }
  1032.    }
  1033.    if(sec < 8)
  1034.    {
  1035.       smash.setVolume((8 - sec) * 20);
  1036.    }
  1037.    else
  1038.    {
  1039.       smash.setVolume(0);
  1040.    }
  1041.    if(sec < 0)
  1042.    {
  1043.       myInterval(0,-100);
  1044.       levelshower.label.l_txt.text = "Time Up";
  1045.       timedisp_txt.text = "0:00";
  1046.       levelshower.gotoAndPlay(2);
  1047.       smash.setVolume(0);
  1048.       this.onEnterFrame = function()
  1049.       {
  1050.          var _loc3_ = Key.isDown(32);
  1051.          if(!spacebar && _loc3_)
  1052.          {
  1053.             spacebar = true;
  1054.             _root.onMouseDown();
  1055.          }
  1056.          if(spacebar && !_loc3_)
  1057.          {
  1058.             spacebar = false;
  1059.             _root.onMouseUp();
  1060.          }
  1061.          if(piggy > 0)
  1062.          {
  1063.             piggy--;
  1064.             if(piggy == 1)
  1065.             {
  1066.                makeExplosion(char1._x + 75,char1._y + 100,"sparkle",10,0);
  1067.                this.gotoAndStop(1);
  1068.             }
  1069.          }
  1070.          if(destp > powerup)
  1071.          {
  1072.             powerup += (destp - powerup) * (0.06 + hastonic * 0.07);
  1073.          }
  1074.          else
  1075.          {
  1076.             powerup -= 1;
  1077.          }
  1078.          this.yoff += this.dy;
  1079.          this.dy += 2;
  1080.          if(this.yoff > 0)
  1081.          {
  1082.             this.yoff = 0;
  1083.             this.dy = 0;
  1084.          }
  1085.          if(powerup > 20)
  1086.          {
  1087.             powerup = 20;
  1088.          }
  1089.          if(powerup < 0)
  1090.          {
  1091.             powerup = 0;
  1092.          }
  1093.          pwrchar1.powerbar._xscale = powerup * 5;
  1094.          if(powerup == 20)
  1095.          {
  1096.             if(penalty > 1)
  1097.             {
  1098.                penalty = 1;
  1099.             }
  1100.             pwrchar1.gethim._visible = true;
  1101.          }
  1102.          else
  1103.          {
  1104.             pwrchar1.gethim._visible = false;
  1105.          }
  1106.          this.glow._alpha = powerup * powerup / 4;
  1107.          if(penalty > 1)
  1108.          {
  1109.             char1.gotoAndStop(4);
  1110.             penalty--;
  1111.          }
  1112.          else if(penalty == 1)
  1113.          {
  1114.             char1.gotoAndStop(10);
  1115.             char1.anim.gotoAndPlay(13);
  1116.             penalty = 0;
  1117.          }
  1118.          this._x += 5;
  1119.          if(this._x > 800)
  1120.          {
  1121.             delete _root.onMouseDown;
  1122.             delete _root.onMouseUp;
  1123.             if(money >= hittarget)
  1124.             {
  1125.                doGoalMet();
  1126.             }
  1127.             else
  1128.             {
  1129.                doGoalFail();
  1130.             }
  1131.             delete this.onEnterFrame;
  1132.          }
  1133.       };
  1134.    }
  1135.    if(destp > powerup)
  1136.    {
  1137.       powerup += (destp - powerup) * (0.06 + hastonic * 0.07);
  1138.    }
  1139.    else
  1140.    {
  1141.       if(powerup > 10)
  1142.       {
  1143.          this._x = this.sx - (powerup - 10) * 9;
  1144.       }
  1145.       powerup -= 1;
  1146.    }
  1147.    this.yoff += this.dy;
  1148.    this.dy += 2;
  1149.    if(this.yoff > 0)
  1150.    {
  1151.       this.yoff = 0;
  1152.       this.dy = 0;
  1153.    }
  1154.    if(powerup > 20)
  1155.    {
  1156.       powerup = 20;
  1157.    }
  1158.    if(powerup < 0)
  1159.    {
  1160.       powerup = 0;
  1161.    }
  1162.    pwrchar1.powerbar._xscale = powerup * 5;
  1163.    if(powerup == 20)
  1164.    {
  1165.       if(penalty > 1)
  1166.       {
  1167.          penalty = 1;
  1168.       }
  1169.       pwrchar1.gethim._visible = true;
  1170.    }
  1171.    else
  1172.    {
  1173.       pwrchar1.gethim._visible = false;
  1174.    }
  1175.    if(powerup > 10)
  1176.    {
  1177.       this._x = this.sx - (powerup - 10) * 9;
  1178.    }
  1179.    this.glow._alpha = powerup * powerup / 4;
  1180.    if(penalty > 1)
  1181.    {
  1182.       char1.gotoAndStop(4);
  1183.       penalty--;
  1184.    }
  1185.    else if(penalty == 1)
  1186.    {
  1187.       char1.gotoAndStop(10);
  1188.       char1.anim.gotoAndPlay(13);
  1189.       penalty = 0;
  1190.    }
  1191. };
  1192. beginGame = function()
  1193. {
  1194.    stopAllSounds();
  1195.    song = new Sound(sounds.songmc);
  1196.    song.attachSound("transitionsong");
  1197.    song.setVolume(50 * musicmute);
  1198.    song.start(0,9999);
  1199.    story.talk.start(0,9999);
  1200.    story.talk.setVolume(0 * sfxmute);
  1201.    story.story.knight.play();
  1202.    circlewipe(titlescreen,story);
  1203.    delete titlescreen.rays.onEnterFrame;
  1204.    story.story.onRelease = function()
  1205.    {
  1206.       score = 0;
  1207.       consecutive = 0;
  1208.       powerup = 0;
  1209.       hittarget = 0;
  1210.       money = 0;
  1211.       lastroundgot = 90;
  1212.       mostgot = 90;
  1213.       numhit = 0;
  1214.       level = 0;
  1215.       delete story.bubble.onEnterFrame;
  1216.       story.story.mouth.stop();
  1217.       story.story.knight.stop();
  1218.       story.talk.stop();
  1219.       circlewipe(story,goalscreen);
  1220.       delete story.story.onRelease;
  1221.       nextlevel();
  1222.    };
  1223.    story.curstatement = 0;
  1224.    story.wait = 0;
  1225.    story.statement[7] = "The Queen needs a " + story.randoms[random(story.randoms.length)];
  1226.    story.bubble.onEnterFrame = story.bubbleOnEnterFrame;
  1227.    curweapon = 1;
  1228.    world = 0;
  1229.    score = 0;
  1230.    consecutive = 0;
  1231.    powerup = 0;
  1232.    hittarget = 0;
  1233.    money = 0;
  1234.    numhit = 0;
  1235.    level = 0;
  1236.    percplus = 0;
  1237.    updateText();
  1238.    _root.smult = 0;
  1239.    hasamulet = false;
  1240.    hasoil = false;
  1241.    hastonic = false;
  1242.    pwrchar1.gethim._visible = false;
  1243.    weaponshop.firstinit();
  1244. };
  1245. goalscreen.parchment.stop();
  1246. goalscreen._visible = false;
  1247. weaponshop._visible = false;
  1248. instructions._visible = false;
  1249. story._visible = false;
  1250. _root.smult = 0;
  1251. stop();
  1252. doinstructions = function()
  1253. {
  1254.    instructions.gotoAndStop(1);
  1255.    instructions.hand.play();
  1256.    instructions.knight.play();
  1257.    circlewipe(titlescreen,instructions);
  1258. };
  1259. bigcircle._visible = false;
  1260. circlewipe = function(inmc, outmc)
  1261. {
  1262.    _level0.setMask(bigcircle);
  1263.    bigcircle.onEnterFrame = function()
  1264.    {
  1265.       this._xscale -= 10;
  1266.       this._yscale -= 10;
  1267.       if(this._xscale <= 0)
  1268.       {
  1269.          if(inmc == goalscreen)
  1270.          {
  1271.             _quality = "LOW";
  1272.          }
  1273.          if(outmc == goalscreen || outmc == titlescreen || outmc == weaponshop)
  1274.          {
  1275.             _quality = "HIGH";
  1276.          }
  1277.          inmc._visible = false;
  1278.          outmc._visible = true;
  1279.          this.onEnterFrame = function()
  1280.          {
  1281.             this._xscale += 10;
  1282.             this._yscale += 10;
  1283.             if(this._xscale >= 100)
  1284.             {
  1285.                _level0.setMask(null);
  1286.                delete this.onEnterFrame;
  1287.             }
  1288.          };
  1289.       }
  1290.    };
  1291. };
  1292. g = getTimer();
  1293. var i = 0;
  1294. while(i < 10000)
  1295. {
  1296.    b = Math.sin(Math.random());
  1297.    i++;
  1298. }
  1299. diff = getTimer() - g;
  1300. if(diff < 180)
  1301. {
  1302.    setgamequality(1);
  1303. }
  1304. else if(diff > 230)
  1305. {
  1306.    setgamequality(3);
  1307. }
  1308. else
  1309. {
  1310.    setgamequality(2);
  1311. }
  1312. Stage.scaleMode = "noscale";
  1313.