Frame 1
stop();
Frame 212
var bgMusic = new Sound(_root);
bgMusic.attachSound("music");
bgMusic.start(0, 0);
bgMusic.onSoundComplete = function () {
bgMusic.start(0, 0);
};
Instance of Symbol 92 MovieClip in Frame 236
on (press) {
_root.gotoAndPlay("GameStart");
}
Instance of Symbol 94 MovieClip in Frame 236
on (press) {
_root.gotoAndStop("Help");
}
Instance of Symbol 96 MovieClip in Frame 236
on (press) {
getURL ("http://www.gamesofgondor.com", "_blank");
}
Frame 241
stop();
Frame 242
stop();
Instance of Symbol 98 MovieClip in Frame 242
on (press) {
_root.gotoAndStop("Menu");
}
Frame 302
Mouse.hide();
var pitch = 0;
stop();
var tilt = 0;
_root._quality = "MEDIUM";
Stage.showMenu = false;
var ballPos = new Object();
var shooting = false;
var counting = false;
var count = 0;
var timeLeft = new Number(60);
_root.timeMeter.timeLeft = timeLeft;
var KeyListener = new Object();
KeyListener.onKeyDown = function () {
if ((Key.getAscii() == 113) or (Key.getAscii() == 81)) {
if (_root._quality == "LOW") {
_root._quality = "HIGH";
} else if (_root._quality == "MEDIUM") {
_root._quality = "LOW";
} else if (_root._quality == "HIGH") {
_root._quality = "MEDIUM";
}
}
};
Key.addListener(KeyListener);
var timer = setInterval(function () {
timeLeft--;
if (timeLeft <= 5) {
_root.timeMeter.gotoAndStop(2);
}
if (timeLeft == 0) {
_root.gotoAndStop("endGame");
}
_root.timeMeter.timeLeft = timeLeft;
}, 1000);
_root.onMouseDown = function () {
counting = true;
count = 0;
};
_root.onMouseUp = function () {
if (counting) {
counting = false;
ballPos.x = ((-_root.backdrop._x) + (Stage.width / 2)) - 10;
ballPos.y = ((-_root.backdrop._y) + Stage.height) - 50;
ballPos.z = 0;
ballPos.zPush = Math.cos((pitch * Math.PI) / 180) * count;
ballPos.grav = (-Math.sin((pitch * Math.PI) / 180)) * count;
shooting = true;
count = 0;
}
};
_root.onEnterFrame = function () {
if (counting) {
if (count < 30) {
count = count + 2;
}
}
pitch = 75 + ((_root.backdrop._y / (_root.backdrop._height - Stage.height)) * 75);
tilt = 50 - ((_root.backdrop._x / (_root.backdrop._width - Stage.width)) * -100);
_root.backdrop._x = (_root._xmouse - 400) * ((_root.backdrop._width - Stage.width) / Stage.width);
_root.backdrop._y = (_root._ymouse - 400) * ((_root.backdrop._height - Stage.height) / Stage.height);
if (shooting) {
ballPos.grav = ballPos.grav + 1;
ballPos.y = ballPos.y + ballPos.grav;
ballPos.zPush = ballPos.zPush * 0.98;
ballPos.z = ballPos.z + ballPos.zPush;
if (ballPos.y < 0) {
shooting = false;
}
if (ballPos.z > 120) {
_root.backdrop.explode(ballPos.x, ballPos.y, 50);
_root.backdrop.explosion(ballPos.x, ballPos.y, 90, 10);
shooting = false;
}
}
};
_root.canonBall.onEnterFrame = function () {
if (!shooting) {
this._visible = false;
} else {
this._visible = true;
}
this._x = ballPos.x + _root.backdrop._x;
this._y = ballPos.y + _root.backdrop._y;
this._xscale = 100 - (ballPos.z / 2);
this._yscale = this._xscale;
};
_root.shadowBall.onEnterFrame = function () {
if (!shooting) {
this._visible = false;
} else {
this._visible = true;
}
this._x = ballPos.x + _root.backdrop._x;
this._y = (800 - (ballPos.z / 4)) + _root.backdrop._y;
this._xscale = 100 - (ballPos.z / 2);
this._yscale = this._xscale;
};
Frame 303
Mouse.show();
_root._quality = "HIGH";
clearInterval(timer);
var percent = new Number(Math.round(_root.percentage_destroyed));
var msg = "Read the \"Help\" section!";
if (percent > 10) {
msg = "You suck!";
}
if (percent > 20) {
msg = "Try harder, looser!";
}
if (percent > 30) {
msg = "I hope you can do better!";
}
if (percent > 40) {
msg = "You're getting there!";
}
if (percent > 50) {
msg = "Pretty good!";
}
if (percent > 60) {
msg = "Pretty nice!";
}
if (percent > 70) {
msg = "Good work!";
}
if (percent > 80) {
msg = "Holy crap!";
}
if (percent > 90) {
msg = "You are a god!";
}
if (percent == 100) {
msg = "Perfect score!";
}
result_field = (("Time's up! \nYou destroyed " + percent) + "% of the castle!\n\n") + msg;
Instance of Symbol 144 MovieClip in Frame 303
on (press) {
_root.gotoAndStop("Menu");
}
Symbol 5 MovieClip [boomgradient] Frame 40
stop();
Symbol 16 MovieClip Frame 1
gotoAndStop(Math.round(Math.random() * (this._totalframes - 1)) + 1);
Symbol 23 MovieClip Frame 1
this._visible = false;
this.gotoAndStop(Math.round(Math.random() * this._totalframes));
Symbol 53 MovieClip Frame 1
stop();
this.onEnterFrame = function () {
this.loadBar._xscale = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
this.gotoAndStop(2);
}
};
Instance of Symbol 52 MovieClip in Symbol 53 MovieClip Frame 2
on (press) {
_root.gotoAndPlay("Intro");
}
Symbol 72 MovieClip Frame 177
stop();
Symbol 106 MovieClip Frame 1
function buildCastleArray(castleData) {
var _local4 = new Array();
var _local2 = new Array();
i = 0;
while (i < castleData.length) {
var _local1 = castleData.charAt(i);
if (_local1 == "/") {
_local4.push(_local2);
_local2 = new Array();
} else {
_local2.push(_local1);
}
i++;
}
_local4.push(_local2);
return(_local4);
}
function explode(xAt, yAt, size) {
var i = 0;
while (i < propArray.length) {
with (propArray[i]) {
if (!isSim) {
var dist = Math.sqrt(Math.pow(x - xAt, 2) + Math.pow(y - yAt, 2));
if (dist < size) {
var angle = Math.atan2(y - yAt, x - xAt);
xPush = (Math.cos(angle) * (size - dist)) / 4;
yPush = ((-Math.sin(angle)) * (size - dist)) / 3;
rotationPush = (x - xAt) / 5;
if ((damaged == true) or (dist < 20)) {
isSim = true;
} else {
damaged = true;
}
}
}
}
i++;
}
}
function explosion(x, y, strength, density) {
var index = new Number(this.getNextHighestDepth());
this.createEmptyMovieClip("explosion" + index, index);
with (this["explosion" + index]) {
_x = x;
_y = y;
}
var i = 0;
while (i < density) {
this["explosion" + index].attachMovie("boomgradient", "cloud" + i, this["explosion" + index].getNextHighestDepth());
with (this["explosion" + index]["cloud" + i]) {
cacheAsBitmap = true;
_x = 0;
_y = 0;
_xscale = (Math.random() * strength) + (strength / 2);
_yscale = _xscale;
}
if ((i % 2) == 0) {
this["explosion" + index]["cloud" + i].xInc = ((Math.random() * strength) / 2) - (strength / 4);
this["explosion" + index]["cloud" + i].yInc = (((-Math.random()) * strength) / 4) - (strength / 8);
this["explosion" + index]["cloud" + i].onEnterFrame = function () {
this.xInc = this.xInc * 0.87;
this.yInc = this.yInc * 0.87;
this._x = this._x + this.xInc;
this._y = this._y + this.yInc;
this._alpha = (Math.abs(this.xInc) * strength) / 20;
if (Math.abs(this.xInc) < 0.5) {
this.removeMovieClip();
}
};
} else {
this["explosion" + index]["cloud" + i].xInc = (Math.random() * 10) - 5;
this["explosion" + index]["cloud" + i].yInc = (Math.random() * 10) - 5;
this["explosion" + index]["cloud" + i]._x = (Math.random() * 10) - 5;
this["explosion" + index]["cloud" + i]._y = ((-Math.random()) * 10) - 5;
this["explosion" + index]["cloud" + i].onEnterFrame = function () {
this.xInc = this.xInc * 0.91;
this.yInc = this.yInc * 0.91;
this._x = this._x + this.xInc;
this._y = this._y + this.yInc;
this._alpha = Math.abs(this.xInc) * 20;
if (Math.abs(this.xInc) < 0.1) {
this.removeMovieClip();
}
};
}
i++;
}
explosionsArray[Math.floor(Math.random() * explosionsArray.length)].start(0, 0);
}
function loadBooms(boomAmount) {
i = 1;
while (i <= boomAmount) {
var _local2 = new Sound(this);
_local2.attachSound("boom" + i);
explosionsArray.push(_local2);
i++;
}
}
var castle = "0fg0h0fg0000000000000fg0h0fg0/0f11111g0000000000000f11111g0/0f11111g0000000000000f11111g0/00f141g000000000000000f141g00/00f121g000000000000000f121g00/00f121g000000000000000f121g00/00f1e1g000000000000000f1e1g00/00f111g000000000000000f111g00/00f111g000000000000000f111g00/00f111g000000000000000f111g00/00f111g080000000000080f111g00/00f111g070000000000070f111g00/00f111g0h0h0h0h0h0h0h0f111g00/00f11111111111111111111111g00/00f11111111111111111111111g00/00f1411141115bbb6111411141g00/00f121112115d333c611211121g00/00f12111211933333a11211121g00/00f1e111e11933333a11e111e1g00/00f11111111933333a11111111g00/00f11111111933333a11111111g00/00f11111111933333a11111111g00/00f11111111933333a11111111g00/00f11111111933333a11111111g00";
var explosionsArray = new Array();
loadBooms(3);
var castleArray = new Array();
var castleArray = buildCastleArray(castle);
var referalArray = new Array();
var brickTot = 0;
var propArray = new Array();
var xOff = 220;
var yOff = 300;
i = 0;
while (i < castleArray.length) {
var thisReferal = new Array();
j = 0;
while (j <= (castleArray[i].length - 1)) {
if (castleArray[i][j] != 0) {
brickTot++;
this.attachMovie("castleBrick", "brick" + brickTot, 1000 + brickTot);
var transformer = (new flash.geom.Transform(this["brick" + brickTot]));
var colTransForm = (new flash.geom.ColorTransform(1, 1, 1, 1, (80 - (i * 3)) - j, (80 - (i * 3)) - j, (80 - (i * 3)) - j, 0));
transformer.colorTransform = colTransForm;
this["brick" + brickTot].transform(colTransForm);
with (this["brick" + brickTot]) {
_x = (j * _width) + xOff;
_y = (i * _height) + yOff;
gotoAndStop(castleArray[i][j]);
}
var curProp = new Object();
curProp.gravityPull = 0;
curProp.rotationPush = 0;
curProp.y = this["brick" + brickTot]._y;
curProp.x = this["brick" + brickTot]._x;
curProp.yIndex = i;
curProp.xIndex = j;
curProp.xPush = 0;
curProp.yPush = 0;
curProp.isSim = false;
curProp.active = true;
curProp.isOnTop = false;
curProp.damaged = false;
propArray.push(curProp);
thisReferal.push(brickTot);
} else {
thisReferal.push(-1);
}
j++;
}
referalArray.push(thisReferal);
i++;
}
var numActive = 0;
var totSim = 0;
this.onEnterFrame = function () {
numActive = 0;
totSim = 1;
var _local3 = 1;
while (_local3 <= brickTot) {
var _local5 = 0;
n = -1;
while (n <= 1) {
var _local7 = propArray[_local3 - 1].xIndex + n;
var _local6 = propArray[_local3 - 1].yIndex + 1;
var _local4 = referalArray[_local6][_local7];
if (_local4 != -1) {
if (propArray[_local4 - 1].isSim) {
_local5++;
}
} else {
_local5++;
}
n++;
}
if ((_local5 > 2) && (!propArray[_local3 - 1].isSim)) {
propArray[_local3 - 1].isSim = true;
propArray[_local3 - 1].rotationPush = (Math.random() * 10) - 5;
}
if (propArray[_local3 - 1].isSim) {
totSim++;
}
if (propArray[_local3 - 1].damaged == true) {
this["brick" + _local3].crackMC._visible = true;
} else {
this["brick" + _local3].crackMC._visible = false;
}
if (propArray[_local3 - 1].isSim && (propArray[_local3 - 1].active)) {
propArray[_local3 - 1].damaged = false;
this["brick" + _local3].cacheAsBitmap = false;
numActive++;
if (!propArray[_local3 - 1].isOnTop) {
this["brick" + _local3].swapDepths(this.getNextHighestDepth());
propArray[_local3 - 1].isOnTop = true;
}
if (propArray[_local3 - 1].rotationPush != 0) {
this["brick" + _local3]._rotation = this["brick" + _local3]._rotation + propArray[_local3 - 1].rotationPush;
}
if (propArray[_local3 - 1].xPush != 0) {
this["brick" + _local3]._x = this["brick" + _local3]._x + propArray[_local3 - 1].xPush;
}
if (propArray[_local3 - 1].yPush != 0) {
propArray[_local3 - 1].gravityPull = -propArray[_local3 - 1].yPush;
propArray[_local3 - 1].yPush = 0;
}
propArray[_local3 - 1].gravityPull = propArray[_local3 - 1].gravityPull + 0.3;
this["brick" + _local3]._y = this["brick" + _local3]._y + propArray[_local3 - 1].gravityPull;
}
if ((this["brick" + _local3]._y > 780) or (this["brick" + _local3]._y < 50)) {
this["brick" + _local3].cacheAsBitmap = true;
this["brick" + _local3].isSim = false;
propArray[_local3 - 1].active = false;
}
if ((this["brick" + _local3]._x > 1450) or (this["brick" + _local3]._x < 50)) {
this["brick" + _local3].removeMovieClip();
propArray[_local3 - 1].active = false;
}
_local3++;
}
if (numActive == 0) {
} else {
this.cacheAsBitmap = false;
}
_root.percentage_destroyed = (totSim / propArray.length) * 100;
};
Symbol 119 MovieClip Frame 1
this.onEnterFrame = function () {
this.arrowPoint._y = 150 - (_root.pitch * 2);
};
Symbol 125 MovieClip Frame 1
this.onEnterFrame = function () {
this.arrowPoint._x = ((-_root.tilt) * 1.5) + 75;
};
Symbol 130 MovieClip Frame 1
this.onEnterFrame = function () {
this.pointing._rotation = (_root.count / 30) * 360;
};
Symbol 140 MovieClip Frame 1
stop();