Frame 1
function onEnterFrame() {
if (this._currentframe == 1) {
bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded / bytes_total;
loader._xscale = getPercent * 100;
if ((bytes_loaded == bytes_total) && (thePlay._x < 0)) {
if ((domain == "jaludo.com") || (domain == "media.jaludo.com")) {
}
loader._x = 1000;
outer._x = 1000;
thePlay._x = 192;
createStartHoverer(thePlay.s1);
createStartHoverer(thePlay.s2);
thePlay.s1.onRelease = function () {
gotoAndStop (2);
};
thePlay.s2.onRelease = function () {
gotoAndStop (2);
muted = true;
};
}
}
}
function createStartHoverer(button) {
button.onRollOver = function () {
button.gotoAndStop(2);
};
button.onRollOut = function () {
button.gotoAndStop(1);
};
button.onReleaseOutside = function () {
button.gotoAndStop(1);
};
}
function goToThisURL() {
getURL ("http://armor.ag/MoreGames", "_blank");
}
function createContextMenu(menu) {
_root.menu = menu;
}
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;
var pv;
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);
}
pv = ((fv == 5) ? (getVersion()) : (System.capabilities.version));
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=8&fv=") + fv) + "&v=") + escape(pv)) + "&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);
}
stop();
muted = false;
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
var mainItem = new ContextMenuItem("Play More Games", goToThisURL);
myMenu.customItems.push(mainItem);
createContextMenu(myMenu);
urlStart = _url.indexOf("://") + 3;
urlEnd = _url.indexOf("/", urlStart);
domain = _url.substring(urlStart, urlEnd);
LastDot = domain.lastIndexOf(".") - 1;
domEnd = domain.lastIndexOf(".", LastDot) + 1;
domain = domain.substring(domEnd, domain.length);
if ((domain == "armorgames.com") || (domain == "www.armorgames.com")) {
} else {
__com_mochibot__("4ef79aaa", this, 10301, true);
var CPMStarContentSpotID = "7396Q9287487D";
System.security.allowDomain("server.cpmstar.com");
adBox.loadMovie("http://server.cpmstar.com/adviewas2.swf?contentspotid=" + CPMStarContentSpotID);
}
Frame 2
if (muted) {
var laserShot = new Sound();
laserShot.attachSound("laserShot.mp3");
laserShot.setVolume(0);
}
toArmor.onRelease = function () {
getURL ("http://armor.ag/MoreGames", "_blank");
};
Frame 3
function resetValues() {
gameCompleted = false;
highscoreEasy = 0;
highscoreMedium = 0;
highscoreHard = 0;
}
function loadGame() {
if (sObject.data.gameCompleted != undefined) {
gameCompleted = sObject.data.gameCompleted;
}
if (sObject.data.highscoreEasy != undefined) {
highscoreEasy = sObject.data.highscoreEasy;
}
if (sObject.data.highscoreMedium != undefined) {
highscoreMedium = sObject.data.highscoreMedium;
}
if (sObject.data.highscoreHard != undefined) {
highscoreHard = sObject.data.highscoreHard;
}
}
function saveGame() {
sObject.data.gameCompleted = gameCompleted;
sObject.data.highscoreEasy = highscoreEasy;
sObject.data.highscoreMedium = highscoreMedium;
sObject.data.highscoreHard = highscoreHard;
sObject.flush();
}
function enemyManagement() {
enemyDelay = enemyDelay - 1;
if (enemyDelay <= 0) {
enemyDelay = enemyDelayConst;
createEnemy();
}
enemyMovement();
}
function createEnemy() {
enemy = attachMovie("enemy", "enemy" + depth, depth++);
enemy.gotoAndStop(enemy.Type);
enemy._y = 339 - (enemy._height / 2);
enemy._x = Stage.width + (enemy._width / 2);
enemy.xSpeed = 0;
enemy.ySpeed = 0;
enemy.Speed = -0.3;
createEnemyButton(enemy);
enemies.push(enemy);
}
function createEnemyButton(enemy) {
enemy.onRelease = function () {
explosion = attachMovie("explosion", "explosion" + depth, depth++);
explosion._x = enemy._x;
explosion._y = enemy._y;
i = enemies.length - 1;
while (i >= 0) {
if (enemies[i] == enemy) {
enemy.removeMovieClip();
enemies.splice(i, 1);
bunniesKilled = bunniesKilled + 1;
if (bunniesKilled > 1) {
bunnyKilledTxt.htmlText = bunniesKilled + " bunnies were harmed in the making of this game.";
} else {
bunnyKilledTxt.htmlText = bunniesKilled + " bunny was harmed in the making of this game.";
}
}
i--;
}
};
}
function enemyMovement() {
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
enemy.bunIn.bunIn.play();
enemy.xSpeed = enemy.xSpeed + enemy.Speed;
enemy.ySpeed = enemy.ySpeed + gravity;
enemy.xSpeed = enemy.xSpeed * friction;
enemy.ySpeed = enemy.ySpeed * airFriction;
if ((enemy.bunIn.bunIn._currentframe > 11) || (!enemy.hitTest(floor))) {
enemy._x = enemy._x + (enemy.xSpeed * 2);
if (!enemy.hitTest(floor)) {
enemy._x = enemy._x - enemy.xSpeed;
}
}
enemy._y = enemy._y + enemy.ySpeed;
if (enemy.hitTest(floor)) {
if (enemy.ySpeed > 5) {
enemy._y = 339 - (enemy._height / 2);
enemy.ySpeed = enemy.ySpeed * -0.5;
} else {
enemy._y = 339 - (enemy._height / 2);
enemy.ySpeed = 0;
}
} else if (enemy.ice._currentframe == 1) {
enemy.bunIn.bunIn.gotoAndStop(10);
}
if (enemy._x <= (-(enemy._width / 2))) {
removeEnemy();
}
e--;
}
}
function removeEnemy() {
enemy.removeMovieClip();
enemies.splice(e, 1);
}
function onEnterFrame() {
selector._x = selector._x + ((difButtons[selectorNum - 1]._x - selector._x) / 4);
if (pMax) {
pBtn._xscale = pBtn._xscale + ((150 - pBtn._xscale) / 2);
} else {
pBtn._xscale = pBtn._xscale + ((100 - pBtn._xscale) / 2);
}
pBtn._yscale = pBtn._xscale;
if (cMax) {
cBtn._xscale = cBtn._xscale + ((150 - cBtn._xscale) / 2);
} else {
cBtn._xscale = cBtn._xscale + ((100 - cBtn._xscale) / 2);
}
cBtn._yscale = cBtn._xscale;
if (mMax) {
mBtn._xscale = mBtn._xscale + ((150 - mBtn._xscale) / 2);
} else {
mBtn._xscale = mBtn._xscale + ((100 - mBtn._xscale) / 2);
}
mBtn._yscale = mBtn._xscale;
if (bMax) {
bBtn._xscale = bBtn._xscale + ((150 - bBtn._xscale) / 2);
} else {
bBtn._xscale = bBtn._xscale + ((100 - bBtn._xscale) / 2);
}
bBtn._yscale = bBtn._xscale;
enemyManagement();
}
function createGenericHoverer(button, num) {
button.onRollOver = function () {
if (selectorNum != num) {
button.gotoAndStop(2);
}
};
button.onRollOut = function () {
button.gotoAndStop(1);
};
button.onReleaseOutside = function () {
button.gotoAndStop(1);
};
}
stop();
song.stop();
enemyDelay = 0;
enemyDelayConst = 90;
theArrow2._alpha = 0;
resetValues();
sObject = SharedObject.getLocal("saveFile");
loadGame();
depth = 100;
enemies = new Array();
friction = 0.9;
airFriction = 0.95;
gravity = 1;
bunniesKilled = 0;
pMax = false;
cMax = false;
mMax = false;
bMax = false;
pBtn.onRollOver = function () {
pMax = true;
};
pBtn.onRollOut = function () {
pMax = false;
};
cBtn.onRollOver = function () {
cMax = true;
};
cBtn.onRollOut = function () {
cMax = false;
};
mBtn.onRollOver = function () {
mMax = true;
};
mBtn.onRollOut = function () {
mMax = false;
};
limitless = false;
if (gameCompleted) {
bBtn._alpha = 100;
bBtn.gotoAndStop(2);
bBtn.onRollOver = function () {
bMax = true;
};
bBtn.onRollOut = function () {
bMax = false;
};
bBtn.onRelease = function () {
gotoAndStop (4);
limitless = true;
};
}
pBtn.onRelease = function () {
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
removeEnemy();
e--;
}
gotoAndStop (4);
};
cBtn.onRelease = function () {
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
removeEnemy();
e--;
}
gotoAndStop (5);
};
mBtn.onRelease = function () {
getURL ("http://armor.ag/MoreGames", "_blank");
};
kills = 0;
selectorNum = 2;
difButtons = new Array(e1, e2, e3);
createGenericHoverer(e1, 1);
createGenericHoverer(e2, 2);
createGenericHoverer(e3, 3);
e1.onRelease = function () {
if (!gameCompleted) {
theArrow2._alpha = 100;
}
selectorNum = 1;
e1.gotoAndStop(1);
};
e2.onRelease = function () {
if (!gameCompleted) {
theArrow2._alpha = 100;
}
selectorNum = 2;
e2.gotoAndStop(1);
};
e3.onRelease = function () {
if (!gameCompleted) {
theArrow2._alpha = 100;
}
selectorNum = 3;
e3.gotoAndStop(1);
};
createStartHoverer(lUs);
createStartHoverer(f1);
lUs.onRelease = function () {
getURL ("http://www.facebook.com/ArmorGames", "_blank");
};
f1.onRelease = function () {
getURL ("https://twitter.com/Zaguios", "_blank");
};
ag.onRelease = function () {
getURL ("http://armor.ag/MoreGames", "_blank");
};
Frame 4
function displayManagement() {
if (inDisplay && (!inShop)) {
if ((info._alpha < 100) && (displayLeft >= 25)) {
info._alpha = info._alpha + ((100 - info._alpha) / 5);
}
displayLeft = displayLeft - 1;
if (displayLeft <= 25) {
info._alpha = displayLeft * 4;
if (displayLeft <= 0) {
info._alpha = 0;
inDisplay = false;
}
}
}
}
function daySetup() {
day = day + 1;
if ((day == (dayGoal + 1)) && (!limitless)) {
gamePause = true;
gameComplete = attachMovie("gameCompleteScreen", "gameCompleteScreen", 987500);
gameComplete._x = Stage.width / 2;
gameComplete._y = 230;
inGameComplete = true;
gameComplete.bBtn.onRollOver = function () {
bMax = true;
};
gameComplete.bBtn.onRollOut = function () {
bMax = false;
};
gameComplete.bBtn.onRelease = function () {
gameComplete.removeMovieClip();
gamePause = false;
};
gameCompleted = true;
saveGame();
}
if (day >= newDisplays[atDisplay]) {
info.gotoAndStop(atDisplay + 4);
atDisplay = atDisplay + 1;
inDisplay = true;
displayLeft = displayLeftConst;
}
if (!inTutorial) {
waver.gotoAndPlay(2);
waver.w1.waveTxt.htmlText = bold("Wave " + day);
newWave.start();
}
enemiesLeft = enemiesByDay[day - 1];
enemyTypes = enemyTypesByDay[day - 1];
enemyDelayConst = enemyDelayConsts[day - 1];
}
function formatNumber(number) {
var _local1 = number.toString();
var _local3 = "";
while (_local1.length > 3) {
var _local2 = _local1.substr(-3);
_local1 = _local1.substr(0, _local1.length - 3);
_local3 = ("," + _local2) + _local3;
}
if (_local1.length > 0) {
_local3 = _local1 + _local3;
}
return(_local3);
}
function updateStats() {
floor.healthTxt.htmlText = bold(Math.floor((health / healthMax) * 100) + "%");
floor.coinsTxt.htmlText = bold(formatNumber(coins));
floor.killsTxt.htmlText = bold(((enemiesByDay[day - 1] - (enemiesLeft + enemies.length)) + "/") + enemiesByDay[day - 1]);
floor.dayTxt.htmlText = bold((("Wave " + day) + "/") + dayGoal);
}
function enemyManagement() {
enemyDelay = enemyDelay - 1;
if ((enemyDelay <= 0) && (waver._currentframe == 1)) {
enemyDelay = enemyDelayConst;
if (enemiesLeft > 0) {
enemiesLeft = enemiesLeft - 1;
createEnemy();
}
}
enemyMovement();
}
function createEnemy() {
enemy = attachMovie("enemy", "enemy" + depth, depth++);
enemy.onScreen = false;
enemy.Type = random(enemyTypes) + 1;
if (day == 25) {
if (random(2) == 1) {
enemy.Type = 5;
}
}
enemy.gotoAndStop(enemy.Type);
enemy.bunIn.bunIn.b1.gotoAndStop(enemy.Type);
enemy.bunIn.bunIn.n1.gotoAndStop(enemy.Type);
enemy.bunIn.bunIn.e1.gotoAndStop(enemy.Type);
enemy.bunIn.bunIn.e2.gotoAndStop(enemy.Type);
enemy.healthMax = enemyHealths[enemy.Type - 1];
enemy.health = enemy.healthMax;
hBar = attachMovie("healthBar", "healthBar" + depth, depth++);
enemy.hBar = hBar;
enemy.invuln = false;
if ((enemy.Type != 3) && (enemy.Type != 5)) {
enemy._y = 339 - (enemy._height / 2);
} else {
enemy._y = random(260) + 40;
}
if ((enemy.Type == 4) || (enemy.Type == 5)) {
enemy.invuln = true;
enemy.invulnLeft = random(50) + 50;
}
enemy._x = Stage.width + (enemy._width / 2);
enemy.xSpeed = 0;
enemy.ySpeed = 0;
enemy.Speed = -0.3;
enemies.push(enemy);
}
function enemyMovement() {
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (enemy.ice._currentframe == 1) {
enemy.bunIn.bunIn.play();
enemy.xSpeed = enemy.xSpeed + enemy.Speed;
}
if ((enemy.Type == 4) || (enemy.Type == 5)) {
enemy.invulnLeft = enemy.invulnLeft - 1;
if (enemy.invuln) {
enemy._alpha = 50;
if (enemy.invulnLeft <= 0) {
enemy.invuln = false;
}
} else {
enemy._alpha = 100;
if ((random(50) == 1) && (enemy.invulnLeft <= -50)) {
if (random(2) == 1) {
enemy.invuln = true;
enemy.invulnLeft = random(50) + 50;
} else {
enemy.invuln = false;
enemy.invulnLeft = random(100);
}
}
}
}
if ((enemy.Type != 3) && (enemy.Type != 5)) {
enemy.ySpeed = enemy.ySpeed + gravity;
}
enemy.xSpeed = enemy.xSpeed * friction;
enemy.ySpeed = enemy.ySpeed * airFriction;
if ((!floor.hitTest(enemy._x, enemy._y + 50, true)) && (enemy.ice._currentframe == 1)) {
enemy.bunIn._rotation = ((Math.atan2(enemy.ySpeed, enemy.xSpeed) * 180) / Math.PI) + 180;
} else {
enemy.bunIn._rotation = 0;
}
if ((enemy.bunIn.bunIn._currentframe > 11) || (!enemy.hitTest(floor))) {
enemy._x = enemy._x + (enemy.xSpeed * 2);
if (!enemy.hitTest(floor)) {
enemy._x = enemy._x - enemy.xSpeed;
if (day == 25) {
enemy._x = enemy._x - (enemy.xSpeed * 0.5);
}
}
}
if (enemy._x <= (Stage.width - (enemy._width / 2))) {
enemy.onStage = true;
}
enemy._y = enemy._y + enemy.ySpeed;
if (enemy.hitTest(floor)) {
if (enemy.ySpeed > 5) {
enemy._y = 339 - (enemy._height / 2);
enemy.ySpeed = enemy.ySpeed * -0.5;
} else {
enemy._y = 339 - (enemy._height / 2);
enemy.ySpeed = 0;
}
} else if (enemy.ice._currentframe == 1) {
enemy.bunIn.bunIn.gotoAndStop(10);
}
if ((enemy._x >= (Stage.width - (enemy._width / 2))) && (enemy.onStage)) {
enemy._x = Stage.width - (enemy._width / 2);
enemy.xSpeed = enemy.xSpeed * -1;
}
if (enemy._x >= 800) {
enemy._x = 800;
enemy.xSpeed = 0;
}
if (enemy._y <= (enemy._height / 2)) {
enemy.ySpeed = enemy.ySpeed * -1;
enemy._y = enemy._height / 2;
}
enemy.hBar._x = enemy._x;
enemy.hBar._y = enemy._y - 20;
if (enemy._x <= (-(enemy._width / 2))) {
shake = 1;
flasher.gotoAndPlay(2);
flasher.f1.gotoAndStop(2);
if (gameMode == 1) {
health = health - 2;
}
if (gameMode == 2) {
health = health - 5;
}
if (gameMode == 3) {
health = health - 10;
}
if (health <= 0) {
health = 0;
clearScreen();
gotoAndStop (6);
}
removeEnemy();
}
e--;
}
}
function removeEnemy() {
enemy.hBar.removeMovieClip();
enemy.removeMovieClip();
enemies.splice(e, 1);
if ((enemies.length <= 0) && (enemiesLeft <= 0)) {
daySetup();
}
}
function tutorialManagement() {
if (inTutorial) {
if (arrowStage == 4) {
infoTime = infoTime - 1;
if (infoTime <= 25) {
info._alpha = infoTime * 4;
}
if (infoTime <= 0) {
info.swapDepths(500500);
inTutorial = false;
waver.gotoAndPlay(2);
newWave.start();
waver.w1.waveTxt.htmlText = bold("Wave " + day);
gamePause = false;
arrowStage = 5;
}
}
}
}
function onEnterFrame() {
if (inGameComplete) {
if (bMax) {
gameComplete.bBtn._xscale = gameComplete.bBtn._xscale + ((150 - gameComplete.bBtn._xscale) / 2);
} else {
gameComplete.bBtn._xscale = gameComplete.bBtn._xscale + ((100 - gameComplete.bBtn._xscale) / 2);
}
gameComplete.bBtn._yscale = gameComplete.bBtn._xscale;
} else if (waver._currentframe != 1) {
waver.play();
}
tutorialManagement();
displayManagement();
shopManagement();
if ((!gamePause) && (!playerPause)) {
arrowCannonManagement();
enemyManagement();
gunManagement();
bouncerManagement();
blimpManagement();
spikeManagement();
particleManagement();
}
shaker();
updateStats();
wasMDown = mDown;
}
function createSpike() {
spike = attachMovie("groundSpike", "groundSpike" + depth, depth++);
spike.gotoAndStop(5);
spike.shotDelay = 10;
spike._x = _xmouse;
spike._y = _ymouse;
return(spike);
}
function spikeManagement() {
s = spikes.length - 1;
while (s >= 0) {
spike = spikes[s];
spike.shotDelay = spike.shotDelay - 1;
if (spike.shotDelay <= 0) {
hittingEnemy = false;
spike.gotoAndStop(5);
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (((Math.abs(spike._x - enemy._x) <= 10) && (Math.abs(spike._y - enemy._y) <= 30)) && (!enemy.invuln)) {
hittingEnemy = true;
}
e--;
}
if (hittingEnemy) {
spike.shotDelay = 30;
spike.gotoAndPlay(2);
spikeHit.start();
} else {
spike.gotoAndStop(1);
}
}
if (spike._currentframe == 5) {
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (enemy.hitTest(spike)) {
if (enemy.invuln == false) {
enemy.ySpeed = -20;
hitStuff();
}
enemy.hBar.inBar._xscale = Math.floor((enemy.health / enemy.healthMax) * 100);
testDeath();
}
e--;
}
}
s--;
}
}
function testDeath() {
if (enemy.health <= 0) {
kills = kills + 1;
flasher.gotoAndPlay(2);
flasher.f1.gotoAndStop(1);
createParticles(20, enemy);
coins = coins + enemyRewards[enemy.Type - 1];
if (inShop) {
shopButtons = new Array(shop.s1, shop.s2, shop.s3, shop.s4, shop.s5, shop.s6);
s = shopButtons.length - 1;
while (s >= 0) {
createShopButton(shopButtons[s], s);
s--;
}
}
rewarder = attachMovie("enemyReward", "enemyReward" + depth, depth++);
rewarder._x = enemy._x;
rewarder._y = enemy._y;
rewarder.r1.moneyTxt.htmlText = bold(formatNumber(enemyRewards[enemy.Type - 1]));
shake = 1;
bang.start();
removeEnemy();
}
}
function createBlimp() {
blimp = attachMovie("blimp", "blimp" + depth, depth++);
blimp.attackDelay = 10;
blimp._x = _xmouse;
blimp._y = _ymouse;
return(blimp);
}
function blimpManagement() {
b = blimps.length - 1;
while (b >= 0) {
blimp = blimps[b];
blimp.attackDelay = blimp.attackDelay - 1;
nearEnemy = false;
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (Math.abs(enemy._x - blimp._x) <= 75) {
nearEnemy = true;
}
e--;
}
if ((blimp.attackDelay <= 0) && (nearEnemy)) {
createBomb();
blimp.attackDelay = 30 + random(30);
}
b--;
}
bombManagement();
}
function createBomb() {
bomb = attachMovie("bomb", "bomb" + depth, depth++);
bomb._x = blimp._x;
bomb._y = blimp._y + 30;
bomb.xSpeed = (10 * Math.random()) - 5;
bomb.ySpeed = 0;
bombs.push(bomb);
}
function bombManagement() {
b = bombs.length - 1;
while (b >= 0) {
bomb = bombs[b];
bomb.ySpeed = bomb.ySpeed + 1;
bomb.ySpeed = bomb.ySpeed * airFriction;
bomb._y = bomb._y + bomb.ySpeed;
bomb.xSpeed = bomb.xSpeed * airFriction;
bomb._x = bomb._x + bomb.xSpeed;
if (bomb.hitTest(floor)) {
boom.start();
explosion = attachMovie("explosion", "explosion" + depth, depth++);
explosion._x = bomb._x;
explosion._y = bomb._y;
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (explosion.hitBox.hitTest(enemy)) {
if (enemy.invuln == false) {
enemy.ySpeed = -20;
hitStuff();
}
enemy.hBar.inBar._xscale = Math.floor((enemy.health / enemy.healthMax) * 100);
testDeath();
}
e--;
}
removeBomb();
} else {
exploding = false;
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (bomb.hitTest(enemy)) {
if (enemy.invuln == false) {
boom.start();
explosion = attachMovie("explosion", "explosion" + depth, depth++);
explosion._x = bomb._x;
explosion._y = bomb._y;
exploding = true;
}
}
e--;
}
if (exploding) {
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (explosion.hitBox.hitTest(enemy)) {
if (enemy.invuln == false) {
enemy.ySpeed = -20;
hitStuff();
enemy.hBar.inBar._xscale = Math.floor((enemy.health / enemy.healthMax) * 100);
testDeath();
}
}
e--;
}
removeBomb();
}
}
b--;
}
}
function removeBomb() {
bomb.removeMovieClip();
bombs.splice(b, 1);
}
function hitStuff() {
enemy.health = enemy.health - 1;
enemy.bunIn.gotoAndPlay(2);
hit = attachMovie("hitAnim", "hitAnim" + depth, depth++);
hit._x = enemy._x;
hit._y = enemy._y;
}
function createBouncer() {
bouncer = attachMovie("bouncer", "bouncer" + depth, depth++);
bouncer._x = _xmouse;
bouncer._y = _ymouse;
return(bouncer);
}
function bouncerManagement() {
b = bouncers.length - 1;
while (b >= 0) {
bouncer = bouncers[b];
if (bouncer.bumper._currentframe == 1) {
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (Math.sqrt(((enemy._x - bouncer._x) * (enemy._x - bouncer._x)) + ((enemy._y - bouncer._y) * (enemy._y - bouncer._y))) <= ((bouncer._width / 2) + (enemy._width / 2))) {
if (enemy.invuln == false) {
shotHit.start();
bouncer.bumper.gotoAndPlay(2);
theDir = Math.atan2(enemy._y - bouncer._y, enemy._x - bouncer._x);
enemy.xSpeed = Math.cos(theDir) * 15;
enemy.ySpeed = Math.sin(theDir) * 15;
enemy._x = enemy._x + (enemy.xSpeed * 2);
enemy._y = enemy._y + (enemy.ySpeed * 2);
hitStuff();
}
enemy.hBar.inBar._xscale = Math.floor((enemy.health / enemy.healthMax) * 100);
testDeath();
}
e--;
}
}
b--;
}
}
function createArrowCannon() {
arrowCannon = attachMovie("flakGun", "arrowCannon" + depth, depth++);
arrowCannon.shotDelay = 10;
arrowCannon._x = 0;
arrowCannon._y = _ymouse;
return(arrowCannon);
}
function arrowCannonManagement() {
a = arrowCannons.length - 1;
while (a >= 0) {
arrowCannon = arrowCannons[a];
arrowCannon.shotDelay = arrowCannon.shotDelay - 1;
if ((arrowCannon.shotDelay <= 0) && (enemies.length != 0)) {
arrowShotS.start();
arrowCannon.gotoAndPlay(2);
arrowCannon.shotDelay = 60;
e = 0;
while (e < 5) {
createArrow();
e++;
}
}
a--;
}
arrowManagement();
}
function createArrow() {
arrowShot = attachMovie("arrowShot", "arrowShot" + depth, depth++);
arrowShot._y = arrowCannon._y;
arrowDir = (Math.random() * (Math.PI/2)) - (Math.PI/4);
arrowPower = 10 + random(20);
arrowShot.xSpeed = Math.cos(arrowDir) * arrowPower;
arrowShot.ySpeed = Math.sin(arrowDir) * arrowPower;
arrowShot._x = arrowShot._x + (arrowShot.xSpeed * 2);
arrowShot._y = arrowShot._y + (arrowShot.ySpeed * 2);
arrowShot._rotation = (Math.atan2(arrowShot.ySpeed, arrowShot.xSpeed) * 180) / Math.PI;
arrowShot.decayDelay = 50;
arrows.push(arrowShot);
}
function arrowManagement() {
a = arrows.length - 1;
while (a >= 0) {
arrowShot = arrows[a];
arrowShot.ySpeed = arrowShot.ySpeed + (gravity / 2);
arrowShot.ySpeed = arrowShot.ySpeed * 0.98;
arrowShot.xSpeed = arrowShot.xSpeed * 0.98;
arrowShot._x = arrowShot._x + arrowShot.xSpeed;
arrowShot._y = arrowShot._y + arrowShot.ySpeed;
if (arrowShot.xSpeed != 0) {
arrowShot._rotation = (Math.atan2(arrowShot.ySpeed, arrowShot.xSpeed) * 180) / Math.PI;
}
if (floor.hitTest(arrowShot._x, arrowShot._y, true) || (arrowShot._y >= Stage.height)) {
arrowShot.xSpeed = 0;
arrowShot.ySpeed = 0;
arrowShot._y = floor._y - (floor._height / 2);
arrowShot.decayDelay = arrowShot.decayDelay - 1;
if (arrowShot.decayDelay <= 25) {
arrowShot._alpha = arrowShot.decayDelay * 4;
if (arrowShot.decayDelay <= 0) {
removeArrow();
}
}
} else {
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
if (enemy.hitTest(arrowShot._x, arrowShot._y, true)) {
if (!enemy.invuln) {
hitStuff();
hitStuff();
}
enemy.hBar.inBar._xscale = Math.floor((enemy.health / enemy.healthMax) * 100);
if (enemy.invuln == false) {
enemy.ySpeed = -10;
enemy.xSpeed = enemy.xSpeed + 5;
}
testDeath();
removeArrow();
}
e--;
}
}
a--;
}
}
function removeArrow() {
arrowShot.removeMovieClip();
arrows.splice(a, 1);
}
function createGun() {
if (placingNum == 0) {
gun = attachMovie("gun", "gun" + depth, depth++);
}
if (placingNum == 1) {
gun = attachMovie("iceGun", "gun" + depth, depth++);
}
gun.shotDelay = 10;
gun.Type = placingNum + 1;
gun._x = _xmouse;
gun._y = _ymouse;
return(gun);
}
function gunManagement() {
g = guns.length - 1;
while (g >= 0) {
gun = guns[g];
if (enemies.length != 0) {
closestEnemy = null;
theDist = 999999999 /* 0x3B9AC9FF */;
theE = -1;
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
newDist = Math.sqrt(((enemy._x - gun._x) * (enemy._x - gun._x)) + ((enemy._y - gun._y) * (enemy._y - gun._y)));
if (((newDist <= theDist) && (!enemy.invuln)) && (enemy._x <= (Stage.width - (enemy._width / 2)))) {
theDist = newDist;
closestEnemy = enemy;
theE = e;
}
e--;
}
if (closestEnemy != null) {
if (gun.theEyes._currentframe == 1) {
if (random(70) == 1) {
gun.theEyes.gotoAndPlay(2);
}
}
gun.barrel._rotation = (Math.atan2(closestEnemy._y - gun._y, closestEnemy._x - gun._x) * 180) / Math.PI;
gun.eye1._rotation = gun.barrel._rotation;
gun.eye2._rotation = gun.barrel._rotation;
gun.shotDelay = gun.shotDelay - 1;
if ((gun.shotDelay <= 0) && (theDist <= 250)) {
gun.shotDelay = 30;
gun.barrel.gotoAndPlay(2);
enemy = closestEnemy;
e = theE;
machineShot(gun);
}
if ((gun.shotDelay <= 0) && (theDist > 250)) {
gun.mouth.gotoAndStop(2);
} else {
gun.mouth.gotoAndStop(1);
}
}
}
g--;
}
b = bullets.length - 1;
while (b >= 0) {
bullet = bullets[b];
bullet._alpha = bullet._alpha - 33;
if (bullet._alpha <= 2) {
bullet.removeMovieClip();
bullets.splice(b, 1);
}
b--;
}
}
function createGenericHover(button) {
button.onRollOver = function () {
button.gotoAndStop(2);
};
button.onRollOut = function () {
button.gotoAndStop(1);
};
button.onReleaseOutside = function () {
button.gotoAndStop(1);
};
}
function createGenericHover2(button) {
button.onRollOver = function () {
button.backing.gotoAndStop(2);
rollover.start();
};
button.onRollOut = function () {
button.backing.gotoAndStop(1);
};
button.onReleaseOutside = function () {
button.backing.gotoAndStop(1);
};
}
function createShop() {
if (arrowStage == 1) {
arrowStage = 2;
theArrow._x = 190;
theArrow._y = 70;
theArrow._alpha = 0;
theArrow.a1.gotoAndStop(2);
}
inShop = true;
shopButtons = new Array(shop.s1, shop.s2, shop.s3, shop.s4, shop.s5, shop.s6);
s = shopButtons.length - 1;
while (s >= 0) {
createShopButton(shopButtons[s], s);
s--;
}
createGenericHover(shop.fin);
shop.fin.onRelease = function () {
inShop = false;
if (arrowStage == 2) {
arrowStage = 1;
theArrow._x = 654;
theArrow._y = 350;
theArrow.a1.gotoAndStop(1);
theArrow._alpha = 100;
}
};
}
function bold(item) {
return(("<b>" + item) + "</b>");
}
function createShopButton(button, num) {
delete button.onRollOver;
delete button.onRollOut;
delete button.onRelease;
delete button.onReleaseOutside;
button.shopIcon.gotoAndStop(num + 1);
button.shopIcon.g1.gr.gotoAndStop(2);
button.nameTxt.htmlText = bold(upgradeNames[num]);
button.costTxt.htmlText = bold(formatNumber(upgradeCosts[num][upgradesBought[num]]));
button.descTxt.htmlText = bold(upgradeDescriptions[num]);
if ((coins >= upgradeCosts[num][upgradesBought[num]]) && (upgradesBought[num] < upgradeMaxes[num])) {
button._alpha = 100;
createGenericHover2(button);
button.onRelease = function () {
if (coins >= upgradeCosts[num][upgradesBought[num]]) {
if (arrowStage == 2) {
arrowStage = 3;
info.gotoAndStop(2);
theArrow._alpha = 0;
}
coins = coins - upgradeCosts[num][upgradesBought[num]];
purchase.start();
purchase.start();
upgradesBought[num] = upgradesBought[num] + 1;
inShop = false;
placingItem = true;
placingNum = num;
itemPlacing = createFunctions[num]();
aa._alpha = 100;
mDown = false;
wasMDown = false;
}
};
} else {
if (upgradesBought[num] >= upgradeMaxes[num]) {
button.costTxt.htmlText = bold("MAXED");
}
button._alpha = 50;
}
}
function hypot(xer, yer) {
return(Math.sqrt((xer * xer) + (yer * yer)));
}
function hypotObj(object1, object2) {
return(hypot(object1._x - object2._x, object1._y - object2._y));
}
function shopManagement() {
if (placingItem) {
itemPlacing._x = _xmouse;
itemPlacing._y = _ymouse;
if ((_ymouse + (turretHeights[placingNum] / 2)) >= (Stage.height - 150)) {
itemPlacing._y = (Stage.height - 150) - (turretHeights[placingNum] / 2);
}
if ((_ymouse - (turretHeights[placingNum] / 2)) <= 33) {
itemPlacing._y = 33 + (turretHeights[placingNum] / 2);
}
if ((_xmouse + (turretWidths[placingNum] / 2)) >= (Stage.width - 50)) {
itemPlacing._x = (Stage.width - 50) - (turretWidths[placingNum] / 2);
}
if ((_xmouse - (turretWidths[placingNum] / 2)) <= 50) {
itemPlacing._x = 50 + (turretWidths[placingNum] / 2);
}
if (inTutorial) {
if (_ymouse <= 130) {
itemPlacing._y = 130;
}
}
if (placingNum == 2) {
itemPlacing._y = 339;
}
if (placingNum == 5) {
itemPlacing._x = 0;
}
isHitting = false;
if (placingNum == 2) {
s = spikes.length - 1;
while (s >= 0) {
spike = spikes[s];
if (itemPlacing.hitTest(spike)) {
isHitting = true;
aa.gotoAndStop(4);
}
s--;
}
}
if (placingNum == 5) {
a = arrowCannons.length - 1;
while (a >= 0) {
arrowCannon = arrowCannons[a];
if (itemPlacing.hitTest(arrowCannon)) {
isHitting = true;
aa.gotoAndStop(6);
}
a--;
}
}
g = guns.length - 1;
while (g >= 0) {
gun = guns[g];
if ((((placingNum == 0) || (placingNum == 1)) || (placingNum == 2)) || (placingNum == 3)) {
if (hypotObj(gun, itemPlacing) <= hypot((turretWidths[0] / 2) + (turretWidths[placingNum] / 2), 0)) {
isHitting = true;
aa.gotoAndStop(2);
}
}
if ((placingNum == 4) && (itemPlacing.hitTest(gun.tIn))) {
isHitting = true;
aa.gotoAndStop(2);
}
g--;
}
b = bouncers.length - 1;
while (b >= 0) {
bouncer = bouncers[b];
if ((((placingNum == 0) || (placingNum == 1)) || (placingNum == 2)) || (placingNum == 3)) {
if (hypotObj(bouncer, itemPlacing) <= hypot((turretWidths[3] / 2) + (turretWidths[placingNum] / 2), 0)) {
isHitting = true;
aa.gotoAndStop(2);
}
}
if ((placingNum == 4) && (itemPlacing.hitTest(bouncer))) {
isHitting = true;
aa.gotoAndStop(2);
}
b--;
}
b = blimps.length - 1;
while (b >= 0) {
blimp = blimps[b];
if ((placingNum == 0) || (placingNum == 1)) {
if (itemPlacing.tIn.hitTest(blimp)) {
isHitting = true;
aa.gotoAndStop(2);
}
} else if (itemPlacing.hitTest(blimp)) {
isHitting = true;
aa.gotoAndStop(2);
}
b--;
}
if (!isHitting) {
aa.gotoAndStop(1);
if (placingNum == 2) {
aa.gotoAndStop(3);
}
if (placingNum == 5) {
aa.gotoAndStop(5);
}
}
if (wasMDown && (!mDown)) {
if (!isHitting) {
placingItem = false;
if (arrowStage == 3) {
arrowStage = 4;
info.gotoAndStop(3);
theArrow.removeMovieClip();
}
if ((placingNum == 0) || (placingNum == 1)) {
itemPlacing.gr.gotoAndStop(2);
guns.push(itemPlacing);
if (gameCompleted && (guns.length == 1)) {
tg._alpha = 0;
gamePause = false;
waver.gotoAndPlay(2);
newWave.start();
}
}
if (placingNum == 2) {
itemPlacing.gotoAndStop(1);
spikes.push(itemPlacing);
}
if (placingNum == 3) {
bouncers.push(itemPlacing);
}
if (placingNum == 4) {
blimps.push(itemPlacing);
}
if (placingNum == 5) {
arrowCannons.push(itemPlacing);
}
g = guns.length - 1;
while (g >= 0) {
gun = guns[g];
gun.swapDepths(depth++);
g--;
}
itemPlacing = null;
aa._alpha = 0;
placingNum = -1;
}
}
}
if (inShop) {
shop._y = shop._y + Math.ceil((-shop._y) / 7);
if (arrowStage == 2) {
if (shop._y == 0) {
theArrow._alpha = 100;
}
}
} else {
shop._y = shop._y + Math.floor((((-shop._height) - 4) - shop._y) / 7);
}
}
function machineShot(weapon) {
laserShot.start();
theItem = createEmptyMovieClip("laser" + depth, 200555 + (depth++));
bullets.push(theItem);
if (weapon.Type == 1) {
theItem.lineStyle(3, 3683363);
}
if (weapon.Type == 2) {
theItem.lineStyle(3, 39423);
}
dir = (weapon.barrel._rotation * Math.PI) / 180;
theItem.moveTo(weapon._x + (Math.cos(dir) * 40), weapon._y + (Math.sin(dir) * 40));
theItem.lineTo(enemy._x, enemy._y);
if (!enemy.invuln) {
hitStuff();
}
enemy.hBar.inBar._xscale = Math.floor((enemy.health / enemy.healthMax) * 100);
if (enemy.invuln == false) {
enemy.ySpeed = -10;
enemy.xSpeed = enemy.xSpeed + (Math.cos((weapon.barrel._rotation * Math.PI) / 180) * 5);
if (weapon.Type == 2) {
enemy._y = enemy._y - 30;
enemy.ice.gotoAndStop(2);
enemy.bunIn.bunIn.gotoAndStop(15);
}
}
testDeath();
}
function createParticles(amount, object) {
p = 0;
while (p < amount) {
particle = attachMovie("particle", "particle" + depth, depth++);
particle._xscale = (particle._yscale = random(60) + 20);
particle.Speed = 1 + (Math.random() * 25);
particle.Dir = (Math.PI * Math.random()) * 2;
particle._x = object._x;
particle._y = object._y;
particles.push(particle);
p++;
}
}
function particleManagement() {
p = particles.length - 1;
while (p >= 0) {
particle = particles[p];
particle._x = particle._x + (Math.cos(particle.Dir) * particle.Speed);
particle._y = particle._y + (Math.sin(particle.Dir) * particle.Speed);
particle.Speed = particle.Speed * 0.85;
particle._alpha = particle._alpha - (((100 - particle._alpha) / 10) + 1);
if (particle._alpha <= 0) {
removeParticle();
}
p--;
}
}
function removeParticle() {
particle.removeMovieClip();
particles.splice(p, 1);
}
function shaker() {
if (shake == 0) {
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 3;
_root._x = _root._x - 3;
} else if (shake == 3) {
shake = 0;
_root._x = 0;
_root._y = 0;
}
}
function clearScreen() {
shop.removeMovieClip();
waver.removeMovieClip();
floor.removeMovieClip();
info.removeMovieClip();
theArrow.removeMovieClip();
pauseScreen.removeMovieClip();
a = arrowCannons.length - 1;
while (a >= 0) {
arrowCannon = arrowCannons[a];
arrowCannon.removeMovieClip();
arrowCannons.splice(a, 1);
a--;
}
b = bullets.length - 1;
while (b >= 0) {
bullet = bullets[b];
bullet.removeMovieClip();
bullets.splice(b, 1);
b--;
}
g = guns.length - 1;
while (g >= 0) {
gun = guns[g];
gun.removeMovieClip();
guns.splice(g, 1);
g--;
}
b = bouncers.length - 1;
while (b >= 0) {
bouncer = bouncers[b];
bouncer.removeMovieClip();
bouncers.splice(b, 1);
b--;
}
b = blimps.length - 1;
while (b >= 0) {
blimp = blimps[b];
blimp.removeMovieClip();
blimps.splice(b, 1);
b--;
}
p = particles.length - 1;
while (p >= 0) {
particle = particles[p];
removeParticle();
p--;
}
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
removeEnemy();
e--;
}
s = spikes.length - 1;
while (s >= 0) {
spike = spikes[s];
spike.removeMovieClip();
spikes.splice(s, 1);
s--;
}
b = bombs.length - 1;
while (b >= 0) {
bomb = bombs[b];
removeBomb();
b--;
}
a = arrows.length - 1;
while (a >= 0) {
arrowShot = arrows[a];
removeArrow();
a--;
}
}
e = enemies.length - 1;
while (e >= 0) {
enemy = enemies[e];
removeEnemy();
e--;
}
var song = new Sound();
song.attachSound("bunny.mp3");
song.start(0, 999);
if (muted) {
song.setVolume(0);
}
var laserShot = new Sound();
laserShot.attachSound("laserShot.mp3");
var shotHit = new Sound();
shotHit.attachSound("shotHit.mp3");
var bang = new Sound();
bang.attachSound("bang.mp3");
var arrowShotS = new Sound();
arrowShotS.attachSound("arrowShot.mp3");
var boom = new Sound();
boom.attachSound("bigExplosion.mp3");
var spikeHit = new Sound();
spikeHit.attachSound("spikeHit.mp3");
var newWave = new Sound();
newWave.attachSound("newWave.mp3");
var purchase = new Sound();
purchase.attachSound("purchase.mp3");
var rollover = new Sound();
rollover.attachSound("rollover.mp3");
gameMode = selectorNum;
aa._alpha = 0;
inTutorial = true;
gamePause = true;
depth = 100;
health = 100;
healthMax = 100;
coins = 10;
day = 0;
dayGoal = 20;
kills = 0;
waver.swapDepths(701503);
enemyDelayConsts = new Array(60, 40, 50, 35, 20, 38, 32, 26, 22, 40, 35, 30, 25, 20, 18, 30, 27, 24, 22, 20, 18, 16, 14, 12, 10);
enemyDelayConst = enemyDelayConsts[day];
enemyDelay = 0;
enemiesByDay = new Array(5, 10, 10, 15, 20, 20, 30, 40, 50, 30, 40, 50, 60, 70, 80, 40, 55, 70, 85, 100, 150, 200, 250, 300, 9999999);
enemyTypesByDay = new Array(1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5);
enemiesLeft = 0;
enemyTypes = 1;
newDisplays = new Array(3, 6, 11, 16, 9999);
displayLeftConst = 200;
displayLeft = displayLeftConst;
atDisplay = 0;
inDisplay = false;
inGameComplete = false;
daySetup();
shop.swapDepths(800500);
floor.swapDepths(800600);
enemies = new Array();
friction = 0.9;
airFriction = 0.95;
gravity = 1;
enemyHealths = new Array(2, 4, 9, 12, 25);
enemyRewards = new Array(10, 80, 350, 2000, 10000);
theArrow.swapDepths(975200);
arrowStage = 1;
infoTime = 125;
bMax = false;
spikes = new Array();
blimps = new Array();
bombs = new Array();
bouncers = new Array();
arrowCannons = new Array();
arrows = new Array();
guns = new Array();
playerPause = false;
createGenericHover(floor.pBtn);
createGenericHover(floor.qBtn);
createGenericHover(floor.mBtn);
pauseScreen.swapDepths(933400);
pauseScreen._alpha = 0;
floor.pBtn.onRelease = function () {
playerPause = !playerPause;
if (playerPause) {
pauseScreen._alpha = 100;
pauseScreen.rtm.onRollOver = function () {
pauseScreen.rtm._alpha = 50;
};
pauseScreen.rtm.onRollOut = function () {
pauseScreen.rtm._alpha = 100;
};
pauseScreen.rtm.onReleaseOutside = function () {
pauseScreen.rtm._alpha = 100;
};
pauseScreen.rtm.onRelease = function () {
clearScreen();
gotoAndStop (3);
};
} else {
delete pauseScreen.rtm.onRollOver;
delete pauseScreen.rtm.onReleaseOutside;
delete pauseScreen.rtm.onRollOut;
delete pauseScreen.rtm.onRelease;
pauseScreen._alpha = 0;
}
};
floor.qBtn.onRelease = function () {
if (_quality == "LOW") {
_quality = "MEDIUM";
} else if (_quality == "MEDIUM") {
_quality = "HIGH";
} else {
_quality = "LOW";
}
};
floor.mBtn.onRelease = function () {
muted = !muted;
if (muted) {
song.setVolume(0);
} else {
song.setVolume(100);
}
};
createGenericHover(floor.shopBtn);
floor.shopBtn.onRelease = function () {
createShop();
};
inShop = false;
placingItem = false;
itemPlacing = null;
placingNum = -1;
upgradeNames = new Array("Turret", "Ice Gun", "Spike Trap", "Bouncer", "Blimp", "Arrow Cannon");
upgrade1Costs = new Array(10, 50, 300, 1200, 5000, 20000);
upgrade2Costs = new Array(500, 1500, 7500, 30000, 90000, 270000);
upgrade3Costs = new Array(20, 80, 600, 1600, 8000, 40000);
upgrade4Costs = new Array(2000, 10000, 50000, 150000, 450000);
upgrade5Costs = new Array(13000, 65000, 340000);
upgrade6Costs = new Array(45000, 135000, 520000);
upgradeCosts = new Array(upgrade1Costs, upgrade2Costs, upgrade3Costs, upgrade4Costs, upgrade5Costs, upgrade6Costs);
upgradesBought = new Array(0, 0, 0, 0, 0, 0);
upgradeDescriptions = new Array("Shoots enemies in a standard way.", "Freezes enemies temporarily and makes them more vulnerable", "Hides a spike in the ground that occassionally pops out to kill enemies", "Launches enemies off it if touched", "Drops deadly explosions", "Shoots a barrage of crazy arrows");
createFunctions = new Array(createGun, createGun, createSpike, createBouncer, createBlimp, createArrowCannon);
if (gameMode == 1) {
modeTxt.htmlText = "Easy";
}
if (gameMode == 2) {
modeTxt.htmlText = "Medium";
}
if (gameMode == 3) {
modeTxt.htmlText = "Hard";
}
upgradeMaxes = new Array(6, 6, 6, 5, 3, 3);
shop.s1.shopIcon.g1.gr.gotoAndStop(2);
shop.s2.shopIcon.g1.gr.gotoAndStop(2);
shop.s3.shopIcon.g1.gr.gotoAndStop(2);
shop.s4.shopIcon.g1.gr.gotoAndStop(2);
shop.s5.shopIcon.g1.gr.gotoAndStop(2);
shop.s6.shopIcon.g1.gr.gotoAndStop(2);
mDown = false;
wasMDown = false;
onMouseDown = function () {
if (playerPause && (!floor.pBtn.hitTest(_xmouse, _ymouse, true))) {
playerPause = false;
pauseScreen._alpha = 0;
}
mDown = true;
};
onMouseUp = function () {
mDown = false;
};
turretWidths = new Array(35, 35, 28, 57, 90, 0);
turretHeights = new Array(35, 35, 0, 57, 26, 0);
bullets = new Array();
particles = new Array();
shake = 0;
if (gameCompleted) {
inTutorial = false;
gamePause = true;
theArrow._alpha = 0;
arrowStage = 5;
info.swapDepths(500500);
info.removeMovieClip();
inTutorial = false;
waver.w1.waveTxt.htmlText = bold("Wave " + day);
} else {
tg._alpha = 0;
}
Frame 5
function onEnterFrame() {
if (bMax) {
bBtn._xscale = bBtn._xscale + ((150 - bBtn._xscale) / 2);
} else {
bBtn._xscale = bBtn._xscale + ((100 - bBtn._xscale) / 2);
}
bBtn._yscale = bBtn._xscale;
}
stop();
bMax = false;
bBtn.onRollOver = function () {
bMax = true;
};
bBtn.onRollOut = function () {
bMax = false;
};
bBtn.onRelease = function () {
gotoAndStop (3);
};
ag.onRelease = function () {
getURL ("http://armor.ag/MoreGames", "_blank");
};
Frame 6
function formatNumber(number) {
var _local1 = number.toString();
var _local3 = "";
while (_local1.length > 3) {
var _local2 = _local1.substr(-3);
_local1 = _local1.substr(0, _local1.length - 3);
_local3 = ("," + _local2) + _local3;
}
if (_local1.length > 0) {
_local3 = _local1 + _local3;
}
return(_local3);
}
function bold(item) {
return(("<b>" + item) + "</b>");
}
function calcRank(killNumber) {
topRank = 0;
i = 0;
while (i < rankGoals.length) {
if (killNumber >= rankGoals[i]) {
topRank = topRank + 1;
}
i++;
}
return(ranks[topRank]);
}
function calcRank2(killNumber) {
topRank = 0;
i = 0;
while (i < rankGoals.length) {
if (killNumber >= rankGoals[i]) {
topRank = topRank + 1;
}
i++;
}
return(topRank);
}
function onEnterFrame() {
delayToUp = delayToUp - 1;
if ((killsTemp < kills) && (delayToUp <= 0)) {
delayToUp = 1;
killsTemp = killsTemp + Math.ceil((kills - killsTemp) / 40);
killsTxt.htmlText = bold(formatNumber(killsTemp));
rankTxt.htmlText = bold(calcRank(killsTemp));
}
if (bMax) {
bBtn._xscale = bBtn._xscale + ((150 - bBtn._xscale) / 2);
} else {
bBtn._xscale = bBtn._xscale + ((100 - bBtn._xscale) / 2);
}
bBtn._yscale = bBtn._xscale;
if (mMax) {
mBtn._xscale = mBtn._xscale + ((150 - mBtn._xscale) / 2);
} else {
mBtn._xscale = mBtn._xscale + ((100 - mBtn._xscale) / 2);
}
mBtn._yscale = mBtn._xscale;
}
stop();
_quality = "HIGH";
killsTxt.htmlText = bold("0");
rankTxt.htmlText = bold("FAILURE");
bMax = false;
mMax = false;
bBtn.onRollOver = function () {
bMax = true;
};
bBtn.onRollOut = function () {
bMax = false;
};
bBtn.onRelease = function () {
gotoAndStop (3);
};
mBtn.onRollOver = function () {
mMax = true;
};
mBtn.onRollOut = function () {
mMax = false;
};
mBtn.onRelease = function () {
getURL ("http://armor.ag/MoreGames", "_blank");
};
ag.onRelease = function () {
getURL ("http://armor.ag/MoreGames", "_blank");
};
if (gameMode == 1) {
highscore = highscoreEasy;
modeTxt.htmlText = bold("Easy Mode");
}
if (gameMode == 2) {
highscore = highscoreMedium;
modeTxt.htmlText = bold("Medium Mode");
}
if (gameMode == 3) {
highscore = highscoreHard;
modeTxt.htmlText = bold("Hard Mode");
}
if (kills >= highscore) {
highscore = kills;
}
ranks = new Array("FAILURE", "PATHETIC", "BAD", "BEGINNER", "AMATEUR", "NOVICE", "FAIR", "AVERAGE", "ACCEPTABLE", "INTERMEDIATE", "GOOD", "SATISFYING", "RAD", "GREAT", "SUPERB", "SPLENDID", "ADVANCED", "AMAZING", "PRO", "VETERAN", "ELITE", "NONE");
rankGoals = new Array(100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 9999999);
killsTemp = 0;
delayToUp = 0;
highscoreTxt.htmlText = bold(formatNumber(highscore));
bestRankTxt.htmlText = bold(calcRank(highscore));
nextRankTxt.htmlText = rankGoals[calcRank2(highscore) + 1];
if (gameMode == 1) {
highscoreEasy = highscore;
}
if (gameMode == 2) {
highscoreMedium = highscore;
}
if (gameMode == 3) {
highscoreHard = highscore;
}
saveGame();
Symbol 39 MovieClip [starter] Frame 1
stop();
Symbol 42 MovieClip [starter2] Frame 1
stop();
Symbol 45 MovieClip Frame 1
stop();
Symbol 65 MovieClip Frame 1
_root.stop();
gotoAndPlay (2);
Symbol 65 MovieClip Frame 225
_root.nextFrame();
Symbol 77 MovieClip Frame 1
stop();
Symbol 85 MovieClip Frame 1
stop();
Symbol 94 MovieClip Frame 1
stop();
Symbol 101 MovieClip Frame 1
stop();
Symbol 105 MovieClip Frame 1
stop();
Symbol 108 MovieClip Frame 60
_parent.gotoAndStop(1);
Symbol 109 MovieClip Frame 1
stop();
Symbol 110 MovieClip [enemy] Frame 1
stop();
Symbol 119 MovieClip Frame 1
stop();
Symbol 124 MovieClip Frame 1
stop();
Symbol 227 MovieClip Frame 48
_parent.removeMovieClip();
Symbol 237 MovieClip Frame 1
stop();
Symbol 243 MovieClip Frame 1
stop();
Symbol 249 MovieClip Frame 1
stop();
Symbol 257 MovieClip Frame 1
stop();
Symbol 260 MovieClip Frame 1
stop();
Symbol 264 MovieClip [groundSpike] Frame 1
stop();
Symbol 266 MovieClip Frame 1
stop();
Symbol 267 MovieClip [flash] Frame 1
stop();
Symbol 280 MovieClip Frame 1
stop();
Symbol 288 MovieClip Frame 1
stop();
Symbol 291 MovieClip Frame 1
stop();
Symbol 301 MovieClip [enemyReward] Frame 45
this.removeMovieClip();
Symbol 306 MovieClip [flakGun] Frame 1
stop();
Symbol 327 MovieClip Frame 1
stop();
Symbol 334 MovieClip Frame 1
stop();
Symbol 340 MovieClip Frame 1
stop();
Symbol 343 MovieClip Frame 1
stop();
Symbol 347 MovieClip Frame 1
stop();
Symbol 355 MovieClip Frame 1
stop();
Symbol 361 MovieClip Frame 1
stop();
Symbol 366 MovieClip Frame 1
stop();
Symbol 376 MovieClip Frame 1
stop();
Symbol 388 MovieClip Frame 1
stop();
Symbol 399 MovieClip Frame 1
stop();
Symbol 401 MovieClip [upgradeInfo] Frame 1
stop();
Symbol 407 MovieClip [hitAnim] Frame 10
this.removeMovieClip();
Symbol 431 MovieClip Frame 1
stop();
Symbol 445 MovieClip Frame 1200
stop();