Frame 1
stop();
totalBytes = getBytesTotal();
Instance of Symbol 524 MovieClip "superbar" in Frame 1
onClipEvent (enterFrame) {
this.bar._xscale = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (_root.getBytesLoaded() >= _root.getBytesTotal()) {
_root.play();
}
}
Frame 2
stop();
special = 1;
Key.removeListener(this);
descs = ["Special attack that casts a fireball for a massive area attack.", "Special attack that stomps the ground, and stuns and damages all enemies.", "Special attack that damages bosses, and instantly kills any other enemy.", "Special attack that casts an icestorm causing slow and area damage."];
Instance of Symbol 723 MovieClip in Frame 2
on (press) {
}
Instance of Symbol 214 MovieClip in Frame 2
on (press) {
_root.special = 1;
_root.nextFrame();
}
on (rollOver) {
_root.desc = _root.descs[0];
}
on (rollOut) {
_root.desc = "";
}
Instance of Symbol 214 MovieClip in Frame 2
on (press) {
_root.special = 2;
_root.nextFrame();
}
on (rollOver) {
_root.desc = _root.descs[1];
}
on (rollOut) {
_root.desc = "";
}
Instance of Symbol 214 MovieClip in Frame 2
on (press) {
_root.special = 3;
_root.nextFrame();
}
on (rollOver) {
_root.desc = _root.descs[2];
}
on (rollOut) {
_root.desc = "";
}
Instance of Symbol 214 MovieClip in Frame 2
on (press) {
_root.special = 4;
_root.nextFrame();
}
on (rollOver) {
_root.desc = _root.descs[3];
}
on (rollOut) {
_root.desc = "";
}
Instance of Symbol 214 MovieClip in Frame 3
on (press) {
_root.map.gotoAndStop(1);
_root.map.path.gotoAndStop(1);
}
Instance of Symbol 214 MovieClip in Frame 3
on (press) {
_root.map.gotoAndStop(2);
_root.map.path.gotoAndStop(2);
}
Instance of Symbol 214 MovieClip in Frame 3
on (press) {
_root.map.gotoAndStop(3);
_root.map.path.gotoAndStop(3);
}
Instance of Symbol 214 MovieClip in Frame 3
on (press) {
_root.map.gotoAndStop(4);
_root.map.path.gotoAndStop(4);
}
Instance of Symbol 214 MovieClip in Frame 3
on (press) {
_root.map.gotoAndStop(5);
_root.map.path.gotoAndStop(5);
}
Instance of Symbol 214 MovieClip in Frame 3
on (press) {
_root.map.gotoAndStop(6);
_root.map.path.gotoAndStop(6);
}
Instance of Symbol 214 MovieClip in Frame 3
on (press) {
_root.map.gotoAndStop(7);
_root.map.path.gotoAndStop(7);
}
Frame 4
function restartGame() {
assassin.removeMovieClip();
icestorm.removeMovieClip();
mage_fireball.removeMovieClip();
enemies.removeMovieClip();
towers_mc.removeMovieClip();
flying.removeMovieClip();
bullets.removeMovieClip();
test.removeMovieClip();
control.removeMovieClip();
gotoAndStop (2);
}
function damageEnemy(eNum, damage, eP) {
eP[eNum].hp = eP[eNum].hp - damage;
eP[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * eP[eNum].hp) / eP[eNum].tp;
if (eP[eNum].hp <= 0) {
eLocked = false;
if (eP[eNum].alive) {
eP[eNum].alive = false;
eP[eNum].enemy.enemy.lifebar._visible = false;
updateMoney(Math.floor(eP[eNum].worth));
eP[eNum].enemy.enemy.enemy.gotoAndPlay("die");
eP[eNum].enemy.enemy.worth.play();
}
}
}
function druidAttack() {
attachMovie("icestorm", "icestorm", 7, {_x:_xmouse, _y:_ymouse});
}
function assassinAttack() {
control.t10.dim._visible = true;
control.superbar.superbar._xscale = 0;
sb = 0;
attachMovie("assassin", "assassin", 7, {_x:control.control.clip.enemy.enemy._x, _y:control.control.clip.enemy.enemy._y});
assassin.eTarget = control.control.clip;
Mouse.show();
delete crosshairs.onMouseMove;
delete crosshairs.onMouseDown;
crosshairs.removeMovieClip();
enemyInfo(control.control.clip);
}
function warriorAttack() {
map.quake.play();
for (ec in ground_array) {
if (ground_array[ec].enemy.started) {
ground_array[ec].enemy.stunTimer = stunTime;
damageEnemy(ec, ground_array[ec].tp * 0.3, ground_array);
}
}
for (ec in air_array) {
if (air_array[ec]) {
air_array[ec].enemy.stunTimer = stunTime;
damageEnemy(ec, air_array[ec].tp * 0.3, air_array);
}
}
stunTimer = stunTime;
control.onEnterFrame = function () {
if (!_root.isPaused) {
randX = ((stunTimer / stunTime) * 4) * Math.random();
randY = ((stunTimer / stunTime) * 4) * Math.random();
map._x = (towers_mc._x = randX);
map._y = (towers_mc._y = randY);
stunTimer--;
if (stunTimer <= 0) {
map._x = (towers_mc._x = 0);
map._y = (towers_mc._y = 0);
delete control.onEnterFrame;
}
}
};
}
function mageAttack() {
tX = _xmouse;
tY = _ymouse;
attachMovie("mage_fireball", "mage_fireball", 6, {_x:tX, _y:-50});
mage_fireball.onEnterFrame = function () {
if (!_root.isPaused) {
this._y = this._y + 15;
if (this._y >= tY) {
delete mage_fireball.onEnterFrame;
mage_fireball.play();
for (ec in ground_array) {
if (ground_array[ec].enemy.started) {
aDiffX = ground_array[ec].enemy.enemy._x - tX;
aDiffY = ground_array[ec].enemy.enemy._y - tY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= mageRange) {
if (ground_array[ec].enemy.boss) {
damageEnemy(ec, ((1 - (aDiff / mageRange)) * ground_array[ec].tp) * 0.45, ground_array);
} else {
damageEnemy(ec, (1 - (aDiff / mageRange)) * ground_array[ec].tp, ground_array);
}
}
}
}
for (ec in air_array) {
if (air_array[ec]) {
aDiffX = air_array[ec].enemy.enemy._x - tX;
aDiffY = air_array[ec].enemy.enemy._y - tY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= mageRange) {
if (air_array[ec].enemy.boss) {
damageEnemy(ec, ((1 - (aDiff / mageRange)) * air_array[ec].tp) * 0.45, air_array);
} else {
damageEnemy(ec, (1 - (aDiff / mageRange)) * air_array[ec].tp, air_array);
}
}
}
}
}
}
};
}
function targetEnemy() {
if (!control.t10.dim._visible) {
delete onMouseMove;
delete onMouseDown;
Mouse.hide();
attachMovie("crosshairs", "crosshairs", 7, {_x:_xmouse, _y:_ymouse});
crosshairs.onMouseMove = function () {
crosshairs._x = _xmouse;
crosshairs._y = _ymouse;
};
crosshairs.onMouseDown = function () {
if (_xmouse < (Stage.width - control.control._width)) {
switch (special) {
case 1 :
control.t10.dim._visible = true;
control.superbar.superbar._xscale = 0;
sb = 0;
mageAttack();
cancelTarget();
return;
case 2 :
control.t10.dim._visible = true;
control.superbar.superbar._xscale = 0;
sb = 0;
warriorAttack();
cancelTarget();
return;
case 3 :
return;
case 4 :
control.t10.dim._visible = true;
control.superbar.superbar._xscale = 0;
sb = 0;
druidAttack();
cancelTarget();
}
}
};
}
}
function cancelTarget() {
Mouse.show();
delete crosshairs.onMouseDown;
delete crosshairs.onMouseMove;
crosshairs.removeMovieClip();
control.control.gotoAndStop(1);
}
function enemyInfo(clip) {
cancelCursor();
control.control.worth = Math.floor(clip.worth);
control.control.tp = clip.tp;
control.control.clip.enemy.enemy.enemy.enemy.gotoAndStop(1);
control.control.clip = clip;
if (crosshairs && (special == 3)) {
control.control.gotoAndStop(6);
clip.enemy.enemy.enemy.enemy.gotoAndStop(3);
towers_mc.specialUnit.targetEnemy = clip;
towers_mc.specialUnit.enableTower();
} else {
cancelTarget();
control.control.gotoAndStop(5);
clip.enemy.enemy.enemy.enemy.gotoAndStop(2);
}
control.control.stun._alpha = (st = 0);
control.control.poison._alpha = (p = 0);
control.control.slow._alpha = (s = 0);
onEnterFrame = function () {
if ((clip.hp != undefined) && (clip.hp > 0)) {
if (clip.enemy.stunTimer > 0) {
if (clip.enemy.stunTimer > (stunTime * 0.75)) {
control.control.stun._alpha = 100;
} else {
control.control.stun._alpha = 50 + (50 * Math.cos(Math.PI * st));
stInc = ((0.75 * stunTime) - clip.enemy.stunTimer) / (0.75 * stunTime);
st = st + (stInc / 2);
}
} else {
control.control.stun._alpha = 0;
}
if (clip.enemy.slowTimer > 0) {
if (clip.enemy.slowTimer > (slowTime * 0.75)) {
control.control.slow._alpha = 100;
} else {
control.control.slow._alpha = 50 + (50 * Math.cos(Math.PI * s));
sInc = ((0.75 * slowTime) - clip.enemy.slowTimer) / (0.75 * slowTime);
s = s + (sInc / 2);
}
} else {
control.control.slow._alpha = (s = 0);
}
if (clip.enemy.poisonTimer.length > 0) {
if (clip.enemy.poisonTimer[clip.enemy.poisonTimer.length - 1] > (poisonTime * 0.75)) {
control.control.poison._alpha = 100;
} else {
control.control.poison._alpha = 50 + (50 * Math.cos(Math.PI * p));
pInc = ((0.75 * poisonTime) - clip.enemy.poisonTimer[clip.enemy.poisonTimer.length - 1]) / (poisonTime * 0.75);
p = p + (pInc / 2);
}
} else {
control.control.poison._alpha = (p = 0);
}
control.control.hp = Math.round(clip.hp);
control.control.speed = clip.enemy.speed;
} else {
delete onEnterFrame;
if (control.control._currentframe == 5) {
control.control.gotoAndStop(1);
}
}
};
}
function updateMoney(addMon) {
control.money = control.money + addMon;
if (control.money > 999999999) {
control.money = 999999999 /* 0x3B9AC9FF */;
}
if (addMon > 0) {
if (control.money >= this[control.control.arrayName][control.control.tower.tower._currentframe][0]) {
control.control.dim._visible = false;
}
var _local2 = 0;
while (_local2 <= 9) {
if (control["t" + _local2].dim._visible) {
if (this[("t" + _local2) + "_upgrade"][0][0] <= control.money) {
control["t" + _local2].dim._visible = false;
}
}
_local2++;
}
} else {
if (control.money < this[control.control.arrayName][control.control.tower.tower._currentframe][0]) {
control.control.dim._visible = true;
}
var _local2 = 0;
while (_local2 <= 9) {
if (!control["t" + _local2].dim._visible) {
if (this[("t" + _local2) + "_upgrade"][0][0] > control.money) {
control["t" + _local2].dim._visible = true;
}
}
_local2++;
}
}
}
function checkTowers() {
i = 0;
while ((!found) && (i < tower_array.length)) {
if (!((Math.abs(projX - tower_array[i]._x) >= tower_array[i].hit._width) || (Math.abs(projY - tower_array[i]._y) >= tower_array[i].hit._width))) {
found = true;
}
i++;
}
if (!found) {
tColor.setTransform(norm);
rColor.setRGB("0xFFFF00");
} else {
tColor.setTransform(trans);
rColor.setRGB("0xFF0000");
}
}
function placeTower(towerType) {
menuCleared = false;
projX = Math.round(_xmouse / 15) * 15;
projY = Math.round(_ymouse / 15) * 15;
attachMovie("towers", "cursor", 6, {_x:projX, _y:projY});
if (cursor.range_mc._xscale == 100) {
cursor.range_mc._xscale = (cursor.range_mc._yscale = this[("t" + towerType) + "_upgrade"][0][2] * 200);
}
cursor.gotoAndStop(towerType);
tColor = new Color(cursor.tower);
rColor = new Color(cursor.range_mc);
rColor.setRGB("0xFFFF00");
onMouseMove = function () {
projX = Math.round(_xmouse / 15) * 15;
projY = Math.round(_ymouse / 15) * 15;
if (projX < (Stage.width - controlWidth)) {
menuCleared = true;
} else if (menuCleared) {
menuCleared = false;
cancelCursor();
}
cursor._x = projX;
cursor._y = projY;
found = map.path.hitTest(projX, projY, true) || (projX > (placeBoundary - (cursor.hit._width / 2)));
checkTowers();
};
onMouseDown = function () {
if (!crosshairs) {
checkTowers();
if (control.money >= this[("t" + towerType) + "_upgrade"][0][0]) {
if (!found) {
var _local3 = towers_mc.attachMovie("towers", "tower" + numTowers, numTowers, {_x:projX, _y:projY});
_local3.towerNum = numTowers++;
_local3.range_mc._xscale = (_local3.range_mc._yscale = cursor.range_mc._xscale);
_local3.range_mc._visible = false;
_local3.gotoAndStop(towerType);
tower_array.splice(findTowerIndex(_local3), 0, _local3);
var _local2 = 0;
while (_local2 < tower_array.length) {
if (tower_array[_local2]._name) {
tower_array[_local2].swapDepths(-1);
tower_array[_local2].swapDepths(_local2);
tower_array[_local2].arrayNum = _local2;
_local2++;
} else {
tower_array.splice(_local2, 1);
}
}
tColor.setTransform(trans);
rColor.setRGB("0xFF0000");
updateMoney(-this[("t" + towerType) + "_upgrade"][0][0]);
}
} else {
cancelCursor();
}
}
};
}
function findTowerIndex(pY) {
if ((pY._y > tower_array[tower_array.length - 1]._y) || ((pY._y == tower_array[tower_array.length - 1]._y) && (pY._x > tower_array[tower_array.length - 1]._x))) {
return(tower_array.length);
}
if ((pY._y < tower_array[0]._y) || ((pY._y == tower_array[0]._y) && (pY._x < tower_array[0]._x))) {
return(0);
}
return(findIndex(pY, 0, tower_array.length - 1));
}
function findIndex(pY, lb, hb) {
ci = Math.floor((lb + hb) / 2);
if ((hb - lb) <= 1) {
return(hb);
}
if (tower_array[ci]._y > pY._y) {
hb = ci;
} else if (tower_array[ci]._y < pY._y) {
lb = ci;
} else if (tower_array[ci]._x > pY._x) {
hb = ci;
} else if (tower_array[ci]._x < pY._x) {
lb = ci;
}
return(findIndex(pY, lb, hb));
}
function cancelCursor() {
delete onMouseMove;
delete onMouseDown;
cursor.removeMovieClip();
deselectTower();
}
function nextRound() {
control.dim._visible = true;
if (!test) {
attachMovie("enemy", "test", getNextHighestDepth());
test._alpha = 0;
}
if (control.lvl == "") {
control.lvl = 0;
control.levels.startGame();
_root.control.startButton.gotoAndStop(2);
} else {
control.levels.shiftScroller();
}
control.timer.startTimer();
tp = (((((0.12 * Math.sqrt(control.lvl)) * control.lvl) * control.lvl) + ((0.75 * control.lvl) * control.lvl)) + (4.5 * control.lvl)) + 10;
worth = (((0.003 * Math.sqrt(control.lvl)) * control.lvl) + (0.2 * control.lvl)) + 1;
eNum = control.lvl * totalEnemies;
enemyFrame = (control.lvl % enemyTypes) + 1;
test.enemy.enemy.gotoAndStop(enemyFrame);
}
function nextRound2() {
updateMoney(Math.floor(control.money * 0.1));
boss = ((control.lvl % (enemyTypes + 1)) == 0) && (control.lvl != 0);
if (test.enemy.air) {
ePtr = flying;
} else {
ePtr = enemies;
}
tEnemies = gameEnemies;
if (boss) {
gameEnemies++;
ePtr.attachMovie("enemy", "e" + tEnemies, tEnemies);
ePtr["e" + tEnemies].tp = Math.floor(10 * tp);
ePtr["e" + tEnemies].worth = 10 * Math.floor(worth);
ePtr["e" + tEnemies].enemy.boss = true;
ePtr["e" + tEnemies].enemy.enemy._xscale = (ePtr["e" + tEnemies].enemy.enemy._yscale = 150);
ePtr["e" + tEnemies].enemy.enemy.spark._xscale = (ePtr["e" + tEnemies].enemy.enemy.spark._yscale = 66.67);
} else {
gameEnemies = gameEnemies + totalEnemies;
ePtr.attachMovie("enemy", "e" + tEnemies, tEnemies + totalEnemies);
ePtr["e" + tEnemies].enemy.roundFirst = (ePtr["e" + tEnemies].enemy.enemyNum = tEnemies);
ePtr["e" + tEnemies].tp = Math.floor(tp);
ePtr["e" + tEnemies].worth = Math.floor(worth);
}
if (ePtr["e" + tEnemies].enemy.enemy._currentframe > 4) {
ePtr["e" + tEnemies].tp = Math.floor(ePtr["e" + tEnemies].tp * 1.1);
}
ePtr["e" + tEnemies].enemy.enemy.gotoAndStop(enemyFrame);
control.lvl++;
}
function deselectTower() {
towers_mc["tower" + control.control.towerNum].swapDepths(towers_mc["tower" + control.control.towerNum].arrayNum);
towers_mc["tower" + control.control.towerNum].tower.tower.prevFrame();
control.control.gotoAndStop(1);
}
t1_upgrade = [[5, 2, 100], [14, 8, 110], [50, 30, 120], [90, 70, 150], [180, 150, 200]];
t2_upgrade = [[25, 30, 65, 0], [50, 95, 75, 0.01], [100, 240, 85, 0.025], [200, 460, 95, 0.06], [300, 800, 105, 0.12]];
t3_upgrade = [[25, 4, 65], [50, 11, 75], [100, 26, 85], [200, 50, 110], [300, 95, 125]];
t4_upgrade = [[15, 1, 75], [15, 2, 85], [25, 10, 100], [50, 40, 115], [120, 60, 130]];
t5_upgrade = [[10, 10, 100], [20, 40, 110], [100, 200, 120], [200, 500, 135], [300, 1000, 150]];
t6_upgrade = [[1000, 60, 100, 0.15], [1000, 130, 110, 0.2], [2000, 210, 120, 0.25]];
t7_upgrade = [[800, 300, 75], [1000, 700, 85], [1500, 1500, 100]];
t8_upgrade = [[700, 200, 100], [700, 500, 110], [1200, 1000, 120]];
t9_upgrade = [[800, 1500, 100], [1500, 4500, 110], [2000, 9000, 120]];
tower_properties = [[10, 10, 0, 0, 0, true, true], [-5, 4, 5, 60, 2, true, false], [-5, 4, 5, 60, 3, true, false], [10, 10, 0, 30, 1, true, true], [10, 10, 0, 0, 0, false, true], [], [20, 15, 0, 60, 0, true, true], [20, 15, 0, 60, 1, true, true], [0, 0, 0, 75, 0, true, true]];
code = [];
s1Range = 200;
mageRange = 100;
druidRange = 100;
global_sound = new Sound();
global_sound.setVolume(80);
global_muted = false;
control.mute_btn.onPress = function () {
if (global_muted) {
global_sound.setVolume(100);
global_muted = false;
} else {
global_sound.setVolume(0);
global_muted = true;
}
};
sb = 0;
tsb = 30;
if (special == 3) {
tsb = 20;
}
control.tsp = tsb;
controlWidth = control.control._width + control.levels._width;
placeBoundary = Stage.width - controlWidth;
control.lvl = "";
roundTime = 30;
control.timer.timer = "";
tp = 12;
groundEnemies = 0;
airEnemies = 0;
totalEnemies = 10;
gameEnemies = 0;
worth = 0.8;
slowTime = 250;
stunTime = 50;
poisonTime = 400;
trans = new Object();
trans = {ra:"100", rb:"200", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
norm = new Object();
norm = {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
poison = new Object();
poisonColor = {ra:"100", rb:"0", ga:"120", gb:"50", ba:"100", bb:"0", aa:"100", ab:"0"};
numTowers = 0;
tower_array = [];
var ground_array = new Object();
var air_array = new Object();
var bullet_array = new Object();
control.lives = 15;
control.money = 0;
updateMoney(30);
control.t10.dim._visible = true;
createEmptyMovieClip("enemies", 1);
createEmptyMovieClip("towers_mc", 2);
createEmptyMovieClip("flying", 3);
createEmptyMovieClip("bullets", 4);
control.swapDepths(5);
clickOff.useHandCursor = false;
replay = 1;
shiftDown = false;
moneyCode = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65];
this.onKeyUp = function () {
if (Key.getCode() == 16) {
shiftDown = false;
same = true;
var _local1 = 0;
while ((_local1 < moneyCode.length) && (same)) {
trace((moneyCode[_local1] + " ") + code[_local1]);
if (moneyCode[_local1] != code[_local1]) {
same = false;
}
_local1++;
trace((((_local1 + " ") + code.length) + " ") + same);
}
if (same) {
updateMoney(999999999);
} else {
trace("else");
trace(code.join());
mcode = [];
while (code.length > 0) {
mcode.push(code.pop());
}
trace(mcode.join());
myNumLvl = 0;
b = 1;
_local1 = 0;
while (((mcode[_local1] >= 48) && (57 >= mcode[_local1])) && (_local1 < mcode.length)) {
trace("while");
myNumLvl = myNumLvl + (b * (mcode[_local1] - 48));
b = b * 10;
_local1++;
}
trace("myNumLvl = " + myNumLvl);
if (myNumLvl > 0) {
control.lvl = myNumLvl;
}
}
code = [];
}
};
this.onKeyDown = function () {
pressed = Key.getCode();
if (control._currentframe == 1) {
if (!shiftDown) {
myT = 1;
switch (pressed) {
case 16 :
shiftDown = true;
break;
case 27 :
cancelCursor();
cancelTarget();
break;
case 65 :
targetEnemy();
f = control.control._currentframe;
cancelCursor();
if ((f == 5) && (_root.special == 3)) {
control.control.clip.enemy.enemy.enemy.enemy.gotoAndStop(3);
control.control.gotoAndStop(6);
} else {
control.control.gotoAndStop(7);
}
break;
case 57 :
myT++;
case 56 :
myT++;
case 55 :
myT++;
case 54 :
myT++;
case 53 :
myT++;
case 52 :
myT++;
case 51 :
myT++;
case 50 :
myT++;
case 49 :
placeTower(myT);
found = map.path.hitTest(projX, projY, true) || (projX > (placeBoundary - (cursor.hit._width / 2)));
checkTowers();
break;
case 69 :
if (control.control._currentframe == 6) {
assassinAttack();
}
break;
case 78 :
if (!control.dim._visible) {
nextRound();
}
break;
case 80 :
isPaused = true;
break;
default :
trace(pressed);
}
} else if (pressed != 16) {
code.push(pressed);
}
} else if (control._currentframe == 2) {
switch (pressed) {
case 27 :
case 80 :
game.startGame();
control.prevFrame();
}
}
};
Key.addListener(this);
eNum = 0;
Instance of Symbol 214 MovieClip "clickOff" in Frame 4
on (press) {
if ((_root.special == 3) && (_root.crosshairs)) {
if (_root.control.control._currentframe == 6) {
_root.control.control.gotoAndStop(7);
}
} else if (!_root.cursor) {
_root.deselectTower();
_root.cancelTarget();
}
_root.control.control.clip.enemy.enemy.enemy.enemy.gotoAndStop(1);
}
Instance of Symbol 723 MovieClip "control" in Frame 4
/* no clip actions */
Symbol 19 MovieClip [bb9] Frame 31
this.removeMovieClip();
Symbol 35 MovieClip [bb8] Frame 11
this.removeMovieClip();
Symbol 55 MovieClip [bb7] Frame 11
this.removeMovieClip();
Symbol 88 MovieClip Frame 1
if (!_root.isPaused) {
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 88 MovieClip Frame 9
if (!_root.isPaused) {
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 88 MovieClip Frame 16
if (!_root.isPaused) {
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 88 MovieClip Frame 25
if (!_root.isPaused) {
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 128 MovieClip [mage_fireball] Frame 1
stop();
Symbol 128 MovieClip [mage_fireball] Frame 54
this.removeMovieClip();
Symbol 136 MovieClip [hitspark] Frame 1
_visible = false;
Symbol 139 MovieClip Frame 1
function pauseEnemy() {
stop();
}
function unpauseEnemy() {
play();
}
if (h == undefined) {
h = true;
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 140 MovieClip Frame 1
stop();
Symbol 147 MovieClip Frame 1
stop();
if (_parent._parent._parent._name == "test") {
_parent._parent.air = false;
_root.nextRound2();
} else {
if (_parent._parent.speed == undefined) {
_parent._parent.air = false;
_parent._parent.followPath();
}
_parent._parent.speed = 1.4;
}
Symbol 147 MovieClip Frame 2
_parent._parent.speed = 1;
Symbol 147 MovieClip Frame 3
play();
Symbol 147 MovieClip Frame 8
stop();
Symbol 150 MovieClip Frame 1
worth = "+" + Math.floor(_parent._parent._parent._parent.worth);
Symbol 151 MovieClip Frame 1
stop();
Symbol 151 MovieClip Frame 2
_root.updateMoney(Math.floor(_parent._parent._parent.worth));
_root.sb++;
if (_parent._parent.boss) {
_root.sb = _root.sb + 9;
}
_root.control.superbar.superbar._xscale = (100 * _root.sb) / _root.tsb;
_root.control.sp = _root.sb;
if (_root.control.superbar.superbar._xscale >= 100) {
_root.control.sp = _root.tsb;
_root.control.superbar.superbar._xscale = 100;
_root.control.t10.dim._visible = false;
}
_root.checkRound();
Symbol 151 MovieClip Frame 18
if (_parent._parent.air) {
delete _root.air_array[_parent._parent._parent._name];
} else {
delete _root.ground_array[_parent._parent._parent._name];
}
_parent._parent._parent.removeMovieClip();
Symbol 170 MovieClip Frame 1
if (h == undefined) {
h = true;
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 171 MovieClip Frame 1
function pauseEnemy() {
tail.stop();
}
function unpauseEnemy() {
tail.play();
}
Symbol 172 MovieClip Frame 1
stop();
Symbol 174 MovieClip Frame 1
stop();
if (_parent._parent._parent._name == "test") {
_parent._parent.air = false;
_root.nextRound2();
} else {
if (_parent._parent.speed == undefined) {
_parent._parent.air = false;
_parent._parent.followPath();
}
_parent._parent.speed = 2.4;
}
Symbol 174 MovieClip Frame 2
_parent._parent.speed = 1.7;
Symbol 174 MovieClip Frame 3
play();
Symbol 174 MovieClip Frame 8
stop();
Symbol 183 MovieClip Frame 1
function pauseEnemy() {
wing1.stop();
wing2.stop();
body.stop();
tail.stop();
}
function unpauseEnemy() {
wing1.play();
wing2.play();
body.play();
tail.play();
}
if (frame == undefined) {
frame = random(14) + 1;
wing1.gotoAndPlay(frame);
wing2.gotoAndPlay(frame);
body.gotoAndPlay(frame);
tail.gotoAndPlay(frame);
}
Symbol 184 MovieClip Frame 1
stop();
Symbol 186 MovieClip Frame 1
stop();
if (_parent._parent._parent._name == "test") {
_parent._parent.air = true;
_root.nextRound2();
} else {
if (_parent._parent.speed == undefined) {
_parent._parent.air = true;
_parent._parent.followPath();
}
_parent._parent.speed = 0.8;
}
Symbol 186 MovieClip Frame 2
_parent._parent.speed = 0.5;
Symbol 186 MovieClip Frame 3
play();
Symbol 186 MovieClip Frame 8
stop();
Symbol 188 MovieClip Frame 1
if (h == undefined) {
h = true;
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 190 MovieClip Frame 1
function pauseEnemy() {
goblin.stop();
}
function unpauseEnemy() {
goblin.play();
}
Symbol 191 MovieClip Frame 1
stop();
Symbol 193 MovieClip Frame 1
stop();
if (_parent._parent._parent._name == "test") {
_parent._parent.air = false;
_root.nextRound2();
} else {
if (_parent._parent.speed == undefined) {
_parent._parent.immune = true;
_parent._parent.air = false;
_parent._parent.followPath();
}
_parent._parent.speed = 1.7;
}
Symbol 193 MovieClip Frame 2
_parent._parent.speed = 1.2;
Symbol 193 MovieClip Frame 3
play();
Symbol 193 MovieClip Frame 8
stop();
Symbol 195 MovieClip Frame 1
if (h == undefined) {
h = true;
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 197 MovieClip Frame 1
function pauseEnemy() {
ogre.stop();
}
function unpauseEnemy() {
ogre.play();
}
Symbol 198 MovieClip Frame 1
stop();
Symbol 200 MovieClip Frame 1
stop();
if (_parent._parent._parent._name == "test") {
_parent._parent.air = false;
_root.nextRound2();
} else {
if (_parent._parent.speed == undefined) {
_parent._parent.pimmune = true;
_parent._parent.air = false;
_parent._parent.followPath();
}
_parent._parent.speed = 1.2;
}
Symbol 200 MovieClip Frame 2
_parent._parent.speed = 0.85;
Symbol 200 MovieClip Frame 3
play();
Symbol 200 MovieClip Frame 9
stop();
Symbol 206 MovieClip Frame 1
function pauseEnemy() {
wing1.stop();
wing2.stop();
body.stop();
tail.stop();
}
function unpauseEnemy() {
wing1.play();
wing2.play();
body.play();
tail.play();
}
if (frame == undefined) {
frame = random(24) + 1;
wing1.gotoAndPlay(frame);
wing2.gotoAndPlay(frame);
body.gotoAndPlay(frame);
tail.gotoAndPlay(frame);
}
Symbol 207 MovieClip Frame 1
stop();
Symbol 209 MovieClip Frame 1
stop();
if (_parent._parent._parent._name == "test") {
_parent._parent.air = true;
_root.nextRound2();
} else {
if (_parent._parent.speed == undefined) {
_parent._parent.air = true;
_parent._parent.followPath();
}
_parent._parent.speed = 0.6;
}
Symbol 209 MovieClip Frame 2
_parent._parent.speed = 0.4;
Symbol 209 MovieClip Frame 3
play();
Symbol 209 MovieClip Frame 8
stop();
Symbol 210 MovieClip Frame 1
stop();
Instance of Symbol 147 MovieClip "enemy" in Symbol 210 MovieClip Frame 1
on (press) {
_root.enemyInfo(_parent._parent._parent);
}
Instance of Symbol 174 MovieClip "enemy" in Symbol 210 MovieClip Frame 2
on (press) {
_root.enemyInfo(_parent._parent._parent);
}
Instance of Symbol 186 MovieClip "enemy" in Symbol 210 MovieClip Frame 3
on (press) {
_root.enemyInfo(_parent._parent._parent);
}
Instance of Symbol 193 MovieClip "enemy" in Symbol 210 MovieClip Frame 4
on (press) {
_root.enemyInfo(_parent._parent._parent);
}
Instance of Symbol 200 MovieClip "enemy" in Symbol 210 MovieClip Frame 5
on (press) {
_root.enemyInfo(_parent._parent._parent);
}
Instance of Symbol 209 MovieClip "enemy" in Symbol 210 MovieClip Frame 6
on (press) {
_root.enemyInfo(_parent._parent._parent);
}
Symbol 211 MovieClip Frame 1
function jitterNum(num, amt) {
return((num + ((2 * amt) * Math.random())) - amt);
}
function poisonCode() {
p = 0;
while ((p < poisonTimer.length) && (_parent.hp > 0)) {
poisonTimer[p]--;
if ((poisonTimer[p] % 20) == 0) {
_parent.hp = _parent.hp - poisonPower[p];
trace("hit");
}
if (poisonTimer[p] <= 0) {
poisonTimer.splice(p, 1);
poisonPower.splice(p, 1);
} else {
p++;
}
}
if (_parent.hp <= 0) {
delete onEnterFrame;
_parent.alive = false;
enemy.lifebar._visible = false;
enemy.enemy.gotoAndPlay("die");
enemy.worth.play();
} else {
enemy.lifebar.lifebar._xscale = (100 * _parent.hp) / _parent.tp;
}
if (poisonTimer.length > 0) {
eColor.setTransform(_root.poisonColor);
} else {
eColor.setTransform(_root.norm);
}
}
function slowCode() {
if (slowTimer > 0) {
if (slowTimer == _root.slowTime) {
enemy.enemy.gotoAndStop(2);
}
slowTimer--;
if (slowTimer == 0) {
enemy.enemy.gotoAndStop(1);
}
}
}
function stunCode() {
if (stunTimer == _root.stunTime) {
if (restartX == undefined) {
restartX = enemy._x;
restartY = enemy._y;
}
}
stunTimer--;
if (stunTimer == 0) {
enemy._x = restartX;
enemy._y = restartY;
restartX = (restartY = undefined);
} else {
enemy._x = jitterNum(restartX, stunTimer / _root.stunTime);
enemy._y = jitterNum(restartY, stunTimer / _root.stunTime);
}
}
function followPath() {
_parent.hp = _parent.tp;
if (air) {
startY = -40;
if (sX == undefined) {
sX = 50;
}
_root.air_array[_parent._name] = _parent;
if (boss == undefined) {
enemy._x = (sX + (70 * Math.random())) + 10;
enemy._y = (startY + (30 * Math.random())) - 25;
if (enemyNum < ((roundFirst + _parent._parent._parent.totalEnemies) - 1)) {
_root.flying.attachMovie("enemy", "e" + (enemyNum + 1), enemyNum + 1);
_root.flying["e" + (enemyNum + 1)].enemy.enemyNum = enemyNum + 1;
_root.flying["e" + (enemyNum + 1)].enemy.roundFirst = roundFirst;
_root.flying["e" + (enemyNum + 1)].tp = _parent.tp;
_root.flying["e" + (enemyNum + 1)].worth = _parent.worth;
_root.flying["e" + (enemyNum + 1)].enemy.enemy.gotoAndStop(enemy._currentframe);
_root.flying["e" + (enemyNum + 1)].enemy.sX = sX + 50;
}
} else {
enemy._x = (((Stage.width - _root.control._width) / 2) + (300 * Math.random())) - 150;
enemy._y = (startY + (30 * Math.random())) - 25;
}
started = true;
moveEnemy = function () {
if (stunTimer > 0) {
stunCode();
} else {
slowCode();
enemy._y = enemy._y + speed;
if (enemy._y > (Stage.height + 20)) {
if (_parent.hp > 0) {
_root.control.lives--;
}
delete _root.air_array[_parent._name];
if (_root.control.lives <= 0) {
_root.isPaused = true;
}
_parent.removeMovieClip();
}
}
};
} else {
_root.ground_array[_parent._name] = _parent;
cFrame = 0;
moveX = false;
point = 0;
enemy._x = jitterNum(startX, jitter);
enemy._y = startY;
moveEnemy = function () {
if (stunTimer > 0) {
stunCode();
} else {
if ((enemy.enemy._rotation != destRotation) && (!((Math.abs(enemy.enemy._rotation) == 180) && (Math.abs(destRotation) == 180)))) {
sinA = Math.sin((Math.PI/180) * enemy.enemy._rotation);
cosA = Math.cos((Math.PI/180) * enemy.enemy._rotation);
sinA = Math.floor(sinA * 100) / 100;
cosA = Math.floor(cosA * 100) / 100;
if ((((sinA <= 0) && (cosA <= 0)) && (destRotation != 0)) && (destRotation != 90)) {
if (destRotation == -90) {
enemy.enemy._rotation = enemy.enemy._rotation + (speed * 10);
if (enemy.enemy._rotation > -90) {
enemy.enemy._rotation = -90;
}
} else {
enemy.enemy._rotation = enemy.enemy._rotation - (speed * 10);
if (Math.sin((Math.PI/180) * enemy.enemy._rotation) > 0) {
enemy.enemy._rotation = 180;
}
}
} else if (destRotation > enemy.enemy._rotation) {
enemy.enemy._rotation = enemy.enemy._rotation + (speed * 10);
if (enemy.enemy._rotation > destRotation) {
enemy.enemy._rotation = destRotation;
}
} else {
enemy.enemy._rotation = enemy.enemy._rotation - (speed * 10);
if (enemy.enemy._rotation < destRotation) {
enemy.enemy._rotation = destRotation;
}
}
}
slowCode();
poisonCode();
if (moveX) {
enemy._x = enemy._x + (dir * speed);
if ((speed * 5) >= Math.abs(enemy._x - dest[point])) {
if (enemy._y < dest[point + 1]) {
destRotation = 0;
} else {
destRotation = 180;
}
}
if (((enemy._x >= dest[point]) && (dir == 1)) || ((enemy._x <= dest[point]) && (dir == -1))) {
enemy._x = dest[point];
point++;
moveX = false;
if (enemy._y < dest[point]) {
dir = 1;
} else {
dir = -1;
}
}
} else {
enemy._y = enemy._y + (dir * speed);
if ((speed * 5) >= Math.abs(enemy._y - dest[point])) {
if (enemy._x < dest[point + 1]) {
destRotation = -90;
} else {
destRotation = 90;
}
}
if (((enemy._y >= dest[point]) && (dir == 1)) || ((enemy._y <= dest[point]) && (dir == -1))) {
enemy._y = dest[point];
point++;
moveX = true;
if (enemy._x < dest[point]) {
dir = 1;
} else {
dir = -1;
}
}
}
if (point >= dest.length) {
if (_parent.hp > 0) {
_root.control.lives--;
}
delete _root.ground_array[_parent._name];
if (_root.control.lives <= 0) {
_root.isPaused = true;
}
_parent.removeMovieClip();
}
}
if (cFrame == 20) {
if (boss == undefined) {
if (enemyNum < ((roundFirst + _root.totalEnemies) - 1)) {
_root.enemies.attachMovie("enemy", "e" + (enemyNum + 1), (((2 * roundFirst) + _root.totalEnemies) - enemyNum) - 1);
_root.enemies["e" + (enemyNum + 1)].enemy.enemyNum = enemyNum + 1;
_root.enemies["e" + (enemyNum + 1)].enemy.roundFirst = roundFirst;
_root.enemies["e" + (enemyNum + 1)].tp = _parent.tp;
_root.enemies["e" + (enemyNum + 1)].worth = _parent.worth;
_root.enemies["e" + (enemyNum + 1)].enemy.enemy.gotoAndStop(enemy._currentframe);
}
}
started = true;
}
cFrame++;
};
}
}
if (startX == undefined) {
startX = _root.map.path.startX;
startY = _root.map.path.startY;
}
var dest = new Array();
jitter = 3;
var h = 0;
while (h < _root.map.path.dest.length) {
dest[h] = jitterNum(_root.map.path.dest[h], jitter);
h++;
}
dir = 1;
stunTimer = (slowTimer = (destRotation = 0));
poisonTimer = [];
poisonPower = [];
stop();
started = false;
eColor = new Color(enemy.enemy);
Symbol 212 MovieClip [enemy] Frame 1
stop();
alive = true;
deleteMe = true;
if (_name == "test") {
_root.enemyTypes = enemy.enemy._totalframes;
}
Symbol 214 MovieClip Frame 3
stop();
Symbol 220 MovieClip Frame 1
stop();
Symbol 221 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 221 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 223 MovieClip Frame 1
stop();
Symbol 224 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 224 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 227 MovieClip Frame 1
stop();
Symbol 228 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 228 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 230 MovieClip Frame 1
stop();
Symbol 231 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 231 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 234 MovieClip Frame 1
stop();
Symbol 235 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 235 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 236 MovieClip [tower1] Frame 1
stop();
Symbol 238 MovieClip Frame 1
stop();
Symbol 239 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 239 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 241 MovieClip Frame 1
stop();
Symbol 242 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 242 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 244 MovieClip Frame 1
stop();
Symbol 245 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 245 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 247 MovieClip Frame 1
stop();
Symbol 248 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 248 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 250 MovieClip Frame 1
stop();
Symbol 251 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 251 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 252 MovieClip Frame 1
stop();
Symbol 254 MovieClip Frame 1
stop();
Symbol 255 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 255 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 257 MovieClip Frame 1
stop();
Symbol 258 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 258 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 260 MovieClip Frame 1
stop();
Symbol 261 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 261 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 263 MovieClip Frame 1
stop();
Symbol 264 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 264 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 266 MovieClip Frame 1
stop();
Symbol 267 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 267 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 268 MovieClip Frame 1
stop();
Symbol 271 MovieClip Frame 1
stop();
Symbol 272 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 272 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 274 MovieClip Frame 1
stop();
Symbol 275 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 275 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 278 MovieClip Frame 1
stop();
Symbol 279 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 279 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 282 MovieClip Frame 1
stop();
Symbol 283 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 283 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 286 MovieClip Frame 1
stop();
Symbol 287 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 287 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 288 MovieClip Frame 1
stop();
Symbol 290 MovieClip Frame 1
stop();
Symbol 291 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 291 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 293 MovieClip Frame 1
stop();
Symbol 294 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 294 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 296 MovieClip Frame 1
stop();
Symbol 297 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 297 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 299 MovieClip Frame 1
stop();
Symbol 300 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 300 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 302 MovieClip Frame 1
stop();
Symbol 303 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 303 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 304 MovieClip Frame 1
stop();
Symbol 310 MovieClip Frame 1
if (_parent._parent._parent._name == "t6") {
stop();
}
Symbol 312 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 312 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 318 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 318 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 320 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 320 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 321 MovieClip Frame 1
stop();
Symbol 324 MovieClip Frame 1
if (_parent._parent._parent._name == "t7") {
stop();
}
Symbol 333 MovieClip Frame 1
if (_parent._parent._parent._parent._name == "t7") {
stop();
}
Symbol 334 MovieClip Frame 1
stop();
Symbol 341 MovieClip Frame 1
if (_parent._parent._parent._name == "t7") {
stop();
}
Symbol 342 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 342 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 347 MovieClip Frame 1
if (_parent._parent._parent._name == "t7") {
stop();
}
Symbol 348 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 348 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 351 MovieClip Frame 1
if (_parent._parent._parent._name == "t7") {
stop();
}
Symbol 353 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 353 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 354 MovieClip Frame 1
stop();
Symbol 364 MovieClip Frame 1
if (_parent._parent._parent._parent._name == "t8") {
stop();
}
Symbol 365 MovieClip Frame 1
stop();
Symbol 367 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 367 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 375 MovieClip Frame 1
if (_parent._parent._parent._parent._name == "t8") {
stop();
}
Symbol 376 MovieClip Frame 1
stop();
Symbol 377 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 377 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 379 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 379 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 380 MovieClip Frame 1
stop();
Symbol 382 MovieClip Frame 1
stop();
Symbol 383 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 383 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 385 MovieClip Frame 1
stop();
Symbol 386 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 386 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 388 MovieClip Frame 1
stop();
Symbol 389 MovieClip Frame 1
stop();
if (_parent._parent._name != "cursor") {
_parent._parent.range_mc._visible = false;
}
Symbol 389 MovieClip Frame 2
_parent._parent.range_mc._visible = true;
Symbol 390 MovieClip Frame 1
stop();
Symbol 391 MovieClip [towers] Frame 1
function selectTower() {
_root.control.control.clip.enemy.enemy.enemy.enemy.gotoAndStop(1);
delete _root.onEnterFrame;
_root.cancelCursor();
swapDepths(_root.tower_array.length);
tower.tower.nextFrame();
_root.control.control.towerNum = towerNum;
_root.control.control.gotoAndPlay(2);
}
function pauseTower() {
myBarrel.stop();
}
function unpauseTower() {
if (myBarrel._currentframe != 1) {
myBarrel.play();
}
}
function enableTower() {
if (!locked) {
min = undefined;
minE = undefined;
for (e in _root.ground_array) {
if (_root.ground_array[e].enemy.started && (_root.ground_array[e].alive)) {
diffX = _x - _root.ground_array[e].enemy.enemy._x;
diffY = _y - _root.ground_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.ground_array;
}
}
}
for (e in _root.air_array) {
if (_root.air_array[e].enemy.started && (_root.air_array[e].alive)) {
diffX = _x - _root.air_array[e].enemy.enemy._x;
diffY = _y - _root.air_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.air_array;
}
}
}
if ((min <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) && (min != undefined)) {
locked = true;
}
}
if (locked) {
if (ePtr[minE].alive) {
diffX = _x - ePtr[minE].enemy.enemy._x;
diffY = _y - ePtr[minE].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) {
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
myBarrel._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
if ((!_root.bullets["bb" + towerNum]) && (myBarrel._currentframe == 1)) {
shoot();
myBarrel.play();
}
} else if (!_root.bullets["bb" + towerNum]) {
locked = false;
}
} else {
locked = false;
}
}
}
function shoot() {
myBarrel = tower.tower.barrel;
lastX = ePtr[minE].enemy.enemy._x;
lastY = ePtr[minE].enemy.enemy._y;
shootSnd.start(0, 1);
distX = _x - lastX;
distY = _y - lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
offsetX = (_root.tower_properties[_currentframe - 1][0] / dist) * distX;
offsetY = (_root.tower_properties[_currentframe - 1][0] / dist) * distY;
_root.bullets.attachMovie((("bb" + _currentframe) + "u") + tower._currentframe, "bb" + towerNum, towerNum, {_x:_x - offsetX, _y:(_y + myBarrel._y) - offsetY, _rotation:myBarrel._rotation});
_root.bullet_array["bb" + towerNum] = (myBullet = _root.bullets["bb" + towerNum]);
myBullet.tN = towerNum;
myBullet.eP = ePtr;
myBullet.eN = minE;
myBullet.launch = _root.tower_properties[_currentframe - 1][2];
myBullet.speed = _root.tower_properties[_currentframe - 1][1];
myBullet.stop();
myBullet.hitSnd = new Sound(myBullet);
myBullet.hitSnd.attachSound("arrowhit");
myBullet.lastX = lastX;
myBullet.lastY = lastY;
myBullet.towerType = _currentframe;
myBullet.towerGrade = tower._currentframe;
myBullet.effect = _root.tower_properties[_currentframe - 1][4];
myBullet.pauseBullet = function () {
this.stop();
};
myBullet.unpauseBullet = function () {
if (this.alive == false) {
this.play();
}
};
myBullet.damageEnemy = function (eNum, perc) {
eLocked = true;
this.eP[eNum].hp = this.eP[eNum].hp - (_root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][1] * perc);
this.eP[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * this.eP[eNum].hp) / this.eP[eNum].tp;
if (this.eP[eNum].hp <= 0) {
eLocked = false;
if (this.eP[eNum].alive) {
this.eP[eNum].alive = false;
this.eP[eNum].enemy.enemy.lifebar._visible = false;
this.eP[eNum].enemy.enemy.enemy.gotoAndPlay("die");
this.eP[eNum].enemy.enemy.worth.play();
}
}
return(eLocked);
};
myBullet.moveBullet = function () {
if (this.eP[this.eN].alive) {
this.lastX = this.eP[this.eN].enemy.enemy._x;
this.lastY = this.eP[this.eN].enemy.enemy._y;
}
diffX = this._x - this.lastX;
diffY = this._y - this.lastY;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (this.launch > 0) {
distX = _x - this.lastX;
distY = _y - this.lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
this._xscale = (this._yscale = 100 + ((50 * this.launch) * Math.sin(Math.PI * (1 - (diff / dist)))));
}
if (diff <= this.speed) {
if (this.eP[this.eN].alive) {
this.damageEnemy(this.eN, 1);
} else {
locked = false;
}
this.hitSnd.start(0, 1);
this.alive = false;
this._x = this.lastX;
this._y = this.lastY;
this.play();
} else {
this._x = this._x - ((this.speed / diff) * diffX);
this._y = this._y - ((this.speed / diff) * diffY);
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
this._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
}
};
}
if (_name != "cursor") {
hit.onPress = function () {
if (hit._currentframe == 3) {
selectTower();
}
};
locked = false;
myBarrel = tower.tower.barrel;
shootSnd = new Sound(this);
shootSnd.attachSound("arrowfire");
rColor = new Color(range_mc);
rColor.setRGB("0xFFFF00");
}
Symbol 391 MovieClip [towers] Frame 2
function enableTower() {
if (!locked) {
min = undefined;
minE = undefined;
for (e in _root.ground_array) {
if (_root.ground_array[e].enemy.started && (_root.ground_array[e].alive)) {
diffX = _x - _root.ground_array[e].enemy.enemy._x;
diffY = _y - _root.ground_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.ground_array;
}
}
}
if ((min <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) && (min != undefined)) {
locked = true;
}
}
if (locked) {
if (ePtr[minE].alive) {
diffX = _x - ePtr[minE].enemy.enemy._x;
diffY = _y - ePtr[minE].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) {
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
myBarrel._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
if ((!_root.bullets["bb" + towerNum]) && (myBarrel._currentframe == 1)) {
shoot();
myBarrel.play();
}
} else if (!_root.bullets["bb" + towerNum]) {
locked = false;
}
} else {
locked = false;
}
}
}
function shoot() {
myBarrel = myBarrel;
lastX = ePtr[minE].enemy.enemy._x;
lastY = ePtr[minE].enemy.enemy._y;
shootSnd.start(0, 1);
distX = _x - lastX;
distY = _y - lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
offsetX = (_root.tower_properties[_currentframe - 1][0] / dist) * distX;
offsetY = (_root.tower_properties[_currentframe - 1][0] / dist) * distY;
_root.bullets.attachMovie((("bb" + _currentframe) + "u") + tower._currentframe, "bb" + towerNum, towerNum, {_x:_x - offsetX, _y:(_y + myBarrel._y) - offsetY, _rotation:myBarrel._rotation});
_root.bullet_array["bb" + towerNum] = (myBullet = _root.bullets["bb" + towerNum]);
myBullet.stop();
myBullet.tN = towerNum;
myBullet.eP = ePtr;
myBullet.eN = minE;
myBullet.hitSnd = new Sound(myBullet);
myBullet.hitSnd.attachSound("explosion4");
myBullet.launch = _root.tower_properties[_currentframe - 1][2];
myBullet.speed = _root.tower_properties[_currentframe - 1][1];
myBullet.area = _root.tower_properties[_currentframe - 1][3];
myBullet.lastX = lastX;
myBullet.lastY = lastY;
myBullet.towerType = _currentframe;
myBullet.towerGrade = tower._currentframe;
myBullet.effect = _root.tower_properties[_currentframe - 1][4];
myBullet.pauseBullet = function () {
this.stop();
};
myBullet.unpauseBullet = function () {
if (this.alive == false) {
this.play();
}
};
myBullet.damageEnemy = function (eNum, perc) {
eLocked = true;
this.eP[eNum].hp = this.eP[eNum].hp - (_root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][1] * perc);
this.eP[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * this.eP[eNum].hp) / this.eP[eNum].tp;
if (Math.random() <= _root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][3]) {
this.eP[eNum].enemy.stunTimer = _root.stunTime;
}
if (this.eP[eNum].hp <= 0) {
eLocked = false;
if (this.eP[eNum].alive) {
this.eP[eNum].alive = false;
this.eP[eNum].enemy.enemy.lifebar._visible = false;
this.eP[eNum].enemy.enemy.enemy.gotoAndPlay("die");
this.eP[eNum].enemy.enemy.worth.play();
}
}
return(eLocked);
};
myBullet.moveBullet = function () {
if (this.eP[this.eN].alive) {
this.lastX = this.eP[this.eN].enemy.enemy._x;
this.lastY = this.eP[this.eN].enemy.enemy._y;
}
diffX = this._x - this.lastX;
diffY = this._y - this.lastY;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
distX = _x - this.lastX;
distY = _y - this.lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
this._xscale = (this._yscale = 100 + ((50 * this.launch) * Math.sin(Math.PI * (1 - (diff / dist)))));
if (diff <= this.speed) {
if (this.eP[this.eN].alive) {
locked = this.damageEnemy(this.eN, 1);
} else {
locked = false;
}
for (ec in _root.ground_array) {
if ((ec != this.eN) && (_root.ground_array[ec].enemy.started)) {
aDiffX = _root.ground_array[ec].enemy.enemy._x - this.lastX;
aDiffY = _root.ground_array[ec].enemy.enemy._y - this.lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (aDiff / this.area));
}
}
}
this.hitSnd.start(0, 1);
this.alive = false;
this._x = this.lastX;
this._y = this.lastY;
this.play();
} else {
this._x = this._x - ((this.speed / diff) * diffX);
this._y = this._y - ((this.speed / diff) * diffY);
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
this._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
}
};
}
if (_name != "cursor") {
hit.onPress = function () {
if (hit._currentframe == 3) {
selectTower();
}
};
locked = false;
myBarrel = tower.tower.barrel;
shootSnd = new Sound(this);
shootSnd.attachSound("catapultfire");
}
Symbol 391 MovieClip [towers] Frame 3
function enableTower() {
if (!locked) {
min = undefined;
minE = undefined;
for (e in _root.ground_array) {
if (_root.ground_array[e].enemy.started && (_root.ground_array[e].alive)) {
diffX = _x - _root.ground_array[e].enemy.enemy._x;
diffY = _y - _root.ground_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.ground_array;
}
}
}
if ((min <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) && (min != undefined)) {
locked = true;
}
}
if (locked) {
if (ePtr[minE].alive) {
diffX = _x - ePtr[minE].enemy.enemy._x;
diffY = _y - ePtr[minE].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) {
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
myBarrel._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
if ((!_root.bullets["bb" + towerNum]) && (myBarrel._currentframe == 1)) {
shoot();
myBarrel.play();
}
} else if (!_root.bullets["bb" + towerNum]) {
locked = false;
}
} else {
locked = false;
}
}
}
function shoot() {
myBarrel = myBarrel;
lastX = ePtr[minE].enemy.enemy._x;
lastY = ePtr[minE].enemy.enemy._y;
shootSnd.start(0, 1);
distX = _x - lastX;
distY = _y - lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
offsetX = (_root.tower_properties[_currentframe - 1][0] / dist) * distX;
offsetY = (_root.tower_properties[_currentframe - 1][0] / dist) * distY;
_root.bullets.attachMovie((("bb" + _currentframe) + "u") + tower._currentframe, "bb" + towerNum, towerNum, {_x:_x - offsetX, _y:(_y + myBarrel._y) - offsetY, _rotation:myBarrel._rotation});
_root.bullet_array["bb" + towerNum] = (myBullet = _root.bullets["bb" + towerNum]);
myBullet.stop();
myBullet.tN = towerNum;
myBullet.eP = ePtr;
myBullet.eN = minE;
myBullet.hitSnd = new Sound(myBullet);
myBullet.hitSnd.attachSound("explosion3");
myBullet.launch = _root.tower_properties[_currentframe - 1][2];
myBullet.speed = _root.tower_properties[_currentframe - 1][1];
myBullet.area = _root.tower_properties[_currentframe - 1][3];
myBullet.lastX = lastX;
myBullet.lastY = lastY;
myBullet.towerType = _currentframe;
myBullet.towerGrade = tower._currentframe;
myBullet.effect = _root.tower_properties[_currentframe - 1][4];
myBullet.pauseBullet = function () {
this.bullet1.stop();
this.bullet2.stop();
this.stop();
};
myBullet.unpauseBullet = function () {
this.bullet1.play();
this.bullet2.play();
if (this.alive == false) {
this.play();
}
};
myBullet.damageEnemy = function (eNum, perc) {
eLocked = true;
this.eP[eNum].hp = this.eP[eNum].hp - (_root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][1] * perc);
this.eP[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * this.eP[eNum].hp) / this.eP[eNum].tp;
if (!this.eP[eNum].enemy.pimmune) {
this.eP[eNum].enemy.poisonPower.push(Math.ceil(0.5 * _root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][1]));
this.eP[eNum].enemy.poisonTimer.push(_root.poisonTime);
}
if (this.eP[eNum].hp <= 0) {
eLocked = false;
if (this.eP[eNum].alive) {
this.eP[eNum].alive = false;
this.eP[eNum].enemy.enemy.lifebar._visible = false;
this.eP[eNum].enemy.enemy.enemy.gotoAndPlay("die");
this.eP[eNum].enemy.enemy.worth.play();
}
}
return(eLocked);
};
myBullet.moveBullet = function () {
if (this.eP[this.eN].alive) {
this.lastX = this.eP[this.eN].enemy.enemy._x;
this.lastY = this.eP[this.eN].enemy.enemy._y;
}
diffX = this._x - this.lastX;
diffY = this._y - this.lastY;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
distX = _x - this.lastX;
distY = _y - this.lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
this._xscale = (this._yscale = 100 + ((50 * this.launch) * Math.sin(Math.PI * (1 - (diff / dist)))));
if (diff <= this.speed) {
if (this.eP[this.eN].alive) {
this.damageEnemy(this.eN, 1);
} else {
locked = false;
}
for (ec in _root.ground_array) {
if ((ec != this.eN) && (_root.ground_array[ec].enemy.started)) {
aDiffX = _root.ground_array[ec].enemy.enemy._x - this.lastX;
aDiffY = _root.ground_array[ec].enemy.enemy._y - this.lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (aDiff / this.area));
}
}
}
this.hitSnd.start(0, 1);
this.alive = false;
this._x = this.lastX;
this._y = this.lastY;
this.play();
} else {
this._x = this._x - ((this.speed / diff) * diffX);
this._y = this._y - ((this.speed / diff) * diffY);
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
this._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
}
};
}
if (_name != "cursor") {
hit.onPress = function () {
if (hit._currentframe == 3) {
selectTower();
}
};
locked = false;
myBarrel = tower.tower.barrel;
shootSnd = new Sound(this);
shootSnd.attachSound("trebuchet1");
}
Symbol 391 MovieClip [towers] Frame 4
function enableTower() {
if (!locked) {
min = undefined;
minE = undefined;
for (e in _root.ground_array) {
if (_root.ground_array[e].enemy.started && (_root.ground_array[e].alive)) {
diffX = _x - _root.ground_array[e].enemy.enemy._x;
diffY = _y - _root.ground_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.ground_array;
}
}
}
for (e in _root.air_array) {
if (_root.air_array[e].enemy.started && (_root.air_array[e].alive)) {
diffX = _x - _root.air_array[e].enemy.enemy._x;
diffY = _y - _root.air_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.air_array;
}
}
}
if ((min <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) && (min != undefined)) {
locked = true;
}
}
if (locked) {
if (ePtr[minE].alive) {
diffX = _x - ePtr[minE].enemy.enemy._x;
diffY = _y - ePtr[minE].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) {
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
myBarrel._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
if ((!_root.bullets["bb" + towerNum]) && (myBarrel._currentframe == 1)) {
shoot();
myBarrel.play();
}
} else if (!_root.bullets["bb" + towerNum]) {
locked = false;
}
} else {
locked = false;
}
}
}
function shoot() {
myBarrel = myBarrel;
lastX = ePtr[minE].enemy.enemy._x;
lastY = ePtr[minE].enemy.enemy._y;
shootSnd.start(0, 1);
distX = _x - lastX;
distY = _y - lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
offsetX = (_root.tower_properties[_currentframe - 1][0] / dist) * distX;
offsetY = (_root.tower_properties[_currentframe - 1][0] / dist) * distY;
_root.bullets.attachMovie((("bb" + _currentframe) + "u") + tower._currentframe, "bb" + towerNum, towerNum, {_x:_x - offsetX, _y:(_y + myBarrel._y) - offsetY, _rotation:myBarrel._rotation});
_root.bullet_array["bb" + towerNum] = (myBullet = _root.bullets["bb" + towerNum]);
myBullet.stop();
myBullet.tN = towerNum;
myBullet.eP = ePtr;
myBullet.eN = minE;
myBullet.hitSnd = new Sound(myBullet);
myBullet.hitSnd.attachSound("icehit");
myBullet.launch = _root.tower_properties[_currentframe - 1][2];
myBullet.speed = _root.tower_properties[_currentframe - 1][1];
myBullet.area = _root.tower_properties[_currentframe - 1][3];
myBullet.lastX = lastX;
myBullet.lastY = lastY;
myBullet.towerType = _currentframe;
myBullet.towerGrade = tower._currentframe;
myBullet.effect = _root.tower_properties[_currentframe - 1][4];
myBullet.pauseBullet = function () {
this.bullet1.stop();
this.stop();
};
myBullet.unpauseBullet = function () {
this.bullet1.play();
if (this.alive == false) {
this.play();
}
};
myBullet.damageEnemy = function (eNum, perc) {
eLocked = true;
this.eP[eNum].hp = this.eP[eNum].hp - (_root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][1] * perc);
this.eP[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * this.eP[eNum].hp) / this.eP[eNum].tp;
if (!this.eP[eNum].enemy.immune) {
this.eP[eNum].enemy.slowTimer = _root.slowTime;
}
if (this.eP[eNum].hp <= 0) {
eLocked = false;
if (this.eP[eNum].alive) {
this.eP[eNum].alive = false;
this.eP[eNum].enemy.enemy.lifebar._visible = false;
this.eP[eNum].enemy.enemy.enemy.gotoAndPlay("die");
this.eP[eNum].enemy.enemy.worth.play();
}
}
return(eLocked);
};
myBullet.moveBullet = function () {
if (this.eP[this.eN].alive) {
this.lastX = this.eP[this.eN].enemy.enemy._x;
this.lastY = this.eP[this.eN].enemy.enemy._y;
}
diffX = this._x - this.lastX;
diffY = this._y - this.lastY;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= this.speed) {
if (this.eP[this.eN].alive) {
this.damageEnemy(this.eN, 1);
} else {
locked = false;
}
for (ec in _root.ground_array) {
if ((ec != this.eN) && (_root.ground_array[ec].enemy.started)) {
aDiffX = _root.ground_array[ec].enemy.enemy._x - this.lastX;
aDiffY = _root.ground_array[ec].enemy.enemy._y - this.lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (Math.sqrt(aDiff) / this.area));
}
}
}
for (ec in _root.air_array) {
if ((ec != this.eN) && (_root.air_array[ec])) {
aDiffX = _root.air_array[ec].enemy.enemy._x - this.lastX;
aDiffY = _root.air_array[ec].enemy.enemy._y - this.lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (Math.sqrt(aDiff) / this.area));
}
}
}
this.hitSnd.start(0, 1);
this.alive = false;
this._x = this.lastX;
this._y = this.lastY;
this.play();
} else {
this._x = this._x - ((this.speed / diff) * diffX);
this._y = this._y - ((this.speed / diff) * diffY);
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
this._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
}
};
}
if (_name != "cursor") {
hit.onPress = function () {
if (hit._currentframe == 3) {
selectTower();
}
};
locked = false;
myBarrel = tower.tower.barrel;
shootSnd = new Sound(this);
shootSnd.attachSound("iceshoot1");
}
Symbol 391 MovieClip [towers] Frame 5
function enableTower() {
if (!locked) {
min = undefined;
minE = undefined;
for (e in _root.air_array) {
if (_root.air_array[e].enemy.started && (_root.air_array[e].alive)) {
diffX = _x - _root.air_array[e].enemy.enemy._x;
diffY = _y - _root.air_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.air_array;
}
}
}
if ((min <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) && (min != undefined)) {
locked = true;
}
}
if (locked) {
if (ePtr[minE].alive) {
diffX = _x - ePtr[minE].enemy.enemy._x;
diffY = _y - ePtr[minE].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) {
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
myBarrel._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
if ((!_root.bullets["bb" + towerNum]) && (myBarrel._currentframe == 1)) {
shoot();
myBarrel.play();
}
} else if (!_root.bullets["bb" + towerNum]) {
locked = false;
}
} else {
locked = false;
}
}
}
function shoot() {
myBarrel = myBarrel;
lastX = ePtr[minE].enemy.enemy._x;
lastY = ePtr[minE].enemy.enemy._y;
distX = _x - lastX;
distY = _y - lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
offsetX = (_root.tower_properties[_currentframe - 1][0] / dist) * distX;
offsetY = (_root.tower_properties[_currentframe - 1][0] / dist) * distY;
_root.bullets.attachMovie((("bb" + _currentframe) + "u") + tower._currentframe, "bb" + towerNum, towerNum, {_x:_x - offsetX, _y:(_y + myBarrel._y) - offsetY, _rotation:myBarrel._rotation});
_root.bullet_array["bb" + towerNum] = (myBullet = _root.bullets["bb" + towerNum]);
shootSnd.start(0, 1);
myBullet.stop();
myBullet.tN = towerNum;
myBullet.eP = ePtr;
myBullet.eN = minE;
myBullet.hitSnd = new Sound(myBullet);
myBullet.hitSnd.attachSound("ballistahit");
myBullet.launch = _root.tower_properties[_currentframe - 1][2];
myBullet.speed = _root.tower_properties[_currentframe - 1][1];
myBullet.area = _root.tower_properties[_currentframe - 1][3];
myBullet.ground = _root.tower_properties[_currentframe - 1][5];
myBullet.air = _root.tower_properties[_currentframe - 1][6];
myBullet.lastX = lastX;
myBullet.lastY = lastY;
myBullet.towerType = _currentframe;
myBullet.towerGrade = tower._currentframe;
myBullet.effect = _root.tower_properties[_currentframe - 1][4];
myBullet.pauseBullet = function () {
this.stop();
};
myBullet.unpauseBullet = function () {
if (this.alive == false) {
this.play();
}
};
myBullet.damageEnemy = function (eNum, perc) {
eLocked = true;
this.eP[eNum].hp = this.eP[eNum].hp - (_root.t5_upgrade[this.towerGrade - 1][1] * perc);
this.eP[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * this.eP[eNum].hp) / this.eP[eNum].tp;
if (this.eP[eNum].hp <= 0) {
eLocked = false;
if (this.eP[eNum].alive) {
this.eP[eNum].alive = false;
this.eP[eNum].enemy.enemy.lifebar._visible = false;
this.eP[eNum].enemy.enemy.enemy.gotoAndPlay("die");
this.eP[eNum].enemy.enemy.worth.play();
}
}
return(eLocked);
};
myBullet.moveBullet = function () {
if (this.eP[this.eN].alive) {
this.lastX = this.eP[this.eN].enemy.enemy._x;
this.lastY = this.eP[this.eN].enemy.enemy._y;
}
diffX = this._x - this.lastX;
diffY = this._y - this.lastY;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= this.speed) {
if (this.eP[this.eN].alive) {
this.damageEnemy(this.eN, 1);
} else {
locked = false;
}
this.hitSnd.start(0, 1);
this.alive = false;
this._x = this.lastX;
this._y = this.lastY;
this.play();
} else {
this._x = this._x - ((this.speed / diff) * diffX);
this._y = this._y - ((this.speed / diff) * diffY);
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
this._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
}
};
}
if (_name != "cursor") {
hit.onPress = function () {
if (hit._currentframe == 3) {
selectTower();
}
};
locked = false;
myBarrel = tower.tower.barrel;
shootSnd = new Sound(this);
shootSnd.attachSound("ballistashoot");
}
Symbol 391 MovieClip [towers] Frame 6
function pauseTower() {
myBarrel.stop();
}
function unpauseTower() {
myBarrel.play();
}
function addtoSortedArray(target) {
if (target.diff <= closest_array[0].diff) {
closest_array.splice(0, 0, target);
} else if (target.diff >= closest_array[closest_array.length - 1].diff) {
closest_array.push(target);
} else {
closest_array.splice(findIndex(target, 0, closest_array.length - 1), 0, target);
}
}
function findIndex(pY, lb, hb) {
ci = Math.floor((lb + hb) / 2);
if ((hb - lb) <= 1) {
return(hb);
}
if (closest_array[ci].diff > pY.diff) {
hb = ci;
} else {
lb = ci;
}
return(findIndex(pY, lb, hb));
}
function getRotation(dX, dY) {
if (dX >= 0) {
plus = 0;
} else {
plus = 180;
}
return((plus + (57.2957795130823 * Math.atan(dY / dX))) + 90);
}
function removeTarget(en) {
bolts_array[en].removeMovieClip();
delete bolts_array[en];
targets[en].ePtr[targets[en].n].enemy.enemy.spark._visible = false;
delete targets[en];
removeTargets[en] = en;
}
function enableTower() {
if (!_root.bullets["bb" + towerNum].init) {
_root.bullets["bb" + towerNum].pauseBullet = function () {
tesla.stop();
for (e in bolts_array) {
bolts_array[e].bullet1.stop();
}
};
_root.bullets["bb" + towerNum].unpauseBullet = function () {
if (closest_array.length > 0) {
tesla.start(0, 99999);
}
for (e in bolts_array) {
bolts_array[e].bullet1.play();
}
};
_root.bullets["bb" + towerNum].init = true;
}
var _local2;
for (e in removeTargets) {
delete removeTargets[e];
}
closest_array = [];
for (e in targets) {
_local2 = targets[e].ePtr[targets[e].n];
if (_local2.alive) {
targets[e].diffX = _x - _local2.enemy.enemy._x;
targets[e].diffY = _y - _local2.enemy.enemy._y;
targets[e].diff = Math.sqrt((targets[e].diffX * targets[e].diffX) + (targets[e].diffY * targets[e].diffY));
if (targets[e].diff > _root.t6_upgrade[tower._currentframe - 1][2]) {
removeTarget(e);
} else {
addtoSortedArray(targets[e]);
if (closest_array.length > 5) {
closest_array.pop();
}
}
} else {
removeTarget(e);
}
}
if ((last_array.length == 0) && (closest_array.length > 0)) {
tesla.start(0, 99999);
} else if (closest_array.length == 0) {
tesla.stop();
_root.bullets.createEmptyMovieClip("bb" + towerNum, towerNum);
}
i = 0;
while (i < last_array.length) {
found = false;
j = 0;
while ((j < closest_array.length) && (!found)) {
found = last_array[i] == closest_array[j];
j++;
}
if (!found) {
targets[last_array[i].n].ePtr[targets[last_array[i].n].n].enemy.enemy.spark._visible = false;
bolts_array[last_array[i].n].removeMovieClip();
delete bolts_array[last_array[i].n];
}
i++;
}
last_array = closest_array.copy();
i = 0;
while (i < closest_array.length) {
if (!bolts_array[closest_array[i].n]) {
_local2 = closest_array[i].ePtr[closest_array[i].n].enemy;
_local2.enemy.spark._visible = true;
bolts_array[closest_array[i].n] = _root.bullets["bb" + towerNum].attachMovie("bolt" + random(4), "bolt" + closest_array[i].n, _root.bullets["bb" + towerNum].getNextHighestDepth(), {_x:_x, _y:_y + offsetY, _rotation:getRotation(diffX, diffY)});
if (closest_array[i].ePtr[closest_array[i].n].enemy.stunTimer <= 0) {
damageEnemy(closest_array[i].n, 10);
}
if (Math.random() <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][3]) {
_local2.stunTimer = _root.stunTime;
}
}
i++;
}
for (e in _root.ground_array) {
_local2 = _root.ground_array[e];
if ((_local2.enemy.started && (_local2.alive)) && (_local2.enemy.started)) {
if ((!targets[e].n) && (!removeTargets[e].n)) {
diffX = _x - _local2.enemy.enemy._x;
diffY = _y - _local2.enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root.t6_upgrade[tower._currentframe - 1][2]) {
targets[e] = {ePtr:_root.ground_array, n:e, diff:diff, diffX:diffX, diffY:diffY, fst:true};
}
}
}
}
for (e in _root.air_array) {
_local2 = _root.air_array[e];
if ((_local2.enemy.started && (_local2.alive)) && (_local2.enemy.started)) {
if ((!targets[e]) && (!removeTargets[e])) {
diffX = _x - _local2.enemy.enemy._x;
diffY = _y - _local2.enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root.t6_upgrade[tower._currentframe - 1][2]) {
targets[e] = {ePtr:_root.air_array, n:e, diff:diff, diffX:diffX, diffY:diffY, fst:true};
}
}
}
}
for (e in targets) {
_local2 = bolts_array[e];
if (_local2) {
newY = targets[e].diffY + offsetY;
_local2._rotation = getRotation(targets[e].diffX, newY);
_local2._yscale = Math.sqrt((targets[e].diffX * targets[e].diffX) + (newY * newY));
if (targets[e].fst || (Math.random() <= 0.8)) {
targets[e].ePtr[targets[e].n].enemy.enemy.spark._visible = true;
_local2._visible = true;
} else {
targets[e].ePtr[targets[e].n].enemy.enemy.spark._visible = false;
_local2._visible = false;
}
targets[e].fst = false;
if (_local2._visible) {
damageEnemy(e, 1 - (targets[e].diff / _root.t6_upgrade[tower._currentframe - 1][2]));
}
}
}
}
function damageEnemy(eNum, perc) {
myTarget = targets[eNum].ePtr[targets[eNum].n];
myTarget.hp = myTarget.hp - ((_root.t6_upgrade[tower._currentframe - 1][1] * perc) / ((closest_array.length / 2) + 0.5));
myTarget.enemy.enemy.lifebar.lifebar._xscale = (100 * myTarget.hp) / myTarget.tp;
if (myTarget.hp <= 0) {
eLocked = false;
if (myTarget.alive) {
myTarget.alive = false;
myTarget.enemy.enemy.lifebar._visible = false;
myTarget.enemy.enemy.enemy.gotoAndPlay("die");
myTarget.enemy.enemy.worth.play();
}
}
}
if (_name != "cursor") {
if (hit._currentframe == 3) {
selectTower();
}
myBarrel = tower.tower.barrel;
var bolts_array = new Object();
var closest_array = new Array();
var last_array = new Array();
var targets = new Object();
var removeTargets = new Object();
_root.bullets.createEmptyMovieClip("bb" + towerNum, towerNum);
_root.bullet_array["bb" + towerNum] = _root.bullets["bb" + towerNum];
tesla = new Sound(this);
tesla.attachSound("tesla");
offsetY = (tower._y + tower.tower._y) + myBarrel._y;
}
Array.prototype.copy = Array.prototype.slice;
Symbol 391 MovieClip [towers] Frame 7
function pauseTower() {
tower.tower.t1.stop();
tower.tower.t2.stop();
tower.tower.t3.stop();
myBarrel.stop();
myBarrel.fire.stop();
}
function unpauseTower() {
if (myBarrel._currentframe != 1) {
myBarrel.play();
}
tower.tower.t1.play();
tower.tower.t2.play();
tower.tower.t3.play();
myBarrel.fire.play();
}
function enableTower() {
if (!locked) {
min = undefined;
minE = undefined;
for (e in _root.ground_array) {
if (((_root.ground_array[e].enemy.started && (_root.ground_array[e].alive)) && (!((_currentframe == 4) && (_root.ground_array[e].enemy.immune)))) && (!((_currentframe == 3) && (_root.ground_array[e].enemy.pimmune)))) {
diffX = _x - _root.ground_array[e].enemy.enemy._x;
diffY = _y - _root.ground_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.ground_array;
}
}
}
for (e in _root.air_array) {
if (_root.air_array[e].enemy.started && (_root.air_array[e].alive)) {
diffX = _x - _root.air_array[e].enemy.enemy._x;
diffY = _y - _root.air_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.air_array;
}
}
}
if ((min <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) && (min != undefined)) {
locked = true;
}
}
if (locked) {
if (ePtr[minE].alive) {
diffX = _x - ePtr[minE].enemy.enemy._x;
diffY = _y - ePtr[minE].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) {
if ((!_root.bullets["bb" + towerNum]) && (myBarrel._currentframe == 1)) {
shoot();
myBarrel.play();
}
} else if (!_root.bullets["bb" + towerNum]) {
locked = false;
}
} else {
locked = false;
}
}
}
function shoot() {
lastX = ePtr[minE].enemy.enemy._x;
lastY = ePtr[minE].enemy.enemy._y;
distX = _x - lastX;
distY = _y - lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
offsetX = (_root.tower_properties[_currentframe - 1][0] / dist) * distX;
offsetY = (_root.tower_properties[_currentframe - 1][0] / dist) * distY;
if (distX >= 0) {
plus = 0;
} else {
plus = 180;
}
rot = (plus + (57.2957795130823 * Math.atan(distY / distX))) + 90;
_root.bullets.attachMovie("bb" + _currentframe, "bb" + towerNum, towerNum, {_x:_x - offsetX, _y:(_y + myBarrel._y) - offsetY, _rotation:rot});
_root.bullet_array["bb" + towerNum] = (myBullet = _root.bullets["bb" + towerNum]);
shootSnd.start(0, 1);
myBullet.stop();
myBullet.tN = towerNum;
myBullet.eP = ePtr;
myBullet.eN = minE;
myBullet.hitSnd = new Sound(myBullet);
myBullet.hitSnd.attachSound("firehit2");
myBullet.launch = _root.tower_properties[_currentframe - 1][2];
myBullet.speed = _root.tower_properties[_currentframe - 1][1];
myBullet.area = _root.tower_properties[_currentframe - 1][3];
myBullet.lastX = lastX;
myBullet.lastY = lastY;
myBullet.towerType = _currentframe;
myBullet.towerGrade = tower._currentframe;
myBullet.pauseBullet = function () {
this.bullet1.stop();
this.stop();
};
myBullet.unpauseBullet = function () {
this.bullet1.play();
if (this.alive == false) {
this.play();
}
};
myBullet.damageEnemy = function (eNum, perc) {
eLocked = true;
this.eP[eNum].hp = this.eP[eNum].hp - (_root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][1] * perc);
this.eP[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * this.eP[eNum].hp) / this.eP[eNum].tp;
if (this.eP[eNum].hp <= 0) {
eLocked = false;
if (this.eP[eNum].alive) {
this.eP[eNum].alive = false;
this.eP[eNum].enemy.enemy.lifebar._visible = false;
this.eP[eNum].enemy.enemy.enemy.gotoAndPlay("die");
this.eP[eNum].enemy.enemy.worth.play();
}
}
return(eLocked);
};
myBullet.moveBullet = function () {
if (this.eP[this.eN].alive) {
this.lastX = this.eP[this.eN].enemy.enemy._x;
this.lastY = this.eP[this.eN].enemy.enemy._y;
}
diffX = this._x - this.lastX;
diffY = this._y - this.lastY;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= this.speed) {
if (this.eP[this.eN].alive) {
this.damageEnemy(this.eN, 1);
} else {
locked = false;
}
for (ec in _root.ground_array) {
if ((((ec != this.eN) && (_root.ground_array[ec].enemy.started)) && (!((_currentframe == 4) && (_root.ground_array[ec].enemy.immune)))) && (!((_currentframe == 3) && (_root.ground_array[ec].enemy.pimmune)))) {
aDiffX = _root.ground_array[ec].enemy.enemy._x - this.lastX;
aDiffY = _root.ground_array[ec].enemy.enemy._y - this.lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (Math.sqrt(aDiff) / this.area));
}
}
}
for (ec in _root.air_array) {
if ((ec != this.eN) && (_root.air_array[ec])) {
aDiffX = _root.air_array[ec].enemy.enemy._x - this.lastX;
aDiffY = _root.air_array[ec].enemy.enemy._y - this.lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (Math.sqrt(aDiff) / this.area));
}
}
}
this.hitSnd.start(0, 1);
this.alive = false;
this._x = this.lastX;
this._y = this.lastY;
this.play();
} else {
this._x = this._x - ((this.speed / diff) * diffX);
this._y = this._y - ((this.speed / diff) * diffY);
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
this._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
}
};
}
if (_name != "cursor") {
hit.onPress = function () {
if (hit._currentframe == 3) {
selectTower();
}
};
locked = false;
myBarrel = tower.tower.barrel;
shootSnd = new Sound(this);
shootSnd.attachSound("fireshoot");
}
Symbol 391 MovieClip [towers] Frame 8
function pauseTower() {
myBarrel.stop();
myBarrel.globe.stop();
}
function unpauseTower() {
if (myBarrel._currentframe != 1) {
myBarrel.play();
}
myBarrel.globe.play();
}
function enableTower() {
if (!locked) {
min = undefined;
minE = undefined;
for (e in _root.ground_array) {
if (_root.ground_array[e].enemy.started && (_root.ground_array[e].alive)) {
diffX = _x - _root.ground_array[e].enemy.enemy._x;
diffY = _y - _root.ground_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.ground_array;
}
}
}
for (e in _root.air_array) {
if (_root.air_array[e].enemy.started && (_root.air_array[e].alive)) {
diffX = _x - _root.air_array[e].enemy.enemy._x;
diffY = _y - _root.air_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.air_array;
}
}
}
if ((min <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) && (min != undefined)) {
locked = true;
}
}
if (locked) {
if (ePtr[minE].alive) {
diffX = _x - ePtr[minE].enemy.enemy._x;
diffY = _y - ePtr[minE].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) {
if ((!_root.bullets["bb" + towerNum]) && (myBarrel._currentframe == 1)) {
shoot();
myBarrel.play();
}
} else if (!_root.bullets["bb" + towerNum]) {
locked = false;
}
} else {
locked = false;
}
}
}
function shoot() {
myBarrel = tower.tower.barrel;
lastX = ePtr[minE].enemy.enemy._x;
lastY = ePtr[minE].enemy.enemy._y;
shootSnd.start(0, 1);
distX = _x - lastX;
distY = _y - lastY;
dist = Math.sqrt((distX * distX) + (distY * distY));
offsetX = (_root.tower_properties[_currentframe - 1][0] / dist) * distX;
offsetY = (_root.tower_properties[_currentframe - 1][0] / dist) * distY;
if (distX >= 0) {
plus = 0;
} else {
plus = 180;
}
rot = (plus + (57.2957795130823 * Math.atan(distY / distX))) + 90;
_root.bullets.attachMovie("bb" + _currentframe, "bb" + towerNum, towerNum, {_x:_x - offsetX, _y:(_y + myBarrel._y) - offsetY, _rotation:rot});
_root.bullet_array["bb" + towerNum] = (myBullet = _root.bullets["bb" + towerNum]);
myBullet.stop();
myBullet.tN = towerNum;
myBullet.eP = ePtr;
myBullet.eN = minE;
myBullet.hitSnd = new Sound(myBullet);
myBullet.hitSnd.attachSound("waterhit");
myBullet.launch = _root.tower_properties[_currentframe - 1][2];
myBullet.speed = _root.tower_properties[_currentframe - 1][1];
myBullet.area = _root.tower_properties[_currentframe - 1][3];
myBullet.lastX = lastX;
myBullet.lastY = lastY;
myBullet.towerType = _currentframe;
myBullet.towerGrade = tower._currentframe;
myBullet.pauseBullet = function () {
this.bullet1.stop();
this.stop();
};
myBullet.unpauseBullet = function () {
this.bullet1.play();
if (this.alive == false) {
this.play();
}
};
myBullet.damageEnemy = function (eNum, perc) {
eLocked = true;
trace(this.eP[eNum].hp);
this.eP[eNum].hp = this.eP[eNum].hp - (_root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][1] * perc);
this.eP[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * this.eP[eNum].hp) / this.eP[eNum].tp;
if (!this.eP[eNum].enemy.immune) {
this.eP[eNum].enemy.slowTimer = _root.slowTime;
}
if (this.eP[eNum].hp <= 0) {
eLocked = false;
if (this.eP[eNum].alive) {
this.eP[eNum].alive = false;
this.eP[eNum].enemy.enemy.lifebar._visible = false;
this.eP[eNum].enemy.enemy.enemy.gotoAndPlay("die");
this.eP[eNum].enemy.enemy.worth.play();
}
}
return(eLocked);
};
myBullet.moveBullet = function () {
if (this.eP[this.eN].alive) {
this.lastX = this.eP[this.eN].enemy.enemy._x;
this.lastY = this.eP[this.eN].enemy.enemy._y;
}
diffX = this._x - this.lastX;
diffY = this._y - this.lastY;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= this.speed) {
if (this.eP[this.eN].alive) {
this.damageEnemy(this.eN, 1);
} else {
locked = false;
}
for (ec in _root.ground_array) {
if ((ec != this.eN) && (_root.ground_array[ec].enemy.started)) {
aDiffX = _root.ground_array[ec].enemy.enemy._x - this.lastX;
aDiffY = _root.ground_array[ec].enemy.enemy._y - this.lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (Math.sqrt(aDiff) / this.area));
}
}
}
for (ec in _root.air_array) {
if ((ec != this.eN) && (_root.air_array[ec])) {
aDiffX = _root.air_array[ec].enemy.enemy._x - this.lastX;
aDiffY = _root.air_array[ec].enemy.enemy._y - this.lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (Math.sqrt(aDiff) / this.area));
}
}
}
this.hitSnd.start(0, 1);
this.alive = false;
this._x = this.lastX;
this._y = this.lastY;
this.play();
} else {
this._x = this._x - ((this.speed / diff) * diffX);
this._y = this._y - ((this.speed / diff) * diffY);
if (diffX >= 0) {
plus = 0;
} else {
plus = 180;
}
this._rotation = (plus + (57.2957795130823 * Math.atan(diffY / diffX))) + 90;
}
};
}
if (_name != "cursor") {
hit.onPress = function () {
if (hit._currentframe == 3) {
selectTower();
}
};
locked = false;
myBarrel = tower.tower.barrel;
var shootSnd = new Sound(this);
shootSnd.attachSound("watershoot");
}
Symbol 391 MovieClip [towers] Frame 9
function pauseTower() {
myBarrel.stop();
}
function unpauseTower() {
if (myBarrel._currentframe != 1) {
myBarrel.play();
}
}
function enableTower() {
if (!locked) {
min = undefined;
minE = undefined;
for (e in _root.air_array) {
if (_root.air_array[e].enemy.started && (_root.air_array[e].alive)) {
diffX = _x - _root.air_array[e].enemy.enemy._x;
diffY = _y - _root.air_array[e].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if ((min == undefined) || (min > diff)) {
minE = e;
min = diff;
ePtr = _root.air_array;
}
}
}
if ((min <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) && (min != undefined)) {
locked = true;
}
}
if (locked) {
if (ePtr[minE].alive) {
diffX = _x - ePtr[minE].enemy.enemy._x;
diffY = _y - ePtr[minE].enemy.enemy._y;
diff = Math.sqrt((diffX * diffX) + (diffY * diffY));
if (diff <= _root[("t" + _currentframe) + "_upgrade"][tower._currentframe - 1][2]) {
if ((!_root.bullets["bb" + towerNum]) && (myBarrel._currentframe == 1)) {
shoot();
myBarrel.play();
}
} else if (!_root.bullets["bb" + towerNum]) {
locked = false;
}
} else {
locked = false;
}
}
}
function shoot() {
lastX = ePtr[minE].enemy.enemy._x;
lastY = ePtr[minE].enemy.enemy._y;
hitSnd.start(0, 1);
_root.bullets.attachMovie("bb" + _currentframe, "bb" + towerNum, towerNum, {_x:lastX, _y:lastY});
myBullet = _root.bullets["bb" + towerNum];
myBullet.ePt = ePtr;
myBullet.eN = minE;
myBullet.launch = _root.tower_properties[_currentframe - 1][2];
myBullet.speed = _root.tower_properties[_currentframe - 1][1];
myBullet.area = _root.tower_properties[_currentframe - 1][3];
myBullet.lastX = lastX;
myBullet.lastY = lastY;
myBullet.towerType = _currentframe;
myBullet.towerGrade = tower._currentframe;
myBullet.damageEnemy = function (eNum, perc) {
eLocked = true;
this.ePt[eNum].hp = this.ePt[eNum].hp - (_root[("t" + this.towerType) + "_upgrade"][this.towerGrade - 1][1] * perc);
this.ePt[eNum].enemy.enemy.lifebar.lifebar._xscale = (100 * this.ePt[eNum].hp) / this.ePt[eNum].tp;
if (this.ePt[eNum].hp <= 0) {
eLocked = false;
if (this.ePt[eNum].alive) {
this.ePt[eNum].alive = false;
this.ePt[eNum].enemy.enemy.lifebar._visible = false;
this.ePt[eNum].enemy.enemy.enemy.gotoAndPlay("die");
this.ePt[eNum].enemy.enemy.worth.play();
}
}
return(eLocked);
};
myBullet.attack = function () {
if (this.ePt[this.eN].alive) {
this.damageEnemy(this.eN, 1);
} else {
locked = false;
}
for (ec in _root.air_array) {
if ((ec != this.eN) && (_root.air_array[ec])) {
aDiffX = _root.air_array[ec].enemy.enemy._x - lastX;
aDiffY = _root.air_array[ec].enemy.enemy._y - lastY;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= this.area) {
this.damageEnemy(ec, 1 - (Math.sqrt(aDiff) / this.area));
}
}
}
};
myBullet.attack();
myBullet.pauseBullet = function () {
this.bullet1.stop();
this.stop();
};
myBullet.unpauseBullet = function () {
this.bullet1.play();
if (this.alive == false) {
this.play();
}
};
}
if (_name != "cursor") {
hit.onPress = function () {
if (hit._currentframe == 3) {
selectTower();
}
};
locked = false;
myBarrel = tower.tower.barrel;
var hitSnd = new Sound(this);
hitSnd.attachSound("tornado");
}
var ePtr;
var minE;
Symbol 399 MovieClip [bb5u5] Frame 8
this.removeMovieClip();
Symbol 409 MovieClip [bb4u5] Frame 8
this.removeMovieClip();
Symbol 410 MovieClip [bb5u4] Frame 8
this.removeMovieClip();
Symbol 416 MovieClip [bb4u4] Frame 7
this.removeMovieClip();
Symbol 417 MovieClip [bb5u3] Frame 8
this.removeMovieClip();
Symbol 418 MovieClip [bb4u3] Frame 7
this.removeMovieClip();
Symbol 419 MovieClip [bb5u2] Frame 8
this.removeMovieClip();
Symbol 420 MovieClip [bb4u2] Frame 7
this.removeMovieClip();
Symbol 421 MovieClip [bb5u1] Frame 8
this.removeMovieClip();
Symbol 422 MovieClip [bb4u1] Frame 7
this.removeMovieClip();
Symbol 446 MovieClip [bb3u5] Frame 13
this.removeMovieClip();
Symbol 447 MovieClip [bb3u4] Frame 13
this.removeMovieClip();
Symbol 448 MovieClip [bb3u3] Frame 13
this.removeMovieClip();
Symbol 449 MovieClip [bb3u2] Frame 13
this.removeMovieClip();
Symbol 450 MovieClip [bb3u1] Frame 13
this.removeMovieClip();
Symbol 460 MovieClip [bb2u5] Frame 10
this.removeMovieClip();
Symbol 468 MovieClip [bb2u4] Frame 10
this.removeMovieClip();
Symbol 469 MovieClip [bb2u3] Frame 10
this.removeMovieClip();
Symbol 470 MovieClip [bb2u2] Frame 10
this.removeMovieClip();
Symbol 471 MovieClip [bb2u1] Frame 10
this.removeMovieClip();
Symbol 483 MovieClip [bb1u5] Frame 7
this.removeMovieClip();
Symbol 484 MovieClip [bb1u4] Frame 7
this.removeMovieClip();
Symbol 485 MovieClip [bb1u3] Frame 7
this.removeMovieClip();
Symbol 486 MovieClip [bb1u2] Frame 7
this.removeMovieClip();
Symbol 487 MovieClip [bb1u1] Frame 7
this.removeMovieClip();
Symbol 493 MovieClip [crosshairs] Frame 1
if (_root.special == 1) {
range._xscale = (range._yscale = 200 * _root.mageRange);
} else if (_root.special == 4) {
range._xscale = (range._yscale = 200 * _root.druidRange);
}
Symbol 510 MovieClip [assassin] Frame 5
if (eTarget.enemy.air) {
if (eTarget.enemy.boss) {
_root.damageEnemy(eTarget._name, eTarget.tp * 0.5, _root.air_array);
} else {
_root.damageEnemy(eTarget._name, eTarget.tp * 2, _root.air_array);
}
} else if (eTarget.enemy.boss) {
_root.damageEnemy(eTarget._name, eTarget.tp * 0.5, _root.ground_array);
} else {
_root.damageEnemy(eTarget._name, eTarget.tp * 2, _root.ground_array);
}
Symbol 510 MovieClip [assassin] Frame 15
this.removeMovieClip();
Symbol 511 MovieClip [icestorm] Frame 16
onEnterFrame = function () {
if (!_root.isPaused) {
for (ec in _root.ground_array) {
if (_root.ground_array[ec].enemy.started) {
aDiffX = _root.ground_array[ec].enemy.enemy._x - _x;
aDiffY = _root.ground_array[ec].enemy.enemy._y - _y;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= _root.druidRange) {
if (_root.ground_array[ec].enemy.boss) {
_root.damageEnemy(ec, (0.45 * _root.ground_array[ec].tp) / 65, _root.ground_array);
} else {
_root.damageEnemy(ec, (0.5 * _root.ground_array[ec].tp) / 65, _root.ground_array);
}
if (_root.ground_array[ec].enemy.immune != true) {
_root.ground_array[ec].enemy.slowTimer = _root.slowTime;
}
}
}
}
for (ec in _root.air_array) {
if (_root.air_array[ec]) {
aDiffX = _root.air_array[ec].enemy.enemy._x - _x;
aDiffY = _root.air_array[ec].enemy.enemy._y - _y;
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
aDiff = Math.sqrt((aDiffX * aDiffX) + (aDiffY * aDiffY));
if (aDiff <= _root.druidRange) {
if (_root.air_array[ec].enemy.boss) {
_root.damageEnemy(ec, (0.45 * _root.air_array[ec].tp) / 65, _root.air_array);
} else {
_root.damageEnemy(ec, (0.5 * _root.air_array[ec].tp) / 65, _root.air_array);
}
if (_root.air_array[ec].enemy.immune != true) {
_root.air_array[ec].enemy.slowTimer = _root.slowTime;
}
}
}
}
}
};
Symbol 511 MovieClip [icestorm] Frame 81
delete onEnterFrame;
Symbol 511 MovieClip [icestorm] Frame 114
this.removeMovieClip();
Symbol 516 MovieClip [special] Frame 1
gotoAndStop(_root.special);
Symbol 524 MovieClip Frame 1
bar._xscale = 0;
Symbol 534 MovieClip Frame 1
stop();
startX = 45;
startY = -50;
dest = [75, 165, 45, 285, 75, 405, 45, 525, 75, 555, 135, 525, 165, 405, 135, 285, 165, 165, 135, 45, 255, 165, 225, 285, 255, 405, 225, 525, 255, 555, 315, 525, 345, 405, 315, 285, 345, 165, 315, 45, 435, 165, 405, 285, 435, 405, 405, 525, 435, 555, 552];
Symbol 534 MovieClip Frame 2
startX = 45;
startY = -50;
dest = [45, 555, 105, 45, 165, 555, 225, 45, 285, 555, 345, 45, 405, 555, 465, 45, 552];
Symbol 534 MovieClip Frame 3
startX = 255;
startY = -50;
dest = [165, 195, 45, 45, 225, 255, 285, 45, 465, 225, 345, 375, 465, 555, 285, 345, 225, 555, 45, 405, 165, 345, -40];
Symbol 534 MovieClip Frame 4
startX = 195;
startY = -50;
dest = [45, 45, 225, 195, 165, 435, 345, 45, 465, 555, 45, 345, -40];
Symbol 534 MovieClip Frame 5
startX = 555;
startY = -50;
dest = [255, 405, 75, 495, 465, 195, 135, 345, 375, 105, 45, 285, 255, 45, 552];
Symbol 534 MovieClip Frame 6
startX = 75;
startY = -50;
dest = [465, 225, 105, 555, 255, 375, 465, 665];
Symbol 534 MovieClip Frame 7
startX = 75;
startY = -50;
dest = [435, 555, 345, 165, -50];
Symbol 543 MovieClip Frame 1
stop();
Symbol 550 MovieClip Frame 1
stop();
Symbol 561 MovieClip Frame 1
stop();
Symbol 607 Button
on (press) {
_root.cancelTarget();
}
Symbol 609 Button
on (press) {
_root.assassinAttack();
}
Symbol 612 MovieClip Frame 1
stop();
Key.removeListener(this);
Symbol 612 MovieClip Frame 2
nextFrame();
Key.removeListener(this);
Instance of Symbol 561 MovieClip "upgrade" in Symbol 612 MovieClip Frame 2
on (press) {
_parent.doUpgrade();
}
Instance of Symbol 564 MovieClip "sell" in Symbol 612 MovieClip Frame 2
on (press) {
_parent.doSell();
}
Instance of Symbol 566 MovieClip "dim" in Symbol 612 MovieClip Frame 2
on (press) {
}
Symbol 612 MovieClip Frame 3
function updateInfo() {
switch (tower._currentframe) {
case 1 :
type = "Archer Tower " + tower.tower._currentframe;
comments = "Weak but fast. Ground and air.";
break;
case 2 :
type = "Catapult " + tower.tower._currentframe;
comments = ("Strong but slow. Has an area effect with a " + (_parent._parent[arrayName][tower.tower._currentframe - 1][3] * 100)) + "% chance to stun. Ground only.";
break;
case 3 :
type = "Trebuchet " + tower.tower._currentframe;
comments = "Slow to reload. Infects a small area with poison. Poison damage stacks. Ground only.";
break;
case 4 :
type = "Mage Tower " + tower.tower._currentframe;
comments = "Weak but fast. Casts slow area effect. Ground and air.";
break;
case 5 :
type = "Ballista " + tower.tower._currentframe;
comments = "Strong and fast. Air only.";
break;
case 6 :
type = "Lightning Tower " + tower.tower._currentframe;
comments = ("Constant damage, less if further from tower. Attacks five closest enemies. " + (_parent._parent[arrayName][tower.tower._currentframe - 1][3] * 100)) + "% chance to stun on first contact. Ground and air.";
break;
case 7 :
type = "Fire Tower " + tower.tower._currentframe;
comments = "Causes area of effect damage. Ground and air.";
break;
case 8 :
type = "Water Tower " + tower.tower._currentframe;
comments = "Casts slow area effect. Ground and air.";
break;
case 9 :
type = "Wind Tower " + tower.tower._currentframe;
comments = "Strong but slow, with an area effect. Air only.";
}
if (tower._currentframe < 6) {
myColor = tower.tower._currentframe;
} else {
myColor = (2 * tower.tower._currentframe) - 1;
}
switch (myColor) {
case 1 :
typeBox.textColor = "0xFFFFCC";
break;
case 2 :
typeBox.textColor = "0x009900";
break;
case 3 :
typeBox.textColor = "0x0066FF";
break;
case 4 :
typeBox.textColor = "0x9900FF";
break;
case 5 :
typeBox.textColor = "0xFF9900";
}
if (_parent._parent[arrayName][tower.tower._currentframe][0] == undefined) {
uprice = (upower = (urange = ""));
} else {
tprice = _parent._parent[arrayName][tower.tower._currentframe][0];
uprice = "+" + tprice;
upgrade.price = "UPGRADE FOR " + tprice;
upower = "+" + (_parent._parent[arrayName][tower.tower._currentframe][1] - _parent._parent[arrayName][tower.tower._currentframe - 1][1]);
urange = "+" + (_parent._parent[arrayName][tower.tower._currentframe][2] - _parent._parent[arrayName][tower.tower._currentframe - 1][2]);
}
power = _parent._parent[arrayName][tower.tower._currentframe - 1][1];
range = _parent._parent[arrayName][tower.tower._currentframe - 1][2];
price = 0;
tNum = tower.tower._currentframe - 1;
while (tNum >= 0) {
price = price + _parent._parent[arrayName][tNum][0];
tNum--;
}
if (_root.control.lvl == "") {
sellFor = price;
} else {
sellFor = Math.floor(price * 0.7);
}
sell.sell = "sell for " + sellFor;
if (_parent.money >= _parent._parent[arrayName][tower.tower._currentframe][0]) {
dim._visible = false;
} else {
dim._visible = true;
}
}
function doUpgrade() {
if ((!dim._visible) && (upgrade._visible)) {
_root.updateMoney(-_parent._parent[arrayName][tower.tower._currentframe][0]);
var _local3 = tower.tower.tower.barrel;
rot = _local3._rotation;
tower.tower.nextFrame();
_local3._rotation = rot;
tower.range_mc._xscale = (tower.range_mc._yscale = _parent._parent[arrayName][tower.tower._currentframe - 1][2] * 200);
updateInfo();
if (!_root[arrayName][tower.tower._currentframe][0]) {
upgrade._visible = false;
}
tower.tower.tower.nextFrame();
}
}
function doSell() {
_root.updateMoney(sellFor);
if (tower._currentframe == 6) {
_root.bullets["bb" + towerNum].removeMovieClip();
tower.tesla.stop();
var _local3 = 0;
while (_local3 < tower.closest_array.length) {
tower.closest_array[_local3].ePtr[tower.closest_array[_local3].n].enemy.enemy.spark._visible = false;
_local3++;
}
}
_root.tower_array.splice(tower.arrayNum, 1);
_root.towers_mc["tower" + towerNum].removeMovieClip();
var _local2 = 0;
while (_local2 < _root.tower_array.length) {
_root.tower_array[_local2].swapDepths(-1);
_root.tower_array[_local2].swapDepths(_local2);
_root.tower_array[_local2].arrayNum = _local2;
_local2++;
}
gotoAndStop (1);
}
stop();
dim.useHandCursor = false;
dim._visible = true;
tower = _parent._parent.towers_mc["tower" + towerNum];
arrayName = ("t" + tower._currentframe) + "_upgrade";
upgrade._visible = true;
if (!_parent._parent[arrayName][tower.tower._currentframe][0]) {
upgrade._visible = false;
}
sellFor = 0;
updateInfo();
this.onKeyDown = function () {
pressed = Key.getCode();
switch (pressed) {
case 85 :
doUpgrade();
break;
case 83 :
doSell();
case 37 :
if (tower.arrayNum == 0) {
newT = _root.tower_array.length - 1;
} else {
newT = tower.arrayNum - 1;
}
_root.tower_array[newT].selectTower();
break;
case 39 :
if (tower.arrayNum == (_root.tower_array.length - 1)) {
newT = 0;
} else {
newT = tower.arrayNum + 1;
}
_root.tower_array[newT].selectTower();
break;
default :
trace(pressed);
}
};
Key.addListener(this);
Symbol 612 MovieClip Frame 4
arrayName = ("t" + tType) + "_upgrade";
switch (tType) {
case 1 :
type = "Archer Tower";
comments = "Weak but fast. Ground and air.";
break;
case 2 :
type = "Catapult";
comments = ("Strong but slow. Has an area effect with a " + (_parent._parent[arrayName][0][3] * 100)) + "% chance to stun. Ground only.";
break;
case 3 :
type = "Trebuchet";
comments = "Slow to reload. Infects a small area with poison. Poison damage stacks. Ground only.";
break;
case 4 :
type = "Mage Tower";
comments = "Weak but fast. Casts slow area effect. Ground and air.";
break;
case 5 :
type = "Ballista";
comments = "Strong and fast. Air only.";
break;
case 6 :
type = "Lightning Tower";
comments = ("Constant damage, less if further from tower. Attacks five closest enemies. " + (_parent._parent[arrayName][0][3] * 100)) + "% chance to stun on first contact. Ground and air.";
break;
case 7 :
type = "Fire Tower";
comments = "Causes area of effect damage. Ground and air.";
break;
case 8 :
type = "Water Tower";
comments = "Casts slow area effect. Ground and air.";
break;
case 9 :
type = "Wind Tower";
comments = "Strong but slow, with an area effect. Air only.";
}
price = _parent._parent[arrayName][0][0];
power = _parent._parent[arrayName][0][1];
range = _parent._parent[arrayName][0][2];
Key.removeListener(this);
Symbol 612 MovieClip Frame 5
switch (clip.enemy.enemy._currentframe) {
case 1 :
etype = "Bear";
comments = "Ground unit.";
break;
case 2 :
etype = "Wolf";
comments = "Fast ground unit.";
break;
case 3 :
etype = "Wyrm";
comments = "Fast air unit.";
break;
case 4 :
etype = "Goblin";
comments = "Ground unit. Immune to slow.";
break;
case 5 :
etype = "Ogre";
comments = "Strong but slow ground unit. Immune to poison.";
break;
case 6 :
etype = "Dragon";
comments = "Strong air unit.";
}
Key.removeListener(this);
Symbol 612 MovieClip Frame 6
switch (_root.special) {
case 1 :
type = "Mage";
break;
case 2 :
type = "Warrior";
break;
case 3 :
type = "Assassin";
break;
case 4 :
type = "Druid";
}
switch (clip.enemy.enemy._currentframe) {
case 1 :
etype = "Bear";
break;
case 2 :
etype = "Wolf";
break;
case 3 :
etype = "Wyrm";
break;
case 4 :
etype = "Goblin";
break;
case 5 :
etype = "Ogre";
break;
case 6 :
etype = "Dragon";
}
Key.removeListener(this);
Symbol 612 MovieClip Frame 7
switch (_root.special) {
case 1 :
type = "Mage";
comments = "Casts a fireball for a massive area attack. Press anywhere on the map to cast to that location.";
break;
case 2 :
type = "Warrior";
comments = "Stomps the ground, and stuns and damages all enemies. Press anywhere on the map to perform skill.";
break;
case 3 :
type = "Assassin";
comments = "Damages bosses, and instantly kills any other enemy. Select an enemy and press the \"Attack\" button.";
break;
case 4 :
type = "Druid";
comments = "Icestorm that casts slow and causes area damage. Press the map where you would like to cast.";
}
comments = comments + " This skill is charged when the skill bar is full. Replenish by killing enemies.";
Key.removeListener(this);
Symbol 655 MovieClip Frame 1
stop();
Symbol 656 MovieClip Frame 1
function init() {
startY = _y;
boxHeight = lvl1._height;
dec = boxHeight / ((_root.roundTime + 1) * 24);
lvl1.swapDepths(1);
levels = [null, null, lvl1];
lvl1._y = boxHeight;
i = 3;
while (i < 9) {
levels.push(lvl1.duplicateMovieClip("lvl" + i, i));
levels[i].gotoAndStop(((i - 1) * 2) - 1);
if (levels[i]._currentframe > 12) {
levels[i].gotoAndStop(levels[i]._currentframe - 12);
}
levels[i]._y = (i - 1) * boxHeight;
i++;
}
}
function startGame() {
realY = startY;
}
function shiftScroller() {
realY = startY - (boxHeight * _parent.lvl);
levels[0].removeMovieClip();
levels.splice(0, 1);
d = this.getNextHighestDepth();
levels.push(levels[levels.length - 1].duplicateMovieClip("lvl" + d, d));
levels[levels.length - 1]._y = levels[levels.length - 1]._y + boxHeight;
boss = Number(((_parent.lvl + 6) % (_root.enemyTypes + 1)) == 0);
enemyFrame = ((_parent.lvl + 6) % _root.enemyTypes) + 1;
levels[levels.length - 1].gotoAndStop(((enemyFrame * 2) - 1) + boss);
}
init();
Symbol 659 MovieClip Frame 1
function timerUpdate() {
timer--;
_root.nRound.roundTime = timer;
if (timer == -1) {
_parent._parent.nextRound();
}
}
function startTimer() {
if (millis == 0) {
timer = _parent._parent.roundTime;
frames = timer * 24;
} else {
frames = millis;
}
onEnterFrame = function () {
if (!_root.isPaused) {
millis = 0;
with (_parent.levels) {
realY = realY - dec;
_y = realY;
}
frames--;
if ((frames % 24) == 0) {
timerUpdate();
}
} else {
millis = frames;
delete onEnterFrame;
}
};
}
millis = 0;
Symbol 667 Button
on (press) {
if (!_parent.dim._visible) {
_root.nextRound();
}
}
Symbol 669 Button
on (press) {
if (!_parent.dim._visible) {
_root.nextRound();
}
}
Symbol 670 MovieClip Frame 1
stop();
Symbol 671 MovieClip Frame 1
stop();
Symbol 672 MovieClip Frame 1
stop();
Symbol 673 MovieClip Frame 1
stop();
Symbol 674 MovieClip Frame 1
stop();
Symbol 675 MovieClip Frame 1
stop();
Symbol 676 MovieClip Frame 1
stop();
Symbol 677 MovieClip Frame 1
stop();
Symbol 680 MovieClip Frame 1
superbar._xscale = 0;
Symbol 681 MovieClip Frame 1
stop();
Symbol 682 MovieClip Frame 1
stop();
Symbol 683 MovieClip Frame 1
stop();
Symbol 690 Button
on (press) {
_root.isPaused = true;
}
Symbol 695 MovieClip Frame 1
stop();
Symbol 715 Button
on (press) {
_root.game.startGame();
prevFrame();
}
Symbol 718 Button
on (press) {
_root.restartGame();
}
Symbol 722 Button
on (press) {
_root.restartGame();
}
Symbol 723 MovieClip Frame 1
stop();
if (!init) {
dim._visible = false;
init = true;
}
Instance of Symbol 659 MovieClip "timer" in Symbol 723 MovieClip Frame 1
on (press) {
_root.interval = _root.setInterval(_root.clearInterval(_root.interval), 999999999);
}
Instance of Symbol 671 MovieClip "t7" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 672 MovieClip "t1" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 673 MovieClip "t2" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 674 MovieClip "t3" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 675 MovieClip "t4" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 676 MovieClip "t5" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 677 MovieClip "t10" in Symbol 723 MovieClip Frame 1
on (press) {
_root.targetEnemy();
f = _root.control.control._currentframe;
_root.cancelCursor();
if ((f == 5) && (_root.special == 3)) {
_root.control.control.clip.enemy.enemy.enemy.enemy.gotoAndStop(3);
_root.control.control.gotoAndStop(6);
} else {
_root.control.control.gotoAndStop(7);
}
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
if ((f == 5) && (_root.special == 3)) {
_parent.control.gotoAndStop(6);
} else {
_parent.control.gotoAndStop(7);
}
gotoAndStop (2);
}
on (rollOut) {
if (!_root.crosshairs) {
_parent.control.gotoAndStop(1);
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 681 MovieClip "t6" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 682 MovieClip "t8" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 683 MovieClip "t9" in Symbol 723 MovieClip Frame 1
on (press) {
_root.cancelTarget();
_parent._parent.placeTower(Number(_name.charAt(1)));
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
on (rollOver) {
if ((!_root.cursor) && (!_root.crosshairs)) {
if (_parent.control.clip.enemy.enemy.enemy.enemy._currentframe == 2) {
_parent.control.clip.enemy.enemy.enemy.enemy.prevFrame();
}
_root.deselectTower();
_parent.control.tType = Number(_name.charAt(1));
_parent.control.gotoAndStop(4);
}
gotoAndStop (2);
}
on (rollOut) {
if ((!_root.cursor) && (!_root.crosshairs)) {
_root.deselectTower();
}
gotoAndStop (1);
}
on (release) {
gotoAndStop (1);
}
on (releaseOutside) {
gotoAndStop (1);
}
Instance of Symbol 695 MovieClip "mute_btn" in Symbol 723 MovieClip Frame 1
on (press) {
if (_currentframe == 1) {
gotoAndStop (2);
} else {
gotoAndStop (1);
}
}
Symbol 723 MovieClip Frame 2
_root.cancelTarget();
_root.deselectTower();
Instance of Symbol 700 MovieClip "dim" in Symbol 723 MovieClip Frame 2
on (press) {
}
onClipEvent (load) {
this.useHandCursor = false;
}
Symbol 723 MovieClip Frame 3
_root.cancelTarget();
_root.deselectTower();
Key.removeListener(_root);
Symbol 733 Button
on (release) {
getURL ("http://www.duels.com", "_blank", "POST");
}
Symbol 751 Button
on (press) {
_root.nextFrame();
}
Symbol 753 MovieClip Frame 1
function startGame() {
_root.isPaused = false;
unpauseEnemies();
unpauseTowers();
unpauseBullets();
unpauseSpecials();
_root.control.superbar.superbar.play();
if (_root.control.lvl != "") {
_root.control.timer.startTimer();
}
onEnterFrame = function () {
if (_root.isPaused) {
if (_root.control.lives > 0) {
_root.control.gotoAndStop(2);
} else {
_root.control.gotoAndStop(3);
}
_root.cancelTarget();
pauseEnemies();
pauseTowers();
pauseBullets();
pauseSpecials();
_root.control.superbar.superbar.stop();
delete onEnterFrame;
} else {
moveEnemies();
moveTowers();
moveBullets();
}
};
}
function pauseSpecials() {
_root.map.quake.stop();
_root.assassin.stop();
_root.icestorm.stop();
_root.mage_fireball.stop();
_root.mage_fireball.fire.stop();
}
function unpauseSpecials() {
if (_root.map.quake._currentframe != 1) {
_root.map.quake.play();
}
_root.assassin.play();
_root.icestorm.play();
_root.mage_fireball.fire.play();
if (_root.mage_fireball._currentframe != 1) {
_root.mage_fireball.play();
}
}
function moveEnemies() {
alive = false;
for (e in _root.ground_array) {
if (_root.ground_array[e].alive) {
_root.ground_array[e].enemy.moveEnemy();
alive = true;
}
}
for (e in _root.air_array) {
if (_root.air_array[e].alive) {
alive = true;
_root.air_array[e].enemy.moveEnemy();
}
}
if (!alive) {
_root.control.dim._visible = false;
}
}
function moveTowers() {
var _local2 = 0;
while (_local2 < _root.tower_array.length) {
_root.tower_array[_local2].enableTower();
_local2++;
}
}
function moveBullets() {
for (b in _root.bullet_array) {
if (!_root.bullet_array[b]) {
delete _root.bullet_array[b];
} else if (_root.bullet_array[b].alive != false) {
_root.bullet_array[b].moveBullet();
}
}
}
function pauseBullets() {
for (b in _root.bullet_array) {
_root.bullet_array[b].pauseBullet();
}
}
function unpauseBullets() {
for (b in _root.bullet_array) {
_root.bullet_array[b].unpauseBullet();
}
}
function pauseTowers() {
var _local2 = 0;
while (_local2 < _root.tower_array.length) {
_root.tower_array[_local2].pauseTower();
_local2++;
}
}
function unpauseTowers() {
var _local2 = 0;
while (_local2 < _root.tower_array.length) {
_root.tower_array[_local2].unpauseTower();
_local2++;
}
}
function pauseEnemies() {
for (e in _root.ground_array) {
_root.ground_array[e].enemy.enemy.enemy.enemy.enemy.pauseEnemy();
_root.ground_array[e].enemy.enemy.enemy.stop();
_root.ground_array[e].enemy.enemy.worth.stop();
_root.ground_array[e].enemy.enemy.spark.spark.stop();
}
for (e in _root.air_array) {
_root.air_array[e].enemy.enemy.enemy.enemy.enemy.pauseEnemy();
_root.air_array[e].enemy.enemy.enemy.stop();
_root.air_array[e].enemy.enemy.worth.stop();
_root.air_array[e].enemy.enemy.spark.spark.stop();
}
}
function unpauseEnemies() {
for (e in _root.ground_array) {
_root.ground_array[e].enemy.enemy.enemy.enemy.enemy.unpauseEnemy();
if (!_root.ground_array[e].alive) {
if (_root.ground_array[e].enemy.enemy.enemy._currentframe != _root.ground_array[e].enemy.enemy.enemy._totalframes) {
_root.ground_array[e].enemy.enemy.enemy.play();
}
_root.ground_array[e].enemy.enemy.worth.play();
}
_root.ground_array[e].enemy.enemy.spark.spark.play();
}
for (e in _root.air_array) {
_root.air_array[e].enemy.enemy.enemy.enemy.enemy.unpauseEnemy();
if (!_root.air_array[e].alive) {
if (_root.air_array[e].enemy.enemy.enemy._currentframe != _root.air_array[e].enemy.enemy.enemy._totalframes) {
_root.air_array[e].enemy.enemy.enemy.play();
}
_root.air_array[e].enemy.enemy.worth.play();
}
_root.air_array[e].enemy.enemy.spark.spark.play();
}
}
startGame();