home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / dragon.swf / scripts / DefineSprite_90_deflect_ice / frame_1 / DoAction.as
Encoding:
Text File  |  2008-09-12  |  1.2 KB  |  54 lines

  1. function setVelocity(xdelta, ydelta)
  2. {
  3.    vx = xdelta;
  4.    vy = ydelta;
  5. }
  6. function step()
  7. {
  8.    m_flightTime++;
  9.    vy += _parent._parent.g_grav;
  10.    _Y = _Y + vy;
  11.    _X = _X + vx;
  12.    radians = Math.atan(vy / vx);
  13.    if(vx > 0)
  14.    {
  15.       _rotation = radians * 180 / 3.14159;
  16.    }
  17.    else
  18.    {
  19.       _rotation = radians * 180 / 3.14159 + 180;
  20.    }
  21.    if(vx < 0.00001 && vx > -0.00001)
  22.    {
  23.       _rotation = _rotation + 180;
  24.    }
  25.    if(boundaryTimer-- < 0)
  26.    {
  27.       boundaryTimer = 25;
  28.       if(_X < xmin || _X > xmax || _Y > ymax)
  29.       {
  30.          this.unloadMovie();
  31.       }
  32.    }
  33.    if(flameDebrisTimer-- < 0)
  34.    {
  35.       flameDebrisTimer = 0;
  36.       var _loc3_ = _parent._parent.addObj("ice_spark",_parent._parent.debris_layer,_parent._parent.getNextDebrisLevel());
  37.       _loc3_._x = _X;
  38.       _loc3_._y = _Y;
  39.       _loc3_._rotation = random(360);
  40.       _loc3_._xscale = _loc3_._yscale = 30 + rank * 20;
  41.       _loc3_.decayRate = 6;
  42.    }
  43. }
  44. xmax = _parent._parent.g_width + 10;
  45. ymax = _parent._parent.g_ground + 10;
  46. flameDebrisTimer = 0;
  47. _rotation = random(360);
  48. xmax = _parent._parent.g_width + 50;
  49. xmin = -50;
  50. ymin = -50;
  51. ymax = _parent._parent.g_ground + 50;
  52. boundaryTimer = 50;
  53. var m_flightTime = 0;
  54.