home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / blackknight.swf / scripts / DefineSprite_1062 / frame_1 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  4.3 KB  |  133 lines

  1. function firstinit()
  2. {
  3.    var _loc3_ = 0;
  4.    while(_loc3_ < 9)
  5.    {
  6.       var _loc2_ = this["weapon" + (_loc3_ + 1)];
  7.       _loc2_.myname = weaponnames[_loc3_];
  8.       _loc2_.myprice = weaponprices[_loc3_];
  9.       _loc2_.mydesc = weapondescs[_loc3_];
  10.       _loc2_.myid = _loc3_ + 1;
  11.       _loc2_.sx = _loc2_._x;
  12.       _loc2_.sy = _loc2_._y;
  13.       _loc2_._alpha = 100;
  14.       _loc2_.onRollOver = function()
  15.       {
  16.          info_txt.text = this.myname + ". Cost: " + this.myprice * 10;
  17.       };
  18.       _loc2_.onRollOut = function()
  19.       {
  20.          info_txt.text = "";
  21.       };
  22.       _loc2_.onRelease = function()
  23.       {
  24.          overlay.da = 100;
  25.          overlay.buyitem.gotoAndStop(this.myid);
  26.          overlay.buyitemshad.gotoAndStop(this.myid);
  27.          whosel = this;
  28.          overlay.title_txt.text = this.myname;
  29.          overlay.cost_txt.text = this.myprice * 10;
  30.          overlay.desc_txt.text = this.mydesc;
  31.       };
  32.       _loc2_.swapDepths(_loc2_.myid);
  33.       _loc3_ = _loc3_ + 1;
  34.    }
  35. }
  36. function init()
  37. {
  38.    var _loc3_ = 2;
  39.    while(_loc3_ < 7)
  40.    {
  41.       if(_root.curweapon >= _loc3_)
  42.       {
  43.          this["weapon" + _loc3_]._alpha = 20;
  44.          delete this["weapon" + _loc3_].onRelease;
  45.          delete this["weapon" + _loc3_].onRollOver;
  46.          delete this["weapon" + _loc3_].onRollOut;
  47.       }
  48.       else
  49.       {
  50.          this["weapon" + _loc3_]._visible = true;
  51.       }
  52.       _loc3_ = _loc3_ + 1;
  53.    }
  54.    status_txt.text = "Gold: " + _root.money * 10;
  55.    info_txt.text = "Click on an item you want to buy.";
  56.    overlay._alpha = 0;
  57.    overlay.da = 0;
  58.    overlay.onEnterFrame = function()
  59.    {
  60.       this._alpha += (this.da - this._alpha) * 0.5;
  61.       if(this._alpha < 1)
  62.       {
  63.          this._visible = false;
  64.       }
  65.       else
  66.       {
  67.          this._visible = true;
  68.       }
  69.    };
  70. }
  71. weaponnames = new Array("Wooden Club","Wooden Mallet","Battle Hammer","Battle Axe","Exaclibur Sword","Spiked Mace","Lucky Amulet","Armor Oil","Strength Tonic");
  72. weaponprices = new Array(0,50,150,250,300,400,20,30,40);
  73. weapondescs = new Array();
  74. weapondescs[0] = "Wooden Club. Standard Weapon.";
  75. weapondescs[1] = "What kind of Knight carries a club? Extract more gold per hit from the peasants in style with the Wooden Mallet!";
  76. weapondescs[2] = "For fast tax extraction per hit you need the Battle Hammer. Made of iron for hard-hitting performance!";
  77. weapondescs[3] = "Step up to the big leagues with the Battle Axe. A mid level tax extractor. No one argues with da Axe!";
  78. weapondescs[4] = "Not strong or righteous enough to draw the sword from the stone? Don\'t worry, we did it for you! Next to top of the line in tax extraction technology.";
  79. weapondescs[5] = "The last word in tax collection, one look at this fearsome weapon will have peasants dropping gold like never before!";
  80. weapondescs[6] = "Don\'t leave home without your lucky amulet! Increases your haul from barrels, hay stacks, chests, and those pesky peasants.";
  81. weapondescs[7] = "Glenda the Glum\'s patented Armor OilΓäó formula greatly speeds up your recovery time after a missed swing. For external use only.";
  82. weapondescs[8] = "Get Medieval with lightning speed with Ye Olde Strength Tonic. The more you chug, the more you\'ll slug!";
  83. overlay.buybutton.onRelease = function()
  84. {
  85.    if(whosel.myprice <= _root.money)
  86.    {
  87.       if(whosel.myid <= 6)
  88.       {
  89.          _root.curweapon = whosel.myid;
  90.          _root.money -= whosel.myprice;
  91.          if(_root.percplus > 0)
  92.          {
  93.             _root.percplus = 0;
  94.          }
  95.          init();
  96.       }
  97.       else
  98.       {
  99.          _root.money -= whosel.myprice;
  100.          whosel._visible = false;
  101.          if(whosel.myid == 7)
  102.          {
  103.             _root.hasamulet = true;
  104.          }
  105.          else if(whosel.myid == 8)
  106.          {
  107.             _root.hasoil = true;
  108.          }
  109.          else if(whosel.myid == 9)
  110.          {
  111.             _root.hastonic = true;
  112.          }
  113.          init();
  114.       }
  115.    }
  116.    else
  117.    {
  118.       info_txt.text = "Thou cannot afford it.";
  119.    }
  120.    overlay.da = 0;
  121. };
  122. overlay.backbutton.onRelease = function()
  123. {
  124.    overlay.da = 0;
  125. };
  126. overlay.swapDepths(20);
  127. donebutton.onRelease = function()
  128. {
  129.    _root.nextlevel();
  130.    _root.circlewipe(_root.weaponshop,_root.goalscreen);
  131.    delete overlay.onEnterFrame;
  132. };
  133.