home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / ellipsis.swf / scripts / DefineSprite_26_enemy9 / frame_1 / DoAction.as
Encoding:
Text File  |  2007-02-20  |  3.0 KB  |  124 lines

  1. function moveMe()
  2. {
  3.    youSpeed = Math.min(youMaxSpeed,youSpeed + youAcc);
  4.    player._rotation += (Key.isDown(39) - Key.isDown(37)) * 7;
  5.    xC = Math.cos(player._rotation * 3.141592653589793 / 180) * youSpeed;
  6.    yC = Math.sin(player._rotation * 3.141592653589793 / 180) * youSpeed;
  7.    player._x += xC;
  8.    player._y += yC;
  9.    oldX = player._x;
  10.    oldY = player._y;
  11. }
  12. youAcc = 4;
  13. youDec = 0.2;
  14. youSpeed = 0;
  15. youMaxSpeed = random(5) + 5;
  16. player._x = _root._xmouse;
  17. player._y = _root._ymouse;
  18. player._rotation = random(360);
  19. tap = 16777215;
  20. var my_color = new Color(this);
  21. my_color.setRGB(tap);
  22. life *= 50;
  23. onEnterFrame = function()
  24. {
  25.    moveMe();
  26.    if(player._rotation >= 360)
  27.    {
  28.       player._rotation -= 360;
  29.    }
  30.    if(player._rotation < 0)
  31.    {
  32.       player._rotation += 360;
  33.    }
  34.    if(player._x >= 575)
  35.    {
  36.       if(player._rotation >= 0 && player._rotation < 90)
  37.       {
  38.          player._rotation = 180 - player._rotation;
  39.          moveMe();
  40.       }
  41.       if(player._rotation < 0 && player._rotation > -90)
  42.       {
  43.          player._rotation = 180 - player._rotation;
  44.          moveMe();
  45.       }
  46.    }
  47.    if(player._x <= 25)
  48.    {
  49.       if(player._rotation <= 180 && player._rotation > 90)
  50.       {
  51.          player._rotation = 180 - player._rotation;
  52.          moveMe();
  53.       }
  54.       if(player._rotation > -180 && player._rotation < -90)
  55.       {
  56.          player._rotation = 180 - player._rotation;
  57.          moveMe();
  58.       }
  59.    }
  60.    if(player._y <= 25)
  61.    {
  62.       if(player._rotation >= -180 && player._rotation <= -90)
  63.       {
  64.          player._rotation = - player._rotation;
  65.          moveMe();
  66.       }
  67.       if(player._rotation >= -90 && player._rotation <= 0)
  68.       {
  69.          player._rotation = - player._rotation;
  70.          moveMe();
  71.       }
  72.    }
  73.    if(player._y >= 575)
  74.    {
  75.       if(player._rotation >= 90 && player._rotation <= 180)
  76.       {
  77.          player._rotation = - player._rotation;
  78.          moveMe();
  79.       }
  80.       if(player._rotation <= 90 && player._rotation >= 0)
  81.       {
  82.          player._rotation = - player._rotation;
  83.          moveMe();
  84.       }
  85.    }
  86.    tracer = player._rotation;
  87.    if(player.hitTest(_root.base))
  88.    {
  89.       _root.base.play();
  90.       _root.life = _root.life - 1;
  91.    }
  92.    if(_root.life <= 0)
  93.    {
  94.       i = 0;
  95.       while(i < 4)
  96.       {
  97.          e = _root.attachMovie("lineline12","l" + _root.k,_root.k++);
  98.          e._x = player._x;
  99.          e._y = player._y;
  100.          i++;
  101.       }
  102.       this.removeMovieClip();
  103.    }
  104. };
  105. onMouseDown = function()
  106. {
  107.    if(player.hitTest(_root._xmouse,_root._ymouse))
  108.    {
  109.       _root.score += 525;
  110.       _root.kill = _root.kill + 1;
  111.       _root.hitted.start();
  112.       i = 0;
  113.       while(i < 10)
  114.       {
  115.          f = _root.attachMovie("lineline12","l" + _root.k,_root.k++);
  116.          tap = Math.round(Math.random() * 16777215);
  117.          var _loc3_ = new Color(f);
  118.          _loc3_.setRGB(tap);
  119.          i++;
  120.       }
  121.       this.removeMovieClip();
  122.    }
  123. };
  124.