home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / ellipsis.swf / scripts / DefineSprite_32_enemy7 / frame_1 / DoAction.as
Encoding:
Text File  |  2007-02-20  |  3.2 KB  |  133 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 = 2;
  16. driftSpeed = 0.005;
  17. player._x = _root._xmouse;
  18. player._y = _root._ymouse;
  19. player._rotation = random(360);
  20. life *= 50;
  21. onEnterFrame = function()
  22. {
  23.    moveMe();
  24.    if(player._rotation >= 360)
  25.    {
  26.       player._rotation -= 360;
  27.    }
  28.    if(player._rotation < 0)
  29.    {
  30.       player._rotation += 360;
  31.    }
  32.    if(player._x >= 575)
  33.    {
  34.       if(player._rotation >= 0 && player._rotation < 90)
  35.       {
  36.          player._rotation = 180 - player._rotation;
  37.          moveMe();
  38.       }
  39.       if(player._rotation < 0 && player._rotation > -90)
  40.       {
  41.          player._rotation = 180 - player._rotation;
  42.          moveMe();
  43.       }
  44.    }
  45.    if(player._x <= 25)
  46.    {
  47.       if(player._rotation <= 180 && player._rotation > 90)
  48.       {
  49.          player._rotation = 180 - player._rotation;
  50.          moveMe();
  51.       }
  52.       if(player._rotation > -180 && player._rotation < -90)
  53.       {
  54.          player._rotation = 180 - player._rotation;
  55.          moveMe();
  56.       }
  57.    }
  58.    if(player._y <= 25)
  59.    {
  60.       if(player._rotation >= -180 && player._rotation <= -90)
  61.       {
  62.          player._rotation = - player._rotation;
  63.          moveMe();
  64.       }
  65.       if(player._rotation >= -90 && player._rotation <= 0)
  66.       {
  67.          player._rotation = - player._rotation;
  68.          moveMe();
  69.       }
  70.    }
  71.    if(player._y >= 575)
  72.    {
  73.       if(player._rotation >= 90 && player._rotation <= 180)
  74.       {
  75.          player._rotation = - player._rotation;
  76.          moveMe();
  77.       }
  78.       if(player._rotation <= 90 && player._rotation >= 0)
  79.       {
  80.          player._rotation = - player._rotation;
  81.          moveMe();
  82.       }
  83.    }
  84.    circx = player._x;
  85.    circy = player._y;
  86.    prevx = _root.base._x;
  87.    prevy = _root.base._y;
  88.    _root.base._x -= driftSpeed * ((_root.base._x - player._x) / 2);
  89.    _root.base._y -= driftSpeed * ((_root.base._y - player._y) / 2);
  90.    dough.removeMovieClip();
  91.    createEmptyMovieClip("dough",5);
  92.    with(dough)
  93.    {
  94.       lineStyle(1,16777215,100);
  95.       moveTo(player._x,player._y);
  96.       lineTo(_root.base._x,_root.base._y);
  97.    }
  98.    tracer = player._rotation;
  99.    if(player.hitTest(_root.base))
  100.    {
  101.       _root.base.play();
  102.       _root.life--;
  103.    }
  104.    if(_root.life <= 0)
  105.    {
  106.       i = 0;
  107.       while(i < 4)
  108.       {
  109.          e = _root.attachMovie("lineline10","l" + _root.k,_root.k++);
  110.          e._x = player._x;
  111.          e._y = player._y;
  112.          i++;
  113.       }
  114.       this.removeMovieClip();
  115.    }
  116. };
  117. onMouseDown = function()
  118. {
  119.    if(player.hitTest(_root._xmouse,_root._ymouse))
  120.    {
  121.       _root.score += 525;
  122.       _root.kill = _root.kill + 1;
  123.       _root.hitted.start();
  124.       i = 0;
  125.       while(i < 10)
  126.       {
  127.          _root.attachMovie("lineline10","l" + _root.k,_root.k++);
  128.          i++;
  129.       }
  130.       this.removeMovieClip();
  131.    }
  132. };
  133.