Frame 1
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(getVersion())) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
MochiAd.showPreGameAd({id:"7e418c51514912c5", res:"640x440"});
__com_mochibot__("fa108bd1", this, 10301, true);
Frame 2
stop();
_root.bg_music.stop();
Frame 3
function distance(x1, y1, x2, y2) {
dx = x1 - x2;
dy = y1 - y2;
dist = Math.sqrt((dx * dx) + (dy * dy));
return(dist);
}
this.createEmptyMovieClip("bg_music", 60000);
var bg_music = new Sound("bg_music");
bg_music.attachSound("bg_music");
bg_music.setVolume(10);
_root.bg_music.start(0, 999999);
stop();
var lives = 20;
var speed = 1.25;
var money = 50;
var level = 1;
var level_text = "1 of 50";
var creeps = new Array();
var towers = new Array();
var placing_tower = false;
var select = null;
var creep_depth = 1000;
var tower_depth = 10000;
var bullet_depth = 20000;
var upgrade_depth = 50000;
var zombie_type = "regular_zombie";
waypoint_x = new Array(60, 180, 180, 300, 300, 380, 380, 580, 580);
waypoint_y = new Array(300, 300, 180, 180, 60, 60, 300, 300, -40);
add_zombie = true;
var delay = 55;
var delay_counter = 0;
var creep_count = 0;
var max_creeps = 10;
var level_life = (level * (level + 5));
var level_speed = 1;
var level_money = 1;
var zombie_description = (((max_creeps + " Average Zombies with ") + level_life) + " health, coming at you.");
var level_count_down_max = 175;
var level_count_down = 0;
var send_creeps = false;
onEnterFrame = function () {
if (((creep_count == max_creeps) && (_root.creeps.length == 0)) && (send_creeps)) {
this.level++;
if (this.level >= 51) {
gotoAndPlay (5);
}
this.level_text = this.level + " of 50";
this.level_life = level * (level + 5);
this.money = Math.floor(this.money * 1.1);
this.level_money = Math.floor(level / 6) + 1;
this.level_speed = 1;
switch (this.level % 4) {
case 0 :
this.zombie_type = "regular_zombie";
this.level_life = this.level_life;
this.level_speed = 1.25;
this.max_creeps = 10;
this.delay = 55;
this.zombie_description = ((max_creeps + " Average Zombies with ") + level_life) + " health, coming at you.";
break;
case 1 :
this.zombie_type = "fat_zombie";
this.level_life = Math.floor(this.level_life * 1.5);
this.level_speed = 0.75;
this.max_creeps = 10;
this.delay = 75;
this.zombie_description = ((max_creeps + " Fat Lumbering Zombies with ") + level_life) + " health, waddling towards you.";
break;
case 2 :
this.zombie_type = "crawling_zombie";
this.level_life = Math.floor(this.level_life * 0.9);
this.level_speed = 1.35;
this.max_creeps = 15;
this.delay = 45;
this.zombie_description = ((this.max_creeps + " Quick Crawling Zombie Torsos with ") + level_life) + " health, crawling along.";
break;
case 3 :
this.zombie_type = "regular_zombie";
this.level_life = Math.floor(this.level_life * 0.75);
this.level_speed = 3.5;
this.max_creeps = 10;
this.delay = 35;
this.zombie_description = ((max_creeps + " Sprinting Zombies with ") + level_life) + " health, rushing past you.";
}
_root.description_board._visible = true;
creep_count = 0;
send_creeps = false;
}
if ((!send_creeps) && (level_count_down < level_count_down_max)) {
level_count_down++;
}
if (level_count_down >= level_count_down_max) {
send_creeps = true;
level_count_down = 0;
}
if ((creep_count < max_creeps) && (send_creeps)) {
delay_counter++;
}
if ((delay_counter == delay) && (send_creeps)) {
_root.description_board._visible = false;
delay_counter = 0;
creep_count++;
creep = attachMovie("zombie_container", "zombie_container" + creep_depth, creep_depth++, {_x:60, _y:-40});
creep.mob_img = creep.attachMovie(this.zombie_type, "Zombie" + creep_depth, creep_depth++);
creep.health_border = creep.attachMovie("health_border", "health_border" + creep_depth, creep_depth++);
creep.health_bar = creep.attachMovie("health_bar", "health_bar" + creep_depth, creep_depth++);
creep.health_bar._x = creep.health_bar._x - 15;
creep.health_border._y = creep.health_border._y - 25;
creep.health_bar._y = creep.health_bar._y - 25;
creep.hp = this.level_life;
creep.life = this.level_life;
creep.money = this.level_money;
creep.speed = this.level_speed;
_root.creeps.push(creep);
creep.next_waypoint = 0;
creep.onEnterFrame = function () {
if (this.hp <= 0) {
_root.money = _root.money + this.money;
_root.creeps = _root.creeps.remove(this);
this.removeMovieClip();
}
this.health_bar._width = (this.hp / this.life) * 30;
if (this.hitTest("_root.end_spot")) {
_root.lives--;
if (_root.lives <= 0) {
_root.gotoAndPlay(4);
}
_root.creeps = _root.creeps.remove(this);
this.removeMovieClip();
}
dist_x = waypoint_x[this.next_waypoint] - this._x;
dist_y = waypoint_y[this.next_waypoint] - this._y;
if ((Math.abs(dist_x) + Math.abs(dist_y)) < this.speed) {
this.next_waypoint++;
}
angle = Math.atan2(dist_y, dist_x);
this._x = this._x + (this.speed * Math.cos(angle));
this._y = this._y + (this.speed * Math.sin(angle));
this.mob_img._rotation = ((angle / 3.14) * 180) - 90;
};
}
};
Array.prototype.remove = function (obj) {
var _local3 = [];
var _local2 = 0;
while (_local2 < this.length) {
if (this[_local2] != obj) {
_local3.push(this[_local2]);
}
_local2++;
}
return(_local3);
};
Instance of Symbol 105 MovieClip [Sniper Menu Item] in Frame 3
onClipEvent (load) {
this.onRelease = function () {
if (_root.money >= 25) {
_root.money = _root.money - 25;
var _local5 = _root.tower_depth++;
var _local3 = 0;
while (_local3 < _root.towers.length) {
_root.towers[_local3].bounds._visible = true;
_local3++;
}
turret = _root.attachMovie("pistol", "pistol" + _local5, _local5);
startDrag (turret, true);
turret.onEnterFrame = function () {
_root.placing_tower = true;
this.tower.placing = true;
var _local4 = false;
if (this.bounds.hitTest("_root.menuBar")) {
_local4 = true;
} else {
var _local3 = 1;
while (_local3 < 10) {
if (this.bounds.hitTest("_root.path.s" + _local3)) {
_local4 = true;
}
_local3++;
}
if (!_local4) {
_local3 = 0;
while (_local3 < _root.towers.length) {
if ((this != _root.towers[_local3]) && (this.bounds.hitTest(_root.towers[_local3].bounds))) {
_local4 = true;
}
_local3++;
}
}
}
if (_local4) {
this._alpha = 50;
} else {
this._alpha = 100;
}
};
turret.onRelease = function () {
if (this._alpha == 100) {
stopDrag();
_root.placing_tower = false;
this.tower.placing = false;
_root.towers.push(this);
var _local3 = 0;
while (_local3 < _root.towers.length) {
_root.towers[_local3].bounds._visible = false;
_local3++;
}
delete this.onEnterFrame;
delete this.onRelease;
}
};
}
};
}
Instance of Symbol 103 MovieClip [Gernade Thrower Menu Item] in Frame 3
onClipEvent (load) {
this.onRelease = function () {
if (_root.money >= 30) {
_root.money = _root.money - 30;
var _local5 = _root.tower_depth++;
var _local3 = 0;
while (_local3 < _root.towers.length) {
_root.towers[_local3].bounds._visible = true;
_local3++;
}
turret = _root.attachMovie("bomb", "bomb" + _local5, _local5);
startDrag (turret, true);
turret.onEnterFrame = function () {
_root.placing_tower = true;
this.tower.placing = true;
var _local4 = false;
if (this.bounds.hitTest("_root.menuBar")) {
_local4 = true;
} else {
var _local3 = 1;
while (_local3 < 10) {
if (this.bounds.hitTest("_root.path.s" + _local3)) {
_local4 = true;
}
_local3++;
}
if (!_local4) {
_local3 = 0;
while (_local3 < _root.towers.length) {
if ((this != _root.towers[_local3]) && (this.bounds.hitTest(_root.towers[_local3].bounds))) {
_local4 = true;
}
_local3++;
}
}
}
if (_local4) {
this._alpha = 50;
} else {
this._alpha = 100;
}
};
turret.onRelease = function () {
if (this._alpha == 100) {
stopDrag();
_root.placing_tower = false;
this.tower.placing = false;
_root.towers.push(this);
var _local3 = 0;
while (_local3 < _root.towers.length) {
_root.towers[_local3].bounds._visible = false;
_local3++;
}
delete this.onEnterFrame;
delete this.onRelease;
}
};
}
};
}
Instance of Symbol 101 MovieClip [SAM Launcher Menu Item] in Frame 3
onClipEvent (load) {
this.onRelease = function () {
if (_root.money >= 100) {
_root.money = _root.money - 100;
var _local5 = _root.tower_depth++;
var _local3 = 0;
while (_local3 < _root.towers.length) {
_root.towers[_local3].bounds._visible = true;
_local3++;
}
turret = _root.attachMovie("laser", "laser" + _local5, _local5);
startDrag (turret, true);
turret.onEnterFrame = function () {
_root.placing_tower = true;
this.tower.placing = true;
var _local4 = false;
if (this.bounds.hitTest("_root.menuBar")) {
_local4 = true;
} else {
var _local3 = 1;
while (_local3 < 10) {
if (this.bounds.hitTest("_root.path.s" + _local3)) {
_local4 = true;
}
_local3++;
}
if (!_local4) {
_local3 = 0;
while (_local3 < _root.towers.length) {
if ((this != _root.towers[_local3]) && (this.bounds.hitTest(_root.towers[_local3].bounds))) {
_local4 = true;
}
_local3++;
}
}
}
if (_local4) {
this._alpha = 50;
} else {
this._alpha = 100;
}
};
turret.onRelease = function () {
if (this._alpha == 100) {
stopDrag();
_root.placing_tower = false;
this.tower.placing = false;
_root.towers.push(this);
var _local3 = 0;
while (_local3 < _root.towers.length) {
_root.towers[_local3].bounds._visible = false;
_local3++;
}
delete this.onEnterFrame;
delete this.onRelease;
}
};
}
};
}
Frame 4
_root.creep_count = 9999;
_root.bg_music.stop();
i = 0;
while (i < _root.creeps.length) {
_root.creeps[i].removeMovieClip();
i++;
}
i = 0;
while (i < _root.towers.length) {
_root.towers[i].removeMovieClip();
i++;
}
stop();
Frame 5
_root.creep_count = 9999;
_root.bg_music.stop();
i = 0;
while (i < _root.creeps.length) {
_root.creeps[i].removeMovieClip();
i++;
}
i = 0;
while (i < _root.towers.length) {
_root.towers[i].removeMovieClip();
i++;
}
stop();
Symbol 16 MovieClip [pistol_turret_base] Frame 1
stop();
Symbol 16 MovieClip [pistol_turret_base] Frame 2
stop();
Symbol 16 MovieClip [pistol_turret_base] Frame 3
stop();
Symbol 16 MovieClip [pistol_turret_base] Frame 4
stop();
Symbol 16 MovieClip [pistol_turret_base] Frame 5
stop();
Symbol 24 MovieClip [pistol_turret] Frame 1
stop();
Symbol 24 MovieClip [pistol_turret] Frame 2
stop();
Symbol 24 MovieClip [pistol_turret] Frame 3
stop();
Symbol 24 MovieClip [pistol_turret] Frame 4
stop();
Symbol 24 MovieClip [pistol_turret] Frame 5
stop();
Symbol 26 Button
on (release) {
_root.select = this;
}
Instance of Symbol 27 MovieClip [tower] "tower" in Symbol 28 MovieClip [pistol] Frame 1
onClipEvent (load) {
_parent.turret.lvl1._visible = true;
_parent.turret.lvl2._visible = false;
_parent.turret.lvl3._visible = false;
_parent.turret.lvl4._visible = false;
_parent.turret.lvl5._visible = false;
_parent.base.lvl1._visible = true;
_parent.base.lvl2._visible = false;
_parent.base.lvl3._visible = false;
_parent.base.lvl4._visible = false;
_parent.base.lvl5._visible = false;
var upgrade_cost = 30;
var bullet_speed = 1;
var level = 1;
var fire_delay_counter = 0;
var target_x = 0;
var target_y = 0;
var has_target = false;
var placing = true;
var upgrade_damage = 14;
var upgrade_range = 75;
var upgrade_speed = 70;
var tower_name = ["Pistol Tower I", "Pistol Tower II", "Pistol Tower III", "Pistol Tower IV", "Pistol Tower V"];
var damage = [10, 26, 52, 140, 325];
var range = [100, 100, 110, 120, 200];
var speed = [30, 32, 35, 37, 40];
var cost = [25, 25, 50, 100, 200];
upgrade_area = _root.attachMovie("upgrade_area", "upgrade_area" + (_root.upgrade_depth++), _root.upgrade_depth);
upgrade_area.target_tower = this;
upgrade_area.setVars = function (tower) {
this.level = tower.level;
this.tower_name = tower.tower_name[this.level - 1];
this.upgrade_cost = tower.cost[this.level];
var _local4 = 0;
var _local2 = 0;
while (_local2 < this.level) {
_local4 = _local4 + tower.cost[_local2];
_local2++;
}
_local4 = Math.floor(_local4 * 0.9);
this.sell_button.sell_text = "Sell for " + _local4;
this.speed = tower.speed[this.level - 1];
this.damage = tower.damage[this.level - 1];
this.range = tower.range[this.level - 1];
this.speed_text = (int((35 / tower.speed[this.level - 1]) * 100) / 100) + " per second";
this.upgrade_damage = tower.damage[this.level];
this.upgrade_range = tower.range[this.level];
this.upgrade_speed = tower.speed[this.level];
this.upgrade_speed_text = (int((35 / tower.speed[this.level]) * 100) / 100) + " per second";
if (this.level >= 5) {
this.upgrade_damage = "At Max Level";
this.upgrade_range = "At Max Level";
this.upgrade_cost = "At Max Level";
this.upgrade_speed_text = "At Max Level";
}
};
upgrade_area.setVars(this);
upgrade_area._x = 240;
upgrade_area._y = 400;
upgrade_area.onEnterFrame = function () {
if (_root.select == _parent) {
this._visible = true;
} else {
this._visible = false;
}
};
range_circle = _parent.attachMovie("range_circle", "range_circle" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
swapDepths(_parent);
range_circle._alpha = 20;
range_circle._width = range * 2;
range_circle._height = range * 2;
range_circle.onEnterFrame = function () {
if ((_root.select == _parent) || (_root.placing_tower)) {
this._visible = true;
} else {
this._visible = false;
}
};
this.onEnterFrame = function () {
this.range_circle._width = this.range[this.level - 1] * 2;
this.range_circle._height = this.range[this.level - 1] * 2;
upgrade_area.setVars(this);
this.has_target = false;
var _local4 = 0;
while (_local4 < _root.creeps.length) {
creep = _root[_root.creeps[_local4]._name];
if (_root.distance(creep._x, creep._y, _parent._x, _parent._y) <= this.range[this.level - 1]) {
this.target_x = creep._x;
this.target_y = creep._y;
this.has_target = true;
break;
}
this.has_target = false;
_local4++;
}
_parent.turret._rotation = (Math.atan2(_parent._y - this.target_y, _parent._x - this.target_x) * 180) / Math.PI;
this.fire_delay_counter++;
if (((this.fire_delay_counter > this.speed[this.level - 1]) && (!this.placing)) && (this.has_target)) {
this.fire_delay_counter = 0;
var _local5 = _root.attachMovie("pistol_bullet", "pistol_bullet" + (_root.bullet_depth++), _root.bullet_depth);
var _local9 = this.createEmptyMovieClip("pistol_bullet_sound" + (_root.bullet_depth++), _root.bullet_depth);
var _local7 = new Sound(_local9);
_local7.attachSound("pistol_bullet_sound");
_local7.setVolume(50);
_local7.start();
var _local6 = this._parent.turret._rotation;
_local5._rotation = _local6;
_local5.parent_tower = this;
var _local8 = {x:_parent.turret.bullet_spawn._x, y:_parent.turret.bullet_spawn._y};
_parent.turret.bullet_spawn.localToGlobal(_local8);
_local5._x = _local8.x;
_local5._y = _local8.y;
_local5.dirx = Math.cos((_local6 * Math.PI) / 180) * 15;
_local5.diry = Math.sin((_local6 * Math.PI) / 180) * 15;
_local5.onEnterFrame = function () {
this._x = this._x - (this.parent_tower.bullet_speed * this.dirx);
this._y = this._y - (this.parent_tower.bullet_speed * this.diry);
var _local3 = 0;
while (_local3 < _root.creeps.length) {
creep = _root[_root.creeps[_local3]._name];
if (this.hitTest(creep)) {
creep.hp = creep.hp - this.parent_tower.damage[this.parent_tower.level - 1];
this.removeMovieClip();
}
_local3++;
}
if ((((this._x < 0) || (this._x > 700)) || (this._y < 0)) || (this._y > 600)) {
this.removeMovieClip();
}
};
}
};
}
Instance of Symbol 44 MovieClip [sell_tower] "sell_button" in Symbol 59 MovieClip [upgrade_area] Frame 1
on (release) {
var cost = 0;
var i = 0;
while (i < _parent.target_tower.level) {
cost = cost + _parent.target_tower.cost[i];
i++;
}
cost = Math.floor(cost * 0.9);
_root.money = _root.money + cost;
_parent.target_tower._parent.removeMovieClip(_parent.target_tower._parent);
_root.select = null;
_root.towers = _root.towers.remove(_parent.target_tower);
}
Instance of Symbol 53 MovieClip [upgrade_button] in Symbol 59 MovieClip [upgrade_area] Frame 1
on (release) {
if (_root.money >= _parent.upgrade_cost) {
_root.money = _root.money - _parent.upgrade_cost;
_parent.target_tower.level++;
var lvl = _parent.target_tower.level;
var tur = _parent.target_tower._parent.turret;
var bas = _parent.target_tower._parent.base;
tur.gotoAndPlay(lvl);
bas.gotoAndPlay(lvl);
if (lvl >= 5) {
this._visible = false;
}
}
}
Symbol 65 MovieClip [bomb_base] Frame 1
stop();
Symbol 65 MovieClip [bomb_base] Frame 2
stop();
Symbol 65 MovieClip [bomb_base] Frame 3
stop();
Symbol 65 MovieClip [bomb_base] Frame 4
stop();
Symbol 65 MovieClip [bomb_base] Frame 5
stop();
Symbol 71 MovieClip [Symbol 1] Frame 1
stop();
Symbol 71 MovieClip [Symbol 1] Frame 2
stop();
Symbol 71 MovieClip [Symbol 1] Frame 3
stop();
Symbol 71 MovieClip [Symbol 1] Frame 4
stop();
Symbol 71 MovieClip [Symbol 1] Frame 5
stop();
Symbol 72 Button
on (release) {
_root.select = this;
}
Instance of Symbol 27 MovieClip [tower] "tower" in Symbol 73 MovieClip [bomb] Frame 1
onClipEvent (load) {
_parent.turret.lvl1._visible = true;
_parent.turret.lvl2._visible = false;
_parent.turret.lvl3._visible = false;
_parent.turret.lvl4._visible = false;
_parent.turret.lvl5._visible = false;
_parent.base.lvl1._visible = true;
_parent.base.lvl2._visible = false;
_parent.base.lvl3._visible = false;
_parent.base.lvl4._visible = false;
_parent.base.lvl5._visible = false;
this.tower_name = "Bomb Turret I";
var upgrade_cost = 30;
var speed = 70;
var bullet_speed = 1;
var damage = 14;
var range = 75;
var level = 1;
var fire_delay_counter = 0;
var target_x = 0;
var target_y = 0;
var has_target = false;
var placing = true;
var upgrade_damage = 14;
var upgrade_range = 75;
var upgrade_speed = 70;
var tower_name = ["Bomb Tower I", "Bomb Tower II", "Bomb Tower III", "Bomb Tower IV", "Bomb Tower V"];
var damage = [28, 64, 128, 240, 420];
var range = [75, 100, 100, 100, 120];
var speed = [60, 50, 40, 30, 20];
var cost = [30, 40, 90, 200, 400];
upgrade_area = _root.attachMovie("upgrade_area", "upgrade_area" + (_root.upgrade_depth++), _root.upgrade_depth);
upgrade_area.target_tower = this;
upgrade_area.setVars = function (tower) {
this.level = tower.level;
this.tower_name = tower.tower_name[this.level - 1];
this.upgrade_cost = tower.cost[this.level];
var _local4 = 0;
var _local2 = 0;
while (_local2 < this.level) {
_local4 = _local4 + tower.cost[_local2];
_local2++;
}
_local4 = Math.floor(_local4 * 0.9);
this.sell_button.sell_text = "Sell for " + _local4;
this.speed = tower.speed[this.level - 1];
this.damage = tower.damage[this.level - 1];
this.range = tower.range[this.level - 1];
this.speed_text = (int((35 / tower.speed[this.level - 1]) * 100) / 100) + " per second";
this.upgrade_damage = tower.damage[this.level];
this.upgrade_range = tower.range[this.level];
this.upgrade_speed = tower.speed[this.level];
this.upgrade_speed_text = (int((35 / tower.speed[this.level]) * 100) / 100) + " per second";
if (this.level >= 5) {
this.upgrade_damage = "At Max Level";
this.upgrade_range = "At Max Level";
this.upgrade_cost = "At Max Level";
this.upgrade_speed_text = "At Max Level";
}
};
upgrade_area.setVars(this);
upgrade_area._x = 240;
upgrade_area._y = 400;
upgrade_area.onEnterFrame = function () {
if (_root.select == _parent) {
this._visible = true;
} else {
this._visible = false;
}
};
range_circle = _parent.attachMovie("range_circle", "range_circle" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
swapDepths(_parent);
range_circle._alpha = 20;
range_circle._width = range * 2;
range_circle._height = range * 2;
range_circle.onEnterFrame = function () {
if ((_root.select == _parent) || (_root.placing_tower)) {
this._visible = true;
} else {
this._visible = false;
}
};
this.onEnterFrame = function () {
this.range_circle._width = this.range[this.level - 1] * 2;
this.range_circle._height = this.range[this.level - 1] * 2;
upgrade_area.setVars(this);
this.has_target = false;
var _local4 = 0;
while (_local4 < _root.creeps.length) {
creep = _root[_root.creeps[_local4]._name];
if (_root.distance(creep._x, creep._y, _parent._x, _parent._y) <= this.range[this.level - 1]) {
this.target_x = creep._x;
this.target_y = creep._y;
this.has_target = true;
break;
}
this.has_target = false;
_local4++;
}
_parent.turret._rotation = (Math.atan2(_parent._y - this.target_y, _parent._x - this.target_x) * 180) / Math.PI;
this.fire_delay_counter++;
if (((this.fire_delay_counter > this.speed[this.level - 1]) && (!this.placing)) && (this.has_target)) {
this.fire_delay_counter = 0;
var _local5 = _root.attachMovie("bomb_bullet", "bomb_bullet" + (_root.bullet_depth++), _root.bullet_depth);
var _local9 = this.createEmptyMovieClip("bomb_bullet_sound" + (_root.bullet_depth++), _root.bullet_depth);
var _local7 = new Sound(_local9);
_local7.attachSound("bomb_bullet_sound");
_local7.setVolume(25);
_local7.start();
var _local6 = this._parent.turret._rotation;
_local5._rotation = _local6;
_local5.parent_tower = this;
var _local8 = {x:_parent.turret.bullet_spawn._x, y:_parent.turret.bullet_spawn._y};
_parent.turret.bullet_spawn.localToGlobal(_local8);
_local5._x = _local8.x;
_local5._y = _local8.y;
_local5.dirx = Math.cos((_local6 * Math.PI) / 180) * 15;
_local5.diry = Math.sin((_local6 * Math.PI) / 180) * 15;
_local5.onEnterFrame = function () {
this._x = this._x - (this.parent_tower.bullet_speed * this.dirx);
this._y = this._y - (this.parent_tower.bullet_speed * this.diry);
var _local3 = 0;
while (_local3 < _root.creeps.length) {
creep = _root[_root.creeps[_local3]._name];
if (this.hitTest(creep)) {
creep.hp = creep.hp - this.parent_tower.damage[this.parent_tower.level - 1];
this.removeMovieClip();
}
_local3++;
}
if ((((this._x < 0) || (this._x > 700)) || (this._y < 0)) || (this._y > 600)) {
this.removeMovieClip();
}
};
}
};
}
Symbol 81 MovieClip [laser_base] Frame 1
stop();
Symbol 81 MovieClip [laser_base] Frame 2
stop();
Symbol 81 MovieClip [laser_base] Frame 3
stop();
Symbol 81 MovieClip [laser_base] Frame 4
stop();
Symbol 81 MovieClip [laser_base] Frame 5
stop();
Symbol 87 MovieClip [laser_turret] Frame 1
stop();
Symbol 87 MovieClip [laser_turret] Frame 2
stop();
Symbol 87 MovieClip [laser_turret] Frame 3
stop();
Symbol 87 MovieClip [laser_turret] Frame 4
stop();
Symbol 87 MovieClip [laser_turret] Frame 5
stop();
Symbol 88 Button
on (release) {
_root.select = this;
}
Instance of Symbol 27 MovieClip [tower] "tower" in Symbol 89 MovieClip [laser] Frame 1
onClipEvent (load) {
_parent.turret.lvl1._visible = true;
_parent.turret.lvl2._visible = false;
_parent.turret.lvl3._visible = false;
_parent.turret.lvl4._visible = false;
_parent.turret.lvl5._visible = false;
_parent.base.lvl1._visible = true;
_parent.base.lvl2._visible = false;
_parent.base.lvl3._visible = false;
_parent.base.lvl4._visible = false;
_parent.base.lvl5._visible = false;
var upgrade_cost = 100;
var bullet_speed = 1;
var level = 1;
var fire_delay_counter = 0;
var target_x = 0;
var target_y = 0;
var has_target = false;
var placing = true;
var upgrade_damage = 14;
var upgrade_range = 75;
var upgrade_speed = 70;
var bullet_name = ["laser_bullet_red", "laser_bullet_yellow", "laser_bullet_green", "laser_bullet_purple", "laser_bullet_blue"];
var tower_name = ["Laser Tower I", "Laser Tower II", "Laser Tower III", "Laser Tower IV", "Laser Tower V"];
var damage = [20, 44, 96, 210, 440];
var range = [120, 120, 120, 120, 120];
var speed = [17.5, 17.5, 17.5, 17.5, 17.5];
var cost = [100, 100, 200, 400, 800];
upgrade_area = _root.attachMovie("upgrade_area", "upgrade_area" + (_root.upgrade_depth++), _root.upgrade_depth);
upgrade_area.target_tower = this;
upgrade_area.setVars = function (tower) {
this.level = tower.level;
this.tower_name = tower.tower_name[this.level - 1];
this.upgrade_cost = tower.cost[this.level];
var _local4 = 0;
var _local2 = 0;
while (_local2 < this.level) {
_local4 = _local4 + tower.cost[_local2];
_local2++;
}
_local4 = Math.floor(_local4 * 0.9);
this.sell_button.sell_text = "Sell for " + _local4;
this.speed = tower.speed[this.level - 1];
this.damage = tower.damage[this.level - 1];
this.range = tower.range[this.level - 1];
this.speed_text = (int((35 / tower.speed[this.level - 1]) * 100) / 100) + " per second";
this.upgrade_damage = tower.damage[this.level];
this.upgrade_range = tower.range[this.level];
this.upgrade_speed = tower.speed[this.level];
this.upgrade_speed_text = (int((35 / tower.speed[this.level]) * 100) / 100) + " per second";
if (this.level >= 5) {
this.upgrade_damage = "At Max Level";
this.upgrade_range = "At Max Level";
this.upgrade_cost = "At Max Level";
this.upgrade_speed_text = "At Max Level";
}
};
upgrade_area.setVars(this);
upgrade_area._x = 240;
upgrade_area._y = 400;
upgrade_area.onEnterFrame = function () {
if (_root.select == _parent) {
this._visible = true;
} else {
this._visible = false;
}
};
range_circle = _parent.attachMovie("range_circle", "range_circle" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
swapDepths(_parent);
range_circle._alpha = 20;
range_circle._width = range * 2;
range_circle._height = range * 2;
range_circle.onEnterFrame = function () {
if ((_root.select == _parent) || (_root.placing_tower)) {
this._visible = true;
} else {
this._visible = false;
}
};
this.onEnterFrame = function () {
this.range_circle._width = this.range[this.level - 1] * 2;
this.range_circle._height = this.range[this.level - 1] * 2;
upgrade_area.setVars(this);
this.has_target = false;
var _local4 = 0;
while (_local4 < _root.creeps.length) {
creep = _root[_root.creeps[_local4]._name];
if (_root.distance(creep._x, creep._y, _parent._x, _parent._y) <= this.range[this.level - 1]) {
this.target_x = creep._x;
this.target_y = creep._y;
this.has_target = true;
break;
}
this.has_target = false;
_local4++;
}
_parent.turret._rotation = (Math.atan2(_parent._y - this.target_y, _parent._x - this.target_x) * 180) / Math.PI;
this.fire_delay_counter++;
if (((this.fire_delay_counter > this.speed[this.level - 1]) && (!this.placing)) && (this.has_target)) {
this.fire_delay_counter = 0;
var _local9 = this.bullet_name[this.level - 1];
var _local5 = _root.attachMovie(_local9, (("" + _local9) + "") + (_root.bullet_depth++), _root.bullet_depth);
var _local10 = this.createEmptyMovieClip("laser_bullet_sound" + (_root.bullet_depth++), _root.bullet_depth);
var _local7 = new Sound(_local10);
_local7.attachSound("laser_bullet_sound");
_local7.setVolume(50);
_local7.start();
var _local6 = this._parent.turret._rotation;
_local5._rotation = _local6;
_local5.parent_tower = this;
var _local8 = {x:_parent.turret.bullet_spawn._x, y:_parent.turret.bullet_spawn._y};
_parent.turret.bullet_spawn.localToGlobal(_local8);
_local5._x = _local8.x;
_local5._y = _local8.y;
_local5.dirx = Math.cos((_local6 * Math.PI) / 180) * 15;
_local5.diry = Math.sin((_local6 * Math.PI) / 180) * 15;
_local5.onEnterFrame = function () {
this._x = this._x - (this.parent_tower.bullet_speed * this.dirx);
this._y = this._y - (this.parent_tower.bullet_speed * this.diry);
var _local3 = 0;
while (_local3 < _root.creeps.length) {
creep = _root[_root.creeps[_local3]._name];
if (this.hitTest(creep)) {
creep.hp = creep.hp - this.parent_tower.damage[this.parent_tower.level - 1];
this.removeMovieClip();
}
_local3++;
}
if ((((this._x < 0) || (this._x > 700)) || (this._y < 0)) || (this._y > 600)) {
this.removeMovieClip();
}
};
}
};
}
Symbol 161 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.1");
}
static function showPreGameAd(options) {
var _local27 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}};
options = _parseOptions(options, _local27);
var clip = options.clip;
var _local23 = 11000;
var _local26 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
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 _local7 = chk.createEmptyMovieClip("_mochiad_bar", 4);
_local7._x = 10;
_local7._y = _local13 - 20;
var _local22 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local24 = options.outline;
delete options.outline;
var _local5 = _local7.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 = _local7.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local22);
_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 _local6 = _local7.createEmptyMovieClip("_outline", 3);
_local6.lineStyle(0, _local24, 100);
_local6.moveTo(0, 0);
_local6.lineTo(_local4 - 20, 0);
_local6.lineTo(_local4 - 20, 10);
_local6.lineTo(0, 10);
_local6.lineTo(0, 0);
chk.ad_msec = _local23;
chk.ad_timeout = _local26;
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;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local12 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local10 = (100 * _local8) / _local4;
var _local11 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local2 = Math.min(100, Math.min(_local10 || 0, _local11));
_local2 = Math.max(this.last_pcnt, _local2);
this.last_pcnt = _local2;
_local9._xscale = _local2;
if (!chk.showing) {
var _local7 = _local12.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local5 > chk.ad_timeout) {
_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 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();
}};
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_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;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
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) {
_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 showTimedAd(options) {
showInterLevelAd(options);
}
static function showPreloaderAd(options) {
showPreGameAd(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 _loadCommunicator(options) {
var _local26 = {clip:_root, com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = _parseOptions(options, _local26);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local18 = options.clip;
var _local20 = "_mochiad_com_" + options.id;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local18[_local20]) {
return(_local18[_local20].lc);
}
var _local21 = options.com_server + options.id;
_allowDomains(_local21);
delete options.id;
delete options.com_server;
var _local25 = options.depth;
delete options.depth;
var _local17 = _local18.createEmptyMovieClip(_local20, _local25);
var _local11 = _local17.createEmptyMovieClip("_mochiad_com", 1);
for (var _local15 in options) {
_local11[_local15] = options[_local15];
}
var _local6 = new LocalConnection();
var _local16 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local6.mc = _local17;
_local6.name = _local16;
_local6.allowDomain = function (d) {
return(true);
};
_local6.allowInsecureDomain = _local6.allowDomain;
_local6.connect(_local16);
_local17.lc = _local6;
_local11.lc = _local16;
_local6._id = 0;
_local6._queue = [];
_local6.rpcResult = function (cb_arg) {
var _local8 = parseInt(cb_arg);
var _local4 = this._callbacks[_local8];
if (!_local4) {
return(undefined);
}
delete this._callbacks[_local8];
var _local5 = [];
var _local3 = 2;
while (_local3 < _local4.length) {
_local5.push(_local4[_local3]);
_local3++;
}
_local3 = 1;
while (_local3 < arguments.length) {
_local5.push(arguments[_local3]);
_local3++;
}
var _local6 = _local4[1];
var _local7 = _local4[0];
if (_local7 && (typeof(_local6) == "string")) {
_local6 = _local7[_local6];
}
if (_local6) {
_local6.apply(_local7, _local5);
}
};
_local6._didConnect = function (endpoint) {
this._endpoint = endpoint;
var _local4 = this._queue;
delete this._queue;
var _local5 = this.doSend;
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
_local5.apply(this, _local3);
_local2++;
}
};
_local6.doSend = function (args, cbobj, cbfn) {
if (this._endpoint == null) {
var _local4 = [];
var _local3 = 0;
while (_local3 < arguments.length) {
_local4.push(arguments[_local3]);
_local3++;
}
this._queue.push(_local4);
return(undefined);
}
this._id = this._id + 1;
var _local5 = this._id;
if ((cbfn === undefined) || (cbfn === null)) {
cbfn = cbobj;
}
this._callbacks[_local5] = [cbobj, cbfn];
var _local7 = new LocalConnection();
var _local9 = _local7.send(this._endpoint, "rpc", _local5, args);
};
_local6._callbacks = {};
_local6._callbacks[0] = [_local6, "_didConnect"];
_local11.st = getTimer();
_local11.loadMovie(_local21 + ".swf", "POST");
return(_local6);
}
static function fetchHighScores(options, callbackObj, callbackMethod) {
var _local1 = _loadCommunicator({id:options.id});
if (!_local1) {
return(false);
}
var _local4 = ["fetchHighScores", options];
_local1.doSend(["fetchHighScores", options], callbackObj, callbackMethod);
return(true);
}
static function sendHighScore(options, callbackObj, callbackMethod) {
var _local1 = _loadCommunicator({id:options.id});
if (!_local1) {
return(false);
}
var _local4 = ["sendHighScore", options];
_local1.doSend(["sendHighScore", options], callbackObj, callbackMethod);
return(true);
}
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 _local9 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local9._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local9.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local9._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
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;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local8;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
_local6.lc = _local5;
_local4.lc = _local8;
_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);
}
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++;
}
}
return(_local4);
}
}
Symbol 117 Button
on (release) {
getURL ("http://www.zombiehead.org");
}
Symbol 127 Button
on (release) {
_root.play();
}
Symbol 131 Button
on (release) {
_root.select = null;
}
Symbol 145 Button
on (release) {
gotoAndPlay (4);
}
Symbol 150 Button
on (release) {
getURL ("http://www.zombiehead.org");
}
Symbol 156 Button
on (release) {
gotoAndPlay (3);
}