home *** CD-ROM | disk | FTP | other *** search
- if(!clockStop)
- {
- if(_root.minLeft < 0 and inTransit == 0)
- {
- _parent.timeUp.play();
- _root.minLeft = 0;
- _root.secLeft = 0;
- _root.milLeft = 0;
- persoIsDying = true;
- _parent.life["life_" + _root.persoLife].gotoAndPlay("close");
- _root.persoLife--;
- if(_root.persoLife <= 0)
- {
- _parent.gotoAndStop("gameOver");
- }
- else
- {
- persoIsInPain = false;
- resetPlay();
- }
- }
- _root.milLeft -= 3.3;
- if(_root.milLeft <= 0)
- {
- _root.milLeft = 99;
- _root.secLeft--;
- if(_root.secLeft < 0)
- {
- _root.secLeft = 59;
- _root.minLeft--;
- if(_root.minLeft < 0 and inTransit == 0)
- {
- _parent.timeUp.play();
- _root.minLeft = 0;
- _root.secLeft = 0;
- _root.milLeft = 0;
- persoIsDying = true;
- _parent.life["life_" + _root.persoLife].gotoAndPlay("close");
- _root.persoLife--;
- if(_root.persoLife <= 0)
- {
- _parent.gotoAndStop("gameOver");
- }
- else
- {
- persoIsInPain = false;
- resetPlay();
- }
- }
- }
- }
- _root.minLeftTxt = fixedDigit(_root.minLeft,2);
- _root.secLeftTxt = fixedDigit(_root.secLeft,2);
- _root.milLeftTxt = fixedDigit(Math.floor(_root.milLeft),2);
- }
- if(persoXSpeed != 0)
- {
- persoIsRunning = true;
- }
- if(persoYSpeed < 0)
- {
- persoIsJumping = true;
- persoIsFalling = false;
- }
- else if(persoYSpeed > 0)
- {
- persoIsBouncing = false;
- persoIsFalling = true;
- persoIsJumping = false;
- persoAnim("fall");
- }
- if(!persoIsInvisible)
- {
- if(persoIsRunning)
- {
- perso._x += persoXSpeed;
- }
- persoYSpeed += persoJumpDecel;
- if(persoYSpeed > persoMaxYSpeed)
- {
- persoYSpeed = persoMaxYSpeed;
- }
- perso._y += persoYSpeed;
- }
- if(inTransit == 0)
- {
- if(perso._x + _parent.moveZone._x > BGWidth + 10)
- {
- if(!persoIsDying)
- {
- transitTo(1);
- }
- }
- else if(perso._x + _parent.moveZone._x < -20)
- {
- if(!persoIsDying)
- {
- transitTo(-1);
- }
- }
- }
- else
- {
- transitXSpeed = (_parent.moveZone._x - transitNewX) / transitAccel;
- _parent.moveZone._x -= transitXSpeed;
- if(_parent.moveZone._x >= transitNewX - 2 and _parent.moveZone._x <= transitNewX + 2)
- {
- _parent.moveZone._x = transitNewX;
- inTransit = 0;
- _quality = "HIGH";
- eval("_parent.moveZone.BG_" + BGLast).removeMovieClip();
- eval("_parent.moveZone.overlay_" + BGLast).removeMovieClip();
- }
- }
- if(!persoIsJumping)
- {
- if(persoIsFalling and persoYSpeed > accroche)
- {
- j = persoMaxYSpeed;
- }
- else
- {
- j = accroche;
- }
- i = 0;
- while(i <= j)
- {
- if(_parent.moveZone["BG_" + BGCur].hitZoneX.hitTest(perso._x + _parent.moveZone._x,perso._y + _parent.moveZone._y - i,true))
- {
- perso._y -= i;
- if(persoIsFalling)
- {
- if(persoYSpeed > 0 and perso._y > Number(persoFallStart + persoLandTreshold))
- {
- persoAnim("land");
- persoXSpeed = 0;
- }
- else
- {
- persoIsLanding = false;
- persoXSpeed = Math.floor(persoXSpeed / 2);
- }
- persoIsAttacking = false;
- persoIsFalling = false;
- persoIsBouncing = false;
- }
- persoYSpeed = 0;
- }
- else if(perso._y > deathY and !persoIsDying)
- {
- trace("Death from above at Y = " + perso._y);
- death();
- }
- i++;
- }
- }
- k = 1;
- if(_parent.moveZone["BG_" + BGCur].hitZoneY.hitTest(perso._x + _parent.moveZone._x,perso._y + _parent.moveZone._y,true))
- {
- while(_parent.moveZone["BG_" + BGCur].hitZoneY.hitTest(perso._x + _parent.moveZone._x + k,perso._y + _parent.moveZone._y,true))
- {
- k = - k;
- if(k < 0)
- {
- k--;
- }
- }
- perso._x += k;
- if(wbEnabled and Key.isDown(38) and persoIsJumping)
- {
- s1.gotoAndPlay("swish_13");
- persoXSpeed = (- persoXSpeed) / 1.2;
- if(persoXSpeed < 0)
- {
- perso._xscale = - Math.abs(perso._xscale);
- }
- else if(persoXSpeed > 0)
- {
- perso._xscale = Math.abs(perso._xscale);
- }
- persoIsBouncing = true;
- c.persoAnim("jump");
- persoYSpeed = - persoJumpSpeed;
- stillPressingKeyUp = true;
- keyUpListener.onKeyUp = function()
- {
- if(!Key.isDown(38))
- {
- stillPressingKeyUp = false;
- keyUpListener.onKeyUp = null;
- }
- };
- }
- else
- {
- persoXSpeed = 0;
- if(Key.isDown(37))
- {
- persoXSpeed = -2;
- }
- else if(Key.isDown(39))
- {
- persoXSpeed = 2;
- }
- }
- }
- if(!persoIsDying and !persoIsInPain)
- {
- if(Key.isDown(32) and attEnabled and !persoIsTeleporting and !stillPressingKeyAtt and !persoIsBusy)
- {
- if(!persoIsJumping and !persoIsFalling)
- {
- persoIsAttacking = true;
- c.persoAnim("attack");
- persoXSpeed = 0;
- stillPressingKeyAtt = true;
- keyAttListener.onKeyUp = function()
- {
- if(!Key.isDown(32))
- {
- stillPressingKeyatt = false;
- keyAttListener.onKeyUp = null;
- }
- };
- }
- }
- else if(Key.isDown(40) and !persoIsTeleporting and !persoIsJumping and !persoIsFalling and !persoIsAttacking and !persoIsBusy)
- {
- persoIsAttacking = false;
- persoIsCrouching = true;
- persoXSpeed = 0;
- c.persoAnim("crouch");
- }
- else if(Key.isDown(39) and !Key.isDown(37) and !persoIsTeleporting and !persoIsAttacking and !persoIsBouncing and !persoIsBusy)
- {
- if(!persoIsJumping and !persoIsFalling)
- {
- persoIsAttacking = false;
- c.persoAnim("run");
- }
- if(persoXSpeed < persoMaxXSpeed)
- {
- if(persoXSpeed < 0)
- {
- persoXSpeed = 0;
- }
- persoXSpeed += persoXAccel;
- if(persoXSpeed > persoMaxXSpeed)
- {
- persoXSpeed = persoMaxXSpeed;
- }
- }
- perso._xscale = Math.abs(perso._xscale);
- }
- else if(Key.isDown(37) and !Key.isDown(39) and !persoIsTeleporting and !persoIsAttacking and !persoIsBouncing and !persoIsBusy)
- {
- if(!persoIsJumping and !persoIsFalling)
- {
- persoIsAttacking = false;
- c.persoAnim("run");
- }
- if(persoXSpeed > - persoMaxXSpeed)
- {
- if(persoXSpeed > 0)
- {
- persoXSpeed = 0;
- }
- persoXSpeed -= persoXAccel;
- if(persoXSpeed < - persoMaxXSpeed)
- {
- persoXSpeed = - persoMaxXSpeed;
- }
- }
- perso._xscale = - Math.abs(perso._xscale);
- }
- else if(!persoIsJumping and !persoIsFalling)
- {
- if(persoXSpeed < 0)
- {
- persoXSpeed += persoXDecel;
- if(persoXSpeed > 0)
- {
- persoXSpeed = 0;
- }
- c.persoAnim("run");
- }
- else if(persoXSpeed != 0)
- {
- persoXSpeed -= persoXDecel;
- if(persoXSpeed < 0)
- {
- persoXSpeed = 0;
- }
- c.persoAnim("run");
- }
- else
- {
- c.persoAnim("idle");
- }
- }
- if(Key.isDown(38) and !stillPressingKeyUp and !persoIsTeleporting and !persoIsJumping and !persoIsFalling and !persoIsBusy)
- {
- c.persoAnim("jump");
- persoYSpeed = - (persoJumpSpeed + Math.abs(persoXSpeed) / 5);
- stillPressingKeyUp = true;
- keyUpListener.onKeyUp = function()
- {
- if(!Key.isDown(38))
- {
- stillPressingKeyUp = false;
- keyUpListener.onKeyUp = null;
- }
- };
- }
- }
- else if(!stillPressingKeyAtt)
- {
- persoIsAttacking = false;
- }
-