home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Acao / Titans / star.swf / scripts / DefineSprite_190_bunny / frame_1 / DoAction.as
Encoding:
Text File  |  2006-01-05  |  1.1 KB  |  62 lines

  1. speed = 0.8 * r.espeed;
  2. y = _Y;
  3. stick = 0;
  4. name = "bunny";
  5. d = 12;
  6. if(_parent._name == "enemymap")
  7. {
  8.    initme();
  9. }
  10. else
  11. {
  12.    onenterframe = function()
  13.    {
  14.       d--;
  15.       dx = _X - s._x;
  16.       dy = _Y - s._y;
  17.       if(!stick)
  18.       {
  19.          ang = math.atan2(dy,dx);
  20.          xs = speed * math.cos(ang);
  21.          ys = speed * math.sin(ang);
  22.          if(d > 0)
  23.          {
  24.             _X = _X + 0.7 * xs;
  25.          }
  26.          else
  27.          {
  28.             _X = _X + xs;
  29.          }
  30.          _Y = _Y + ys;
  31.          if(dx * dx + dy * dy < 100)
  32.          {
  33.             stick = 1;
  34.          }
  35.          _rotation = deg(ang);
  36.       }
  37.       else
  38.       {
  39.          _X = s._x + (_X - s._x) / 10;
  40.          _Y = s._y + (_Y - s._y) / 10;
  41.       }
  42.       cekhit();
  43.       if(hit)
  44.       {
  45.          gotoAndPlay(5);
  46.       }
  47.       if(!r.inv)
  48.       {
  49.          if(s.hittest(_X,_Y,1))
  50.          {
  51.             r.hit = 1;
  52.             gotoAndPlay(5);
  53.          }
  54.       }
  55.       if(_X < -30)
  56.       {
  57.          this.removeMovieClip();
  58.       }
  59.    };
  60. }
  61. stop();
  62.