Frame 1
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(getVersion())) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
function preload() {
if ((getBytesLoaded() / getBytesTotal()) == 1) {
preloader_mc.gotoAndStop(100);
clearInterval(preloaderInterval);
} else {
preloader_mc.gotoAndStop(Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100));
}
}
System.security.allowDomain("rustyarcade.com");
__com_mochibot__("62a949f2", this, 10301, true);
stop();
_global.username = "Anonamous";
var dissolveBmp = (new flash.display.BitmapData(Stage.width, Stage.height, true));
var intervalId;
var totalDissolved;
var totalPixels = (Stage.width * Stage.height);
_global.startTrans = function () {
var _local4 = new flash.display.BitmapData(Stage.width, Stage.height);
_local4.draw(_root);
var screeny = _root.createEmptyMovieClip("screenEffect", _root.getNextHighestDepth());
screeny.attachBitmap(_local4, 1);
var _local3 = _root.attachMovie("titleEffect", "titleEffect", _root.getNextHighestDepth(), {_x:Stage.width, _y:0});
_local3._xscale = (_local3._yscale = 1000);
_local3.onEnterFrame = function () {
this._x = this._x - 75;
if (this._x < (Stage.width - (this._width / 2))) {
screeny.swapDepths(_root.getNextHighestDepth());
screeny.removeMovieClip();
}
if (this._x < (Stage.width - this._width)) {
this.swapDepths(_root.getNextHighestDepth());
this.removeMovieClip();
}
};
};
_global.startDissolve = function () {
dissolveBmp.draw(_root);
dissolveBmp.copyChannel(dissolveBmp, dissolveBmp.rectangle, new flash.geom.Point(0, 0), 2, 1);
dissolveBmp.copyChannel(dissolveBmp, dissolveBmp.rectangle, new flash.geom.Point(0, 0), 2, 4);
attachBitmap(dissolveBmp, getNextHighestDepth());
var _local2 = Math.floor(Math.random() * 10);
totalDissolved = 0;
dissolve(_local2);
};
_global.dissolve = function (randomNum) {
var _local2 = dissolveBmp.pixelDissolve(dissolveBmp, dissolveBmp.rectangle, new flash.geom.Point(0, 0), randomNum, 1250);
clearInterval(intervalId);
if (totalDissolved < totalPixels) {
intervalId = setInterval(_global.dissolve, 10, _local2);
}
totalDissolved = totalDissolved + 1250;
};
var preloaderInterval = setInterval(preload, 100);
preloader_mc.onRelease = function () {
if (this._currentframe == 100) {
_global.startTrans();
gotoAndStop ("Intro");
} else {
getURL ("http://www.rustyarcade.com/index.php?ref=how", "_blank");
}
};
crossHair.onEnterFrame = function () {
if (!_global.pauser) {
this._x = _xmouse;
this._y = _ymouse;
Mouse.hide();
} else {
Mouse.show();
}
};
var optionMenu = new ContextMenu(function () {
_global.pauseGame();
});
optionMenu.hideBuiltInItems();
optionMenu.builtInItems.quality = true;
var item1 = new ContextMenuItem("Play More Games", function () {
getURL ("http://www.rustyarcade.com/index.php?ref=how", "_blank");
});
optionMenu.customItems.push(item1);
_global.soundOn = false;
var item2 = new ContextMenuItem("Turn Sound Off", function () {
if (_root.optionMenu.customItems[1].caption == "Turn Sound Off") {
_root.optionMenu.customItems[1].caption = "Turn Sound On";
_global.soundOn = true;
} else {
_root.optionMenu.customItems[1].caption = "Turn Sound Off";
_global.soundOn = false;
}
}, true);
optionMenu.customItems.push(item2);
_global.musicOn = true;
var item3 = new ContextMenuItem("Turn Music Off", function () {
if (_root.optionMenu.customItems[2].caption == "Turn Music Off") {
_root.optionMenu.customItems[2].caption = "Turn Music On";
_global.musicOn = false;
stopAllSounds();
} else {
_root.optionMenu.customItems[2].caption = "Turn Music Off";
_global.musicOn = true;
var _local3 = new Sound(_root);
_local3.attachSound("gameLoop");
_local3.start(0, 10000);
}
}, true);
optionMenu.customItems.push(item3);
var noMenu = new ContextMenu();
noMenu.hideBuiltInItems();
_root.menu = noMenu;
Frame 19
stop();
onEnterFrame = function () {
if (_root.titleEffect == undefined) {
var _local3 = _root.attachMovie("intro", "intro", _root.getNextHighestDepth());
_local3._x = 125;
_local3._y = 25;
onEnterFrame = function () {
if (_root.intro.done) {
_root.intro.swapDepths(_root.getNextHighestDepth());
_root.intro.removeMovieClip();
_global.startTrans();
_root.gotoAndStop("MainMenu");
onEnterFrame = null;
}
};
}
};
stopAllSounds();
Frame 29
stop();
playMoreGames_btn.onRelease = function () {
getURL ("http://www.rustyarcade.com/index.php?ref=how", "_blank");
};
start_btn.onRelease = function () {
_global.startTrans();
gotoAndStop ("Game");
};
var loader = new LoadVars();
loader.gid = 1;
loader.sendAndLoad("http://rustyarcade.com/permalinks/horizonOfWar/getChamp.php", loader, "POST");
loader.onLoad = function (success) {
if (success) {
champ.text = "World champion: " + this.champ;
} else {
champ.text = "";
}
};
champ.text = "";
_root.menu = optionMenu;
stopAllSounds();
if (_global.musicOn) {
var bgm = new Sound(_root);
bgm.attachSound("menuLoop");
bgm.start(0, 10000);
}
var ra_loader = new MovieClipLoader();
ra_loader.loadClip("http://rustyarcade.com/permalinks/horizonOfWar/banner.swf?random=" + Math.random(), ra_unreal_banner);
var ra_loader_listener = new Object();
ra_loader_listener.onLoadComplete = function () {
var _local1 = new LoadVars();
_local1.url = _url;
_local1.sendAndLoad("http://rustyarcade.com/permalinks/horizonOfWar/bannertrack.php", _local1, "post");
_local1.onLoad = function () {
ra_unreal_banner._x = 0;
ra_unreal_banner._y = Stage.height - ra_unreal_banner._height;
};
};
ra_loader.addListener(ra_loader_listener);
Frame 39
function spawnEnemy(level) {
var _local4 = random(level);
switch (_local4) {
case 0 :
var _local2 = 0;
while (_local2 < 6) {
var _local3 = _root.attachMovie("troop1", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770 + (_local2 * 4), _y:380});
_local3.speed = 1;
_local3.hp = 1;
_local3.damage = 1;
_local3.rrate = 40;
_local3.bulletType = "bullet";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = true;
_local2++;
}
break;
case 1 :
_root.attachMovie("tank1", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
break;
case 2 :
var _local3 = _root.attachMovie("tank2", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 0.6;
_local3.hp = 7;
_local3.damage = 4;
_local3.rrate = 140;
_local3.bulletType = "bullet2";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = false;
break;
case 3 :
_local3 = _root.attachMovie("tank3", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 3;
_local3.hp = 3;
_local3.damage = 2;
_local3.rrate = 100;
_local3.bulletType = "bullet3";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = false;
break;
case 4 :
_local3 = _root.attachMovie("tank4", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 0.9;
_local3.hp = 2;
_local3.damage = 2;
_local3.rrate = 50;
_local3.bulletType = "bullet3";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = true;
break;
case 5 :
_local3 = _root.attachMovie("tank5", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 0.7;
_local3.hp = 3;
_local3.damage = 2;
_local3.rrate = 140;
_local3.bulletType = "bullet2";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = true;
break;
case 6 :
_local3 = _root.attachMovie("tank6", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 2;
_local3.hp = 4;
_local3.damage = 3;
_local3.rrate = 60;
_local3.bulletType = "bullet3";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = false;
break;
case 7 :
_local3 = _root.attachMovie("tank7", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 4;
_local3.hp = 2;
_local3.damage = 0.25;
_local3.rrate = 10;
_local3.bulletType = "bullet";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = true;
break;
case 8 :
_local3 = _root.attachMovie("tank8", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 1;
_local3.hp = 2;
_local3.damage = 0.25;
_local3.rrate = 5;
_local3.bulletType = "bullet";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = true;
break;
case 9 :
_local3 = _root.attachMovie("tank9", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 3;
_local3.hp = 2;
_local3.damage = 0.3;
_local3.rrate = 10;
_local3.bulletType = "bullet";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = true;
break;
case 10 :
_local3 = _root.attachMovie("tank11", "enemy" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:770, _y:380});
_local3.speed = 0.5;
_local3.hp = 13;
_local3.damage = 7;
_local3.rrate = 90;
_local3.bulletType = "bullet2";
_local3.bulSpeed = 10;
_local3.bulGrav = 0.1;
_local3.troop = false;
}
}
function spawnItem() {
var _local8 = _root.attachMovie("pickup", "pickup" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:100 + random(Stage.width - 200), _y:-50});
_local8.itemNum = random(6) + 1;
_local8.gotoAndStop(_local8.itemNum);
switch (_local8.itemNum) {
case 1 :
_local8.ammo = 5;
break;
case 2 :
_local8.ammo = 50;
break;
case 3 :
_local8.ammo = 3;
break;
case 4 :
_local8.ammo = 15;
break;
case 5 :
_local8.ammo = 100;
break;
case 6 :
}
_local8.onEnterFrame = function () {
if (!_global.pauser) {
this._y++;
var _local7 = new Array();
_global.grid_get(this, _local7);
var _local6 = 0;
while (_local6 < _local7.length) {
var _local4 = 0;
while (_local4 < _root[_local7[_local6]].length) {
var _local5 = _root[_local7[_local6]][_local4];
if (this.hitTest(_local5._x, _local5._y, true)) {
if (this.itemNum == 6) {
_global.hp = _global.hp + 20;
} else {
_global.setWeapon(this.itemNum, this.ammo);
}
this.swapDepths(_root.getNextHighestDepth());
this.removeMovieClip();
}
_local4++;
}
_local6++;
}
if (this._y > (Stage.height + 50)) {
this.swapDepths(_root.getNextHighestDepth());
this.removeMovieClip();
}
}
};
}
stop();
_global.pauser = false;
_global.hp = 200;
_global.ammo = 0;
_global.population = 99999 /* 0x01869F */;
var mc = turret;
var heatBar = bar1;
var terrainDamage = (new flash.display.BitmapData(Stage.width, Stage.height, true, 16777215));
var container = this.createEmptyMovieClip("terrainDamageContainer", this.getNextHighestDepth()).attachBitmap(terrainDamage, this.getNextHighestDepth());
var fx = new Array(0, 25, 50, 50, 75, 75, 100, 100, 100, 125, 150, 150, 175, 175, 200, 225, 225, 250, 250, 275, 300, 325, 350, 375, 400, 400, 425, 450, 450, 475, 475, 500, 500, 525, 550, 575, 575, 600, 600, 625, 650, 650, 675);
var fy = new Array(125, 125, 125, 150, 150, 175, 175, 200, 225, 225, 250, 250, 250, 275, 275, 275, 300, 300, 325, 325, 325, 325, 325, 325, 325, 300, 300, 300, 275, 275, 250, 250, 275, 275, 275, 275, 300, 300, 325, 325, 325, 350, 350);
var floorTiles = new Array();
var i = 0;
while (i < fx.length) {
floorTiles.push((("grid" + fx[i]) + "x") + fy[i]);
i++;
}
delete fx;
delete fy;
var fpsarr = new Array(30, 30, 30);
var dt = getTimer();
var avefps = 30;
var time = 300;
var time2 = 300;
var enemyUp = 0;
var enemyNum = 1;
var spawnTime = 300;
onEnterFrame = function () {
buildingDamage.gotoAndStop(21 - Math.ceil(_global.hp / 10));
population_mc.populationDisplay.text = "";
var _local9 = _global.population.toString();
var _local7 = _local9.length;
while (_local7 > 0) {
if ((_local7 - 3) > 0) {
population_mc.populationDisplay.text = ("," + _local9.slice(_local7 - 3, _local7)) + population_mc.populationDisplay.text;
} else {
population_mc.populationDisplay.text = _local9.slice(0, _local7) + population_mc.populationDisplay.text;
}
_local7 = _local7 - 3;
}
if (!_global.pauser) {
time--;
if (time <= 0) {
enemyUp++;
if (enemyUp == 3) {
enemyUp = 0;
if (enemyNum < 11) {
enemyNum++;
}
}
spawnEnemy(enemyNum);
if (spawnTime >= 100) {
spawnTime = spawnTime - 60;
} else {
spawnTime = 60;
}
time = random(50) + spawnTime;
}
time2--;
if (time2 <= 0) {
spawnItem();
time2 = random(300) + (320 + spawnTime);
}
var _local11 = (1 / (getTimer() - dt)) * 1000;
dt = getTimer();
fpsarr.push(_local11);
avefps = Math.round(((fpsarr[0] + fpsarr[1]) + fpsarr[2]) / 3);
fpsarr.splice(0, 1);
fpsDisplay.text = avefps + "fps";
for (var _local10 in floorTiles) {
_local7 = 0;
while (_local7 < this[floorTiles[_local10]].length) {
var _local4 = this[floorTiles[_local10]][_local7];
if (ground.hitTest(_local4._x, _local4._y, true)) {
_local4.gotoAndStop(2);
_local4.terrainDamage._rotation = _local4._rotation;
var _local6 = new flash.geom.Matrix();
_local6.translate(_local4._x, _local4._y);
terrainDamage.draw(_local4, _local6);
_local4.myEffect2(_local4);
_local4.swapDepths(this.getNextHighestDepth());
_local4.removeMovieClip();
}
_local7++;
}
}
heatBar.pointer._rotation = ((mc.heat / 100) * 180) - 90;
heatBar.statusText.gotoAndStop(Math.ceil((heatBar.pointer._rotation + 90) / 60));
if (heatBar.statusText._currentframe == 3) {
heatBar._x = 622.1 + random(5);
heatBar._y = -random(5);
} else {
heatBar._x = 622.1;
heatBar._y = 0;
}
heatBar.statusText.ammo.text = ammo;
if (_global.hp <= 0) {
_global.gameOver();
}
var _local8 = new Array();
_global.grid_get(damageZone, _local8);
_local7 = 0;
while (_local7 < _local8.length) {
var _local5 = 0;
while (_local5 < _root[_local8[_local7]].length) {
var _local4 = _root[_local8[_local7]][_local5];
if (_local4.ai) {
if (damageZone.hitTest(_local4._x, _local4._y, true)) {
_global.hp = _global.hp - _local4.damage;
_local4.swapDepths(_root.getNextHighestDepth());
_local4.removeMovieClip();
}
}
_local5++;
}
_local7++;
}
_local7 = 0;
while (_local7 < Stage.width) {
var _local5 = 0;
while (_local5 < Stage.height) {
this[(("grid" + _local7) + "x") + _local5] = [];
_local5 = _local5 + 25;
}
_local7 = _local7 + 25;
}
}
};
onKeyDown = function () {
if (Key.isDown(80)) {
_global.pauseGame();
}
};
Key.addListener(this);
_global.grid_insert = function (it) {
minx = Math.floor((it._x - it._width) / 25) * 25;
miny = Math.floor((it._y - it._height) / 25) * 25;
maxx = Math.floor(it._x / 25) * 25;
maxy = Math.floor(it._y / 25) * 25;
var _local3 = minx;
while (_local3 <= maxx) {
var _local2 = miny;
while (_local2 <= maxy) {
_root[(("grid" + _local3) + "x") + _local2].push(it);
_local2 = _local2 + 25;
}
_local3 = _local3 + 25;
}
};
_global.grid_get = function (it, spaces) {
minx = Math.floor((it._x - it._width) / 25) * 25;
miny = Math.floor((it._y - it._height) / 25) * 25;
maxx = Math.floor(it._x / 25) * 25;
maxy = Math.floor(it._y / 25) * 25;
var _local2 = minx;
while (_local2 <= maxx) {
var _local1 = miny;
while (_local1 <= maxy) {
spaces.push((("grid" + _local2) + "x") + _local1);
_local1 = _local1 + 25;
}
_local2 = _local2 + 25;
}
};
_global.setWeapon = function (num, ammo) {
if (mc.gunRef == num) {
_global.ammo = _global.ammo + ammo;
} else {
mc.gunRef = num;
switch (num) {
case 0 :
bar1.gotoAndStop(1);
mc.bulSpeed = 15;
mc.bulGrav = 0.08;
mc.damage = 0.8;
mc.thermal = 0.25;
mc.rrate = 8;
mc.bulletType = "bullet";
_global.bulletEffect = _global.defaultEffect;
_global.collisionEffect = null;
break;
case 1 :
bar1.gotoAndStop(2);
mc.bulSpeed = 20;
mc.bulGrav = 0.1;
mc.thermal = 0;
mc.damage = 10;
mc.rrate = 60;
mc.bulletType = "bullet2";
_global.bulletEffect = _global.rocketEffect;
_global.collisionEffect = _global.explodeEffect;
break;
case 2 :
bar1.gotoAndStop(3);
mc.bulSpeed = 15;
mc.bulGrav = 0.08;
mc.damage = 1;
mc.thermal = 0;
mc.rrate = 2;
mc.bulletType = "bullet";
_global.bulletEffect = _global.defaultEffect;
_global.collisionEffect = null;
break;
case 3 :
bar1.gotoAndStop(4);
mc.bulSpeed = 10;
mc.bulGrav = 1;
mc.damage = 5;
mc.thermal = 0;
mc.rrate = 40;
mc.bulletType = "bullet4";
_global.bulletEffect = _global.smokeEffect;
_global.collisionEffect = _global.explode2Effect;
break;
case 4 :
bar1.gotoAndStop(5);
mc.bulSpeed = 25;
mc.bulGrav = 0;
mc.damage = 10;
mc.thermal = 0;
mc.rrate = 20;
mc.bulletType = "bullet6";
_global.bulletEffect = _global.trailEffect;
_global.collisionEffect = null;
break;
case 5 :
bar1.gotoAndStop(6);
mc.bulSpeed = 7;
mc.bulGrav = 0.1;
mc.damage = 1.5;
mc.thermal = 0;
mc.rrate = 0;
mc.bulletType = "bullet5";
_global.bulletEffect = null;
_global.collisionEffect = null;
}
_global.ammo = ammo;
}
};
_global.bulletEffect = null;
_global.collisionEffect = null;
_global.defaultEffect = function (mc) {
var _local3 = attachMovie("smoke", "smoke" + getNextHighestDepth(), getNextHighestDepth(), {_x:mc._x, _y:mc._y});
_local3._rotation = mc._rotation;
_local3.onEnterFrame = function () {
if (!_global.pauser) {
this._yscale = (this._xscale = this._xscale + 10);
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this._alpha = this._alpha - 10;
}
};
};
_global.rocketEffect = function (mc) {
var _local4 = attachMovie("smoke2", "smoke" + getNextHighestDepth(), getNextHighestDepth(), {_x:mc._x + (Math.cos((mc._rotation * Math.PI) / 180) * 20), _y:mc._y + (Math.sin((mc._rotation * Math.PI) / 180) * 20)});
_local4._rotation = mc._rotation;
_local4.onEnterFrame = function () {
if (!_global.pauser) {
this._yscale = (this._xscale = this._xscale + 10);
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this._alpha = this._alpha - 7;
}
};
_local4 = attachMovie("smoke3", "smoke" + getNextHighestDepth(), getNextHighestDepth(), {_x:mc._x, _y:mc._y});
_local4._rotation = mc._rotation;
_local4.onEnterFrame = function () {
if (!_global.pauser) {
this._yscale = this._yscale - 3;
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this._alpha = this._alpha - 3;
}
};
};
_global.smokeEffect = function (mc) {
var _local3 = attachMovie("smoke4", "smoke" + getNextHighestDepth(), getNextHighestDepth(), {_x:mc._x, _y:mc._y});
_local3._rotation = mc._rotation;
_local3.onEnterFrame = function () {
if (!_global.pauser) {
this._yscale = (this._xscale = this._xscale + 10);
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this._alpha = this._alpha - 30;
}
};
};
_global.fireEffect = function (mc) {
var _local3 = attachMovie("smoke6", "smoke" + getNextHighestDepth(), getNextHighestDepth(), {_x:mc._x, _y:mc._y});
_local3._rotation = mc._rotation;
_local3.onEnterFrame = function () {
if (!_global.pauser) {
this._yscale = (this._xscale = this._xscale + 20);
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this._alpha = this._alpha - 50;
}
};
};
_global.trailEffect = function (mc) {
var _local3 = attachMovie("smoke7", "smoke" + getNextHighestDepth(), getNextHighestDepth(), {_x:mc._x, _y:mc._y});
_local3._rotation = mc._rotation;
_local3.onEnterFrame = function () {
if (!_global.pauser) {
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this._alpha--;
}
};
};
_global.bloodEffect = function (mc) {
var _local3 = attachMovie("smoke5", "smoke" + getNextHighestDepth(), getNextHighestDepth(), {_x:mc._x, _y:mc._y});
_local3._rotation = 80;
_local3.xspeed = Math.cos((_local3._rotation * Math.PI) / 180) * (random(5) + 5);
_local3.yspeed = Math.sin((_local3._rotation * Math.PI) / 180) * (random(5) + 5);
_local3.onEnterFrame = function () {
this._rotation = this._rotation + this.xspeed;
if (!_global.pauser) {
this._x = this._x - this.xspeed;
this._y = this._y - this.yspeed;
this.yspeed--;
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this._alpha = this._alpha - 7;
}
};
};
_global.explosiveEffect = function (mc) {
var _local4 = 0;
while (_local4 < 35) {
var _local3 = attachMovie("smoke6", "smoke" + getNextHighestDepth(), getNextHighestDepth(), {_x:mc._x, _y:mc._y});
_local3._rotation = random(360);
_local3.xspeed = Math.cos((_local3._rotation * Math.PI) / 180) * (random(5) + 5);
_local3.yspeed = Math.sin((_local3._rotation * Math.PI) / 180) * (random(5) + 5);
_local3.onEnterFrame = function () {
this._xscale = (this._ysclae = this._ysclae - 5);
if (!_global.pauser) {
this._x = this._x - this.xspeed;
this._y = this._y - this.yspeed;
this.yspeed--;
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this._alpha = this._alpha - 5;
}
};
_local4++;
}
};
_global.explodeEffect = function (mc) {
if (!_global.soundOn) {
var _local4 = new Sound(_root);
var _local6 = random(2) + 1;
_local4.attachSound("explosion" + _local6);
_local4.start(0, 0);
}
_global.explosiveEffect(mc);
var _local3 = _root.attachMovie("explosiveHitter", "explosiveHitter" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:mc._x, _y:mc._y});
for (d in _root) {
if (d.slice(0, 5) == "enemy") {
if (_root[d].hitTest(_local3)) {
_root[d].hp = _root[d].hp - 2;
}
}
}
_local3.removeMovieClip();
};
_global.explode2Effect = function (mc) {
if (!_global.soundOn) {
var _local6 = new Sound(_root);
var _local7 = random(2) + 1;
_local6.attachSound("explosion" + _local7);
_local6.start(0, 0);
}
var _local3 = 0;
while (_local3 < 3) {
_global.explosiveEffect(mc);
_local3++;
}
var _local4 = _root.attachMovie("explosiveHitter2", "explosiveHitter" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:mc._x, _y:mc._y});
for (d in _root) {
if (d.slice(0, 5) == "enemy") {
if (_root[d].hitTest(_local4)) {
_root[d].hp = _root[d].hp - 2;
}
}
}
_local4.removeMovieClip();
};
_global.pauseGame = function () {
if (!_global.pauser) {
sky.stop();
_global.pauser = true;
var _local4 = new flash.display.BitmapData(Stage.width, Stage.height);
_local4.draw(_root);
_local4.copyChannel(_local4, _local4.rectangle, new flash.geom.Point(0, 0), 2, 1);
_local4.copyChannel(_local4, _local4.rectangle, new flash.geom.Point(0, 0), 2, 4);
var _local5 = createEmptyMovieClip("pauseContainer", getNextHighestDepth());
_local5.attachBitmap(_local4, 1);
_local5.attachMovie("pauseCopy", "pauseCopy", 2);
_local5._alpha = 1;
_local5.onEnterFrame = function () {
if (this._alpha <= 0) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
if (_global.pauser) {
if (this._alpha < 100) {
this._alpha = this._alpha + 7;
}
} else {
this._alpha = this._alpha - 7;
}
};
} else {
sky.play();
_global.pauser = false;
}
};
_global.gameOver = function () {
_global.pauser = true;
_global.startDissolve();
play();
};
stopAllSounds();
if (_global.musicOn) {
var bgm = new Sound(_root);
bgm.attachSound("gameLoop");
bgm.start(0, 10000);
}
_global.setWeapon(0, 0);
Frame 49
stop();
onEnterFrame = null;
onMouseDown = null;
Key.removeListener(this);
for (var d in _root) {
if ((((d != "crossHair") && (d != "bestPlayer")) && (d != "restart_btn")) && (d != "playMoreGames_btn")) {
_root[d].swapDepths(_root.getNextHighestDepth());
_root[d].removeMovieClip();
}
}
kills.text = "";
_global.population = 99999 - _global.population;
var popText = _global.population.toString();
var i = popText.length;
while (i > 0) {
if ((i - 3) > 0) {
kills.text = ("," + popText.slice(i - 3, i)) + kills.text;
} else {
kills.text = popText.slice(0, i) + kills.text;
}
i = i - 3;
}
kills.text = "Kills: " + kills.text;
position.text = "Sending score...";
var loader = new LoadVars();
loader.username = _global.username;
loader.score = _global.population;
loader.gid = 1;
loader.sendAndLoad("http://rustyarcade.com/permalinks/horizonOfWar/submitScore.php", loader, "POST");
loader.onLoad = function (success) {
if (success) {
position.text = "Calculating your global rank...";
this.score = _global.population;
this.gid = 1;
this.sendAndLoad("http://rustyarcade.com/permalinks/horizonOfWar/getPosition.php", this, "POST");
this.onLoad = function (success) {
if (success) {
position.text = "Global rank: " + this.place;
} else {
position.text = "Failed";
}
};
} else {
position.text = "Failed";
}
};
_global.pauser = false;
restart_btn.onRelease = function () {
_global.startTrans();
gotoAndStop ("Game");
};
playMoreGames_btn.onRelease = function () {
getURL ("http://www.rustyarcade.com/index.php?ref=how", "_blank");
};
Symbol 2 MovieClip [deadbullet6] Frame 1
stop();
Symbol 10 MovieClip Frame 1
stop();
Symbol 389 MovieClip [__Packages.enemy] Frame 0
class enemy extends MovieClip
{
var myPlace, _x, _y, _width, _rotation, angle, rotation, main, hitTest, troop, swapDepths, _parent, removeMovieClip, myEffect;
function enemy () {
super();
}
function onLoad() {
myPlace = 120 + random(60);
}
function onEnterFrame() {
if (!_global.pauser) {
if (speed > 0) {
_x = _x - speed;
while (_root.ground.hitTest(_x, _y, true)) {
_y--;
}
while (!_root.ground.hitTest(_x, _y + 1, true)) {
if (!_root.ground.hitTest(_x, _y + 10, true)) {
break;
}
_y++;
}
var _local11 = _x - (_width / 2);
var _local9 = _y;
var _local10 = _x + (_width / 2);
var _local8 = _y;
while (_root.ground.hitTest(_local11, _local9, true)) {
_local9--;
}
while (!_root.ground.hitTest(_local11, _local9 + 1, true)) {
if (!_root.ground.hitTest(_local11, _local9 + 10, true)) {
break;
}
_local9++;
}
while (_root.ground.hitTest(_local10, _local8, true)) {
_local8--;
}
while (!_root.ground.hitTest(_local10, _local8 + 1, true)) {
if (!_root.ground.hitTest(_local10, _local8 + 10, true)) {
break;
}
_local8++;
}
var _local13 = Math.atan2(_local9 - _local8, _local11 - _local10);
_rotation = 180 + ((_local13 * 180) / Math.PI);
if (_x < myPlace) {
angle = Math.atan2(_root.damageZone._y - _y, _root.damageZone._x - _x);
rotation = (angle * 180) / Math.PI;
main.turret._rotation = (rotation + 180) - _rotation;
var _local12 = new Object({x:main.turret.shootSpot._x, y:main.turret.shootSpot._y});
main.turret.localToGlobal(_local12);
angle = Math.atan2(_root.damageZone._y - _local12.y, _root.damageZone._x - _local12.x);
speed = 0;
}
} else {
if (recoil > rrate) {
recoil = 0;
fire();
}
recoil++;
}
var _local7 = new Array();
_global.grid_get(this, _local7);
var _local6 = 0;
while (_local6 < _local7.length) {
var _local5 = 0;
while (_local5 < _root[_local7[_local6]].length) {
var _local4 = _root[_local7[_local6]][_local5];
if (!_local4.ai) {
if (hitTest(_local4._x, _local4._y, true)) {
hp = hp - _local4.damage;
if (!troop) {
losePart("_part4");
if (random(2) == 1) {
losePart("_part4");
}
}
_local4.myEffect2(_local4);
_local4.swapDepths(_root.getNextHighestDepth());
_local4.removeMovieClip();
}
}
_local5++;
}
_local6++;
}
if (hp <= 0) {
if (troop) {
kill();
} else {
explode();
}
swapDepths(_parent.getNextHighestDepth());
(removeMovieClip());// not popped
}
}
}
function fire() {
var _local5 = _parent.getNextHighestDepth();
var _local3 = _parent.attachMovie(bulletType, "bul" + _local5, _local5);
var _local4 = new Object({x:main.turret.shootSpot._x, y:main.turret.shootSpot._y});
main.turret.localToGlobal(_local4);
_local3._x = _local4.x;
_local3._y = _local4.y;
_local3._rotation = rotation + 180;
_local3.xspeed = Math.cos(angle) * bulSpeed;
_local3.yspeed = Math.sin(angle) * bulSpeed;
_local3.grav = bulGrav;
_local3.damage = damage;
_local3.myEffect = myEffect;
_local3.ai = true;
_local3.onEnterFrame = function () {
if (!_global.pauser) {
this._x = this._x + this.xspeed;
this._y = this._y + this.yspeed;
this.yspeed = this.yspeed + this.grav;
_global.grid_insert(this);
if (this._y > Stage.height) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this.myEffect(this);
}
};
}
function losePart(part) {
var _local3 = _parent.attachMovie(part, "part" + _parent.getNextHighestDepth(), _parent.getNextHighestDepth(), {_x:_x, _y:_y});
if (!troop) {
_local3.xvel = random(11) - 5;
_local3.yvel = random(6) - 15;
_local3.myEffect = _global.smokeEffect;
} else {
_local3.xvel = random(6) - 4;
_local3.yvel = random(6) - 10;
}
_local3.onEnterFrame = function () {
if (!_global.pauser) {
this._rotation = this._rotation + this.xvel;
this._x = this._x + this.xvel;
this._y = this._y + this.yvel;
this.yvel++;
if (this._y > (Stage.height + 100)) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
if (this.yvel < 0) {
this.myEffect(this);
}
}
};
}
function explode() {
if (!_global.soundOn) {
var _local4 = new Sound(_root);
var _local5 = random(2) + 1;
_local4.attachSound("explosion" + _local5);
_local4.start(0, 0);
}
_global.explosiveEffect(this);
losePart("_part1");
losePart("_part2");
losePart("_part2");
losePart("_part3");
losePart("_part4");
losePart("_part4");
losePart("_part4");
losePart("_part5");
losePart("_part5");
_global.population--;
}
function kill() {
if (!_global.soundOn) {
var _local5 = new Sound(_root);
_local5.attachSound("splat");
_local5.start(0, 0);
}
losePart("_part6");
losePart("_part7");
losePart("_part8");
losePart("_part9");
losePart("_part9");
losePart("_part10");
losePart("_part10");
var _local4 = 0;
while (_local4 < 20) {
_global.bloodEffect(this);
_local4++;
}
_global.population--;
}
var recoil = 1000;
var speed = 1.5;
var hp = 4;
var damage = 2;
var rrate = 60;
var bulletType = "bullet";
var bulSpeed = 10;
var bulGrav = 0.1;
}
Symbol 390 MovieClip [__Packages.player] Frame 0
class player extends MovieClip
{
var overHeated, _y, _x, _rotation, turret;
function player () {
super();
}
function onEnterFrame() {
if (!_global.pauser) {
overHeatCheck();
if (!overHeated) {
shoot();
} else {
heat = heat - 0.25;
}
}
}
function onMouseMove() {
var _local3 = Math.atan2(_root._ymouse - _y, _root._xmouse - _x) * 57.2957795130823;
if (Math.abs(_local3) <= 60) {
_rotation = _local3;
}
}
function onMouseDown() {
mouseIsDown = true;
}
function onMouseUp() {
mouseIsDown = false;
}
function shoot() {
if (turret._x < 12) {
turret._x = turret._x - ((turret._x - 12) * 0.5);
}
if (recoil <= 0) {
if (mouseIsDown) {
fire();
turret._x = turret._x - 10;
recoil = rrate;
} else {
recoil = 0;
}
} else {
recoil--;
}
}
function fire() {
var _local5 = new Object({x:turret.shootSpot._x, y:turret.shootSpot._y});
turret.localToGlobal(_local5);
var _local7 = _root.attachMovie("dead" + bulletType, "deadBul" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:_x, _y:_y});
_local7.yspeed = -6;
_local7.onEnterFrame = function () {
this._rotation = this._rotation + (random(3) + 2);
this._y = this._y + this.yspeed;
this.yspeed++;
if (this._y > (Stage.height + 50)) {
this.swapDepths(_root.getNextHighestDepth());
this.removeMovieClip();
}
};
var _local6 = _root.getNextHighestDepth();
var _local4 = _root.attachMovie(bulletType, "bul" + _local6, _local6);
_local4._x = _local5.x;
_local4._y = _local5.y;
_local4._rotation = _rotation;
var ang = ((Math.PI/180) * _rotation);
_local4.xspeed = Math.cos(ang) * bulSpeed;
_local4.yspeed = Math.sin(ang) * bulSpeed;
_local4.grav = bulGrav;
_local4.damage = damage;
_local4.myEffect1 = _global.bulletEffect;
_local4.myEffect2 = _global.collisionEffect;
_local4.onEnterFrame = function () {
if (!_global.pauser) {
this._x = this._x + this.xspeed;
this._y = this._y + this.yspeed;
this.yspeed = this.yspeed + this.grav;
this.ang = Math.atan2(this._y - (this._y + this.yspeed), this._x - (this._x + this.xspeed));
this._rotation = (this.ang * 180) / Math.PI;
_global.grid_insert(this);
if (this._y > Stage.height) {
this.myEffect2(this);
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
}
this.myEffect1(this);
}
};
delete ang;
if (_global.ammo == 1) {
_global.setWeapon(0, 0);
}
_global.ammo--;
}
function overHeatCheck() {
if (mouseIsDown) {
if (heat < 100) {
heat = heat + thermal;
} else {
overHeated = true;
}
}
if ((!mouseIsDown) || (overHeated)) {
if (heat > 0) {
heat = heat - 0.5;
} else {
heat = 0;
overHeated = false;
}
}
}
var recoil = 0;
var heat = 0;
var mouseIsDown = false;
var thermal = 2;
var damage = 1;
var rrate = 4;
var bulletType = "bullet";
var bulSpeed = 10;
var bulGrav = 0.3;
}
Symbol 20 MovieClip [bullet] Frame 1
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("rifle");
sfx.start(0, 0);
}
stop();
Symbol 25 MovieClip [turret] Frame 1
#initclip 15
Object.registerClass("turret", player);
#endinitclip
Symbol 41 MovieClip [tank1] Frame 1
#initclip 3
Object.registerClass("tank1", enemy);
#endinitclip
stop();
Symbol 53 MovieClip [bullet2] Frame 1
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("missile");
sfx.start(0, 0);
}
stop();
Symbol 79 MovieClip [smoke5] Frame 1
gotoAndStop(random(3) + 1);
Symbol 94 MovieClip [troop1] Frame 1
#initclip 4
Object.registerClass("troop1", enemy);
#endinitclip
Symbol 98 MovieClip [deadbullet] Frame 1
stop();
Symbol 99 MovieClip [deadbullet2] Frame 1
stop();
Symbol 116 MovieClip [tank2] Frame 1
#initclip 5
Object.registerClass("tank2", enemy);
#endinitclip
Symbol 130 MovieClip [tank3] Frame 1
#initclip 6
Object.registerClass("tank3", enemy);
#endinitclip
Symbol 131 MovieClip [bullet3] Frame 1
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("missile");
sfx.start(0, 0);
}
stop();
Symbol 133 MovieClip [bullet4] Frame 1
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("mortar");
sfx.start(0, 0);
}
stop();
Symbol 140 MovieClip Frame 60
stop();
Symbol 144 MovieClip [bullet5] Frame 1
stop();
Symbol 146 MovieClip [deadbullet4] Frame 1
stop();
Symbol 160 MovieClip [intro] Frame 112
stop();
this.done = true;
Symbol 169 MovieClip [tank7] Frame 1
#initclip 7
Object.registerClass("tank7", enemy);
#endinitclip
Symbol 175 MovieClip [tank4] Frame 1
#initclip 8
Object.registerClass("tank4", enemy);
#endinitclip
Symbol 181 MovieClip [tank5] Frame 1
#initclip 9
Object.registerClass("tank5", enemy);
#endinitclip
Symbol 192 MovieClip [tank6] Frame 1
#initclip 10
Object.registerClass("tank6", enemy);
#endinitclip
Symbol 197 MovieClip [tank8] Frame 1
#initclip 11
Object.registerClass("tank8", enemy);
#endinitclip
Symbol 204 MovieClip [tank9] Frame 1
#initclip 12
Object.registerClass("tank9", enemy);
#endinitclip
Symbol 217 MovieClip [tank10] Frame 1
#initclip 13
Object.registerClass("tank10", enemy);
#endinitclip
Symbol 223 MovieClip [tank11] Frame 1
#initclip 14
Object.registerClass("tank11", enemy);
#endinitclip
Symbol 224 MovieClip [bullet6] Frame 1
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("sniperRifle");
sfx.start(0, 0);
}
stop();
Symbol 256 MovieClip Frame 1
confirm_btn.onRelease = function () {
_global.username = usernameInput.text;
_visible = false;
};
Symbol 361 MovieClip Frame 1
stop();
Symbol 368 MovieClip Frame 1
stop();
Symbol 368 MovieClip Frame 3
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("alarm");
sfx.start(0, 0);
}
Symbol 374 MovieClip Frame 1
stop();
Symbol 379 MovieClip Frame 1
stop();
Symbol 379 MovieClip Frame 2
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("reload");
sfx.start(0, 0);
}
Symbol 379 MovieClip Frame 3
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("reload");
sfx.start(0, 0);
}
Symbol 379 MovieClip Frame 4
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("reload");
sfx.start(0, 0);
}
Symbol 379 MovieClip Frame 5
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("reload");
sfx.start(0, 0);
}
Symbol 379 MovieClip Frame 6
if (!_global.soundOn) {
var sfx = new Sound(_root);
sfx.attachSound("reload");
sfx.start(0, 0);
}