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

  1. fast = 10;
  2. xmin = 50;
  3. xmax = 300;
  4. ymin = 50;
  5. ymax = 350;
  6. space = 10;
  7. div = 1.01;
  8. s.gotoAndStop("fly");
  9. delete onmouseup;
  10. onenterframe = function()
  11. {
  12.    nx = r._xmouse;
  13.    ny = r._ymouse;
  14.    if(nx < xmin)
  15.    {
  16.       nx = xmin;
  17.    }
  18.    if(nx > xmax)
  19.    {
  20.       nx = xmax;
  21.    }
  22.    if(ny < ymin)
  23.    {
  24.       ny = ymin;
  25.    }
  26.    if(ny > ymax)
  27.    {
  28.       ny = ymax;
  29.    }
  30.    dx = nx - s._x;
  31.    if(dx < - space)
  32.    {
  33.       r.hd = 1;
  34.    }
  35.    else if(dx > space)
  36.    {
  37.       r.hd = 2;
  38.    }
  39.    else
  40.    {
  41.       r.hd = 0;
  42.    }
  43.    if(!r.noshot)
  44.    {
  45.       s.gotoAndStop("fly" + r.hd);
  46.    }
  47.    oldx = s._x;
  48.    oldy = s._y;
  49.    div *= 1.05;
  50.    if(div > 1.2)
  51.    {
  52.       div = 1.2;
  53.    }
  54.    s._x = nx + (s._x - nx) / div;
  55.    s._y = ny + (s._y - ny) / div;
  56.    r.bg1._y = -0.2 * s._y;
  57.    r.bg2._y = -0.15 * s._y;
  58.    r.clouds._y = -0.1 * s._y;
  59.    if(r.hit)
  60.    {
  61.       gotoAndPlay(5);
  62.    }
  63. };
  64. onmousedown = function()
  65. {
  66.    r.autofire = 1;
  67.    r.noshot = 0;
  68. };
  69. onmouseup = function()
  70. {
  71.    r.autofire = 0;
  72.    r.noshot = 1;
  73. };
  74. stop();
  75.