home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / Dual.swf / scripts / frame_7 / DoAction.as < prev   
Encoding:
Text File  |  2008-09-03  |  10.2 KB  |  405 lines

  1. stop();
  2. trace(modo);
  3. _root.createEmptyMovieClip("almacen",10);
  4. score = 0;
  5. vel = 5;
  6. radius = 12.5;
  7. probab = 30;
  8. probabp = 30;
  9. pausa = false;
  10. dmg = 0;
  11. tmpo = 0;
  12. rotor = 1.5;
  13. tam = 100;
  14. stam = 100;
  15. stam_dur = 0;
  16. start_time = getTimer();
  17. volumen.control._x = volumetrico;
  18. if(_root.modo == "inverse")
  19. {
  20.    textoA.text = "Arrow keys";
  21.    textoB.text = "Arrow keys [inverted]";
  22. }
  23. if(_root.modo == "hand")
  24. {
  25.    textoA.text = "WASD";
  26.    textoB.text = "Arrow keys";
  27. }
  28. onEnterFrame = function()
  29. {
  30.    music.setVolume(volumen.control._x);
  31.    if(tam < stam)
  32.    {
  33.       tam++;
  34.    }
  35.    if(tam > stam)
  36.    {
  37.       tam--;
  38.    }
  39.    if(elapsed_seconds - stam_dur >= 5)
  40.    {
  41.       stam = 100;
  42.    }
  43.    if(stam <= 0)
  44.    {
  45.       stam = 0;
  46.    }
  47.    toca = rank._currentframe + 1;
  48.    vbar.bar._xscale = 100 - dmg;
  49.    rank._rotation += rotor;
  50.    if(elapsed_seconds >= 10 && rank._currentframe == 1)
  51.    {
  52.       rotor += 2;
  53.    }
  54.    if(elapsed_seconds >= 25 && rank._currentframe == 2)
  55.    {
  56.       rotor += 2;
  57.    }
  58.    if(elapsed_seconds >= 40 && rank._currentframe == 3)
  59.    {
  60.       rotor += 2;
  61.    }
  62.    if(elapsed_seconds >= 55 && rank._currentframe == 4)
  63.    {
  64.       rotor += 2;
  65.    }
  66.    if(elapsed_seconds >= 75 && rank._currentframe == 5)
  67.    {
  68.       rotor += 2;
  69.    }
  70.    if(elapsed_seconds >= 95 && rank._currentframe == 6)
  71.    {
  72.       rotor += 2;
  73.    }
  74.    if(elapsed_seconds >= 120 && rank._currentframe == 7)
  75.    {
  76.       rotor += 2;
  77.    }
  78.    if(elapsed_seconds >= 140 && rank._currentframe == 8)
  79.    {
  80.       rotor += 2;
  81.    }
  82.    if(elapsed_seconds >= 200 && rank._currentframe == 9)
  83.    {
  84.       rotor += 2;
  85.    }
  86.    if(rotor >= 90)
  87.    {
  88.       rank.gotoAndStop(toca);
  89.       rotor = 1.5;
  90.    }
  91.    if(!pausa)
  92.    {
  93.       probab -= 0.0025;
  94.       if(dmg >= 100)
  95.       {
  96.          volumetrico = volumen.control._x;
  97.          score = elapsed_seconds;
  98.          dmg = 100;
  99.          _root.attachMovie("fininv","fininv",99999999 + _root.getNextHighestDepth());
  100.          fininv.score.text = elapsed_seconds + " seconds";
  101.          if(guardar.data.best < elapsed_seconds)
  102.          {
  103.             guardar.data.best = elapsed_seconds;
  104.          }
  105.          if(rotor <= 2)
  106.          {
  107.             fininv.ranko.gotoAndStop(toca - 1);
  108.          }
  109.          else
  110.          {
  111.             fininv.ranko.gotoAndStop(toca);
  112.          }
  113.          pausa = true;
  114.       }
  115.       elapsed_time = getTimer() - start_time;
  116.       _root.count.text = elapsed_seconds;
  117.       elapsed_seconds = Math.floor(elapsed_time / 1000);
  118.       if(_root.modo == "inverse")
  119.       {
  120.          if(Key.isDown(37))
  121.          {
  122.             a._x -= vel;
  123.             b._x += vel;
  124.          }
  125.          if(Key.isDown(39))
  126.          {
  127.             a._x += vel;
  128.             b._x -= vel;
  129.          }
  130.          if(Key.isDown(38))
  131.          {
  132.             a._y -= vel;
  133.             b._y += vel;
  134.          }
  135.          if(Key.isDown(40))
  136.          {
  137.             a._y += vel;
  138.             b._y -= vel;
  139.          }
  140.       }
  141.       if(_root.modo == "hand")
  142.       {
  143.          if(Key.isDown(65))
  144.          {
  145.             a._x -= vel;
  146.          }
  147.          if(Key.isDown(68))
  148.          {
  149.             a._x += vel;
  150.          }
  151.          if(Key.isDown(87))
  152.          {
  153.             a._y -= vel;
  154.          }
  155.          if(Key.isDown(83))
  156.          {
  157.             a._y += vel;
  158.          }
  159.          if(Key.isDown(37))
  160.          {
  161.             b._x -= vel;
  162.          }
  163.          if(Key.isDown(39))
  164.          {
  165.             b._x += vel;
  166.          }
  167.          if(Key.isDown(38))
  168.          {
  169.             b._y -= vel;
  170.          }
  171.          if(Key.isDown(40))
  172.          {
  173.             b._y += vel;
  174.          }
  175.       }
  176.       if(a._x < 16.5)
  177.       {
  178.          a._x = 16.5;
  179.       }
  180.       if(a._x > 235.5)
  181.       {
  182.          a._x = 235.5;
  183.       }
  184.       if(a._y > 237.5)
  185.       {
  186.          a._y = 237.5;
  187.       }
  188.       if(a._y < 16.5)
  189.       {
  190.          a._y = 16.5;
  191.       }
  192.       if(b._x < 264.5)
  193.       {
  194.          b._x = 264.5;
  195.       }
  196.       if(b._x > 483.5)
  197.       {
  198.          b._x = 483.5;
  199.       }
  200.       if(b._y > 237.5)
  201.       {
  202.          b._y = 237.5;
  203.       }
  204.       if(b._y < 16.5)
  205.       {
  206.          b._y = 16.5;
  207.       }
  208.       e = almacen.getNextHighestDepth();
  209.       i = almacen.getNextHighestDepth() + 3;
  210.       if(random(probab) == 0)
  211.       {
  212.          var enemy = _root.almacen.attachMovie("enemy","enemy" + e,e);
  213.          _root.guardar.data.enemy = _root.guardar.data.enemy + 1;
  214.          enemy._y = -10;
  215.          enemy._x = Math.random() * 220 + 15;
  216.          enemy.velo = Math.random() * 5 + 1;
  217.          enemy.rotor = 3;
  218.          enemy.onEnterFrame = function()
  219.          {
  220.             this._xscale = _root.tam;
  221.             this._yscale = _root.tam;
  222.             if(!pausa)
  223.             {
  224.                if(_root.a.ha.hitTest(this) or _root.b.hb.hitTest(this))
  225.                {
  226.                   _root.dmg = _root.dmg + 1;
  227.                }
  228.                this._rotation += enemy.rotor;
  229.                this._y += enemy.velo;
  230.                if(this._y > 250)
  231.                {
  232.                   this._y = 250;
  233.                   enemy.rotor = 0;
  234.                   this._rotation = this._rotation;
  235.                   this._alpha = this._alpha - 1;
  236.                }
  237.                if(this._alpha <= 0)
  238.                {
  239.                   this.removeMovieClip();
  240.                }
  241.             }
  242.          };
  243.       }
  244.       if(random(probab) == 0)
  245.       {
  246.          var Enemy = _root.almacen.attachMovie("enemy","enemy" + e,e);
  247.          _root.guardar.data.enemy = _root.guardar.data.enemy + 1;
  248.          Enemy._y = -10;
  249.          Enemy._x = Math.random() * 220 + 265;
  250.          Enemy.velo = Math.random() * 5 + 1;
  251.          Enemy.rotor = 3;
  252.          Enemy.onEnterFrame = function()
  253.          {
  254.             this._xscale = _root.tam;
  255.             this._yscale = _root.tam;
  256.             if(!pausa)
  257.             {
  258.                if(_root.a.ha.hitTest(this) or _root.b.hb.hitTest(this))
  259.                {
  260.                   _root.dmg = _root.dmg + 1;
  261.                }
  262.                this._rotation += Enemy.rotor;
  263.                this._y += Enemy.velo;
  264.                if(this._y > 250)
  265.                {
  266.                   this._y = 250;
  267.                   Enemy.rotor = 0;
  268.                   this._rotation = this._rotation;
  269.                   this._alpha = this._alpha - 1;
  270.                }
  271.                if(this._alpha <= 0)
  272.                {
  273.                   this.removeMovieClip();
  274.                }
  275.             }
  276.          };
  277.       }
  278.       if(random(probab * 2) == 0)
  279.       {
  280.          _root.guardar.data.enemy += 2;
  281.          var _loc3_ = _root.almacen.attachMovie("pinchod","pinchod" + e,e);
  282.          _loc3_._y = Math.random() * 230 + 10;
  283.          _loc3_._x = 520;
  284.          _loc3_.onEnterFrame = function()
  285.          {
  286.             if(!pausa)
  287.             {
  288.                if(this._x > 250)
  289.                {
  290.                   this._x -= 3;
  291.                }
  292.                if(_root.a.ha.hitTest(this) or _root.b.hb.hitTest(this))
  293.                {
  294.                   _root.dmg = _root.dmg + 1;
  295.                }
  296.                if(this._x <= 250)
  297.                {
  298.                   this._alpha -= 3;
  299.                }
  300.                if(this._alpha <= 20)
  301.                {
  302.                   this.removeMovieClip();
  303.                }
  304.             }
  305.          };
  306.          var _loc4_ = _root.almacen.attachMovie("pinchoi","pinchoi" + i,i);
  307.          _loc4_._y = Math.random() * 230 + 10;
  308.          _loc4_._x = -20;
  309.          _loc4_.onEnterFrame = function()
  310.          {
  311.             if(!pausa)
  312.             {
  313.                if(this._x < 250)
  314.                {
  315.                   this._x += 3;
  316.                }
  317.                if(_root.a.ha.hitTest(this) or _root.b.hb.hitTest(this))
  318.                {
  319.                   _root.dmg = _root.dmg + 1;
  320.                }
  321.                if(this._x >= 250)
  322.                {
  323.                   this._alpha -= 3;
  324.                }
  325.                if(this._alpha <= 20)
  326.                {
  327.                   this.removeMovieClip();
  328.                }
  329.             }
  330.          };
  331.       }
  332.       if(random(probabp * 5) == 0)
  333.       {
  334.          var size = _root.almacen.attachMovie("size","size" + e,e);
  335.          size._y = Math.random() * 220 + 15;
  336.          size._x = Math.random() * 220 + 15;
  337.          size.muerte = elapsed_seconds;
  338.          size.onEnterFrame = function()
  339.          {
  340.             if(!pausa)
  341.             {
  342.                this._rotation += 1.2;
  343.                if((_root.a.ha.hitTest(this) or _root.b.hb.hitTest(this)) and this._currentframe <= 14)
  344.                {
  345.                   this.gotoAndPlay(15);
  346.                   _root.stam_dur = _root.elapsed_seconds;
  347.                   _root.stam += 50;
  348.                   _root.guardar.data.powers = _root.guardar.data.powers + 1;
  349.                }
  350.                if(_root.elapsed_seconds - size.muerte == 5)
  351.                {
  352.                   this.gotoAndPlay(15);
  353.                }
  354.             }
  355.          };
  356.       }
  357.       if(random(probabp * 5) == 0)
  358.       {
  359.          var sizem = _root.almacen.attachMovie("sizem","sizem" + e,e);
  360.          sizem._y = Math.random() * 220 + 15;
  361.          sizem._x = Math.random() * 220 + 265;
  362.          sizem.muerte = elapsed_seconds;
  363.          sizem.onEnterFrame = function()
  364.          {
  365.             if(!pausa)
  366.             {
  367.                this._rotation += 1.2;
  368.                if((_root.a.ha.hitTest(this) or _root.b.hb.hitTest(this)) and this._currentframe <= 14)
  369.                {
  370.                   this.gotoAndPlay(15);
  371.                   _root.stam_dur = _root.elapsed_seconds;
  372.                   _root.stam -= 25;
  373.                   _root.guardar.data.powers = _root.guardar.data.powers + 1;
  374.                }
  375.                if(_root.elapsed_seconds - sizem.muerte == 5)
  376.                {
  377.                   this.gotoAndPlay(15);
  378.                }
  379.             }
  380.          };
  381.       }
  382.    }
  383. };
  384. volumen.control.onPress = function()
  385. {
  386.    volumen.control.onEnterFrame = function()
  387.    {
  388.       this._x = _root._xmouse;
  389.       if(this._x <= 0)
  390.       {
  391.          this._x = 0;
  392.       }
  393.       if(this._x >= 100)
  394.       {
  395.          this._x = 100;
  396.       }
  397.    };
  398. };
  399. volumen.control.onMouseUp = function()
  400. {
  401.    volumen.control.onEnterFrame = function()
  402.    {
  403.    };
  404. };
  405.