Frame 46
gotoAndPlay ("intro");
Frame 47
stop();
shooter = true;
whichmode = "Auto Aim";
game.onRelease = function () {
gotoAndStop ("game");
};
instructions.onRelease = function () {
gotoAndStop ("instructions");
};
mouseaim.onRelease = function () {
shooter = false;
whichmode = "Mouse Aim";
};
autoaim.onRelease = function () {
shooter = true;
whichmode = "Auto Aim";
};
Frame 51
menu.onRelease = function () {
gotoAndStop ("menu");
};
nextb.onRelease = function () {
gotoAndStop ("instructions 2");
};
Frame 53
airpoints._x = base._x;
waterpoints._x = base._x;
firepoints._x = base._x;
airpoints._y = base._y;
waterpoints._y = base._y;
firepoints._y = base._y;
airpoints.gotoAndStop(4);
firepoints.gotoAndStop(5);
waterpoints.gotoAndStop(4);
menu.onRelease = function () {
gotoAndStop ("menu");
};
nextb.onRelease = function () {
gotoAndStop ("instructions 3");
};
Frame 55
menu.onRelease = function () {
gotoAndStop ("menu");
};
Frame 57
delay = 40;
Ecounter = 0;
enemy = 0;
totalEnemies = 20;
newEnemy = 1;
total = 0;
towers = 0;
bullets = 0;
totalBullets = 10 * towers;
newBullet = 0;
b1.notputdown = true;
lives = 10;
divisor = lives / 5;
gold = 60;
reps = 0;
wave = 1;
wavecounter = 0;
pausegame = true;
mines = 0;
notputdownmine = 0;
explosions = 0;
topExplosions = 3;
notPutDownElement = "none";
wavefire = 0;
wavewater = 0;
waveair = 0;
towerPrice = 20;
elementPrice = 10;
landMinePrice = 2;
backdrop.gotoAndStop(5);
lands = 11;
phases = 1;
map = 1;
mod = 20;
map1phase1 = 143.2;
map1phase2 = 122 - mod;
map1phase3 = 90.5 - mod;
map1phase4 = 190.8 - mod;
map1phase5 = 148.2 - mod;
map1phase6 = 244.9 - mod;
map1phase7 = 84.6 - mod;
map1phase8 = 108.8 - mod;
map1phase9 = 193.7 - mod;
map1phase10 = 169.3 - mod;
map1phase11 = 148.2 - mod;
nextWave = "Fire";
stop();
unpause.onRelease = function () {
pausegame = false;
unpause._y = -100;
};
pauser.onRelease = function () {
pausegame = true;
pauser._y = -100;
};
goMenu.onRelease = function () {
reset();
gotoAndStop ("menu");
};
reset = function () {
i = 0;
while (i <= towers) {
currentT = eval ("t" + i);
currentB = eval ("b" + i);
currentT._x = -100;
currentB._x = -100;
currentT._y = -100;
currentB._y = -100;
currentT = eval ("f" + i);
currentB = eval ("w" + i);
currentT._x = -100;
currentB._x = -100;
currentT._y = -100;
currentB._y = -100;
currentT = eval ("a" + i);
currentT._x = -100;
currentT._y = -100;
i++;
}
i = 0;
while (i <= totalEnemies) {
currentT = eval ("e" + i);
currentT._x = -100;
currentT._y = -100;
currentT = eval ("bar" + i);
currentT._x = -100;
currentT._y = -100;
i++;
}
i = 0;
while (i <= mines) {
currentM = eval ("mine" + i);
currentM._x = -100;
currentM._y = -100;
i++;
}
i = 0;
while (i <= bullets) {
cB = eval ("bu" + i);
cB._x = -100;
cB._y = -100;
i++;
}
pausegame = true;
delay = 40;
Ecounter = 0;
enemy = 0;
totalEnemies = 50;
newEnemy = 1;
total = 0;
towers = 0;
bullets = 0;
totalBullets = 10 * towers;
newBullet = 0;
b1.notputdown = true;
lives = 40;
gold = 40;
reps = 0;
wave = 1;
wavecounter = 0;
pausegame = true;
mines = 0;
notputdownmine = 0;
explosions = 0;
topExplosions = 3;
notPutDownElement = "none";
};
releaseNewEnemy = function (health, speed, level, normalResistance, flameResistance, waterResistance, airResistance, type, wave) {
if (enemy < totalEnemies) {
enemy++;
newEnemy = enemy;
total++;
duplicateMovieClip (duplicateEnemy, "e" + enemy, total);
total++;
duplicateMovieClip (healthBar, "bar" + enemy, total);
currentEnemy = eval ("e" + enemy);
currentEnemy.health = health;
currentEnemy.counter = 0;
currentEnemy.phase = 1;
currentEnemy.speed = speed;
currentEnemy.level = level;
currentEnemy._x = startBlock._x;
currentEnemy._y = startBlock._y;
currentEnemy.dead = false;
if (type == "fire") {
currentEnemy.gotoAndStop("fire");
currentEnemy.barDistance = 10;
currentEnemy.flameResistance = 3;
currentEnemy.waterResistance = 0;
currentEnemy.airResistance = 1;
currentEnemy.normalResistance = 0.5;
}
if (type == "water") {
currentEnemy.gotoAndStop("water");
currentEnemy.barDistance = 10;
currentEnemy.flameResistance = 0;
currentEnemy.waterResistance = 3;
currentEnemy.airResistance = 1;
currentEnemy.normalResistance = 0.5;
}
if (type == "air") {
currentEnemy.gotoAndStop("air");
currentEnemy.barDistance = 10;
currentEnemy.flameResistance = 1;
currentEnemy.waterResistance = 1;
currentEnemy.airResistance = 3;
currentEnemy.normalResistance = 0;
}
if (type == "normal") {
currentEnemy.gotoAndStop("normal");
currentEnemy.barDistance = 10;
currentEnemy.flameResistance = 1;
currentEnemy.waterResistance = 1;
currentEnemy.airResistance = 0;
currentEnemy.normalResistance = 3;
}
} else {
if (newEnemy < totalEnemies) {
newEnemy++;
} else {
newEnemy = 1;
}
currentEnemy = eval ("e" + newEnemy);
currentEnemy.health = health;
currentEnemy.counter = 0;
currentEnemy.phase = 1;
currentEnemy.speed = speed;
currentEnemy.level = level;
currentEnemy._x = startBlock._x;
currentEnemy._y = startBlock._y;
currentEnemy.dead = false;
if (type == "fire") {
currentEnemy.gotoAndStop("fire");
currentEnemy.barDistance = 10;
currentEnemy.flameResistance = 3;
currentEnemy.waterResistance = 0;
currentEnemy.airResistance = 1;
currentEnemy.normalResistance = 1;
}
if (type == "water") {
currentEnemy.gotoAndStop("water");
currentEnemy.barDistance = 10;
currentEnemy.flameResistance = 0;
currentEnemy.waterResistance = 3;
currentEnemy.airResistance = 1;
currentEnemy.normalResistance = 1;
}
if (type == "air") {
currentEnemy.gotoAndStop("air");
currentEnemy.barDistance = 10;
currentEnemy.flameResistance = 1;
currentEnemy.waterResistance = 1;
currentEnemy.airResistance = 3;
currentEnemy.normalResistance = 0;
}
if (type == "normal") {
currentEnemy.gotoAndStop("normal");
currentEnemy.barDistance = 10;
currentEnemy.flameResistance = 0;
currentEnemy.waterResistance = 0;
currentEnemy.airResistance = 0;
currentEnemy.normalResistance = 0;
}
}
};
titlebanner.onEnterFrame = function () {
mousecollision._x = _root._xmouse;
mousecollision._y = _root._ymouse;
crosshair._x = _root._xmouse;
crosshair._y = _root._ymouse;
percentage = Math.ceil(lives / divisor);
backdrop.gotoAndStop(percentage);
if (lives <= 0) {
reset();
gotoAndStop ("lose");
}
if (pausegame == false) {
totalBullets = towers;
reps++;
controlBullets();
runWaves();
controlEnemies();
unpause._y = -100;
}
controlMines();
i = 0;
while (i <= towers) {
currentB = eval ("b" + i);
currentT = eval ("t" + i);
currentFlameIndicator = eval ("f" + i);
currentWaterIndicator = eval ("w" + i);
currentAirIndicator = eval ("a" + i);
if (notputdown == i) {
currentB._x = _root._xmouse;
currentB._y = _root._ymouse;
currentT._x = currentB._x;
currentT._y = currentB._y;
currentFlameIndicator._x = currentB._x;
currentFlameIndicator._y = currentB._y;
currentWaterIndicator._x = currentB._x;
currentWaterIndicator._y = currentB._y;
currentAirIndicator._x = currentB._x;
currentAirIndicator._y = currentB._y;
rangefinder._x = currentB._x;
rangefinder._y = currentB._y;
}
i++;
}
if (notputdown == -1) {
rangefinder._x = -100;
rangefinder._y = -100;
}
if (notPutDownElement == "flame") {
flameCarry = fC;
flameCarry._x = _root._xmouse;
flameCarry._y = _root._ymouse;
}
if (notPutDownElement == "water") {
waterCarry = wC;
waterCarry._x = _root._xmouse;
waterCarry._y = _root._ymouse;
}
if (notPutDownElement == "air") {
airCarry = aC;
airCarry._x = _root._xmouse;
airCarry._y = _root._ymouse;
}
if (pausegame == false) {
controlTowers();
pauser._x = Stage.width;
pauser._y = Stage.height;
} else {
pauser._y = -100;
unpause._y = Stage.height;
unpause._x = Stage.width;
}
};
controlMines = function () {
currentMine = eval ("mine" + notputdownmine);
currentMine._x = _root._xmouse - 10;
currentMine._y = _root._ymouse - 10;
};
runWaves = function () {
if (wave == 1) {
delay = 15;
wavefire = 0;
wavewater = 0;
waveair = 0;
health = 4;
speed = 2;
if (wavecounter > 10) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + (wave * 10);
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Fire";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "fire", wave);
}
}
}
if (wave == 2) {
delay = 15;
health = 4;
speed = 3;
if (wavecounter > 10) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + (wave * 10);
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Water";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "fire", wave);
}
}
}
if (wave == 3) {
delay = 15;
health = 5;
speed = 4;
if (wavecounter > 12) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 25;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Air";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "water", wave);
}
}
}
if (wave == 3) {
delay = 10;
health = 6;
speed = 4;
if (wavecounter > 12) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 35;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Fire + Earth";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "air", wave);
}
}
}
if (wave == 4) {
delay = 20;
health = 4;
speed = 4;
if (wavecounter > 12) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 35;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Water";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "fire", wave);
releaseNewEnemy(health, speed - 2, wave, 0, wavefire, wavewater, waveair, "normal", wave);
}
}
}
if (wave == 5) {
delay = 7;
health = 8;
speed = 5;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 40;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Fire";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "water", wave);
}
}
}
if (wave == 6) {
delay = 5;
health = 9;
speed = 6;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 40;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Water + Air";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "fire", wave);
releaseNewEnemy(health + 2, speed - 3, wave, 0, wavefire, wavewater, waveair, "fire", wave);
}
}
}
if (wave == 7) {
delay = 5;
health = 10;
speed = 5;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 50;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Earth + Fire";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "water", wave);
releaseNewEnemy(health + 2, speed - 3, wave, 0, wavefire, wavewater, waveair, "air", wave);
releaseNewEnemy(health + 4, speed - 6, wave, 0, wavefire, wavewater, waveair, "air", wave);
}
}
}
if (wave == 8) {
delay = 5;
health = 12;
speed = 7;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 50;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Air";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "normal", wave);
releaseNewEnemy(health + 2, speed - 3, wave, 0, wavefire, wavewater, waveair, "normal", wave);
releaseNewEnemy(health + 4, speed - 6, wave, 0, wavefire, wavewater, waveair, "fire", wave);
}
}
}
if (wave == 9) {
delay = 3;
health = 12;
speed = 9;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 50;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Earth + Water";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "air", wave);
}
}
}
if (wave == 10) {
delay = 3;
health = 10;
speed = 9;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 50;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "Fire + Air";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "normal", wave);
releaseNewEnemy(health - 2, speed + 2, wave, 0, wavefire, wavewater, waveair, "water", wave);
}
}
}
if (wave == 11) {
delay = 3;
health = 12;
speed = 9;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 60;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "All";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "fire", wave);
releaseNewEnemy(health - 2, speed + 2, wave, 0, wavefire, wavewater, waveair, "air", wave);
}
}
}
if (wave == 12) {
delay = 2;
health = 4;
speed = 1;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 60;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
nextWave = "All";
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "normal", wave);
releaseNewEnemy(health, speed + 1, wave, 0, wavefire, wavewater, waveair, "fire", wave);
releaseNewEnemy(health, speed + 2, wave, 0, wavefire, wavewater, waveair, "air", wave);
releaseNewEnemy(health, speed + 3, wave, 0, wavefire, wavewater, waveair, "normal", wave);
}
}
}
if (wave == 13) {
delay = 3;
health = 12;
speed = 10;
if (wavecounter > 20) {
allEnemiesDead = true;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
if (currentEnemy.hitTest(backdrop)) {
allEnemiesDead = false;
}
i++;
}
if (allEnemiesDead) {
wave++;
wavecounter = 0;
Ecounter = 0;
pausethegame();
gold = gold + 60;
resistanceMultiplier = wave + 1;
wavefire = Math.floor(Math.random() * resistanceMultiplier);
wavewater = Math.floor(Math.random() * resistanceMultiplier);
waveair = Math.floor(Math.random() * resistanceMultiplier);
reset();
gotoAndStop ("win");
}
} else {
Ecounter++;
if (Ecounter == delay) {
Ecounter = 0;
wavecounter++;
releaseNewEnemy(health, speed, wave, 0, wavefire, wavewater, waveair, "normal", wave);
releaseNewEnemy(health, speed + 1, wave, 0, wavefire, wavewater, waveair, "air", wave);
releaseNewEnemy(health, speed + 2, wave, 0, wavefire, wavewater, waveair, "water", wave);
releaseNewEnemy(health, speed + 3, wave, 0, wavefire, wavewater, waveair, "fire", wave);
}
}
}
};
pausethegame = function () {
pausegame = true;
i = 0;
while (i <= bullets) {
currentBullet = eval ("bu" + i);
currentBullet._x = -100;
currentBullet._y = -100;
currentBullet.dx = 0;
currentBullet.dy = 0;
i++;
}
};
controlEnemies = function () {
distance1 = 230;
i = 0;
while (i <= enemy) {
cE = eval ("e" + i);
cBar = eval ("bar" + i);
cBar.gotoAndStop(cE.health);
cBar._x = cE._x - cE.barDistance;
cBar._y = cE._y - cE.barDistance;
m = 0;
while (m <= mines) {
if (notputdownmine != m) {
currentMine = eval ("mine" + m);
if (currentMine.hitTest(cE)) {
cE.counter = 0;
cE.phase = 1;
cE.speed = 2;
cE._x = -100;
cE._y = -100;
cE.dead = true;
currentMine._x = -100;
currentMine._y = -100;
}
}
m++;
}
if (map == 1) {
if (cE.phase == 1) {
if (cE.counter < map1phase1) {
cE._rotation = 0;
cE._x = cE._x + cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = 90;
cE.phase++;
cE.counter = 0;
}
}
if (cE.phase == 2) {
if (cE.counter < map1phase2) {
cE._y = cE._y + cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = 0;
cE.phase++;
cE.counter = 0;
}
}
if (cE.phase == 3) {
if (cE.counter < map1phase3) {
cE._x = cE._x + cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = -90;
cE.phase++;
cE.counter = 0;
}
}
if (cE.phase == 4) {
if (cE.counter < map1phase4) {
cE._y = cE._y - cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = 0;
cE.phase++;
cE.counter = 0;
}
}
if (cE.phase == 5) {
if (cE.counter < map1phase5) {
cE._x = cE._x + cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = 90;
cE.phase++;
cE.counter = 0;
}
}
if (cE.phase == 6) {
if (cE.counter < map1phase6) {
cE._y = cE._y + cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = 180;
cE.phase++;
cE.counter = 0;
}
}
if (cE.phase == 7) {
if (cE.counter < map1phase7) {
cE._x = cE._x - cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = -90;
cE.counter = 0;
cE.phase++;
}
}
if (cE.phase == 8) {
if (cE.counter < map1phase8) {
cE._y = cE._y - cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = 0;
cE.counter = 0;
cE.phase++;
}
}
if (cE.phase == 9) {
if (cE.counter < map1phase9) {
cE._x = cE._x + cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = 90;
cE.counter = 0;
cE.phase++;
}
}
if (cE.phase == 10) {
if (cE.counter < map1phase10) {
cE._y = cE._y + cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
cE._rotation = 0;
cE.counter = 0;
cE.phase++;
}
}
if (cE.phase == 11) {
if (cE.counter < map1phase11) {
cE._x = cE._x + cE.speed;
cE.counter = cE.counter + cE.speed;
} else {
lives--;
cE.counter = 0;
cE.phase = 1;
cE.dead = true;
}
}
}
i++;
}
};
basicTower.onRelease = function () {
if (gold >= towerPrice) {
gold = gold - towerPrice;
towers++;
total++;
duplicateMovieClip (base, "b" + towers, total);
total++;
duplicateMovieClip (firepoints, "f" + towers, total);
total++;
duplicateMovieClip (waterpoints, "w" + towers, total);
total++;
duplicateMovieClip (airpoints, "a" + towers, total);
total++;
duplicateMovieClip (top, "t" + towers, total);
currentT = eval ("b" + towers);
currentT.pauser = 0;
currentT.lengthOfPause = 15;
currentT.launchSpeed = 10;
currentT.range = 80;
currentT.penetrate = 2;
currentT.nearest = newEnemy;
currentT.oldnearest = newEnemy - 1;
currentT.bulletType = "bullet";
currentT.level = 1;
currentT.normalDamage = 1;
currentT.flameDamage = 0;
currentT.flameLevel = 1;
currentT.waterDamage = 0;
currentT.waterLevel = 1;
currentT.airDamage = 0;
currentT.airLevel = 1;
total++;
bullets++;
duplicateMovieClip (bullet, "bu" + bullets, total);
total++;
bullets++;
duplicateMovieClip (bullet, "bu" + bullets, total);
currentBullet = eval ("bu" + bullets);
currentBullet.bulletType = "bullet";
notputdown = towers;
}
};
flamebutton.onRelease = function () {
if (gold >= elementPrice) {
gold = gold - elementPrice;
notPutDownElement = "flame";
notPutDownElementNumber = 1;
}
};
waterbutton.onRelease = function () {
if (gold >= elementPrice) {
gold = gold - elementPrice;
notPutDownElement = "water";
notPutDownElementNumber = 1;
}
};
airbutton.onRelease = function () {
if (gold >= elementPrice) {
gold = gold - elementPrice;
notPutDownElement = "air";
notPutDownElementNumber = 1;
}
};
flamebutton5.onRelease = function () {
if (gold >= (elementPrice * 5)) {
gold = gold - (elementPrice * 5);
notPutDownElement = "flame";
notPutDownElementNumber = 5;
}
};
waterbutton5.onRelease = function () {
if (gold >= (elementPrice * 5)) {
gold = gold - (elementPrice * 5);
notPutDownElement = "water";
notPutDownElementNumber = 5;
}
};
airbutton5.onRelease = function () {
if (gold >= (elementPrice * 5)) {
gold = gold - (elementPrice * 5);
notPutDownElement = "air";
notPutDownElementNumber = 5;
}
};
minebutton.onRelease = function () {
if (gold >= landMinePrice) {
gold = gold - landMinePrice;
total++;
mines++;
duplicateMovieClip (mine, "mine" + mines, total);
notputdownmine = mines;
}
};
controlTowers = function () {
i = 0;
while (i <= towers) {
currentB = eval ("b" + i);
currentT = eval ("t" + i);
currentFlameIndicator = eval ("f" + i);
currentWaterIndicator = eval ("w" + i);
currentAirIndicator = eval ("a" + i);
if (notputdown == i) {
currentB._x = _root._xmouse;
currentB._y = _root._ymouse;
currentT._x = currentB._x;
currentT._y = currentB._y;
currentFlameIndicator._x = currentB._x;
currentFlameIndicator._y = currentB._y;
rangefinder._x = currentB._x;
rangefinder._y = currentB._y;
} else {
rangefinder._x = -100;
rangefinder._y = -100;
currentT = eval ("b" + i);
currentTop = eval ("t" + i);
if (currentT != undefined) {
if (shooter) {
notFinished = true;
closest = 0;
rangeToClosest = 10000;
currentTower = eval ("b" + i);
e = 0;
while (e <= totalEnemies) {
currentEnemy = eval ("e" + e);
dx = currentEnemy._x - currentTower._x;
dy = currentEnemy._y - currentTower._y;
distance = Math.sqrt((dx * dx) + (dy * dy));
if (distance < rangeToClosest) {
closest = e;
rangeToClosest = distance;
}
e++;
}
currentTower.closest = closest;
if (rangeToClosest <= currentTower.range) {
currentTower.fire = true;
} else {
currentTower.fire = false;
}
nearestEnemy = eval ("e" + currentT.closest);
if (nearestEnemy.dead != true) {
mdx = currentT._x - nearestEnemy._x;
mdy = currentT._y - nearestEnemy._y;
radians = Math.atan(mdy / mdx);
degrees = (radians * 180) / Math.PI;
degrees = degrees + 90;
if (mdx >= 0) {
degrees = degrees - 180;
}
}
} else {
i = 0;
while (i <= towers) {
currentTower = eval ("b" + i);
currentTower.fire = true;
i++;
}
mdx = currentT._x - _root._xmouse;
mdy = currentT._y - _root._ymouse;
radians = Math.atan(mdy / mdx);
degrees = (radians * 180) / Math.PI;
degrees = degrees + 90;
if (mdx >= 0) {
degrees = degrees - 180;
}
}
currentTop._rotation = degrees;
currentFlameIndicator._rotation = degrees;
currentWaterIndicator._rotation = degrees;
currentAirIndicator._rotation = degrees;
if (currentT.pauser < currentT.lengthOfPause) {
currentT.pauser++;
}
if (currentT.pauser >= currentT.lengthOfPause) {
if (currentTower.fire) {
currentT.pauser = 0;
currentBullet = eval ("bu" + i);
currentBullet.speed = currentT.launchSpeed;
currentBullet.dx = Math.cos(radians) * currentBullet.speed;
currentBullet.dy = Math.sin(radians) * currentBullet.speed;
if (mdx >= 0) {
currentBullet.dx = currentBullet.dx * -1;
currentBullet.dy = currentBullet.dy * -1;
}
currentBullet._rotation = degrees;
currentBullet._x = currentT._x;
currentBullet._y = currentT._y;
currentBullet.range = currentT.range;
currentBullet.rangecounter = 0;
currentBullet.normalDamage = currentT.normalDamage;
currentBullet.penetrate = currentT.penetrate;
currentBullet.flameDamage = currentT.flameDamage;
currentBullet.waterDamage = currentT.waterDamage;
currentBullet.airDamage = currentT.airDamage;
if (currentT.flameDamage > currentT.waterDamage) {
if (currentT.flameDamage > currentT.airDamage) {
currentBullet.gotoAndStop("fire");
} else {
currentBullet.gotoAndStop("air");
}
} else if (currentT.waterDamage > currentT.airDamage) {
currentBullet.gotoAndStop("water");
} else {
currentBullet.gotoAndStop("air");
}
}
}
}
}
i++;
}
};
_root.onMouseDown = function () {
cantdoit = false;
currentTower = eval ("b" + notputdown);
i = 0;
while (i <= lands) {
currentLand = eval ("l" + i);
if (currentLand.hitTest(currentTower)) {
cantdoit = true;
}
i++;
}
if (panelbg.hitTest(currentTower)) {
currentTower = eval ("b" + towers);
currentTop = eval ("t" + towers);
currentTower._x = -100;
currentTower._y = -100;
currentTop._x = -100;
currentTop._y = -100;
flameIndicator = eval ("f" + towers);
flameIndicator._x = -100;
flameIndicator._y = -100;
waterIndicator = eval ("w" + towers);
waterIndicator._x = -100;
waterIndicator._y = -100;
airIndicator = eval ("a" + towers);
airIndicator._x = -100;
airIndicator._y = -100;
notputdown = -1;
towers--;
total = total - 3;
gold = gold + towerPrice;
}
if (panelbg2.hitTest(mousecollision)) {
cantdoit = true;
}
if (panelbg3.hitTest(mousecollision)) {
cantdoit = true;
}
if (panelbg4.hitTest(mousecollision)) {
cantdoit = true;
}
if (panelbg5.hitTest(mousecollision)) {
cantdoit = true;
}
if (panelbg6.hitTest(mousecollision)) {
cantdoit = true;
}
if (notPutDownElement != "none") {
if (panelbg.hitTest(mousecollision)) {
notPutDownElement = "none";
flameCarry._x = -100;
flameCarry._y = -100;
waterCarry._x = -100;
waterCarry._y = -100;
airCarry._x = -100;
airCarry._y = -100;
gold = gold + (elementPrice * notPutDownElementNumber);
}
}
i = 0;
while (i <= towers) {
if (i != notputdown) {
if (notputdown != -1) {
currentUpTower = eval ("b" + i);
if (currentUpTower != null) {
if (currentUpTower.hitTest(mousecollision)) {
if (currentUpTower.level <= 4) {
currentUpTower.level++;
currentUpTower.gotoAndStop(currentUpTower.level);
currentUpTower.penetrate = currentUpTower.penetrate + currentTower.penetrate;
currentUpTower.launchSpeed = currentUpTower.launchSpeed + (currentTower.launchSpeed / 2);
currentUpTower.range = currentUpTower.range + currentTower.range;
currentUpTower.lenghtOfPause = currentUpTower.lenghtOfPause / 2;
currentUpTower._xscale = currentUpTower._xscale + 10;
currentUpTower._yscale = currentUpTower._yscale + 10;
currentUpTower = eval ("f" + i);
currentUpTower._xscale = currentUpTower._xscale + 10;
currentUpTower._yscale = currentUpTower._yscale + 10;
currentUpTower = eval ("w" + i);
currentUpTower._xscale = currentUpTower._xscale + 10;
currentUpTower._yscale = currentUpTower._yscale + 10;
currentUpTower = eval ("a" + i);
currentUpTower._xscale = currentUpTower._xscale + 10;
currentUpTower._yscale = currentUpTower._yscale + 10;
currentUpTower = eval ("t" + i);
currentUpTower._xscale = currentUpTower._xscale + 10;
currentUpTower._yscale = currentUpTower._yscale + 10;
currentTower = eval ("b" + towers);
currentTop = eval ("t" + towers);
currentTower._x = -100;
currentTower._y = -100;
currentTop._x = -100;
currentTop._y = -100;
flameIndicator = eval ("f" + towers);
flameIndicator._x = -100;
flameIndicator._y = -100;
waterIndicator = eval ("w" + towers);
waterIndicator._x = -100;
waterIndicator._y = -100;
airIndicator = eval ("a" + towers);
airIndicator._x = -100;
airIndicator._y = -100;
notputdown = -1;
towers--;
total = total - 3;
} else {
cantdoit = true;
}
}
}
}
}
i++;
}
i = 0;
while (i <= towers) {
currentUpTower = eval ("b" + i);
if (currentUpTower != null) {
if (currentUpTower.hitTest(mousecollision)) {
if (notPutDownElement == "flame") {
notPutDownElement = "none";
flameCarry._x = -100;
flameCarry._y = -100;
currentUpTower.flameLevel = currentUpTower.flameLevel + notPutDownElementNumber;
currentUpTower.flameDamage = currentUpTower.flameDamage + notPutDownElementNumber;
currentFlameIcon = eval ("f" + i);
currentFlameIcon.gotoAndStop(currentUpTower.flameLevel);
}
if (notPutDownElement == "water") {
notPutDownElement = "none";
waterCarry._x = -100;
waterCarry._y = -100;
currentUpTower.waterLevel = currentUpTower.waterLevel + notPutDownElementNumber;
currentUpTower.waterDamage = currentUpTower.waterDamage + notPutDownElementNumber;
currentFlameIcon = eval ("w" + i);
currentFlameIcon.gotoAndStop(currentUpTower.waterLevel);
}
if (notPutDownElement == "air") {
notPutDownElement = "none";
airCarry._x = -100;
airCarry._y = -100;
currentUpTower.airLevel = currentUpTower.airLevel + notPutDownElementNumber;
currentUpTower.airDamage = currentUpTower.airDamage + notPutDownElementNumber;
currentFlameIcon = eval ("a" + i);
currentFlameIcon.gotoAndStop(currentUpTower.airLevel);
}
}
}
i++;
}
if (cantdoit == false) {
notputdown = -1;
}
closest = 0;
rangeToClosest = 10000;
i = 0;
while (i <= totalEnemies) {
currentEnemy = eval ("e" + i);
dx = currentEnemy._x - currentTower._x;
dy = currentEnemy._y - currentTower._y;
distance = Math.sqrt((dx * dx) + (dy * dy));
if (distance < rangeToClosest) {
closest = i;
rangeToClosest = distance;
}
i++;
}
currentTower.closest = closest;
cantdoit = true;
currentMine = eval ("mine" + notputdownmine);
i = 0;
while (i <= lands) {
currentLand = eval ("l" + i);
if (currentLand.hitTest(currentMine)) {
cantdoit = false;
}
i++;
}
if (currentMine.hitTest(panelbg)) {
notputdownmine = -1;
gold = gold + landMinePrice;
currentMine._x = -100;
currentMine._y = -100;
}
if (cantdoit == false) {
notputdownmine++;
}
};
explode = function (currentObject) {
total++;
if (explosions < topExplosions) {
explosions++;
duplicateMovieClip (explosion, "exp" + explosions, total);
newExplosions = explosions;
} else {
newExplosions++;
if (newExplosions < topExplosions) {
newExplosions = 1;
}
}
currentExplosion = eval ("exp" + newExplosions);
currentExplosion._x = currentObject._x;
currentExplosion._y = currentObject._y;
currentExplosion.gotoAndPlay(1);
currentObject._x = -100;
currentObject._y = -100;
};
controlBullets = function () {
i = 1;
while (i <= bullets) {
currentBullet = eval ("bu" + i);
currentBullet._y = currentBullet._y + currentBullet.dy;
currentBullet._x = currentBullet._x + currentBullet.dx;
currentBullet.rangecounter = currentBullet.rangecounter + currentBullet.speed;
if (currentBullet.rangecounter >= currentBullet.range) {
currentBullet._x = -100;
currentBullet._y = -100;
currentBullet.dx = 0;
currentBullet.dy = 0;
}
if (currentBullet.penetrate <= 0) {
currentBullet.dy = 0;
currentBullet.dx = 0;
currentBullet._x = -100;
currentBullet._y = -100;
currentBullet.penetrate = 0;
}
e = 1;
while (e <= totalEnemies) {
currentEnemy = eval ("e" + e);
if (currentBullet.hitTest(currentEnemy)) {
damage = 0;
normalDamage = currentBullet.normalDamage - currentEnemy.normalResistance;
if (normalDamage < 0) {
normalDamage = 0;
}
fireDamage = currentBullet.flameDamage - currentEnemy.flameResistance;
if (fireDamage < 0) {
fireDamage = 0;
}
waterDamage = currentBullet.waterDamage - currentEnemy.waterResistance;
if (waterDamage < 0) {
waterDamage = 0;
}
airDamage = currentBullet.airDamage - currentEnemy.airResistance;
if (airDamage < 0) {
airDamage = 0;
}
totalDamage = ((normalDamage + fireDamage) + waterDamage) + airDamage;
currentEnemy.health = currentEnemy.health - totalDamage;
currentBullet.penetrate--;
if (currentEnemy.health <= 0) {
gold = gold + 1;
currentEnemy.counter = 0;
currentEnemy.phase = 1;
currentEnemy.speed = 2;
currentEnemy._x = -1000;
currentEnemy._y = -1000;
currentEnemy.dead = true;
currentBullet.penetrate--;
go = true;
}
}
e++;
}
i++;
}
};
Frame 61
menu.onRelease = function () {
gotoAndStop ("menu");
};
Frame 66
menu.onRelease = function () {
gotoAndStop ("menu");
};
Frame 73
skip.onRelease = function () {
gotoAndStop ("menu");
};
Frame 161
skip.onRelease = function () {
gotoAndStop ("menu");
};
Frame 255
skip.onRelease = function () {
gotoAndStop ("menu");
};
Frame 304
skip.onRelease = function () {
gotoAndStop ("menu");
};
Frame 350
skip.onRelease = function () {
gotoAndStop ("menu");
};
Frame 395
skip.onRelease = function () {
gotoAndStop ("menu");
};
Frame 480
gotoAndStop ("menu");
Symbol 40 MovieClip Frame 1
stop();
Symbol 75 MovieClip Frame 1
stop();
Symbol 85 MovieClip Frame 1
stop();
Symbol 95 MovieClip Frame 1
stop();
Symbol 140 MovieClip Frame 15
this._x = -100;
this._y = -100;