home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / rocketcar2.swf / scripts / DefineSprite_68_p2 / frame_2 / DoAction.as
Encoding:
Text File  |  2008-09-24  |  2.0 KB  |  121 lines

  1. if(_root.paused)
  2. {
  3.    return undefined;
  4. }
  5. gravity = _root.car.gravity;
  6. _X = parent._x + parent._width / 2 - 15;
  7. if(_root.car.jet)
  8. {
  9.    onfloor = true;
  10.    yvel = 0;
  11.    yknown = undefined;
  12.    _Y = _root.car._y;
  13.    return undefined;
  14. }
  15. if(_root.gravityType == "normal")
  16. {
  17.    _Y = _Y + yvel;
  18. }
  19. if(_root.gravityType == "reverse")
  20. {
  21.    _Y = _Y - yvel;
  22. }
  23. if(!_root.bg.hitTest(_X,_Y + 1,true))
  24. {
  25.    yvel += gravity;
  26. }
  27. if(_root.gravityType == "normal")
  28. {
  29.    while(_root.bg.hitTest(_X,_Y + 1,true))
  30.    {
  31.       this._y -= 1;
  32.       onfloor = true;
  33.       yvel = 0;
  34.       yknown = undefined;
  35.    }
  36. }
  37. if(_root.gravityType == "reverse")
  38. {
  39.    while(_root.bg.hitTest(_X,_Y - 5,true))
  40.    {
  41.       this._y += 1;
  42.       onfloor = true;
  43.       yvel = 0;
  44.       yknown = undefined;
  45.    }
  46. }
  47. if(_root.gravityType == "normal")
  48. {
  49.    if(!_root.bg.hitTest(_X,_Y + 5,true))
  50.    {
  51.       onfloor = false;
  52.    }
  53. }
  54. if(_root.gravityType == "reverse")
  55. {
  56.    if(!_root.bg.hitTest(_X,_Y - 10,true))
  57.    {
  58.       onfloor = false;
  59.    }
  60. }
  61. if(_root.gravityType == "normal")
  62. {
  63.    if(_root.bg.hitTest(_X,_Y + 5,true))
  64.    {
  65.       hitBg = true;
  66.    }
  67.    else
  68.    {
  69.       hitBg = false;
  70.    }
  71. }
  72. if(distance > 80)
  73. {
  74.    if(_root.carp2.onfloor)
  75.    {
  76.       if(yknown == undefined)
  77.       {
  78.          yknown = 1;
  79.       }
  80.       if(!_root.bg.hitTest(_X,_Y + 1,true))
  81.       {
  82.          _Y = _root.car._y;
  83.       }
  84.    }
  85. }
  86. if(_root.gravityType == "normal")
  87. {
  88.    if(distance > 200)
  89.    {
  90.       if(!_root.bg.hitTest(_X,_Y + 1,true))
  91.       {
  92.          _Y = _root.car._y;
  93.       }
  94.    }
  95. }
  96. if(_root.gravityType == "reverse")
  97. {
  98.    if(distance < -200)
  99.    {
  100.       if(!_root.bg.hitTest(_X,_Y - 10,true))
  101.       {
  102.          _Y = _root.car._y;
  103.       }
  104.    }
  105. }
  106. distance = _Y - _root.car._y;
  107. if(_root.gravityType == "normal")
  108. {
  109.    if(_Y < _root.car._y)
  110.    {
  111.       _Y = _root.car._y;
  112.    }
  113. }
  114. if(_root.gravityType == "reverse")
  115. {
  116.    if(_Y > _root.car._y)
  117.    {
  118.       _Y = _root.car._y;
  119.    }
  120. }
  121.