home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / avenger.swf / scripts / frame_94 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  22.9 KB  |  943 lines

  1. stop();
  2. fabryki._visible = true;
  3. chmurki._visible = true;
  4. _root.menu._visible = true;
  5. hero._visible = true;
  6. trawka._visible = true;
  7. sun._visible = true;
  8. hero.swapDepths(46);
  9. level = 1;
  10. menu.level_txt.text = level;
  11. live = 3;
  12. wytrzyma = 3;
  13. if(_root.scr < 1000)
  14. {
  15.    _root.scr = 0;
  16. }
  17. else
  18. {
  19.    _root.scr = _root.ilePunktow;
  20. }
  21. menu.score_txt.text = scr;
  22. muzyka1 = new Sound();
  23. muzyka1.attachSound("level1");
  24. muzyka1.setVolume(90);
  25. muzyka1.start(0,9999);
  26. trawka.trawka1.duplicateMovieClip("trawka1_dub",100);
  27. trawka.trawka1_dub._x = trawka.trawka1._x + trawka.trawka1._width;
  28. bgstartx = trawka._x;
  29. bgSpeed = 5;
  30. trawka.onEnterFrame = function()
  31. {
  32.    trawka._x -= bgSpeed;
  33.    if(trawka._x <= bgstartx - trawka.trawka1._width)
  34.    {
  35.       trawka._x = bgstartx - bgSpeed;
  36.    }
  37. };
  38. fabryki.fabryki1.duplicateMovieClip("fabryki1_dub",100);
  39. fabryki.fabryki1_dub._x = fabryki.fabryki1._x + fabryki.fabryki1._width;
  40. bgstartx = fabryki._x;
  41. bgSpeed1 = 1;
  42. fabryki.onEnterFrame = function()
  43. {
  44.    fabryki._x -= bgSpeed1;
  45.    if(fabryki._x <= bgstartx - fabryki.fabryki1._width)
  46.    {
  47.       fabryki._x = bgstartx - bgSpeed1;
  48.    }
  49. };
  50. chmurki.chmurki1.duplicateMovieClip("chmurki1_dub",100);
  51. chmurki.chmurki1_dub._x = chmurki.chmurki1._x + chmurki.chmurki1._width;
  52. bgstartx = chmurki._x;
  53. bgSpeed2 = 0.2;
  54. chmurki.onEnterFrame = function()
  55. {
  56.    chmurki._x -= bgSpeed2;
  57.    if(chmurki._x <= bgstartx - chmurki.chmurki1._width)
  58.    {
  59.       chmurki._x = bgstartx - bgSpeed2;
  60.    }
  61. };
  62. sun.onEnterFrame = function()
  63. {
  64.    this._x -= 0.05;
  65. };
  66. Vpion = 5;
  67. Vpoz = 6;
  68. fireRate = 10;
  69. repeatTime = 0;
  70. firing = false;
  71. costrzela = "laser1";
  72. klawiatura = new Object();
  73. klawiatura.onKeyDown = function()
  74. {
  75.    if(_root._currentframe >= 151)
  76.    {
  77.       return undefined;
  78.    }
  79.    if(firing == false && Key.getCode() == 17)
  80.    {
  81.       firing = true;
  82.       repeatTime = 0;
  83.    }
  84. };
  85. klawiatura.onKeyUp = function()
  86. {
  87.    if(Key.getCode() == 17)
  88.    {
  89.       firing = false;
  90.    }
  91. };
  92. Key.addListener(klawiatura);
  93. hero.onEnterFrame = function()
  94. {
  95.    trace(live);
  96.    if(live <= 0)
  97.    {
  98.       _root.weaponLayer.removeMovieClip();
  99.       _root.enemyLayer.removeMovieClip();
  100.       _root.projectileLayer.removeMovieClip();
  101.       _root.projectileLayerHero.removeMovieClip();
  102.       delete this.onEnterFrame;
  103.       delete trawka.onEnterFrame;
  104.       delete sun.onEnterFrame;
  105.       delete fabryki.onEnterFrame;
  106.       delete chmurki.onEnterFrame;
  107.       menu._visible = false;
  108.       muzyka1.stop();
  109.       delete this.onEnterFrame;
  110.       delete wyspa.onEnterFrame;
  111.       muzyka3.stop();
  112.       delete this.onEnterFrame;
  113.       delete wood1.onEnterFrame;
  114.       delete sun3.onEnterFrame;
  115.       delete mountain.onEnterFrame;
  116.       delete chmurki3_1.onEnterFrame;
  117.       muzyka2.stop();
  118.       delete this.onEnterFrame;
  119.       delete ny.onEnterFrame;
  120.       muzyka5.stop();
  121.       delete this.onEnterFrame;
  122.       delete szkielet_zachod.onEnterFrame;
  123.       muzyka4.stop();
  124.       pustynia._visible = false;
  125.       tlo_pustynia._visible = false;
  126.       gotoAndStop(162);
  127.    }
  128.    l = 0;
  129.    while(l < 46)
  130.    {
  131.       var nm = "enemy" + l;
  132.       if(this._currentframe == 1)
  133.       {
  134.          if(this.hitTest(enemyLayer[nm]))
  135.          {
  136.             this.gotoAndPlay(2);
  137.             enemyLayer[nm].gotoAndPlay(2);
  138.             scr += 100;
  139.             menu.score_txt.text = scr;
  140.             menu.maska._xscale -= 30;
  141.             if(menu.maska._xscale <= 0)
  142.             {
  143.                this.gotoAndPlay(3);
  144.                menu.maska._xscale = 100;
  145.                live--;
  146.                costrzela = "laser1";
  147.                menu.maska_live._xscale += 20;
  148.             }
  149.          }
  150.       }
  151.       l++;
  152.    }
  153.    if(Key.isDown(38))
  154.    {
  155.       hero._y -= Vpion;
  156.    }
  157.    else if(Key.isDown(40))
  158.    {
  159.       hero._y += Vpion;
  160.    }
  161.    if(Key.isDown(37))
  162.    {
  163.       hero._x -= Vpoz;
  164.    }
  165.    else if(Key.isDown(39))
  166.    {
  167.       hero._x += Vpoz;
  168.    }
  169.    if(hero._x < 60)
  170.    {
  171.       hero._x = 60;
  172.    }
  173.    if(hero._y < 76)
  174.    {
  175.       hero._y = 76;
  176.    }
  177.    if(hero._y > 320)
  178.    {
  179.       hero._y = 320;
  180.    }
  181.    if(hero._x > 525)
  182.    {
  183.       hero._x = 525;
  184.    }
  185.    if(energyLayer.hitTest(hero))
  186.    {
  187.       _root.lev3.gotoAndPlay("energyUP");
  188.       energyLayer.onEnterFrame = function()
  189.       {
  190.          energyLayer._xscale -= 22;
  191.          energyLayer._yscale -= 22;
  192.          UPUP = new Sound();
  193.          UPUP.attachSound("zoop");
  194.          UPUP.start();
  195.          if(energyLayer._xscale < 10)
  196.          {
  197.             menu.maska._xscale = 100;
  198.             energyLayer.removeMovieClip();
  199.          }
  200.       };
  201.    }
  202.    if(weaponLayer.hitTest(hero))
  203.    {
  204.       weaponLayer.onEnterFrame = function()
  205.       {
  206.          weaponLayer._xscale -= 25;
  207.          weaponLayer._yscale -= 25;
  208.          UPUP = new Sound();
  209.          UPUP.attachSound("zoop");
  210.          UPUP.start();
  211.          if(weaponLayer._xscale < 18)
  212.          {
  213.             weaponLayer.removeMovieClip();
  214.             if(costrzela == "laser1")
  215.             {
  216.                _root.lev1.gotoAndPlay("weaponUP");
  217.                costrzela = "laser1a";
  218.             }
  219.             else if(costrzela == "laser1a")
  220.             {
  221.                _root.lev1.gotoAndPlay("weaponUP");
  222.                costrzela = "laser2";
  223.             }
  224.             else if(costrzela == "laser2")
  225.             {
  226.                _root.lev1.gotoAndPlay("weaponUP");
  227.                costrzela = "bullet4";
  228.             }
  229.             else if(costrzela == "bullet4")
  230.             {
  231.                _root.lev1.gotoAndPlay("weaponUP");
  232.                costrzela = "bullet5";
  233.             }
  234.             else if(costrzela == "bullet5")
  235.             {
  236.                _root.lev1.gotoAndPlay("weaponUP");
  237.                costrzela = "super_bron";
  238.             }
  239.          }
  240.       };
  241.    }
  242.    if(firing && repeatTime == 0)
  243.    {
  244.       bron = costrzela;
  245.       createProjectileHero(bron,this._x,this._y,20,0);
  246.       if(costrzela == "laser1" || costrzela == "laser1a")
  247.       {
  248.          type1 = new Sound();
  249.          type1.attachSound("fx_1");
  250.          type1.start();
  251.       }
  252.       else if(costrzela == "laser2")
  253.       {
  254.          type2 = new Sound(menu);
  255.          type2.attachSound("fx_2");
  256.          type2.setVolume(30);
  257.          type2.start();
  258.       }
  259.       else if(costrzela == "bullet4" || costrzela == "bullet5")
  260.       {
  261.          type3 = new Sound();
  262.          type3.attachSound("fx_3");
  263.          type3.setVolume(100);
  264.          type3.start();
  265.       }
  266.       else if(costrzela == "super_bron")
  267.       {
  268.          type4 = new Sound();
  269.          type4.attachSound("fx_super_b");
  270.          type4.setVolume(80);
  271.          type4.start();
  272.       }
  273.    }
  274.    repeatTime++;
  275.    repeatTime %= fireRate;
  276. };
  277. _root.createEmptyMovieClip("enemyLayer",44);
  278. _root.createEmptyMovieClip("projectileLayer",42);
  279. _root.createEmptyMovieClip("projectileLayerHero",45);
  280. enemyCount = 0;
  281. ship_attack1 = function(type, ile)
  282. {
  283.    wytrzyma_ship = 2;
  284.    var zmianaX = 500;
  285.    var zmianaY = 120;
  286.    i = ile;
  287.    while(i > 0)
  288.    {
  289.       zmianaX += 60;
  290.       zmianaY += 60;
  291.       enemyCount++;
  292.       enemyCount %= 30;
  293.       var nm = "enemy" + enemyCount;
  294.       enemyLayer.attachMovie(type,nm,enemyCount);
  295.       enemyLayer[nm]._y = zmianaY;
  296.       enemyLayer[nm]._x = zmianaX;
  297.       enemyLayer[nm].dx = 11;
  298.       enemyLayer[nm].onEnterFrame = function()
  299.       {
  300.          if(this._x <= 250)
  301.          {
  302.             this._dx = 0;
  303.             if(this.f != true && this._currentframe == 1)
  304.             {
  305.                kierunekX = Math.random() * -5 - 14;
  306.                kierunekY = Math.random() * -6 + 2;
  307.                createProjectile("bullet3",this._x,this._y,kierunekX,kierunekY);
  308.             }
  309.             this.f = true;
  310.          }
  311.          else
  312.          {
  313.             this._x -= this.dx;
  314.          }
  315.          if(this.f)
  316.          {
  317.             this._x += 20;
  318.          }
  319.          if(this._x > 700)
  320.          {
  321.             this.removeMovieClip();
  322.          }
  323.       };
  324.       i--;
  325.    }
  326. };
  327. ship_attack2 = function(type, y, ilosc, dol_czy_gora)
  328. {
  329.    wytrzyma_ship = 5;
  330.    var zmiana1 = 700;
  331.    j = ilosc;
  332.    while(j > 0)
  333.    {
  334.       zmiana1 += 60;
  335.       enemyCount++;
  336.       enemyCount %= 20;
  337.       var nm = "enemy" + enemyCount;
  338.       enemyLayer.attachMovie(type,nm,enemyCount);
  339.       enemyLayer[nm]._x = zmiana1;
  340.       enemyLayer[nm].yline = y;
  341.       enemyLayer[nm]._y = y;
  342.       enemyLayer[nm].dx = 8;
  343.       enemyLayer[nm].t = Math.random() * 5;
  344.       enemyLayer[nm].onEnterFrame = function()
  345.       {
  346.          if(this._x < 200)
  347.          {
  348.             this._y += dol_czy_gora;
  349.             this._x -= 7;
  350.          }
  351.          else
  352.          {
  353.             this._y = this.yline + Math.sin(this.t) * 22;
  354.             this._x -= this.dx;
  355.             this.t += 0.5;
  356.          }
  357.          if(this._y > 400 || this._x < -10)
  358.          {
  359.             this.removeMovieClip();
  360.          }
  361.       };
  362.       j--;
  363.    }
  364. };
  365. ship_attack3 = function(type, y, ile, dol_czy_gora)
  366. {
  367.    wytrzyma_ship = 1;
  368.    var zmiana = 700;
  369.    i = ile;
  370.    while(i > 0)
  371.    {
  372.       zmiana += 60;
  373.       enemyCount++;
  374.       enemyCount %= 25;
  375.       var nm = "enemy" + enemyCount;
  376.       enemyLayer.attachMovie(type,nm,enemyCount);
  377.       enemyLayer[nm]._y = y;
  378.       enemyLayer[nm]._x = zmiana;
  379.       enemyLayer[nm].dx = 11;
  380.       enemyLayer[nm].onEnterFrame = function()
  381.       {
  382.          this._x -= this.dx;
  383.          if(this._x < 290)
  384.          {
  385.             this._y += dol_czy_gora;
  386.             if(this.f != true && this._currentframe == 1)
  387.             {
  388.                kierunekX = Math.random() * -5 - 5;
  389.                kierunekY = Math.random() * -6 + 4;
  390.                createProjectile("bullet1",this._x,this._y,kierunekX,kierunekY);
  391.             }
  392.             this.f = true;
  393.             if(this._y >= 300)
  394.             {
  395.                this._x += 10;
  396.             }
  397.          }
  398.          if(this._y > 400 || this._x < -10)
  399.          {
  400.             this.removeMovieClip();
  401.          }
  402.       };
  403.       i--;
  404.    }
  405. };
  406. boss_attack1 = function(type, x, y, jaka_bron)
  407. {
  408.    wytrzyma = 18;
  409.    bossCount = 12;
  410.    bossCount++;
  411.    if(bossCount == 17)
  412.    {
  413.       bossCount = 12;
  414.    }
  415.    spadaj = 0;
  416.    var nm = "boss" + bossCount;
  417.    enemyLayer.attachMovie(type,nm,bossCount);
  418.    enemyLayer[nm]._y = y;
  419.    enemyLayer[nm]._x = x;
  420.    enemyLayer[nm].dy = 0;
  421.    enemyLayer[nm].dx = -8;
  422.    enemyLayer[nm].onEnterFrame = function()
  423.    {
  424.       if(this._x <= 350)
  425.       {
  426.          this.dx = 0;
  427.          if(this.f != true && this._currentframe == 1)
  428.          {
  429.             kierunekX = Math.random() * -5 - 14;
  430.             kierunekY = Math.random() * -6 + 2;
  431.             createProjectile("bullet2",this._x,this._y + 20,kierunekX,kierunekY);
  432.             this.f = true;
  433.             spadaj++;
  434.          }
  435.          switch(this._y)
  436.          {
  437.             case 150:
  438.                this.dy = 2;
  439.                this.f = false;
  440.                break;
  441.             case 170:
  442.             case 190:
  443.             case 200:
  444.             case 220:
  445.             case 240:
  446.             case 280:
  447.                this.f = false;
  448.                break;
  449.             case 300:
  450.                this.dy = - 2;
  451.                this.f = false;
  452.          }
  453.       }
  454.       if(wytrzyma <= 0)
  455.       {
  456.          addWeapon("weapon",jaka_bron,600,250,5);
  457.       }
  458.       if(spadaj >= 15)
  459.       {
  460.          this.dx = 5;
  461.       }
  462.       if(this._x > 600 || this._y < -100)
  463.       {
  464.          this.removeMovieClip();
  465.       }
  466.       this._y += this.dy;
  467.       this._x += this.dx;
  468.    };
  469. };
  470. boss_attack2 = function(type, x, y, jaka_bron)
  471. {
  472.    wytrzyma = 11;
  473.    bossCount = 0;
  474.    bossCount++;
  475.    if(bossCount == 11)
  476.    {
  477.       bossCount = 0;
  478.    }
  479.    spadaj = 0;
  480.    var nm = "boss" + bossCount;
  481.    enemyLayer.attachMovie(type,nm,bossCount);
  482.    enemyLayer[nm]._y = y;
  483.    enemyLayer[nm]._x = x;
  484.    enemyLayer[nm].dy = 0;
  485.    enemyLayer[nm].dx = -8;
  486.    enemyLayer[nm].onEnterFrame = function()
  487.    {
  488.       if(this._x <= 350)
  489.       {
  490.          this.dx = 0;
  491.          if(this.f != true && this._currentframe == 1)
  492.          {
  493.             kierunekX = Math.random() * -5 - 14;
  494.             kierunekY = Math.random() * -6 + 2;
  495.             createProjectile("bullet1",this._x,this._y + 40,kierunekX,kierunekY);
  496.             createProjectile("bullet1",this._x,this._y - 28,kierunekX,kierunekY);
  497.             this.f = true;
  498.             spadaj++;
  499.          }
  500.          switch(this._y)
  501.          {
  502.             case 150:
  503.                this.dy = 2;
  504.                this.f = false;
  505.                break;
  506.             case 170:
  507.             case 190:
  508.             case 200:
  509.             case 220:
  510.             case 240:
  511.             case 280:
  512.                this.f = false;
  513.                break;
  514.             case 300:
  515.                this.dy = - 2;
  516.                this.f = false;
  517.          }
  518.       }
  519.       if(wytrzyma <= 0)
  520.       {
  521.          addWeapon("weapon1",jaka_bron,600,200,3);
  522.       }
  523.       if(spadaj >= 15)
  524.       {
  525.          this.dx = 5;
  526.       }
  527.       if(this._x > 600 || this._y < -100)
  528.       {
  529.          this.removeMovieClip();
  530.       }
  531.       this._y += this.dy;
  532.       this._x += this.dx;
  533.    };
  534. };
  535. boss_attack_energy = function(type, x, y, jaka_bron)
  536. {
  537.    wytrzyma = 11;
  538.    bossCount = 17;
  539.    bossCount++;
  540.    if(bossCount == 20)
  541.    {
  542.       bossCount = 17;
  543.    }
  544.    spadaj = 0;
  545.    var nm = "boss" + bossCount;
  546.    enemyLayer.attachMovie(type,nm,bossCount);
  547.    enemyLayer[nm]._y = y;
  548.    enemyLayer[nm]._x = x;
  549.    enemyLayer[nm].dy = 0;
  550.    enemyLayer[nm].dx = -8;
  551.    enemyLayer[nm].onEnterFrame = function()
  552.    {
  553.       if(this._x <= 350)
  554.       {
  555.          this.dx = 0;
  556.          if(this.f != true && this._currentframe == 1)
  557.          {
  558.             kierunekX = Math.random() * -5 - 14;
  559.             kierunekY = Math.random() * -6 + 2;
  560.             createProjectile("bullet1",this._x,this._y + 40,kierunekX,kierunekY);
  561.             createProjectile("bullet1",this._x,this._y - 28,kierunekX,kierunekY);
  562.             this.f = true;
  563.             spadaj++;
  564.          }
  565.          switch(this._y)
  566.          {
  567.             case 150:
  568.                this.dy = 2;
  569.                this.f = false;
  570.                break;
  571.             case 170:
  572.             case 190:
  573.             case 200:
  574.             case 220:
  575.             case 240:
  576.             case 280:
  577.                this.f = false;
  578.                break;
  579.             case 300:
  580.                this.dy = - 2;
  581.                this.f = false;
  582.          }
  583.       }
  584.       if(wytrzyma <= 0)
  585.       {
  586.          addEnergy("energy",600,200,5);
  587.       }
  588.       if(spadaj >= 15)
  589.       {
  590.          this.dx = 5;
  591.       }
  592.       if(this._x > 600 || this._y < -100)
  593.       {
  594.          this.removeMovieClip();
  595.       }
  596.       this._y += this.dy;
  597.       this._x += this.dx;
  598.    };
  599. };
  600. projectileCount = 0;
  601. createProjectile = function(type, x, y, dx, dy)
  602. {
  603.    var nm = "proj" + projectileCount;
  604.    projectileLayer.attachMovie(type,nm,projectileCount);
  605.    projectileLayer[nm]._x = x;
  606.    projectileLayer[nm]._y = y;
  607.    projectileLayer[nm].dx = dx;
  608.    projectileLayer[nm].dy = dy;
  609.    projectileLayer[nm].onEnterFrame = function()
  610.    {
  611.       this._x += this.dx;
  612.       this._y += this.dy;
  613.       if(this._x < 0)
  614.       {
  615.          this.removeMovieClip();
  616.       }
  617.       if(hero._currentframe == 1)
  618.       {
  619.          if(this.hitTest(hero))
  620.          {
  621.             hero.gotoAndPlay(2);
  622.             this.removeMovieClip();
  623.             menu.maska._xscale -= 10;
  624.             if(menu.maska._xscale <= 0)
  625.             {
  626.                menu.maska._xscale = 100;
  627.                hero.gotoAndPlay(3);
  628.                live--;
  629.                costrzela = "laser1";
  630.                menu.maska_live._xscale += 20;
  631.             }
  632.             if(live < 0)
  633.             {
  634.                gotoAndPlay(162);
  635.             }
  636.          }
  637.       }
  638.    };
  639.    projectileCount++;
  640.    projectileCount %= 22;
  641. };
  642. createProjectileHero = function(type, x, y, dx, dy)
  643. {
  644.    var nm = "proj" + projectileCount;
  645.    projectileLayerHero.attachMovie(type,nm,projectileCount);
  646.    projectileLayerHero[nm]._x = x;
  647.    projectileLayerHero[nm]._y = y;
  648.    projectileLayerHero[nm].dx = dx;
  649.    projectileLayerHero[nm].dy = dy;
  650.    projectileLayerHero[nm].onEnterFrame = function()
  651.    {
  652.       this._x += this.dx;
  653.       this._y += this.dy;
  654.       if(this._x > 540)
  655.       {
  656.          this.removeMovieClip();
  657.       }
  658.       var i = 0;
  659.       while(i < 2)
  660.       {
  661.          var mm = "bossik" + i;
  662.          if(this.hitTest(enemyLayer[mm]) && enemyLayer[mm]._currentframe == 1)
  663.          {
  664.             scr += 200;
  665.             this.removeMovieClip();
  666.             menu.score_txt.text = scr;
  667.             przenies -= 1;
  668.             if(przenies <= 0)
  669.             {
  670.                enemyLayer[mm].play();
  671.             }
  672.          }
  673.          i++;
  674.       }
  675.       var i = 0;
  676.       while(i < 21)
  677.       {
  678.          var enm = "boss" + i;
  679.          if(this.hitTest(enemyLayer[enm]) && enemyLayer[enm]._currentframe == 1)
  680.          {
  681.             scr += 150;
  682.             this.removeMovieClip();
  683.             menu.score_txt.text = scr;
  684.             wytrzyma -= 1;
  685.             if(wytrzyma <= 0)
  686.             {
  687.                enemyLayer[enm].play();
  688.             }
  689.          }
  690.          i++;
  691.       }
  692.       var i = 0;
  693.       while(i < 46)
  694.       {
  695.          var enm = "enemy" + i;
  696.          if(this.hitTest(enemyLayer[enm]) && enemyLayer[enm]._currentframe == 1)
  697.          {
  698.             wytrzyma_ship -= 1;
  699.             this.removeMovieClip();
  700.             if(wytrzyma_ship <= 0)
  701.             {
  702.                enemyLayer[enm].play();
  703.                scr += 100;
  704.                menu.score_txt.text = scr;
  705.             }
  706.          }
  707.          i++;
  708.       }
  709.    };
  710.    projectileCount++;
  711.    projectileCount %= 22;
  712. };
  713. addW_count = 0;
  714. addWeapon = function(type, nazwa, x, y, dx)
  715. {
  716.    _root.createEmptyMovieClip("weaponLayer",43);
  717.    addW_count++;
  718.    weaponLayer.attachMovie(type,nazwa,addW_count);
  719.    weaponLayer._x = x;
  720.    weaponLayer._y = y;
  721.    weaponLayer.onEnterFrame = function()
  722.    {
  723.       weaponLayer._x -= dx;
  724.    };
  725. };
  726. addEnergy = function(type, x, y, dx)
  727. {
  728.    _root.createEmptyMovieClip("energyLayer",43);
  729.    addW_count++;
  730.    energyLayer.attachMovie(type,dodaj,addW_count);
  731.    energyLayer._x = x;
  732.    energyLayer._y = y;
  733.    energyLayer.onEnterFrame = function()
  734.    {
  735.       energyLayer._x -= dx;
  736.    };
  737. };
  738. attackTime = 0;
  739. next_lev = false;
  740. this.onEnterFrame = function()
  741. {
  742.    if(attackTime == 50)
  743.    {
  744.       var sx = Math.random() * 180 + 100;
  745.       ship_attack3("ship2",sx,6,7);
  746.    }
  747.    if(attackTime == 120)
  748.    {
  749.       ship_attack0("ship1",3);
  750.    }
  751.    if(attackTime == 250)
  752.    {
  753.       var sx = Math.random() * 100 + 180;
  754.       ship_attack2("ship3",sx,8,7);
  755.    }
  756.    if(attackTime == 350)
  757.    {
  758.       var sx = Math.random() * 120 + 120;
  759.       ship_attack3("ship2",sx,5,-7);
  760.    }
  761.    if(attackTime == 420)
  762.    {
  763.       ship_attack1("ship1",3);
  764.    }
  765.    if(attackTime == 480)
  766.    {
  767.       boss_attack1("boss1",600,150,laser2a);
  768.    }
  769.    if(attackTime == 650)
  770.    {
  771.       var sx = Math.random() * 120 + 120;
  772.       ship_attack3("ship2",sx,5,9);
  773.    }
  774.    if(attackTime == 780)
  775.    {
  776.       var sx = Math.random() * 180 + 100;
  777.       ship_attack3("ship2",sx,8,-8);
  778.    }
  779.    if(attackTime == 890)
  780.    {
  781.       boss_attack2("boss3",600,150,bullet1);
  782.    }
  783.    if(attackTime == 1050)
  784.    {
  785.       var sx = Math.random() * 100 + 180;
  786.       ship_attack2("ship3",sx,4,3);
  787.    }
  788.    if(attackTime == 1100)
  789.    {
  790.       var sx = Math.random() * 120 + 120;
  791.       ship_attack3("ship2",sx,6,5);
  792.    }
  793.    if(attackTime == 1200)
  794.    {
  795.       boss_attack1("boss1",600,150,bullet1);
  796.    }
  797.    if(attackTime == 1250)
  798.    {
  799.       boss_attack2("boss3",600,150,bullet_boss);
  800.    }
  801.    if(attackTime == 1400)
  802.    {
  803.       ship_attack1("ship1",2);
  804.    }
  805.    if(attackTime == 1450)
  806.    {
  807.       ship_attack1("ship1",2);
  808.    }
  809.    if(attackTime == 1550)
  810.    {
  811.       var sx = Math.random() * 180 + 100;
  812.       ship_attack3("ship2",sx,5,8);
  813.    }
  814.    if(attackTime == 1600)
  815.    {
  816.       var sx = Math.random() * 180 + 100;
  817.       ship_attack3("ship2",sx,5,-8);
  818.    }
  819.    if(attackTime == 1700)
  820.    {
  821.       ship_attack1("ship2",4);
  822.    }
  823.    if(attackTime == 1720)
  824.    {
  825.       boss_level("boss_koniec_1",600,150,bullet1);
  826.    }
  827.    if(attackTime > 1750 && przenies <= 0 && next_lev == true)
  828.    {
  829.       delete this.onEnterFrame;
  830.       delete trawka.onEnterFrame;
  831.       delete sun.onEnterFrame;
  832.       delete fabryki.onEnterFrame;
  833.       delete chmurki.onEnterFrame;
  834.       fabryki._visible = false;
  835.       chmurki._visible = false;
  836.       trawka._visible = false;
  837.       sun._visible = false;
  838.       muzyka1.stop();
  839.       gotoAndPlay(152);
  840.    }
  841.    attackTime++;
  842.    trace(attackTime);
  843.    trace(przenies);
  844.    trace(next_lev);
  845. };
  846. boss_level = function(type, x, y, jaka_bron)
  847. {
  848.    przenies = 25;
  849.    bossikCount = 0;
  850.    bossikCount++;
  851.    bossik %= 2;
  852.    var mm = "bossik" + bossikCount;
  853.    enemyLayer.attachMovie(type,mm,bossikCount);
  854.    enemyLayer[mm]._y = y;
  855.    enemyLayer[mm]._x = x;
  856.    enemyLayer[mm].dy = 0;
  857.    enemyLayer[mm].dx = -8;
  858.    enemyLayer[mm].onEnterFrame = function()
  859.    {
  860.       if(this._x <= 380)
  861.       {
  862.          this.dx = 0;
  863.          if(this.f != true && this._currentframe == 1)
  864.          {
  865.             kierunekX = Math.random() * -5 - 14;
  866.             kierunekY = Math.random() * -6 + 2;
  867.             createProjectile("bullet2",this._x,this._y + 20,kierunekX,kierunekY);
  868.             this.f = true;
  869.          }
  870.          switch(this._y)
  871.          {
  872.             case 150:
  873.                this.dy = 2;
  874.                this.f = false;
  875.                break;
  876.             case 170:
  877.             case 190:
  878.             case 200:
  879.             case 220:
  880.             case 240:
  881.             case 280:
  882.                this.f = false;
  883.                break;
  884.             case 300:
  885.                this.dy = - 2;
  886.                this.f = false;
  887.          }
  888.       }
  889.       if(this._x > 600 || this._y < -100)
  890.       {
  891.          this.removeMovieClip();
  892.       }
  893.       this._y += this.dy;
  894.       this._x += this.dx;
  895.    };
  896. };
  897. ship_attack0 = function(type, ile)
  898. {
  899.    wytrzyma_ship = 2;
  900.    var zmianaX = 500;
  901.    var zmianaY = 120;
  902.    enemyCount2 = 35;
  903.    i = ile;
  904.    while(i > 0)
  905.    {
  906.       zmianaX += 60;
  907.       zmianaY += 60;
  908.       enemyCount2++;
  909.       if(enemyCount2 == 45)
  910.       {
  911.          enemyCount = 35;
  912.       }
  913.       var nm = "enemy" + enemyCount2;
  914.       enemyLayer.attachMovie(type,nm,enemyCount2);
  915.       enemyLayer[nm]._y = zmianaY;
  916.       enemyLayer[nm]._x = zmianaX;
  917.       enemyLayer[nm].dx = 15;
  918.       enemyLayer[nm].onEnterFrame = function()
  919.       {
  920.          if(this._x <= 250)
  921.          {
  922.             this.f = true;
  923.          }
  924.          else
  925.          {
  926.             this._x -= this.dx;
  927.          }
  928.          if(this.f)
  929.          {
  930.             gdziesX = Math.random() * 13 + 7;
  931.             gdziesY = Math.random() * 12 + 5;
  932.             this._y -= gdziesY;
  933.             this._x -= gdziesX;
  934.          }
  935.          if(this._x < -20)
  936.          {
  937.             this.removeMovieClip();
  938.          }
  939.       };
  940.       i--;
  941.    }
  942. };
  943.