Frame 2
stop();
Frame 3
function executeCallback() {
if (_root.hasGameStarted) {
if (_root.count >= _root.maxCount) {
_root.newLevel();
_root.count = 1;
}
if ((_root.wave - 1) < (_root.waves.length - 1)) {
_root.count++;
} else if (_root.currentNumberOfCreeps <= 0) {
_root.hasGameStarted = false;
_root.inGameMessage("<font color='#0000FF'>You Win. What? You Want A Reward Or Something?</font>");
}
} else {
var _local2 = 1;
while (_local2 <= _root.towerCount) {
b = _root["t" + _local2];
if (("" + b) != "undefined") {
Explosion("projectile_fire", b._x, b._y);
b.removeMovieClip();
}
_local2++;
}
}
}
function towerInfo(tower) {
_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>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];
}
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].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.currentNumberOfCreeps++;
_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 = 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 = this.creep._rotation + 10;
} else if ((this.creep._rotation - 10) > this.r) {
this.creep._rotation = this.creep._rotation - 10;
} else {
this.creep._rotation = r;
}
this.rads = (this.dir * 3.141593) / 180;
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = 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 > 11) {
_root.leak(this);
_root.updateInfoBar();
}
}
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 = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
this._alpha = this._alpha - 5;
if (this.speed > 0.5) {
this.speed = 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 = r._x - (Math.cos(rads) * (from._width / 2));
r._y = 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 = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
if (this.speed < this.maxspeed) {
this.speed = 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 = _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.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.currentNumberOfCreeps--;
_root.gold = _root.gold + creep.gold;
updateScore();
updateInfoBar();
this.removeMovieClip();
};
}
function leak(creep) {
_root.creepLeaks++;
if (!_root.hasGameFinished) {
creep._x = _root.wp0._x;
creep._y = _root.wp0._y;
creep.targ = 1;
} else {
creep.removeMovieClip();
}
_root.health--;
if (_root.health <= 0) {
_root.health = 0;
_root.hasGameStarted = false;
if (!_root.hasGameFinished) {
_root.inGameMessage("<font color='#0000FF'>You Lose! All The Children Have Been Eaten, I Hope You Are Happy.</font>");
}
_root.hasGameFinished = true;
}
}
function updateScore() {
var _local3 = _root.gold;
var _local2 = 1;
while (_local2 <= _root.towerCount) {
b = _root["t" + _local2];
if (("" + b) != "undefined") {
_local3 = _local3 + b.cost;
}
_local2++;
}
_root.score = _root.score + _local3;
}
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 = a.cost + int(a.upgrades[b][1]);
a.level++;
_root.towerInfo(_root.selectedTower);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
updateScore();
}
function updateInfoBar() {
_root.InfoBar.GoldAmount.text = _root.gold;
_root.InfoBar.ScoreAmount.text = _root.score;
_root.InfoBar.HealthAmount.text = _root.health;
}
function inGameMessage(n) {
_root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText;
_root.ingame_message.vPosition = _root.ingame_message.maxVPosition;
}
stop();
_root.waves = [[10, 50, 2.5, 2000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 200, 2], [10, 200, 1.5, 2000, 3], [10, 250, 3.5, 4000, 3], [1, 500, 2.5, 2000, 50], [10, 350, 2.5, 2000, 4], [10, 450, 3.5, 4000, 4], [10, 550, 2.5, 200, 5], [10, 650, 1.5, 2000, 5], [10, 750, 3.5, 4000, 6], [1, 1200, 3.5, 4000, 100], [10, 950, 2.5, 2000, 8], [10, 1150, 3.5, 4000, 8], [10, 1350, 2.5, 200, 9], [10, 1550, 1.5, 2000, 10], [10, 1750, 3.5, 4000, 10], [3, 2700, 2.5, 200, 150], [10, 2150, 2.5, 2000, 10], [10, 2550, 3.5, 4000, 12], [10, 2950, 2.5, 200, 12], [10, 3350, 1.5, 2000, 12], [10, 3850, 3.5, 4000, 12], [1, 5500, 1.5, 4000, 300], [10, 4650, 2.5, 2000, 14], [10, 5450, 3.5, 4000, 14], [10, 6250, 2.5, 200, 14], [10, 7050, 1.5, 2000, 14], [10, 7850, 3.5, 4000, 16], [1, 11500, 3.5, 4000, 500], [10, 9450, 2.5, 2000, 16], [10, 11050, 3.5, 4000, 16], [10, 12650, 2.5, 200, 18], [10, 14250, 1.5, 2000, 18], [10, 15850, 3.5, 4000, 20], [1, 30450, 1, 4000, 1000][20][22][22][24][1500][24][24][30][5000][5000][5000][5000][5000][1]];
_root.wave = 0;
_root.hasGameStarted = false;
_root.hasGameFinished = false;
_root.towerCount = 0;
_root.selectedTower = "";
_root.currentNumberOfCreeps = 0;
_root.creepCount = 0;
_root.creepArray = [];
_root.creepLeaks = 0;
_root.explosionCount = 0;
_root.particleCount = 0;
_root.kills = 0;
_root.gold = 100;
_root.count = 1;
_root.maxCount = 40;
_root.updateDuration = 2;
_root.health = 30;
_root.score = 0;
bgSound = new Sound(this);
itquit = false;
itgoes = true;
bgSound.attachSound("sound1");
bgSound.start(0, 99);
slider.slideBar._x = -30;
slider.slideBar.onEnterFrame = function () {
bgSound.setVolume(-(3.4 * this._x));
};
slider.slideBar.onPress = function () {
startDrag (this, false, -30, 0, -3, 0);
};
slider.slideBar.onRelease = (slider.slideBar.onReleaseOutside = function () {
stopDrag();
});
stop();
Instance of Symbol 111 MovieClip "deselect" in Frame 3
on (press) {
_root.selectedTower = "";
_root.ranger._x = 3000;
_root.ranger._width = 10;
_root.ranger._height = 10;
_root.UpgradeTowerInfo._visible = false;
}
Instance of Symbol 124 MovieClip "info_message" in Frame 3
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 132 MovieClip "UpgradeTowerInfo" in Frame 3
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 150 MovieClip "timeline" in Frame 3
onClipEvent (load) {
clearInterval(_root.levelInterval);
_root.levelInterval = setInterval(_root, "executeCallback", 1000);
}
on (press) {
if (!_root.hasGameStarted) {
return(undefined);
}
if ((_root.wave >= 0) && ((_root.wave - 1) <= (_root.waves.length - 1))) {
_root.score = _root.score + (_root.wave * (_root.maxCount - _root.count));
_root.gold = _root.gold + int(_root.gold * 0.03);
_root.count = 1;
_root.newLevel();
}
}
onClipEvent (enterFrame) {
}
Instance of Symbol 165 MovieClip in Frame 3
on (press) {
if (_root.gold >= 15) {
_root.marker.active = 1;
_root.marker.tower = "cannon";
_root.marker.cost = 15;
}
_root.UpgradeTowerInfo._visible = false;
}
on (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;
}
on (rollOut) {
_parent.info_message._visible = false;
}
Instance of Symbol 167 MovieClip "tower_cannon" in Frame 3
onClipEvent (load) {
title = "Cannon Tower [Cost: $15]";
desc = "Medium attack speed with high damage and a high range";
type = "Ground";
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]];
}
on (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);
}
}
}
}
}
Instance of Symbol 170 MovieClip "marker" in Frame 3
onClipEvent (load) {
active = 0;
}
onClipEvent (enterFrame) {
if (active == 1) {
_x = ((int((_root._xmouse - 10) / 20) * 20) + 20);
_y = ((int((_root._ymouse - 10) / 20) * 20) + 20);
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;
}
}
on (press) {
hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1);
hitTestOnDeSelectMovieClip = _root.deselect.hitTest(_x, _y, 1);
if (hitTestOnGrassMovieClip || (hitTestOnDeSelectMovieClip)) {
if (hitTestOnGrassMovieClip && (!_root.hasGameFinished)) {
_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 = _root.gold - cost;
_root.updateInfoBar();
if (!_root.hasGameStarted) {
_root.newLevel();
_root.hasGameStarted = true;
_root.instructions._visible = false;
}
}
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.ranger._x = 1000;
_root.ranger._width = 10;
_root.ranger._height = 10;
}
}
Instance of Symbol 179 MovieClip in Frame 3
on (press) {
if (_root.gold >= 40) {
_root.marker.active = 1;
_root.marker.tower = "fire";
_root.marker.cost = 40;
}
_root.UpgradeTowerInfo._visible = false;
}
on (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;
}
on (rollOut) {
_parent.info_message._visible = false;
}
Instance of Symbol 184 MovieClip "tower_fire" in Frame 3
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]];
}
on (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);
}
}
}
}
}
Instance of Symbol 186 MovieClip in Frame 3
on (press) {
if (_root.gold >= 30) {
_root.marker.active = 1;
_root.marker.tower = "water";
_root.marker.cost = 30;
}
_root.UpgradeTowerInfo._visible = false;
}
on (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;
}
on (rollOut) {
_parent.info_message._visible = false;
}
Instance of Symbol 188 MovieClip "tower_water" in Frame 3
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]];
}
on (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);
}
}
}
}
}
Instance of Symbol 193 MovieClip in Frame 3
on (press) {
if (_root.gold >= 25) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 25;
}
_root.UpgradeTowerInfo._visible = false;
}
on (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;
}
on (rollOut) {
_parent.info_message._visible = false;
}
Instance of Symbol 195 MovieClip "tower_poison" in Frame 3
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]];
}
on (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 Symbol 200 MovieClip in Frame 3
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 15) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 201 MovieClip in Frame 3
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 40) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 202 MovieClip in Frame 3
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 30) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 203 MovieClip in Frame 3
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 25) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 4
stop();
Frame 5
stop();
Frame 6
stop();
Frame 7
var sound = true;
var song = new Sound();
song.attachSound("song");
this.onLoad = function () {
_root.song.start(0, 1000);
this.btnPlay._alpha = 70;
this.btnPlay.enabled = false;
};
Frame 8
function executeCallback() {
if (_root.hasGameStarted) {
if (_root.count >= _root.maxCount) {
_root.newLevel();
_root.count = 1;
}
if ((_root.wave - 1) < (_root.waves.length - 1)) {
_root.count++;
} else if (_root.currentNumberOfCreeps <= 0) {
_root.hasGameStarted = false;
_root.inGameMessage("<font color='#0000FF'>You Win. What? You Want A Reward Or Something?</font>");
}
} else {
var _local2 = 1;
while (_local2 <= _root.towerCount) {
b = _root["t" + _local2];
if (("" + b) != "undefined") {
Explosion("projectile_fire", b._x, b._y);
b.removeMovieClip();
}
_local2++;
}
}
}
function towerInfo(tower) {
_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>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];
}
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].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.currentNumberOfCreeps++;
_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 = 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 = this.creep._rotation + 10;
} else if ((this.creep._rotation - 10) > this.r) {
this.creep._rotation = this.creep._rotation - 10;
} else {
this.creep._rotation = r;
}
this.rads = (this.dir * 3.141593) / 180;
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = 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 > 8) {
_root.leak(this);
_root.updateInfoBar();
}
}
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 = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
this._alpha = this._alpha - 5;
if (this.speed > 0.5) {
this.speed = 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 = r._x - (Math.cos(rads) * (from._width / 2));
r._y = 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 = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
if (this.speed < this.maxspeed) {
this.speed = 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 = _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.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.currentNumberOfCreeps--;
_root.gold = _root.gold + creep.gold;
updateScore();
updateInfoBar();
this.removeMovieClip();
};
}
function leak(creep) {
_root.creepLeaks++;
if (!_root.hasGameFinished) {
creep._x = _root.wp0._x;
creep._y = _root.wp0._y;
creep.targ = 1;
} else {
creep.removeMovieClip();
}
_root.health--;
if (_root.health <= 0) {
_root.health = 0;
_root.hasGameStarted = false;
if (!_root.hasGameFinished) {
_root.inGameMessage("<font color='#0000FF'>You Lose! All The Children Have Been Eaten, I Hope You Are Happy.</font>");
}
_root.hasGameFinished = true;
}
}
function updateScore() {
var _local3 = _root.gold;
var _local2 = 1;
while (_local2 <= _root.towerCount) {
b = _root["t" + _local2];
if (("" + b) != "undefined") {
_local3 = _local3 + b.cost;
}
_local2++;
}
_root.score = _root.score + _local3;
}
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 = a.cost + int(a.upgrades[b][1]);
a.level++;
_root.towerInfo(_root.selectedTower);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
updateScore();
}
function updateInfoBar() {
_root.InfoBar.GoldAmount.text = _root.gold;
_root.InfoBar.ScoreAmount.text = _root.score;
_root.InfoBar.HealthAmount.text = _root.health;
}
function inGameMessage(n) {
_root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText;
_root.ingame_message.vPosition = _root.ingame_message.maxVPosition;
}
stop();
_root.waves = [[10, 50, 2.5, 2000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 200, 2], [10, 200, 1.5, 2000, 3], [10, 250, 3.5, 4000, 3], [1, 500, 2.5, 2000, 50], [10, 350, 2.5, 2000, 4], [10, 450, 3.5, 4000, 4], [10, 550, 2.5, 200, 5], [10, 650, 1.5, 2000, 5], [10, 750, 3.5, 4000, 6], [1, 1200, 3.5, 4000, 100], [10, 950, 2.5, 2000, 8], [10, 1150, 3.5, 4000, 8], [10, 1350, 2.5, 200, 9], [10, 1550, 1.5, 2000, 10], [10, 1750, 3.5, 4000, 10], [3, 2700, 2.5, 200, 150], [10, 2150, 2.5, 2000, 10], [10, 2550, 3.5, 4000, 12], [10, 2950, 2.5, 200, 12], [10, 3350, 1.5, 2000, 12], [10, 3850, 3.5, 4000, 12], [1, 5500, 1.5, 4000, 300], [10, 4650, 2.5, 2000, 14], [10, 5450, 3.5, 4000, 14], [10, 6250, 2.5, 200, 14], [10, 7050, 1.5, 2000, 14], [10, 7850, 3.5, 4000, 16], [1, 11500, 3.5, 4000, 500], [10, 9450, 2.5, 2000, 16], [10, 11050, 3.5, 4000, 16], [10, 12650, 2.5, 200, 18], [10, 14250, 1.5, 2000, 18], [10, 15850, 3.5, 4000, 20], [1, 30450, 1, 4000, 1000][20][22][22][24][1500][24][24][30][5000][5000][5000][5000][5000][1]];
_root.wave = 0;
_root.hasGameStarted = false;
_root.hasGameFinished = false;
_root.towerCount = 0;
_root.selectedTower = "";
_root.currentNumberOfCreeps = 0;
_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.health = 20;
_root.score = 0;
bgSound = new Sound(this);
itquit = false;
itgoes = true;
bgSound.attachSound("sound1");
bgSound.start(0, 99);
slider.slideBar._x = -30;
slider.slideBar.onEnterFrame = function () {
bgSound.setVolume(-(3.4 * this._x));
};
slider.slideBar.onPress = function () {
startDrag (this, false, -30, 0, -3, 0);
};
slider.slideBar.onRelease = (slider.slideBar.onReleaseOutside = function () {
stopDrag();
});
stop();
Instance of Symbol 111 MovieClip "deselect" in Frame 8
on (press) {
_root.selectedTower = "";
_root.ranger._x = 3000;
_root.ranger._width = 10;
_root.ranger._height = 10;
_root.UpgradeTowerInfo._visible = false;
}
Instance of Symbol 124 MovieClip "info_message" in Frame 8
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 132 MovieClip "UpgradeTowerInfo" in Frame 8
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 150 MovieClip "timeline" in Frame 8
onClipEvent (load) {
clearInterval(_root.levelInterval);
_root.levelInterval = setInterval(_root, "executeCallback", 1000);
}
on (press) {
if (!_root.hasGameStarted) {
return(undefined);
}
if ((_root.wave >= 0) && ((_root.wave - 1) <= (_root.waves.length - 1))) {
_root.score = _root.score + (_root.wave * (_root.maxCount - _root.count));
_root.gold = _root.gold + int(_root.gold * 0.03);
_root.count = 1;
_root.newLevel();
}
}
onClipEvent (enterFrame) {
}
Instance of Symbol 165 MovieClip in Frame 8
on (press) {
if (_root.gold >= 15) {
_root.marker.active = 1;
_root.marker.tower = "cannon";
_root.marker.cost = 15;
}
_root.UpgradeTowerInfo._visible = false;
}
on (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;
}
on (rollOut) {
_parent.info_message._visible = false;
}
Instance of Symbol 167 MovieClip "tower_cannon" in Frame 8
onClipEvent (load) {
title = "Cannon Tower [Cost: $15]";
desc = "Medium attack speed with high damage and a high range";
type = "Ground";
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]];
}
on (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);
}
}
}
}
}
Instance of Symbol 170 MovieClip "marker" in Frame 8
onClipEvent (load) {
active = 0;
}
onClipEvent (enterFrame) {
if (active == 1) {
_x = ((int((_root._xmouse - 10) / 20) * 20) + 20);
_y = ((int((_root._ymouse - 10) / 20) * 20) + 20);
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;
}
}
on (press) {
hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1);
hitTestOnDeSelectMovieClip = _root.deselect.hitTest(_x, _y, 1);
if (hitTestOnGrassMovieClip || (hitTestOnDeSelectMovieClip)) {
if (hitTestOnGrassMovieClip && (!_root.hasGameFinished)) {
_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 = _root.gold - cost;
_root.updateInfoBar();
if (!_root.hasGameStarted) {
_root.newLevel();
_root.hasGameStarted = true;
_root.instructions._visible = false;
}
}
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.ranger._x = 1000;
_root.ranger._width = 10;
_root.ranger._height = 10;
}
}
Instance of Symbol 179 MovieClip in Frame 8
on (press) {
if (_root.gold >= 40) {
_root.marker.active = 1;
_root.marker.tower = "fire";
_root.marker.cost = 40;
}
_root.UpgradeTowerInfo._visible = false;
}
on (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;
}
on (rollOut) {
_parent.info_message._visible = false;
}
Instance of Symbol 184 MovieClip "tower_fire" in Frame 8
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]];
}
on (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);
}
}
}
}
}
Instance of Symbol 186 MovieClip in Frame 8
on (press) {
if (_root.gold >= 30) {
_root.marker.active = 1;
_root.marker.tower = "water";
_root.marker.cost = 30;
}
_root.UpgradeTowerInfo._visible = false;
}
on (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;
}
on (rollOut) {
_parent.info_message._visible = false;
}
Instance of Symbol 188 MovieClip "tower_water" in Frame 8
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]];
}
on (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);
}
}
}
}
}
Instance of Symbol 193 MovieClip in Frame 8
on (press) {
if (_root.gold >= 25) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 25;
}
_root.UpgradeTowerInfo._visible = false;
}
on (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;
}
on (rollOut) {
_parent.info_message._visible = false;
}
Instance of Symbol 195 MovieClip "tower_poison" in Frame 8
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]];
}
on (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 Symbol 200 MovieClip in Frame 8
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 15) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 201 MovieClip in Frame 8
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 40) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 202 MovieClip in Frame 8
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 30) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 203 MovieClip in Frame 8
onClipEvent (load) {
this.useHandCursor = false;
}
onClipEvent (enterFrame) {
if (_root.gold < 25) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 9
function executeCallback() {
if (_root.hasGameStarted) {
if (_root.count >= _root.maxCount) {
_root.newLevel();
_root.count = 1;
}
if ((_root.wave - 1) < (_root.waves.length - 1)) {
_root.count++;
} else if (_root.currentNumberOfCreeps <= 0) {
_root.hasGameStarted = false;
_root.inGameMessage("<font color='#0000FF'>You Win. What? You Want A Reward Or Something?</font>");
}
} else {
var _local2 = 1;
while (_local2 <= _root.towerCount) {
b = _root["t" + _local2];
if (("" + b) != "undefined") {
Explosion("projectile_fire", b._x, b._y);
b.removeMovieClip();
}
_local2++;
}
}
}
function towerInfo(tower) {
_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>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];
}
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].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.currentNumberOfCreeps++;
_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 = 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 = this.creep._rotation + 10;
} else if ((this.creep._rotation - 10) > this.r) {
this.creep._rotation = this.creep._rotation - 10;
} else {
this.creep._rotation = r;
}
this.rads = (this.dir * 3.141593) / 180;
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = 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 > 8) {
_root.leak(this);
_root.updateInfoBar();
}
}
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 = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
this._alpha = this._alpha - 5;
if (this.speed > 0.5) {
this.speed = 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 = r._x - (Math.cos(rads) * (from._width / 2));
r._y = 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 = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
if (this.speed < this.maxspeed) {
this.speed = 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 = _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.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.currentNumberOfCreeps--;
_root.gold = _root.gold + creep.gold;
updateScore();
updateInfoBar();
this.removeMovieClip();
};
}
function leak(creep) {
_root.creepLeaks++;
if (!_root.hasGameFinished) {
creep._x = _root.wp0._x;
creep._y = _root.wp0._y;
creep.targ = 1;
} else {
creep.removeMovieClip();
}
_root.health--;
if (_root.health <= 0) {
_root.health = 0;
_root.hasGameStarted = false;
if (!_root.hasGameFinished) {
_root.inGameMessage("<font color='#0000FF'>You Lose! All The Children Have Been Eaten, I Hope You Are Happy.</font>");
}
_root.hasGameFinished = true;
}
}
function updateScore() {
var _local3 = _root.gold;
var _local2 = 1;
while (_local2 <= _root.towerCount) {
b = _root["t" + _local2];
if (("" + b) != "undefined") {
_local3 = _local3 + b.cost;
}
_local2++;
}
_root.score = _root.score + _local3;
}
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 = a.cost + int(a.upgrades[b][1]);
a.level++;
_root.towerInfo(_root.selectedTower);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
updateScore();
}
function updateInfoBar() {
_root.InfoBar.GoldAmount.text = _root.gold;
_root.InfoBar.ScoreAmount.text = _root.score;
_root.InfoBar.HealthAmount.text = _root.health;
}
function inGameMessage(n) {
_root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText;
_root.ingame_message.vPosition = _root.ingame_message.maxVPosition;
}
stop();
_root.waves = [[10, 50, 2.5, 2000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 200, 2], [10, 200, 1.5, 2000, 3], [10, 250, 3.5, 4000, 3], [1, 500, 2.5, 2000, 50], [10, 350, 2.5, 2000, 4], [10, 450, 3.5, 4000, 4], [10, 550, 2.5, 200, 5], [10, 650, 1.5, 2000, 5], [10, 750, 3.5, 4000, 6], [1, 1200, 3.5, 4000, 100], [10, 950, 2.5, 2000, 8], [10, 1150, 3.5, 4000, 8], [10, 1350, 2.5, 200, 9], [10, 1550, 1.5, 2000, 10], [10, 1750, 3.5, 4000, 10], [3, 2700, 2.5, 200, 150], [10, 2150, 2.5, 2000, 10], [10, 2550, 3.5, 4000, 12], [10, 2950, 2.5, 200, 12], [10, 3350, 1.5, 2000, 12], [10, 3850, 3.5, 4000, 12], [1, 5500, 1.5, 4000, 300], [10, 4650, 2.5, 2000, 14], [10, 5450, 3.5, 4000, 14], [10, 6250, 2.5, 200, 14], [10, 7050, 1.5, 2000, 14], [10, 7850, 3.5, 4000, 16], [1, 11500, 3.5, 4000, 500], [10, 9450, 2.5, 2000, 16], [10, 11050, 3.5, 4000, 16], [10, 12650, 2.5, 200, 18], [10, 14250, 1.5, 2000, 18], [10, 15850, 3.5, 4000, 20], [1, 30450, 1, 4000, 1000][20][22][22][24][1500][24][24][30][5000][5000][5000][5000][5000][1]];
_root.wave = 0;
_root.hasGameStarted = false;
_root.hasGameFinished = false;
_root.towerCount = 0;
_root.selectedTower = "";
_root.currentNumberOfCreeps = 0;
_root.creepCount = 0;
_root.creepArray = [];
_root.creepLeaks = 0;
_root.explosionCount = 0;
_root.particleCount = 0;
_root.kills = 0;
_root.gold = 25;
_root.count = 1;
_root.maxCount = 40;
_root.updateDuration = 2;
_root.health = 10;
_root.score = 0;
bgSound = new Sound(this);
itquit = false;
itgoes = true;
bgSound.attachSound("sound1");
bgSound.start(0, 99);
slider.slideBar._x = -30;
slider.slideBar.onEnterFrame = function () {
bgSound.setVolume(-(3.4 * this._x));
};
slider.slideBar.onPress = function () {
startDrag (this, false, -30, 0, -3, 0);
};
slider.slideBar.onRelease = (slider.slideBar.onReleaseOutside = function () {
stopDrag();
});
stop();
Instance of Symbol 167 MovieClip "tower_cannon" in Frame 9
onClipEvent (load) {
title = "MachineGun(hard only)[Cost: $15]";
desc = "Extreme attack speed with Low damage and a high range";
type = "Ground";
cost = 0;
range = 120;
rate = 1;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
damage = 3;
splash = 0;
slow = 0;
poison = 0;
level = 1;
upgrades = [["Damage: 5\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 20, 5, 120, 1, 0, 0, 0], ["Damage: 10\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 50, 10, 120, 1, 0, 0, 0], ["Damage: 20\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 85, 20, 120, 1, 0, 0, 0], ["Damage: 35\rRange: 120\rSplash:Yes\rSlow:No\rPoison:No\r", 150, 35, 160, 1, 40, 0, 0]];
}
on (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);
}
}
}
}
}
Frame 10
stop();
Frame 11
stop();
Frame 12
stop();
Frame 13
stop();
Frame 14
stop();
Frame 15
stop();
Frame 16
stop();
Frame 17
stop();
Frame 18
stop();
Symbol 35 Button
on (release) {
startMovie();
}
Symbol 36 MovieClip Frame 1
function timerHandler() {
if (!loadingComplete) {
var _local4 = _root.getBytesLoaded() / _root.getBytesTotal();
bar._xscale = 100 * _local4;
if (_local4 == 1) {
loadingComplete = true;
if (AUTO_PLAY) {
startMovie();
} else {
gotoAndStop ("loaded");
}
return(undefined);
}
}
dt = getTimer() - time;
time = time + dt;
frameAccum = frameAccum + dt;
var _local3 = 0;
while ((frameAccum >= FRAME_TIME) && (_local3 < MAX_FRAME_SKIP)) {
advanceFrame(tankLogo, true, true);
advanceFrame(loadingText, false, true);
advanceFrame(barGfx, false, true);
if (loadingComplete) {
advanceFrame(this, false, false);
}
(frameAccum = frameAccum - FRAME_TIME);
_local3++;
}
updateAfterEvent();
}
function advanceFrame(clip, recurse, loop) {
if (!clip) {
return(undefined);
}
clip.stop();
if (clip._currentframe == clip._totalframes) {
if (loop) {
clip.gotoAndStop(1);
}
} else {
clip.nextFrame();
}
if (recurse) {
for (childName in clip) {
if (typeof(clip[childName]) == "movieclip") {
advanceFrame(clip[childName], recurse, loop);
}
}
}
}
function startMovie() {
clearInterval(intervalId);
_root.play();
}
_root.stop();
stop();
var FRAME_TIME = 33.3333333333333;
var AUTO_PLAY = false;
var MAX_FRAME_SKIP = 5;
var loadingComplete;
var intervalId;
var time;
var frameAccum;
loadingComplete = false;
intervalId = setInterval(this, "timerHandler", FRAME_TIME / 2);
frameAccum = 0;
time = getTimer();
timerHandler();
Symbol 47 Button
on (release) {
gotoAndPlay (8);
}
Symbol 57 Button
on (release) {
gotoAndPlay (4);
}
Symbol 67 Button
on (release) {
gotoAndPlay (5);
}
Symbol 76 MovieClip Frame 1
stop();
Symbol 84 Button
on (release) {
gotoAndPlay (6);
}
Symbol 91 Button
on (release) {
gotoAndPlay (3);
}
Symbol 100 Button
on (release) {
gotoAndPlay (9);
}
Symbol 105 Button
on (release) {
gotoAndPlay (10);
}
Symbol 116 MovieClip Frame 2
stop();
Instance of Symbol 129 MovieClip "UpgradeButton" in Symbol 132 MovieClip Frame 1
on (press) {
_root.upgrade();
}
Symbol 150 MovieClip Frame 1
Instance of Symbol 148 MovieClip "tl" in Symbol 150 MovieClip Frame 1
onClipEvent (enterFrame) {
_x = ((190 + (_root.wave * 100)) + (_root.count * (100 / _root.maxCount)));
}
Symbol 158 MovieClip Frame 1
stop();
Instance of Symbol 152 MovieClip in Symbol 158 MovieClip Frame 2
onClipEvent (enterFrame) {
if (_root.player._x > _x) {
_x = (_x + 5);
}
}
onClipEvent (enterFrame) {
if (_root.player._x < _x) {
_x = (_x - 5);
}
}
onClipEvent (enterFrame) {
if (_root.player._y > _y) {
_y = (_y + 5);
}
}
onClipEvent (enterFrame) {
if (_root.player._y < _y) {
_y = (_y - 5);
}
}
Symbol 173 MovieClip Frame 1
stop();
Symbol 213 Button [slash]
on (release) {
gotoAndPlay (2);
}
Symbol 218 Button
on (release) {
_root.song.stop();
this.btnStop.enabled = false;
this.btnStop._alpha = 70;
this.btnPlay.enabled = true;
this.btnPlay._alpha = 100;
trace("Song stopped");
}
Symbol 221 Button
on (release) {
_root.song.start(0);
this.btnStop._alpha = 100;
this.btnStop.enabled = true;
this.btnPlay.enabled = false;
this.btnPlay._alpha = 70;
trace("Song is playing");
}
Symbol 254 Button
on (release) {
gotoAndPlay (1);
}
Symbol 257 Button
on (release) {
if (sound == true) {
_root.song.setVolume(0);
sound = false;
trace("Sound muted = " + sound);
} else {
_root.song.setVolume(100);
sound = true;
trace("Sound muted = " + sound);
}
}
Symbol 273 Button
on (release) {
gotoAndPlay (11);
}
Symbol 276 Button
on (release) {
gotoAndPlay (12);
}
Symbol 281 Button
on (release) {
gotoAndPlay (13);
}
Symbol 285 Button
on (release) {
gotoAndPlay (14);
}
Symbol 288 Button
on (release) {
gotoAndPlay (15);
}
Symbol 292 Button
on (release) {
gotoAndPlay (16);
}
Symbol 296 Button
on (release) {
gotoAndPlay (17);
}
Symbol 300 Button
on (release) {
gotoAndPlay (18);
}