home *** CD-ROM | disk | FTP | other *** search
- if(getTimer() - startTime > 1000)
- {
- startTime += 1000;
- _root.console.time--;
- if(_root.console.time == 0)
- {
- gotoAndPlay(9);
- }
- }
- if(Key.isDown(_global.opt.keyUp))
- {
- i = 0;
- while(i < 2)
- {
- clowns[i].plankX += 0.1 * clowns[i].mirrorX;
- i++;
- }
- }
- if(Key.isDown(_global.opt.keyDown))
- {
- i = 0;
- while(i < 2)
- {
- clowns[i].plankX -= 0.1 * clowns[i].mirrorX;
- i++;
- }
- }
- i = 0;
- while(i < 2)
- {
- if(Math.abs(clowns[i].plankX < 0))
- {
- clowns[i].plankX = 0;
- }
- if(Math.abs(clowns[i].plankX > 1))
- {
- clowns[i].plankX = 1;
- }
- i++;
- }
- if(Key.isDown(_global.opt.keyRight))
- {
- if(vx < 0)
- {
- vx = 0;
- }
- vx += ax;
- if(vx > vxMax)
- {
- vx = vxMax;
- }
- }
- if(Key.isDown(_global.opt.keyLeft))
- {
- if(vx > 0)
- {
- vx = 0;
- }
- vx -= ax;
- if(vx < -1 * vxMax)
- {
- vx = -1 * vxMax;
- }
- }
- plankTargetX = mainSprite._x + vx;
- if(Math.abs(vx) > 0)
- {
- mainSprite.cycle.monkey.play();
- mainSprite.cycle.monkeyLeg.play();
- mainSprite.cycle.play();
- }
- else
- {
- mainSprite.cycle.monkey.stop();
- mainSprite.cycle.monkeyLeg.stop();
- mainSprite.cycle.stop();
- }
- vx = 0;
- if(plankTargetX > wallRight)
- {
- plankTargetX = wallRight;
- vx = 0;
- }
- if(plankTargetX < wallLeft)
- {
- plankTargetX = wallLeft;
- vx = 0;
- }
- mainSprite._x = plankTargetX;
- i = 0;
- while(i < 2)
- {
- if(clowns[i].mode == MODE_FLYING)
- {
- clowns[i].vy += gravity;
- clowns[i].targetX = clowns[i]._x + clowns[i].vx;
- clowns[i].targetY = clowns[i]._y + clowns[i].vy;
- clowns[i].plankX = calcPlankLandingX(i);
- if(clowns[i].vy > 0 && clowns[i].targetY > wippeTop && calcOnPlankY(i) <= clowns[i].targetY)
- {
- if(clowns[i].plankX > 1 || clowns[i].plankX < 0)
- {
- if(clowns[i].targetY > axisY)
- {
- clowns[i]._y = wallBottom - 7;
- clowns[i].mode = MODE_RETURNING;
- tDamage = Math.abs(clowns[i].vy) * 0.07 - 0.5;
- tDamage *= 1.3;
- if(tDamage < 0)
- {
- tDamage = 0;
- }
- damageHealth(clowns[i],tDamage);
- clowns[i].vy = 0;
- clowns[i].plankX = 0.7;
- }
- }
- else
- {
- if(clowns[i].vy < 4)
- {
- clowns[i].vy = 4;
- }
- vr = clowns[i].vy * clowns[i].mirrorX;
- clowns[i].mode = MODE_STANDING;
- clowns[i].gotoAndStop("standing");
- clowns[i].partner.gotoAndStop("prejump");
- }
- }
- clowns[i].plankX = Math.abs(clowns[i].plankX);
- }
- if(clowns[i].mode == MODE_FLYING)
- {
- clowns[i]._x = clowns[i].targetX;
- clowns[i]._y = clowns[i].targetY;
- }
- else if(clowns[i].mode == MODE_RETURNING && clowns[i].health > 0)
- {
- if(clowns[i]._x < -50)
- {
- clowns[i]._x = -50;
- }
- if(clowns[i]._x > 600)
- {
- clowns[i]._x = 600;
- }
- if(Math.abs(clowns[i]._x - calcOnPlankX(i)) > 4)
- {
- if(clowns[i]._x > calcOnPlankX(i))
- {
- clowns[i]._x -= 5;
- clowns[i].gotoAndStop("walk_left");
- }
- else
- {
- clowns[i]._x += 5;
- clowns[i].gotoAndStop("walk_right");
- }
- }
- else
- {
- clowns[i].mode = MODE_FLYING;
- clowns[i].gotoAndStop("jump_" + clowns[i].lookDir);
- clowns[i].vx = 0;
- clowns[i].vy = -5;
- }
- }
- else if(clowns[i].mode == MODE_STANDING)
- {
- clowns[i]._x = calcOnPlankX(i);
- clowns[i]._y = calcOnPlankY(i);
- }
- i++;
- }
- plankTargetR = mainSprite.plank._rotation + vr * 2;
- if(Math.abs(plankTargetR) > mainSprite.plank.maxRotation)
- {
- if(plankTargetR > 0)
- {
- clownLeft.mode = MODE_FLYING;
- clownLeft.gotoAndStop("fly_right");
- clownLeft.vy = -0.9 * Math.abs(vr) * (Math.abs(clownRight.plankX) + 0.7);
- clownLeft.vx = -1 * Math.abs(vr) * (Math.abs(clownLeft.plankX) - 0.7);
- mainSprite.plank._rotation = mainSprite.plank.maxRotation;
- }
- else
- {
- clownRight.mode = MODE_FLYING;
- clownRight.gotoAndStop("fly_left");
- clownRight.vy = -0.9 * Math.abs(vr) * (Math.abs(clownLeft.plankX) + 0.7);
- clownRight.vx = 1 * Math.abs(vr) * (Math.abs(clownRight.plankX) - 0.7);
- mainSprite.plank._rotation = -1 * mainSprite.plank.maxRotation;
- }
- vr = 0;
- }
- else
- {
- mainSprite.plank._rotation = plankTargetR;
- }
- if(clowns[0].mode == MODE_FLYING)
- {
- flyingClown = clowns[0];
- }
- else
- {
- flyingClown = clowns[1];
- }
- i = 0;
- while(i < sensorAmount)
- {
- if(sensors[i].active)
- {
- if(matterHitTest(flyingClown._x,flyingClown._y,i))
- {
- if(sensors[i].dieAtDanger)
- {
- if(deadlyHitTest(flyingClown._x,flyingClown._y,i))
- {
- canMove = true;
- gotoAndPlay(7);
- }
- }
- if(sensors[i].hitObjects)
- {
- hits = objectsHitTest(flyingClown._x,flyingClown._y,i);
- hitI = 0;
- while(true)
- {
- if(!hits[hitI])
- {
- break;
- }
- hits[hitI].touch();
- hitI++;
- }
- }
- }
- }
- i++;
- }
- if(needCollect <= 0)
- {
- gotoAndPlay(11);
- }
-