Frame 1
stop();
Frame 2
stop();
var creditsStatus = 1;
logo_clip.credits_btn.onPress = function () {
var _local1 = 1 + ((creditsStatus - Math.pow(-1, creditsStatus)) / 2);
logo_clip.credits_btn.gotoAndStop(_local1);
logo_clip.gotoAndStop(_local1);
trace("creditsFrame:" + _local1);
creditsStatus = creditsStatus * -1;
};
highScore._visible = false;
logo_clip.play_btn.onRelease = function () {
gotoAndStop (3);
};
logo_clip.credits_btn.onRelease = function () {
trace("Credits pressed");
};
Frame 3
function initialize() {
var _local2;
gameIsOver = false;
towerBallMoving = false;
shipsVars.load("highscore.txt");
highScore.registerHandlers(listScoresContinue, enterScoreSend, scoresError, receivedInfo);
cannon.rows = 13;
cannon.cols = 7;
this.createEmptyMovieClip("splashSoundClip", initialSoundDepth + 1);
this.createEmptyMovieClip("explosionSoundClip", initialSoundDepth + 2);
this.createEmptyMovieClip("seagullsSoundClip", initialSoundDepth + 3);
splashSound = new Sound(splashSoundClip);
explosionSound = new Sound(explosionSoundClip);
seagullsSound = new Sound(seagullsSoundClip);
maxVolume.setVolume(30);
explosionSound.attachSound("explosionSnd");
explosionSound.setVolume(60);
cannonSound.attachSound("cannonSnd");
cannonSound.setVolume(90);
oceanSound.attachSound("oceanSnd");
oceanSound.start(null, 2000);
splashSound.attachSound("splashSnd");
seagullsSound.attachSound("seagullsSnd");
seagullsSound.start(null, 2000);
seagullsSound.setVolume(20);
towerhitSound.attachSound("towerhitSnd");
towerhitSound.setVolume(55);
towerMaskWidth = integrity_clip.towerDamageMask._width;
Mouse.addListener(cannon);
view = new md.threed.Camera(new md.threed.Point3D(400, 500, 0), new md.threed.Angle3D(cameraAngle, 0, 0), focalLength);
addShip(1);
_local2 = 1;
while (_local2 <= totalShips) {
addShip(shipToAddType());
_local2++;
}
Key.addListener(myListener);
removeShipsInterval = setInterval(autoShipRemove, 20);
moveInterval = setInterval(moveShips, 50);
gameOver_clip._visible = false;
startTimer = getTimer();
shipsAutoShoot();
moveBalls();
}
function receivedInfo() {
restart();
}
function listScoresContinue() {
trace("finalscore:" + totalScore);
if (highScore.isScoreAccepted(totalScore)) {
trace("enter score");
highScore.enterScore(totalScore);
} else {
trace("scores not accepted");
restart();
}
}
function restart() {
trace("RESTART");
gotoAndStop (2);
}
function enterScoreSend() {
}
function scoresError() {
trace((("error status:" + highScore.getStatus) + " IO:") + highScore.getIOStatus);
enterScoreSend();
}
function shipToAddType() {
var _local1;
var _local4;
var _local2 = [5, 15, 30, 50];
var _local3 = Math.ceil(Math.random() * addShipsRandom);
_local1 = 0;
while (_local1 < _local2.length) {
if (_local3 <= _local2[_local1]) {
_local4 = _local1;
break;
}
_local1++;
}
return(5 - _local4);
}
function addShip(shipModel) {
var _local14 = Math.pow(-1, Math.floor(Math.random() * 2));
var _local2;
var _local3 = 0;
if (shipModel != 1) {
if (shipsArr.length > 0) {
do {
var _local1;
goodDepth = true;
_local2 = zArr[Math.floor(Math.random() * zArr.length)];
_local1 = 0;
while (_local1 < shipsArr.length) {
if (goodDepth) {
if (shipsArr[_local1].shipPos.z == _local2.z) {
temp = _local2.z;
goodDepth = false;
}
}
_local1++;
}
} while (!goodDepth);
} else {
_local2 = zArr[Math.floor(Math.random() * zArr.length)];
}
xInit = (-_local2.x) * _local14;
zInit = _local2.z;
type = "enemy";
} else {
xInit = (-friendShipx) * _local14;
zInit = friendShipz;
type = "friend";
}
shipIDindex++;
shipReference = scene.attachMovie("ship" + shipModel, "ship" + shipIDindex, shipIDindex, {_x:0, _y:0, _xscale:1, _yscale:1});
switch (shipModel) {
case 1 :
_local3 = 50;
break;
case 2 :
_local3 = 50;
break;
case 3 :
_local3 = 25;
break;
case 4 :
_local3 = 25;
break;
case 5 :
_local3 = 0;
}
shipPosition = new md.threed.Point3D(xInit, 0, zInit);
shipsArr.push({shipID:shipModel, x:xInit, z:zInit, h:shipReference._height * 100, w:shipReference._width * 100, integrity:100 - _local3, shipPos:shipPosition, shipRef:shipReference, sense:_local14, sinking:false, shipType:type});
}
function addBall(xInit, yInit, zInit, elevation, azimuth, type) {
if (gameIsOver) {
return(undefined);
}
var _local1;
ballPosition = new md.threed.Point3D(xInit, yInit, zInit);
totalBalls++;
splashReference = scene.attachMovie("splash", "splash" + totalBalls, initialSplashDepth + totalBalls, {_x:0, _y:0, _xscale:1, _yscale:1});
ballReference = scene.attachMovie("ball", "ball" + totalBalls, initialDepth + totalBalls, {_x:0, _y:0, _xscale:1, _yscale:1});
ballsArr.push({x:xInit, y:yInit, z:zInit, ballType:type, ballPos:ballPosition, ballRef:ballReference, splashRef:splashReference, elevation:-elevation, azimuth:-azimuth, t:0});
ballsOnStage = ballsArr.length;
_local1 = 0;
while (_local1 < zArr.length) {
if (zArr[_local1].z == zInit) {
cannonSound.setVolume(volumesArr[_local1]);
cannonSound.setPan((100 * xInit) / zArr[_local1].x);
break;
}
if (zInit == 0) {
cannonSound.setVolume(90);
}
_local1++;
}
cannonSound.start();
}
function removeShip(ref) {
var _local1;
_local1 = 0;
while (_local1 < shipsArr.length) {
if (String(shipsArr[_local1].shipRef) == String(ref)) {
if (shipsArr[_local1].shipID == 1) {
addShip(1);
} else {
addShip(shipToAddType());
}
shipsArr[_local1].shipRef.removeMovieClip();
shipsArr.splice(_local1, 1);
}
_local1++;
}
}
function removeBall(ref) {
var _local1;
_local1 = 0;
while (_local1 < ballsOnStage) {
if (String(ballsArr[_local1].ballRef) == String(ref)) {
ballsArr[_local1].ballRef.removeMovieClip();
ballsArr.splice(_local1, 1);
ballsOnStage = ballsArr.length;
}
_local1++;
}
}
function autoShipRemove() {
var _local1;
var _local2;
var _local3 = 10;
_local1 = 0;
while (_local1 < shipsArr.length) {
_local2 = shipsArr[_local1].shipRef;
if (((_local2._x > Math.round((bkg._width + _local3) + (_local2._width / 2))) && (shipsArr[_local1].sense == 1)) || ((_local2._x < Math.round((-_local3) - (_local2._width / 2))) && (shipsArr[_local1].sense == -1))) {
if (shipsArr[_local1].sinking == true) {
removeShip(_local2);
break;
}
shipsArr[_local1].sense = shipsArr[_local1].sense * -1;
}
_local1++;
}
}
function moveShips() {
var _local2;
if (shipsArr.length > 0) {
_local2 = 0;
while (_local2 < shipsArr.length) {
crtShip = shipsArr[_local2].shipPos;
var _local3 = md.threed.Projection.simpleProjection(shipsArr[_local2].shipPos, view);
ship = shipsArr[_local2].shipRef;
ship._x = _local3.x;
ship._y = _local3.y;
ship._xscale = _local3.scale * shipsArr[_local2].sense;
ship._yscale = _local3.scale;
sDepth = Math.round(initialDepth - _local3.zDepth);
if (this.getInstanceAtDepth(sDepth) == undefined) {
ship.swapDepths(sDepth);
} else {
trace("same depth!!!!!!!!!!!");
}
shipsArr[_local2].shipPos.x = shipsArr[_local2].shipPos.x + (10 * shipsArr[_local2].sense);
_local2++;
}
} else {
trace("No more ships");
_local2 = 0;
while (_local2 < ballsArr.length) {
removeBall(ballsArr[_local2].ballRef);
_local2++;
}
clearInterval(launchBallsInterval);
clearInterval(removeShipsInterval);
clearInterval(moveInterval);
clearInterval(moveShipsBallsInterval);
}
updateAfterEvent();
}
function shipsAutoShoot() {
launchBallsInterval = setInterval(launchRandomBall, 2000);
}
function launchRandomBall() {
var _local1 = Math.pow(-1, Math.floor(Math.random() * 2));
var _local2 = "";
shipToLaunch = Math.floor(Math.random() * shipsArr.length);
crtShip = shipsArr[shipToLaunch];
if ((crtShip.shipRef._x > 0) && (crtShip.shipRef._x < bkg._width)) {
var _local3;
ballsToLaunch = Math.ceil(crtShip.shipID * Math.random());
_local3 = 0;
while (_local3 < ballsToLaunch) {
elevation = initBallAngle + (Math.random() * 30);
shipAzimuth = (Math.atan(crtShip.shipPos.z / crtShip.shipPos.x) * 180) / Math.PI;
if (crtShip.shipType == "enemy") {
if (crtShip.shipPos.x > 0) {
azimuth = (180 - shipAzimuth) + ((Math.random() * (shipShootAngle / 2)) * _local1);
} else {
azimuth = Math.abs(shipAzimuth) + ((Math.random() * (shipShootAngle / 2)) * _local1);
}
_local2 = "enemy";
} else {
if (crtShip.shipPos.x >= 0) {
azimuth = (180 + shipAzimuth) + ((Math.random() * (shipShootAngle / 2)) * _local1);
} else {
azimuth = shipAzimuth + ((Math.random() * (shipShootAngle / 2)) * _local1);
}
_local2 = "friend";
}
if (crtShip.sinking == false) {
addBall(crtShip.shipPos.x, crtShip.shipPos.y - 5, crtShip.shipPos.z, elevation, azimuth, _local2);
}
_local3++;
}
}
}
function moveShipsBalls() {
var _local3;
_local3 = 0;
while (_local3 < ballsArr.length) {
var _local10 = new md.threed.Point3D(ballsArr[_local3].x, ballsArr[_local3].y, ballsArr[_local3].z);
ball = ballsArr[_local3].ballRef;
splash = ballsArr[_local3].splashRef;
if (ballsArr[_local3].t == null) {
ballsArr[_local3].t = 0;
}
var _local6 = ballisticTrajectory(_local10, ballsArr[_local3].t, cannonVelocity, ballsArr[_local3].elevation, ballsArr[_local3].azimuth);
var _local4 = md.threed.Projection.simpleProjection(_local6, view);
ball._x = _local4.x;
ball._y = _local4.y;
ball._xscale = (ball._yscale = _local4.scale);
bDepth = Math.round(initialDepth - _local4.zDepth);
if (this.getInstanceAtDepth(bDepth) == undefined) {
ball.swapDepths(bDepth);
} else {
trace("same depth!!!!!!!!!!!");
}
ballsArr[_local3].ballPos = _local6;
ballsArr[_local3].t = ballsArr[_local3].t + timeslice;
if (_local6.z < -200) {
removeBall(ball);
}
if (_local6.y < 0) {
var _local9 = 50;
var _local8 = 50;
var _local7 = 80;
var _local2;
var _local5;
_local2 = 0;
while (_local2 < shipsArr.length) {
if (((((((ballsArr[_local3].ballPos.z > (shipsArr[_local2].shipPos.z - _local7)) && (ballsArr[_local3].ballPos.z < (shipsArr[_local2].shipPos.z + _local7))) && (ballsArr[_local3].ballPos.y > ((-shipsArr[_local2].h) + _local8))) && (ballsArr[_local3].ballPos.y < _local8)) && (ballsArr[_local3].ballPos.x > ((shipsArr[_local2].shipPos.x + _local9) - (shipsArr[_local2].w / 2)))) && (ballsArr[_local3].ballPos.x < ((shipsArr[_local2].shipPos.x - _local9) + (shipsArr[_local2].w / 2)))) && (shipsArr[_local2].sinking == false)) {
if (shipsArr[_local2].shipType != ballsArr[_local3].ballType) {
ballsArr[_local3].t = null;
shipsArr[_local2].integrity = shipsArr[_local2].integrity - 25;
playFrame = (12 * ((100 - shipsArr[_local2].integrity) / 25)) + 1;
if (shipsArr[_local2].integrity != 0) {
splash._x = _local4.x;
splash._y = _local4.y;
splash._xscale = (splash._yscale = _local4.scale);
splash.setAction("hit", shipsArr[_local2].shipRef);
} else {
shipsArr[_local2].sinking = true;
}
_local5 = 0;
while (_local5 < zArr.length) {
if (zArr[_local5].z == shipsArr[_local2].shipPos.z) {
explosionSound.setVolume(volumesArr[_local5]);
explosionSound.setPan((100 * shipsArr[_local2].shipPos.x) / zArr[_local5].x);
break;
}
_local5++;
}
explosionSound.start();
towerBallMoving = false;
shipsArr[_local2].shipRef.goPlay(playFrame);
totalScore = totalScore + pointsArr[shipsArr[_local2].shipID - 1];
score_txt.text = totalScore;
removeBall(ball);
}
}
if (ballsArr[_local2].ballType == "enemy") {
if (((((ballsArr[_local3].ballPos.z < 0) && (ballsArr[_local3].ballPos.y < 0)) && (ballsArr[_local3].ballPos.y > -260)) && (ballsArr[_local3].ballPos.x > -400)) && (ballsArr[_local3].ballPos.x < 400)) {
tower.shake();
towerDamage = towerDamage + damageStep;
damage_txt.text = towerDamage;
if (towerDamage < 100) {
integrity_clip.towerDamageMask._width = (towerMaskWidth * (100 - towerDamage)) / 100;
towerhitSound.start();
removeBall(ball);
} else {
stopGame();
}
}
}
_local2++;
}
} else {
ballsArr[_local3].t = null;
splash._x = _local4.x;
splash._y = _local4.y;
splash._xscale = (splash._yscale = _local4.scale);
splDepth = Math.round(initialDepth - _local4.zDepth);
if (this.getInstanceAtDepth(splDepth) == undefined) {
splash.swapDepths(splDepth);
} else {
trace("same depth!!!!!!!!!!!");
}
var _local5 = 0;
while (_local5 < zArr.length) {
splashSound.setVolume(volumesArr[_local5]);
splashSound.setPan((100 * _local6.x) / zArr[_local5].x);
if (_local6.z <= zArr[_local5].z) {
break;
}
_local5++;
}
splashSound.start();
splash.setAction("splash", shipsArr[_local2].shipRef);
if (ballsArr[_local3].ballType == "friend") {
towerBallMoving = false;
}
removeBall(ball);
}
updateAfterEvent();
_local3++;
}
}
function stopGame() {
var _local1;
gameOver_clip._visible = true;
_local1 = 0;
while (_local1 < winnerScoreArr.length) {
if (totalScore <= winnerScoreArr[_local1]) {
gameOver_clip.gameOverMsg_txt.text = txtArr[_local1];
break;
}
gameOver_clip.gameOverMsg_txt.text = txtArr[_local1 + 1];
trace((("totalScore:" + totalScore) + " text:") + txtArr[_local1 + 1]);
_local1++;
}
gameIsOver = true;
clearInterval(launchBallsInterval);
clearInterval(removeShipsInterval);
clearInterval(moveInterval);
clearInterval(moveShipsBallsInterval);
}
function moveBalls() {
moveShipsBallsInterval = setInterval(moveShipsBalls, 20);
}
function ballisticTrajectory(origin, t, v0, elevation, azimuth) {
var _local9 = 5;
var _local4 = (Math.PI/180);
var _local1 = _local4 * elevation;
var _local5 = _local4 * azimuth;
var _local2 = (v0 * t) * Math.cos(_local1);
var _local10 = _local2 * Math.cos(_local5);
var _local7 = _local2 * Math.sin(_local5);
var _local8 = ((_local9 * t) * t) + ((v0 * t) * Math.sin(_local1));
return(new md.threed.Point3D(_local10 + origin.x, _local8 + origin.y, _local7 + origin.z));
}
stop();
var cannon;
var scene;
var focalLength = 500;
var cameraAngle = 40;
var cannonVelocity = 140;
var timeslice = 0.7;
var cannonIsFiring = false;
var zHitTower = 90;
var initialDepth = 4000;
var initialSplashDepth = 500;
var initialSoundDepth = 50;
var soundDepth = 0;
var zArr = new Array({x:1100, z:550}, {x:1350, z:880}, {x:1650, z:1240}, {x:1850, z:1520}, {x:1970, z:1660});
var friendShipz = 350;
var friendShipx = 900;
var volumesArr = new Array(70, 60, 50, 40, 30);
var pointsArr = new Array(1, 2, 3, 4, 5);
var totalScore = 0;
var towerDamage = 0;
var towerMaskWidth = 0;
var damageStep = 5;
var txtArr = new Array("You didn't even want to defend our island. You will pay for that with your life! You'll be hanged at dawn!", "You have fought bravely against the Royal Navy but we did't have a chance to win this battle.", "You have successfuly defended the island. In the meantime our main fleet has returned. We've won the battle!");
var winnerScoreArr = new Array(50, 200);
var startTimer = 0;
var myListener = new Object();
var totalShips = 3;
var shipsArr = new Array();
var shipPosition;
var shipIDindex = 0;
var shipsVars = new LoadVars();
var towerBallMoving;
var ballsOnStage = 0;
var ballsArr = new Array();
var ballPosition;
var totalBalls = 0;
var shipShootAngle = 30;
var initBallAngle = 10;
var launchBallsRandom = 2;
var addShipsRandom = 50;
var shipToAddID = 1;
var maxVolume = new Sound();
var cannonSound = new Sound(cannon);
var oceanSound = new Sound(bkg);
var splashSound = new Sound(splashSoundClip);
var explosionSound = new Sound(explosionSoundClip);
var seagullsSound = new Sound(seagullsSoundClip);
var towerhitSound = new Sound(tower);
var highscoreScript;
var highscoreFile;
var highscoreTimeout = 10;
var highscoreLocal;
var gameIsOver;
shipsVars.onLoad = function (success) {
if (!success) {
highscoreScript = "http://www.media-division.com/flashgames/highscores/highscore.php";
highscoreFile = "piratecove.txt";
highscoreLocal = true;
} else {
if (shipsVars.hiScript == null) {
highscoreScript = "http://www.media-division.com/flashgames/highscores/highscore.php";
} else {
highscoreScript = shipsVars.hiScript;
}
if (shipsVars.hiFile == null) {
highscoreFile = "piratecove.txt";
} else {
highscoreFile = shipsVars.hiFile;
}
if (shipsVars.hiLocal.toLowerCase() != "false") {
highscoreLocal = true;
} else {
highscoreLocal = false;
}
}
trace((((("highscoreScript:" + highscoreScript) + " highscoreFile:") + highscoreFile) + " highscoreLocal:") + highscoreLocal);
};
myListener.onKeyDown = function () {
if (Key.getCode() == 40) {
if (totalShips >= 0) {
addBall(-900, 0, 2300, 45, 45, "enemy");
addBall(900, 0, 2300, 25, 130, "enemy");
addBall(900, 0, 1500, 60, 130, "enemy");
addBall(-1200, 0, 2300, 25, 130, "enemy");
trace("key pressed");
}
}
if (Key.getCode() == 39) {
addBall(-100, 1000, 0, 45, 45, "enemy");
}
};
gameOver_clip.continue_btn.onRelease = function () {
trace("Continue pressed");
trace("highscoreScript:" + highscoreScript);
highscoreTimeout = Number(highscoreTimeout);
highScore._visible = true;
highScore.initHighscoreTable(highscoreScript, highscoreFile, highscoreTimeout, highscoreLocal);
highScore.readHighscores();
};
cannon.onMouseMove = function () {
var _local3 = Math.max(1, Math.min(this.rows, Math.round(_root._xmouse / (this._parent.bkg._width / this.rows))));
var _local4 = Math.max(0, Math.min(this.cols - 1, Math.round(this.cols - (_root._ymouse / (this._parent.bkg._height / this.cols)))));
var _local5 = (_local4 * this.rows) + _local3;
this.azimuth = -(((_local3 - 7) * 10) - 90);
this.elevation = -(_local4 * 10);
this.gotoAndStop(_local5);
};
cannon.onMouseDown = function () {
cannonIsFiring = false;
};
cannon.onMouseUp = function () {
if (towerBallMoving) {
return(undefined);
}
this.fireball.goPlay(2);
towerBallMoving = true;
addBall(cannon.fireball._x, cannon.fireball._y - 100, 0, -cannon.elevation, -cannon.azimuth, "friend");
};
initialize();
Symbol 16 MovieClip [splash] Frame 1
stop();
setAction = function (action, ship) {
if (action == "hit") {
gotoAndPlay ("hit");
} else if (action == "splash") {
gotoAndPlay ("splash");
} else {
this.removeMovieClip();
}
};
Symbol 16 MovieClip [splash] Frame 2
Symbol 16 MovieClip [splash] Frame 25
this.removeMovieClip();
Symbol 16 MovieClip [splash] Frame 49
this.removeMovieClip();
Symbol 33 MovieClip Frame 1
stop();
Symbol 34 MovieClip Frame 1
function onEnterFrame() {
var _local2 = _root.getBytesTotal();
var _local3 = _root.getBytesLoaded();
var _local4 = (_local3 / _local2) * 100;
loadbar.gotoAndStop(Math.round(_local4));
if ((_local3 >= _local2) && (_local2 > 50)) {
_root.play();
}
}
Symbol 370 MovieClip [__Packages.md.threed.Angle3D] Frame 0
class md.threed.Angle3D
{
var alpha, beta, gamma;
function Angle3D (a, b, g) {
if (((a == null) || (b == null)) || (g == null)) {
return;
}
alpha = Math.max(-179, Math.min(180, a));
beta = Math.max(-179, Math.min(180, b));
gamma = Math.max(-179, Math.min(180, g));
}
}
Symbol 371 MovieClip [__Packages.md.threed.Camera] Frame 0
class md.threed.Camera
{
var x, y, z, alpha, beta, gamma, focalLength, sinX, cosX, sinY, cosY, sinZ, cosZ;
function Camera (point, angles, f) {
x = point.x;
y = point.y;
z = point.z;
alpha = angles.alpha;
beta = angles.beta;
gamma = angles.gamma;
if (f != null) {
focalLength = Math.max(1, Math.min(500, f));
} else {
focalLength = 50;
}
sinX = Math.sin(angles.alpha * rad);
cosX = Math.cos(angles.alpha * rad);
sinY = Math.sin(angles.beta * rad);
cosY = Math.cos(angles.beta * rad);
sinZ = Math.sin(angles.gamma * rad);
cosZ = Math.cos(angles.gamma * rad);
}
var rad = (Math.PI/180);
}
Symbol 372 MovieClip [__Packages.md.threed.Point3D] Frame 0
class md.threed.Point3D
{
var x, y, z;
function Point3D (x, y, z) {
if (((x == null) || (y == null)) || (z == null)) {
return;
}
this.x = x;
this.y = y;
this.z = z;
}
}
Symbol 373 MovieClip [__Packages.md.threed.Projection] Frame 0
class md.threed.Projection
{
function Projection () {
}
static function simpleProjection(point, camera) {
var _local5 = camera.focalLength / (camera.focalLength + point.z);
var _local4 = point.x;
var _local3 = point.y;
var _local2 = point.z;
var _local10 = 100 * _local5;
var _local7 = (camera.cosX * _local3) - (camera.sinX * _local2);
var _local6 = (camera.sinX * _local3) + (camera.cosX * _local2);
var _local11 = (camera.cosY * _local6) - (camera.sinY * _local4);
var _local8 = (camera.sinY * _local6) + (camera.cosY * _local4);
var _local12 = (camera.sinZ * _local8) + (camera.cosZ * _local7);
var _local13 = (camera.cosZ * _local8) - (camera.sinZ * _local7);
_local4 = (_local13 * _local5) + camera.x;
_local3 = (_local12 * _local5) + camera.y;
_local2 = _local11 + camera.z;
return(new md.threed.Point2D(_local4, _local3, _local2, _local10));
}
}
Symbol 374 MovieClip [__Packages.md.threed.Point2D] Frame 0
class md.threed.Point2D
{
var x, y, zDepth, scale;
function Point2D (x, y, z, s) {
if ((((x == null) || (y == null)) || (z == null)) || (s == null)) {
return;
}
this.x = x;
this.y = y;
zDepth = z;
scale = s;
}
}
Symbol 43 MovieClip Frame 1
stop();
Symbol 43 MovieClip Frame 2
stop();
Symbol 57 MovieClip Frame 1
stop();
Symbol 64 MovieClip Frame 1
stop();
Symbol 76 Button
on (release) {
handleSendButton();
}
Symbol 83 Button
on (release) {
handleContinueButton();
}
Symbol 95 MovieClip Frame 1
function initHighscoreTable(scriptPath, scoreFile, timeout, local) {
trace((((((("scriptPath:" + scriptPath) + " scoreFile:") + scoreFile) + "timeout:") + timeout) + "local:") + local);
debug("Initializing scores", 3, 0);
boundingbox._visible = false;
if ((status != "error") && (!initialized)) {
if ((((scriptPath == null) || (scriptPath.length < 1)) || (scoreFile == null)) || (scoreFile.length < 1)) {
debug("Fatal Error: incorrect parameters", 0, 0);
status = "error";
return(false);
}
if (((timeout == null) || (timeout < 1)) || (timeout > 30)) {
timeout = 10;
}
if (local == null) {
local = true;
}
scoresToKeep = 10;
highscoresPath = scriptPath;
scoresFile = scoreFile;
readWriteTimeout = timeout;
isLocalRead = local;
if (isLocalRead) {
localVars = SharedObject.getLocal(scoresFile);
highscoreData = localVars.data;
debug("Local vars " + highscoreData, 2, 2);
} else {
highscoreData = new LoadVars();
debug("Load vars " + highscoreData, 2, 2);
}
var _local2 = 1;
while (_local2 <= scoresToKeep) {
if (highscoreData["name" + _local2] == "") {
highscoreData["name" + _local2] = "-";
}
if (highscoreData["email" + _local2] == "") {
highscoreData["email" + _local2] = "-";
}
if (highscoreData["score" + _local2] == undefined) {
highscoreData["score" + _local2] = 0;
}
_local2++;
}
OutTimer.checkTime = function (startTime, timeout) {
debug("Check loaded...", 3, 0);
if (highscoreData.loaded) {
debug("Loaded " + this.intervalId, 2, 0);
if (status == "write") {
writeHandler();
}
park();
clearInterval(this.intervalId);
} else if ((getTimer() - startTime) > timeout) {
debug("Timeout", 1, 2);
timeoutError();
clearInterval(this.intervalId);
}
};
OutTimer.countDown = function (seconds) {
this.startTime = getTimer();
this.timeout = seconds * 1000;
this.intervalId = setInterval(this, "checkTime", 1000, this.startTime, this.timeout);
debug((("Start countdown for " + seconds) + " id=") + this.intervalId);
};
highscoreList.createLines();
highscoreList.hideList();
scoreForm.hideForm();
initialized = true;
dataLoaded = false;
park();
return(true);
}
}
function registerHandlers(list, send, error, write) {
listContinueHandler = list;
sendDataHandler = send;
errorHandler = error;
writeHandler = write;
}
function enterScore(score) {
debug("Enter score " + score, 3, 0);
if ((status == "error") || (!dataLoaded)) {
return(false);
}
if (score < 0) {
score = 0;
}
if (isScoreAccepted(score)) {
debug("Score accepted", 2, 2);
scoreForm.showForm(score);
status = "enter";
return(true);
}
return(false);
}
function park() {
debug("Park", 3, 0);
textMessages.setMsg("none");
scoreForm.hideForm();
if (status == "read") {
debug("Show list ", 3, 2);
highscoreList.showList();
highscoreList.listLines();
status = "list";
} else {
debug("Hide list", 3, 2);
highscoreList.hideList();
status = "idle";
}
}
function timeoutError() {
debug("Timeout error", 0, 0);
textMessages.setMsg("error");
scoreForm.hideForm();
status = "error";
errorHandler();
}
function isScoreAccepted(score) {
return((status != "error") && (score >= Number(highscoreData["score" + scoresToKeep])));
}
function insertNewScore(name, mail, score) {
if (status == "error") {
return(false);
}
var _local2;
var _local1 = 1;
while (_local1 <= scoresToKeep) {
if (score >= Number(highscoreData["score" + _local1])) {
break;
}
_local1++;
}
var _local3 = _local1;
_local1 = scoresToKeep - 1;
while (_local1 >= _local3) {
_local2 = _local1 + 1;
highscoreData["name" + _local2] = highscoreData["name" + _local1];
highscoreData["email" + _local2] = highscoreData["email" + _local1];
highscoreData["score" + _local2] = highscoreData["score" + _local1];
_local1--;
}
highscoreData["name" + _local3] = ((name != undefined) ? (name) : "");
highscoreData["email" + _local3] = ((mail != undefined) ? (mail) : "");
highscoreData["score" + _local3] = (isNaN(score) ? 0 : (score));
writeHighScores();
return(true);
}
function readHighscores() {
debug("Read scores " + status, 3, 0);
if ((status != "idle") && (status != "error")) {
return(false);
}
dataLoaded = true;
if (isLocalRead) {
debug("Read local", 3, 2);
status = "read";
park();
} else {
debug("Read from server", 3, 2);
var _local2 = Math.floor((getTimer() * 1000) * Math.random());
var _local1 = (((highscoresPath + "?requestID=") + _local2) + "&action=read&scorefile=") + scoresFile;
debug("Read request=" + _local1, 2, 4);
delete highscoreData.action;
textMessages.setMsg("read");
status = "read";
highscoreData.load(_local1);
OutTimer.countDown(readWriteTimeout);
}
return(true);
}
function writeHighScores() {
debug("Write data", 3, 0);
if ((status == "error") || (dataLoaded == false)) {
return(false);
}
scoreForm.hideForm();
dataLoaded = false;
if (isLocalRead) {
debug("Saving local", 2, 2);
status = "write";
localVars.flush();
park();
} else {
var _local1 = highscoresPath;
highscoreData.scorefile = scoresFile;
debug((("Saving on " + _local1) + " file=") + highscoreData.scorefile, 2, 2);
highscoreData.action = "write";
textMessages.setMsg("write");
status = "write";
highscoreData.sendAndLoad(_local1, highscoreData, "GET");
OutTimer.countDown(readWriteTimeout);
}
return(true);
}
function getIOStatus() {
return(highscoreData.statusmsg);
}
function getStatus() {
return(status);
}
function debug(message, level, indent) {
if (level == null) {
level = 0;
}
if (indent == null) {
indent = 0;
}
if (level > debugLevel) {
return(undefined);
}
if (level == 0) {
message = message.toUpperCase();
}
var _local2 = "";
var _local1 = 0;
while (_local1 <= indent) {
_local2 = _local2 + " ";
_local1++;
}
trace(_local2 + message);
}
var scoresToKeep = 10;
var highscoresPath;
var scoresFile;
var readWriteTimeout;
var isLocalRead;
var status = "idle";
var initialized = false;
var dataLoaded = false;
var boundingbox;
var textMessages;
var scoreForm;
var highscoreList;
var localVars;
var highscoreData;
var OutTimer = {};
var debugLevel;
textMessages.setMsg = function (message) {
debug("Set message " + message, 3, 0);
switch (message) {
case "none" :
this.gotoAndStop("none");
break;
case "read" :
this.gotoAndStop("read");
break;
case "write" :
this.gotoAndStop("write");
break;
case "error" :
this.gotoAndPlay("error");
break;
default :
this.gotoAndStop("none");
}
};
highscoreList.showList = function () {
this._visible = true;
};
highscoreList.hideList = function () {
this._visible = false;
};
highscoreList.handleContinueButton = function () {
debug("Button Continue clicked", 3, 0);
park();
listContinueHandler();
};
highscoreList.createLines = function () {
var _local3 = this.highscoreLine._height;
this.highscoreLine._visible = false;
var _local2 = 1;
while (_local2 <= scoresToKeep) {
duplicateMovieClip (this.highscoreLine, "highscoreLine" + _local2, _local2);
this["highscoreLine" + _local2].index = _local2;
this["highscoreLine" + _local2].name = "";
this["highscoreLine" + _local2].mail = "";
this["highscoreLine" + _local2].scor = 0;
this["highscoreLine" + _local2]._y = this["highscoreLine" + _local2]._y + ((_local2 - 1) * (_local3 + 3));
_local2++;
}
};
highscoreList.listLines = function () {
var _local2 = 1;
while (_local2 <= scoresToKeep) {
this["highscoreLine" + _local2].index = _local2;
this["highscoreLine" + _local2].name = ((highscoreData["name" + _local2] != null) ? (highscoreData["name" + _local2]) : "");
this["highscoreLine" + _local2].mail = ((highscoreData["email" + _local2] != null) ? (highscoreData["email" + _local2]) : "");
this["highscoreLine" + _local2].scor = ((highscoreData["score" + _local2] != null) ? (highscoreData["score" + _local2]) : 0);
_local2++;
}
};
scoreForm.showForm = function (score) {
this.inputScore = score;
this._visible = true;
};
scoreForm.hideForm = function () {
delete inputScore;
this._visible = false;
};
scoreForm.handleSendButton = function () {
debug("Send button pressed", 3, 0);
sendDataHandler();
insertNewScore(this.inputName, this.inputMail, this.inputScore);
};
Symbol 120 MovieClip [ship3] Frame 1
function goPlay(frame) {
gotoAndStop(frame);
}
Symbol 120 MovieClip [ship3] Frame 12
gotoAndPlay (1);
Symbol 120 MovieClip [ship3] Frame 13
play();
Symbol 120 MovieClip [ship3] Frame 24
gotoAndPlay (13);
Symbol 120 MovieClip [ship3] Frame 25
play();
Symbol 120 MovieClip [ship3] Frame 36
gotoAndPlay (25);
Symbol 120 MovieClip [ship3] Frame 37
play();
Symbol 120 MovieClip [ship3] Frame 48
gotoAndPlay (37);
Symbol 120 MovieClip [ship3] Frame 49
play();
Symbol 120 MovieClip [ship3] Frame 69
_root.removeShip(this);
Symbol 150 MovieClip [ship5] Frame 1
function goPlay(frame) {
gotoAndStop(frame);
}
Symbol 150 MovieClip [ship5] Frame 12
gotoAndPlay (1);
Symbol 150 MovieClip [ship5] Frame 13
play();
Symbol 150 MovieClip [ship5] Frame 24
gotoAndPlay (13);
Symbol 150 MovieClip [ship5] Frame 25
play();
Symbol 150 MovieClip [ship5] Frame 36
gotoAndPlay (25);
Symbol 150 MovieClip [ship5] Frame 37
play();
Symbol 150 MovieClip [ship5] Frame 48
gotoAndPlay (37);
Symbol 150 MovieClip [ship5] Frame 49
play();
Symbol 150 MovieClip [ship5] Frame 69
_root.removeShip(this);
Symbol 174 MovieClip [ship4] Frame 1
function goPlay(frame) {
gotoAndStop(frame);
}
Symbol 174 MovieClip [ship4] Frame 12
gotoAndPlay (1);
Symbol 174 MovieClip [ship4] Frame 13
play();
Symbol 174 MovieClip [ship4] Frame 24
gotoAndPlay (13);
Symbol 174 MovieClip [ship4] Frame 25
play();
Symbol 174 MovieClip [ship4] Frame 36
gotoAndPlay (25);
Symbol 174 MovieClip [ship4] Frame 37
play();
Symbol 174 MovieClip [ship4] Frame 48
gotoAndPlay (37);
Symbol 174 MovieClip [ship4] Frame 49
play();
Symbol 174 MovieClip [ship4] Frame 69
_root.removeShip(this);
Symbol 192 MovieClip [ship2] Frame 1
function goPlay(frame) {
gotoAndStop(frame);
}
Symbol 192 MovieClip [ship2] Frame 12
gotoAndPlay (1);
Symbol 192 MovieClip [ship2] Frame 13
play();
Symbol 192 MovieClip [ship2] Frame 37
play();
Symbol 192 MovieClip [ship2] Frame 48
gotoAndPlay (37);
Symbol 192 MovieClip [ship2] Frame 49
play();
Symbol 192 MovieClip [ship2] Frame 69
_root.removeShip(this);
Symbol 209 MovieClip [ship1] Frame 1
function goPlay(frame) {
gotoAndStop(frame);
}
Symbol 209 MovieClip [ship1] Frame 12
gotoAndPlay (1);
Symbol 209 MovieClip [ship1] Frame 13
play();
Symbol 209 MovieClip [ship1] Frame 36
gotoAndPlay (25);
Symbol 209 MovieClip [ship1] Frame 37
play();
Symbol 209 MovieClip [ship1] Frame 48
gotoAndPlay (37);
Symbol 209 MovieClip [ship1] Frame 49
play();
Symbol 209 MovieClip [ship1] Frame 69
_root.removeShip(this);
stop();
Symbol 216 MovieClip Frame 1
stop();
Symbol 216 MovieClip Frame 3
stop();
Symbol 216 MovieClip Frame 5
stop();
Symbol 216 MovieClip Frame 7
stop();
Symbol 216 MovieClip Frame 9
stop();
Symbol 216 MovieClip Frame 11
stop();
Symbol 239 MovieClip Frame 1
stop();
goPlay = function (frame) {
gotoAndPlay(frame);
};
Symbol 330 MovieClip Frame 1
stop();
Symbol 333 MovieClip Frame 1
stop();
shake = function () {
play();
this.onEnterFrame = function () {
_parent.cannon._y = graphics._y + 250;
if (this._currentframe == 12) {
this.onEnterFrame = null;
}
};
};
Symbol 351 MovieClip Frame 1
if (!init) {
gotoAndPlay(Math.round(Math.random() * this._totalframes));
init = true;
}
Symbol 354 MovieClip Frame 1
if (!init) {
gotoAndPlay(Math.round(Math.random() * this._totalframes));
init = true;
}
Symbol 357 MovieClip Frame 1
if (!init) {
gotoAndPlay(Math.round(Math.random() * this._totalframes));
init = true;
}
Symbol 360 MovieClip Frame 1
if (!init) {
gotoAndPlay(Math.round(Math.random() * this._totalframes));
init = true;
}
Symbol 363 MovieClip Frame 1
if (!init) {
gotoAndPlay(Math.round(Math.random() * this._totalframes));
init = true;
}