home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / gammabros.swf / scripts / __Packages / classes / fx / Asteroids.as < prev    next >
Encoding:
Text File  |  2007-03-28  |  7.9 KB  |  167 lines

  1. class classes.fx.Asteroids
  2. {
  3.    var c;
  4.    var c2;
  5.    var stage = "A";
  6.    var exists = true;
  7.    var Name = "asteroids";
  8.    function Asteroids()
  9.    {
  10.       this.c = 0;
  11.       this.c2 = 10;
  12.    }
  13.    function switchStage(which)
  14.    {
  15.       this.c = 0;
  16.       this.c2 = 10;
  17.       this.stage = which;
  18.    }
  19.    function createTypeA()
  20.    {
  21.       var _loc3_ = random(4);
  22.       _root.fxID = _root.fxID + 1;
  23.       if(_root.hyper)
  24.       {
  25.          _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(50,950),620,_root.randRange(1,2),"U",_root.randRange(1,6),_root.fxID,true);
  26.          this.c2 = _root.randRange(4,25);
  27.       }
  28.       else
  29.       {
  30.          _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,2),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  31.          this.c2 = _root.randRange(10,300);
  32.       }
  33.       _root.addFX("asteroid" + _root.fxID);
  34.       this.c = 0;
  35.       this.c2 *= 1 / _root.dif.speed;
  36.    }
  37.    function createTypeB()
  38.    {
  39.       var _loc3_ = random(4);
  40.       _root.fxID = _root.fxID + 1;
  41.       _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,3),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  42.       _root.addFX("asteroid" + _root.fxID);
  43.       this.c = 0;
  44.       this.c2 = _root.randRange(2,30);
  45.       this.c2 *= 1 / _root.dif.speed;
  46.    }
  47.    function createTypeC()
  48.    {
  49.       var _loc3_ = random(4);
  50.       _root.fxID = _root.fxID + 1;
  51.       if(_root.hyper)
  52.       {
  53.          _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(50,950),620,_root.randRange(2,4),"U",_root.randRange(1,6),_root.fxID,true);
  54.          this.c2 = _root.randRange(3,10);
  55.       }
  56.       else
  57.       {
  58.          _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,2),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  59.          this.c2 = _root.randRange(5,25);
  60.       }
  61.       _root.addFX("asteroid" + _root.fxID);
  62.       _loc3_ = random(4);
  63.       _root.fxID = _root.fxID + 1;
  64.       _root["asteroidB" + _root.fxID] = new classes.fx.AsteroidB(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),1,_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  65.       _root.addFX("asteroidB" + _root.fxID);
  66.       this.c = 0;
  67.       this.c2 *= 1 / _root.dif.speed;
  68.    }
  69.    function createTypeD()
  70.    {
  71.       var _loc3_ = random(4);
  72.       _root.fxID = _root.fxID + 1;
  73.       _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,4),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  74.       _root.addFX("asteroid" + _root.fxID);
  75.       _loc3_ = random(4);
  76.       _root.fxID = _root.fxID + 1;
  77.       _root["asteroidB" + _root.fxID] = new classes.fx.AsteroidB(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,2),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  78.       _root.addFX("asteroidB" + _root.fxID);
  79.       this.c = 0;
  80.       this.c2 = _root.randRange(3,15);
  81.       this.c2 *= 1 / _root.dif.speed;
  82.    }
  83.    function createTypeE()
  84.    {
  85.       var _loc3_ = random(4);
  86.       _root.fxID = _root.fxID + 1;
  87.       _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(3,5),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  88.       _root.addFX("asteroid" + _root.fxID);
  89.       _loc3_ = random(4);
  90.       _root.fxID = _root.fxID + 1;
  91.       _root["asteroidB" + _root.fxID] = new classes.fx.AsteroidB(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,3),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  92.       _root.addFX("asteroidB" + _root.fxID);
  93.       this.c = 0;
  94.       this.c2 = _root.randRange(2,8);
  95.       this.c2 *= 1 / _root.dif.speed;
  96.    }
  97.    function createTypeF()
  98.    {
  99.       var _loc3_ = random(4);
  100.       _root.fxID = _root.fxID + 1;
  101.       _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(3,5),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  102.       _root.addFX("asteroid" + _root.fxID);
  103.       this.c = 0;
  104.       this.c2 = _root.randRange(10,60);
  105.       this.c2 *= 1 / _root.dif.speed;
  106.    }
  107.    function createTypeG()
  108.    {
  109.       var _loc3_ = random(4);
  110.       _root.fxID = _root.fxID + 1;
  111.       _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(2,4),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  112.       _root.addFX("asteroid" + _root.fxID);
  113.       this.c = 0;
  114.       this.c2 = _root.randRange(50,150);
  115.       this.c2 *= 1 / _root.dif.speed;
  116.    }
  117.    function createTypeH()
  118.    {
  119.       var _loc3_ = random(4);
  120.       _root.fxID = _root.fxID + 1;
  121.       if(_root.hyper)
  122.       {
  123.          _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(50,950),620,_root.randRange(1,4),"U",_root.randRange(1,6),_root.fxID);
  124.       }
  125.       else
  126.       {
  127.          _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,4),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  128.       }
  129.       _root.addFX("asteroid" + _root.fxID);
  130.       if(random(2) == 1)
  131.       {
  132.          _loc3_ = random(4);
  133.          _root.fxID = _root.fxID + 1;
  134.          _root["asteroidB" + _root.fxID] = new classes.fx.AsteroidB(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,2),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  135.          _root.addFX("asteroidB" + _root.fxID);
  136.       }
  137.       this.c = 0;
  138.       this.c2 = _root.randRange(15,50);
  139.       this.c2 *= 1 / _root.dif.speed;
  140.    }
  141.    function createTypeI()
  142.    {
  143.       var _loc3_ = random(4);
  144.       _root.fxID = _root.fxID + 1;
  145.       _root["asteroid" + _root.fxID] = new classes.fx.Asteroid(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,5),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  146.       _root.addFX("asteroid" + _root.fxID);
  147.       if(random(2) == 1)
  148.       {
  149.          _loc3_ = random(4);
  150.          _root.fxID = _root.fxID + 1;
  151.          _root["asteroidB" + _root.fxID] = new classes.fx.AsteroidB(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(1,3),_root.dirArray[_loc3_],_root.randRange(1,6),_root.fxID);
  152.          _root.addFX("asteroidB" + _root.fxID);
  153.       }
  154.       this.c = 0;
  155.       this.c2 = _root.randRange(3,15);
  156.       this.c2 *= 1 / _root.dif.speed;
  157.    }
  158.    function main()
  159.    {
  160.       this.c = this.c + 1;
  161.       if(this.c >= this.c2)
  162.       {
  163.          this["createType" + this.stage]();
  164.       }
  165.    }
  166. }
  167.