home *** CD-ROM | disk | FTP | other *** search
- function restartLeg()
- {
- if(Key.isDown(32))
- {
- gotoAndStop("restartSlideShow3");
- }
- }
- function moveBG(target, bg)
- {
- bg._x -= Math.cos(target.radians) * target.speed + Math.cos(target.momentumRad) * target.momentumSpeed;
- bg._y -= Math.sin(target.radians) * target.speed + Math.sin(target.momentumRad) * target.momentumSpeed;
- }
- function moveClouds(target, bg)
- {
- bg._x -= (Math.cos(target.radians) * target.speed + Math.cos(target.momentumRad) * target.momentumSpeed) * 2;
- bg._y -= (Math.sin(target.radians) * target.speed + Math.sin(target.momentumRad) * target.momentumSpeed) * 2;
- }
- function hitDock(target, dock)
- {
- if(tutorialMap_mc.tutorialDocks_mc.hitTest(target._x,target._y,true) && target.speed < 0.5 && target.momentumSpeed < 0.5)
- {
- target.finished = true;
- grats_txt.text = "Congratulations, you\'ve completed the tutorial. You\'re now rady to sail!";
- }
- }
- function turnIt(target)
- {
- if(Key.isDown(37))
- {
- target._rotation -= target.turning;
- target.degrees -= target.turning;
- if(target.degrees < 0)
- {
- target.degrees += 360;
- }
- tutorialShipLayer_mc.ship3d_mc.gotoAndStop(Math.floor(target.degrees / 12));
- }
- if(Key.isDown(39))
- {
- target._rotation += target.turning;
- target.degrees += target.turning;
- if(target.degrees > 360)
- {
- target.degrees -= 360;
- }
- tutorialShipLayer_mc.ship3d_mc.gotoAndStop(Math.floor(target.degrees / 12));
- }
- if(target.hitStorm)
- {
- target._rotation += target.turning * 2;
- target.degrees += target.turning * 2;
- if(target.degrees > 360)
- {
- target.degrees -= 360;
- }
- tutorialShipLayer_mc.ship3d_mc.gotoAndStop(Math.floor(target.degrees / 12));
- }
- target.radians = (target._rotation + 30) * 3.141592653589793 / 180;
- }
- function changeSpeed(target)
- {
- target.momentumSpeed *= 0.97;
- if(target.momentumSpeed < 0.05)
- {
- target.momentumSpeed = 0;
- }
- if(Key.isDown(38) && target.speed < target.maxSpeed)
- {
- target.speed += target.acceleration;
- if(target.speed > target.maxSpeed)
- {
- target.speed = target.maxSpeed;
- }
- if(target.momentumSpeed < target.speed)
- {
- target.momentumSpeed = target.speed;
- }
- target.momentumRad = target.radians;
- }
- else
- {
- target.speed *= 0.96;
- }
- if(Key.isDown(40) && target.speed > 0)
- {
- target.speed -= target.braking;
- if(target.speed < 0.05)
- {
- target.speed = 0;
- }
- }
- if(target.speed < 0.05)
- {
- target.speed = 0;
- }
- if(target.hitLand)
- {
- target.speed = 0.5;
- target.momentumSpeed = 0;
- if(pointsMinus_mc._currentframe == 1)
- {
- pointsMinus_mc.displayText = "4";
- pointsMinus_mc.gotoAndPlay("start");
- if(timer.seconds >= 4)
- {
- timer.seconds -= 4;
- }
- else
- {
- timer.seconds = 0;
- }
- }
- }
- else if(target.hitIceBerg)
- {
- target.speed = 0.5;
- target.momentumSpeed = 0;
- if(pointsMinus_mc._currentframe == 1)
- {
- pointsMinus_mc.displayText = "3";
- pointsMinus_mc.gotoAndPlay("start");
- if(timer.seconds >= 3)
- {
- timer.seconds -= 3;
- }
- else
- {
- timer.seconds = 0;
- }
- }
- }
- else if(target.hitRock)
- {
- target.speed = 0.5;
- target.momentumSpeed = 0;
- if(pointsMinus_mc._currentframe == 1)
- {
- pointsMinus_mc.displayText = "2";
- pointsMinus_mc.gotoAndPlay("start");
- if(timer.seconds >= 2)
- {
- timer.seconds -= 2;
- }
- else
- {
- timer.seconds = 0;
- }
- }
- }
- else if(target.hitWhale)
- {
- target.speed = 0.5;
- target.momentumSpeed = 0;
- if(pointsMinus_mc._currentframe == 1)
- {
- pointsMinus_mc.displayText = "3";
- pointsMinus_mc.gotoAndPlay("start");
- if(timer.seconds >= 3)
- {
- timer.seconds -= 3;
- }
- else
- {
- timer.seconds = 0;
- }
- }
- }
- }
- stop();
- _quality = "HIGH";
- detailToggle_mc._visible = false;
- soundToggle_mc._visible = false;
- tutorialShip_mc._rotation = _global.shipRotation;
- switch(_global.shipClass)
- {
- case "A":
- tutorialShipLayer_mc.attachMovie("shipA","ship3d_mc",1);
- tutorialShipLayer_mc.ship3d_mc._x = 231;
- tutorialShipLayer_mc.ship3d_mc._y = 178;
- tutorialShip_mc.radians = (tutorialShip_mc._rotation + 30) * 3.141592653589793 / 180;
- tutorialShip_mc.maxSpeed = 6;
- tutorialShip_mc.acceleration = 0.1;
- tutorialShip_mc.braking = 2;
- tutorialShip_mc.turning = 12;
- break;
- case "B":
- tutorialShipLayer_mc.attachMovie("shipB","ship3d_mc",1);
- tutorialShipLayer_mc.ship3d_mc._x = 231;
- tutorialShipLayer_mc.ship3d_mc._y = 178;
- tutorialShip_mc.radians = (tutorialShip_mc._rotation + 30) * 3.141592653589793 / 180;
- tutorialShip_mc.maxSpeed = 5.5;
- tutorialShip_mc.acceleration = 0.2;
- tutorialShip_mc.braking = 2;
- tutorialShip_mc.turning = 12;
- break;
- case "C":
- tutorialShipLayer_mc.attachMovie("shipC","ship3d_mc",1);
- tutorialShipLayer_mc.ship3d_mc._x = 231;
- tutorialShipLayer_mc.ship3d_mc._y = 178;
- tutorialShip_mc.radians = (tutorialShip_mc._rotation + 30) * 3.141592653589793 / 180;
- tutorialShip_mc.maxSpeed = 5;
- tutorialShip_mc.acceleration = 0.5;
- tutorialShip_mc.braking = 2;
- tutorialShip_mc.turning = 12;
- }
- tutorialShip_mc.degrees = _global.shipRotation;
- tutorialShipLayer_mc.ship3d_mc.gotoAndStop(Math.floor(tutorialShip_mc.degrees / 12));
- tutorialShip_mc.momentumRad = tutorialShip_mc.radians;
- tutorialShip_mc.momentumSpeed = 0;
- tutorialShip_mc.speed = 0;
- tutorialShip_mc.waterTrail = 0;
- tutorialShip_mc.orangeBuoys = 0;
- tutorialShip_mc.hitLand = false;
- tutorialShip_mc.hitIceBerg = false;
- tutorialShip_mc.hitRock = false;
- tutorialShip_mc.hitStorm = false;
- tutorialShip_mc.finished = false;
- tutorialShip_mc.onEnterFrame = function()
- {
- if(!tutorialShip_mc.finished)
- {
- moveBG(this,tutorialMap_mc);
- changeSpeed(this);
- turnIt(this);
- hitDock(this,_global.nextDock);
- restartLeg();
- }
- else
- {
- restartLeg();
- }
- };
- tutorialFadeToBlack_mc.onEnterFrame = function()
- {
- if(tutorialShip_mc.finished && this._alpha < 65)
- {
- this._alpha += 5;
- }
- if(tutorialShip_mc.finished && gratsText_mc._alpha < 100)
- {
- gratsText_mc._alpha += 10;
- }
- };
- btnNext_mc.onRelease = function()
- {
- gotoAndStop("selectBoat");
- play();
- };
- btnBack_mc.onRelease = function()
- {
- gotoAndStop("slideShow2");
- play();
- };
-