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:"75b1a87bf9dfe197", res:"640x440"});
__com_mochibot__("7e3fbca0", this, 10301, true);
_root.submit_kongregate = false;
if (_root.submit_kongregate) {
_root.kongregateServices.connect();
}
Frame 2
stop();
difficulty_frame._visible = false;
instructions_frame._visible = false;
story_frame._visible = false;
_root.bg_music.stop();
Frame 3
function hideTowers() {
var _local2 = 0;
while (_local2 < _root.towers.length) {
_root.towers[_local2].bounds._visible = false;
_local2++;
}
}
function showTowers() {
var _local2 = 0;
while (_local2 < _root.towers.length) {
_root.towers[_local2].bounds._visible = true;
_local2++;
}
}
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_2");
bg_music.setVolume(10);
_root.bg_music.start(0, 999999);
stop();
if ((_root.difficulty == null) or (_root.difficulty == undefined)) {
_root.difficulty = 1;
}
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 waypoint_x = new Array(60, 180, 180, 300, 300, 380, 380, 580, 580);
var waypoint_y = new Array(300, 300, 180, 180, 60, 60, 300, 300, -40);
var 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_type = "regular";
var zombie_num_type = (max_creeps + " Average Zombies");
var zombie_health = (("with " + level_life) + " health");
var zombie_reward = (("reward of " + level_money) + " offered");
var zombie_interest = "0 interest earned for the last level";
var level_count_down_max = 175;
var level_count_down = 0;
var send_creeps = false;
var total_creeps_killed = 0;
var total_money_earned = 0;
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 = Math.floor((level * (level + 5)) * _root.difficulty);
this.interest = Math.floor(this.money * 0.1);
this.total_money_earned = this.total_money_earned + this.interest;
this.money = this.money + this.interest;
this.zombie_interest = this.interest + " interest earned for the last level";
this.level_money = Math.floor(level / 6) + 1;
this.level_speed = 1;
switch (this.level % 7) {
case 0 :
this.zombie_type = "regular";
this.level_life = this.level_life;
this.level_speed = 1.25;
this.max_creeps = 10;
this.delay = 55;
this.zombie_num_type = max_creeps + " Average Zombies";
break;
case 1 :
this.zombie_type = "fat";
this.level_life = Math.floor(this.level_life * 1.5);
this.level_speed = 0.75;
this.max_creeps = 10;
this.delay = 75;
this.zombie_num_type = max_creeps + " Fat Lumbering Zombies";
break;
case 2 :
this.zombie_type = "crawler";
this.level_life = Math.floor(this.level_life * 0.9);
this.level_speed = 1.35;
this.max_creeps = 15;
this.delay = 45;
this.zombie_num_type = this.max_creeps + " Quick Crawling Zombie Torsos";
break;
case 3 :
this.zombie_type = "regular";
this.level_life = Math.floor(this.level_life * 0.75);
this.level_speed = 3.5;
this.max_creeps = 10;
this.delay = 35;
this.zombie_num_type = max_creeps + " Sprinting Zombies";
break;
case 4 :
this.zombie_type = "regular_2";
this.leve_life = this.level_life;
this.level_speed = 1.25;
this.max_creeps = 10;
this.delay = 45;
this.zombie_num_type = max_creeps + " Regular Joe Zombies";
break;
case 5 :
this.zombie_type = "ghoul";
this.level_life = Math.floor(this.level_life * 1.1);
this.level_speed = 0.9;
this.max_creeps = 15;
this.delay = 50;
this.zombie_num_type = max_creeps + " Ghoulish Creeping Zombies";
break;
case 6 :
this.zombie_type = "stumpy";
this.level_life = this.level_life;
this.level_speed = 1.35;
this.max_creeps = 10;
this.delay = 40;
this.zombie_num_type = max_creeps + " Stumpy Armless Zombies";
}
if (((((level == 10) or (level == 20)) or (level == 30)) or (level == 40)) or (level == 50)) {
this.zombie_type = "hulk";
this.level_life = Math.floor(this.level_life * 8);
this.level_speed = 1;
this.max_creeps = 1;
this.delay = 35;
this.zombie_num_type = "A Massive Mutant Zombie Hulk";
this.level_money = this.level_money * 9;
}
this.zombie_health = ("with " + level_life) + " health";
this.zombie_reward = ("reward of " + level_money) + " offered";
_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 = _root.attachMovie("zombie", "zombie" + creep_depth, creep_depth++, {type:this.zombie_type, _x:60, _y:-40, speed:this.level_speed, hp:this.level_life, life:this.level_life, money:this.level_money, description:this.zombie_description});
_root.creeps.push(creep);
}
};
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);
};
Frame 4
if (_root.submit_kongregate) {
_root.kongregateStats.submit("TotalMoneyEarned", _root.total_money_earned);
_root.kongregateStats.submit("TotalCreepsKilled", _root.total_creeps_killed);
}
_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();
if (_root.submit_kongregate) {
_root.kongregateStats.submit("TotalMoneyEarned", _root.total_money_earned);
_root.kongregateStats.submit("TotalCreepsKilled", _root.total_creeps_killed);
if (_root.difficulty == 0.75) {
_root.kongregateStats.submit("CompletedGameEasy", 1);
} else if (_root.difficulty == 1) {
_root.kongregateStats.submit("CompletedGameMedium", 1);
} else if (_root.difficulty == 1.25) {
_root.kongregateStats.submit("CompletedGameHard", 1);
}
}
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();
_root.kongregateStats.submit("GameCompleted", 1);
Symbol 12 MovieClip [pistol] Frame 1
#initclip 19
Object.registerClass("pistol", Tower);
#endinitclip
Symbol 16 MovieClip [pistol_bullet] Frame 1
#initclip 6
Object.registerClass("pistol_bullet", Bullet);
#endinitclip
Symbol 39 MovieClip [upgrade_area] Frame 1
#initclip 7
Object.registerClass("upgrade_area", UpgradeArea);
#endinitclip
Symbol 47 MovieClip [pistol_turret] Frame 1
stop();
Symbol 47 MovieClip [pistol_turret] Frame 2
stop();
Symbol 47 MovieClip [pistol_turret] Frame 3
stop();
Symbol 47 MovieClip [pistol_turret] Frame 4
stop();
Symbol 47 MovieClip [pistol_turret] Frame 5
stop();
Symbol 54 MovieClip [pistol_base] Frame 1
stop();
Symbol 54 MovieClip [pistol_base] Frame 2
stop();
Symbol 54 MovieClip [pistol_base] Frame 3
stop();
Symbol 54 MovieClip [pistol_base] Frame 4
stop();
Symbol 54 MovieClip [pistol_base] Frame 5
stop();
Symbol 55 MovieClip [bomb] Frame 1
#initclip 8
Object.registerClass("bomb", Tower);
#endinitclip
Symbol 61 MovieClip [bomb_base] Frame 1
stop();
Symbol 61 MovieClip [bomb_base] Frame 2
stop();
Symbol 61 MovieClip [bomb_base] Frame 3
stop();
Symbol 61 MovieClip [bomb_base] Frame 4
stop();
Symbol 61 MovieClip [bomb_base] Frame 5
stop();
Symbol 67 MovieClip [bomb_turret] Frame 1
stop();
Symbol 67 MovieClip [bomb_turret] Frame 2
stop();
Symbol 67 MovieClip [bomb_turret] Frame 3
stop();
Symbol 67 MovieClip [bomb_turret] Frame 4
stop();
Symbol 67 MovieClip [bomb_turret] Frame 5
stop();
Symbol 70 MovieClip [bomb_bullet] Frame 1
#initclip 9
Object.registerClass("bomb_bullet", Bullet);
#endinitclip
Symbol 75 MovieClip [zombie] Frame 1
#initclip 10
Object.registerClass("zombie", Creep);
#endinitclip
Symbol 79 MovieClip [laser] Frame 1
#initclip 11
Object.registerClass("laser", Tower);
#endinitclip
Symbol 85 MovieClip [laser_turret] Frame 1
stop();
Symbol 85 MovieClip [laser_turret] Frame 2
stop();
Symbol 85 MovieClip [laser_turret] Frame 3
stop();
Symbol 85 MovieClip [laser_turret] Frame 4
stop();
Symbol 85 MovieClip [laser_turret] Frame 5
stop();
Symbol 86 MovieClip [laser_base] Frame 1
stop();
Symbol 86 MovieClip [laser_base] Frame 2
stop();
Symbol 86 MovieClip [laser_base] Frame 3
stop();
Symbol 86 MovieClip [laser_base] Frame 4
stop();
Symbol 86 MovieClip [laser_base] Frame 5
stop();
Symbol 88 MovieClip [laser_bullet_red] Frame 1
#initclip 12
Object.registerClass("laser_bullet_red", Bullet);
#endinitclip
Symbol 90 MovieClip [laser_bullet_yellow] Frame 1
#initclip 13
Object.registerClass("laser_bullet_yellow", Bullet);
#endinitclip
Symbol 92 MovieClip [laser_bullet_green] Frame 1
#initclip 14
Object.registerClass("laser_bullet_green", Bullet);
#endinitclip
Symbol 94 MovieClip [laser_bullet_purple] Frame 1
#initclip 15
Object.registerClass("laser_bullet_purple", Bullet);
#endinitclip
Symbol 96 MovieClip [laser_bullet_blue] Frame 1
#initclip 16
Object.registerClass("laser_bullet_blue", Bullet);
#endinitclip
Symbol 107 MovieClip [multishot] Frame 1
#initclip 17
Object.registerClass("multishot", Tower);
#endinitclip
Symbol 109 MovieClip [multishot_bullet] Frame 1
#initclip 18
Object.registerClass("multishot_bullet", Bullet);
#endinitclip
Symbol 115 MovieClip [multishot_turret] Frame 1
stop();
Symbol 115 MovieClip [multishot_turret] Frame 2
stop();
Symbol 115 MovieClip [multishot_turret] Frame 3
stop();
Symbol 115 MovieClip [multishot_turret] Frame 4
stop();
Symbol 115 MovieClip [multishot_turret] Frame 5
stop();
Instance of Symbol 141 MovieClip "background" in Symbol 147 MovieClip [Sniper Menu Item] Frame 1
onClipEvent (load) {
}
Symbol 164 Button
on (release) {
_root.difficulty = 0.75;
_root.play();
}
Symbol 167 Button
on (release) {
_root.difficulty = 1;
_root.play();
}
Symbol 170 Button
on (release) {
_root.difficulty = 1.25;
_root.play();
}
Symbol 175 Button
on (release) {
this._visible = false;
}
Symbol 249 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 250 MovieClip [__Packages.Bullet] Frame 0
class Bullet extends MovieClip
{
var _x, _y, _rotation, hitTest, removeMovieClip;
function Bullet () {
super();
}
function setup(speed, damage, x, y, rotation) {
this.speed = speed;
this.damage = damage;
_x = x;
_y = y;
_rotation = rotation;
dirx = Math.cos((_rotation * Math.PI) / 180) * 15;
diry = Math.sin((_rotation * Math.PI) / 180) * 15;
}
function play_sound(sound_id, volume) {
var _local2 = new Sound(this);
_local2.attachSound(sound_id);
_local2.setVolume(volume);
_local2.start();
}
function move() {
_x = _x - (speed * dirx);
_y = _y - (speed * diry);
var _local3 = 0;
while (_local3 < _root.creeps.length) {
var _local4 = _root[_root.creeps[_local3]._name];
if (hitTest(_local4)) {
_local4.hp = _local4.hp - damage;
removeMovieClip();
}
_local3++;
}
if ((((_x < 0) || (_x > 700)) || (_y < 0)) || (_y > 600)) {
removeMovieClip();
}
}
var speed = null;
var damage = null;
var dirx = null;
var diry = null;
}
Symbol 251 MovieClip [__Packages.UpgradeArea] Frame 0
class UpgradeArea extends MovieClip
{
var attachMovie, getNextHighestDepth, onEnterFrame, removeMovieClip;
function UpgradeArea () {
super();
upgrade_button = attachMovie("upgrade_button", "upgrade_button" + getNextHighestDepth(), getNextHighestDepth());
upgrade_button._x = 343;
upgrade_button._y = 17;
upgrade_button.onRelease = function () {
if (_root.money >= this._parent.up_cost) {
_root.money = _root.money - this._parent.up_cost;
this._parent.target.upgrade();
this._parent.update();
if (this._parent.target.level >= 5) {
this.removeMovieClip();
}
}
};
sell_button = attachMovie("sell_button", "sell_button" + getNextHighestDepth(), getNextHighestDepth());
sell_button.onRelease = function () {
this._parent.sellTower();
};
sell_button._x = 397;
sell_button._y = 50;
onEnterFrame = function () {
if (_root.select == this.target) {
this._visible = true;
} else {
this._visible = false;
}
};
}
function update() {
name = target.getName();
speed = speedStr(target.getSpeed());
damage = target.getDamage();
range = target.getRange();
if (target.level < 5) {
up_cost = target.getUpCost();
up_speed = speedStr(target.getUpSpeed());
up_damage = target.getUpDamage();
up_range = target.getUpRange();
} else {
up_cost = "At max level";
up_speed = "At max level";
up_damage = "At max level";
up_range = "At max level";
}
sell_button.sell_text = "Sell for " + getSellPrice();
}
function sellTower() {
_root.money = _root.money + getSellPrice();
target.removeMovieClip();
removeMovieClip();
}
function speedStr(speed) {
return((int((35 / speed) * 100) / 100) + " per second");
}
function getSellPrice() {
var _local3 = 0;
var _local2 = 0;
while (_local2 < target.level) {
_local3 = _local3 + target.cost[_local2];
_local2++;
}
return(Math.floor(_local3 * 0.9));
}
var target = null;
var name = "";
var sell_price = "";
var speed = "";
var damage = "";
var range = "";
var up_cost = "";
var up_speed = "";
var up_damage = "";
var up_range = "";
var sell_button = null;
var upgrade_button = null;
}
Symbol 252 MovieClip [__Packages.Tower] Frame 0
class Tower extends MovieClip
{
var attachMovie, getNextHighestDepth, startDrag, onEnterFrame, onRelease, _alpha, stopDrag, _x, _y;
function Tower () {
super();
range_circle = attachMovie("range_circle", "range_circle" + getNextHighestDepth(), getNextHighestDepth());
bounds = attachMovie("bounds", "bounds" + getNextHighestDepth(), getNextHighestDepth());
base = attachMovie(base_name + "_base", (base_name + "_base") + getNextHighestDepth(), getNextHighestDepth());
turret = attachMovie(base_name + "_turret", (base_name + "_turret") + getNextHighestDepth(), getNextHighestDepth());
startDrag(true);
onEnterFrame = function () {
this.handlePlaceTower();
};
onRelease = function () {
this.handlePlaceRelease();
};
setupRangeCircle();
setupUpgradeArea();
}
function init() {
onRelease = function () {
_root.select = this;
};
onEnterFrame = function () {
this.handleEnterFrame();
};
}
function setupRangeCircle() {
range_circle._alpha = 20;
updateRange();
range_circle.onEnterFrame = function () {
if ((_root.select == this._parent) || (_root.placing_tower)) {
this._visible = true;
} else {
this._visible = false;
}
};
}
function updateRange() {
range_circle._width = getRange() * 2;
range_circle._height = getRange() * 2;
}
function setupUpgradeArea() {
upgrade_area = _root.attachMovie("upgrade_area", "upgrade_area" + (_root.upgrade_depth++), _root.upgrade_depth);
upgrade_area.target = this;
upgrade_area.update();
upgrade_area._x = 75;
upgrade_area._y = 360;
}
function upgrade() {
level++;
updateRange();
turret.gotoAndPlay(level);
base.gotoAndPlay(level);
}
function handlePlaceTower() {
_root.placing_tower = true;
var _local4 = false;
if (bounds.hitTest("_root.menuBar")) {
_local4 = true;
} else {
var _local3 = 1;
while (_local3 < 10) {
if (bounds.hitTest("_root.path.s" + _local3)) {
_local4 = true;
break;
}
_local3++;
}
if (!_local4) {
_local3 = 0;
while (_local3 < _root.towers.length) {
if ((this != _root.towers[_local3]) && (bounds.hitTest(_root.towers[_local3].bounds))) {
_local4 = true;
break;
}
_local3++;
}
}
}
if (_local4) {
_alpha = 50;
} else {
_alpha = 100;
}
}
function handlePlaceRelease() {
if (_alpha == 100) {
stopDrag();
_root.placing_tower = false;
_root.towers.push(this);
_root.hideTowers();
init();
}
}
function getName() {
return(name[level - 1]);
}
function getBulletName() {
return(bullet_name[level - 1]);
}
function getCost() {
return(cost[level - 1]);
}
function getUpCost() {
return(cost[level]);
}
function getDamage() {
return(damage[level - 1]);
}
function getUpDamage() {
return(damage[level]);
}
function getRange() {
return(range[level - 1]);
}
function getUpRange() {
return(range[level]);
}
function getSpeed() {
return(speed[level - 1]);
}
function getUpSpeed() {
return(speed[level]);
}
function getBulletCoords() {
var _local2 = {x:turret.bullet_spawn._x, y:turret.bullet_spawn._y};
turret.bullet_spawn.localToGlobal(_local2);
return(_local2);
}
function getBulletCoordsById(id) {
var _local2 = {x:turret["bullet_spawn_" + id]._x, y:turret["bullet_spawn_" + id]._y};
turret["bullet_spawn_" + id].localToGlobal(_local2);
return(_local2);
}
function setupBulletShot(id, bullet_name, rotation_offset) {
var _local4 = getBulletCoordsById(id);
var _local3 = _root.attachMovie(bullet_name, bullet_name + (_root.bullet_depth++), _root.bullet_depth);
_local3.setup(bullet_speed, getDamage(), _local4.x, _local4.y, turret._rotation + rotation_offset);
_local3.onEnterFrame = function () {
this.move();
};
return(_local3);
}
function getTargetCoords() {
var _local4 = 0;
while (_local4 < _root.creeps.length) {
var _local3 = _root[_root.creeps[_local4]._name];
if (_root.distance(_local3._x, _local3._y, _x, _y) <= getRange()) {
return({x:_local3._x, y:_local3._y});
}
_local4++;
}
return(null);
}
function fireBullet() {
var _local4 = getBulletCoords();
var _local3 = _root.attachMovie("pistol_bullet", "pistol_bullet" + (_root.bullet_depth++), _root.bullet_depth);
trace(turret._rotation);
_local3.setup(bullet_speed, getDamage(), _local4.x, _local4.y, turret._rotation);
_local3.play_sound("pistol_bullet_sound", 50);
_local3.onEnterFrame = function () {
this.move();
};
}
function rotateTurret(point) {
if (point != null) {
turret._rotation = (Math.atan2(_y - point.y, _x - point.x) * 180) / Math.PI;
}
}
function canFire(count) {
return(count > getSpeed());
}
function handleEnterFrame() {
if (_root.select == this) {
upgrade_area._visible = true;
range_circle._visible = true;
} else {
upgrade_area._visible = false;
range_circle._visible = false;
}
fire_delay_counter++;
var _local3 = getTargetCoords();
rotateTurret(_local3);
if ((_local3 != null) && (canFire(fire_delay_counter))) {
fire_delay_counter = 0;
fireBullet();
}
}
var level = 1;
var bullet_speed = 1;
var name = null;
var cost = null;
var damage = null;
var range = null;
var speed = null;
var turret = null;
var base = null;
var bounds = null;
var range_circle = null;
var upgrade_area = null;
var bullet_name = null;
var fire_delay_counter = 0;
var base_name = null;
}
Symbol 253 MovieClip [__Packages.Creep] Frame 0
class Creep extends MovieClip
{
var attachMovie, getNextHighestDepth, onEnterFrame, removeMovieClip, hitTest, _x, _y;
function Creep () {
super();
zombie = attachMovie(type, type + getNextHighestDepth(), getNextHighestDepth());
health_border = attachMovie("health_border", "health_border" + getNextHighestDepth(), getNextHighestDepth());
health_bar = attachMovie("health_bar", "health_bar" + getNextHighestDepth(), getNextHighestDepth());
health_bar._x = -15;
health_bar._y = 25;
health_border._y = 25;
onEnterFrame = function () {
this.handleEnterFrame();
};
}
function handleEnterFrame() {
if (hp <= 0) {
_root.money = _root.money + money;
_root.total_creeps_killed++;
_root.total_money_earned = _root.total_money_earned + money;
_root.creeps = _root.creeps.remove(this);
removeMovieClip();
}
health_bar._width = (hp / life) * 30;
if (hitTest("_root.end_spot")) {
_root.lives--;
if (_root.lives <= 0) {
_root.gotoAndPlay(4);
}
_root.creeps = _root.creeps.remove(this);
removeMovieClip();
}
var _local5 = _root.waypoint_x[next_waypoint] - _x;
var _local4 = _root.waypoint_y[next_waypoint] - _y;
if ((Math.abs(_local5) + Math.abs(_local4)) < speed) {
next_waypoint++;
}
var _local3 = Math.atan2(_local4, _local5);
_x = _x + (speed * Math.cos(_local3));
_y = _y + (speed * Math.sin(_local3));
zombie._rotation = ((_local3 / 3.14) * 180) - 90;
}
var hp = null;
var life = null;
var speed = null;
var money = null;
var type = null;
var next_waypoint = 0;
var description = null;
var zombie = null;
var health_bar = null;
var health_border = null;
}
Symbol 191 Button
on (release) {
getURL ("http://www.zombiehead.org");
}
Symbol 200 Button
on (release) {
difficulty_frame._visible = true;
}
Symbol 209 Button
on (release) {
instructions_frame._visible = true;
}
Symbol 216 Button
on (release) {
story_frame._visible = true;
}
Symbol 223 Button
on (release) {
_root.select = null;
}
Symbol 231 Button
on (release) {
_root.gotoAndPlay(4);
}
Instance of Symbol 149 MovieClip [multishot_menu_item] in Symbol 232 MovieClip Frame 1
onClipEvent (load) {
var info_pane = _root.attachMovie("menu_item_info", "multishot_menu_item_info", _root.getNextHighestDepth() + 100);
info_pane._x = 145;
info_pane._y = 365;
info_pane._visible = false;
info_pane.tower_name = "Multishot Turret";
info_pane.damage = "10";
info_pane.cost = "50";
info_pane.range = "120";
info_pane.speed = "2 per second";
info_pane.description = "A tower that lobs multiple fast moving bullets towards its target. Upgrade for more bullets.";
this.onRollOver = function () {
this.info_pane._visible = true;
};
this.onRollOut = function () {
this.info_pane._visible = false;
};
this.onRelease = function () {
var _local3 = 50;
if (_root.money >= _local3) {
_root.money = _root.money - _local3;
_root.showTowers();
turret = _root.attachMovie("multishot", "multishot" + (_root.tower_depth++), _root.tower_depth, {base_name:"multishot", name:["Multishot Tower I", "Multishot Tower II", "Multishot Tower III", "Multishot Tower IV", "Multishot Tower V"], damage:[10, 20, 30, 40, 50], range:[100, 100, 100, 100, 100], speed:[35, 35, 35.5, 35, 35], cost:[50, 100, 200, 400, 800]});
turret.fireBullet = function () {
var _local2 = this.setupBulletShot("1", "multishot_bullet", 0);
if (this.level >= 2) {
this.setupBulletShot("2", "multishot_bullet", -15);
this.setupBulletShot("3", "multishot_bullet", 15);
}
if (this.level >= 3) {
this.setupBulletShot("4", "multishot_bullet", -30);
this.setupBulletShot("5", "multishot_bullet", 30);
}
if (this.level >= 4) {
this.setupBulletShot("6", "multishot_bullet", -45);
this.setupBulletShot("7", "multishot_bullet", 45);
}
if (this.level >= 5) {
this.setupBulletShot("8", "multishot_bullet", -60);
this.setupBulletShot("9", "multishot_bullet", 60);
}
_local2.play_sound("pistol_bullet_sound", 50);
};
}
};
}
Instance of Symbol 147 MovieClip [Sniper Menu Item] in Symbol 232 MovieClip Frame 1
onClipEvent (load) {
var info_pane = _root.attachMovie("menu_item_info", "pistol_menu_item_info", _root.getNextHighestDepth() + 100);
info_pane._x = 45;
info_pane._y = 365;
info_pane._visible = false;
info_pane.tower_name = "Pistol Turret";
info_pane.damage = "10";
info_pane.cost = "25";
info_pane.range = "100";
info_pane.speed = "1.16 per second";
info_pane.description = "Shoot bullets at your targets. Upgrades increase the damage and range, but decreases its speed.";
this.onRollOver = function () {
this.info_pane._visible = true;
};
this.onRollOut = function () {
this.info_pane._visible = false;
};
this.onRelease = function () {
var _local4 = 25;
if (_root.money >= _local4) {
_root.money = _root.money - _local4;
_root.showTowers();
turret = _root.attachMovie("pistol", "pistol" + (_root.tower_depth++), _root.tower_depth, {base_name:"pistol", name:["Pistol Tower I", "Pistol Tower II", "Pistol Tower III", "Pistol Tower IV", "Pistol Tower V"], damage:[10, 26, 52, 140, 325], range:[100, 100, 110, 120, 200], speed:[30, 32, 35, 37, 40], cost:[25, 25, 50, 100, 200]});
turret.fireBullet = function () {
var _local4 = this.getBulletCoords();
var _local3 = _root.attachMovie("pistol_bullet", "pistol_bullet" + (_root.bullet_depth++), _root.bullet_depth);
_local3.setup(this.bullet_speed, this.getDamage(), _local4.x, _local4.y, this.turret._rotation);
_local3.play_sound("pistol_bullet_sound", 50);
_local3.onEnterFrame = function () {
this.move();
};
};
}
};
}
Instance of Symbol 145 MovieClip [Gernade Thrower Menu Item] in Symbol 232 MovieClip Frame 1
onClipEvent (load) {
var info_pane = _root.attachMovie("menu_item_info", "bomb_menu_item_info", _root.getNextHighestDepth() + 100);
info_pane._x = 79;
info_pane._y = 365;
info_pane._visible = false;
info_pane.tower_name = "Bomb Turret";
info_pane.damage = "28";
info_pane.cost = "30";
info_pane.range = "75";
info_pane.speed = "0.58 per second";
info_pane.description = "Launches slow, highly damaging rockets at zombies. Upgrade for better speed, damage and range.";
this.onRollOver = function () {
this.info_pane._visible = true;
};
this.onRollOut = function () {
this.info_pane._visible = false;
};
this.onRelease = function () {
var _local4 = 30;
if (_root.money >= _local4) {
_root.money = _root.money - _local4;
_root.showTowers();
turret = _root.attachMovie("bomb", "bomb" + (_root.tower_depth++), _root.tower_depth, {base_name:"bomb", name:["Bomb Tower I", "Bomb Tower II", "Bomb Tower III", "Bomb Tower IV", "Bomb Tower V"], damage:[28, 64, 128, 240, 420], range:[75, 100, 100, 100, 120], speed:[60, 50, 40, 30, 20], cost:[30, 40, 90, 200, 400]});
turret.fireBullet = function () {
var _local4 = this.getBulletCoords();
var _local3 = _root.attachMovie("bomb_bullet", "bomb_bullet" + (_root.bullet_depth++), _root.bullet_depth);
_local3.setup(this.bullet_speed, this.getDamage(), _local4.x, _local4.y, this.turret._rotation);
_local3.play_sound("bomb_bullet_sound", 2);
_local3.onEnterFrame = function () {
this.move();
};
};
}
};
}
Instance of Symbol 143 MovieClip [SAM Launcher Menu Item] in Symbol 232 MovieClip Frame 1
onClipEvent (load) {
var info_pane = _root.attachMovie("menu_item_info", "laser_menu_item_info", _root.getNextHighestDepth() + 100);
info_pane._x = 112;
info_pane._y = 365;
info_pane._visible = false;
info_pane.tower_name = "Laser Turret";
info_pane.damage = "20";
info_pane.cost = "100";
info_pane.range = "120";
info_pane.speed = "2 per second";
info_pane.description = "Quickly shoots beams of amplified light towards towards its target. Ugrade for higher damage.";
this.onRollOver = function () {
this.info_pane._visible = true;
};
this.onRollOut = function () {
this.info_pane._visible = false;
};
this.onRelease = function () {
var _local4 = 100;
if (_root.money >= _local4) {
_root.money = _root.money - _local4;
_root.showTowers();
turret = _root.attachMovie("laser", "laser" + (_root.tower_depth++), _root.tower_depth, {base_name:"laser", name:["Laser Tower I", "Laser Tower II", "Laser Tower III", "Laser Tower IV", "Laser Tower V"], bullet_name:["laser_bullet_red", "laser_bullet_yellow", "laser_bullet_green", "laser_bullet_purple", "laser_bullet_blue"], damage:[20, 44, 96, 210, 440], range:[120, 120, 120, 120, 120], speed:[17.5, 17.5, 17.5, 17.5, 17.5], cost:[100, 100, 200, 400, 800]});
turret.fireBullet = function () {
var _local4 = this.getBulletCoords();
var _local3 = _root.attachMovie(this.getBulletName(), this.getBulletName() + (_root.bullet_depth++), _root.bullet_depth);
_local3.setup(this.bullet_speed, this.getDamage(), _local4.x, _local4.y, this.turret._rotation);
_local3.play_sound("laser_bullet_sound", 5);
_local3.onEnterFrame = function () {
this.move();
};
};
}
};
}
Symbol 237 Button
on (release) {
getURL ("http://www.zombiehead.org");
}
Symbol 244 Button
on (release) {
gotoAndPlay (3);
}