home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Acao / gotham_dark_night.swf / scripts / frame_40 / DoAction.as
Encoding:
Text File  |  2008-09-08  |  32.0 KB  |  902 lines

  1. function death(deathType)
  2. {
  3.    _global.oGame.StopSound("conveyer");
  4.    _global.oGame.StopSound("musique");
  5.    _global.oGame.StopSound("smoke");
  6.    _global.oPerso.perso._y = 4000;
  7.    batmanIcon._visible = false;
  8.    if(deathType == "Boom")
  9.    {
  10.       transition.gotoAndStop("bombExplode");
  11.       eval("_global.oGame.moveZone.BG_" + _global.oGame.CurrentBG).removeMovieClip();
  12.    }
  13.    else
  14.    {
  15.       _global.oGame.PlaySound("tragic");
  16.       transition.gotoAndStop("fallOffScreen");
  17.    }
  18. }
  19. Array.prototype.deleteOne = function(element)
  20. {
  21.    var _loc1_ = this;
  22.    var _loc2_ = element;
  23.    thisLength = _loc1_.length;
  24.    i = 0;
  25.    while(i < thisLength)
  26.    {
  27.       if(_loc1_[i] == _loc2_)
  28.       {
  29.          _loc1_.splice(i,1);
  30.          break;
  31.       }
  32.       i++;
  33.    }
  34. };
  35. Array.prototype.getPos = function(element)
  36. {
  37.    var _loc1_ = this;
  38.    var _loc2_ = element;
  39.    thisLength = _loc1_.length;
  40.    i = 0;
  41.    while(i < thisLength)
  42.    {
  43.       if(_loc1_[i] == _loc2_)
  44.       {
  45.          return i;
  46.       }
  47.       i++;
  48.    }
  49.    return null;
  50. };
  51. _global.b.addListener(_global.oGame);
  52. _global.oGame.level1 = new Object();
  53. _global.oGame.level2 = new Object();
  54. _global.oGame.level3 = new Object();
  55. _global.oGame.mover = new Array();
  56. _global.oGame.Bomb = new Array();
  57. _global.oGame.FallingBomb = new Array();
  58. _global.oGame.RollingCarpet = new Array();
  59. _global.oGame.BadGuysHitZone = new Array();
  60. _global.oGame.BombTime = new Array([3,7,8,11,13],[5,7,13],[4,8,9,11],[4,7,8,9],[5,10,13,17],[4,6,9,11],[7,9,11,16],[3,11,8,19],[7,9,15,17],[5,8,11,18]);
  61. _global.oGame.level1.bg1 = [0,0,50,355,0,1,0,0];
  62. _global.oGame.level1.bg2 = [1,0,50,130,0,-2,0,0];
  63. _global.oGame.level1.bg0 = [1,1,20,157,0,0,0,0];
  64. _global.oGame.level2.bg1 = [0,0,50,355,0,1,0,0];
  65. _global.oGame.level2.bg2 = [1,0,50,130,0,1,0,0];
  66. _global.oGame.level2.bg3 = [2,0,20,157,0,0,5,0];
  67. _global.oGame.level2.bg8 = [0,0,400,100,0,1,0,0];
  68. _global.oGame.level2.bg9 = [0,1,20,100,0,0,0,0];
  69. _global.oGame.level3.bg1 = [0,0,50,355,0,1,0,0];
  70. _global.oGame.level3.bg2 = [1,0,50,130,0,1,0,0];
  71. _global.oGame.level3.bg3 = [2,0,20,157,0,0,1,0];
  72. _global.oGame.level3.bg4 = [2,-1,212,315,0,1,0,0];
  73. _global.oGame.level3.bg5 = [3,-1,20,165,0,1,0,0];
  74. _global.oGame.level3.bg6 = [3,0,50,185,0,0,1,0];
  75. _global.oGame.level3.bg7 = [4,0,50,200,0,0,0,0];
  76. _global.oGame.freeze = false;
  77. _global.oGame.starting = true;
  78. _global.oGame.BGCur = 1;
  79. _global.oGame.BGVCur = 1;
  80. _global.oGame.transitAccel = 3.5;
  81. _global.oGame.accroche = 8;
  82. _global.oGame.inTransit = 0;
  83. _global.oGame.transitNewX = 0;
  84. _global.oGame.transitXSpeed = 0;
  85. _global.oGame.transitNewY = 0;
  86. _global.oGame.transitYSpeed = 0;
  87. _global.oGame.BGWidth = 500;
  88. _global.oGame.BGHeight = 375;
  89. _global.oGame.moveZone.attachMovie("BGHit_l1_" + _global.oGame.CurrentBG,"BG_" + _global.oGame.CurrentBG,1);
  90. if(_global.oGame.CurrentBG == 4 || _global.oGame.CurrentBG == 8 || _global.oGame.CurrentBG == 7)
  91. {
  92.    _global.oGame.PlaySound("platformMove",999);
  93. }
  94. _global.oGame.moveZone["BG_" + _global.oGame.CurrentBG]._x = 0;
  95. _global.oGame.moveZone["BG_" + _global.oGame.CurrentBG]._y = 0;
  96. _global.oGame.moveZone._x = eval("_global.oGame.level" + _global.oGame.level + ".bg" + _global.oGame.CurrentBG)[0];
  97. _global.oGame.moveZone._y = eval("_global.oGame.level" + _global.oGame.level + ".bg" + _global.oGame.CurrentBG)[1];
  98. _global.oPerso.perso._x = eval("_global.oGame.level" + _global.oGame.level + ".bg" + _global.oGame.CurrentBG)[2];
  99. _global.oPerso.perso._y = eval("_global.oGame.level" + _global.oGame.level + ".bg" + _global.oGame.CurrentBG)[3];
  100. _global.oPerso.persoXSpeed = 0;
  101. _global.oPerso.persoYSpeed = 0;
  102. _global.oPerso.persoIsRunning = false;
  103. _global.oPerso.persoIsJumping = false;
  104. _global.oPerso.persoIsFalling = false;
  105. _global.oPerso.persoIsDucking = false;
  106. _global.oPerso.persoIsLanding = false;
  107. _global.oPerso.IsBatman = true;
  108. _global.oPerso.persoCurAction = "idle";
  109. _global.oPerso.persoJumpSpeed = 15;
  110. _global.oPerso.persoJumpDecel = 2;
  111. _global.oPerso.persoXAccel = 2;
  112. _global.oPerso.persoXDecel = 7;
  113. _global.oPerso.persoMaxXSpeed = 16;
  114. _global.oPerso.persoMaxYSpeed = 43;
  115. _global.keyListen = false;
  116. _global.oGame.PlaySound = function(theSound, loop)
  117. {
  118.    sounds.startsound(theSound,loop);
  119. };
  120. _global.oGame.StopSound = function(theSound)
  121. {
  122.    sounds.Stopsound(theSound);
  123. };
  124. _global.oGame.ChangeVolume = function(theSound, volume)
  125. {
  126.    sounds.SetSoundVolume(theSound,volume);
  127. };
  128. _global.oGame.StopAllSounds = function()
  129. {
  130.    sounds.stopAllSounds();
  131. };
  132. _global.oGame.StopSound("MusiqueIntro");
  133. _global.oGame.PlaySound("musique",999);
  134. _global.oGame.addMeToMovingList = function(obj)
  135. {
  136.    if(obj != undefined)
  137.    {
  138.       _global.oGame.mover.push(obj);
  139.    }
  140. };
  141. _global.oGame.RemoveFromMovingList = function(obj)
  142. {
  143.    _global.oGame.mover.deleteOne(obj);
  144. };
  145. _global.oGame.AddBadGuysHitZone = function(obj)
  146. {
  147.    _global.oGame.BadGuysHitZone.push(obj);
  148. };
  149. _global.oGame.RemoveBadGuysHitZone = function(obj)
  150. {
  151.    _global.oGame.BadGuysHitZone.deleteOne(obj);
  152. };
  153. _global.oGame.AddBomb = function(obj)
  154. {
  155.    var _loc1_ = obj;
  156.    _loc1_._visible = false;
  157.    _loc1_.bombColor = new Color(_loc1_.countdown);
  158.    _loc1_.time = _global.oGame.BombTime[Number(_loc1_._name.substring(4,5))][Number(_loc1_._name.substring(5,6))];
  159.    _global.oGame.Bomb.push(_loc1_);
  160. };
  161. _global.oGame.RemoveBomb = function(obj)
  162. {
  163.    _global.oGame.Bomb.deleteOne(obj);
  164. };
  165. _global.oGame.AddFallingBomb = function(obj)
  166. {
  167.    _global.oGame.FallingBomb.push(obj);
  168. };
  169. _global.oGame.RemoveFallingBomb = function(obj)
  170. {
  171.    _global.oGame.FallingBomb.deleteOne(obj);
  172. };
  173. _global.oGame.AddMeToRollingList = function(obj)
  174. {
  175.    _global.oGame.RollingCarpet.push(obj);
  176. };
  177. _global.oGame.RemoveMeToRollingList = function(obj)
  178. {
  179.    _global.oGame.RollingCarpet.deleteOne(obj);
  180. };
  181. _global.oGame.AddLife = function()
  182. {
  183.    var _loc1_ = _global;
  184.    _loc1_.persoLife = _loc1_.persoLife + 1;
  185.    _loc1_.scoreTotal = Number(_loc1_.scoreTotal) + 1250;
  186.    batmanIcon.showLife.text = _loc1_.persoLife;
  187.    batmanIcon.showScore.text = _loc1_.scoreTotal;
  188. };
  189. _global.oGame.WinGame = function()
  190. {
  191.    _global.oGame.StopSound("conveyer");
  192.    _global.oGame.StopSound("musique");
  193.    _global.oGame.StopSound("smoke");
  194.    _global.oGame.freeze = true;
  195.    _global.oPerso.perso._y = 4000;
  196.    _root.batmanIcon._visible = false;
  197.    eval("_global.oGame.moveZone.BG_" + _global.oGame.CurrentBG).removeMovieClip();
  198.    transition.gotoAndStop("win");
  199. };
  200. _global.oGame.LoseGame = function()
  201. {
  202.    _global.oGame.freeze = true;
  203.    _global.oPerso.perso._y = 4000;
  204.    _root.batmanIcon._visible = false;
  205.    eval("_global.oGame.moveZone.BG_" + _global.oGame.CurrentBG).removeMovieClip();
  206.    transition.gotoAndStop("lose");
  207. };
  208. _global.oGame.persoAnim = function(action)
  209. {
  210.    var _loc1_ = _global;
  211.    var _loc2_ = action;
  212.    switch(_loc2_)
  213.    {
  214.       case "idle":
  215.          if(_loc1_.oPerso.persoIsLanding)
  216.          {
  217.             _loc2_ = "land";
  218.          }
  219.          break;
  220.       case "run":
  221.          if(_loc1_.oPerso.persoIsLanding)
  222.          {
  223.             _loc2_ = "land";
  224.          }
  225.          break;
  226.       case "land":
  227.          _loc1_.oGame.PlaySound("landing");
  228.          _loc1_.oPerso.persoIsLanding = true;
  229.    }
  230.    if(_loc1_.oPerso.persoCurAction != _loc2_)
  231.    {
  232.       _loc1_.oPerso.perso.gotoAndStop(_loc2_);
  233.       _loc1_.oPerso.persoCurAction = _loc2_;
  234.    }
  235. };
  236. _global.oGame.transitTo = function(GoH, transitionDir, direction)
  237. {
  238.    _global.oGame.starting = true;
  239.    _global.leftPress = false;
  240.    _global.rightPress = false;
  241.    _global.upPress = false;
  242.    _global.downPress = false;
  243.    _global.keyListen = false;
  244.    _global.oPerso.persoXSpeed = 0;
  245.    _global.oGame.inTransit = transitionDir;
  246.    _global.oGame.BGLast = _global.oGame.CurrentBG;
  247.    _global.oGame.mover = new Array();
  248.    switch(direction)
  249.    {
  250.       case "right":
  251.          var moveDir = eval("_global.oGame.level" + _global.oGame.level + ".bg" + _global.oGame.CurrentBG)[5];
  252.          break;
  253.       case "up":
  254.          var moveDir = eval("_global.oGame.level" + _global.oGame.level + ".bg" + _global.oGame.CurrentBG)[6];
  255.    }
  256.    _global.oGame.CurrentBG += moveDir;
  257.    if(GoH)
  258.    {
  259.       _global.oGame.transitDirectionHorizontal = true;
  260.       _global.oGame.transitNewX = (- _global.oGame.BGWidth) * (_global.oGame.BGCur + transitionDir - 1);
  261.       _global.oGame.BGCur += transitionDir;
  262.    }
  263.    else
  264.    {
  265.       _global.oGame.transitDirectionHorizontal = false;
  266.       _global.oGame.transitOldY = _global.oGame.transitNewY;
  267.       _global.oGame.transitNewY = (- _global.oGame.BGHeight) * (_global.oGame.BGVCur + transitionDir - 1);
  268.       _global.oGame.BGVCur += transitionDir;
  269.    }
  270.    _global.oGame.moveZone.attachMovie("BGHit_l1_" + _global.oGame.CurrentBG,"BG_" + _global.oGame.CurrentBG,eval("_global.oGame.moveZone.BG_" + _global.oGame.BGLast).getDepth() + 1);
  271.    with(eval("_global.oGame.moveZone.BG_" + _global.oGame.CurrentBG))
  272.    {
  273.       _x = _global.oGame.BGWidth * (_global.oGame.BGCur - 1);
  274.       _y = _global.oGame.BGheight * (_global.oGame.BGVCur - 1);
  275.    }
  276. };
  277. MovingEnterFrame = function(obj)
  278. {
  279.    var _loc1_ = obj;
  280.    var _loc2_ = _global;
  281.    var _loc3_ = this;
  282.    _loc1_.tempx = _loc1_._x + _loc1_.xspeed;
  283.    _loc1_.tempy = _loc1_._y + _loc1_.yspeed;
  284.    if(_loc1_.xspeed > 0)
  285.    {
  286.       if(_loc1_.tempx < _loc1_.homex + _loc1_.maxxmov)
  287.       {
  288.          _loc1_._x = _loc1_.tempx;
  289.       }
  290.       else
  291.       {
  292.          _loc1_._x = _loc1_.tempx;
  293.          if(!_loc1_.OneWay)
  294.          {
  295.             _loc1_.xspeed = - Math.abs(_loc1_.xspeed);
  296.             _loc1_._parent.rollingCarpet.speed = -2;
  297.          }
  298.          else
  299.          {
  300.             _loc1_.direction = "left";
  301.             _loc1_.init();
  302.             _loc2_.oGame.mover.DeleteOne(_loc1_);
  303.          }
  304.       }
  305.    }
  306.    if(_loc1_.xspeed < 0)
  307.    {
  308.       if(_loc1_.tempx > _loc1_.homex - _loc1_.maxxmov)
  309.       {
  310.          _loc1_._x = _loc1_.tempx;
  311.       }
  312.       else
  313.       {
  314.          _loc1_._x = _loc1_.tempx;
  315.          if(!_loc1_.OneWay)
  316.          {
  317.             _loc1_.xspeed = Math.abs(_loc1_.xspeed);
  318.             _loc1_._parent.rollingCarpet.speed = 2;
  319.          }
  320.          else
  321.          {
  322.             _loc1_.direction = "right";
  323.             _loc1_.init();
  324.             _loc2_.oGame.mover.DeleteOne(_loc1_);
  325.          }
  326.       }
  327.    }
  328.    if(_loc1_.yspeed > 0)
  329.    {
  330.       if(_loc1_.tempy < _loc1_.homey + _loc1_.maxymov)
  331.       {
  332.          _loc1_._y = _loc1_.tempy;
  333.       }
  334.       else
  335.       {
  336.          _loc1_._y = _loc1_.tempy;
  337.          if(!_loc1_.OneWay)
  338.          {
  339.             _loc1_.yspeed = - Math.abs(_loc1_.yspeed);
  340.          }
  341.          else
  342.          {
  343.             if(_loc1_.swapBG == true)
  344.             {
  345.                _loc2_.oPerso.perso._y = _loc1_._y + 4000;
  346.                _loc2_.oGame.transitTo(false,1,"down");
  347.             }
  348.             _loc1_.direction = "up";
  349.             _loc1_.init();
  350.             _loc1_.automatic = false;
  351.             _loc2_.oGame.mover.DeleteOne(_loc1_);
  352.             if(_loc1_.changing == true)
  353.             {
  354.                _loc2_.oGame.StopSound("platformMove");
  355.                _loc2_.oGame.PlaySound("platformStop");
  356.                pt = new Object();
  357.                pt.x = _loc1_.graphique.batman._x;
  358.                pt.y = _loc1_.graphique.batman._y;
  359.                _loc3_.localToGlobal(pt);
  360.                _loc2_.oPerso.perso._x = pt.x - _loc2_.oGame.moveZone._x + _loc1_.xPos;
  361.                _loc2_.oPerso.perso._y = pt.y - _loc2_.oGame.moveZone._y + _loc1_.yPos;
  362.                _loc2_.oPerso.perso._visible = 1;
  363.                _loc2_.oPerso.persoXSpeed = 0;
  364.                _loc2_.oPerso.persoYSpeed = 0;
  365.                _loc1_._y += 10;
  366.                _loc1_._visible = false;
  367.                _loc1_._parent.movingPlatform._visible = true;
  368.                if(_loc2_.oGame.starting == false)
  369.                {
  370.                   _loc2_.oGame.addmetoMovingList(_loc1_._parent.movingPlatform);
  371.                   _loc2_.oGame.addmetoMovingList(_loc1_._parent.hitZoneX.movingPlatform);
  372.                }
  373.                else
  374.                {
  375.                   _loc1_._parent.movingPlatform.onEnterFrame = function()
  376.                   {
  377.                      var _loc1_ = _global;
  378.                      var _loc2_ = this;
  379.                      if(_loc1_.oGame.starting == false)
  380.                      {
  381.                         _loc1_.oGame.addmetoMovingList(_loc2_);
  382.                         _loc1_.oGame.addmetoMovingList(_loc2_._parent.hitZoneX.movingPlatform);
  383.                         delete _loc2_.onEnterFrame;
  384.                      }
  385.                   };
  386.                }
  387.                _loc2_.oGame.freeze = false;
  388.                _loc1_.graphique.gotoAndStop(1);
  389.                _loc1_.changing = false;
  390.             }
  391.          }
  392.       }
  393.    }
  394.    if(_loc1_.yspeed < 0)
  395.    {
  396.       if(_loc1_.tempy > _loc1_.homey - _loc1_.maxymov)
  397.       {
  398.          _loc1_._y = _loc1_.tempy;
  399.       }
  400.       else
  401.       {
  402.          _loc1_._y = _loc1_.tempy;
  403.          if(!_loc1_.OneWay)
  404.          {
  405.             _loc1_.yspeed = Math.abs(_loc1_.yspeed);
  406.          }
  407.          else
  408.          {
  409.             if(_loc1_.swapBG == true)
  410.             {
  411.                _loc2_.oGame.StopSound("conveyer");
  412.                _loc2_.oGame.transitTo(false,-1,"up");
  413.                _loc1_._visible = false;
  414.             }
  415.             _loc1_.direction = "down";
  416.             _loc1_.init();
  417.             _loc1_.automatic = false;
  418.             _loc2_.oGame.mover.DeleteOne(_loc1_);
  419.             if(_loc1_.changing == true)
  420.             {
  421.                _loc2_.oGame.StopSound("platformMove");
  422.                _loc2_.oGame.PlaySound("platformStop");
  423.                pt = new Object();
  424.                pt.x = _loc1_.graphique.batman._x;
  425.                pt.y = _loc1_.graphique.batman._y;
  426.                _loc3_.localToGlobal(pt);
  427.                _loc2_.oPerso.perso._x = pt.x - _loc2_.oGame.moveZone._x + _loc1_.xPos;
  428.                _loc2_.oPerso.perso._y = pt.y - _loc2_.oGame.moveZone._y + _loc1_.yPos;
  429.                _loc2_.oPerso.perso._visible = 1;
  430.                _loc2_.oPerso.persoXSpeed = 0;
  431.                _loc2_.oPerso.persoYSpeed = 0;
  432.                _loc1_._y += 10;
  433.                _loc1_._parent.movingPlatform._visible = true;
  434.                if(_loc2_.oGame.starting == false)
  435.                {
  436.                   _loc2_.oGame.addmetoMovingList(_loc1_._parent.movingPlatform);
  437.                   _loc2_.oGame.addmetoMovingList(_loc1_._parent.hitZoneX.movingPlatform);
  438.                }
  439.                else
  440.                {
  441.                   _loc1_._parent.movingPlatform.onEnterFrame = function()
  442.                   {
  443.                      var _loc1_ = _global;
  444.                      var _loc2_ = this;
  445.                      if(_loc1_.oGame.starting == false)
  446.                      {
  447.                         _loc1_.oGame.addmetoMovingList(_loc2_);
  448.                         _loc1_.oGame.addmetoMovingList(_loc2_._parent.hitZoneX.movingPlatform);
  449.                         delete _loc2_.onEnterFrame;
  450.                      }
  451.                   };
  452.                }
  453.                _loc2_.oGame.freeze = false;
  454.                _loc1_.changing = false;
  455.                _loc1_._visible = false;
  456.             }
  457.          }
  458.       }
  459.    }
  460. };
  461. _global.stillPressingKeyUp = false;
  462. frameAction = function()
  463. {
  464.    _global.upPress = false;
  465.    _global.downPress = false;
  466.    _global.leftPress = false;
  467.    _global.rightPress = false;
  468.    if(_global.keyListen == true)
  469.    {
  470.       if(Key.isDown(38) || Key.isDown(32))
  471.       {
  472.          _global.upPress = true;
  473.       }
  474.       else
  475.       {
  476.          _global.upPress = false;
  477.          _global.stillPressingKeyUp = false;
  478.       }
  479.       if(Key.isDown(40))
  480.       {
  481.          _global.downPress = true;
  482.       }
  483.       else if(_global.oPerso.perso._currentframe != 49)
  484.       {
  485.          _global.oPerso.persoIsDucking = false;
  486.       }
  487.       if(Key.isDown(37))
  488.       {
  489.          _global.leftPress = true;
  490.       }
  491.       else
  492.       {
  493.          _global.leftPress = false;
  494.       }
  495.       if(Key.isDown(39))
  496.       {
  497.          _global.rightPress = true;
  498.       }
  499.       else
  500.       {
  501.          _global.rightPress = false;
  502.       }
  503.    }
  504.    if(!_global.oGame.freeze)
  505.    {
  506.       if(_global.oPerso.persoXSpeed != 0)
  507.       {
  508.          _global.oPerso.persoIsRunning = true;
  509.       }
  510.       if(_global.oPerso.persoYSpeed < 0)
  511.       {
  512.          _global.oPerso.persoIsJumping = true;
  513.          _global.oPerso.persoIsFalling = false;
  514.       }
  515.       else if(_global.oPerso.persoYSpeed > 0 && _global.oPerso.persoYSpeed < 3)
  516.       {
  517.          _global.oPerso.persoIsBouncing = false;
  518.          _global.oPerso.persoIsFalling = true;
  519.          _global.oPerso.persoIsJumping = false;
  520.       }
  521.       else if(_global.oPerso.persoYSpeed >= 3)
  522.       {
  523.          _global.oPerso.persoIsDucking = false;
  524.          _global.oGame.persoAnim("fall");
  525.       }
  526.       if(_global.oPerso.persoIsRunning || _global.oPerso.movingBlock != -1)
  527.       {
  528.          if(_global.oPerso.persoIsJumping == true || _global.oPerso.persoIsFalling == true)
  529.          {
  530.             _global.oPerso.perso._x += (_global.oPerso.persoXSpeed + _global.oGame.mover[_global.oPerso.movingBlock].xspeed) / 2;
  531.          }
  532.          else
  533.          {
  534.             _global.oPerso.perso._x += _global.oPerso.persoXSpeed + _global.oGame.mover[_global.oPerso.movingBlock].xspeed;
  535.          }
  536.       }
  537.       if(_global.oPerso.persoYSpeed <= _global.oPerso.persoMaxYSpeed)
  538.       {
  539.          _global.oPerso.persoYSpeed += _global.oPerso.persoJumpDecel;
  540.       }
  541.       _global.oPerso.perso._y += _global.oPerso.persoYSpeed;
  542.       if(_global.oPerso.perso.persoBody.hitTest(transitR) && _global.oGame.inTransit == 0)
  543.       {
  544.          _global.oGame.transitTo(true,1,"right");
  545.       }
  546.       else if(_global.oPerso.perso.persoBody.hitTest(transitU) && _global.oGame.inTransit == 0)
  547.       {
  548.          _global.oGame.transitTo(false,-1,"up");
  549.       }
  550.       else if(_global.oPerso.perso.persoBody.hitTest(transitD) && _global.oGame.inTransit == 0)
  551.       {
  552.          death("Fall");
  553.       }
  554.       if(_global.oGame.inTransit != 0)
  555.       {
  556.          if(_global.oGame.transitDirectionHorizontal)
  557.          {
  558.             _global.oGame.transitXSpeed = (_global.oGame.moveZone._x - _global.oGame.transitNewX) / _global.oGame.transitAccel;
  559.             _global.oGame.moveZone._x -= _global.oGame.transitXSpeed;
  560.             if(_global.oGame.moveZone._x >= _global.oGame.transitNewX - 2 && _global.oGame.moveZone._x <= _global.oGame.transitNewX + 2)
  561.             {
  562.                _global.oGame.moveZone._x = _global.oGame.transitNewX;
  563.                _global.oGame.inTransit = 0;
  564.                eval("_global.oGame.moveZone.BG_" + _global.oGame.BGLast).removeMovieClip();
  565.             }
  566.          }
  567.          else
  568.          {
  569.             _global.oGame.transitYSpeed = (_global.oGame.moveZone._y - _global.oGame.transitNewY) / _global.oGame.transitAccel;
  570.             _global.oGame.moveZone._y -= _global.oGame.transitYSpeed;
  571.             if(_global.oGame.moveZone._y >= _global.oGame.transitNewY - 2 && _global.oGame.moveZone._y <= _global.oGame.transitNewY + 2)
  572.             {
  573.                _global.oGame.moveZone._y = _global.oGame.transitNewY;
  574.                _global.oGame.inTransit = 0;
  575.                eval("_global.oGame.moveZone.BG_" + _global.oGame.BGLast).removeMovieClip();
  576.             }
  577.          }
  578.       }
  579.       if(!_global.oPerso.persoIsJumping)
  580.       {
  581.          if(_global.oPerso.persoIsFalling && _global.oPerso.persoYSpeed > _global.oGame.accroche)
  582.          {
  583.             j = _global.oPerso.persoMaxYSpeed;
  584.          }
  585.          else
  586.          {
  587.             j = _global.oGame.accroche;
  588.          }
  589.          i = j;
  590.          while(i >= 0)
  591.          {
  592.             if(eval("_global.oGame.moveZone.BG_" + _global.oGame.CurrentBG + ".hitZoneX").hitTest(_global.oPerso.perso._x + _global.oGame.moveZone._x,_global.oPerso.perso._y + _global.oGame.moveZone._y - i,true))
  593.             {
  594.                _global.oPerso.perso._y -= i - 1;
  595.                if(_global.oPerso.persoIsFalling)
  596.                {
  597.                   if(_global.oPerso.persoYSpeed > 8)
  598.                   {
  599.                      _global.oGame.persoAnim("land");
  600.                   }
  601.                   _global.oPerso.persoIsFalling = false;
  602.                   _global.oPerso.persoIsBouncing = false;
  603.                   _global.oPerso.persoXSpeed = Math.floor(_global.oPerso.persoXSpeed / 2);
  604.                }
  605.                _global.oPerso.persoYSpeed = 0;
  606.                break;
  607.             }
  608.             if(_global.oPerso.perso.persoBody.hitTest(deathZone))
  609.             {
  610.                death();
  611.             }
  612.             i--;
  613.          }
  614.       }
  615.       k = 1;
  616.       if(eval("_global.oGame.moveZone.BG_" + _global.oGame.CurrentBG + ".hitZoneY").hitTest(_global.oPerso.perso._x + _global.oGame.moveZone._x,_global.oPerso.perso._y + _global.oGame.moveZone._y,true))
  617.       {
  618.          while(eval("_global.oGame.moveZone.BG_" + _global.oGame.CurrentBG + ".hitZoneY").hitTest(_global.oPerso.perso._x + _global.oGame.moveZone._x + k,_global.oPerso.perso._y + _global.oGame.moveZone._y,true))
  619.          {
  620.             k = - k;
  621.             if(k < 0)
  622.             {
  623.                k--;
  624.             }
  625.          }
  626.          _global.oPerso.perso._x += k;
  627.       }
  628.       if(_global.downPress && !_global.oPerso.persoIsDucking && !_global.oPerso.persoIsJumping && !_global.oPerso.persoIsFalling)
  629.       {
  630.          _global.oPerso.persoIsDucking = true;
  631.          _global.oPerso.persoXSpeed = 0;
  632.          if(_global.oGame.Bomb.length != 0)
  633.          {
  634.             var i = 0;
  635.             while(i < _global.oGame.Bomb.length)
  636.             {
  637.                if(_global.oGame.Bomb[i].hitZone.hitTest(_global.oPerso.perso))
  638.                {
  639.                   _global.oGame.disarming = false;
  640.                   _global.oGame.persoAnim("disarm");
  641.                   break;
  642.                }
  643.                _global.oGame.persoAnim("dodge");
  644.                i++;
  645.             }
  646.          }
  647.          else
  648.          {
  649.             _global.oGame.persoAnim("dodge");
  650.          }
  651.       }
  652.       else if(_global.rightPress && !_global.leftPress && !_global.oPerso.persoIsDucking)
  653.       {
  654.          if(!_global.oPerso.persoIsJumping && !_global.oPerso.persoIsFalling)
  655.          {
  656.             _global.oPerso.persoIsAttacking = false;
  657.             _global.oGame.persoAnim("run");
  658.          }
  659.          if(_global.oPerso.persoXSpeed < _global.oPerso.persoMaxXSpeed)
  660.          {
  661.             if(_global.oPerso.persoXSpeed < 0)
  662.             {
  663.                _global.oPerso.persoXSpeed = 0;
  664.             }
  665.             _global.oPerso.persoXSpeed += _global.oPerso.persoXAccel;
  666.             if(_global.oPerso.persoXSpeed > _global.oPerso.persoMaxXSpeed)
  667.             {
  668.                _global.oPerso.persoXSpeed = _global.oPerso.persoMaxXSpeed;
  669.             }
  670.          }
  671.          _global.oPerso.perso._xscale = Math.abs(_global.oPerso.perso._xscale);
  672.       }
  673.       else if(_global.leftPress && !_global.rightPress && !_global.oPerso.persoIsDucking)
  674.       {
  675.          if(!_global.oPerso.persoIsJumping && !_global.oPerso.persoIsFalling)
  676.          {
  677.             _global.oPerso.persoIsAttacking = false;
  678.             _global.oGame.persoAnim("run");
  679.          }
  680.          if(_global.oPerso.persoXSpeed > - _global.oPerso.persoMaxXSpeed)
  681.          {
  682.             if(_global.oPerso.persoXSpeed > 0)
  683.             {
  684.                _global.oPerso.persoXSpeed = 0;
  685.             }
  686.             _global.oPerso.persoXSpeed -= _global.oPerso.persoXAccel;
  687.             if(_global.oPerso.persoXSpeed < - _global.oPerso.persoMaxXSpeed)
  688.             {
  689.                _global.oPerso.persoXSpeed = - _global.oPerso.persoMaxXSpeed;
  690.             }
  691.          }
  692.          _global.oPerso.perso._xscale = - Math.abs(_global.oPerso.perso._xscale);
  693.       }
  694.       else if(!_global.oPerso.persoIsJumping && !_global.oPerso.persoIsFalling && !_global.oPerso.persoIsDucking)
  695.       {
  696.          if(_global.oPerso.persoXSpeed < 0)
  697.          {
  698.             _global.oPerso.persoXSpeed += _global.oPerso.persoXDecel;
  699.             if(_global.oPerso.persoXSpeed > 0)
  700.             {
  701.                _global.oPerso.persoXSpeed = 0;
  702.             }
  703.             _global.oGame.persoAnim("run");
  704.          }
  705.          else if(_global.oPerso.persoXSpeed != 0)
  706.          {
  707.             _global.oPerso.persoXSpeed -= _global.oPerso.persoXDecel;
  708.             if(_global.oPerso.persoXSpeed < 0)
  709.             {
  710.                _global.oPerso.persoXSpeed = 0;
  711.             }
  712.             _global.oGame.persoAnim("run");
  713.          }
  714.          else
  715.          {
  716.             _global.oGame.persoAnim("idle");
  717.          }
  718.       }
  719.       if(_global.upPress && !_global.oGame.mover[_global.oPerso.movingBlock].blocking && !_global.stillPressingKeyUp && !_global.oPerso.persoIsTeleporting && !_global.oPerso.persoIsJumping && !_global.oPerso.persoIsFalling && !_global.oGame.inTransit && !_global.oPerso.persoIsDucking)
  720.       {
  721.          _global.oGame.persoAnim("jump");
  722.          _global.oPerso.persoYSpeed = - _global.oPerso.persoJumpSpeed;
  723.          _global.stillPressingKeyUp = true;
  724.       }
  725.    }
  726.    else
  727.    {
  728.       _global.oGame.persoAnim("idle");
  729.       if(_global.oGame.inTransit != 0)
  730.       {
  731.          if(_global.oGame.transitDirectionHorizontal)
  732.          {
  733.             _global.oGame.transitXSpeed = (_global.oGame.moveZone._x - _global.oGame.transitNewX) / _global.oGame.transitAccel;
  734.             _global.oGame.moveZone._x -= _global.oGame.transitXSpeed;
  735.          }
  736.          else
  737.          {
  738.             _global.oGame.transitYSpeed = (_global.oGame.moveZone._y - _global.oGame.transitNewY) / _global.oGame.transitAccel;
  739.             _global.oGame.moveZone._y -= _global.oGame.transitYSpeed;
  740.          }
  741.          if(_global.oGame.transitDirectionHorizontal)
  742.          {
  743.             if(_global.oGame.moveZone._x >= _global.oGame.transitNewX - 2 && _global.oGame.moveZone._x <= _global.oGame.transitNewX + 2)
  744.             {
  745.                _global.oGame.moveZone._x = _global.oGame.transitNewX;
  746.                _global.oGame.inTransit = 0;
  747.                eval("_global.oGame.moveZone.BG_" + _global.oGame.BGLast).removeMovieClip();
  748.             }
  749.          }
  750.          else if(_global.oGame.moveZone._y >= _global.oGame.transitNewY - 2 && _global.oGame.moveZone._y <= _global.oGame.transitNewY + 2)
  751.          {
  752.             _global.oGame.moveZone._y = _global.oGame.transitNewY;
  753.             _global.oGame.inTransit = 0;
  754.             eval("_global.oGame.moveZone.BG_" + _global.oGame.BGLast).removeMovieClip();
  755.          }
  756.       }
  757.    }
  758.    _global.oPerso.movingBlock = -1;
  759.    moverLength = _global.oGame.mover.length;
  760.    var MyObj = 0;
  761.    while(MyObj < moverLength)
  762.    {
  763.       MovingEnterFrame(_global.oGame.mover[MyObj]);
  764.       if(_global.oPerso.perso.hitTest(_global.oGame.mover[MyObj]))
  765.       {
  766.          if(_global.oPerso.perso._y + _global.oGame.moveZone._y - 15 <= _global.oGame.mover[MyObj]._y && !_global.oGame.mover[MyObj].BadGuyMove)
  767.          {
  768.             _global.oPerso.movingBlock = MyObj;
  769.             if(_global.oGame.mover[MyObj].blocking)
  770.             {
  771.                _global.oPerso.perso._x = Math.abs(_global.oGame.moveZone._x) + _global.oGame.mover[MyObj]._x + _global.oGame.mover[MyObj]._width / 2;
  772.                _global.oPerso.persoXSpeed = 0;
  773.                _global.oPerso.persoYSpeed = 0;
  774.             }
  775.          }
  776.       }
  777.       MyObj++;
  778.    }
  779.    _global.oGame.Rolling = false;
  780.    var rollingI = 0;
  781.    while(rollingI < _global.oGame.RollingCarpet.length)
  782.    {
  783.       if(_global.oGame.RollingCarpet[rollingI].hitTest(_global.oPerso.Perso) && _global.oPerso.Perso._y + _global.oPerso.Perso.height <= _global.oGame.RollingCarpet[rollingI]._y + _global.oGame.RollingCarpet[rollingI]._height + _global.oGame.RollingCarpet[rollingI]._parent._y)
  784.       {
  785.          _global.oGame.Rolling = true;
  786.          if(!_global.oPerso.PersoIsJumping && !_global.oPerso.PersoIsFalling)
  787.          {
  788.             if(_global.oPerso.persoXSpeed < 0 && _global.oGame.RollingCarpet[rollingI].speed < 0 || _global.oPerso.persoXSpeed > 0 && _global.oGame.RollingCarpet[rollingI].speed > 0)
  789.             {
  790.                _global.oPerso.persoMaxXSpeed = 5;
  791.             }
  792.             else if(_global.oPerso.persoXSpeed > 0 && _global.oGame.RollingCarpet[rollingI].speed < 0 || _global.oPerso.persoXSpeed < 0 && _global.oGame.RollingCarpet[rollingI].speed > 0)
  793.             {
  794.                _global.oPerso.persoMaxXSpeed = 18;
  795.             }
  796.             _global.oPerso.perso._x -= _global.oGame.RollingCarpet[rollingI].speed;
  797.          }
  798.       }
  799.       if(_global.oGame.RollingCarpet[rollingI].hitTest(_global.oGame.RollingCarpet[rollingI]._parent.bomb01))
  800.       {
  801.          _global.oGame.RollingCarpet[rollingI]._parent.bomb01._x -= _global.oGame.RollingCarpet[rollingI].speed;
  802.       }
  803.       if(_global.oGame.RollingCarpet[rollingI].hitTest(_global.oGame.RollingCarpet[rollingI]._parent.bomb31))
  804.       {
  805.          _global.oGame.RollingCarpet[rollingI]._parent.bomb31._x -= _global.oGame.RollingCarpet[rollingI].speed;
  806.       }
  807.       rollingI++;
  808.    }
  809.    if(_global.oGame.Rolling == false)
  810.    {
  811.       _global.oPerso.persoMaxXSpeed = 16;
  812.    }
  813.    BadGuyLength = _global.oGame.BadGuysHitZone.length;
  814.    var i = 0;
  815.    while(i < BadGuyLength)
  816.    {
  817.       if(_global.oPerso.perso.persoBody.hitTest(_global.oGame.BadGuysHitZone[i]) && !_global.oPerso.persoIsInPain)
  818.       {
  819.          _global.oPerso.persoIsDucking = false;
  820.          pt = new Object();
  821.          pt.x = _global.oGame.BadGuysHitZone[i]._x;
  822.          pt.y = _global.oGame.BadGuysHitZone[i]._y;
  823.          var temp = pt.x + _global.ogame.movezone._x;
  824.          _root.texte.text = "HitZoneX = " + temp + " : BatmanX = " + _global.oPerso.perso._x;
  825.          if(_global.oPerso.perso._x > temp)
  826.          {
  827.             _global.oPerso.persoXSpeed = 0;
  828.             _global.oPerso.persoXSpeed += 15;
  829.          }
  830.          else if(_global.oPerso.perso._x < temp)
  831.          {
  832.             _global.oPerso.persoXSpeed = 0;
  833.             _global.oPerso.persoXSpeed -= 15;
  834.          }
  835.          _global.leftPress = false;
  836.          _global.rightPress = false;
  837.          _global.upPress = false;
  838.          _global.downPress = false;
  839.          _global.keyListen = false;
  840.          restoreListener.gotoAndPlay(2);
  841.       }
  842.       i++;
  843.    }
  844.    BombLength = _global.oGame.Bomb.length;
  845.    var i = 0;
  846.    while(i < BombLength)
  847.    {
  848.       if(_global.oPerso.persoIsDucking && _global.oGame.Bomb[i].hitZone.hitTest(_global.oPerso.perso) && _global.oGame.disarming == true)
  849.       {
  850.          _global.oGame.Bomb[i].gotoAndStop(1);
  851.          _global.oGame.Bomb[i].colorChange.gotoAndPlay(2);
  852.          _global.scoreTotal = Number(_global.scoreTotal) + 750;
  853.          batmanIcon.showScore.text = _global.scoreTotal;
  854.          batmanIcon.timeBonus += Number(_global.oGame.Bomb[i].countdown.text);
  855.          _global.remainingTime += Number(_global.oGame.Bomb[i].countdown.text) * Number(_global.oGame.Bomb[i].countdown.text);
  856.          if(_global.oGame.Bomb.length == 1)
  857.          {
  858.             _global.scoreTotal = Number(_global.scoreTotal) + _global.remainingTime * 1000;
  859.             batmanIcon.showScore.text = _global.scoreTotal;
  860.             batmanIcon.gotoAndPlay(2);
  861.             _global.remainingTime = 0;
  862.             if(_global.oGame.CurrentBG != _global.oGame.BGFinal)
  863.             {
  864.                _global.oGame.Bomb[i]._parent.arrow.gotoAndStop(2);
  865.                if(_global.oGame.Bomb[i]._parent.hitZoneY.hitPorte)
  866.                {
  867.                   _global.oGame.Bomb[i]._parent.hitZoneY.hitPorte.gotoAndStop(2);
  868.                }
  869.                else
  870.                {
  871.                   _global.oGame.PlaySound("platformStart");
  872.                   _global.oGame.Bomb[i]._parent.animElev.gotoAndPlay(2);
  873.                }
  874.             }
  875.             else
  876.             {
  877.                batmanIcon.finished = true;
  878.             }
  879.          }
  880.          _global.oGame.RemoveBomb(_global.oGame.Bomb[i]);
  881.          break;
  882.       }
  883.       i++;
  884.    }
  885.    FallingBombLength = _global.oGame.FallingBomb.length;
  886.    var i = 0;
  887.    while(i < FallingBombLength)
  888.    {
  889.       if(_global.oGame.FallingBomb[i].hitTest(_global.oPerso.perso))
  890.       {
  891.          _global.oGame.FallingBomb[i].onEnterFrame = function()
  892.          {
  893.             this.fall();
  894.          };
  895.          _global.oGame.RemoveFallingBomb(_global.oGame.FallingBomb[i]);
  896.          break;
  897.       }
  898.       i++;
  899.    }
  900. };
  901. stop();
  902.