Frame 1
stop();
mochi.as2.MochiAd.showPreGameAd({id:"15b395de68369545", res:"800x600"});
mochi.as2.MochiServices.connect("15b395de68369545");
Frame 2
stop();
Instance of Symbol 13 MovieClip in Frame 2
onClipEvent (load) {
timecount = 0;
timestart = 0;
this._width = 10;
this._height = 5.36;
}
onClipEvent (enterFrame) {
if (this._width < 422) {
this._width = this._width * 1.04;
this._height = this._height * 1.04;
} else {
this.timestart = 1;
}
if (this.timestart == 1) {
this.timecount++;
}
if (this.timecount >= 60) {
_root.gotoAndPlay("mainmenu");
}
}
Frame 3
stop();
Frame 4
stop();
Frame 5
stop();
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.xpleft == undefined) {
_global.xpleft = 0;
} else {
_global.xpleft = storedskills.data.xpleft;
}
if (storedskills.data.attackskill == undefined) {
_global.attackskill = 0;
} else {
_global.attackskill = storedskills.data.attackskill;
}
if (storedskills.data.rangeskill == undefined) {
_global.rangeskill = 0;
} else {
_global.rangeskill = storedskills.data.rangeskill;
}
if (storedskills.data.startmoneylevel == undefined) {
_global.startmoneylevel = 0;
} else {
_global.startmoneylevel = storedskills.data.startmoneylevel;
}
if (storedskills.data.killbounty == undefined) {
_global.killbounty = 0;
} else {
_global.killbounty = storedskills.data.killbounty;
}
if (storedskills.data.gems == undefined) {
_global.gems = 0;
} else {
_global.gems = storedskills.data.gems;
}
if (storedskills.data.techlevel == undefined) {
_global.techlevel = 0;
} else {
_global.techlevel = storedskills.data.techlevel;
}
if (storedskills.data.maxlevelbeat == undefined) {
_root.maxlevelbeat = 0;
} else {
_root.maxlevelbeat = storedskills.data.maxlevelbeat;
}
if (storedskills.data.level1gain == undefined) {
_root.level1gain = 0;
} else {
_root.level1gain = storedskills.data.level1gain;
}
if (storedskills.data.level1score == undefined) {
_root.level1score = 0;
} else {
_root.level1score = storedskills.data.level1score;
}
if (storedskills.data.level2gain == undefined) {
_root.level2gain = 0;
} else {
_root.level2gain = storedskills.data.level2gain;
}
if (storedskills.data.level2score == undefined) {
_root.level2score = 0;
} else {
_root.level2score = storedskills.data.level2score;
}
if (storedskills.data.level3gain == undefined) {
_root.level3gain = 0;
} else {
_root.level3gain = storedskills.data.level3gain;
}
if (storedskills.data.level3score == undefined) {
_root.level3score = 0;
} else {
_root.level3score = storedskills.data.level3score;
}
if (storedskills.data.level4gain == undefined) {
_root.level4gain = 0;
} else {
_root.level4gain = storedskills.data.level4gain;
}
if (storedskills.data.level4score == undefined) {
_root.level4score = 0;
} else {
_root.level4score = storedskills.data.level4score;
}
if (storedskills.data.level5gain == undefined) {
_root.level5gain = 0;
} else {
_root.level5gain = storedskills.data.level5gain;
}
if (storedskills.data.level5score == undefined) {
_root.level5score = 0;
} else {
_root.level5score = storedskills.data.level5score;
}
if (storedskills.data.level6gain == undefined) {
_root.level6gain = 0;
} else {
_root.level6gain = storedskills.data.level6gain;
}
if (storedskills.data.level6score == undefined) {
_root.level6score = 0;
} else {
_root.level6score = storedskills.data.level6score;
}
if (storedskills.data.level7gain == undefined) {
_root.level7gain = 0;
} else {
_root.level7gain = storedskills.data.level7gain;
}
if (storedskills.data.level7score == undefined) {
_root.level7score = 0;
} else {
_root.level7score = storedskills.data.level7score;
}
if (storedskills.data.level8gain == undefined) {
_root.level8gain = 0;
} else {
_root.level8gain = storedskills.data.level8gain;
}
if (storedskills.data.level8score == undefined) {
_root.level8score = 0;
} else {
_root.level8score = storedskills.data.level8score;
}
if (storedskills.data.level9gain == undefined) {
_root.level9gain = 0;
} else {
_root.level9gain = storedskills.data.level9gain;
}
if (storedskills.data.level9score == undefined) {
_root.level9score = 0;
} else {
_root.level9score = storedskills.data.level9score;
}
if (storedskills.data.level10gain == undefined) {
_root.level10gain = 0;
} else {
_root.level10gain = storedskills.data.level10gain;
}
if (storedskills.data.level10score == undefined) {
_root.level10score = 0;
} else {
_root.level10score = storedskills.data.level10score;
}
if (storedskills.data.level11score == undefined) {
_root.level11score = 0;
} else {
_root.level11score = storedskills.data.level11score;
}
stop();
Instance of Symbol 47 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level1gain;
_root.lvlscore = _root.level1score;
_root.lvlmax = 2;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
_root.gotoAndPlay("level1");
}
Instance of Symbol 54 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level2gain;
_root.lvlscore = _root.level2score;
_root.lvlmax = 2;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 1) {
_root.gotoAndPlay("level2");
}
}
Instance of Symbol 60 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level3gain;
_root.lvlscore = _root.level3score;
_root.lvlmax = 3;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 2) {
_root.gotoAndPlay("level3");
}
}
Instance of Symbol 65 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level4gain;
_root.lvlscore = _root.level4score;
_root.lvlmax = 3;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 3) {
_root.gotoAndPlay("level4");
}
}
Instance of Symbol 69 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level5gain;
_root.lvlscore = _root.level5score;
_root.lvlmax = 3;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 4) {
_root.gotoAndPlay("level5");
}
}
Instance of Symbol 73 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level6gain;
_root.lvlscore = _root.level6score;
_root.lvlmax = 3;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 5) {
_root.gotoAndPlay("level6");
}
}
Instance of Symbol 77 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level7gain;
_root.lvlscore = _root.level7score;
_root.lvlmax = 3;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 6) {
_root.gotoAndPlay("level7");
}
}
Instance of Symbol 81 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level9gain;
_root.lvlscore = _root.level9score;
_root.lvlmax = 4;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 8) {
_root.gotoAndPlay("level9");
}
}
Instance of Symbol 85 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level10gain;
_root.lvlscore = _root.level10score;
_root.lvlmax = 4;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 9) {
_root.gotoAndPlay("level10");
}
}
Instance of Symbol 89 MovieClip in Frame 5
on (rollOver) {
_root.lvlscore = _root.level11score;
_root.challengescore._x = this._x;
_root.challengescore._y = this._y;
_root.challengescore._visible = true;
_root.lvl11score = _root.level11score;
}
on (rollOut) {
_root.lvl11score = "";
_root.challengescore._visible = false;
}
on (press) {
_root.challengescore.removeMovieClip();
_root.skillstats.removeMovieClip();
if (_root.maxlevelbeat >= 10) {
_root.gotoAndPlay("level11");
}
}
Instance of Symbol 100 MovieClip "skillstats" in Frame 5
onClipEvent (load) {
this.swapDepths(9999);
this._visible = false;
}
Instance of Symbol 104 MovieClip in Frame 5
on (rollOver) {
_root.skillstats._x = this._x;
_root.skillstats._y = this._y;
_root.skillstats._visible = true;
_root.lvlgain = _root.level8gain;
_root.lvlscore = _root.level8score;
_root.lvlmax = 3;
}
on (rollOut) {
_root.lvlgain = "";
_root.lvlscore = "";
_root.lvlmax = "";
_root.skillstats._visible = false;
}
on (press) {
_root.skillstats.removeMovieClip();
_root.challengescore.removeMovieClip();
if (_root.maxlevelbeat >= 7) {
_root.gotoAndPlay("level8");
}
}
Frame 6
stop();
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.xpleft == undefined) {
_global.xpleft = 0;
} else {
_global.xpleft = storedskills.data.xpleft;
}
_root.xpleft = _global.xpleft;
if (storedskills.data.attackskill == undefined) {
_global.attackskill = 0;
} else {
_global.attackskill = storedskills.data.attackskill;
}
_root.attackskill = _global.attackskill;
if (storedskills.data.rangeskill == undefined) {
_global.rangeskill = 0;
} else {
_global.rangeskill = storedskills.data.rangeskill;
}
_root.rangeskill = _global.rangeskill;
if (storedskills.data.startmoneylevel == undefined) {
_global.startmoneylevel = 0;
} else {
_global.startmoneylevel = storedskills.data.startmoneylevel;
}
_root.startmoneylevel = _global.startmoneylevel;
if (storedskills.data.killbounty == undefined) {
_global.killbounty = 0;
} else {
_global.killbounty = storedskills.data.killbounty;
}
_root.killbounty = _global.killbounty;
if (storedskills.data.gems == undefined) {
_global.gems = 0;
} else {
_global.gems = storedskills.data.gems;
}
_root.gems = _global.gems;
if (storedskills.data.techlevel == undefined) {
_global.techlevel = 0;
} else {
_global.techlevel = storedskills.data.techlevel;
}
_root.techlevel = _global.techlevel;
Frame 7
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.kills = 0;
_root.levelnew = 1;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 7900 + _root.creepcount);
if (_root.creepcount > 1000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 7) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.levelnew = 1;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.wave = 0;
_root.techlevel = _global.techlevel;
_root.pauses = 0;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 15;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 43, 2.5, 1000], [30, 50, 3, 800], [30, 59, 1.5, 600], [30, 69, 2.5, 1000], [30, 81, 2.7, 1100], [30, 94, 2.5, 1000], [30, 110, 1, 400], [30, 129, 3.5, 1000], [30, 151, 2, 1000], [30, 177, 2.5, 1000], [30, 208, 1.75, 800], [30, 243, 2, 1000], [30, 284, 1.5, 600], [30, 332, 3.5, 1000], [30, 389, 2, 1000]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 7
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 7
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 7
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 7
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 7
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 7
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 7
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 7
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
trace(_root.techlevel);
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.levelnew++;
_root.checkkill();
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose1");
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= 30)) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win1");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 7
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 7
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 7
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod Base damage Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 7
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod Base Damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 7
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod Base Damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 7
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 7
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod Bae Damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 7
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod Base Damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 7
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 7
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 7
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 7
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 7
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 7
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
lastChecked = 0;
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 7
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 7
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 7
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 7
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
lastChecked = 0;
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 7
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 7) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 8) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 7
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 7
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 7
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 7
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 8
stop();
stopAllSounds();
_root.gameover = 1;
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose1");
}
if (_root.lives == 20) {
_root.skillgained = 2;
} else {
_root.skillgained = 1;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level1gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level1gain = _root.skillgained;
} else {
xplast = storedskills.data.level1gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level1gain = storedskills.data.level1gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 1) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 1;
}
if ((storedskills.data.level1score == undefined) || (_root.score > storedskills.data.level1score)) {
storedskills.data.level1score = _root.score;
}
Frame 9
stop();
stopAllSounds();
_root.gameover = 1;
Frame 10
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.kills = 0;
_root.levelnew = 1;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 7900 + _root.creepcount);
if (_root.creepcount > 1000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 8) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.wave = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 20;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 43, 2.5, 1000], [30, 50, 3, 800], [30, 59, 1.5, 600], [30, 69, 2.5, 1000], [30, 81, 2.7, 1100], [30, 94, 2.5, 1000], [30, 110, 1, 400], [30, 129, 3.5, 900], [30, 151, 2, 1000], [30, 177, 2.5, 1000], [30, 208, 1.75, 800], [30, 243, 2, 1000], [30, 284, 1.5, 600], [30, 332, 3.5, 900], [30, 389, 2, 1000], [30, 455, 3, 750], [30, 533, 2.5, 800], [30, 623, 3, 1000], [30, 729, 1.5, 500], [30, 853, 2, 900]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 10
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 10
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 10
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 10
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 10
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 10
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 10
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 10
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 10
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose2");
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win2");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 10
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 10
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 10
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 10
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 10
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 10
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 10
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 10
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 10
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 10
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 10
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 10
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 10
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 10
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 10
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 10
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 10
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 10
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 10
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 9) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 9) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 10
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 10
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 10
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 10
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 11
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose1");
}
if (_root.lives == 20) {
_root.skillgained = 2;
} else {
_root.skillgained = 1;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level2gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level2gain = _root.skillgained;
} else {
xplast = storedskills.data.level2gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level2gain = storedskills.data.level2gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 2) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 2;
}
if ((storedskills.data.level2score == undefined) || (_root.score > storedskills.data.level2score)) {
storedskills.data.level2score = _root.score;
}
Frame 12
stop();
_root.gameover = 1;
stopAllSounds();
Frame 13
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.kills = 0;
_root.levelnew = 1;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 7900 + _root.creepcount);
if (_root.creepcount > 1000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.levelnew = 1;
_root.killbounty = _global.killbounty;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.wave = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 25;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 59, 2.5, 1000], [30, 70, 3, 800], [30, 82, 1.5, 600], [30, 95, 2.5, 1000], [30, 112, 2.7, 1000], [30, 130, 2.5, 1000], [30, 152, 1, 400], [30, 179, 3.5, 900], [30, 209, 2, 1000], [30, 245, 2.5, 1000], [30, 287, 1.75, 800], [30, 336, 2, 1000], [30, 393, 1.5, 600], [30, 459, 3.5, 900], [30, 538, 2, 1000], [30, 629, 3, 750], [30, 737, 2.5, 800], [30, 862, 3, 1000], [30, 1008, 1.5, 500], [30, 1180, 2, 900], [30, 1383, 2.5, 900], [30, 1622, 3.5, 900], [30, 1901, 1.75, 600], [30, 2230, 1.5, 500], [2, 30000, 2, 3000]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 13
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 13
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose3");
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win3");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 13
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 13
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 13
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 13
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 13
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 13
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 13
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 13
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 13
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 13
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 13
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 13
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 13
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 13
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 13
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 13
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 13
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 13
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 13
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 0;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 9) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 13
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 13
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 13
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 13
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 14
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose1");
}
if (_root.lives == 20) {
_root.skillgained = 3;
} else {
_root.skillgained = 2;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level3gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level3gain = _root.skillgained;
} else {
xplast = storedskills.data.level3gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level3gain = storedskills.data.level3gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 3) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 3;
}
if ((storedskills.data.level3score == undefined) || (_root.score > storedskills.data.level3score)) {
storedskills.data.level3score = _root.score;
}
Frame 15
stop();
_root.gameover = 1;
stopAllSounds();
Frame 16
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.kills = 0;
_root.levelnew = 1;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 7900 + _root.creepcount);
if (_root.creepcount > 1000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.wave = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 30;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 59, 2.5, 1000], [30, 70, 3, 900], [30, 82, 1.5, 600], [30, 95, 2.5, 1000], [30, 112, 2.7, 900], [30, 130, 2.5, 1000], [30, 152, 1, 400], [30, 179, 3.5, 900], [30, 209, 2, 1000], [30, 245, 2.5, 1000], [30, 287, 1.75, 800], [30, 336, 2, 1000], [30, 393, 1.5, 600], [30, 459, 3.5, 900], [30, 538, 2, 1000], [30, 629, 3, 750], [30, 737, 2.5, 800], [30, 862, 3, 1000], [30, 1008, 1.5, 500], [30, 1180, 2, 900], [30, 1383, 2.5, 800], [30, 1622, 3.5, 900], [30, 1901, 1.75, 600], [30, 2230, 1.5, 500], [30, 2614, 2, 800], [30, 3065, 4, 1000], [30, 3594, 2.5, 800], [30, 4214, 3, 900], [30, 4942, 1.5, 800]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 16
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 16
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose4");
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win4");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 16
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 16
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 16
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 16
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 16
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 16
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 16
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 16
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 16
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 16
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 16
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 16
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 16
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 16
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 16
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 16
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 16
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 16
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 16
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 16
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 16
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 16
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 16
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 17
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose1");
}
if (_root.lives == 20) {
_root.skillgained = 3;
} else {
_root.skillgained = 2;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level4gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level4gain = _root.skillgained;
} else {
xplast = storedskills.data.level4gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level4gain = storedskills.data.level4gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 4) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 4;
}
if ((storedskills.data.level4score == undefined) || (_root.score > storedskills.data.level4score)) {
storedskills.data.level4score = _root.score;
}
Frame 18
stop();
_root.gameover = 1;
stopAllSounds();
Frame 19
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.levelnew = 1;
_root.kills = 0;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 20000 + _root.creepcount);
if (_root.creepcount > 10000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
trace(this._name);
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.wave = 0;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 35;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 59, 2.5, 1000], [30, 70, 3, 900], [30, 82, 1.5, 600], [30, 95, 2.5, 1000], [30, 112, 2.7, 900], [30, 130, 2.5, 1000], [30, 152, 1, 400], [30, 179, 3.5, 900], [30, 209, 2, 1000], [30, 245, 2.5, 1000], [30, 287, 1.75, 800], [30, 336, 2, 1000], [30, 393, 1.5, 600], [30, 459, 3.5, 900], [30, 538, 2, 1000], [30, 629, 3, 750], [30, 737, 2.5, 800], [30, 862, 3, 1000], [30, 1008, 1.5, 500], [30, 1180, 2, 900], [30, 1383, 2.5, 800], [30, 1622, 3.5, 900], [30, 1901, 1.75, 600], [30, 2230, 1.5, 500], [30, 2614, 2, 800], [30, 3065, 4, 1000], [30, 3594, 2.5, 800], [30, 4214, 3, 900], [30, 4942, 1.5, 800], [30, 5810, 3, 900], [30, 6809, 2, 800], [30, 8000, 2.5, 900], [30, 9400, 1.5, 500], [30, 11045, 3.5, 1000], [2, 140000, 2, 3500]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 19
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 19
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose5");
}
}
if (_root.wave >= _global.maxwaves) {
z = 1;
while (z < _root.creepArray.length) {
if (_root.creepArray[z] == undefined) {
_root.creepArray[z].removeMovieClip();
_root.creepArray.splice(z, 1);
}
z++;
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win5");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 19
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 19
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 19
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 19
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 19
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 19
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 19
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 19
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 19
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 19
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 19
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 19
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 19
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 19
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 19
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 19
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 19
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 10\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 10\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 10\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 19
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 19
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 19
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 19
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 19
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 19
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 20
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose1");
}
if (_root.lives == 20) {
_root.skillgained = 3;
} else {
_root.skillgained = 2;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level5gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level5gain = _root.skillgained;
} else {
xplast = storedskills.data.level5gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level5gain = storedskills.data.level5gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 5) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 5;
}
if ((storedskills.data.level5score == undefined) || (_root.score > storedskills.data.level5score)) {
storedskills.data.level5score = _root.score;
}
Frame 21
stop();
_root.gameover = 1;
stopAllSounds();
Frame 22
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.levelnew = 1;
_root.kills = 0;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 20000 + _root.creepcount);
if (_root.creepcount > 10000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
trace(this._name);
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.wave = 0;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 40;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 76, 2.5, 1000], [30, 90, 3, 900], [30, 103, 1.5, 600], [30, 120, 2.5, 1000], [30, 141, 2.7, 900], [30, 164, 2.5, 1000], [30, 192, 1, 400], [30, 225, 3.5, 900], [30, 263, 2, 1000], [30, 308, 2.5, 1000], [30, 361, 1.75, 800], [30, 422, 2, 1000], [30, 494, 1.5, 600], [30, 577, 3.5, 900], [30, 676, 2, 1000], [30, 790, 3, 750], [30, 925, 2.5, 800], [30, 1082, 3, 1000], [30, 1266, 1.5, 500], [30, 1481, 2, 900], [30, 1737, 2.5, 800], [30, 2036, 3.5, 900], [30, 2387, 1.75, 600], [30, 2799, 1.5, 500], [30, 3282, 2, 800], [30, 3848, 4, 1000], [30, 4512, 2.5, 800], [30, 5290, 3, 900], [30, 6203, 1.5, 800], [30, 7273, 3, 900], [30, 8546, 2, 800], [30, 10041, 2.5, 900], [30, 11799, 1.5, 500], [30, 13863, 3.5, 1000], [30, 16290, 2, 900], [30, 19140, 4.5, 800], [30, 22490, 2, 800], [30, 26426, 1.5, 300], [30, 31050, 2, 700], [2, 300000, 2, 1500]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 22
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 22
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose6");
}
}
if (_root.wave >= _global.maxwaves) {
z = 1;
while (z < _root.creepArray.length) {
if (_root.creepArray[z] == undefined) {
_root.creepArray[z].removeMovieClip();
_root.creepArray.splice(z, 1);
}
z++;
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win6");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 22
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 22
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 22
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 22
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 22
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 22
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 22
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 22
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 22
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 22
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 22
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 22
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 22
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 22
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 22
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 22
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 22
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 22
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 22
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 22
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 22
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 22
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 22
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 23
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose6");
}
if (_root.lives == 20) {
_root.skillgained = 3;
} else {
_root.skillgained = 2;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level6gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level6gain = _root.skillgained;
} else {
xplast = storedskills.data.level6gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level6gain = storedskills.data.level6gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 6) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 6;
}
if ((storedskills.data.level6score == undefined) || (_root.score > storedskills.data.level6score)) {
storedskills.data.level6score = _root.score;
}
Frame 24
stop();
_root.gameover = 1;
stopAllSounds();
Frame 25
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.levelnew = 1;
_root.kills = 0;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 20000 + _root.creepcount);
if (_root.creepcount > 10000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
trace(this._name);
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.wave = 0;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 45;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 76, 2.5, 1000], [30, 90, 3, 900], [30, 103, 1.5, 600], [30, 120, 2.5, 1000], [30, 141, 2.7, 900], [30, 164, 2.5, 1000], [30, 192, 1, 400], [30, 225, 3.5, 900], [30, 263, 2, 1000], [30, 308, 2.5, 1000], [30, 361, 1.75, 800], [30, 422, 2, 1000], [30, 494, 1.5, 600], [30, 577, 3.5, 900], [30, 676, 2, 1000], [30, 790, 3, 750], [30, 925, 2.5, 800], [30, 1082, 3, 1000], [30, 1266, 1.5, 500], [30, 1481, 2, 900], [30, 1737, 2.5, 800], [30, 2036, 3.5, 900], [30, 2387, 1.75, 600], [30, 2799, 1.5, 500], [30, 3282, 2, 800], [30, 3848, 4, 1000], [30, 4512, 2.5, 800], [30, 5290, 3, 900], [30, 6203, 1.5, 800], [30, 7273, 3, 900], [30, 8546, 2, 800], [30, 10041, 2.5, 900], [30, 11799, 1.5, 500], [30, 13863, 3.5, 1000], [30, 16290, 2, 900], [30, 19140, 3.5, 800], [30, 22490, 2, 800], [30, 26426, 1.5, 300], [30, 31050, 2, 700], [30, 36484, 2.5, 900], [30, 43051, 1.75, 500], [30, 50800, 3.5, 1000], [30, 59944, 2, 750], [30, 70734, 3, 850], [2, 600000, 2, 2000]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 25
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 25
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose7");
}
}
if (_root.wave >= _global.maxwaves) {
z = 1;
while (z < _root.creepArray.length) {
if (_root.creepArray[z] == undefined) {
_root.creepArray[z].removeMovieClip();
_root.creepArray.splice(z, 1);
}
z++;
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win7");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 25
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 25
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 25
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 25
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 25
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 25
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 25
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 25
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 25
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 25
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 25
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 25
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 25
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 25
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 25
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 25
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 25
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 25
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 25
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 25
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 25
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 25
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 25
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 26
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose6");
}
if (_root.lives == 20) {
_root.skillgained = 3;
} else {
_root.skillgained = 2;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level7gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level7gain = _root.skillgained;
} else {
xplast = storedskills.data.level7gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level7gain = storedskills.data.level7gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 7) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 7;
}
if ((storedskills.data.level7score == undefined) || (_root.score > storedskills.data.level7score)) {
storedskills.data.level7score = _root.score;
}
Frame 27
stop();
_root.gameover = 1;
stopAllSounds();
Frame 28
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.levelnew = 1;
_root.kills = 0;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 20000 + _root.creepcount);
if (_root.creepcount > 10000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
trace(this._name);
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.wave = 0;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 50;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 76, 2.5, 1000], [30, 90, 3, 900], [30, 103, 1.5, 600], [30, 120, 2.5, 1000], [30, 141, 2.7, 900], [30, 164, 2.5, 1000], [30, 192, 1, 400], [30, 225, 3.5, 900], [30, 263, 2, 1000], [30, 308, 2.5, 1000], [30, 361, 1.75, 800], [30, 422, 2, 1000], [30, 494, 1.5, 600], [30, 577, 3.5, 900], [30, 676, 2, 1000], [30, 790, 3, 750], [30, 925, 2.5, 800], [30, 1082, 3, 1000], [30, 1266, 1.5, 500], [30, 1481, 2, 900], [30, 1737, 2.5, 800], [30, 2036, 3.5, 900], [30, 2387, 1.75, 600], [30, 2799, 1.5, 500], [30, 3282, 2, 800], [30, 3848, 4, 1000], [30, 4512, 2.5, 800], [30, 5290, 3, 900], [30, 6203, 1.5, 800], [30, 7273, 3, 900], [30, 8546, 2, 800], [30, 10041, 2.5, 900], [30, 11799, 1.5, 500], [30, 13863, 3.5, 1000], [30, 16290, 2, 900], [30, 19140, 3.5, 800], [30, 22490, 2, 800], [30, 26426, 1.5, 300], [30, 31050, 2, 700], [30, 36484, 2.5, 900], [30, 43051, 1.75, 500], [30, 50800, 3.5, 1000], [30, 59944, 2, 750], [30, 70734, 3, 850], [30, 83466, 2, 900], [30, 98590, 1.5, 600], [30, 116218, 2, 750], [30, 137137, 3, 750], [30, 161822, 2.25, 800], [2, 1618220, 1.75, 2300]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 28
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 28
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose8");
}
}
if (_root.wave >= _global.maxwaves) {
z = 1;
while (z < _root.creepArray.length) {
if (_root.creepArray[z] == undefined) {
_root.creepArray[z].removeMovieClip();
_root.creepArray.splice(z, 1);
}
z++;
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win8");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 28
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 28
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 28
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 28
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 28
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 28
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 28
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 28
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 28
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 28
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 28
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 28
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 28
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 28
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 28
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 28
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 28
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 28
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 28
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 28
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 28
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 28
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 28
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 29
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose6");
}
if (_root.lives == 20) {
_root.skillgained = 3;
} else {
_root.skillgained = 2;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level8gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level8gain = _root.skillgained;
} else {
xplast = storedskills.data.level8gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level8gain = storedskills.data.level8gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 8) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 8;
}
if ((storedskills.data.level8score == undefined) || (_root.score > storedskills.data.level8score)) {
storedskills.data.level8score = _root.score;
}
Frame 30
stop();
_root.gameover = 1;
stopAllSounds();
Frame 31
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.levelnew = 1;
_root.kills = 0;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 20000 + _root.creepcount);
if (_root.creepcount > 10000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
trace(this._name);
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.wave = 0;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 55;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 93, 2.5, 1000], [30, 109, 3, 900], [30, 128, 1.5, 600], [30, 149, 2.5, 1000], [30, 176, 2.7, 900], [30, 204, 2.5, 1000], [30, 239, 1, 400], [30, 280, 3.5, 900], [30, 328, 2, 1000], [30, 384, 2.5, 1000], [30, 450, 1.75, 800], [30, 526, 2, 1000], [30, 616, 1.5, 600], [30, 720, 3.5, 900], [30, 843, 2, 1000], [30, 986, 3, 750], [30, 1154, 2.5, 800], [30, 1350, 3, 1000], [30, 1580, 1.5, 500], [30, 1848, 2, 900], [30, 2159, 2.5, 800], [30, 2530, 3.5, 900], [30, 2967, 1.75, 600], [30, 3494, 1.5, 500], [30, 4097, 2, 800], [30, 4783, 4, 1000], [30, 5608, 2.5, 800], [30, 6575, 3, 900], [2, 75000, 1.5, 800], [30, 9040, 3, 900], [30, 10623, 2, 800], [30, 12481, 2.5, 900], [30, 14667, 1.5, 500], [30, 17232, 3.5, 1000], [30, 20249, 2, 900], [30, 23792, 3.5, 800], [30, 27957, 2, 800], [30, 32849, 1.5, 300], [30, 38597, 2, 700], [30, 45352, 2.5, 900], [30, 53516, 1.75, 500], [30, 63148, 2.5, 1000], [30, 74515, 2, 750], [30, 87928, 3, 850], [30, 103755, 2, 900], [30, 122431, 1.5, 600], [30, 144469, 2, 750], [30, 170473, 3, 750], [30, 201158, 2.25, 800], [30, 238375, 1.75, 500], [30, 284841, 2.75, 800], [30, 341809, 2.45, 900], [30, 410171, 2, 700], [30, 492205, 2.5, 750], [2, 5000000, 1.75, 2000]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 31
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 31
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose9");
}
}
if (_root.wave >= _global.maxwaves) {
z = 1;
while (z < _root.creepArray.length) {
if (_root.creepArray[z] == undefined) {
_root.creepArray[z].removeMovieClip();
_root.creepArray.splice(z, 1);
}
z++;
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win9");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 31
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 31
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 31
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 31
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 31
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 31
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 31
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 31
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 31
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 31
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 31
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 31
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 31
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 31
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 31
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 31
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 31
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 31
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 31
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 31
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 31
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 31
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 31
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 32
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose6");
}
if (_root.lives == 20) {
_root.skillgained = 4;
} else if (_root.lives >= 10) {
_root.skillgained = 3;
} else {
_root.skillgained = 2;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level9gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level9gain = _root.skillgained;
} else {
xplast = storedskills.data.level9gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level9gain = storedskills.data.level9gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 9) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 9;
}
if ((storedskills.data.level9score == undefined) || (_root.score > storedskills.data.level9score)) {
storedskills.data.level9score = _root.score;
}
Frame 33
stop();
_root.gameover = 1;
stopAllSounds();
Frame 34
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < _global.maxwaves) {
_root.levelnew = 1;
_root.kills = 0;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 20000 + _root.creepcount);
if (_root.creepcount > 10000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
trace(this._name);
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.wave = 0;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 60;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 102, 2.5, 1000], [30, 119, 3, 900], [30, 140, 1.5, 600], [30, 164, 2.5, 1000], [30, 193, 2.7, 900], [30, 224, 2.5, 1000], [30, 262, 1, 400], [30, 308, 3.5, 900], [30, 360, 2, 1000], [30, 422, 2.5, 1000], [30, 495, 1.75, 800], [30, 578, 2, 1000], [30, 677, 1.5, 600], [30, 792, 3.5, 900], [30, 927, 2, 1000], [30, 1084, 3, 750], [30, 1269, 2.5, 800], [30, 1485, 3, 1000], [30, 1738, 1.5, 500], [30, 2032, 2, 900], [30, 2374, 2.5, 800], [30, 2783, 3.5, 900], [30, 3263, 1.75, 600], [30, 3843, 1.5, 500], [30, 4506, 2, 800], [30, 5261, 4, 1000], [30, 6168, 2.5, 800], [30, 7232, 3, 900], [30, 8481, 1.5, 800], [2, 82000, 3, 900], [30, 11685, 2, 800], [30, 13729, 2.5, 900], [30, 16133, 1.5, 500], [30, 18955, 2.5, 1000], [30, 22273, 2, 900], [30, 23792, 3.5, 800], [30, 26171, 2, 800], [30, 36133, 1.5, 300], [30, 42456, 2, 700], [30, 49887, 2.5, 900], [30, 58867, 1.75, 500], [30, 69462, 2.5, 1000], [30, 81966, 2, 750], [30, 96720, 3, 850], [30, 114130, 2, 900], [30, 134674, 1.5, 600], [30, 158915, 2, 750], [30, 187520, 3, 750], [30, 221273, 2.25, 800], [30, 262212, 1.75, 500], [30, 313325, 2.75, 800], [30, 375989, 2.45, 900], [30, 451188, 2, 700], [30, 541425, 2.5, 750], [30, 652470, 1.75, 600], [30, 779653, 2.25, 850], [30, 935584, 2.75, 900], [30, 1122700, 2, 750], [30, 1347242, 1.75, 800], [2, 12000000, 1.75, 2500]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 34
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 34
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose10");
}
}
if (_root.wave >= _global.maxwaves) {
z = 1;
while (z < _root.creepArray.length) {
if (_root.creepArray[z] == undefined) {
_root.creepArray[z].removeMovieClip();
_root.creepArray.splice(z, 1);
}
z++;
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win10");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 34
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 34
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 34
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 34
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 34
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 34
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 34
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 34
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 34
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 34
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 34
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 34
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 34
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 34
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 34
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 34
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 34
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 34
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 34
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 34
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 34
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 34
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 34
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 35
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose6");
}
if (_root.lives == 20) {
_root.skillgained = 4;
} else if (_root.lives >= 10) {
_root.skillgained = 3;
} else {
_root.skillgained = 2;
}
storedskills = SharedObject.getLocal("flashskill");
if (storedskills.data.level10gain == undefined) {
_global.xpleft = _global.xpleft + _root.skillgained;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level10gain = _root.skillgained;
} else {
xplast = storedskills.data.level10gain;
skilldifferent = _root.skillgained - xplast;
if (skilldifferent > 0) {
_global.xpleft = _global.xpleft + skilldifferent;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.level10gain = storedskills.data.level10gain + skilldifferent;
}
}
if ((storedskills.data.maxlevelbeat < 10) || (storedskills.data.maxlevelbeat == undefined)) {
storedskills.data.maxlevelbeat = 10;
}
if ((storedskills.data.level10score == undefined) || (_root.score > storedskills.data.level10score)) {
storedskills.data.level10score = _root.score;
}
Frame 36
stop();
_root.gameover = 1;
stopAllSounds();
Frame 37
function TowerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
}
function towerInfo(tower) {
_root.selectedTower = tower;
_root.range._x = tower._x;
_root.range._y = tower._y;
_root.range._width = tower.range * 2;
_root.range._height = tower.range * 2;
_root.UpgradeTowerInfo._visible = true;
if (tower.maxtier >= tower.tier) {
_root.UpgradeTowerInfo.UpgradeInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 1][2]) + "\rRange: ") + tower.upgrades[tower.tier - 1][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 1][4]) + "\rEffect: ") + tower.desc;
if (tower.tier == 1) {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rCoolDown: ") + tower.rate) + "\rEffect: ") + tower.desc;
} else {
_root.UpgradeTowerInfo.TowerInfoText.text = (((((("Damage: " + tower.upgrades[tower.tier - 2][2]) + "\rRange: ") + tower.upgrades[tower.tier - 2][3]) + "\rCoolDown: ") + tower.upgrades[tower.tier - 2][4]) + "\rEffect: ") + tower.desc;
}
_root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.tier - 1][1]) + "]";
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
sellprice = Math.floor(tower.cost * 0.85);
_root.UpgradeTowerInfo.sellbutton.UpgradeButtonText.text = ("Sell [$" + sellprice) + "]";
if (tower.maxtier > tower.tier) {
_root.UpgradeTowerInfo.UpgradeButton._visible = true;
} else {
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
}
} else {
_root.UpgradeTowerInfo.f.text = "";
_root.UpgradeTowerInfo.UpgradeButton._visible = false;
_root.UpgradeTowerInfo.UpgradeInfoText.text = "Maximum Level reached";
_root.UpgradeTowerInfo.h.text = "";
}
}
function newLevel() {
if (_root.wave < 59) {
_root.levelnew = 1;
_root.kills = 0;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.nowspeed = _root.waves[_root.wave - 1][2];
_root.nextspeed = _root.waves[_root.wave][2];
_root.nowhp = _root.waves[_root.wave - 1][1];
_root.nexthp = _root.waves[_root.wave][1];
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
_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.goldworth);
_root["spawned" + _root.wave] = _root.waves[_root.wave - 1][0];
} else {
_root.levelnew = 1;
_root.kills = 0;
_root.wave++;
_root.gold = Math.floor(1.04 * _root.gold);
_root.goldworth = Math.pow(1.1, _root.wave);
_root.goldworth = _root.goldworth * (1 + (0.05 * _global.killbounty));
_root.goldworth = Math.floor(_root.goldworth);
randspeed = random(2) + 2;
_root.nowspeed = randspeed;
_root.nextspeed = "???";
wavessince = _root.wave - 60;
hpmultiplier = Math.pow(1.2, wavessince);
_root.nowhp = Math.floor(1742256 * hpmultiplier);
_root.nexthp = Math.floor(_root.nowhp * 1.2);
_root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", 800, _root.wave, "creep1", _root.nowspeed, _root.nowhp, _root.goldworth);
_root["spawned" + _root.wave] = 30;
}
}
function spawn(level, creep, speed, health, gold) {
if (_root["spawned" + level] == 0) {
clearInterval(_root["spawnInterval" + level]);
} else {
_root["spawned" + level]--;
playanim = (level % 5) + 1;
_root.creepcount++;
_root[creep].duplicateMovieClip("c" + _root.creepcount, 20000 + _root.creepcount);
if (_root.creepcount > 10000) {
_root.creepcount = 1;
}
c = _root["c" + _root.creepcount];
c.creep.gotoAndStop(playanim);
c._x = _root.wp1._x;
c._y = _root.wp1._y;
c.health = health;
c.slowcount = 1;
c.isslow = 0;
c.maxhealth = health;
c.speed = speed;
c.maxspeed = c.speed;
c.ispoisoned = 0;
c.poisonedlevel = 0;
c.poisoncount = 0;
c.fullmax = c.maxspeed;
c.targ = 2;
c.rnd = 5;
c.gold = gold;
c.iscorrode = 0;
c.isstunned = 0;
c.stuncount = 1;
c.splashslowed = 0;
c.splashslowedcount = 1;
_root.creepArray[_root.creepArray.length] = c;
c.onEnterFrame = function () {
if (_root.pauses == 0) {
trace(this._name);
this.health_bar.health._width = 30 * (this.health / this.maxhealth);
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.rads = (this.dir * 3.141593) / 180;
if (this.isstunned != 0) {
this.stuncount++;
if ((this.stuncount % 2) == 1) {
this._x = this._x + 2;
} else {
this._x = this._x - 2;
}
}
if (this.stuncount > 120) {
this.isstunned = 0;
this.stuncount = 1;
}
if (this.isslow != 0) {
this.speed = this.isslow * this.fullmax;
this.slowcount++;
}
if (this.slowcount > 120) {
this.speed = this.fullmax;
this.isslow = 0;
this.slowcount = 1;
}
if (this.splashslowed != 0) {
this.fullmax = this.maxspeed * 0.55;
this.speed = this.fullmax;
if (this.isslow != 0) {
this.speed = this.fullmax * this.isslow;
}
this.splashslowedcount++;
}
if (this.splashslowedcount > 150) {
this.splashslowed = 0;
this.splashslowedcount = 1;
this.fullmax = this.maxspeed;
}
if (this.iscorrode != 0) {
this.corrodecount++;
}
if (this.corrodecount > 150) {
this.iscorrode = 0;
this.corrdecount = 1;
}
if (this.ispoisoned == 1) {
if ((this.poisoncount % 30) == 0) {
this.health = this.health - this.poisonedlevel;
}
this.poisoncount++;
}
if (this.poisoncount > 150) {
this.ispoisoned = 0;
this.poisoncount = 0;
}
if (this.isstunned == 0) {
this._x = this._x + (Math.cos(this.rads) * this.speed);
this._y = this._y + (Math.sin(this.rads) * this.speed);
}
d = Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2);
if (d < 25) {
this.targ++;
if (this.targ > 10) {
_root.leak(this);
this._x = _root.wp1._x;
this._y = _root.wp1._y;
this.targ = 2;
}
}
this.r = this.dir;
if ((this._rotation + 10) < this.r) {
this._rotation = this._rotation + 10;
} else if ((this._rotation - 10) > this.r) {
this._rotation = this._rotation - 10;
} else {
this._rotation = r;
}
}
};
}
}
function fire(from, to, speed, acc, maxpeed, projectile, damage, towerid) {
_root.particlecount++;
_root[projectile].duplicateMovieClip("p" + _root.particlecount, 2000 + _root.particlecount);
r = _root["p" + _root.particlecount];
r._x = from._x;
r._y = from._y;
r.tier = from.tier;
r.type = from.type;
r.targ = to;
r.speed = speed;
r.acc = acc;
r.maxspeed = maxspeed;
r.damage = damage;
r.projectile = projectile;
r.towerid = towerid;
if (_root.particlecount > 300) {
_root.particlecount = 0;
}
r.onEnterFrame = function () {
if (_root.pauses == 0) {
if (("" + this.targ) != "") {
this.targX = this.targ._x;
this.targY = this.targ._y;
} else if (_root.creepArray.length <= 0) {
this.removeMovieClip();
} else {
w = 0;
if (w <= _root.creepArray.length) {
this.targ = _root.creepArray[w];
}
}
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;
}
if (this.hitTest(this.targ)) {
if (this.towerid == 10) {
randcrit = random(100);
if ((this.tier == 1) && (randcrit < 11)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 2) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 3) && (randcrit < 16)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 4) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
if ((this.tier == 5) && (randcrit < 21)) {
this.damage = this.damage * 3;
_root.triple.duplicateMovieClip("triple" + _root.triplecount, 6750 + _root.triplecount);
_root["triple" + _root.triplecount]._x = this._x;
_root["triple" + _root.triplecount]._y = this._y;
_root.triplecount++;
if (_root.triplecount > 20) {
_root.triplecount = 1;
}
}
}
if (this.towerid == 4) {
this.targ.corrodecount = 1;
if (this.tier == 1) {
this.targ.iscorrode = 0.06;
} else if (this.tier == 2) {
this.targ.iscorrode = 0.12;
} else if (this.tier == 3) {
this.targ.iscorrode = 0.2;
} else if (this.tier == 4) {
this.targ.iscorrode = 0.32;
}
}
this.targ.health = this.targ.health - (this.damage * (1 + this.targ.iscorrode));
if (this.towerid == 7) {
randstun = random(100);
if ((this.tier == 1) && (randstun < 10)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 2) && (randstun < 13)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
} else if ((this.tier == 3) && (randstun < 16)) {
this.targ.isstunned = 1;
this.targ.stuncount = 1;
}
}
if (this.towerid == 5) {
this.targ.ispoisoned = 1;
this.targ.poisoncount = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < 4225) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[i].ispoisoned = 1;
_root.creepArray[i].poisoncount = 1;
}
i++;
}
if (this.tier == 1) {
this.targ.poisonedlevel = 150;
} else if (this.tier == 2) {
this.targ.poisonedlevel = 600;
} else if (this.tier == 3) {
this.targ.poisonedlevel = 2700;
}
_root.poisonball.duplicateMovieClip("poisonball" + _root.splashct, 6300 + _root.splashct);
_root["poisonball" + _root.splashct]._x = this._x;
_root["poisonball" + _root.splashct]._y = this._y;
_root["poisonball" + _root.splashct]._width = 80;
_root["poisonball" + _root.splashct]._height = 80;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 6) {
if (this.targ.health < (0.35 * this.targ.maxhealth)) {
randdeath = random(100);
if ((this.tier == 1) && (randdeath < 8)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 2) && (randdeath < 12)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
} else if ((this.tier == 3) && (randdeath < 16)) {
this.targ.health = 0;
_root.skull.duplicateMovieClip("skull" + _root.pwncount, 5750 + _root.pwncount);
_root["skull" + _root.pwncount]._x = this._x;
_root["skull" + _root.pwncount]._y = this._y;
_root.pwncount++;
if (_root.pwncount > 20) {
_root.pwncount = 1;
}
}
}
}
if (this.towerid == 8) {
k = 0;
while (k <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[k]._x, 2) + Math.pow(this._y - _root.creepArray[k]._y, 2);
if (d < 10000) {
_root.creepArray[k].health = _root.creepArray[k].health - this.damage;
_root.creepArray[k].splashslowed = 1;
_root.creepArray[k].splashslowedcount = 0;
}
k++;
}
_root.explodingshot.duplicateMovieClip("explodingshot" + _root.explodecount, 5100 + _root.explodecount);
_root["explodingshot" + _root.explodecount]._x = this._x;
_root["explodingshot" + _root.explodecount]._y = this._y;
_root.explodecount++;
if (_root.explodecount > 20) {
_root.explodecount = 1;
}
}
if (this.towerid == 999) {
if (this.targ.health < (0.65 * this.targ.maxhealth)) {
randteleport = random(100);
if ((this.tier == 1) && (randteleport < 8)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
_root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 2) && (randteleport < 9)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 3) && (randteleport < 10)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 4) && (randteleport < 11)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
} else if ((this.tier == 5) && (randteleport < 13)) {
this.targ._x = _root.wp1._x;
this.targ._y = _root.wp1._y;
this.targ.targ = 2;
root.tele.duplicateMovieClip("tele" + _root.telecount, 5700 + _root.telecount);
_root["tele" + _root.telecount]._x = this._x;
_root["tele" + _root.telecount]._y = this._y;
_root.telecount++;
if (_root.telecount > 20) {
_root.telecount = 1;
}
}
}
}
if (this.towerid == 100) {
if (this.tier == 1) {
spradius = 1225;
spwidth = 35;
} else if (this.tier == 2) {
spradius = 1600;
spwidth = 40;
} else if (this.tier == 3) {
spradius = 2025;
spwidth = 45;
} else if (this.tier == 4) {
spradius = 2500;
spwidth = 50;
} else if (this.tier == 5) {
spradius = 3600;
spwidth = 60;
}
j = 0;
while (j <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[j]._x, 2) + Math.pow(this._y - _root.creepArray[j]._y, 2);
if (d < spradius) {
if ((("" + _root.creepArray[j]) != "") && (_root.creepArray[j] != this.targ)) {
_root.creepArray[j].health = _root.creepArray[j].health - (this.damage * (1 - (d / 3600)));
}
_root.creepArray[j].splashslowed = 1;
_root.creepArray[j].splashslowedcount = 1;
}
j++;
}
_root.iceball.duplicateMovieClip("iceball" + _root.splashct, 5200 + _root.splashct);
_root["iceball" + _root.splashct]._x = this._x;
_root["iceball" + _root.splashct]._y = this._y;
_root["iceball" + _root.splashct]._width = spwidth;
_root["iceball" + _root.splashct]._height = spwidth;
_root.splashct++;
if (_root.splashct > 20) {
_root.splashct = 1;
}
}
if (this.towerid == 3) {
if (this.tier == 1) {
this.targ.isslow = 0.7;
}
if (this.tier == 2) {
this.targ.isslow = 0.65;
}
if (this.tier == 3) {
this.targ.isslow = 0.6;
}
if (this.tier == 4) {
this.targ.isslow = 0.5;
}
this.targ.slowcount = 1;
} else if (this.towerid == 2) {
splashrad = 72;
splashrad2 = splashrad * splashrad;
i = 0;
while (i <= _root.creepArray.length) {
if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < splashrad2) {
_root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / 6000)));
}
}
i++;
}
_root.explosion.duplicateMovieClip("explosion" + _root.explosioncount, 5000 + _root.explosioncount);
_root["explosion" + _root.explosioncount]._x = this._x;
_root["explosion" + _root.explosioncount]._y = this._y;
_root["explosion" + _root.explosioncount]._width = 144;
_root["explosion" + _root.explosioncount]._height = 144;
_root.explosioncount++;
if (_root.explosioncount > 20) {
_root.explosioncount = 1;
}
}
if (this.targ.health <= 0) {
this.targ.isDead = 1;
}
this.removeMovieClip();
}
}
};
}
function checkkill() {
n = 0;
while (n < _root.creepArray.length) {
if (_root.creepArray[n].health <= 0) {
if (((_root.creepArray[n].gold != "undefined") && (_root.creepArray[n].gold != "null")) && (_root.creepArray[n].gold > 0)) {
_root.gold = _root.gold + _root.creepArray[n].gold;
_root.score = _root.score + _root.creepArray[n].maxhealth;
_root.kills++;
_root.creepArray[n].removeMovieClip();
_root.creepArray.splice(n, 1);
}
}
n++;
}
}
function kill(creep) {
_root.kills++;
if (_root.kills >= _root.waves[_root.wave - 1][0]) {
_root.kills = 0;
_root.newLevel();
}
creep.onEnterFrame = function () {
this.removeMovieClip();
};
}
function upgrade() {
a = _root.selectedTower;
b = a.tier - 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.tier++;
_root.towerInfo(a);
_root.gold = _root.gold - int(a.upgrades[b][1]);
updateInfoBar();
}
}
function sell() {
tower = _root.selectedTower;
if (((tower != "undefined") && (tower != "null")) && (tower != "")) {
sellprice = Math.floor(tower.cost * 0.85);
_root.gold = _root.gold + sellprice;
_root.range._x = 1000;
_root.range._height = 0;
_root.range._width = 0;
if (tower.maxtier == 1) {
_root.gems++;
}
tower.removeMovieClip();
_root.UpgradeTowerInfo._visible = false;
}
}
function leak(creep) {
_root.creepLeaks++;
_root.lives--;
creep._x = _root.wp1._x;
creep._y = _root.wp1._y;
creep.targ = 1;
}
stop();
_root.levelwin = 0;
_root.gold = 50;
_root.gems = _global.gems;
_root.attackskill = _global.attackskill;
_root.rangeskill = _global.rangeskill;
_root.killbounty = _global.killbounty;
_root.wave = 0;
_root.levelnew = 1;
if (_global.startmoneylevel == 1) {
_root.gold = 100;
} else if (_global.startmoneylevel == 2) {
_root.gold = 150;
} else if (_global.startmoneylevel == 3) {
_root.gold = 250;
} else if (_global.startmoneylevel == 4) {
_root.gold = 350;
} else if (_global.startmoneylevel == 5) {
_root.gold = 500;
}
_root.gameover = 0;
_root.towerCount = 0;
_root.creepcount = 1;
_root.kills = 0;
_root.pauses = 0;
_root.techlevel = _global.techlevel;
_root.creepleaks = 0;
_root.timer = 45;
_root.lives = 20;
_root.goldworth = 0;
_root.creepArray = [];
_global.sound = 1;
_root.particlecount = 1;
_global.maxwaves = 100000 /* 0x0186A0 */;
_root.splashct = 1;
_root.pwncount = 1;
_root.explodecount = 1;
_root.score = 0;
_root.gems = _global.gems;
_root.playsound = new Sound(this);
_root.playsound.attachSound("music");
if (_global.sound == 1) {
_root.playsound.start(0, 100000);
}
_root.playsound1 = new Sound(this);
_root.playsound1.attachSound("sndplasma");
_root.playsound2 = new Sound(this);
_root.playsound2.attachSound("sndrocket");
_root.playsound3 = new Sound(this);
_root.playsound3.attachSound("sndbullet");
_root.playsound4 = new Sound(this);
_root.playsound4.attachSound("sndbullet1");
_root.playsound5 = new Sound(this);
_root.playsound5.attachSound("sndexplode");
_root.playsound6 = new Sound(this);
_root.playsound6.attachSound("sndlaser");
_root.waves = [[30, 110, 2.5, 1000], [30, 129, 3, 900], [30, 151, 1.5, 600], [30, 176, 2.5, 1000], [30, 207, 2.7, 900], [30, 241, 2.5, 1000], [30, 282, 1, 400], [30, 331, 3.5, 900], [30, 387, 2, 1000], [30, 453, 2.5, 1000], [30, 531, 1.75, 800], [30, 621, 2, 1000], [30, 727, 1.5, 600], [30, 850, 3.5, 900], [30, 996, 2, 1000], [30, 1164, 3, 750], [30, 1363, 2.5, 800], [30, 1594, 3, 1000], [30, 1865, 1.5, 500], [30, 2182, 2, 900], [30, 2559, 2.5, 800], [30, 3000, 3.5, 900], [30, 3517, 1.75, 600], [30, 4124, 1.5, 500], [30, 4836, 2, 800], [30, 5670, 4, 1000], [30, 6648, 2.5, 800], [30, 7795, 3, 900], [30, 9140, 1.5, 800], [30, 10654, 3, 900], [30, 12593, 2, 800], [30, 14796, 2.5, 900], [30, 17387, 1.5, 500], [30, 20428, 2.5, 800], [30, 24004, 2, 900], [30, 28204, 3.5, 800], [30, 33141, 2, 800], [30, 38941, 1.5, 300], [30, 45755, 2, 700], [30, 53762, 2.5, 900], [30, 63439, 1.75, 500], [30, 74858, 2.5, 1000], [30, 88333, 2, 750], [30, 104233, 3, 850], [30, 122995, 2, 900], [30, 145134, 1.5, 600], [30, 171258, 2, 750], [30, 20285, 3, 750], [30, 238460, 2.25, 800], [30, 281383, 1.75, 500], [30, 337660, 2.75, 800], [30, 405192, 2.45, 900], [30, 486232, 2, 700], [30, 583477, 2.5, 750], [30, 700137, 1.75, 600], [30, 840208, 2.25, 850], [30, 1008250, 2.75, 900], [30, 1209899, 2, 750], [30, 1451880, 1.75, 800], [30, 1742250, 1.75, 800]];
_root.nowhp = 0;
_root.nowspeed = 0;
_root.nexthp = 43;
_root.nextspeed = 2.5;
stop();
Instance of Symbol 177 MovieClip "wp1" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp2" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp3" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp4" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp5" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp6" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp7" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp8" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp9" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 177 MovieClip "wp10" in Frame 37
onClipEvent (enterFrame) {
_root.checkkill();
}
Instance of Symbol 179 MovieClip in Frame 37
onClipEvent (load) {
this._visible = false;
this.startDrag(true);
this.count = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(77) && (_global.sound == 1)) {
_global.sound = 0;
stopAllSounds();
}
if (Key.isDown(78) && (_global.sound == 0)) {
_global.sound = 1;
_root.playsound.start(0, 100000);
}
if (Key.isDown(80) && (_root.pauses == 0)) {
_root.pauses = 1;
}
if (Key.isDown(85) && (_root.pauses == 1)) {
_root.pauses = 0;
}
if (_root.pauses == 0) {
_root.checkkill();
_root.levelnew++;
this.count++;
if ((this.count % 30) == 0) {
_root.timer--;
}
if (_root.timer <= 0) {
_root.newLevel();
_root.timer = 60;
}
if ((_root.lives <= 0) && (_root.gameover == 0)) {
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
if (_root.creepArray.length <= 0) {
_root.gotoAndPlay("lose11");
}
}
if (_root.wave >= _global.maxwaves) {
z = 1;
while (z < _root.creepArray.length) {
if (_root.creepArray[z] == undefined) {
_root.creepArray[z].removeMovieClip();
_root.creepArray.splice(z, 1);
}
z++;
}
}
if (((((_root.wave >= _global.maxwaves) && (_root.creepArray.length <= 0)) && (_root.gameover == 0)) && (_root.kills >= _root.waves[_root.wave - 1][0])) && (_root.levelnew > 120)) {
_root.levelwin = 1;
i = 0;
while (i < _root.creepArray.length) {
_root.creepArray[i].removeMovieClip();
_root.creepArray.splice(i, 1);
i++;
}
j = 0;
while (j <= _root.towerCount) {
_root["t" + j].removeMovieClip();
j++;
}
_root.marker.swapDepths(9994);
_root.marker.removeMovieClip();
_root.range.swapDepths(9993);
_root.range.removeMovieClip();
_root.creep1.swapDepths(9992);
_root.creep1.removeMovieClip();
_root.UpgradeTowerInfo.swapDepths(9991);
_root.UpgradeTowerInfo.removeMovieClip();
_root.gotoAndPlay("win11");
}
}
}
Instance of Symbol 190 MovieClip "towericon1" in Frame 37
on (press) {
_root.marker.active = 1;
_root.marker.tower = "basic";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Tower. Shoots bullets at enemies. 80 Pre-mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 193 MovieClip "towericon2" in Frame 37
on (press) {
_root.marker.active = 1;
_root.marker.tower = "splash";
_root.marker.cost = 50;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Basic Splash Tower. Shoots Exploding bullets at enemies. 29 Pre-Mod base damage. Cost: $50";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 196 MovieClip "towericon3" in Frame 37
on (press) {
_root.marker.active = 1;
_root.marker.tower = "slow";
_root.marker.cost = 150;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Slow Tower. Shoots shots that slow the enemy. 100 Pre-Mod base damage. Cost: $150";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 199 MovieClip "towericon4" in Frame 37
onClipEvent (load) {
if (_root.techlevel < 1) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 1) {
_root.marker.active = 1;
_root.marker.tower = "poison";
_root.marker.cost = 500;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Splash Poison Tower. Splashes Poison(150/sec for level 1) to hurt the enemy. 300 Pre-Mod base damage. Tech Level 1 needed. Cost: $500";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 203 MovieClip "towericon5" in Frame 37
onClipEvent (load) {
if (_root.techlevel < 4) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 4) {
_root.marker.active = 1;
_root.marker.tower = "explode";
_root.marker.cost = 1000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Exploding Tower. Damages and slows all enemies in a radius of itself. 500 Pre-Mod base damage. Cost: $1000. Requires Tech Level 4";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 207 MovieClip "towericon6" in Frame 37
onClipEvent (load) {
if (_root.techlevel < 2) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 2) {
_root.marker.active = 1;
_root.marker.tower = "death";
_root.marker.cost = 650;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Instant death tower. 8% chance to instantly kill if target is under 35% HP. 500 Pre-Mod base damage. Cost: $650. Requires Tech Level 2";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 211 MovieClip in Frame 37
onClipEvent (load) {
if (_root.techlevel < 3) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if (_root.techlevel >= 3) {
_root.marker.active = 1;
_root.marker.tower = "stun";
_root.marker.cost = 700;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Stun Tower. Has a 10% chance of stunning enemies. 500 Pre-Mod base damage. Cost: $700. Requires Tech Level 3";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 214 MovieClip "towericon8" in Frame 37
on (press) {
_root.marker.active = 1;
_root.marker.tower = "rust";
_root.marker.cost = 400;
_root.tinfo._visible = false;
}
on (rollOver) {
_root.buyinfo = "Rust Tower. Shoots shots that rust the enemy, causing them to take more damage. 300 Pre-Mod base damage. Ultra Fast. Cost: $400";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 218 MovieClip "towericon9" in Frame 37
onClipEvent (load) {
if (_root.techlevel < 5) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
on (press) {
if ((_root.gems > 0) && (_root.techlevel >= 5)) {
_root.marker.active = 1;
_root.marker.tower = "ultimate";
_root.marker.cost = 20000;
_root.tinfo._visible = false;
}
}
on (rollOver) {
_root.buyinfo = "Ultimate Tower. Extreme Damage and splash. 165000 Pre-Mod damage. Cost: $20000. Requires Tech Level 5 and 1 Gem in addition to cost";
_root.tinfo._x = this._x;
_root.tinfo._y = this._y;
_root.tinfo._visible = true;
}
on (rollOut) {
_root.buyinfo = "";
_root.tinfo._visible = false;
}
Instance of Symbol 190 MovieClip "tower_basic" in Frame 37
onClipEvent (load) {
title = "Basic Damage Tower";
desc = "Basic Damage Tower";
cost = 50;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = 80 * (1 + (0.05 * _global.attackskill));
this.damage2 = 400 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 400(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 175, this.damage2, this.range, 30], ["Damage: 2000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 625, this.damage3, this.range, 30], ["Damage: 10000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: None", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_basic")) {
if (target == undefined) {
target = 0;
}
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 1);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 193 MovieClip "tower_splash" in Frame 37
onClipEvent (load) {
title = "Splash Tower";
desc = "Splash Tower";
cost = 50;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(29 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 145 * (1 + (0.05 * _global.attackskill));
this.damage3 = 725 * (1 + (0.05 * _global.attackskill));
this.damage4 = 3625 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 145(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 175, this.damage2, this.range, 30], ["Damage: 725(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 625, this.damage3, this.range, 30], ["Damage: 3625(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Splash", 2125, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_splash")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > ((range * range) + 81)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 196 MovieClip "tower_slow" in Frame 37
onClipEvent (load) {
title = "Slow tower";
desc = "Slow tower";
cost = 150;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(100 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2200 * (1 + (0.05 * _global.attackskill));
this.damage4 = 10500 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 500, this.damage2, this.range, 30], ["Damage: 2200(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 1250, this.damage3, this.range, 30], ["Damage: 10500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect: Slow", 3150, this.damage4, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_slow")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 3);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 199 MovieClip "tower_poison" in Frame 37
onClipEvent (load) {
title = "Splash Poison";
desc = "Splash Poison";
cost = 500;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(600)", 1500, this.damage2, this.range, 30], ["Damage: 4000(pre-mod)\rRange: 75(pre-mod)\rCooldown: 30\rEffect:Poison(2700)", 5000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "shot", this.damage, 5);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound5.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 203 MovieClip "tower_explode" in Frame 37
onClipEvent (load) {
title = "Explosion";
desc = "Explosion";
cost = 1000;
range = 100;
damage = 500;
this.range = 100 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 1800 * (1 + (0.05 * _global.attackskill));
this.damage3 = 9000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 1800(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 3000, this.damage2, this.range, 40], ["Damage: 9000(pre-mod)\rRange: 100(pre-mod)\rCooldown: 40\rEffect:Slow", 10000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_explode")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, this, 10, 1, 10, "redbullet", this.damage, 8);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound1.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 207 MovieClip "tower_death" in Frame 37
onClipEvent (load) {
title = "Instant Death";
desc = "Instant Death";
cost = 650;
this.range = 80 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3000 * (1 + (0.05 * _global.attackskill));
this.damage3 = 15000 * (1 + (0.05 * _global.attackskill));
rate = 40;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(12%)", 2000, this.damage2, this.range, 40], ["Damage: 15000(pre-mod)\rRange: 80(pre-mod)\rCooldown: 40\rEffect:Death(16%)", 7000, this.damage3, this.range, 40]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 6);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound6.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 211 MovieClip "tower_stun" in Frame 37
onClipEvent (load) {
title = "Stun Tower";
desc = "Stun Tower";
cost = 700;
rate = 30;
this.range = 70 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(500 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 3500 * (1 + (0.05 * _global.attackskill));
this.damage3 = 17000 * (1 + (0.05 * _global.attackskill));
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 3;
upgrades = [["Damage: 3500(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(13%)", 2500, this.damage2, this.range, 30], ["Damage: 17000(pre-mod)\rRange: 70(pre-mod)\rCooldown: 30\rEffect:Stun(16%)", 9000, this.damage3, this.range, 30]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "blueshot", this.damage, 7);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound4.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 214 MovieClip "tower_rust" in Frame 37
onClipEvent (load) {
title = "Rust Tower";
desc = "Rust Tower";
cost = 400;
this.range = 75 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(300 * (1 + (0.05 * _global.attackskill)));
this.damage2 = 930 * (1 + (0.05 * _global.attackskill));
this.damage3 = 2000 * (1 + (0.05 * _global.attackskill));
this.damage4 = 5000 * (1 + (0.05 * _global.attackskill));
rate = 12;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 4;
upgrades = [["Damage: 930\rRange: 75\rCooldown: 12\rEffect: Rust", 1200, this.damage2, this.range, 12], ["Damage: 2000\rRange: 75\rCooldown: 12\rEffect: Rust", 3000, this.damage3, this.range, 12], ["Damage: 5000\rRange: 75\rCooldown: 12\rEffect: Rust", 6000, this.damage4, this.range, 12]];
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if (((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "yellowshot", this.damage, 4);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound3.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 218 MovieClip "tower_ultimate" in Frame 37
onClipEvent (load) {
title = "Ultimate Tower";
desc = "Ultimate Tower";
cost = 20000;
damage = 165000 /* 0x028488 */;
this.range = 85 * (1 + (0.05 * _global.rangeskill));
this.range = Math.floor(this.range);
damage = Math.floor(165000 * (1 + (0.05 * _global.attackskill)));
rate = 30;
lastFire = rate;
lastChecked = rate;
creep = "";
target = 0;
tier = 1;
maxtier = 1;
}
on (press) {
_root.towerInfo(this);
_root.TowerInfo(this);
}
onClipEvent (enterFrame) {
if ((((active == 1) && (_root.creepArray.length > 0)) && (_root.pauses == 0)) && (this._name != "tower_ultimate")) {
lastChecked++;
if (lastChecked >= rate) {
if (target == 0) {
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else if (("" + creep) == "") {
target = 0;
i = 0;
while (i <= _root.creepArray.length) {
d = Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2);
if (d < ((range * range) + 81)) {
target = 1;
creep = _root.creepArray[i];
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
break;
}
i++;
}
} else {
d = Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2);
if (d > (range * range)) {
lastChecked = 999;
target = 0;
} else {
_root.fire(this, creep, 10, 1, 10, "redbullet", this.damage, 2);
lastChecked = 0;
if (_global.sound == 1) {
_root.playsound2.start(0, 1);
}
}
}
}
}
}
Instance of Symbol 221 MovieClip "marker" in Frame 37
onClipEvent (load) {
active = 0;
inpath = 0;
this.swapDepths(9998);
}
onClipEvent (enterFrame) {
if (active == 1) {
this.startDrag(true);
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((maphit == 1) && (inpath == 0)) {
this.gotoAndStop(1);
_root.range.gotoAndStop(1);
} else {
this.gotoAndStop(2);
_root.range.gotoAndStop(2);
}
_root.range._x = _x;
_root.range._y = _y;
_root.range._width = _root["tower_" + tower].range * 2;
_root.range._height = _root["tower_" + tower].range * 2;
}
if (Key.isDown(32)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
on (press) {
maphit = _root.map.hitTest(_x, _y, 1);
inpath = 0;
i = 1;
while (i <= 10) {
if (this.hitTest(_root["track" + i])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
i++;
}
if (inpath == 0) {
j = 0;
while (j <= _root.towerCount) {
if (this.hitTest(_root["t" + j])) {
inpath = 1;
}
if (inpath == 1) {
break;
}
j++;
}
}
if ((((maphit == 1) && (inpath == 0)) && (_root.gold >= this.cost)) && (_root.pauses == 0)) {
if (this.hitTest(_root.nextwave) == false) {
if (_root.marker.tower == "ultimate") {
if (_root.gems > 0) {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gems--;
}
} else {
_root.towerCount++;
_root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 10000 + _root.towerCount);
a = _root["t" + _root.towerCount];
a._x = _x;
a._y = _y;
a.active = 1;
_root.gold = _root.gold - this.cost;
}
}
}
if (maphit == 0) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
if (this.hitTest(_root.nextwave)) {
active = 0;
_x = 1000;
_root.selectedTower = "";
_root.range._x = 1000;
_root.range._width = 10;
_root.range._height = 10;
_root.UpgradeTowerInfo._visible = false;
this.stopDrag();
}
}
Instance of Symbol 223 MovieClip "range" in Frame 37
onClipEvent (enterFrame) {
if ((_root.selectedTower == "") && (_root.marker.active == 0)) {
this._visible = false;
} else {
this._visible = true;
}
}
Instance of Symbol 230 MovieClip "UpgradeTowerInfo" in Frame 37
onClipEvent (load) {
_visible = false;
swapDepths(100000);
}
Instance of Symbol 245 MovieClip "explosion" in Frame 37
onClipEvent (load) {
if (this._name == "explosion") {
this._visible = false;
}
}
Instance of Symbol 341 MovieClip in Frame 37
onClipEvent (enterFrame) {
if (_root.timer > 45) {
this._visible = true;
} else {
this._visible = false;
}
}
Frame 38
stop();
_root.gameover = 1;
stopAllSounds();
if (_root.levelwin == 0) {
_root.gotoAndPlay("lose11");
}
Frame 39
stop();
_root.gameover = 1;
stopAllSounds();
storedskills = SharedObject.getLocal("flashskill");
if ((storedskills.data.level11score == undefined) || (_root.score > storedskills.data.level11score)) {
storedskills.data.level11score = _root.score;
}
var o = {n:[2, 6, 0, 6, 4, 11, 13, 0, 15, 14, 10, 7, 0, 8, 9, 15], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
Frame 40
_root.gotoAndStop("levelselect");
Symbol 515 MovieClip [__Packages.mochi.as2.MochiAd] Frame 0
class mochi.as2.MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("3.02 as2");
}
static function showPreGameAd(options) {
var _local26 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
mochi.as2.MochiAd.containerNotify(clip, {id:"hostLoadPcnt", pcnt:_local2}, clip._mochiad._containerLCName);
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local9 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local9);
var clip = options.clip;
var _local8 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local7 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local7._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local7.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local7._mochiad_loaded = true;
if (_local7._url.indexOf("http") != 0) {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
}
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
mochi.as2.MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new Object();
var _local9 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local9;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local9);
_local6.lc = _local5;
_local4.lc = _local9;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
containerNotify(clip, {id:"unload"}, clip._mochiad._containerLCName);
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
containerRpcResult(clip, callbackID, _local4, clip._mochiad._containerLCName);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
containerRpcResult(clip, callbackID, _local3, clip._mochiad._containerLCName);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
static function containerNotify(clip, args, lcName) {
var _local1 = clip._mochiad._mochiad_ctr.ad.app;
if (_local1.notify) {
_local1.notify(args);
} else {
new LocalConnection().send(lcName, "notify", args);
}
}
static function containerRpcResult(clip, callbackID, val, lcName) {
var _local1 = clip._mochiad._mochiad_ctr.ad.app;
if (_local1.rpcResult) {
_local1.rpcResult(callbackID, val);
} else {
new LocalConnection().send(lcName, "rpcResult", callbackID, val);
}
}
}
Symbol 516 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _loader, _loaderListener, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function get childClip() {
return(_clip);
}
static function getVersion() {
return("3.02 as2");
}
static function allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function get isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function set comChannelName(val) {
if (val != undefined) {
if (val.length > 3) {
_sendChannelName = val + "_fromgame";
initComChannels();
}
}
//return(__get__comChannelName());
}
static function get connected() {
return(_connected);
}
static function connect(id, clip, onError) {
warnID(id, false);
if ((!_connected) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.as2.MochiServices.onError = onError;
} else if (mochi.as2.MochiServices.onError == undefined) {
mochi.as2.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var _local3 = "_mochiservices_com_" + id;
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servicesURL != undefined) {
_servicesURL = urlOptions().servicesURL;
}
allowDomains(_servicesURL);
_clip = clip.createEmptyMovieClip(_local3, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, [errorCode]);
};
_loaderListener.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_loaderListener.startTime = getTimer();
_loaderListener.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_loaderListener.waitInterval = setInterval(_loaderListener, "wait", 1000);
_loader.addListener(_loaderListener);
_loader.loadClip((((_servicesURL + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.as2.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel._nextcallbackID = 0;
_listenChannel._callbacks = {};
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_clip, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _listenChannel._callbacks[_local1.callbackID];
}
delete _listenChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
if ((args.options != null) && (args.options.onError != null)) {
args.options.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
} else {
if ((_clip == undefined) || (!_connecting)) {
onError.apply(null, ["NotConnected"]);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
}
_listenChannel._callbacks[_listenChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_listenChannel._nextcallbackID++;
}
static function urlOptions() {
var _local5 = {};
if (_root.mochiad_options) {
var _local4 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
_local5[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local5);
}
static function warnID(bid, leaderboard) {
bid = bid.toLowerCase();
if (bid.length != 16) {
trace(("WARNING: " + (leaderboard ? "board" : "game")) + " ID is not the appropriate length");
return(undefined);
}
if (bid == "1e113c7239048b3f") {
if (leaderboard) {
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
}
return(undefined);
}
if (bid == "84993a1de4031cd8") {
if (leaderboard) {
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
}
return(undefined);
}
var _local1 = 0;
while (_local1 < bid.length) {
switch (bid.charAt(_local1)) {
case "0" :
case "1" :
case "2" :
case "3" :
case "4" :
case "5" :
case "6" :
case "7" :
case "8" :
case "9" :
case "a" :
case "b" :
case "c" :
case "d" :
case "e" :
case "f" :
break;
default :
trace("WARNING: Board ID contains illegal characters: " + bid);
return(undefined);
}
_local1++;
}
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var _local2 = new Object();
_local2.mav = getVersion();
_local2.swfv = btn.getSWFVersion() || 6;
_local2.swfurl = btn._url;
_local2.fv = System.capabilities.version;
_local2.os = System.capabilities.os;
_local2.lang = System.capabilities.language;
_local2.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var _local3 = 0;
for (var _local6 in _local2) {
if (_local3 != 0) {
s = s + "&";
}
_local3++;
s = ((s + _local6) + "=") + escape(_local2[_local6]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var _local7 = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://x.mochiads.com/linkping.swf?t=" + getTimer());
_local7.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
mochi.as2.MochiServices.netup = false;
}
};
}
var _local4 = btn.createEmptyMovieClip("clk", 1001);
_local4._alpha = 0;
_local4.beginFill(1044735);
_local4.moveTo(0, 0);
_local4.lineTo(0, btn._height);
_local4.lineTo(btn._width, btn._height);
_local4.lineTo(btn._width, 0);
_local4.lineTo(0, 0);
_local4.endFill();
_local4.onRelease = function () {
if (mochi.as2.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static var _servicesURL = "http://www.mochiads.com/static/lib/services/services.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
}
Symbol 517 MovieClip [__Packages.mochi.as2.MochiScores] Frame 0
class mochi.as2.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.as2.MochiServices.warnID(boardID, true);
mochi.as2.MochiScores.boardID = boardID;
mochi.as2.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
if ((options.clip == null) || (options.clip == undefined)) {
options.clip = mochi.as2.MochiServices.clip;
}
if ((options.clip != mochi.as2.MochiServices.__get__clip()) || (mochi.as2.MochiServices.__get__childClip()._target == undefined)) {
mochi.as2.MochiServices.disconnect();
trace("WARNING! This application is attempting to connect to MochiServices inside a showLeaderboard call!");
trace("make sure MochiServices.connect is called as early in the application runtime as possible.");
mochi.as2.MochiServices.connect(mochi.as2.MochiServices.__get__id(), options.clip);
}
delete options.clip;
if (options.name != null) {
if (typeof(options.name) == "object") {
if (options.name.text != undefined) {
options.name = options.name.text;
}
}
}
if (options.score != null) {
if (options.score instanceof TextField) {
if (options.score.text != undefined) {
options.score = options.score.text;
}
} else if (options.score instanceof mochi.as2.MochiDigits) {
options.score = options.score.value;
}
var _local1 = Number(options.score);
if (isNaN(_local1)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'");
} else if ((_local1 == Number.NEGATIVE_INFINITY) || (_local1 == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(_local1) != _local1) {
trace(("WARNING: Submitted score '" + options.score) + "' will be truncated");
}
options.score = _local1;
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.as2.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
mochi.as2.MochiServices.__get__clip().play();
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
mochi.as2.MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
mochi.as2.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
mochi.as2.MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
score = Number(score);
if (isNaN(score)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'");
} else if ((score == Number.NEGATIVE_INFINITY) || (score == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(score) != score) {
trace(("WARNING: Submitted score '" + String(score)) + "' will be truncated");
}
score = Number(score);
}
mochi.as2.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
static function scoresArrayToObjects(scores) {
var _local5 = {};
var _local1;
var _local4;
var _local2;
var _local6;
for (var _local8 in scores) {
if (typeof(scores[_local8]) == "object") {
if ((scores[_local8].cols != null) && (scores[_local8].rows != null)) {
_local5[_local8] = [];
_local2 = scores[_local8];
_local4 = 0;
while (_local4 < _local2.rows.length) {
_local6 = {};
_local1 = 0;
while (_local1 < _local2.cols.length) {
_local6[_local2.cols[_local1]] = _local2.rows[_local4][_local1];
_local1++;
}
_local5[_local8].push(_local6);
_local4++;
}
} else {
_local5[_local8] = {};
for (var _local7 in scores[_local8]) {
_local5[_local8][_local7] = scores[_local8][_local7];
}
}
} else {
_local5[_local8] = scores[_local8];
}
}
return(_local5);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 518 MovieClip [__Packages.mochi.as2.MochiDigits] Frame 0
class mochi.as2.MochiDigits
{
var Encoder, Fragment, Sibling;
function MochiDigits (digit, index) {
Encoder = 0;
setValue(digit, index);
}
function get value() {
return(Number(toString()));
}
function set value(v) {
setValue(v);
//return(value);
}
function addValue(v) {
value = value + v;
}
function setValue(digit, index) {
var _local3 = digit.toString();
if ((index == undefined) || (isNaN(index))) {
index = 0;
}
Fragment = _local3.charCodeAt(index++) ^ Encoder;
if (index < _local3.length) {
Sibling = new mochi.as2.MochiDigits(digit, index);
} else {
Sibling = null;
}
reencode();
}
function reencode() {
var _local2 = int(2147483647 * Math.random());
Fragment = Fragment ^ (_local2 ^ Encoder);
Encoder = _local2;
}
function toString() {
var _local2 = String.fromCharCode(Fragment ^ Encoder);
return(((Sibling != null) ? (_local2.concat(Sibling.toString())) : (_local2)));
}
}
Symbol 12 Button
on (release) {
getURL ("http://www.flashgamesnexus.com", "_blank");
}
Symbol 18 Button
on (release) {
getURL ("http://www.flashninjaclan.com", "_blank");
}
Symbol 22 Button
on (release) {
_root.gotoAndStop("levelselect");
}
Symbol 25 Button
on (release) {
_root.gotoAndStop("instr");
}
Symbol 28 Button
on (release) {
getURL ("http://www.flashgamesnexus.com/flash-games-category/Tower-Defense.php", "_blank");
}
Symbol 32 Button
on (release) {
getURL ("http://www.flashninjaclan.com/fncgames.php", "_blank");
}
Symbol 36 Button
on (release) {
_root.gotoAndPlay("mainmenu");
}
Symbol 40 Button
on (release) {
_root.gotoAndPlay("skillsshop");
}
Instance of Symbol 53 MovieClip in Symbol 54 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 1) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 59 MovieClip in Symbol 60 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 2) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 64 MovieClip in Symbol 65 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 3) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 64 MovieClip in Symbol 69 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 4) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 64 MovieClip in Symbol 73 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 5) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 64 MovieClip in Symbol 77 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 6) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 64 MovieClip in Symbol 81 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 8) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 64 MovieClip in Symbol 85 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 9) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 64 MovieClip in Symbol 89 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 10) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 64 MovieClip in Symbol 104 MovieClip Frame 1
onClipEvent (load) {
if (_root.maxlevelbeat < 7) {
this._visible = true;
} else {
this._visible = false;
}
}
Symbol 118 Button
on (release) {
if ((_global.xpleft > 0) && (_global.attackskill < 5)) {
_global.attackskill++;
_global.xpleft--;
_root.attackskill = _global.attackskill;
_root.xpleft = _global.xpleft;
}
}
Symbol 121 Button
on (release) {
if (_global.attackskill > 0) {
_global.attackskill--;
_global.xpleft++;
_root.attackskill = _global.attackskill;
_root.xpleft = _global.xpleft;
}
}
Symbol 125 Button
on (release) {
if ((_global.xpleft > 0) && (_global.rangeskill < 5)) {
_global.rangeskill++;
_global.xpleft--;
_root.rangeskill = _global.rangeskill;
_root.xpleft = _global.xpleft;
}
}
Symbol 126 Button
on (release) {
if (_global.rangeskill > 0) {
_global.rangeskill--;
_global.xpleft++;
_root.rangeskill = _global.rangeskill;
_root.xpleft = _global.xpleft;
}
}
Symbol 129 Button
on (release) {
if ((_global.xpleft > 0) && (_global.startmoneylevel < 5)) {
_global.startmoneylevel++;
_global.xpleft--;
_root.startmoneylevel = _global.startmoneylevel;
_root.xpleft = _global.xpleft;
}
}
Symbol 130 Button
on (release) {
if (_global.startmoneylevel > 0) {
_global.startmoneylevel--;
_global.xpleft++;
_root.startmoneylevel = _global.startmoneylevel;
_root.xpleft = _global.xpleft;
}
}
Symbol 137 Button
on (release) {
if ((_global.xpleft > 0) && (_global.killbounty < 5)) {
_global.killbounty++;
_global.xpleft--;
_root.killbounty = _global.killbounty;
_root.xpleft = _global.xpleft;
}
}
Symbol 138 Button
on (release) {
if (_global.killbounty > 0) {
_global.killbounty--;
_global.xpleft++;
_root.killbounty = _global.killbounty;
_root.xpleft = _global.xpleft;
}
}
Symbol 143 Button
on (release) {
if ((_global.xpleft > 0) && (_global.gems < 5)) {
_global.gems++;
_global.xpleft--;
_root.gems = _global.gems;
_root.xpleft = _global.xpleft;
}
}
Symbol 144 Button
on (release) {
if (_global.gems > 0) {
_global.gems--;
_global.xpleft++;
_root.gems = _global.gems;
_root.xpleft = _global.xpleft;
}
}
Symbol 146 Button
on (release) {
storedskills = SharedObject.getLocal("flashskill");
storedskills.data.attackskill = _global.attackskill;
storedskills.data.xpleft = _global.xpleft;
storedskills.data.rangeskill = _global.rangeskill;
storedskills.data.startmoneylevel = _global.startmoneylevel;
storedskills.data.killbounty = _global.killbounty;
storedskills.data.gems = _global.gems;
storedskills.data.techlevel = _global.techlevel;
if (storedskills.data.techlevel == undefined) {
storedskills.data.techlevel = 0;
}
if (storedskills.data.attackskill == undefined) {
storedskills.data.attackskill = 0;
}
if (storedskills.data.xpleft == undefined) {
storedskills.data.xpleft = 0;
}
if (storedskills.data.rangeskill == undefined) {
storedskills.data.rangeskill = 0;
}
if (storedskills.data.startmoneylevel == undefined) {
storedskills.data.startmoneylevel = 0;
}
if (storedskills.data.killbounty == undefined) {
storedskills.data.killbounty = 0;
}
if (storedskills.data.gems == undefined) {
storedskills.data.gems = 0;
}
_root.gotoAndPlay("levelselect");
}
Symbol 149 Button
on (release) {
if ((_global.xpleft > 0) && (_global.techlevel < 5)) {
_global.techlevel++;
_global.xpleft--;
_root.techlevel = _global.techlevel;
_root.xpleft = _global.xpleft;
}
}
Symbol 150 Button
on (release) {
if (_global.techlevel > 0) {
_global.techlevel--;
_global.xpleft++;
_root.techlevel = _global.techlevel;
_root.xpleft = _global.xpleft;
}
}
Symbol 177 MovieClip Frame 2
stop();
Symbol 189 MovieClip Frame 1
stop();
Symbol 189 MovieClip Frame 2
stop();
Symbol 189 MovieClip Frame 3
stop();
Symbol 189 MovieClip Frame 4
stop();
Symbol 189 MovieClip Frame 5
stop();
Instance of Symbol 189 MovieClip in Symbol 190 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Instance of Symbol 189 MovieClip in Symbol 193 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Instance of Symbol 189 MovieClip in Symbol 196 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Symbol 199 MovieClip Frame 1
stop();
Instance of Symbol 189 MovieClip in Symbol 199 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Symbol 199 MovieClip Frame 2
stop();
Symbol 203 MovieClip Frame 1
stop();
Instance of Symbol 189 MovieClip in Symbol 203 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Symbol 203 MovieClip Frame 2
stop();
Symbol 207 MovieClip Frame 1
stop();
Instance of Symbol 189 MovieClip in Symbol 207 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Symbol 207 MovieClip Frame 2
stop();
Symbol 211 MovieClip Frame 1
stop();
Instance of Symbol 189 MovieClip in Symbol 211 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Symbol 211 MovieClip Frame 2
stop();
Instance of Symbol 189 MovieClip in Symbol 214 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Symbol 218 MovieClip Frame 1
stop();
Instance of Symbol 189 MovieClip in Symbol 218 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(this._parent.tier);
}
Symbol 218 MovieClip Frame 2
stop();
Symbol 221 MovieClip Frame 1
stop();
Symbol 221 MovieClip Frame 2
stop();
Instance of Symbol 229 MovieClip "UpgradeButton" in Symbol 230 MovieClip Frame 1
on (press) {
a = _root.selectedTower;
b = a.maxtier;
c = a.tier;
if (c < b) {
_root.upgrade();
}
}
Instance of Symbol 229 MovieClip "sellbutton" in Symbol 230 MovieClip Frame 1
on (press) {
_root.sell();
}
Symbol 245 MovieClip Frame 5
if (this._name != "explosion") {
this.removeMovieClip();
}
Symbol 256 MovieClip Frame 5
this.removeMovieClip();
Symbol 261 MovieClip Frame 5
this.removeMovieClip();
Symbol 268 Button
on (release) {
if (((_root.wave < _global.maxwaves) && (_root.pauses == 0)) && (_root.timer < 45)) {
_root.kills = 0;
_root.newLevel();
_root.score = _root.score + (40 * _root.timer);
addgold = Math.floor(_root.timer / 3);
_root.gold = _root.gold + addgold;
_root.gold = Math.floor(_root.gold * 1.02);
_root.timer = 60;
}
}
Symbol 302 MovieClip Frame 1
stop();
Symbol 302 MovieClip Frame 2
stop();
Symbol 302 MovieClip Frame 3
stop();
Symbol 302 MovieClip Frame 4
stop();
Symbol 302 MovieClip Frame 5
stop();
Symbol 302 MovieClip Frame 6
stop();
Symbol 302 MovieClip Frame 7
stop();
Symbol 302 MovieClip Frame 8
stop();
Symbol 302 MovieClip Frame 9
stop();
Symbol 302 MovieClip Frame 10
stop();
Symbol 302 MovieClip Frame 11
stop();
Symbol 302 MovieClip Frame 12
stop();
Symbol 302 MovieClip Frame 13
stop();
Symbol 302 MovieClip Frame 14
stop();
Symbol 302 MovieClip Frame 15
stop();
Symbol 302 MovieClip Frame 16
stop();
Symbol 302 MovieClip Frame 17
stop();
Symbol 302 MovieClip Frame 18
stop();
Symbol 302 MovieClip Frame 19
stop();
Symbol 302 MovieClip Frame 20
stop();
Symbol 302 MovieClip Frame 21
stop();
Symbol 302 MovieClip Frame 22
stop();
Symbol 302 MovieClip Frame 23
stop();
Symbol 302 MovieClip Frame 24
stop();
Symbol 302 MovieClip Frame 25
stop();
Symbol 302 MovieClip Frame 26
stop();
Symbol 302 MovieClip Frame 27
stop();
Symbol 302 MovieClip Frame 28
stop();
Symbol 302 MovieClip Frame 29
stop();
Symbol 302 MovieClip Frame 30
stop();
Symbol 302 MovieClip Frame 31
stop();
Symbol 302 MovieClip Frame 32
stop();
Symbol 302 MovieClip Frame 33
stop();
Symbol 302 MovieClip Frame 34
stop();
Symbol 302 MovieClip Frame 35
stop();
Symbol 302 MovieClip Frame 36
stop();
Symbol 302 MovieClip Frame 37
stop();
Symbol 302 MovieClip Frame 38
stop();
Symbol 302 MovieClip Frame 39
stop();
Symbol 302 MovieClip Frame 40
stop();
Symbol 302 MovieClip Frame 41
stop();
Symbol 302 MovieClip Frame 42
stop();
Symbol 302 MovieClip Frame 43
stop();
Symbol 302 MovieClip Frame 44
stop();
Symbol 302 MovieClip Frame 45
stop();
Symbol 302 MovieClip Frame 46
stop();
Symbol 302 MovieClip Frame 47
stop();
Symbol 302 MovieClip Frame 48
stop();
Symbol 302 MovieClip Frame 49
stop();
Symbol 302 MovieClip Frame 50
stop();
Symbol 302 MovieClip Frame 51
stop();
Symbol 305 MovieClip Frame 1
stop();
Symbol 305 MovieClip Frame 2
stop();
Symbol 305 MovieClip Frame 3
stop();
Symbol 305 MovieClip Frame 4
stop();
Symbol 305 MovieClip Frame 5
stop();
Symbol 312 MovieClip Frame 1
stop();
Instance of Symbol 311 MovieClip in Symbol 312 MovieClip Frame 1
onClipEvent (enterFrame) {
if (this._parent.iscorrode != 0) {
this._visible = true;
} else {
this._visible = false;
}
}
Symbol 318 MovieClip Frame 5
if (this._name != "iceball") {
this.removeMovieClip();
}
Symbol 345 Button
on (release) {
_root.gotoAndPlay("levelselect");
}