Combined Code
frame 1 {
function executeCallback() {
if (_root.hasGameStarted) {
if (_root.count >= _root.maxCount) {
_root.newLevel();
_root.count = 1;
}
if (_root.wave - 1 < _root.waves.length) {
++_root.count;
}
}
}
function towerInfo(tower) {
_root.instructions._visible = false;
_root.selectedTower = tower;
_root.ranger._x = tower._x;
_root.ranger._y = tower._y;
_root.ranger._width = tower.range * 2;
_root.ranger._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.upgrades.length >= tower.level) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0];
_root.UpgradeTowerInfo.TowerInfoText.text = 'Damage: ' + tower.damage + '\rRange: ' + tower.range + '\rSplash: ' + (tower.splash ? 'Yes' : 'No') + '\rSlow: ' + (tower.slow ? 'Yes' : 'No') + '\rPoison: ' + (tower.poison ? 'Yes' : 'No');
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = 'Upgrade $' + tower.upgrades[tower.level - 1][1];
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.f.text = '';
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.h.text = '';
}
}
function newLevel() {
++_root.wave;
updateInfoBar();
if (_root.wave - 1 < _root.waves.length - 1) {
_root.inGameMessage('<b>Start Wave: ' + _root.wave + ' - Enemy Health: ' + _root.waves[_root.wave - 1][1] + ' </b>');
_root['spawnInterval' + _root.wave] = setInterval(_root, 'spawn', _root.waves[_root.wave - 1][3], _root.wave, 'creep1', _root.waves[_root.wave - 1][2], _root.waves[_root.wave - 1][1], _root.waves[_root.wave - 1][4]);
_root['creepEventInterval' + _root.wave] = setInterval(_root, 'creepEvent', 500);
_root['spawned' + _root.wave] = _root.waves[_root.wave - 1][0];
} else {
if (_root.creepCount <= 0) {
_root.inGameMessage('<font color=\'#0000FF\'>Great Job! You did, you saved us all!</font>');
}
}
updateScore();
}
function creepEvent() {
i = 0;
while (i <= _root.creepArray.length) {
if ('' + _root.creepArray[i] != '') {
if (_root.creepArray[i].poison > 0) {
_root.creepArray[i].health -= _root.creepArray[i].poison * _root.creepArray[i].health / 100;
--_root.creepArray[i].poison;
}
}
++i;
}
}
function spawn(level, creep, speed, health, gold) {
if (_root['spawned' + level] == 0) {
clearInterval(_root['spawnInterval' + level]);
} else {
--_root['spawned' + level];
++_root.creepCount;
_root[creep].duplicateMovieClip('c' + _root.creepCount, 1000 + _root.creepCount);
c = _root['c' + _root.creepCount];
_root.creepArray[_root.creepArray.length] = c;
c.creep.gotoAndStop(level);
c._x = wp1._x;
c._y = wp1._y;
c.speed = speed;
c.maxspeed = speed;
c.targ = 2;
c.rnd = random(10);
c.health = health;
c.maxHealth = health;
c.isDead = 0;
c.gold = gold;
c.onEnterFrame = function () {
if (this.health <= 0) {
_root.kill(this);
}
if (this.speed < this.maxspeed) {
this.speed += 0.1;
}
this.targX = _root['wp' + this.targ]._x - 5 + this.rnd;
this.targY = _root['wp' + this.targ]._y - 5 + this.rnd;
this.dir = Math.atan2(this.targY - this._y, this.targX - this._x) * 180 / 3.141593;
this.r = this.dir + Math.sin((getTimer() + this.rnd * 100) / 100) * 7;
if (this.creep._rotation + 10 < this.r) {
this.creep._rotation += 10;
} else {
if (this.creep._rotation - 10 > this.r) {
this.creep._rotation -= 10;
} else {
this.creep._rotation = r;
}
}
this.rads = this.dir * 3.141593 / 180;
this._x += Math.cos(this.rads) * this.speed;
this._y += Math.sin(this.rads) * this.speed;
d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2));
if (d < 5) {
++this.targ;
if (this.targ > 14) {
_root.leak(this);
}
}
this.health_bar.health._width = (30 / this.maxHealth) * this.health;
this.health_bar._visible = true;
};
}
}
function Explosion(type, x, y) {
i = 1;
while (i <= 10) {
++_root.explosionCount;
duplicateMovieClip(_root[type + '_explosion'], 'explosion' + _root.explosionCount, 4900 + _root.explosionCount);
a = _root['explosion' + _root.explosionCount];
a._x = x;
a._y = y;
a.rads = random(360);
a.speed = (5 + random(20)) / 5;
a._rotation = a.rads;
a.onEnterFrame = function () {
this._x += Math.cos(this.rads) * this.speed;
this._y += Math.sin(this.rads) * this.speed;
this._alpha -= 5;
if (this.speed > 0.5) {
this.speed -= 0.5;
}
if (this._alpha <= 0) {
this.removeMovieClip();
}
};
++i;
}
if (_root.explosionCount > 100) {
_root.explosionCount = 0;
}
}
function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) {
++_root.particleCount;
_root[projectile].duplicateMovieClip('p' + _root.particleCount, 2000 + _root.particleCount);
r = _root['p' + _root.particleCount];
dir = Math.atan2(from._y - to._y, from._x - to._x) * 180 / 3.141593;
rads = dir * 3.141593 / 180;
r._x = from._x;
r._y = from._y;
r._x -= Math.cos(rads) * (from._width / 2);
r._y -= Math.sin(rads) * (from._height / 2);
r.targ = to;
if ('' + to == '') {
r.removeMovieClip();
}
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.projectile = projectile;
r.damage = damage;
r.splash = splash;
r.slow = slow;
r.poison = poison;
r.onEnterFrame = function () {
if ('' + this.targ != '') {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else {
if ('' + this.targX == 'undefined') {
this.removeMovieClip();
}
}
this.dir = Math.atan2(this.targY - this._y, this.targX - this._x) * 180 / 3.141593;
this._rotation = this.dir + 90;
this.rads = this.dir * 3.141593 / 180;
this._x += Math.cos(this.rads) * this.speed;
this._y += Math.sin(this.rads) * this.speed;
if (this.speed < this.maxspeed) {
this.speed += this.acc;
}
d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2));
if (d < 10) {
Explosion(projectile, this._x, this._y);
if (this.slow > 0) {
this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow);
}
if (this.poison > 0) {
this.targ.poison = this.poison;
}
if (this.splash > 0) {
i = 0;
while (i <= _root.creepArray.length) {
if ('' + _root.creepArray[i] != '' && _root.creepArray[i] != this.targ) {
d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2));
if (d < this.splash) {
_root.creepArray[i].health -= this.damage * (1 - d / this.splash);
if (this.slow > 0) {
_root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow);
}
if (this.poison > 0) {
_root.creepArray[i].poison = int(this.poison * (d / this.splash));
}
}
}
++i;
}
}
this.targ.health -= this.damage;
if (targ.health <= 0) {
targ.isDead = 1;
}
this.removeMovieClip();
}
if (_root.particleCount > 50) {
_root.particleCount = 0;
}
};
}
function kill(creep) {
++_root.kills;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
}
creep.onEnterFrame = function () {
_root.gold += creep.gold;
updateScore();
updateInfoBar();
this.removeMovieClip();
};
}
function leak(creep) {
++_root.creepLeaks;
_root.gold -= 1;
updateScore();
updateInfoBar();
creep._x = _root.wp0._x;
creep._y = _root.wp0._y;
creep.targ = 1;
}
function updateScore() {
var v3 = _root.gold;
var v2 = 1;
while (v2 <= _root.towerCount) {
b = _root['t' + v2];
if ('' + b != 'undefined') {
v3 += b.cost;
}
++v2;
}
_root.score += v3;
}
function upgrade() {
a = _root.selectedTower;
b = a.level - 1;
if (int(a.upgrades[b][1]) <= _root.gold) {
a.damage = int(a.upgrades[b][2]);
a.range = a.upgrades[b][3];
a.rate = a.upgrades[b][4];
a.splash = a.upgrades[b][5];
a.slow = a.upgrades[b][6];
a.cost += int(a.upgrades[b][1]);
++a.level;
_root.towerInfo(_root.selectedTower);
_root.gold -= int(a.upgrades[b][1]);
updateInfoBar();
}
updateScore();
}
function updateInfoBar() {
_root.InfoBar.GoldAmount.text = _root.gold + ' $';
_root.InfoBar.ScoreAmount.text = _root.score;
}
function inGameMessage(n) {
_root.ingame_message.htmlText = n + '<br>' + _root.ingame_message.htmlText;
_root.ingame_message.vPosition = _root.ingame_message.maxVPosition;
}
stop();
_root.waves = [[1, 50, 6.5, 2000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 200, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 4000, 2], [1, 500, 2.5, 2000, 50], [10, 350, 2.5, 2000, 4], [10, 450, 3.5, 4000, 4], [10, 550, 2.5, 200, 4], [10, 650, 1.5, 2000, 4], [10, 750, 3.5, 4000, 4], [1, 1200, 3.5, 4000, 100], [10, 950, 2.5, 2000, 8], [10, 1150, 3.5, 4000, 8], [10, 1350, 2.5, 200, 8], [10, 1550, 1.5, 2000, 8], [10, 1750, 3.5, 4000, 8], [3, 2700, 2.5, 200, 150], [10, 2150, 2.5, 2000, 8], [10, 2550, 3.5, 4000, 8], [10, 2950, 2.5, 200, 8], [10, 3350, 1.5, 2000, 8], [10, 3850, 3.5, 4000, 8], [1, 5500, 1.5, 4000, 300], [10, 4650, 2.5, 2000, 8], [10, 5450, 3.5, 4000, 8], [10, 6250, 2.5, 200, 8], [10, 7050, 1.5, 2000, 8], [10, 7850, 3.5, 4000, 8], [1, 11500, 3.5, 4000, 500], [10, 9450, 2.5, 2000, 16], [10, 11050, 3.5, 4000, 16], [10, 12650, 2.5, 200, 16], [10, 14250, 1.5, 2000, 16], [10, 15850, 3.5, 4000, 16], [1, 30450, 1, 4000, 1000]];
_root.wave = 0;
_root.hasGameStarted = false;
_root.towerCount = 0;
_root.selectedTower = '';
_root.creepCount = 0;
_root.creepArray = [];
_root.creepLeaks = 0;
_root.explosionCount = 0;
_root.particleCount = 0;
_root.kills = 0;
_root.gold = 50;
_root.count = 1;
_root.maxCount = 40;
_root.updateDuration = 2;
_root.score = 0;
if (!_root.hasGameStarted) {
return undefined;
}
if (_root.wave >= 0 && _root.wave - 1 <= _root.waves.length - 1) {
_root.count = 1;
_root.newLevel();
}
}
movieClip 2 {
}
instance deselect of movieClip 2 {
onClipEvent (press) {
_root.selectedTower = '';
_root.ranger._x = 3000;
_root.ranger._width = 10;
_root.ranger._height = 10;
_root.UpgradeTowerInfo._visible = false;
}
}
movieClip 6 {
}
movieClip 9 {
}
movieClip 12 {
}
movieClip 15 {
}
movieClip 18 {
}
movieClip 26 {
}
movieClip 28 {
}
movieClip 29 {
}
// unknown tag 88 length 73
movieClip 33 {
frame 2 {
stop();
}
}
movieClip 36 {
}
movieClip 39 {
}
// unknown tag 88 length 67
movieClip 46 {
}
instance info_message of movieClip 46 {
onClipEvent (load) {
_visible = false;
}
}
movieClip 49 {
}
instance marker of movieClip 49 {
onClipEvent (load) {
active = 0;
}
onClipEvent (enterFrame) {
if (active == 1) {
_x = int(_root._xmouse / 50) * 50 + 25;
_y = int(_root._ymouse / 50) * 50 + 25;
hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1);
if (hitTestOnGrassMovieClip) {
gotoAndStop(1);
_root.ranger.gotoAndStop(1);
} else {
gotoAndStop(2);
_root.ranger.gotoAndStop(2);
}
_root.ranger._x = _x;
_root.ranger._y = _y;
_root.ranger._width = _root['tower_' + tower].range * 2;
_root.ranger._height = _root['tower_' + tower].range * 2;
}
}
onClipEvent (press) {
hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1);
hitTestOnDeSelectMovieClip = _root.deselect.hitTest(_x, _y, 1);
if (hitTestOnGrassMovieClip || hitTestOnDeSelectMovieClip) {
if (hitTestOnGrassMovieClip) {
++_root.towerCount;
_root['tower_' + tower].duplicateMovieClip('t' + _root.towerCount, 500 + _root.towerCount);
a = _root['t' + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
a.cost = cost;
_root.gold -= cost;
_root.updateInfoBar();
if (!_root.hasGameStarted) {
_root.newLevel();
_root.hasGameStarted = true;
_root.instructions2._visible = false;
}
}
active = 0;
_x = 1000;
_root.selectedTower = '';
_root.ranger._x = 1000;
_root.ranger._width = 10;
_root.ranger._height = 10;
}
}
}
movieClip 52 {
frame 1 {
stop();
}
}
movieClip 55 {
}
instance tower_cannon of movieClip 55 {
onClipEvent (load) {
title = 'Cannon Tower [Cost: $15]';
desc = 'Medium attack speed with high damage and a high range';
type = 'Normal';
cost = 0;
range = 120;
rate = 5;
lastFire = rate;
lastChecked = rate;
creep = '';
target = 0;
damage = 15;
splash = 0;
slow = 0;
poison = 0;
level = 1;
upgrades = [['Damage: 40\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r', 20, 40, 120, 5, 0, 0, 0], ['Damage: 75\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r', 30, 75, 120, 5, 0, 0, 0], ['Damage: 150\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r', 55, 150, 120, 5, 0, 0, 0], ['Damage: 250\rRange: 120\rSplash:Yes\rSlow:No\rPoison:No\r', 85, 250, 120, 5, 40, 0, 0]];
}
onClipEvent (press) {
_root.towerInfo(this);
}
onClipEvent (enterFrame) {
if (active == 1 && _root.creepArray.length > 0) {
++lastChecked;
if (lastChecked >= rate) {
lastChecked = 0;
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2));
if (d < range) {
target = 1;
creep = _root.creepArray[i];
break;
}
++i;
}
} else {
if ('' + creep == '') {
target = 0;
} else {
d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2));
if (d > range) {
lastChecked = 999;
target = 0;
} else {
_rotation = Math.atan2(creep._y - this._y, creep._x - this._x) * 180 / 3.141593;
_root.fire(this, creep, 10, 1, 10, 'projectile_cannonball', damage, splash, slow);
}
}
}
}
}
}
}
movieClip 58 {
}
movieClip 60 {
}
movieClip 62 {
}
movieClip 64 {
}
movieClip 67 {
}
movieClip 68 {
}
movieClip 71 {
}
movieClip 72 {
}
movieClip 75 {
}
movieClip 76 {
}
instance tower_water of movieClip 76 {
onClipEvent (load) {
title = 'WaterTower [Cost: $30]';
desc = 'Fast attack speed with low damage and low range, but can cause nearby enemies to slow and can be upgraded to do splash damage';
type = 'Ground + Splash + Slow';
cost = 0;
range = 80;
rate = 2;
lastFire = rate;
lastChecked = rate;
creep = '';
target = 0;
damage = 2;
splash = 10;
slow = 25;
poison = 0;
level = 1;
upgrades = [['Damage: 5\rRange: 80\rSplash:Yes\rSlow:Yes\rPoison:No\r', 35, 5, 80, 2, 10, 40, 0], ['Damage: 10\rRange: 80\rSplash:Yes\rSlow:Yes\rPoison:No\r', 70, 10, 80, 2, 20, 60, 0], ['Damage: 16\rRange: 80\rSplash:Yes\rSlow:Yes\rPoison:No\r', 90, 16, 80, 2, 30, 65, 0], ['Damage: 25\rRange: 80\rSplash:Yes\rSlow:Yes\rPoison:No\r', 115, 25, 80, 2, 40, 70, 0]];
}
onClipEvent (press) {
_root.towerInfo(this);
}
onClipEvent (enterFrame) {
if (active == 1 && _root.creepArray.length > 0) {
++lastChecked;
if (lastChecked >= rate) {
lastChecked = 0;
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2));
if (d < range) {
target = 1;
creep = _root.creepArray[i];
break;
}
++i;
}
} else {
if ('' + creep == '') {
target = 0;
} else {
d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2));
if (d > range) {
lastChecked = 999;
target = 0;
} else {
_rotation = Math.atan2(creep._y - this._y, creep._x - this._x) * 180 / 3.141593;
_root.fire(this, creep, 10, 1, 10, 'projectile_water', damage, splash, slow);
}
}
}
}
}
}
}
movieClip 79 {
}
instance tower_fire of movieClip 79 {
onClipEvent (load) {
title = 'Fire Tower [Cost: $40]';
desc = 'Fast attack speed with moderate damage and low range, but can cause splash damage to nearby enemies';
type = 'Ground + Splash';
cost = 0;
range = 80;
rate = 2;
lastFire = rate;
lastChecked = rate;
creep = '';
target = 0;
damage = 5;
splash = 40;
slow = 0;
poison = 0;
level = 1;
upgrades = [['Damage: 11\rRange: 80\rSplash:Yes\rSlow:No\rPoison:No\r', 45, 11, 80, 2, 50, 0, 0], ['Damage: 20\rRange: 80\rSplash:Yes\rSlow:No\rPoison:No\r', 75, 20, 80, 2, 60, 0, 0], ['Damage: 35\rRange: 80\rSplash:Yes\rSlow:No\rPoison:No\r', 95, 35, 80, 2, 60, 0, 0], ['Damage: 60\rRange: 80\rSplash:Yes\rSlow:Yes\rPoison:No\r', 125, 60, 80, 2, 60, 20, 3]];
}
onClipEvent (press) {
_root.towerInfo(this);
}
onClipEvent (enterFrame) {
if (active == 1 && _root.creepArray.length > 0) {
++lastChecked;
if (lastChecked >= rate) {
lastChecked = 0;
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2));
if (d < range) {
target = 1;
creep = _root.creepArray[i];
break;
}
++i;
}
} else {
if ('' + creep == '') {
target = 0;
} else {
d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2));
if (d > range) {
lastChecked = 999;
target = 0;
} else {
_rotation = Math.atan2(creep._y - this._y, creep._x - this._x) * 180 / 3.141593;
_root.fire(this, creep, 10, 1, 10, 'projectile_fire', damage, splash, slow);
}
}
}
}
}
}
}
movieClip 80 {
}
instance of movieClip 80 {
onClipEvent (press) {
if (_root.gold >= 15) {
_root.marker.active = 1;
_root.marker.tower = 'cannon';
_root.marker.cost = 15;
}
_root.UpgradeTowerInfo._visible = false;
_parent.info_message._visible = false;
_root.instructions._visible = false;
}
onClipEvent (rollOver) {
_parent.info_message.title.text = _root.tower_cannon.title;
_parent.info_message.desc.text = _root.tower_cannon.desc;
_parent.info_message.type.text = _root.tower_cannon.type;
_parent.info_message._visible = true;
_root.UpgradeTowerInfo._visible = false;
_root.instructions._visible = false;
}
onClipEvent (rollOut) {
_parent.info_message._visible = false;
_root.instructions._visible = true;
_root.UpgradeTowerInfo._visible = false;
}
}
movieClip 81 {
}
instance of movieClip 81 {
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 25) {
this._visible = true;
} else {
this._visible = false;
}
}
}
instance of movieClip 75 {
onClipEvent (press) {
if (_root.gold >= 30) {
_root.marker.active = 1;
_root.marker.tower = 'water';
_root.marker.cost = 30;
}
_root.UpgradeTowerInfo._visible = false;
_parent.info_message._visible = false;
_root.instructions._visible = false;
}
onClipEvent (rollOver) {
_parent.info_message.title.text = _root.tower_water.title;
_parent.info_message.desc.text = _root.tower_water.desc;
_parent.info_message.type.text = _root.tower_water.type;
_parent.info_message._visible = true;
_root.UpgradeTowerInfo._visible = false;
_root.instructions._visible = false;
}
onClipEvent (rollOut) {
_parent.info_message._visible = false;
_root.instructions._visible = true;
}
}
movieClip 82 {
}
instance of movieClip 82 {
onClipEvent (press) {
if (_root.gold >= 40) {
_root.marker.active = 1;
_root.marker.tower = 'fire';
_root.marker.cost = 40;
}
_root.UpgradeTowerInfo._visible = false;
_parent.info_message._visible = false;
_root.instructions._visible = false;
}
onClipEvent (rollOver) {
_parent.info_message.title.text = _root.tower_fire.title;
_parent.info_message.desc.text = _root.tower_fire.desc;
_parent.info_message.type.text = _root.tower_fire.type;
_parent.info_message._visible = true;
_root.UpgradeTowerInfo._visible = false;
_root.instructions._visible = false;
}
onClipEvent (rollOut) {
_parent.info_message._visible = false;
_root.instructions._visible = true;
}
}
movieClip 83 {
}
instance of movieClip 83 {
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 40) {
this._visible = true;
} else {
this._visible = false;
}
}
}
movieClip 84 {
}
instance of movieClip 84 {
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 30) {
this._visible = true;
} else {
this._visible = false;
}
}
}
movieClip 87 {
}
movieClip 88 {
}
instance tower_poison of movieClip 88 {
onClipEvent (load) {
title = 'Poison Tower [Cost: $25]';
desc = 'Fast attack speed with medium damage and low range, but can cause residual poison damage';
type = 'Ground + Poison';
cost = 0;
range = 60;
rate = 8;
lastFire = rate;
lastChecked = rate;
creep = '';
target = 0;
damage = 1;
splash = 0;
slow = 0;
poison = 3;
level = 1;
upgrades = [['Damage: 2\rRange: 80\rSplash:No\rSlow:No\rPoison:Yes\r', 50, 2, 80, 8, 0, 0, 5], ['Damage: 3\rRange: 80\rSplash:No\rSlow:No\rPoison:Yes\r', 150, 3, 80, 8, 0, 7], ['Damage: 4\rRange: 80\rSplash:No\rSlow:No\rPoison:Yes\r', 300, 4, 80, 8, 0, 9], ['Damage: 5\rRange: 80\rSplash:Yes\rSlow:No\rPoison:Yes\r', 700, 5, 80, 8, 0, 11]];
}
onClipEvent (press) {
_root.towerInfo(this);
}
onClipEvent (enterFrame) {
if (active == 1 && _root.creepArray.length > 0) {
++lastChecked;
if (lastChecked >= rate) {
lastChecked = 0;
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2));
if (d < range) {
target = 1;
creep = _root.creepArray[i];
break;
}
++i;
}
} else {
if ('' + creep == '') {
target = 0;
} else {
d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2));
if (d > range) {
lastChecked = 999;
target = 0;
} else {
_rotation = Math.atan2(creep._y - this._y, creep._x - this._x) * 180 / 3.141593;
_root.fire(this, creep, 10, 1, 10, 'projectile_poison', damage, splash, slow, poison);
}
}
}
}
}
}
}
instance of movieClip 87 {
onClipEvent (press) {
if (_root.gold >= 30) {
_root.marker.active = 1;
_root.marker.tower = 'poison';
_root.marker.cost = 30;
}
_root.UpgradeTowerInfo._visible = false;
_parent.info_message._visible = false;
_root.instructions._visible = false;
}
onClipEvent (rollOver) {
_parent.info_message.title.text = _root.tower_poison.title;
_parent.info_message.desc.text = _root.tower_poison.desc;
_parent.info_message.type.text = _root.tower_poison.type;
_parent.info_message._visible = true;
_root.UpgradeTowerInfo._visible = false;
_root.instructions._visible = false;
}
onClipEvent (rollOut) {
_parent.info_message._visible = false;
_root.instructions._visible = true;
}
}
movieClip 89 {
}
instance of movieClip 89 {
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 30) {
this._visible = true;
} else {
this._visible = false;
}
}
}
movieClip 90 {
}
movieClip 93 {
}
movieClip 96 {
}
instance instructions of movieClip 96 {
onClipEvent (load) {
this.useHandCursor = false;
_root.instructions._visible = true;
}
}
movieClip 99 {
}
instance instructions2 of movieClip 99 {
onClipEvent (load) {
this.useHandCursor = false;
_root.instructions2._visible = true;
}
}
movieClip 102 {
}
instance of movieClip 102 {
onClipEvent (load) {
clearInterval(_root.levelInterval);
_root.levelInterval = setInterval(_root, 'executeCallback', 1000);
}
}
movieClip 105 {
}
movieClip 109 {
}
movieClip 114 {
}
movieClip 115 {
instance UpgradeButton of movieClip 114 {
onClipEvent (press) {
_root.upgrade();
}
}
}
instance UpgradeTowerInfo of movieClip 115 {
onClipEvent (load) {
_visible = false;
swapDepths(100000);
clearInterval(_root.levelInterval);
_root.levelInterval = setInterval(_root, 'executeCallback', 1000);
if (_root.wave >= 0 && _root.wave - 1 <= _root.waves.length - 1) {
_root.count = 1;
_root.newLevel();
}
}
}
movieClip 129 {
}
movieClip 130 {
}