Frame 1
stop();
Instance of Symbol 582 MovieClip in Frame 1
onClipEvent (enterFrame) {
if (getTimer() > (_root.gameStartTime + 6000)) {
_root.gotoAndStop("game");
this.unloadMovie();
} else {
gotoAndStop(Math.floor((((getTimer() - _root.gameStartTime) * 15) / 1000) % 190));
}
}
Frame 2
function updateTracerNdx() {
g_tracerNdx++;
if (g_tracerNdx >= g_tracerNum) {
g_tracerNdx = 0;
}
}
function loadCounterMeasure() {
if (g_currentLevel > 4) {
bad_msg._x = g_width / 2;
bad_msg._y = g_ground / 2;
}
}
function displayOptions() {
m_options._x = g_width / 2;
m_options._y = (g_ground / 2) + 100;
}
function displayHelp() {
helpWindow._x = g_width / 2;
helpWindow._y = (g_ground / 2) + 100;
}
function saveData() {
trace("Saving Data");
myLocalSO.data.g_total_xp = g_total_xp;
if (myLocalSO.data.g_currentLevel < g_currentLevel) {
myLocalSO.data.g_currentLevel = g_currentLevel;
g_maxLevel = g_currentLevel + 1;
}
}
function calculateXPAward() {
g_long_award_xp = g_longs * g_long_xp;
g_mid_award_xp = g_mids * g_mid_xp;
g_short_award_xp = g_shorts * g_short_xp;
g_level_award_xp = g_level_xp * g_currentLevel;
g_house_award_xp = g_houses_alive * g_house_xp;
if (g_noPopLoss) {
g_zero_loss_award = Math.pow(g_currentLevel, 2);
} else {
g_zero_loss_award = 0;
}
if (g_noHouseLoss) {
g_allhouse_award = Math.floor(Math.pow(g_currentLevel, 2));
} else {
g_allhouse_award = 0;
}
g_awarded_xp = ((g_level_award_xp + g_house_award_xp) + g_allhouse_award) + g_zero_loss_award;
g_xp = g_xp + g_awarded_xp;
g_total_xp = g_total_xp + g_awarded_xp;
g_awarded_xp = g_awarded_xp + (((g_short_award_xp + g_mid_award_xp) + g_long_award_xp) + g_boss_award);
if (g_awarded_xp > 2000) {
g_xp_msg = "Either you're cheating or you've been playing this game for too long.";
} else if (g_awarded_xp > 1000) {
g_xp_msg = "Damn you're good";
} else if (g_awarded_xp > 600) {
g_xp_msg = "You're an expert";
} else if (g_awarded_xp > 400) {
g_xp_msg = "Nice shooting";
} else if (g_awarded_xp > 200) {
g_xp_msg = "Not Bad";
} else if (g_awarded_xp > 100) {
g_xp_msg = "Keep practicing";
} else {
g_xp_msg = "Remember: xp is only awarded for basic arrow critical hits";
}
saveData();
displayXPPage();
g_noPopLoss = true;
g_noHouseLoss = true;
}
function displayXPPage() {
xp_page._x = g_width / 2;
xp_page._y = g_ground / 2;
}
function resetGameVars() {
var _local1 = _root;
_local1.g_maxbowpwr = 1100;
_local1.g_xp = g_total_xp;
_local1.g_population = 20;
_local1.g_multi_num = 1;
_local1.g_fire_num = 0;
_local1.g_ice_num = 0;
_local1.g_bomb_num = 0;
_local1.g_flak_num = 0;
_local1.g_mine_num = 0;
_local1.g_oil_num = 0;
_local1.g_catapult_num = 0;
_local1.g_archer_num = 0;
_local1.g_piercer_num = 0;
_local1.g_arrow_dmg = 5;
_local1.g_blast_range = 180;
_local1.g_blast_power = 20;
_local1.g_catapult_cooldown = 30;
_local1.g_archer_cooldown = 20;
_local1.g_bow_loading = 1;
_local1.g_fire_dot = 2;
}
function setPrevGameVars() {
var _local1 = _root;
_local1.g_Pmaxbowpwr = g_maxbowpwr;
_local1.g_PcurrentLevel = g_currentLevel;
_local1.g_Pxp = g_xp;
_local1.g_Ppopulation = g_population;
_local1.g_Pmulti_num = g_multi_num;
_local1.g_Pfire_num = g_fire_num;
_local1.g_Pice_num = g_ice_num;
_local1.g_Pbomb_num = g_bomb_num;
_local1.g_Pflak_num = g_flak_num;
_local1.g_Pmine_num = g_mine_num;
_local1.g_Poil_num = g_oil_num;
_local1.g_Pcatapult_num = g_catapult_num;
_local1.g_Parcher_num = g_archer_num;
_local1.g_Ppiercer_num = g_piercer_num;
_local1.g_Parrow_dmg = g_arrow_dmg;
_local1.g_Pblast_range = g_blast_range;
_local1.g_Pblast_power = g_blast_power;
_local1.g_Pcatapult_cooldown = g_catapult_cooldown;
_local1.g_Parcher_cooldown = g_archer_cooldown;
_local1.g_Pbow_loading = g_bow_loading;
_local1.g_Pfire_dot = g_fire_dot;
}
function initializeClipLevels() {
for (i in g_arrowLevels) {
g_arrowLevels[i] = false;
}
for (i in g_enemyLevels) {
g_enemyLevels[i] = false;
}
}
function checkoutEneLevel() {
taken = false;
do {
if (taken) {
trace(val + " taken - finding another !!!!!!!!!!!!!!!!!!!!");
}
val = (++g_enelvl) % g_eneLvlMax;
} while ((taken = g_enemyLevels[val]));
trace("Checking out: " + val);
g_enemyLevels[val] = true;
return(val);
}
function checkoutEneLevel2() {
found = false;
level = 0;
i = 0;
while ((i < g_enemyLevels.length) && (!found)) {
if ((found = !g_enemyLevels[i])) {
level = i;
}
i++;
}
g_enemyLevels[level] = true;
g_test_lastOut = level;
return(level);
}
function checkinEneLevel(level) {
g_enemyLevels[level] = false;
}
function toggleMode() {
g_arrowMode--;
if (g_arrowMode < 0) {
g_arrowMode = g_mode_bomb;
}
}
function shootGeneric(x, y, dx, dy, dmg, aoe, brange, bpwr, bouncy, piercing, nonArrow, xvar, yvar, target) {
var _local1 = dx;
var _local2 = dy;
_local1 = _local1 * g_boost;
_local2 = _local2 * g_boost;
radians = Math.atan(_local2 / _local1);
power = Math.sqrt((_local1 * _local1) + (_local2 * _local2));
if (power > g_maxbowpwr) {
power = g_maxbowpwr;
if (_local1 < 0) {
_local1 = Math.cos(radians + Math.PI) * power;
_local2 = Math.sin(radians + Math.PI) * power;
} else {
_local1 = Math.cos(radians) * power;
_local2 = Math.sin(radians) * power;
}
}
_local1 = _local1 + random(xvar);
_local2 = _local2 + random(yvar);
addGeneric(x, y, _local1, _local2, dmg, aoe, brange, bpwr, bouncy, piercing, nonArrow, target);
}
function shoot() {
var _local1 = _root;
playSound("swoosh.wav");
bow.dx = _local1.string._x - _local1.bow._x;
bow.dy = _local1.string._y - _local1.bow._y;
dx = (-bow.dx) * g_boost;
dy = (-bow.dy) * g_boost;
radians = Math.atan(dy / dx);
power = Math.sqrt((dx * dx) + (dy * dy));
trace("Power: " + power);
if (power > g_maxbowpwr) {
power = g_maxbowpwr;
dx = Math.cos(radians) * power;
dy = Math.sin(radians) * power;
}
if (g_mode == "fire") {
addArrows(bow._x, bow._y, dx, dy, "fire_arrow", g_fire_num);
} else if (g_mode == "ice") {
addArrows(bow._x, bow._y, dx, dy, "ice_arrow", g_ice_num);
} else if (g_mode == "all") {
addMultiArrow(bow._x, bow._y, dx, dy);
} else if (g_mode == "normal") {
addArrows(bow._x, bow._y, dx, dy, "arrow", g_multi_num);
} else if (g_mode == "pierce") {
addArrows(bow._x, bow._y, dx, dy, "p_arrow", g_piercer_num);
} else if (g_mode == "bomb") {
addArrows(bow._x, bow._y, dx, dy, "bomb_arrow", g_bomb_num);
} else if (g_mode == "flak") {
addArrows(bow._x, bow._y, dx, dy, "flak_arrow", g_flak_num);
} else if (g_mode == "proximity") {
addArrows(bow._x, bow._y, dx, dy, "land_mine_arrow", 1);
} else if (g_mode == "oil") {
addArrows(bow._x, bow._y, dx, dy, "oil_arrow", 1);
}
}
function getArrowClip() {
g_arrowLevel++;
if (g_arrowLevel > 100) {
g_arrowLevel = 0;
}
return(g_arrowLevel);
}
function addArrow(x, y, vx, vy) {
lvl = getArrowClip();
temp = arrowZone.attachMovie("arrow", "arrow_" + lvl, lvl);
temp.vx = vx;
temp.vy = vy;
temp._x = x;
temp._y = y;
temp.dead = false;
temp.dmg = 50;
temp.AoE = false;
g_arrows.push(temp);
}
function addBombArrow(x, y, vx, vy) {
lvl = getArrowClip();
temp = arrowZone.attachMovie("bomb_arrow", "bomb_arrow_" + lvl, lvl);
temp.vx = vx;
temp.vy = vy;
temp._x = x;
temp._y = y;
temp.dead = false;
temp.dmg = 50;
temp.blastRange = 100;
temp.blastPower = 50;
temp.AoE = true;
g_arrows.push(temp);
}
function addGeneric(x, y, vx, vy, dmg, aoe, brange, bpwr, bouncy, piercing, nonArrow, target) {
lvl = getArrowClip();
temp = arrowZone.attachMovie(target, "gen_arrow_" + lvl, lvl);
temp.aType = target;
temp.vx = vx;
temp.vy = vy;
temp._x = x;
temp._y = y;
temp.dead = false;
temp.bouncy = bouncy;
temp.piercing = piercing;
temp.nonArrow = nonArrow;
temp.dmg = dmg;
temp.blastRange = brange;
temp.blastPower = bpwr;
temp.AoE = aoe;
g_arrows.push(temp);
return(temp);
}
function getNextBloodNdx() {
g_bloodNdx++;
if (g_bloodNdx >= g_bloodMax) {
g_bloodNdx = 0;
}
return(g_bloodNdx);
}
function getNextFireNdx() {
g_fireNdx++;
if (g_fireNdx >= g_fireMax) {
g_fireNdx = 0;
}
return(g_fireNdx);
}
function addBloodsBleeding(xpos, ypos, dmg) {
var _local1 = dmg;
speed_reduction = 5;
variance = 10;
x = xpos;
y = ypos;
vx = random(100);
vy = random(100);
total = 1;
degrees = -Math.ceil(total / 2);
rpd = 0.01745329;
theta = Math.atan(vy / vx);
d = Math.sqrt((vx * vx) + (vy * vy));
i = 0;
while (i < total) {
lvl = getNextBloodNdx();
temp = bloodZone.attachMovie("blood", "blood_" + lvl, lvl);
g_debris_bloods[lvl] = temp;
sfactorX = 2 * (1 + (random(30) / 100));
sfactorY = 2 * (1 + (random(30) / 100));
if (_local1 > 1) {
_local1 = 1;
}
temp._xscale = temp._xscale * (_local1 * sfactorX);
temp._yscale = temp._yscale * (_local1 * sfactorY);
temp._alpha = bloodOn * 100;
if (vx < 0) {
temp.vx = ((-vx) * random(300)) / 100;
temp.vy = (vy * random(300)) / 100;
} else {
temp.vx = (vx * random(300)) / 100;
temp.vy = ((-vy) * random(300)) / 100;
}
temp._x = x;
temp._y = y;
temp.dead = false;
temp.dType = "blood";
g_bloods[lvl] = temp;
degrees++;
i++;
}
}
function addFlyingDebris(debris, x, y, range, total) {
var _local1 = range;
var _local2 = debris;
var _local3 = total;
i = 0;
while (i < _local3) {
g_bloodDead--;
lvl = getNextBloodNdx();
temp = bloodZone.attachMovie(_local2, "debris_" + lvl, lvl);
temp._x = x;
temp._y = (y - 10) - random(20);
g_debris_bloods[lvl] = temp;
sfactor = 1.5 * (1 + (random(150) / 100));
temp._xscale = temp._xscale * sfactor;
temp._yscale = temp._yscale * sfactor;
if (random(2) == 0) {
temp.vx = random(_local1);
temp.vy = -random(_local1);
} else {
temp.vx = -random(_local1);
temp.vy = -random(_local1);
}
temp.dead = false;
temp.dType = _local2;
g_bloods[lvl] = temp;
i++;
}
}
function addBloods(arr, dmg) {
var _local1 = dmg;
var _local2 = arr;
speed_reduction = 5;
variance = 10;
x = _local2._x;
y = _local2._y;
vx = _local2.vx / speed_reduction;
vy = _local2.vy / speed_reduction;
total = g_bloodSplats;
degrees = -Math.ceil(total / 2);
rpd = 0.01745329;
theta = Math.atan(vy / vx);
d = Math.sqrt((vx * vx) + (vy * vy));
i = 0;
while (i < total) {
g_bloodDead--;
lvl = getNextBloodNdx();
temp = bloodZone.attachMovie("blood", "blood_" + lvl, lvl);
g_debris_bloods[lvl] = temp;
sfactor = 2.5 * (1 + (random(150) / 100));
if (_local1 > 1) {
_local1 = 1;
}
temp._xscale = temp._xscale * (_local1 * sfactor);
temp._yscale = temp._yscale * (_local1 * sfactor);
temp._alpha = bloodOn * 100;
temp.vx = (vx * random(g_bloodSpread)) / 100;
temp.vy = -Math.abs((vy * random(g_bloodSpread)) / 100);
temp._x = x;
temp._y = y;
temp.dead = false;
temp.dType = "blood";
g_bloods[lvl] = temp;
degrees++;
i++;
}
}
function addArrows(x, y, vx, vy, arrType, total) {
var _local1 = vy;
var _local2 = vx;
var _local3 = arrType;
g_bow_cooldown = g_bow_loading * total;
degrees = -Math.ceil(total / 2);
rpd = 0.01745329;
theta = Math.atan(_local1 / _local2);
d = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
arr = null;
i = 0;
while (i < total) {
curx = Math.cos(theta + ((2 * degrees) * rpd)) * d;
cury = Math.sin(theta + ((2 * degrees) * rpd)) * d;
_local2 = curx;
_local1 = cury;
if (bow.dx > 0) {
_local2 = -_local2;
_local1 = -_local1;
}
if (_local3 == "bomb_arrow") {
arr = addGeneric(x, y, _local2, _local1, g_arrow_dmg, true, g_blast_range, g_blast_power, false, false, true, "bomb_arrow");
g_bow_cooldown = g_bow_cooldown + (g_bow_loading * 8);
} else if (_local3 == "ice_arrow") {
arr = addGeneric(x, y, _local2, _local1, g_arrow_dmg, false, 0, 0, false, false, false, "ice_arrow");
g_bow_cooldown = g_bow_cooldown + (g_bow_loading * 3);
} else if (_local3 == "fire_arrow") {
arr = addGeneric(x, y, _local2, _local1, g_arrow_dmg, false, 0, 0, false, false, false, "fire_arrow");
g_bow_cooldown = g_bow_cooldown + (g_bow_loading * 3);
} else if (_local3 == "arrow") {
arr = addGeneric(x, y, _local2, _local1, g_arrow_dmg, false, 0, 0, false, false, false, "arrow");
} else if (_local3 == "p_arrow") {
arr = addGeneric(x, y, _local2, _local1, g_arrow_dmg, false, 0, 0, false, true, false, "p_arrow");
} else if (_local3 == "flak_arrow") {
arr = addGeneric(x, y, _local2, _local1, g_arrow_dmg, true, 200, g_blast_power, false, false, true, "flak_arrow");
g_bow_cooldown = g_bow_cooldown + (g_bow_loading * 1.6);
} else if (_local3 == "land_mine_arrow") {
arr = addGeneric(x, y, _local2, _local1, g_arrow_dmg, false, 200, 0, false, false, true, _local3);
g_bow_cooldown = g_bow_cooldown + (g_bow_loading * 5);
} else if (_local3 == "oil_arrow") {
arr = addGeneric(x, y, _local2, _local1, 1, false, 0, 0, false, false, false, "oil_arrow");
g_bow_cooldown = g_bow_cooldown + (g_bow_loading * 5);
}
degrees++;
i++;
}
}
function increaseDifficulty() {
if (g_difficulty_text == "easy") {
setDiffMedium();
} else if (g_difficulty_text == "medium") {
setDiffHard();
} else if (g_difficulty_text == "hard") {
setDiffInsane();
} else if (g_difficulty_text == "insane") {
setDiffEasy();
}
}
function decreaseDifficulty() {
if (g_difficulty_text == "easy") {
setDiffInsane();
} else if (g_difficulty_text == "medium") {
setDiffEasy();
} else if (g_difficulty_text == "hard") {
setDiffMedium();
} else if (g_difficulty_text == "insane") {
setDiffHard();
}
}
function setDiffEasy() {
var _local1 = _root;
_local1.g_diff_vx = 1.1;
_local1.g_diff_hp = 0.2;
_local1.g_difficulty_text = "easy";
}
function setDiffMedium() {
var _local1 = _root;
_local1.g_diff_vx = 1.7;
_local1.g_diff_hp = 0.8;
_local1.g_difficulty_text = "medium";
}
function setDiffHard() {
var _local1 = _root;
_local1.g_diff_vx = 2.1;
_local1.g_diff_hp = 1.5;
_local1.g_difficulty_text = "hard";
}
function setDiffInsane() {
var _local1 = _root;
_local1.g_diff_vx = 5;
_local1.g_diff_hp = 3;
_local1.g_difficulty_text = "insane";
}
function addMultiArrow(x, y, vx, vy) {
var _local1 = vy;
var _local2 = vx;
var _local3 = y;
total = 0;
degrees = -Math.ceil(total / 2);
rpd = 0.01745329;
theta = Math.atan(_local1 / _local2);
d = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (g_flak_num > 0) {
total++;
curx = Math.cos(theta + ((2 * degrees) * rpd)) * d;
cury = Math.sin(theta + ((2 * degrees) * rpd)) * d;
_local2 = curx;
_local1 = cury;
if (bow.dx > 0) {
_local2 = -_local2;
_local1 = -_local1;
}
arr = addGeneric(x, _local3, _local2, _local1, g_arrow_dmg, true, 200, g_blast_power, false, false, true, "flak_arrow");
degrees++;
}
if (g_bomb_num > 0) {
total++;
curx = Math.cos(theta + ((2 * degrees) * rpd)) * d;
cury = Math.sin(theta + ((2 * degrees) * rpd)) * d;
_local2 = curx;
_local1 = cury;
if (bow.dx > 0) {
_local2 = -_local2;
_local1 = -_local1;
}
addGeneric(x, _local3, _local2, _local1, g_arrow_dmg, true, g_blast_range, g_blast_power, false, false, true, "bomb_arrow");
degrees++;
}
if (g_piercer_num > 0) {
total++;
curx = Math.cos(theta + ((2 * degrees) * rpd)) * d;
cury = Math.sin(theta + ((2 * degrees) * rpd)) * d;
_local2 = curx;
_local1 = cury;
if (bow.dx > 0) {
_local2 = -_local2;
_local1 = -_local1;
}
addGeneric(x, _local3, _local2, _local1, g_arrow_dmg, false, 0, 0, false, true, false, "p_arrow");
degrees++;
}
if (g_multi_num > 0) {
total++;
curx = Math.cos(theta + ((2 * degrees) * rpd)) * d;
cury = Math.sin(theta + ((2 * degrees) * rpd)) * d;
_local2 = curx;
_local1 = cury;
if (bow.dx > 0) {
_local2 = -_local2;
_local1 = -_local1;
}
addGeneric(x, _local3, _local2, _local1, g_arrow_dmg, false, 0, 0, false, false, false, "arrow");
degrees++;
}
if (g_fire_num > 0) {
total++;
curx = Math.cos(theta + ((2 * degrees) * rpd)) * d;
cury = Math.sin(theta + ((2 * degrees) * rpd)) * d;
_local2 = curx;
_local1 = cury;
if (bow.dx > 0) {
_local2 = -_local2;
_local1 = -_local1;
}
addGeneric(x, _local3, _local2, _local1, g_arrow_dmg, false, 0, 0, false, false, false, "fire_arrow");
degrees++;
}
if (g_ice_num > 0) {
total++;
curx = Math.cos(theta + ((2 * degrees) * rpd)) * d;
cury = Math.sin(theta + ((2 * degrees) * rpd)) * d;
_local2 = curx;
_local1 = cury;
if (bow.dx > 0) {
_local2 = -_local2;
_local1 = -_local1;
}
addGeneric(x, _local3, _local2, _local1, g_arrow_dmg, false, 0, 0, false, false, false, "ice_arrow");
degrees++;
}
g_bow_cooldown = g_bow_loading * total;
}
function addEnemy(x, y, vx, vy, hp, entype) {
trace(g_armyList);
trace("Army Size: " + g_numArmy);
trace("List Length: " + g_armyList.length);
lvl = checkoutEneLevel();
temp = enemyZone.attachMovie(entype, "enemy_" + lvl, lvl);
temp.timeToShoot = getTimer() + 5000;
temp.lvl = lvl;
temp.fhight = y;
temp.dead = false;
temp.eType = entype;
temp.nextTime = 0;
temp.vx = vx * g_diff_vx;
temp.vy = vy;
temp._x = x;
temp._y = y;
temp.hp = hp * g_diff_hp;
temp.maxhp = hp * g_diff_hp;
g_enemies.push(temp);
g_armyLeft = g_armyList.length;
}
function addObstruct(x, y, obtype, where) {
lvl = getTerrainClip();
temp = where.attachMovie(obtype, "obstruct_" + lvl, lvl);
temp._x = x;
temp._y = y;
temp.dead = false;
temp.oType = obtype;
g_obstructs.push(temp);
return(temp);
}
function stepBloods() {
offset = 0;
g_bcount = g_bloods.length;
for (i in g_bloods) {
cur = g_bloods[i];
if ((cur != null) && (!cur.dead)) {
t = elapsed;
vy0 = cur.vy;
vx0 = cur.vx;
y0 = cur._y;
x0 = cur._x;
cur.vy = (gravY * t) + vy0;
cur.vx = (gravX * t) + vx0;
cur._y = ((((0.5 * gravY) * t) * t) + (vy0 * t)) + y0;
cur._x = ((((0.5 * gravX) * t) * t) + (vx0 * t)) + x0;
radians = Math.atan(cur.vy / cur.vx);
if (cur.vx > 0) {
cur._rotation = (radians * 180) / Math.PI;
} else {
cur._rotation = ((radians * 180) / Math.PI) + 180;
}
if (cur.dType == "fire") {
cur._rotation = cur._rotation - 90;
}
cur.dead = (cur._y > (g_ground + offset)) || (ground.hitTest(cur._x, cur._y - offset, 1));
if (cur.dead) {
if (cur.dType == "fire") {
cur._rotation = 0;
}
cur.gotoAndPlay(2);
g_bloodDead++;
}
}
}
}
function stepArrows() {
g_arcount = g_arrows.length;
for (i in g_arrows) {
cur = g_arrows[i];
t = elapsed;
vy0 = cur.vy;
vx0 = cur.vx;
y0 = cur._y;
x0 = cur._x;
cur.prevX = cur._x;
cur.prevY = cur._y;
cur.vy = (gravY * t) + vy0;
cur.vx = (gravX * t) + vx0;
cur._y = ((((0.5 * gravY) * t) * t) + (vy0 * t)) + y0;
cur._x = ((((0.5 * gravX) * t) * t) + (vx0 * t)) + x0;
cur.airtime++;
radians = Math.atan(cur.vy / cur.vx);
if (cur.vx > 0) {
cur._rotation = (radians * 180) / 3.14159;
} else {
cur._rotation = ((radians * 180) / 3.14159) + 180;
}
}
}
function addTracer(arr, tracerType) {
updateTracerNdx();
temp = tracers.attachMovie(tracerType, "tracer_" + g_tracerNdx, g_tracerNdx);
temp._x = cur._x;
temp._y = cur._y;
}
function stepEnemies() {
for (i in g_enemies) {
cur = g_enemies[i];
checkEnemyDeath(cur);
if (!cur.dead) {
if ((cur.eType != "dragon_archer") && (cur.eType != "flying_enemy")) {
followTerrain(cur);
}
updateMaxes(cur._x - cur._width, cur._y - cur._height);
cur.step();
if ((cur.dead = cur._x < -120)) {
g_enemyDead++;
killPopulation(cur);
trace("killingPop!!");
} else {
if (cur.sick) {
cur.hp = cur.hp - (cur.sickDmg * elapsed);
checkEnemyDeath(cur);
}
house = getNextHouse();
if (((cur.eType != "boss") && (!house.dead)) && (house.hitTest(cur._x, cur._y, 0))) {
house.dead = true;
g_noHouseLoss = false;
house.gotoAndPlay(2);
temp = house.attachMovie("smoker", "smoker_0", 0);
temp._y = temp._y - 40;
temp = house.attachMovie("war_flag2", "warflag_0", 1);
cur.dead = true;
g_enemyDead++;
cur.killedHouse = true;
if (g_frontline > cur._x) {
g_frontline = cur._x;
}
}
mineNdx = random(g_landMines.length);
mine = g_landMines[mineNdx];
if ((mine != null) && (mine.hitTest(cur))) {
addArrows(mine._x, mine._y, 1, 1, "bomb_arrow", 1);
mine.unloadMovie();
g_landMines[mineNdx] = null;
}
}
}
}
}
function updateLandMineNdx() {
g_landMineNdx++;
if (g_landMineNdx >= g_landMines.length) {
g_landMineNdx = 0;
}
}
function cleanUpMines() {
for (i in g_landMines) {
if (g_landMines[i] != null) {
g_landMines[i].unloadMovie();
g_landMines[i] = null;
}
}
}
function updateOilNdx() {
g_oilNdx++;
if (g_oilNdx >= g_oils_num) {
g_oilNdx = 0;
}
}
function cleanUpOils() {
for (i in g_oils) {
if (g_oils[i] != null) {
g_oils[i].unloadMovie();
g_oils[i] = null;
}
}
}
function addMine(x, y) {
trace("adding mine");
maxCount = -1;
do {
maxCount++;
updateLandMineNdx();
} while ((maxCount < g_landMines.length) && (g_landMines[g_landMineNdx] != null));
temp = mines.attachMovie("land_mine", "mine_" + g_landMineNdx, g_landMineNdx);
temp._x = x;
temp._y = y;
g_landMines[g_landMineNdx] = temp;
}
function getNextHouse() {
g_homeNdx++;
if (g_homeNdx >= g_homes.length) {
g_homeNdx = 0;
}
return(g_homes[g_homeNdx]);
}
function killPopulation(ene) {
var _local1 = ene;
if (_local1.eType == "enemy") {
killPopulationNum(2, _local1._x, _local1._y);
} else if (_local1.eType == "ogre") {
killPopulationNum(15, _local1._x, _local1._y);
} else if (_local1.eType == "dragon_archer") {
killPopulationNum(18, _local1._x, _local1._y);
} else if (_local1.eType == "flying_enemy") {
killPopulationNum(7, _local1._x, _local1._y);
} else if (_local1.eType == "boss") {
killPopulationNum(100, _local1._x, _local1._y);
} else if (_local1.eType == "enemy_archer") {
killPopulationNum(3, _local1._x, _local1._y);
} else if (_local1.eType == "enemy_catapult") {
killPopulationNum(75, _local1._x, _local1._y);
}
}
function killPopulationNum(num, x, y) {
var _local1 = num;
g_noPopLoss = false;
if (_local1 > 0) {
lvl = getPopsClip();
temp = pops.attachMovie("pop_killed", "pop_" + lvl, lvl);
temp._x = x;
temp._y = y;
temp.num = -_local1;
newPop = g_population - _local1;
if (newPop <= 0) {
g_population = 0;
gameOver();
} else {
g_population = newPop;
}
}
}
function gameOver() {
g_game_over = true;
pause = true;
g_key_listener.unloadMovie();
}
function tooClose(pos, range, array) {
var _local1 = array;
var _local2 = pos;
var _local3 = range;
close = false;
i = 0;
while ((i < _local1.length) && (!close)) {
close = Math.abs(_local1[i] - _local2) < _local3;
i++;
}
trace("Returning CLOSE: " + close);
return(close);
}
function initObstructs() {
g_homes = new Array();
placeTower();
i = 0;
while (i < g_numHomes) {
do {
range = g_currentLevel * 80;
if (range > ((g_width / 2) - 200)) {
range = (g_width / 2) - 200;
}
homeXPos = random(range);
} while (tooClose(homeXPos, 150, g_homepositions));
g_homepositions.push(homeXPos);
home = addObstruct(homeXpos + 50, g_ground, "house", obstructZone);
home.household = Math.ceil(g_population / 4);
trace("Living in home: " + home.household);
g_homes.push(home);
i++;
}
g_homepositions.splice(0);
i = 0;
while (i < g_numObs) {
tree_num = random(g_trees.length);
closeCount = 0;
do {
treePos = random(g_width);
closeCount++;
} while (tooClose(treePos, 100, g_treepositions) && (closeCount < 5));
g_treepositions.push(treePos);
temp = addObstruct(treePos, g_ground, g_trees[tree_num], obstructZone);
sfactor = (random(200) + 50) / 100;
temp._xscale = temp._xscale * sfactor;
temp._yscale = temp._yscale * sfactor;
i++;
}
g_treepositions.splice(0);
for (i in g_obstructs) {
cur = g_obstructs[i];
while (ground.hitTest(cur._x, cur._y, 1) && (cur != ground)) {
cur._y--;
}
setObsMaxes(cur);
}
}
function setObsMaxes(obs) {
var _local1 = obs;
if ((_local1._x + _local1._width) > g_obsMax_x) {
g_obsMax_x = _local1._x + _local1._width;
}
if ((_local1._x - _local1._width) < g_obsMin_x) {
g_obsMin_x = _local1._x - _local1._width;
}
if ((_local1._y + _local1._height) > g_obsMax_y) {
g_obsMax_y = _local1._y + _local1._height;
}
if ((_local1._y - _local1._height) < g_obsMin_y) {
g_obsMin_y = _local1._y - _local1._height;
}
}
function killPopEnemyFire(arr) {
var _local1 = arr;
trace("Killing By Enemy Fire");
trace("arr.dead = " + _local1.dead);
if (_local1.aType == "cat_ammo1") {
killPopulationNum(2 * g_currentLevel, _local1._x + 100, _local1._y);
} else if (_local1.aType == "boss_ball") {
killPopulationNum(2 * g_currentLevel, _local1._x + 100, _local1._y);
} else if (_local1.aType == "bomb_arrow") {
killPopulationNum(5, _local1._x + 100, _local1._y);
} else {
killPopulationNum(1, _local1._x + 100, _local1._y);
}
}
function testHit() {
for (i in g_arrows) {
curArrow = g_arrows[i];
if (curArrow._y > g_ground) {
groundCollision(curArrow);
} else if ((!curArrow.dead) && (curArrow._x < -80)) {
killPopEnemyFire(curArrow);
curArrow.dead = true;
g_arrowDead++;
} else {
midX = curArrow._x - ((curArrow._x - curArrow.prevX) / 2);
midY = curArrow._y - ((curArrow._y - curArrow.prevY) / 2);
midX33 = curArrow._x - ((curArrow._x - curArrow.prevX) * 0.33);
midY33 = curArrow._y - ((curArrow._y - curArrow.prevY) * 0.33);
midX66 = curArrow._x - ((curArrow._x - curArrow.prevX) * 0.66);
midY66 = curArrow._y - ((curArrow._y - curArrow.prevY) * 0.66);
if (((curArrow._y > g_max_height) && (curArrow._x > g_max_width)) && (curArrow._x < g_width)) {
j = 0;
while ((j < g_enemies.length) && (!curArrow.dead)) {
curEn = g_enemies[j];
if (((curEn.hitzone.hitTest(curArrow._x, curArrow._y, 0) || (curEn.hitzone.hitTest(midX, midY, 0))) || (curEn.hitzone.hitTest(midX33, midY33, 0))) || (curEn.hitzone.hitTest(midX66, midY66, 0))) {
if ((curEn.eType == "flying_enemy") && (random(5) != 0)) {
displayDodge(curArrow._x, curArrow._y);
} else {
enemyCollision(curArrow, curEn);
}
}
j++;
}
}
if (((((!curArrow.dead) && (curArrow._x > g_obsMin_x)) && (curArrow._x < g_obsMax_x)) && (curArrow._y > g_obsMin_y)) && (curArrow._y < g_obsMax_y)) {
atATime = 2;
if (g_obstructs.length < atATime) {
atATime = g_obstructs.length;
}
j = 0;
while (j < atATime) {
curObs = getNextObs();
hitObj = curObs.hitTest(curArrow._x, curArrow._y, 1);
if (hitObj && (curObs != ground)) {
obstructCollision(curArrow, curObs);
}
j++;
}
}
if (curArrow._y > g_groundHeight) {
groundHit = false;
hitSpotX = 0;
hitSpotY = 0;
if (!curArrow.dead) {
if ((groundHit = ground.hitTest(midX33, midY33, 1))) {
trace(">>>>>>>>>>>>>>>>>>33_Point");
hitSpotX = midX33;
hitSpotY = midY33;
} else if ((groundHit = ground.hitTest(midX, midY, 1))) {
trace(">>>>>>>>>>>>>>>>>>MID POINT");
hitSpotX = midX;
hitSpotY = midY;
} else if ((groundHit = ground.hitTest(midX66, midY66, 1))) {
trace(">>>>>>>>>>>>>>>>>>66_Point");
hitSpotX = midX66;
hitSpotY = midY66;
} else if ((groundHit = ground.hitTest(curArrow._x, curArrow._y, 1))) {
trace(">>>>>>>>>>>>>>>>>>ORIG_Point");
hitSpotX = curArrow._x;
hitSpotY = curArrow._y;
}
if (groundHit) {
curArrow._x = hitSpotX;
curArrow._y = hitSpotY;
groundCollision(curArrow);
}
}
}
}
if (curArrow.dead && (curArrow.AoE)) {
forceAoE(curArrow);
}
}
}
function getNextObs() {
g_obsNdx++;
if (g_obsNdx >= g_obstructs.length) {
g_obsNdx = 0;
}
return(g_obstructs[g_obsNdx]);
}
function resetObsMaxes() {
g_obsMax_x = 0;
g_obsMax_y = 0;
g_obsMin_x = g_width;
g_obsMin_y = g_ground;
}
function resetMaxes() {
g_max_height = g_ground;
g_max_width = g_width;
}
function obstructCollision(arr, obs) {
var _local1 = arr;
var _local2 = obs;
friction = 0.95;
if (!_local1.piercing) {
killArrow(_local1);
if (!_local1.nonArrow) {
stickArrowInObject(curArrow, _local2);
}
if (((_local2.oType == "house") && (!_local2.dead)) && (((_local1.aType == "arrow_bad") || (_local1.aType == "cat_ammo1")) || (_local1.aType == "boss_ball"))) {
g_noHouseLoss = false;
temp = _local2.attachMovie("smoker", "smoker_0", 0);
temp._x = _local1._x - _local2._x;
temp._y = _local1._y - _local2._y;
temp = _local2.attachMovie("war_flag2", "warflag_0", 1);
temp._x = _local1._x - _local2._x;
temp._y = _local1._y - _local2._y;
_local2.dead = true;
_local2.gotoAndPlay(2);
if (g_frontline > _local1._x) {
g_frontline = _local1._x;
}
} else if ((_local2.oType != "house") && (!_local2.dead)) {
if (_local1.aType == "fire_arrow") {
trace("FORRESSTTT FIIIIIIIIIIIIIIIIIIIIIIIRRRRRRRRRRRRRRRRRRRREEEEEEEEEEEEE");
_local2.dead = true;
_local2.gotoAndPlay(2);
}
}
} else {
_local1.vx = _local1.vx * friction;
_local1.vy = _local1.vy * friction;
}
if (_local1.aType == "land_mine_arrow") {
addMine(_local1._x, _local1._y);
} else if (_local1.aType == "fire_arrow") {
addFlyingDebris("fire", _local1._x, _local1._y, 100, 1);
} else if (_local1.aType == "ice_arrow") {
addFlyingDebris("ice_crystal", _local1._x, _local1._y, 100, 2);
} else if (_local1.aType == "oil_arrow") {
addFlyingDebris("oil_drop", _local1._x, _local1._y, g_oilSpread, g_oilAmount);
}
}
function enemyCollision(arr, ene) {
var _local1 = arr;
var _local2 = ene;
if (!_local1.piercing) {
killArrow(_local1);
if (!_local1.nonArrow) {
stickArrowInEnemy(_local1, _local2);
}
dmg = calculateDamage(_local1, _local2);
addBloods(_local1, dmg);
} else {
if (_local2.eType == "boss") {
killArrow(_local1);
}
dmg = calculateDamage(_local1, _local2);
addBloods(_local1, dmg);
}
if (_local1.aType == "land_mine_arrow") {
addMine(_local1._x, _local1._y);
} else if (_local1.aType == "oil_arrow") {
addFlyingDebris("oil_drop", _local1._x, _local1._y, g_oilSpread, g_oilAmount);
} else if (_local1.aType == "fire_arrow") {
addFlyingDebris("fire", _local1._x, _local1._y, 50, 2);
} else if (_local1.aType == "ice_arrow") {
addFlyingDebris("ice_crystal", _local1._x, _local1._y, 50, 3);
}
}
function groundCollision(arr) {
var _local1 = arr;
bounceFactor = 0.3;
friction = 0.3;
if (!_local1.bouncy) {
playSound("hit.wav");
killArrow(_local1);
if (!_local1.nonArrow) {
stickArrowInObject(_local1, ground);
}
if ((_local1.aType == "cat_ammo1") || (_local1.aType == "boss_ball")) {
killArrow(_local1);
addFlyingDebris("fire", _local1._x, _local1._y, 500, 3);
forceAoE(_local1);
}
} else if ((_local1.aType == "cat_ammo1") || (_local1.aType == "boss_ball")) {
killArrow(_local1);
addFlyingDebris("fire", _local1._x, _local1._y, 500, 3);
forceAoE(_local1);
} else {
if (_local1.blastRange > 200) {
forceAoE(_local1);
}
_local1.vy = _local1.vy * (-bounceFactor);
_local1.vx = _local1.vx * friction;
midX = _local1._x - ((_local1._x - _local1.prevX) / 2);
midY = _local1._y - ((_local1._y - _local1.prevY) / 2);
_local1._x = midX;
_local1._y = midY;
_local1.bounceCount++;
_local1.blastPower = _local1.blastPower * 0.5;
_local1.blastRange = _local1.blastRange * 0.5;
if (_local1.bounceCount > 3) {
killArrow(_local1);
}
}
if (_local1.aType == "land_mine_arrow") {
addMine(_local1._x, _local1._y);
} else if (_local1.aType == "fire_arrow") {
addFlyingDebris("fire", _local1._x, _local1._y, 10, 1);
} else if (_local1.aType == "ice_arrow") {
addFlyingDebris("ice_crystal", _local1._x, _local1._y, 10, 1);
} else if (_local1.aType == "oil_arrow") {
addFlyingDebris("oil_drop", _local1._x, _local1._y, g_oilSpread, g_oilAmount);
}
}
function checkAoE(arr) {
var _local1 = arr;
if (_local1.dead && (_local1.AoE)) {
forceAoE(_local1);
}
}
function detonateBomb() {
i = 0;
while (i < g_arrows.length) {
arr = g_arrows[i];
if (arr.aType == "flak_arrow") {
killArrow(arr);
}
i++;
}
}
function killArrow(arr) {
arr.dead = true;
g_arrowDead++;
}
function getPopsClip() {
g_popsLevel++;
if (g_popsLevel > 3) {
g_popsLevel = 0;
}
return(g_popsLevel);
}
function getExplosionClip() {
g_explosionsLevel++;
if (g_explosionsLevel > 3) {
g_explosionsLevel = 0;
}
return(g_explosionsLevel);
}
function forceAoE(arr) {
var _local1 = arr;
lvl = getExplosionClip();
if (_local1.aType == "flak_arrow") {
temp = explosions.attachMovie("flak_animation", "b_anim" + lvl, lvl);
playSound("flak.wav");
} else {
temp = explosions.attachMovie("bomb_animation", "b_anim" + lvl, lvl);
playSound("bomb.wav");
}
temp._x = _local1._x;
temp._y = _local1._y;
temp._width = _local1.blastRange;
temp._height = _local1.blastRange;
if (((_local1._x + _local1.blastRange) > g_max_width) && ((_local1._y + _local1.blastRange) > g_max_height)) {
for (i in g_enemies) {
cur = g_enemies[i];
if (!cur.dead) {
dx = (cur._x + cur.critical._x) - _local1._x;
dy = (cur._y + cur.critical._y) - _local1._y;
dis = Math.sqrt((dx * dx) + (dy * dy));
if (dis < (_local1.blastRange / 1.5)) {
damage = Math.ceil(((_local1.blastRange - dis) / _local1.blastRange) * _local1.blastPower);
if (((cur.eType == "flying_enemy") && (_local1.aType == "flak_arrow")) || ((cur.eType == "enemy_archer") && (_local1.aType == "bomb_arrow"))) {
damage = damage * 5;
lvl = getPopsClip();
ch = pops.attachMovie("critical_hit", "critical_hit_" + lvl, lvl);
ch._x = cur._x + cur.critical._x;
ch._y = cur._y + cur.critical._y;
} else if (cur.eType == "boss") {
damage = 1;
}
displayDamage(cur._x, cur._y, damage);
cur.hp = cur.hp - damage;
}
checkEnemyDeath(cur);
}
}
}
}
function stickArrowInEnemy(arr, ene) {
var _local1 = ene;
var _local2 = arr;
lvl = random(3);
temp = _local1.center.attachMovie(_local2.aType, "sarrow_" + lvl, lvl);
if ((_local2.aType == "fire_arrow") && (_local1.eType != "boss")) {
lvl = random(3);
fire = _local1.fire.attachMovie("smoker", "smoker_" + lvl, lvl);
fire._x = _local2._x - _local1._x;
fire._y = _local2._y - _local1._y;
_local1.vy = _local1.vy * 1.2;
_local1.sick = true;
if (_local1.eType == "enemy_catapult") {
_local1.sickDmg = _local1.sickDmg + (g_fire_dot * 30);
} else {
_local1.sickDmg = _local1.sickDmg + g_fire_dot;
}
} else if ((_local2.aType == "ice_arrow") && (_local1.eType != "boss")) {
lvl = random(3);
ice = _local1.ice.attachMovie("ice_crystal", "ice_" + lvl, lvl);
ice._x = _local2._x - _local1._x;
ice._y = _local2._y - _local1._y;
ice._rotation = random(360);
}
temp._rotation = _local2._rotation;
temp._x = _local2._x - _local1._x;
temp._y = _local2._y - _local1._y;
}
function stickArrowInObject(arr, obs) {
var _local1 = arr;
temp = null;
lvl = 0;
if (obs.oType == "house") {
lvl = getDebrisClipFG();
temp = fg.attachMovie(_local1.aType, "s_arrow_" + lvl, lvl);
g_debris_fg[lvl] = temp;
} else {
lvl = getDebrisClipBG();
temp = bg.attachMovie(_local1.aType, "sarrow_" + lvl, lvl);
g_debris_bg[lvl] = temp;
}
temp._rotation = _local1._rotation;
temp._x = _local1._x;
temp._y = _local1._y;
}
function calculateDamage(arr, ene) {
var _local1 = arr;
var _local2 = ene;
vx = _local1.vx;
vy = _local1.vy;
damage = (Math.sqrt((vx * vx) + (vy * vy)) / 1000) * _local1.dmg;
arrType = _local1.aType;
eneType = _local2.eType;
if ((arrType == "fire_arrow") && (eneType != "enemy_catapult")) {
damage = damage * 0.25;
} else if ((arrType == "fire_arrow") && (eneType == "enemy_catapult")) {
damage = damage * 4;
} else if ((arrType == "ice_arrow") && (eneType != "dragon_archer")) {
damage = damage * 0.2;
} else if ((arrType == "ice_arrow") && (eneType == "dragon_archer")) {
damage = damage * 4;
} else if ((arrType == "p_arrow") && (eneType != "ogre")) {
damage = damage * 0.33;
} else if ((arrType == "p_arrow") && (eneType == "ogre")) {
damage = damage * 4;
} else if (arrType == "bomb_arrow") {
if (eneType == "enemy_archer") {
damage = damage * 4;
} else {
damage = damage * 0.2;
}
} else if (arrType == "land_mine_arrow") {
damage = 1;
}
if ((eneType == "boss") && (arrType != "cat_ammo1")) {
damage = 1;
}
dx = (_local1._x - _local2._x) - _local2.critical._x;
dy = (_local1._y - _local2._y) - _local2.critical._y;
dis = Math.sqrt((dx * dx) + (dy * dy));
if ((dis < 20) || (_local1.hitTest(_local2.critical))) {
damage = damage * 2;
if (eneType == "boss") {
damage = (Math.sqrt((vx * vx) + (vy * vy)) / 1000) * _local1.dmg;
if (arrType == "bomb_arrow") {
damage = damage + (g_blast_power * 10);
}
}
lvl = getPopsClip();
ch = pops.attachMovie("critical_hit", "critical_hit_" + lvl, lvl);
ch._x = _local1._x;
ch._y = _local1._y;
if ((_local1.aType == "arrow") && (_local2.eType != "boss")) {
checkXPBonus(_local1._x, _local1._y, _local1.airtime);
}
}
playRandomHit();
damage = Math.ceil(damage);
displayDamage(_local1._x, _local1._y, damage);
_local2.hp = _local2.hp - damage;
if ((_local1.aType == "ice_arrow") && (_local2.eType != "boss")) {
_local2.vx = _local2.vx * 0.66;
}
checkEnemyDeath(_local2);
return(damage / _local2.maxhp);
}
function playSound(filename) {
if (g_sound_on) {
mysound = new Sound();
mysound.attachSound(filename);
mysound.start(0, 1);
}
}
function playRandomHit() {
name = "";
num = random(4);
if (num == 0) {
name = "doeh.wav";
} else if (num == 1) {
name = "uh.wav";
} else if (num == 2) {
name = "oof.wav";
} else {
name = "oreh.wav";
}
playSound(name);
}
function resetXPcounts() {
g_longs = 0;
g_mids = 0;
g_shorts = 0;
}
function checkXPBonus(x, y, airtime) {
var _local1 = x;
var _local2 = y;
trace("AIR TIME: " + airtime);
airtimeBonus = Math.floor(airtime / 7);
if (_local1 > (g_width * 0.8)) {
addXP(g_long_xp + airtimeBonus);
g_longs++;
displayXP(_local1, _local2, g_long_xp + airtimeBonus);
} else if (_local1 > (g_width * 0.6)) {
addXP(g_mid_xp + airtimeBonus);
g_mids++;
displayXP(_local1, _local2, g_mid_xp + airtimeBonus);
} else if (_local1 > (g_width * 0.4)) {
addXP(g_short_xp + airtimeBonus);
g_shorts++;
displayXP(_local1, _local2, g_short_xp + airtimeBonus);
}
}
function addXP(num) {
g_xp = g_xp + num;
g_total_xp = g_total_xp + num;
}
function displayXP(x, y, num) {
lvl = getPopsClip();
xp = pops.attachMovie("xp_bonus", "xp_" + lvl, lvl);
xp._x = x;
xp._y = y;
xp.num = num;
lvl = getPopsClip();
xp = pops.attachMovie("xp_bonus", "xp_" + lvl, lvl);
xp._x = xp_text._x;
xp._y = xp_text._y + 100;
xp.num = num;
}
function displayDamage(x, y, num) {
lvl = getPopsClip();
dmg = pops.attachMovie("hp_damage", "dmg_" + lvl, lvl);
dmg._x = x;
dmg._y = y;
dmg.num = num;
}
function displayDodge(x, y) {
lvl = getPopsClip();
temp = pops.attachMovie("dodge", "dodge_" + lvl, lvl);
temp._x = x;
temp._y = y;
}
function displayPop(x, y, num) {
lvl = getPopsClip();
dmg = pops.attachMovie("hp_damage", "dmg_" + lvl, lvl);
dmg._x = x;
dmg._y = y;
dmg.num = num;
}
function checkEnemyDeath(ene) {
var _local1 = ene;
if ((_local1.dead = _local1.hp <= 0)) {
trace("ENEMY SHOULD BE DEAD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<<<<<<<<<<");
_local1.hp = 0;
g_enemyDead++;
if ((_local1.eType == "boss") && (_local1._x > 0)) {
addXP(g_currentLevel * 20);
g_boss_award = g_boss_award + (g_currentLevel * 20);
displayXP(_local1._x, (_local1._y - _local1._height) - 20, g_currentLevel * 20);
}
}
_local1.gotoAndStop(Math.floor((1 - (_local1.hp / _local1.maxhp)) * 100));
}
function cleanUp() {
cleanUpEnemies();
cleanUpArrows();
cleanUpBlood();
}
function cleanUpEnemies() {
if (g_enemyDead > 0) {
temp = new Array();
for (i in g_enemies) {
cur = g_enemies[i];
if (!cur.dead) {
temp.push(cur);
} else {
if (cur.eType == "enemy_catapult") {
g_numCatapultsOnScreen--;
} else if ((cur.eType == "flying_enemy") || (cur.eType == "dragon_archer")) {
g_numFlyingOnScreen--;
} else if (cur.eType == "boss") {
g_numBossesOnScreen--;
}
g_enemyDead--;
g_curOnScreen--;
checkinEneLevel(cur.lvl);
g_bodies.push(cur);
if (cur.killedHouse) {
trace("Killed House");
cur.gotoAndPlay(136);
} else {
cur.gotoAndPlay(100);
playRandomHit();
}
resetMaxes();
}
}
g_enemies = temp;
}
}
function updateMaxes(x, y) {
if (y < g_max_height) {
g_max_height = y - 100;
}
if (x < g_max_width) {
g_max_width = x - 100;
factr = 20;
if (g_frontline < (g_max_width + 300)) {
spot = g_frontline;
trace("Min Flag");
} else {
spot = g_max_width + 300;
trace("Max Flag");
}
if (spot < 800) {
spot = 800;
}
if (spot > (g_width - 200)) {
spot = g_width - 200;
}
reinforcements._x = spot;
}
}
function cleanUpBlood() {
}
function cleanUpArrows() {
if (g_arrowDead > 0) {
temp = new Array();
for (i in g_arrows) {
cur = g_arrows[i];
if (!cur.dead) {
temp.push(cur);
} else {
cur.unloadMovie();
g_arrowDead--;
}
}
g_arrows = temp;
}
}
function cleanDebris() {
i = 0;
while (i < g_dmax) {
g_debris_fg[i].unloadMovie();
i++;
}
i = 0;
while (i < g_dmax) {
g_debris_bg[i].unloadMovie();
i++;
}
i = 0;
while (i < g_bloodMax) {
g_debris_bloods[i].unloadMovie();
i++;
}
}
function cleanEnemies() {
while (g_enemies.length > 0) {
g_enemies.pop().unloadMovie();
}
}
function cleanObstructs() {
while (g_obstructs.length > 0) {
temp = g_obstructs.pop();
temp.unloadMovie();
}
}
function cleanArrows() {
while (g_arrows.length > 0) {
temp = g_arrows.pop();
temp.unloadMovie();
}
}
function createLevel(lvl) {
var _local1 = lvl;
cleanUpMines();
_root.g_enemyArrowCount = 1 + Math.ceil(_local1 * 0.1);
if (g_enemyArrowCount > 3) {
g_enemyArrowCount = 3;
}
factr = 20;
g_frontline = g_width - (factr * g_currentLevel);
if (g_frontline < ((g_width / 2) + 200)) {
g_frontline = (g_width / 2) + 200;
}
gravX = -50 + random(100);
gravX = gravX * (_local1 * 0.1);
if (gravX < -500) {
gravX = -500;
} else if (gravX > 500) {
gravX = 500;
}
wind_indicator._xscale = gravX;
g_population = g_currentLevel * 10;
g_numArmy = 0;
if ((g_currentLevel % 10) == 0) {
g_numArmy = g_numArmy + ((g_numBosses = Math.floor(g_currentLevel / 10)));
} else {
g_numBosses = 0;
}
g_numArmy = g_numArmy + ((g_numWalkers = (_local1 * 2) + 10));
g_numArmy = g_numArmy + ((g_numFlying = Math.floor(_local1 * 0.2)));
g_numArmy = g_numArmy + ((g_numOgres = Math.floor(_local1 * 0.4) + 1));
g_numArmy = g_numArmy + ((g_numEnemyCatapults = Math.floor(_local1 * 0.12)));
g_numArmy = g_numArmy + ((g_numEnemyArchers = Math.floor(_local1 * 0.16)));
g_numArmy = g_numArmy + ((g_numDragonArchers = Math.floor(_local1 * 0.13)));
g_numHomes = Math.floor(_local1 * 0.1) + 1;
g_numObs = Math.floor(_local1 * 0.1) + 1;
createEnemeyQueue();
if (g_numObs > g_treeMax) {
g_numObs = g_treeMax;
}
if (g_numHomes > 3) {
g_numhomes = 3;
}
factr = 1.05;
g_ogre_hp = Math.ceil(g_base_ogre_hp * Math.pow(factr, g_currentLevel));
g_walker_hp = Math.ceil(g_base_walker_hp * Math.pow(factr, g_currentLevel));
g_flyer_hp = Math.ceil(g_base_flyer_hp * Math.pow(factr, g_currentLevel));
}
function reinforceTheArmy() {
var _local1 = _root;
area = _local1.g_width - _local1.reinforcements._x;
lvl = _local1.g_currentLevel;
spot = _local1.reinforcements._x + random(area);
if (spot < 600) {
spot = 600;
}
if (spot > (_local1.g_width - 100)) {
spot = (_local1.g_width - 100) + random(200);
}
nextEnemy = null;
nextEnemy = _local1.g_armyList.pop();
if (g_curOnScreen >= g_maxOnScreen) {
g_armyList.unshift(nextEnemy);
} else if (((nextEnemy == "dragon_archer") || (nextEnemy == "flying_enemy")) && (g_numFlyingOnScreen >= 2)) {
g_armyList.unshift(nextEnemy);
} else if ((nextEnemy == "enemy_catapult") && (g_numCatapultsOnScreen >= 2)) {
g_armyList.unshift(nextEnemy);
} else if ((nextEnemy == "boss") && (g_numBossesOnScreen >= 1)) {
g_armyList.unshift(nextEnemy);
} else if (nextEnemy == "flying_enemy") {
g_numFlyingOnScreen++;
alt = (_local1.g_groundHeight - random(300)) - 300;
if (alt < 600) {
alt = 600;
}
_local1.addEnemy(_local1.g_width + 20, alt, ((-random(100)) - 20) - (_local1.g_currentLevel * 1.1), 0, _local1.g_flyer_hp, "flying_enemy");
_local1.g_numFlying--;
flyerT = 0;
_local1.g_curOnScreen++;
} else if (nextEnemy == "ogre") {
_local1.addEnemy(spot, _local1.g_ground, -5 - random(_local1.g_currentLevel * g_speedFactor), 0, _local1.g_ogre_hp, "ogre");
_local1.g_numOgres--;
ogreT = 0;
_local1.g_curOnScreen++;
} else if (nextEnemy == "enemy") {
_local1.addEnemy(spot, _local1.g_ground, -10 - random(_local1.g_currentLevel * g_speedFactor), 0, _local1.g_walker_hp, "enemy");
_local1.g_numWalkers--;
walkerT = 0;
_local1.g_curOnScreen++;
} else if (nextEnemy == "enemy_catapult") {
g_numCatapultsOnScreen++;
_local1.addEnemy(spot, _local1.g_ground, -3, 0, Math.floor(_local1.g_ogre_hp), "enemy_catapult");
_local1.g_numEnemyCatapults--;
catapultT = 0;
_local1.g_curOnScreen++;
} else if (nextEnemy == "enemy_archer") {
_local1.addEnemy(spot, _local1.g_ground, -15 - random(_local1.g_currentLevel * g_speedFactor), 0, Math.floor(_local1.g_walker_hp * 0.66), "enemy_archer");
_local1.g_numEnemyArchers--;
archerT = 0;
_local1.g_curOnScreen++;
} else if (nextEnemy == "dragon_archer") {
g_numFlyingOnScreen++;
alt = (_local1.g_groundHeight - random(300)) - 300;
if (alt < 600) {
alt = 600;
}
_local1.addEnemy(_local1.g_width + 20, alt, ((-random(100)) - 20) - (_local1.g_currentLevel * 1.1), 0, Math.floor(_local1.g_flyer_hp * 5), "dragon_archer");
_local1.g_numDragonArchers--;
dragonArcherT = 0;
_local1.g_curOnScreen++;
} else if (nextEnemy == "boss") {
g_numBossesOnScreen++;
_local1.addEnemy(_local1.g_width, _local1.g_ground, -7, 0, _local1.g_ogre_hp * 5, "boss");
_local1.g_numBosses--;
bossT = 0;
_local1.g_curOnScreen++;
}
}
function createEnemeyQueue() {
g_testCount = 0;
g_armyList = new Array(g_numArmy);
addEnemyTypeToArmy("boss", g_numBosses);
addEnemyTypeToArmy("ogre", g_numOgres);
addEnemyTypeToArmy("enemy_catapult", g_numEnemyCatapults);
addEnemyTypeToArmy("dragon_archer", g_numDragonArchers);
addEnemyTypeToArmy("flying_enemy", g_numFlying);
addEnemyTypeToArmy("enemy_archer", g_numEnemyArchers);
addEnemyTypeToArmy("enemy", g_numWalkers);
trace(g_armyList);
trace("Army Size: " + g_numArmy);
trace("List Length: " + g_armyList.length);
trace("Enemies Added: " + g_testCount);
}
function addEnemyTypeToArmy(eType, numOfType) {
var _local1 = eType;
var _local2 = numOfType;
ndx = 0;
while (ndx < _local2) {
spot = random(g_numArmy);
while (g_armyList[spot] != null) {
if ((++spot) > (g_numArmy - 1)) {
spot = 0;
}
}
g_armyList[spot] = _local1;
g_testCount++;
ndx++;
}
}
function loadNextLevel() {
g_lastLevel = g_currentLevel;
createLevel(++g_currentLevel);
}
function cleanLevel() {
cleanDebris();
cleanBodies();
cleanObstructs();
cleanArrows();
cleanArchers();
cleanCatapults();
cleanEnemies();
}
function startNextLevel() {
g_boss_award = 0;
_root.g_landMines = new Array(_root.g_mine_num);
g_houses_alive = g_numhomes;
initializeClipLevels();
reinforcements.gotoAndStop(1);
reinforcements._x = g_width;
lvl = 1;
g_enelvl = -1;
g_arrowLevel = -1;
g_terrainLevel = 0;
g_popsLevel = -1;
g_explosionsLevel = -1;
g_key_listener = keylvl.attachMovie("key_listener", "key_listener_" + lvl, lvl);
g_key_listener._alpha = 0;
g_key_listener._x = -100;
resetXPcounts();
resetMaxes();
cleanDebris();
cleanBodies();
cleanObstructs();
cleanArrows();
cleanArchers();
cleanCatapults();
cleanEnemies();
g_debris_ndx_bg = 0;
g_debris_ndx_fg = 0;
g_curOnScreen = 0;
g_obj_ndx = g_obj_start_ndx;
g_startNew = true;
pause = false;
}
function checkEndGame() {
if ((((g_armyList.length == 0) && (g_enemies.length == 0)) && (!g_level_over)) && (g_population > 0)) {
g_endTime = getTimer() + g_menuDelay;
g_level_over = true;
resetObsMaxes();
if ((g_currentLevel > 0) && (!g_gameJustStarted)) {
temp = levelComplete.attachMovie("level_complete", "complete_0", 0);
temp._x = g_width / 2;
temp._y = g_ground / 2;
}
}
if (((getTimer() > g_endTime) && (g_level_over)) || (g_forceEndGame)) {
g_key_listener.unloadMovie();
if (((!g_gameJustStarted) && (!g_restarted)) && (!g_skipped)) {
calculateXPAward();
}
pause = true;
g_level_over = false;
setPrevGameVars();
loadNextLevel();
if (g_currentLevel > 1) {
temp = menu_layer.attachMovie("upgrades", "upgrades_1", 1);
temp._x = g_width / 2;
temp._y = g_ground / 2;
temp._xscale = (temp._yscale = 247);
} else {
displayLevelStats();
}
loadTerrain();
g_playing = false;
g_forceEndGame = false;
g_gameJustStarted = false;
}
}
function displayLevelStats() {
stats_p._x = g_width / 2;
stats_p._y = g_ground / 2;
}
function resetCosts() {
cost_range = 150;
cost_multi = 200;
cost_archer = 200;
cost_catapult = 1000;
cost_bomb_arrow = 200;
cost_flak_arrow = 200;
cost_land_mine_arrow = 500;
cost_oil_arrow = 600;
cost_fire_arrow = 400;
cost_ice_arrow = 300;
cost_pierce_arrow = 220;
cost_blast_range = 500;
cost_blast_power = 200;
cost_arrow_dmg = 200;
cost_bow_loading = 120;
cost_archer_cooldown = 150;
cost_catapult_cooldown = 105;
cost_fire_dot = 300;
}
function floorAmounts() {
g_maxbowpwr_amount = Math.floor(g_maxbowpwr_amount);
g_arrow_dmg_amount = Math.floor(g_arrow_dmg_amount);
g_blast_range_amount = Math.floor(g_blast_range_amount);
g_blast_power_amount = Math.floor(g_blast_power_amount);
g_catapult_cooldown_amount = Math.floor(g_catapult_cooldown_amount);
g_archer_cooldown_amount = Math.floor(g_archer_cooldown_amount);
g_bow_loading_amount = Math.floor(g_bow_loading_amount);
g_fire_dot_amount = Math.floor(g_fire_dot_amount);
}
function buyAmount(name, amount) {
var _local1 = name;
var _local2 = amount;
i = 0;
while ((i < _local2) && (buy(_local1))) {
i++;
}
}
function buyMaxType(name) {
var _local1 = name;
while (buy(_local1)) {
}
}
function buy(name) {
var _local1 = name;
if (_local1 == "range_upgrade") {
if ((g_xp >= cost_range) && (g_maxbowpwr < g_maxbowpwr_max)) {
g_maxbowpwr = g_maxbowpwr + g_maxbowpwr_inc;
if (g_maxbowpwr > g_maxbowpwr_max) {
g_maxbowpwr = g_maxbowpwr_max;
}
g_xp = g_xp - cost_range;
cost_range = cost_range + 200;
cost_range = Math.floor(cost_range);
return(true);
}
} else if (_local1 == "land_mine_arrow") {
if ((g_xp >= cost_land_mine_arrow) && (g_mine_num < g_mine_num_max)) {
g_mine_num++;
g_xp = g_xp - cost_land_mine_arrow;
cost_land_mine_arrow = cost_land_mine_arrow + 300;
cost_land_mine_arrow = Math.floor(cost_land_mine_arrow);
return(true);
}
} else if (_local1 == "oil_arrow") {
if ((g_xp >= cost_oil_arrow) && (g_oil_num < g_oil_num_max)) {
g_oil_num++;
g_xp = g_xp - cost_oil_arrow;
cost_oil_arrow = cost_oil_arrow + 0;
cost_oil_arrow = Math.floor(cost_oil_arrow);
return(true);
}
} else if (_local1 == "multi_arrow") {
if ((g_xp >= cost_multi) && (g_multi_num < g_multi_num_max)) {
g_multi_num++;
g_xp = g_xp - cost_multi;
cost_multi = cost_multi + 300;
cost_multi = Math.floor(cost_multi);
return(true);
}
} else if (_local1 == "fire_dot") {
if ((g_xp >= cost_fire_dot) && (g_fire_dot < g_fire_dot_max)) {
g_fire_dot = g_fire_dot + g_fire_dot_inc;
if (g_fire_dot > g_fire_dot_max) {
g_fire_dot = g_fire_dot_max;
}
g_xp = g_xp - cost_fire_dot;
cost_fire_dot = cost_fire_dot + 50;
cost_fire_dot = Math.floor(cost_fire_dot);
return(true);
}
} else if (_local1 == "archer") {
if ((g_xp >= cost_archer) && (g_archer_num < g_archer_num_max)) {
g_archer_num++;
g_xp = g_xp - cost_archer;
cost_archer = cost_archer + 50;
cost_archer = Math.floor(cost_archer);
return(true);
}
} else if (_local1 == "catapult") {
if ((g_xp >= cost_catapult) && (g_catapult_num < g_catapult_num_max)) {
g_catapult_num++;
g_xp = g_xp - cost_catapult;
cost_catapult = cost_catapult + 1000;
cost_catapult = Math.floor(cost_catapult);
return(true);
}
} else if (_local1 == "pierce_arrow") {
if ((g_xp >= cost_pierce_arrow) && (g_piercer_num < g_piercer_num_max)) {
g_piercer_num++;
g_xp = g_xp - cost_pierce_arrow;
cost_pierce_arrow = cost_pierce_arrow + 300;
cost_pierce_arrow = Math.floor(cost_pierce_arrow);
return(true);
}
} else if (_local1 == "bomb_arrow") {
if ((g_xp >= cost_bomb_arrow) && (g_bomb_num < g_bomb_num_max)) {
g_bomb_num++;
g_xp = g_xp - cost_bomb_arrow;
cost_bomb_arrow = cost_bomb_arrow + 200;
cost_bomb_arrow = Math.floor(cost_bomb_arrow);
return(true);
}
} else if (_local1 == "flak_arrow") {
if ((g_xp >= cost_flak_arrow) && (g_flak_num < g_flak_num_max)) {
g_flak_num++;
g_xp = g_xp - cost_flak_arrow;
cost_flak_arrow = cost_flak_arrow + 200;
cost_flak_arrow = Math.floor(cost_flak_arrow);
return(true);
}
} else if (_local1 == "land_mine_arrow") {
if ((g_xp >= cost_land_mine_arrow) && (g_mine_num < g_mine_num_max)) {
g_mine_num++;
g_xp = g_xp - cost_land_mine_arrow;
cost_land_mine_arrow = cost_land_mine_arrow + 200;
cost_land_mine_arrow = Math.floor(cost_land_mine_arrow);
return(true);
}
} else if (_local1 == "fire_arrow") {
if ((g_xp >= cost_fire_arrow) && (g_fire_num < g_fire_num_max)) {
g_fire_num++;
g_xp = g_xp - cost_fire_arrow;
cost_fire_arrow = cost_fire_arrow + 200;
cost_fire_arrow = Math.floor(cost_fire_arrow);
return(true);
}
} else if (_local1 == "ice_arrow") {
if ((g_xp >= cost_ice_arrow) && (g_ice_num < g_ice_num_max)) {
g_ice_num++;
g_xp = g_xp - cost_ice_arrow;
cost_ice_arrow = cost_ice_arrow + 200;
cost_ice_arrow = Math.floor(cost_ice_arrow);
return(true);
}
} else if (_local1 == "blast_power") {
if ((g_xp >= cost_blast_power) && (g_blast_power < g_blast_power_max)) {
g_blast_power = g_blast_power + g_blast_power_inc;
if (g_blast_power > g_blast_power_max) {
g_blast_power = g_blast_power_max;
}
g_xp = g_xp - cost_blast_power;
cost_blast_power = cost_blast_power + 300;
cost_blast_power = Math.floor(cost_blast_power);
return(true);
}
} else if (_local1 == "blast_range") {
if ((g_xp >= cost_blast_range) && (g_blast_range < g_blast_range_max)) {
g_blast_range = g_blast_range + g_blast_range_inc;
if (g_blast_range > g_blast_range_max) {
g_blast_range = g_blast_range_max;
}
g_xp = g_xp - cost_blast_range;
cost_blast_range = cost_blast_range + 300;
cost_blast_range = Math.floor(cost_blast_range);
return(true);
}
} else if (_local1 == "bow_loading") {
if ((g_xp >= cost_bow_loading) && (g_bow_loading > g_bow_loading_max)) {
g_bow_loading = g_bow_loading - g_bow_loading_inc;
if (g_bow_loading < g_bow_loading_max) {
g_bow_loading = g_bow_loading_max;
}
g_xp = g_xp - cost_bow_loading;
cost_bow_loading = cost_bow_loading + 20;
cost_bow_loading = Math.floor(cost_bow_loading);
return(true);
}
} else if (_local1 == "archer_loading") {
if ((g_xp >= cost_archer_cooldown) && (g_archer_cooldown > g_archer_cooldown_max)) {
g_archer_cooldown = g_archer_cooldown - g_archer_cooldown_inc;
if (g_archer_cooldown < g_archer_cooldown_max) {
g_archer_cooldown = g_archer_cooldown_max;
}
g_xp = g_xp - cost_archer_cooldown;
cost_archer_cooldown = cost_archer_cooldown + 50;
cost_archer_cooldown = Math.floor(cost_archer_cooldown);
return(true);
}
} else if (_local1 == "catapult_loading") {
if ((g_xp >= cost_catapult_cooldown) && (g_catapult_cooldown > g_catapult_cooldown_max)) {
g_catapult_cooldown = g_catapult_cooldown - g_catapult_cooldown_inc;
if (g_catapult_cooldown < g_catapult_cooldown_max) {
g_catapult_cooldown = g_catapult_cooldown_max;
}
g_xp = g_xp - cost_catapult_cooldown;
cost_catapult_cooldown = cost_catapult_cooldown + 50;
cost_catapult_cooldown = Math.floor(cost_catapult_cooldown);
return(true);
}
} else if (_local1 == "arrow_dmg") {
if ((g_xp >= cost_arrow_dmg) && (g_arrow_dmg < g_arrow_dmg_max)) {
g_arrow_dmg = g_arrow_dmg + g_arrow_dmg_inc;
if (g_arrow_dmg > g_arrow_dmg_max) {
g_arrow_dmg = g_arrow_dmg_max;
}
g_xp = g_xp - cost_arrow_dmg;
cost_arrow_dmg = cost_arrow_dmg + 100;
cost_arrow_dmg = Math.floor(cost_arrow_dmg);
return(true);
}
}
return(false);
}
function cleanArchers() {
while (g_archers.length > 0) {
temp = g_archers.pop();
temp.unloadMovie();
}
}
function loadArchers() {
if (g_archer_num > 0) {
aimer._x = tower._x;
aimer._y = tower._y - 100;
} else {
aimer._x = -100;
}
i = 0;
while (i < g_archer_num) {
temp = archerZone.attachMovie("archer", "archer_" + i, i);
temp._x = (tower._x - 160) - (i * 20);
temp._y = tower._y + 60;
g_archers.push(temp);
i++;
}
}
function relocateForce() {
for (i in g_archers) {
temp = g_archers[i];
temp._x = (tower._x - 160) - (i * 20);
temp._y = tower._y + 60;
}
for (i in g_catapults) {
temp = g_catapults[i];
temp._x = (tower._x - 350) - (i * 50);
temp._y = tower._y + 60;
}
}
function cleanCatapults() {
while (g_catapults.length > 0) {
temp = g_catapults.pop();
temp.unloadMovie();
}
}
function cleanBodies() {
while (g_bodies.length > 0) {
g_bodies.pop().unloadMovie();
}
}
function loadCatapults() {
if (g_catapult_num > 0) {
_root.tower.cat_shooter._alpha = 100;
c_aimer._x = tower._x;
c_aimer._y = tower._y - 150;
} else {
c_aimer._x = -100;
_root.tower.cat_shooter._alpha = 0;
}
if (g_catapult_num > 0) {
temp = catapultZone.attachMovie("catapult", "catapult_" + i, i);
temp._x = (tower._x - 350) - (i * 50);
temp._y = tower._y + 60;
g_catapults.push(temp);
}
}
function getClip() {
}
function getDebrisClipFG() {
g_debris_ndx_fg++;
if (g_debris_ndx_fg == g_dmax) {
g_debris_ndx_fg = 0;
}
return(g_debris_ndx_fg);
}
function getDebrisClipBG() {
g_debris_ndx_bg++;
if (g_debris_ndx_bg == g_dmax) {
g_debris_ndx_bg = 0;
}
return(g_debris_ndx_bg);
}
function getObjClip() {
g_obj_ndx++;
if (g_obj_ndx > 50) {
g_obj_ndx = 0;
}
return(g_obj_ndx);
}
function followTerrain(ene) {
var _local1 = ene;
if (ground.hitTest(_local1._x, _local1._y, 1) || (_local1._y > g_ground)) {
if (_local1.delta > 0) {
_local1.delta = 0;
}
_local1.delta = _local1.delta - 0.5;
_local1._y = _local1._y + _local1.delta;
} else {
if (_local1.delta < 0) {
_local1.delta = 0;
}
_local1.delta = _local1.delta + 0.5;
_local1._y = _local1._y + _local1.delta;
}
}
function placeTower() {
g_placeTowerCount++;
if (g_random_tower == "on") {
tower._x = (random(g_width) * 0.5) + 500;
} else {
tower._x = 500;
}
tower._y = g_ground / 2;
if (ground.hitTest(tower._x - (tower._width / 2), tower._y + (tower._height / 3), 1)) {
while (ground.hitTest(tower._x - (tower._width / 2), tower._y + (tower._height / 3), 1) && (tower._y > 0)) {
tower._y--;
trace("Going Up: " + tower._y);
}
} else {
while ((!ground.hitTest(tower._x - (tower._width / 2), tower._y + (tower._height / 3), 1)) && (tower._y < g_ground)) {
tower._y++;
trace("Going Down: " + tower._y);
}
}
g_icon_offset = tower._x - 425;
if ((g_placeTowerCount < 10) && (((ground.hitTest(tower._x, tower._y, 1) || (ground.hitTest(tower._x + 70, tower._y - 70, 1))) || (ground.hitTest(tower._x + 70, tower._y, 1))) || (tower._y < 300))) {
placeTower();
} else {
g_placeTowerCount = 0;
}
}
function getNextTerrain() {
g_terrainNdx = g_currentLevel % g_terrains.length;
return(g_terrains[g_terrainNdx]);
}
function getNextBackground() {
ndx = random(g_backgrounds.length);
trace("g_terrainNdx: " + ndx);
return(g_backgrounds[ndx]);
}
function getTerrainClip() {
return(g_terrainLevel++);
}
function loadTerrain() {
gravY = 1000;
ground = hill.attachMovie(getNextTerrain(), "ground_1", 1);
back.attachMovie(getNextBackground(), "background_1", 1, back_prop);
back._x = g_width / 2;
back._y = g_ground;
back._width = g_width + 100;
back._height = g_ground;
ground._x = g_width / 2;
ground._width = g_width + 100;
ground._height = g_ground + 100;
ground._y = g_ground;
g_groundHeight = g_ground - ground._height;
}
function restartLevel() {
trace("entering restart");
g_numCatapultsOnScreen = 0;
g_numFlyingOnScreen = 0;
g_numBossesOnScreen = 0;
g_currentLevel--;
g_restarted = true;
g_game_over = false;
g_forceEndGame = true;
checkEndGame();
g_restarted = false;
trace("exiting restart");
}
function skipToLevel() {
g_skipTo = Math.floor(g_skipTo);
num = new Number(g_skipTo);
if (num.toString() == "NaN") {
g_skipTo = 666;
}
if ((g_skipTo <= g_maxLevel) || (g_skipTo == 666)) {
g_skipped = true;
g_game_over = false;
g_currentLevel = g_skipTo - 1;
g_population = g_currentLevel * 10;
g_forceEndGame = true;
checkEndGame();
g_skipped = false;
}
}
function restartGame() {
g_restarted = true;
g_game_over = false;
g_mode = "normal";
resetGameVars();
g_currentLevel = 0;
g_forceEndGame = true;
checkEndGame();
g_restarted = false;
}
function resetToPrev() {
g_maxbowpwr = g_Pmaxbowpwr;
g_currentLevel = g_PcurrentLevel;
g_xp = g_Pxp;
g_population = g_Ppopulation;
g_multi_num = g_Pmulti_num;
g_bomb_num = g_Pbomb_num;
g_catapult_num = g_Pcatapult_num;
g_archer_num = g_Parcher_num;
g_piercer_num = g_Ppiercer_num;
g_arrow_dmg = g_Parrow_dmg;
g_blast_range = g_Pblast_range;
g_blast_power = g_Pblast_power;
g_catapult_cooldown = g_Pcatapult_cooldown;
g_archer_cooldown = g_Parcher_cooldown;
}
function setKey(mode, mode_icon) {
var _local1 = mode_icon;
var _local2 = mode;
for (i in g_keys) {
curKey = g_keys[i];
if (curKey.hitTest(_xmouse, _ymouse, 0)) {
curKey.attachMovie(_local1, "mode_1", 1);
curKey.mode = _local2;
}
}
}
function setMode(keyNum) {
g_mode = g_keys[keyNum].mode;
}
function buymax() {
prev_xp = 0;
do {
prev_xp = g_xp;
buy("bow_loading");
buy("range_upgrade");
buy("multi_arrow");
buy("fire_arrow");
buy("ice_arrow");
buy("pierce_arrow");
buy("bomb_arrow");
buy("catapult");
buy("archer");
buy("blast_range");
buy("catapult_loading");
buy("archer_loading");
buy("blast_power");
buy("arrow_dmg");
buy("fire_dot");
buy("flak_arrow");
buy("land_mine_arrow");
buy("oil_arrow");
} while (g_xp < prev_xp);
}
stop();
g_fireCatapultNow = true;
g_catTimeElapsed = 0;
g_catFireAuto = true;
g_random_tower = "off";
g_soundText = "on";
g_tracerNdx = 0;
g_tracerNum = 8;
g_oilSpread = 120;
g_oilAmount = 3;
g_treeMax = 3;
g_fireSplats = 3;
setMarker = "moveable";
g_tracers = new Array(g_tracerNum);
g_sound_on = true;
g_playing = false;
g_armyList = new Array();
g_ground = 1400;
g_width = 2500;
g_currentLevel = 0;
g_lastLevel = 0;
g_total_xp = 0;
g_xp = 0;
g_maxLevel = 0;
g_gameJustStarted = true;
g_skipTo = 1;
g_restarted = false;
g_skipped = false;
g_base_ogre_hp = 250;
g_base_flyer_hp = 8;
g_base_walker_hp = 10;
g_ogre_hp = g_base_ogre_hp;
g_walker_hp = g_base_flyer_hp;
g_flyer_hp = g_base_walker_hp;
myLocalSO = SharedObject.getLocal("testbm0");
if (myLocalSO.data.g_currentLevel != null) {
trace("Shared Object Data Found... loading data");
g_total_xp = myLocalSO.data.g_total_xp;
g_currentLevel = myLocalSo.data.g_currentLevel;
g_xp = _root.g_total_xp;
g_maxLevel = myLocalSo.data.g_currentLevel + 1;
g_lastLevel = g_currentLevel - 1;
} else {
trace("Shared Object Data Not Found... using default data");
g_total_xp = (g_xp = 0);
g_currentLevel = 0;
g_maxLevel = 1;
displayHelp();
}
g_longs = 0;
g_shorts = 0;
g_mids = 0;
g_long_award_xp = 0;
g_mid_award_xp = 0;
g_short_award_xp = 0;
g_house_award_xp = 0;
g_long_xp = 15;
g_mid_xp = 11;
g_short_xp = 5;
g_level_xp = 5;
g_awarded_xp = 0;
g_level_award_xp = 0;
g_house_xp = 50;
g_zero_loss_award = 0;
g_allhouse_award = 0;
g_xp_msg = "nothing of interest";
g_noPopLoss = true;
g_noHouseLoss = true;
g_boss_award = 0;
g_arrows = new Array();
g_enemies = new Array();
g_obstructs = new Array();
g_bloods = new Array();
g_archers = new Array();
g_catapults = new Array();
g_bodies = new Array();
g_terrains = new Array("ground1", "ground2", "ground3", "ground4", "ground5", "ground6", "ground7", "ground8", "ground9", "ground10", "ground11", "ground12", "ground13", "ground14", "ground15", "ground16", "ground17", "ground18", "ground19", "ground20", "ground21", "ground22", "ground23", "ground24", "ground26", "ground27", "ground28", "ground29", "ground30", "ground31");
g_keys = new Array();
g_trees = new Array("tree", "tree2");
g_homes = new Array();
g_homeNdx = -1;
g_ogres_entered = 0;
g_fliers_entered = 0;
g_walkers_entered = 0;
g_clipnum = 0;
g_andx = 0;
g_endx = 0;
gravX = 1000;
gravY = 1000;
elapsed = 0;
g_arcount = 0;
g_bcount = 0;
g_boost = 4;
g_unloadndx = 0;
pause = false;
bloodOn = true;
g_forceEndGame = false;
g_startNew = false;
g_bow_pwr = 5;
g_mode_single = 0;
g_mode_multi = 1;
g_mode_bomb = 2;
g_mode = "normal";
g_arrowMode = g_mode_bomb;
g_bow_cooldown = 0;
g_key_listener = null;
resetGameVars();
setPrevGameVars();
g_numWalkers = 0;
g_numBosses = 0;
g_numObs = 0;
g_numFlying = 0;
g_numOgres = 0;
g_numEnemyCatapults = 0;
g_numEnemyArchers = 0;
g_numDragonArchers = 0;
g_numHomes = 0;
g_game_over = false;
g_level_over = false;
g_endTime = 0;
g_menuDelay = 3000;
g_icon_spacing = 55;
g_icon_offset = 75;
g_icon_spacing_y = 140;
g_dmax = 8;
g_debris_ndx_fg = 0;
g_debris_ndx_bg = 0;
g_obj_start_ndx = 0;
g_obj_ndx = g_obj_start_ndx;
g_freed = new Array();
g_debris_fg = new Array(g_dmax);
g_debris_bg = new Array(g_dmax);
g_enemyDead = 0;
g_arrowDead = 0;
g_bloodDead = 0;
g_maxOnScreen = 7;
g_curOnScreen = 0;
g_eneNdx = -1;
g_eneLvlMax = 50;
g_arrowLevels = new Array(20);
g_enemyLevels = new Array(g_eneLvlMax);
initializeClipLevels();
g_test_lastOut = 0;
g_enelvl = -1;
g_fps = 0;
g_max_height = g_ground;
g_max_width = g_width;
g_arrowLevel = -1;
g_bloodNdx = 0;
g_bloodMax = 20;
g_debris_bloods = new Array(100);
g_fireNdx = 0;
g_fireMax = 10;
g_debris_fires = new Array(g_fireMax);
g_bloodSpread = 100;
g_bloodSplats = 1;
setDiffEasy();
g_armyLeft = 0;
g_obsMax_x = 0;
g_obsMax_y = 0;
g_obsMin_x = g_width;
g_obsMin_y = g_ground;
g_landMineNdx = 0;
g_oilNdx = 0;
g_homepositions = new Array();
g_treepositions = new Array();
g_obsNdx = 0;
g_popsLevel = -1;
g_explosionsLevel = -1;
g_speedFactor = 0.1;
g_numFlyingOnScreen = 0;
g_numCatapultsOnScreen = 0;
g_numBossesOnScreen = 0;
g_testCount = 0;
cost_range = 150;
cost_multi = 200;
cost_archer = 200;
cost_catapult = 1000;
cost_bomb_arrow = 200;
cost_flak_arrow = 200;
cost_land_mine_arrow = 500;
cost_oil_arrow = 600;
cost_fire_arrow = 400;
cost_ice_arrow = 300;
cost_pierce_arrow = 220;
cost_blast_range = 500;
cost_blast_power = 200;
cost_arrow_dmg = 200;
cost_bow_loading = 120;
cost_archer_cooldown = 150;
cost_catapult_cooldown = 105;
cost_fire_dot = 300;
g_maxbowpwr_max = 1600;
g_multi_num_max = 3;
g_fire_num_max = 1;
g_ice_num_max = 1;
g_bomb_num_max = 1;
g_flak_num_max = 1;
g_mine_num_max = 5;
g_oil_num_max = 1;
g_catapult_num_max = 2;
g_archer_num_max = 4;
g_piercer_num_max = 2;
g_arrow_dmg_max = 200;
g_blast_range_max = 500;
g_blast_power_max = 500;
g_catapult_cooldown_max = 10;
g_archer_cooldown_max = 6;
g_bow_loading_max = 0.4;
g_fire_dot_max = 50;
g_maxbowpwr_inc = 20;
g_arrow_dmg_inc = 5;
g_blast_range_inc = 50;
g_blast_power_inc = 10;
g_catapult_cooldown_inc = 3;
g_archer_cooldown_inc = 3;
g_bow_loading_inc = 0.1;
g_fire_dot_inc = 10;
g_maxbowpwr_amount = 1;
g_arrow_dmg_amount = 1;
g_blast_range_amount = 1;
g_blast_power_amount = 1;
g_catapult_cooldown_amount = 1;
g_archer_cooldown_amount = 1;
g_bow_loading_amount = 1;
g_fire_dot_amount = 1;
g_placeTowerCount = 0;
g_groundHeight = 0;
g_terrainNdx = -1;
g_backgrounds = new Array("bg_1", "bg_2", "bg_3", "bg_4");
g_terrainLevel = 0;
_root.plee._x = g_width / 2;
_root.plee._y = g_ground / 2;
Instance of Symbol 608 MovieClip "ground" in Frame 2
onClipEvent (load) {
this.unloadMovie();
}
Instance of Symbol 555 MovieClip [war_flag] "reinforcements" in Frame 2
/* no clip actions */
Instance of Symbol 624 MovieClip "string" in Frame 2
onClipEvent (load) {
time = 0;
}
onClipEvent (enterFrame) {
if (!_root.pause) {
if (!_root.holding) {
time = time + _root.elapsed;
}
if ((time > _root.g_bow_cooldown) && (!_root.holding)) {
_x = _root.bow.spotX;
_y = _root.bow.spotY;
_root.holding = true;
time = 0;
_alpha = 100;
}
}
}
Instance of Symbol 636 MovieClip "bow" in Frame 2
onClipEvent (load) {
radians = 0;
spotX = 0;
spotY = 0;
width = 45;
dx = 0;
dy = 0;
}
onClipEvent (enterFrame) {
_x = _root.tower._x;
_y = _root.tower._y;
dx = _root.string._x - _root.bow._x;
dy = _root.string._y - _root.bow._y;
radians = Math.atan(dy / dx);
if (dx > 0) {
_rotation = (((radians * 180) / Math.PI) + 180);
spotX = _x - (Math.cos(radians + Math.PI) * width);
spotY = _y - (Math.sin(radians + Math.PI) * width);
} else {
_rotation = ((radians * 180) / Math.PI);
spotX = _x - (Math.cos(radians) * width);
spotY = _y - (Math.sin(radians) * width);
}
}
Instance of Symbol 639 MovieClip "fps" in Frame 2
onClipEvent (load) {
current = (prev = getTimer());
_root.elapsed = 0;
}
onClipEvent (enterFrame) {
current = getTimer();
_root.elapsed = (current - prev) / 1000;
prev = current;
}
Instance of Symbol 641 MovieClip in Frame 2
onClipEvent (load) {
fps_time = 1;
frames = 0;
_root.pause = true;
_root.checkEndGame();
}
onClipEvent (enterFrame) {
if (fps_time < 0.5) {
fps_time = fps_time + _root.elapsed;
frames++;
} else {
_root.g_fps = frames * 2;
fps_time = 0;
frames = 0;
}
_root.checkEndGame();
if (!_root.pause) {
if ((_root.g_curOnScreen <= _root.g_maxOnScreen) && (_root.g_armyList.length > 0)) {
_root.reinforceTheArmy();
}
_root.stepArrows();
_root.stepEnemies();
_root.stepBloods();
_root.testHit();
_root.cleanUp();
}
if (_root.g_startNew) {
_root.initObstructs();
_root.loadArchers();
_root.loadCatapults();
_root.holding = false;
_root.g_startNew = false;
}
updateAfterEvent();
}
Instance of Symbol 651 MovieClip "pause_sign" in Frame 2
onClipEvent (enterFrame) {
if (_root.pause) {
_x = (_root.g_width / 2);
_y = (_root.g_ground / 2);
} else {
_y = -100;
}
}
Instance of Symbol 628 MovieClip in Frame 2
onClipEvent (enterFrame) {
}
Instance of Symbol 671 MovieClip in Frame 2
on (release) {
_root.version_notes._x = _root.g_width / 2;
_root.version_notes._y = _root.g_ground / 2;
}
Instance of Symbol 674 MovieClip in Frame 2
on (release) {
getURL ("http://lostvectors.com/donate.html", "_self");
}
Instance of Symbol 684 MovieClip in Frame 2
on (release) {
getURL ("http://lostvectors.com", "_blank");
}
Instance of Symbol 690 MovieClip "key6" in Frame 2
onClipEvent (load) {
mode = "all";
_root.g_keys[5] = this;
this.attachMovie("all_moder", "mode_1", 1);
}
on (press) {
_root.g_mode = mode;
}
Instance of Symbol 692 MovieClip "key1" in Frame 2
onClipEvent (load) {
mode = "normal";
_root.g_keys[0] = this;
this.attachMovie("normal_moder", "mode_1", 1);
}
on (press) {
_root.g_mode = mode;
}
Instance of Symbol 694 MovieClip "key2" in Frame 2
onClipEvent (load) {
mode = "normal";
_root.g_keys[1] = this;
this.attachMovie("normal_moder", "mode_1", 1);
}
on (press) {
_root.g_mode = mode;
}
Instance of Symbol 696 MovieClip "key3" in Frame 2
onClipEvent (load) {
mode = "normal";
_root.g_keys[2] = this;
this.attachMovie("normal_moder", "mode_1", 1);
}
on (press) {
_root.g_mode = mode;
}
Instance of Symbol 698 MovieClip "key4" in Frame 2
onClipEvent (load) {
mode = "normal";
_root.g_keys[3] = this;
this.attachMovie("normal_moder", "mode_1", 1);
}
on (press) {
_root.g_mode = mode;
}
Instance of Symbol 700 MovieClip "key5" in Frame 2
onClipEvent (load) {
mode = "normal";
_root.g_keys[4] = this;
this.attachMovie("normal_moder", "mode_1", 1);
}
on (press) {
_root.g_mode = mode;
}
Instance of Symbol 701 MovieClip "fire_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
if (_root.g_fire_num > 0) {
_x = ((5 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = (_root.tower._y + _root.g_icon_spacing_y);
} else {
_x = -100;
}
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "fire";
}
on (release) {
stopDrag();
_root.setKey("fire", "fire_icon");
dragging = false;
}
Instance of Symbol 702 MovieClip "ice_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
if (_root.g_ice_num > 0) {
_x = ((4 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = (_root.tower._y + _root.g_icon_spacing_y);
} else {
_x = -100;
}
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "ice";
}
on (release) {
stopDrag();
_root.setKey("ice", "ice_icon");
dragging = false;
}
Instance of Symbol 554 MovieClip [bomb_moder] "bomb_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
if (_root.g_bomb_num > 0) {
_x = ((3 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = (_root.tower._y + _root.g_icon_spacing_y);
} else {
_x = -100;
}
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "bomb";
}
on (release) {
stopDrag();
_root.setKey("bomb", "bomb_moder");
dragging = false;
}
Instance of Symbol 553 MovieClip [pierce_moder] "pierce_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
if (_root.g_piercer_num > 0) {
_x = ((2 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = (_root.tower._y + _root.g_icon_spacing_y);
} else {
_x = -100;
}
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "pierce";
}
on (release) {
stopDrag();
_root.setKey("pierce", "pierce_moder");
dragging = false;
}
Instance of Symbol 552 MovieClip [normal_moder] "normal_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
if (_root.g_multi_num > 0) {
_x = ((1 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = (_root.tower._y + _root.g_icon_spacing_y);
} else {
_x = -100;
}
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "normal";
}
on (release) {
stopDrag();
_root.setKey("normal", "normal_moder");
dragging = false;
}
Instance of Symbol 551 MovieClip [all_moder] "all_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
_x = ((6 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = (_root.tower._y + _root.g_icon_spacing_y);
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "all";
}
on (release) {
stopDrag();
_root.setKey("all", "all_moder");
dragging = false;
}
Instance of Symbol 550 MovieClip [flak_moder] "flak_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
if (_root.g_flak_num > 0) {
_x = ((1 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = ((_root.tower._y + _root.g_icon_spacing_y) + 50);
} else {
_x = -100;
}
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "flak";
}
on (release) {
stopDrag();
_root.setKey("flak", "flak_moder");
dragging = false;
}
Instance of Symbol 549 MovieClip [moder_mine] "proximity_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
if (_root.g_mine_num > 0) {
_x = ((2 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = ((_root.tower._y + _root.g_icon_spacing_y) + 50);
} else {
_x = -100;
}
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "proximity";
}
on (release) {
stopDrag();
_root.setKey("proximity", "moder_mine");
dragging = false;
}
Instance of Symbol 548 MovieClip [moder_oil] "oil_b" in Frame 2
onClipEvent (enterFrame) {
if (!dragging) {
if (_root.g_oil_num > 0) {
_x = ((3 * _root.g_icon_spacing) + _root.g_icon_offset);
_y = ((_root.tower._y + _root.g_icon_spacing_y) + 50);
} else {
_x = -100;
}
}
}
on (press) {
startDrag (this);
dragging = true;
_root.g_mode = "oil";
}
on (release) {
stopDrag();
_root.setKey("oil", "moder_oil");
dragging = false;
}
Instance of Symbol 704 MovieClip in Frame 2
onClipEvent (enterFrame) {
if (_root.g_mode == "all") {
_x = _root.all_b._x;
_y = _root.all_b._y;
} else if (_root.g_mode == "normal") {
_x = _root.normal_b._x;
_y = _root.normal_b._y;
} else if (_root.g_mode == "fire") {
_x = _root.fire_b._x;
_y = _root.fire_b._y;
} else if (_root.g_mode == "ice") {
_x = _root.ice_b._x;
_y = _root.ice_b._y;
} else if (_root.g_mode == "pierce") {
_x = _root.pierce_b._x;
_y = _root.pierce_b._y;
} else if (_root.g_mode == "bomb") {
_x = _root.bomb_b._x;
_y = _root.bomb_b._y;
} else if (_root.g_mode == "flak") {
_x = _root.flak_b._x;
_y = _root.flak_b._y;
} else if (_root.g_mode == "proximity") {
_x = _root.proximity_b._x;
_y = _root.proximity_b._y;
} else if (_root.g_mode == "oil") {
_x = _root.oil_b._x;
_y = _root.oil_b._y;
}
}
Instance of Symbol 585 MovieClip "archer_spot" in Frame 2
onClipEvent (load) {
_alpha = 0;
}
Instance of Symbol 585 MovieClip "catapult_spot" in Frame 2
onClipEvent (load) {
_alpha = 0;
}
Instance of Symbol 718 MovieClip "game_over" in Frame 2
onClipEvent (enterFrame) {
if (_root.g_game_over) {
_x = (_root.g_width / 2);
_y = (_root.g_ground / 2);
} else {
_y = (_root.g_ground + _height);
}
}
Instance of Symbol 790 MovieClip "moon_message" in Frame 2
onClipEvent (load) {
seen = false;
_x = 9999;
}
onClipEvent (enterFrame) {
if ((_root.pause && (_root.g_currentLevel == 100)) && (!seen)) {
_x = (_root.g_width / 2);
_y = (_root.g_ground / 2);
} else {
_x = 9999;
}
}
Instance of Symbol 885 MovieClip in Frame 2
onClipEvent (load) {
_y = (_root.g_ground / 2);
_x = (_root.g_width / 2);
}
onClipEvent (enterFrame) {
if (getTimer() > _root.g_menuDelay) {
this.unloadMovie();
}
}
Symbol 43 MovieClip [ground28] Frame 1
_root.gravY = 166.666666666667;
Instance of Symbol 26 MovieClip in Symbol 43 MovieClip [ground28] Frame 1
onClipEvent (load) {
signx = 1;
signy = 1;
if (random(2) == 1) {
signx = -1;
}
if (random(2) == 1) {
signy = -1;
}
xprev = _x;
yprev = _y;
vx = random(200) * signx;
vy = random(200) * signy;
}
onClipEvent (enterFrame) {
xprev = _x;
yprev = _y;
_x = (_x + (vx * _root.elapsed));
_y = (_y + (vy * _root.elapsed));
_rotation = (_rotation + 1);
if ((_x > 1000) || (_x < -1000)) {
vx = vx * -1;
_x = prevx;
_y = prevy;
}
if ((_y < -1000) || (_y > 1000)) {
vy = vy * -1;
_x = prevx;
_y = prevy;
}
}
Instance of Symbol 28 MovieClip in Symbol 43 MovieClip [ground28] Frame 1
onClipEvent (load) {
signx = 1;
signy = 1;
if (random(2) == 1) {
signx = -1;
}
if (random(2) == 1) {
signy = -1;
}
xprev = _x;
yprev = _y;
vx = random(200) * signx;
vy = random(200) * signy;
}
onClipEvent (enterFrame) {
xprev = _x;
yprev = _y;
_x = (_x + (vx * _root.elapsed));
_y = (_y + (vy * _root.elapsed));
_rotation = (_rotation + 1);
if ((_x > 1000) || (_x < -1000)) {
vx = vx * -1;
_x = prevx;
_y = prevy;
}
if ((_y < -1000) || (_y > 100)) {
vy = vy * -1;
_x = prevx;
_y = prevy;
}
}
Instance of Symbol 28 MovieClip in Symbol 43 MovieClip [ground28] Frame 1
onClipEvent (load) {
signx = 1;
signy = 1;
if (random(2) == 1) {
signx = -1;
}
if (random(2) == 1) {
signy = -1;
}
xprev = _x;
yprev = _y;
vx = random(200) * signx;
vy = random(200) * signy;
}
onClipEvent (enterFrame) {
xprev = _x;
yprev = _y;
_x = (_x + (vx * _root.elapsed));
_y = (_y + (vy * _root.elapsed));
_rotation = (_rotation + 1);
if ((_x > 1000) || (_x < -1000)) {
vx = vx * -1;
_x = prevx;
_y = prevy;
}
if ((_y < -1000) || (_y > 1000)) {
vy = vy * -1;
_x = prevx;
_y = prevy;
}
}
Instance of Symbol 63 MovieClip in Symbol 64 MovieClip [fire] Frame 1
onClipEvent (load) {
this.dead = false;
timeLeft = 0;
frequency = 0.1;
lifeSpan = 22;
burnTimeHit = 0;
fireKill = Math.floor(_root.g_currentLevel / 5) + 1;
bonus = fireKill;
}
onClipEvent (enterFrame) {
if (((!_root.pause) && (!this.dead)) && (timeLeft <= 0)) {
timeLeft = frequency;
oilDrop = _root.g_debris_bloods[random(_root.g_bloodMax)];
enemy = _root.g_enemies[random(_root.g_enemies.length)];
obstruct = _root.g_obstructs[random(_root.g_obstructs.length)];
if (((oilDrop != null) && (oilDrop.dType == "oil_drop")) && (oilDrop.hitTest(_parent))) {
trace("DEAD OIL --------------------------------<<<<<<<<<<<<<<");
oilDrop.dType = "dead_oil";
oilDrop._alpha = 0;
_root.addFlyingDebris("fire", oilDrop._x, oilDrop._y, 300, _root.g_fireSplats);
} else if (enemy.hitTest(_parent) && (enemy.eType != "boss")) {
factor = 1;
if (enemy.eType == "enemy_catapult") {
factor = 20;
}
enemy.hp = enemy.hp - ((frequency * _root.g_fire_dot) * factor);
} else if ((!obstruct.dead) && (obstruct.hitTest(_parent))) {
burnTimeHit++;
trace("obstruct.household = " + obstruct.household);
if ((((obstruct.oType == "house") && (obstruct.household > 0)) && ((burnTimeHit % 5) == 0)) && (burnTimeHit < 25)) {
_root.killPopulationNum(bonus, _parent._x - 50, _parent._y);
obstruct.household = obstruct.household - bonus;
if (obstruct.household <= 0) {
obstruct.gotoAndPlay(2);
}
trace("household left: " + obstruct.household);
bonus = bonus + Math.ceil(fireKill / 5);
}
trace("Burning: " + burnTimeHit);
if (burnTimeHit > 20) {
_root.addFlyingDebris("fire", obstruct._x, obstruct._y, 300, _root.g_fireSplats);
obstruct.dead = true;
obstruct.gotoAndPlay(2);
}
}
} else if (((!_root.pause) && (!dead)) && (timeLeft > 0)) {
timeLeft = timeLeft - _root.elapsed;
}
lifeSpan = lifeSpan - _root.elapsed;
if (lifeSpan < 0) {
dead = true;
_parent.unloadMovie();
}
}
Symbol 66 MovieClip Frame 69
stop();
Symbol 67 MovieClip [tree] Frame 1
dead = false;
stop();
Symbol 67 MovieClip [tree] Frame 2
stop();
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(20));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Instance of Symbol 76 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(random(100));
}
Symbol 148 MovieClip [dragon_archer] Frame 1
function step() {
var _local1 = _root;
_x = (_x + (vx * _local1.elapsed));
_y = ((Math.sin(_x / 100) * 50) + fhight);
if ((getTimer() > timeToShoot) && (_x < (_local1.g_width * 0.66))) {
timeToShoot = getTimer() + 7000;
en_arrow_vx = (-1000 - random(200)) * 0.5;
en_arrow_vy = (200 - random(100)) * 0.5;
_local1.addGeneric(_x - (_width / 2), _y, en_arrow_vx, en_arrow_vy, 1, false, 0, 0, false, false, false, "fire_arrow");
_local1.addGeneric(_x - (_width / 2), _y, en_arrow_vx + 10, en_arrow_vy + 10, 1, false, 0, 0, false, false, false, "oil_arrow");
}
}
function setInXY(x, y) {
inx = x;
iny = y;
}
stop();
Symbol 148 MovieClip [dragon_archer] Frame 135
stop();
this.unloadMovie();
Symbol 148 MovieClip [dragon_archer] Frame 171
stop();
this.unloadMovie();
Symbol 151 MovieClip [flying_enemy] Frame 1
function step() {
_x = (_x + (vx * _root.elapsed));
_y = ((Math.sin(_x / 100) * 50) + fhight);
}
function setInXY(x, y) {
inx = x;
iny = y;
}
stop();
Symbol 151 MovieClip [flying_enemy] Frame 135
stop();
this.unloadMovie();
Symbol 151 MovieClip [flying_enemy] Frame 171
stop();
this.unloadMovie();
Symbol 157 MovieClip [flying_enemy2] Frame 1
function step() {
_x = (_x + (vx * _root.elapsed));
_y = ((Math.sin(_x / 100) * 50) + fhight);
}
function setInXY(x, y) {
inx = x;
iny = y;
}
stop();
stop();
Symbol 157 MovieClip [flying_enemy2] Frame 100
play();
Symbol 157 MovieClip [flying_enemy2] Frame 135
stop();
this.unloadMovie();
Symbol 173 MovieClip Frame 1
stop();
Symbol 176 MovieClip [ogre3] Frame 1
function step() {
_x = (_x + (vx * _root.elapsed));
_y = (_y + (vy * _root.elapsed));
}
stop();
Symbol 176 MovieClip [ogre3] Frame 100
play();
Symbol 176 MovieClip [ogre3] Frame 135
stop();
this.unloadMovie();
Symbol 189 MovieClip Frame 1
stop();
Symbol 189 MovieClip Frame 100
stop();
gotoAndPlay (1);
Symbol 189 MovieClip Frame 121
_parent.walking = true;
trace("start walking again");
Symbol 190 MovieClip [boss] Frame 1
function step() {
var _local1 = _root;
displacement = displacement + Math.abs(vx * _local1.elapsed);
_x = (_x + (vx * _local1.elapsed));
_y = (_y + (vy * _local1.elapsed));
if (walking) {
body.gotoAndStop(Math.ceil((displacement * 0.4) % 99));
}
if (getTimer() > timeToShoot) {
walking = false;
trace("stop walking");
fireballcount++;
if (((count++) % ballsPerLevel) == 0) {
fireTime = 20000;
} else {
fireTime = 1500;
}
timeToShoot = getTimer() + fireTime;
en_arrow_vx = ((-400 - random(200)) * 0.5) - (_local1.g_currentLevel * 2);
en_arrow_vy = ((-600 - random(200)) * 0.5) - (_local1.g_currentLevel * 2);
if (en_arrow_vx < -800) {
en_arrow_vx = -800;
}
if (en_arrow_vy < -1200) {
en_arrow_vx = -1200;
}
_local1.addGeneric(_x - (_width / 2), _y - _height, en_arrow_vx, en_arrow_vy, 1, true, 100, 1, false, false, true, "boss_ball");
body.gotoAndPlay("shoot");
}
}
stop();
count = 0;
fireTime = 500;
displacement = 0;
walking = true;
fireballcount = 0;
ballsPerLevel = Math.floor(_root.g_currentLevel / 10);
Symbol 190 MovieClip [boss] Frame 100
i = 0;
while (i < 10) {
_root.addGeneric(_x - (_width / 2), _y - _height, random(400) - 200, (-random(600)) - 100, 1, true, 500, 500, false, false, true, "boss_ball");
i++;
}
Instance of Symbol 189 MovieClip in Symbol 190 MovieClip [boss] Frame 100
/* no clip actions */
Symbol 190 MovieClip [boss] Frame 135
stop();
this.unloadMovie();
Symbol 190 MovieClip [boss] Frame 175
stop();
this.unloadMovie();
Symbol 193 MovieClip [ogre] Frame 1
function step() {
_x = (_x + (vx * _root.elapsed));
_y = (_y + (vy * _root.elapsed));
}
stop();
Symbol 193 MovieClip [ogre] Frame 135
stop();
this.unloadMovie();
Symbol 193 MovieClip [ogre] Frame 175
stop();
this.unloadMovie();
Symbol 198 MovieClip [enemy_archer] Frame 1
function step() {
var _local1 = _root;
_x = (_x + (vx * _local1.elapsed));
_y = (_y + (vy * _local1.elapsed));
if ((getTimer() > timeToShoot) && (_x < (_local1.g_width * 0.66))) {
timeToShoot = getTimer() + 7000;
en_arrow_vx = ((-800 - random(200)) - envx) * 0.5;
en_arrow_vy = ((-1200 - random(200)) - envy) * 0.5;
_local1.addGeneric(_x - (_width / 2), _y - _height, en_arrow_vx, en_arrow_vy, _local1.g_enemyArrowCount, false, 0, 0, false, false, false, "fire_arrow");
if (en_arrow_vx < -1000) {
en_arrow_vx = -1000;
}
if (en_arrow_vy < -1200) {
en_arrow_vx = -1200;
}
envx = envx + 40;
envy = envy + 60;
if (vx < 0) {
speed = vx;
vx = 0;
} else {
vx = speed;
}
}
}
stop();
Symbol 198 MovieClip [enemy_archer] Frame 135
stop();
this.unloadMovie();
Symbol 198 MovieClip [enemy_archer] Frame 170
stop();
this.unloadMovie();
Symbol 209 MovieClip Frame 1
stop();
Symbol 209 MovieClip Frame 25
stop();
Instance of Symbol 210 MovieClip in Symbol 211 MovieClip [smoker] Frame 1
onClipEvent (load) {
lvl = 0;
time = 3;
}
onClipEvent (enterFrame) {
}
Symbol 212 MovieClip [enemy_catapult] Frame 1
function step() {
var _local1 = _root;
_x = (_x + (vx * _local1.elapsed));
_y = (_y + (vy * _local1.elapsed));
if ((getTimer() > timeToShoot) && (_x < (_local1.g_width * 0.66))) {
timeToShoot = getTimer() + 15000;
en_arrow_vx = ((-800 - random(200)) - envx) * 0.5;
en_arrow_vy = ((-1200 - random(200)) - envy) * 0.5;
if (en_arrow_vx < -1200) {
en_arrow_vx = -1200;
}
if (en_arrow_vy < -1800) {
en_arrow_vx = -1800;
}
envx = envx + 40;
envy = envy + 60;
_local1.addGeneric(_x - (_width / 2), _y - _height, en_arrow_vx, en_arrow_vy, 1, true, 100, 1, false, false, true, "cat_ammo1");
if (vx < 0) {
speed = vx;
vx = 0;
} else {
vx = speed;
}
}
}
stop();
Symbol 212 MovieClip [enemy_catapult] Frame 135
stop();
this.unloadMovie();
Symbol 212 MovieClip [enemy_catapult] Frame 170
stop();
this.unloadMovie();
Symbol 213 MovieClip [enemy] Frame 1
function step() {
_x = (_x + (vx * _root.elapsed));
_y = (_y + (vy * _root.elapsed));
}
stop();
Symbol 213 MovieClip [enemy] Frame 135
stop();
this.unloadMovie();
Symbol 213 MovieClip [enemy] Frame 170
stop();
this.unloadMovie();
Symbol 216 MovieClip [enemy2] Frame 1
function step() {
_x = (_x + (vx * _root.elapsed));
_y = (_y + (vy * _root.elapsed));
}
stop();
Symbol 216 MovieClip [enemy2] Frame 100
play();
Symbol 216 MovieClip [enemy2] Frame 135
stop();
this.unloadMovie();
Symbol 222 MovieClip Frame 70
stop();
Symbol 223 MovieClip [tree2] Frame 1
stop();
Symbol 223 MovieClip [tree2] Frame 2
stop();
Symbol 228 MovieClip [oil_drop] Frame 1
stop();
Instance of Symbol 226 MovieClip in Symbol 228 MovieClip [oil_drop] Frame 1
onClipEvent (load) {
dead = false;
}
onClipEvent (enterFrame) {
if ((!_root.pause) && (!dead)) {
ndx = random(_root.g_enemies.length);
enemy = _root.g_enemies[ndx];
if (enemy.sick && (enemy.hitTest(_parent))) {
dead = true;
alpha = 0;
_root.addFlyingDebris("fire", _parent._x, _parent._y, 300);
}
}
}
Symbol 228 MovieClip [oil_drop] Frame 45
stop();
Symbol 232 MovieClip [blood] Frame 1
stop();
Symbol 232 MovieClip [blood] Frame 45
stop();
Symbol 237 MovieClip [critical_hit] Frame 40
this.unloadMovie();
Instance of Symbol 209 MovieClip in Symbol 238 MovieClip [catapult] Frame 1
onClipEvent (enterFrame) {
if (_root.g_catapult_num > 2) {
_alpha = 100;
} else {
_alpha = 0;
}
}
Instance of Symbol 209 MovieClip in Symbol 238 MovieClip [catapult] Frame 1
onClipEvent (enterFrame) {
if (_root.g_catapult_num > 1) {
_alpha = 100;
} else {
_alpha = 0;
}
}
Instance of Symbol 209 MovieClip in Symbol 238 MovieClip [catapult] Frame 1
onClipEvent (load) {
time = 0;
}
onClipEvent (enterFrame) {
if (!_root.pause) {
time = time + _root.elapsed;
_root.g_catTimeElapsed = time;
}
if (time > _root.g_catapult_cooldown) {
if (_root.g_fireCatapultNow || (_root.g_catFireAuto)) {
dx = _root.c_aimer._x - _parent._x;
dy = _root.c_aimer._y - _parent._y;
i = 0;
while (i < _root.g_catapult_num) {
_root.shootGeneric(_parent._x - (35 * i), _parent._y, dx, dy, 50, true, 300, 300, true, true, true, 50, 50, "cat_ammo1");
i++;
}
_root.playSound("firecat3.wav");
time = 0;
}
}
_root.g_fireCatapultNow = false;
}
Instance of Symbol 241 MovieClip in Symbol 242 MovieClip [archer] Frame 1
onClipEvent (load) {
time = 0;
id = "fire_arrow";
}
onClipEvent (enterFrame) {
if (!_root.pause) {
time = time + _root.elapsed;
}
if (time > _root.g_archer_cooldown) {
dx = _root.aimer._x - _parent._x;
dy = _root.aimer._y - _parent._y;
_root.shootGeneric(_parent._x, _parent._y, dx, dy, _root.g_arrow_dmg, false, 0, 0, false, false, false, 100, 100, id);
time = 0;
}
}
Symbol 245 MovieClip [tracer_cat_ammo1] Frame 23
stop();
Symbol 251 MovieClip [hp_damage] Frame 65
this.unloadMovie();
Symbol 257 MovieClip [pop_killed] Frame 65
this.unloadMovie();
Symbol 263 MovieClip [xp_bonus] Frame 65
this.unloadMovie();
Symbol 265 Button [moder_oil]
on (release) {
_root.buy("oil_arrow");
}
on (rollOver) {
text = "Oil is highly flamable ::hint hint::";
}
Symbol 267 Button [moder_mine]
on (release) {
_root.buy("land_mine_arrow");
}
on (rollOver) {
text = "Proximity bombs will detonate when an enemy comes close to it.";
}
Symbol 269 Button [flak_moder]
on (release) {
_root.buy("flak_arrow");
}
on (rollOver) {
text = "Great against dragon scouts. Weak against all other units. Hit spacebar to detonate in air.";
}
Symbol 271 Button [all_moder]
on (release) {
_root.floorAmounts();
_root.buyAmount("bow_loading", _root.g_bow_loading_amount);
}
on (rollOver) {
text = "Allows you to fire more frequently (decreases your shooting cool down time)";
}
Symbol 273 Button [normal_moder]
on (release) {
_root.buy("multi_arrow");
}
on (rollOver) {
text = "Standard issue arrow - skill points are only awarded for basic arrow critical hits.";
}
Symbol 275 Button [pierce_moder]
on (release) {
_root.buy("pierce_arrow");
}
on (rollOver) {
text = "Passes through objects and enemies doing reduced damage. Extra damage to ogres.";
}
Symbol 277 Button [bomb_moder]
on (release) {
_root.buy("bomb_arrow");
}
on (rollOver) {
text = "Explodes on contact doing splash damage to nearby enemies. Extra damage to enemy archers.";
}
Symbol 283 Button
on (release) {
_root.floorAmounts();
_root.buyAmount("blast_range", _root.g_blast_range_amount);
}
on (rollOver) {
text = "Increases the blast radius of bomb arrows, but not flak bombs";
}
Symbol 284 Button
on (release) {
_root.floorAmounts();
_root.buyAmount("blast_power", _root.g_blast_power_amount);
}
on (rollOver) {
text = "Increases the amount of damage a bomb or flak bomb does within the blast radius";
}
Symbol 285 Button
on (release) {
_root.floorAmounts();
_root.buyAmount("arrow_dmg", _root.g_arrow_dmg_amount);
}
on (rollOver) {
text = "Increases the amount of impact damage done by all arrows";
}
Symbol 286 Button
on (release) {
_root.floorAmounts();
_root.buyAmount("catapult_loading", _root.g_catapult_cooldown_amount);
}
on (rollOver) {
text = "Makes your catapults shoot more frequently. (decreases the loading time)";
}
Symbol 287 Button
on (release) {
_root.floorAmounts();
_root.buyAmount("archer_loading", _root.g_archer_cooldown_amount);
}
on (rollOver) {
text = "Makes your archers shoot more frequently. (decreases the loading time)";
}
Symbol 294 Button
on (release) {
_root.floorAmounts();
_root.buyAmount("range_upgrade", _root.g_maxbowpwr_amount);
}
on (rollOver) {
text = "Increases the maximum range of your bow";
}
Symbol 302 Button
on (release) {
_root.displayLevelStats();
this.unloadMovie();
}
Symbol 322 Button
on (release) {
_root.buy("fire_arrow");
}
on (rollOver) {
text = "Sets enemies on fire. Impact damage is slightly reduced. Slightly increases enemy speed but causes damage over time. Extra damage to catapults. Bosses are immune to fire.";
}
Symbol 326 Button
on (release) {
_root.buy("archer");
}
on (rollOver) {
text = "Archer that fires every so often - it aims for the archer icon which you can move around. Archers fire basic arrows which award skill points.";
}
Symbol 328 Button
on (release) {
_root.buy("catapult");
}
on (rollOver) {
text = "Catapult that fires every so often. The rocks explode on contact and can pass through enemies and objects. It aims for the catapult icon which you can move around";
}
Symbol 330 Button
on (release) {
_root.buy("ice_arrow");
}
on (rollOver) {
text = "Slows enemies but does little impact damage except agains dragon archers. Massive damage to dragon archers. Bosses are immune to ice slowdown";
}
Symbol 348 Button
on (release) {
_root.floorAmounts();
_root.buyAmount("fire_dot", _root.g_fire_dot_amount);
}
on (rollOver) {
text = "Increases how much fire damage enemies take per second when on fire";
}
Symbol 371 Button
on (release) {
_root.buymax();
}
on (rollOver) {
text = "Buys one of everything until maxed or you run out of points to spend";
}
Symbol 379 Button
on (release) {
_root.skipToLevel();
}
Symbol 408 Button
on (release) {
_root.resetCosts();
_root.resetGameVars();
}
on (rollOver) {
text = "Allows you to respend all of your xp";
}
Symbol 421 MovieClip [upgrades] Frame 1
text = "";
Instance of Symbol 387 MovieClip in Symbol 421 MovieClip [upgrades] Frame 1
on (release) {
_root.buyMaxType("range_upgrade");
}
Instance of Symbol 387 MovieClip in Symbol 421 MovieClip [upgrades] Frame 1
on (release) {
_root.buyMaxType("blast_range");
}
Instance of Symbol 387 MovieClip in Symbol 421 MovieClip [upgrades] Frame 1
on (release) {
_root.buyMaxType("blast_power");
}
Instance of Symbol 387 MovieClip in Symbol 421 MovieClip [upgrades] Frame 1
on (release) {
_root.buyMaxType("arrow_dmg");
}
Instance of Symbol 387 MovieClip in Symbol 421 MovieClip [upgrades] Frame 1
on (release) {
_root.buyMaxType("archer_loading");
}
Instance of Symbol 387 MovieClip in Symbol 421 MovieClip [upgrades] Frame 1
on (release) {
_root.buyMaxType("catapult_loading");
}
Instance of Symbol 387 MovieClip in Symbol 421 MovieClip [upgrades] Frame 1
on (release) {
_root.buyMaxType("fire_dot");
}
Instance of Symbol 387 MovieClip in Symbol 421 MovieClip [upgrades] Frame 1
on (release) {
_root.buyMaxType("bow_loading");
}
Symbol 427 MovieClip [flak_animation] Frame 43
this.unloadMovie();
Symbol 429 MovieClip [bomb_animation] Frame 11
this.unloadMovie();
Symbol 432 MovieClip [house] Frame 1
stop();
Symbol 432 MovieClip [house] Frame 25
stop();
_root.killPopulationNum(household, _x, _y);
_root.g_noHouseLoss = false;
_root.g_houses_alive--;
Instance of Symbol 434 MovieClip in Symbol 435 MovieClip [smoke_animation] Frame 1
onClipEvent (load) {
time = 0;
smokeT = 0;
smokeF = 0.1;
}
onClipEvent (enterFrame) {
if (time > 15) {
this.unloadMovie();
}
if (smokeT > smokeF) {
smokeT = 0;
_alpha = (_alpha - 1);
}
_x = (_x + 0.05);
_y = (_y - 0.2);
_xscale = (_xscale * 1.003);
_yscale = (_yscale * 1.01);
time = time + _root.elapsed;
smokeT = smokeT + _root.elapsed;
}
Instance of Symbol 460 MovieClip in Symbol 461 MovieClip [ice_crystal] Frame 1
onClipEvent (load) {
dead = false;
}
onClipEvent (enterFrame) {
if ((!_root.pause) && (!dead)) {
fireNdx = random(_root.g_bloodMax);
fire = _root.g_debris_bloods[fireNdx];
if (((fire != null) && (fire.dType == "fire")) && (fire.hitTest(_parent))) {
trace("DEAD FIRE --------------------------------<<<<<<<<<<<<<<");
fire.dead = true;
fire.dType = "dead_fire";
_root.addFlyingDebris("ice_crystal", fire._x, fire._y, 200, 1);
dead = true;
fire._x = -100;
_alpha = 0;
}
}
}
Symbol 468 MovieClip [level_complete] Frame 158
this.unloadMovie();
Symbol 472 Button
on (keyPress "1") {
_root.setMode(0);
}
on (keyPress "q") {
if (_root.setMarker == "moveable") {
_root.setMarker = "locked";
} else {
_root.setMarker = "moveable";
}
}
on (keyPress "2") {
_root.setMode(1);
}
on (keyPress "3") {
_root.setMode(2);
}
on (keyPress "4") {
_root.setMode(3);
}
on (keyPress "5") {
_root.setMode(4);
}
on (keyPress "6") {
_root.setMode(5);
}
on (keyPress "<Space>") {
_root.detonateBomb();
}
Symbol 478 MovieClip [war_flag2] Frame 1
stop();
Symbol 482 MovieClip [dodge] Frame 55
this.unloadMovie();
Symbol 485 MovieClip [tracer_smoke] Frame 10
stop();
Symbol 516 Button
on (release) {
_y = -800;
}
Symbol 546 Button
on (release) {
_root.startNextLevel();
_x = 9999;
_y = 9999;
_root.g_playing = true;
}
Symbol 555 MovieClip [war_flag] Frame 1
stop();
Symbol 555 MovieClip [war_flag] Frame 35
stop();
Symbol 576 MovieClip Frame 1
function step() {
_alpha = (_alpha - 3);
if (_alpha <= 0) {
this.unloadMovie();
}
}
Instance of Symbol 575 MovieClip in Symbol 576 MovieClip Frame 1
onClipEvent (enterFrame) {
_parent.step();
}
Symbol 579 MovieClip Frame 100
this.unloadMovie();
Instance of Symbol 558 MovieClip in Symbol 582 MovieClip Frame 1
on (release) {
getURL ("http://www.lostvectors.com/", "_blank");
}
Instance of Symbol 568 MovieClip in Symbol 582 MovieClip Frame 1
onClipEvent (load) {
vx = 0;
gx = 0.2;
bounces = 0;
_alpha = 0;
}
onClipEvent (enterFrame) {
if (bounces < 5) {
if (_alpha < 100) {
_alpha = (_alpha + 2);
}
if (_x > 130) {
_x = 130;
bounces++;
vx = vx * -0.5;
}
vx = vx + gx;
_x = (_x + vx);
}
}
Instance of Symbol 581 MovieClip in Symbol 582 MovieClip Frame 124
onClipEvent (load) {
vx = 0;
gx = -0.2;
bounces = 0;
_alpha = 0;
}
onClipEvent (enterFrame) {
if (bounces < 5) {
if (_alpha < 100) {
_alpha = (_alpha + 2);
}
if (_x < 162) {
_x = 162;
bounces++;
vx = vx * -0.5;
}
vx = vx + gx;
_x = (_x + vx);
}
}
Instance of Symbol 584 MovieClip in Symbol 585 MovieClip Frame 1
onClipEvent (load) {
_alpha = 0;
}
Symbol 590 Button
on (release) {
if (_root.setMarker == "moveable") {
_root.setMarker = "locked";
} else {
_root.setMarker = "moveable";
}
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Click this button or hit Q to toggle catapult and archer aimers to moveable/locked.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 598 Button
on (release) {
_root.g_catFireAuto = !_root.g_catFireAuto;
}
Symbol 602 Button
on (release) {
_root.g_fireCatapultNow = true;
}
on (keyPress "c") {
_root.g_fireCatapultNow = true;
}
Instance of Symbol 594 MovieClip in Symbol 603 MovieClip Frame 1
onClipEvent (load) {
soundPlayed = false;
origx = _x;
}
onClipEvent (enterFrame) {
if (_root.g_catTimeElapsed < _root.g_catapult_cooldown) {
soundPlayed = false;
gotoAndStop (1);
percentDone = _root.g_catTimeElapsed / _root.g_catapult_cooldown;
_x = ((_width * percentDone) + origx);
} else if (!soundPlayed) {
if (!_root.g_catFireAuto) {
}
gotoAndStop (2);
soundPlayed = true;
}
}
Instance of Symbol 600 MovieClip in Symbol 603 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_root.g_catFireAuto) {
gotoAndStop (1);
} else {
gotoAndStop (2);
}
}
Instance of Symbol 603 MovieClip "cat_shooter" in Symbol 604 MovieClip Frame 1
onClipEvent (load) {
_alpha = 0;
}
Symbol 608 MovieClip Frame 1
function loadDynamicTerrain() {
loadMovie (loading_terrains[(_root.g_currentLevel - 1) % loading_terrains.length], lvlspot);
}
loading_terrains = new Array("levels/level11.swf");
Symbol 612 Button
on (press) {
if (_root.setMarker == "moveable") {
startDrag (this);
}
}
on (release) {
if (_root.setMarker == "moveable") {
stopDrag();
}
}
Symbol 617 Button
on (press) {
if (_root.setMarker == "moveable") {
startDrag (this);
}
}
on (release) {
if (_root.setMarker == "moveable") {
stopDrag();
}
}
Instance of Symbol 564 MovieClip in Symbol 622 MovieClip Frame 1
onClipEvent (enterFrame) {
_rotation = _root.bow._rotation;
}
Symbol 623 Button
on (press) {
startDrag (this);
_x = _root._xmouse;
_y = _root._ymouse;
_root.holding = true;
_root.showPower = true;
}
on (releaseOutside) {
stopDrag();
if (!_root.pause) {
_root.shoot();
_alpha = 0;
_x = (((_root._xmouse - _root.bow._x) * 200) + _root.bow._x);
_y = (((_root._ymouse - _root.bow._y) * 200) + _root.bow._y);
_root.holding = false;
dx = _root._xmouse - _root.bow._x;
dy = _root._ymouse - _root.bow._y;
radians = Math.atan(dy / dx);
if (dx > 0) {
rot = ((radians * 180) / Math.PI) + 180;
spotX = _x - (Math.cos(radians + Math.PI) * width);
spotY = _y - (Math.sin(radians + Math.PI) * width);
} else {
rot = (radians * 180) / Math.PI;
spotX = _x - (Math.cos(radians) * width);
spotY = _y - (Math.sin(radians) * width);
}
_root.last_spot._x = _root._xmouse;
_root.last_spot._y = _root._ymouse;
_root.last_spot._rotation = rot;
_root.last_angle._rotation = rot;
_root.last_angle._x = _root.bow._x;
_root.last_angle._y = _root.bow._y;
_root.showPower = false;
}
}
on (release) {
stopDrag();
if (!_root.pause) {
_root.shoot();
_alpha = 0;
_x = (((_root._xmouse - _root.bow._x) * 200) + _root.bow._x);
_y = (((_root._ymouse - _root.bow._y) * 200) + _root.bow._y);
_root.holding = false;
dx = _root._xmouse - _root.bow._x;
dy = _root._ymouse - _root.bow._y;
radians = Math.atan(dy / dx);
if (dx > 0) {
rot = ((radians * 180) / Math.PI) + 180;
spotX = _x - (Math.cos(radians + Math.PI) * width);
spotY = _y - (Math.sin(radians + Math.PI) * width);
} else {
rot = (radians * 180) / Math.PI;
spotX = _x - (Math.cos(radians) * width);
spotY = _y - (Math.sin(radians) * width);
}
_root.last_spot._x = _root._xmouse;
_root.last_spot._y = _root._ymouse;
_root.last_spot._rotation = rot;
_root.last_angle._rotation = rot;
_root.last_angle._x = _root.bow._x;
_root.last_angle._y = _root.bow._y;
_root.showPower = false;
}
}
Symbol 635 MovieClip Frame 1
stop();
Instance of Symbol 628 MovieClip in Symbol 636 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_root.showPower) {
dx = (-_root.bow.dx) * _root.g_boost;
dy = (-_root.bow.dy) * _root.g_boost;
radians = Math.atan(dy / dx);
power = Math.sqrt((dx * dx) + (dy * dy));
if ((exceed_max = power > _root.g_maxbowpwr)) {
power = _root.g_maxbowpwr;
}
_x = ((-power) / _root.g_boost);
frameNum = Math.floor((power / _root.g_maxbowpwr) * 100);
_parent.bow_bod.gotoAndStop(frameNum);
_parent.bow_bod._width = power / _root.g_boost;
} else {
_x = 0;
_parent.bow_bod.gotoAndStop(1);
}
}
Symbol 644 Button
on (release) {
if ((!g_game_over) && (g_playing)) {
pause = !pause;
}
}
on (keyPress "p") {
if ((!g_game_over) && (g_playing)) {
pause = !pause;
}
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Toggles pause on/off.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 649 Button
on (release) {
_root.displayHelp();
pause = true;
pause_sign._x = g_width / 2;
pause_sign._y = g_ground / 2;
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Displays the help screen which has a link to my tutorial.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 653 Button
on (release) {
getURL ("http://www.csc.calpoly.edu/~jreinsvo", "_blank");
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Contact me if have ideas for how to make the game better.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 658 Button
on (release) {
g_sound_on = !g_sound_on;
if (g_sound_on) {
g_soundText = "on";
} else {
g_soundText = "off";
}
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Toggles the sound on/off. Turn it off to improve performance. Default is on.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 661 Button
on (release) {
_root.g_random_tower = "on";
_root.placeTower();
_root.relocateForce();
if (_root.g_xp < 0) {
_root.g_xp = 0;
}
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Relocates the tower. Use this if the tower is blocked. Pressing this turns on 'random tower placement'. This can be turned off in the options menu.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 663 Button
on (release) {
_root.displayOptions();
pause = true;
pause_sign._x = g_width / 2;
pause_sign._y = g_ground / 2;
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Allows you to change such variables as 'max enemies on screen' and 'debris count'. Decrease values to improve performance.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 665 Button
on (release) {
_root.restartLevel();
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Restarts the level. Xp gained in this level will be lost.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 667 Button
on (release) {
getURL ("http://www.csc.calpoly.edu/~jreinsvo/bowmaster/help.html", "_blank");
}
on (rollOver) {
if (_root.pause) {
_root.warning_text_bg._x = _root.warning_text._x;
_root.warning_text_bg._y = _root.warning_text._y;
_root.g_warning_text = "Read my notes on how to become an ultimate BowMaster.";
}
}
on (rollOut) {
_root.warning_text_bg._y = -600;
_root.g_warning_text = "";
}
Symbol 690 MovieClip Frame 1
stop();
Symbol 692 MovieClip Frame 1
function setModeAs(mode) {
lvl = 1;
this.attachMovie(mode, "mode_" + lvl, lvl);
}
stop();
Symbol 694 MovieClip Frame 1
function setModeAs(mode) {
lvl = 1;
this.attachMovie(mode, "mode_" + lvl, lvl);
}
stop();
Symbol 696 MovieClip Frame 1
function setModeAs(mode) {
lvl = 1;
this.attachMovie(mode, "mode_" + lvl, lvl);
}
stop();
Symbol 698 MovieClip Frame 1
function setModeAs(mode) {
lvl = 1;
this.attachMovie(mode, "mode_" + lvl, lvl);
}
stop();
Symbol 700 MovieClip Frame 1
function setModeAs(mode) {
lvl = 1;
this.attachMovie(mode, "mode_" + lvl, lvl);
}
stop();
Symbol 716 Button
on (release) {
_root.restartGame();
}
Symbol 717 Button
on (release) {
_root.restartLevel();
}
Symbol 727 Button
on (release) {
_root.g_xp = 0;
}
Symbol 731 Button
on (press) {
if (_root.g_maxOnScreen >= 6) {
_root.g_maxOnScreen = _root.g_maxOnScreen - 1;
}
}
Symbol 732 Button
on (press) {
if (_root.g_maxOnScreen <= 29) {
_root.g_maxOnScreen = _root.g_maxOnScreen + 1;
}
}
Symbol 735 Button
on (press) {
if (_root.g_bloodMax >= 6) {
_root.g_bloodMax = _root.g_bloodMax - 1;
}
if (_root.g_bloodSplats > _root.g_bloodMax) {
_root.g_bloodSplats = _root.g_bloodMax;
}
if (_root.g_fireSplats > _root.g_bloodMax) {
_root.g_fireSplats = _root.g_bloodMax;
}
if (_root.g_oilAmmount > _root.g_bloodMax) {
_root.g_oilAmmount = _root.g_bloodMax;
}
}
Symbol 736 Button
on (press) {
if (_root.g_bloodMax <= 99) {
_root.g_bloodMax = _root.g_bloodMax + 1;
}
}
Symbol 739 Button
on (release) {
_y = -800;
}
Symbol 742 Button
on (press) {
if (_root.g_treeMax >= 3) {
_root.g_treeMax = _root.g_treeMax - 1;
}
}
Symbol 743 Button
on (press) {
if (_root.g_treeMax <= 49) {
_root.g_treeMax = _root.g_treeMax + 1;
}
}
Symbol 746 Button
on (press) {
if (_root.g_bloodSplats >= 1) {
_root.g_bloodSplats = _root.g_bloodSplats - 1;
}
}
Symbol 747 Button
on (press) {
if ((_root.g_bloodSplats <= 49) && (_root.g_bloodSplats < _root.g_bloodMax)) {
_root.g_bloodSplats = _root.g_bloodSplats + 1;
}
}
Symbol 750 Button
on (press) {
if (_root.g_oilAmount >= 1) {
_root.g_oilAmount = _root.g_oilAmount - 1;
}
}
Symbol 751 Button
on (press) {
if ((_root.g_oilAmount <= 49) && (_root.g_oilAmount < _root.g_bloodMax)) {
_root.g_oilAmount = _root.g_oilAmount + 1;
}
}
Symbol 754 Button
on (press) {
if (_root.g_fireSplats >= 2) {
_root.g_fireSplats = _root.g_fireSplats - 1;
}
}
Symbol 755 Button
on (press) {
if ((_root.g_fireSplats <= 49) && (_root.g_fireSplats < _root.g_bloodMax)) {
_root.g_fireSplats = _root.g_fireSplats + 1;
}
}
Symbol 758 Button
on (press) {
if (_root.g_bloodSpread >= 110) {
_root.g_bloodSpread = _root.g_bloodSpread - 10;
}
}
Symbol 759 Button
on (press) {
if (_root.g_bloodSpread <= 1000) {
_root.g_bloodSpread = _root.g_bloodSpread + 10;
}
}
Symbol 762 Button
on (release) {
if (_root.g_random_tower == "on") {
_root.g_random_tower = "off";
} else {
_root.g_random_tower = "on";
}
}
Symbol 765 Button
on (release) {
_root.g_xp = 0;
_root.g_total_xp = 0;
_root.saveData();
}
Symbol 770 Button
on (release) {
_root.decreaseDifficulty();
}
Symbol 771 Button
on (release) {
_root.increaseDifficulty();
}
Symbol 776 Button
on (release) {
_root.version_notes._y = -1000;
}
Symbol 789 Button
on (release) {
seen = true;
_x = -1000;
}
Instance of Symbol 684 MovieClip in Symbol 790 MovieClip Frame 1
on (release) {
getURL ("http://lostvectors.com/moon/", "_blank");
}
Symbol 817 Button
on (release) {
_x = 9999;
_y = 9999;
}
Instance of Symbol 558 MovieClip in Symbol 875 MovieClip Frame 1
on (release) {
getURL ("http://www.lostvectors.com/", "_blank");
}
Symbol 877 Button
on (release) {
_x = -1000;
}