home *** CD-ROM | disk | FTP | other *** search
- if(watertouch eq true)
- {
- if(Key.isDown(Key.LEFT))
- {
- modThrust = 0.15;
- }
- else if(Key.isDown(Key.RIGHT))
- {
- modThrust = -0.25;
- }
- else
- {
- modThrust = -0.1;
- }
- }
- else
- {
- modThrust = -0.06;
- }
- shootX = _root.clickX;
- shootY = _root.clickY;
- gunX = boatX + _root.boat.unit._X;
- gunY = boatY + _root.boat.unit._Y;
- aimX = _root._xmouse;
- aimY = _root._ymouse;
- shootHyp = Math.sqrt((gunX - aimX) * (gunX - aimX) + (gunY - aimY) * (gunY - aimY));
- shootRad = Math.acos((gunX - aimX) / shootHyp);
- shootAng = shootRad * 57.29577951308232;
- _root.boat.unit.unitGun._rotation = shootAng - 90 - boatSlope;
- if(_root.fire and NrOfShots < 2)
- {
- NrOfShots++;
- if(shootNr eq 3)
- {
- shootNr = 0;
- }
- else
- {
- shootNr++;
- }
- shootSpeed = shootHyp / 20;
- shot[shootNr].shootSpeedX = - shootSpeed * Math.cos(shootRad);
- shot[shootNr].shootSpeedY = - shootSpeed * Math.sin(shootRad);
- shot[shootNr].shootX = gunX;
- shot[shootNr].shootY = gunY;
- shot[shootNr].timer = 20;
- bullet = eval("_root.bullet" + shootNr);
- _root.bullet._x = shot[shootNr].shootX;
- _root.bullet._y = shot[shootNr].shootY;
- _root.bullet._rotation = shootAng - 90;
- _root.bullet.gotoAndStop(1);
- _root.fire = false;
- }
- i = 0;
- while(i < 4)
- {
- bullet = eval("_root.bullet" + i);
- shot[i].shootY += shot[i].shootSpeedY;
- shot[i].shootX += shot[i].shootSpeedX + boatXspeed;
- bullet._x = shot[i].shootX;
- bullet._y = shot[i].shootY;
- if(-1 < shot[i].timer)
- {
- shot[i].timer--;
- if(0 >= shot[i].timer)
- {
- shot[i].shootSpeedX = 0;
- shot[i].shootSpeedY = 0;
- grenadeexp.start();
- bullet.play();
- shot[i].timer = -1;
- NrOfShots--;
- t = 0;
- while(t < FooTotal.length)
- {
- planeObj = FooTotal[t];
- if(planeObj.planeX < 600 and -80 < planeObj.planeX and 0 < planeObj.health)
- {
- foX = planeObj.planeX;
- foY = planeObj.planeY;
- ppX = shot[i].shootX;
- ppY = shot[i].shootY;
- damageHyp = Math.sqrt((ppX - foX) * (ppX - foX) + (ppY - foY) * (ppY - foY));
- if(damageHyp < 20)
- {
- planeClip = eval("_root." + planeObj.name);
- planeClip.gotoAndPlay("HIT");
- planeObj.health -= 1;
- if(planeObj.health < 1)
- {
- planeClip.gotoAndPlay("ROLL");
- planeObj.fallspeed = 0.1;
- planeObj.tilt = -1;
- }
- }
- }
- t++;
- }
- }
- }
- i++;
- }
- waveXspeed = curentXspeed + boatXspeed;
- tmpWaveX = waveX + waveXspeed;
- if(tmpWaveX < newWaveValue)
- {
- waveX += waveXspeed;
- }
- else
- {
- newWaveValue += waveLength;
- newx = (- waveLength) * wavesPast;
- wavechange = eval("_root.waveGrid.wave" + w);
- wavechange._x = newx;
- wavechange._yscale = waveArray[w].size * 14;
- if(w eq 0)
- {
- w = 4;
- }
- else
- {
- w--;
- }
- wavesPast++;
- if(w < 2)
- {
- currentWave = w + 3;
- }
- else
- {
- currentWave = w - 2;
- }
- waveSize = waveArray[currentWave].size;
- waveCurve = waveSize * 2.5;
- waveJumpPoint = - (waveSize * 2 - 1);
- waveX += waveXspeed;
- }
- waveOldHeight = waveHeight;
- waveHeight = waveSize * Math.sin(6.283185307179586 / waveLength * (waveX + waveLength * 0.25));
- waveHeight -= waveSize;
- waveSlope = waveCurve * Math.sin(6.283185307179586 / waveLength * waveX);
- waveYforce = waveHeight - waveOldHeight;
- waveY = waveHeight + waterYline;
- if(waveHeight < waveJumpPoint and 3 < boatXspeed and watertouch eq true and 10 < nextJump)
- {
- nextjump = 0;
- jumpHeight = 0;
- watertouch = false;
- jump = true;
- tmpAccSlope = AccSlope;
- if(tmpAccSlope < 0)
- {
- tmpAccSlope = 0;
- }
- upForce = - boatXspeed * (waveSize / 15) * (1 + tmpAccSlope / 8);
- }
- if(jump eq true)
- {
- if(jumpHeight < waterYline - boatY)
- {
- jumpHeight = waterYline - boatY;
- jumpHeighttxt = Math.round(jumpHeight * 100) / 100;
- recordlineY = boatY;
- }
- boatY += upForce;
- upForce += grav;
- boatSlope -= 0.5;
- if(waveY < boatY)
- {
- if(jumpRecord < jumpHeight)
- {
- jumpRecord = jumpHeight;
- jumpRecordtxt = Math.round(jumpRecord * 100) / 100;
- _root.recordline._y = recordlineY;
- }
- if(s eq 1)
- {
- s = 0;
- }
- else
- {
- s = 1;
- }
- splash = eval("_root.splash" + s);
- _root.splash._yscale = upForce * 5;
- _root.splash._x = boatX;
- _root.splash._y = waveY;
- _root.splash._visible = true;
- _root.splash.play();
- jump = false;
- watertouch = true;
- BoatAcc -= waveSlope / 10;
- boatY = waveY;
- boatSlope = waveSlope;
- }
- }
- else
- {
- boatY = waveY;
- boatSlope = waveSlope;
- }
- boatAcc += modThrust;
- if(boatAcc < 0)
- {
- boatAcc = 0;
- }
- if(10 < boatAcc)
- {
- boatAcc = 10;
- }
- boatOldSpeed = boatXspeed;
- boatXspeed = boatTopSpeed * Math.sin(0.3141592653589793 * (boatAcc - 5));
- boatXspeed += boatTopSpeed;
- boatXspeed /= 2;
- if(boatXspeed < 0)
- {
- boatXspeed = 0;
- }
- BoatAccelerate = (boatXspeed - boatOldSpeed) * 50;
- if(AccSlope < BoatAccelerate)
- {
- AccSlope += 0.5;
- }
- else if(BoatAccelerate < AccSlope - 1)
- {
- AccSlope -= 0.5;
- }
- nextjump += 1;
- levelplacement += boatXspeed;
- mapfooX = FooTotal[0].planeX / 10;
- mapunitX = - levelplacement / 10;
- _root.map.mapunit._x = mapunitX;
- _root.map.mapfoo._x = mapfooX;
- i = 0;
- while(i < FooTotal.length)
- {
- planeObj = FooTotal[i];
- planeObj.planeX -= planeObj.speed - boatXspeed;
- planeObj.elevation += planeObj.fallspeed;
- planeObj.planeY += planeObj.elevation;
- planeObj.rotation += planeObj.tilt;
- if(planeObj.planeX < 600 and -80 < planeObj.planeX)
- {
- if(typeof eval(planeObj.name) ne "movieclip")
- {
- planedepth++;
- plane.duplicateMovieClip(planeObj.name,planedepth);
- }
- planeClip = eval("_root." + planeObj.name);
- planeClip._x = planeObj.planeX;
- planeClip._Y = planeObj.planeY;
- planeClip._rotation = planeObj.rotation;
- if(waterYline < planeObj.planeY)
- {
- _root.splash10._yscale = 50;
- _root.splash10._x = planeObj.planeX;
- _root.splash10._y = waterYline;
- trace("SPLASH");
- _root.splash10.gotoAndPlay(2);
- planeObj.planeX = 600;
- planeObj.planeY = 100;
- planeObj.speed = 0;
- planeObj.fallspeed = 0;
- planeObj.elevation = 0;
- }
- }
- else
- {
- planeClip = eval("_root." + planeObj.name);
- planeClip.removeMovieClip();
- }
- i++;
- }
- _root.splash10._x += waveXspeed;
- _root.bubbles._x += waveXspeed;
- _root.splash0._x += waveXspeed;
- _root.splash1._x += waveXspeed;
- _root.waveGrid._x = waveX;
- _root.boat._y = boatY;
- _root.boat._x = boatX;
- _root.boat._rotation = boatSlope + AccSlope * 2;
- if(-4 < _root.background._x)
- {
- _root.background._x = -530;
- }
- else
- {
- _root.background._x += boatXspeed / 5;
- }
- if(560 < _root.island._x)
- {
- _root.island._x = -20;
- }
- else
- {
- _root.island._x += boatXspeed / 2;
- }
-