Frame 1
function currurlcontains(txt) {
var _local1 = _url.split("://");
real_domain = _local1[1].split("/");
if (real_domain[0].indexOf(txt) == -1) {
return(false);
}
return(true);
}
mochi.as2.MochiServices.connect("723f43028564f54f");
var local_data = SharedObject.getLocal("datg_gamestate");
var cf = 0;
var SPONSOR = 1;
var SITELOCK = 0;
var CPMStarContentSpotID = "2222Q4A6659CF";
System.security.allowDomain("server.cpmstar.com");
if (_root.currurlcontains("kongregate")) {
adBox._visible = false;
} else {
adBox.loadMovie("http://server.cpmstar.com/adviewas2.swf?contentspotid=" + CPMStarContentSpotID);
}
_root.attachMovie("dummy", "dummy", _root.getNextHighestDepth(), {_x:-100, _y:-100});
if (SPONSOR == 1) {
_root.attachMovie("gamesbutler_logo", "gamesbutler_logo", _root.getNextHighestDepth(), {_x:10, _y:10});
_root.gamesbutler_logo.onPress = function () {
getURL ("http://www.gamesbutler.com", "_blank");
};
}
_root.dummy.onEnterFrame = function () {
_root.cf++;
if (_root.preloadplay == undefined) {
_root.loadpercent = ("loading... " + Math.ceil((_root.getBytesLoaded() / _root.getBytesTotal()) * 100)) + "%";
}
if (((_root._framesloaded == _root._totalframes) && (_root.preloadplay == undefined)) && (_root.cf > 80)) {
_root.loadpercent = "";
_root.attachMovie("preloadplay", "preloadplay", _root.getNextHighestDepth(), {_x:300, _y:384});
_root.preloadplay.onPress = function () {
_root.adBox.removeMovieClip();
_root.gotoAndPlay("splash1");
};
}
};
stop();
Frame 3
var cc;
for (cc in _root) {
_root[cc].removeMovieClip();
}
Frame 4
function GetCookie(cookieName) {
var _local2 = "";
var _local3 = cookieName + "=";
var _local4 = "function get_cookie(){return document.cookie;}";
var _local1 = flash.external.ExternalInterface.call(_local4).toString();
if (_local1.length > 0) {
offset = _local1.indexOf(_local3);
if (offset != -1) {
offset = offset + _local3.length;
end = _local1.indexOf(";", offset);
if (end == -1) {
end = _local1.length;
}
_local2 = unescape(_local1.substring(offset, end));
}
}
return(_local2);
}
function SetCookie(cookieName, cookieValue) {
js = "javascript:function sc(){";
js = js + "var expires = new Date();\texpires.setDate( expires.getDate() + 365 );";
js = js + (((("var c = escape('" + cookieName) + "') + '=' + escape('") + cookieValue) + "') + '; path=/; expires=' + expires.toGMTString() + '';");
js = js + "document.cookie = c;";
js = js + "}sc();";
getURL (js);
}
function localscores() {
_root.scores_local._visible = false;
_root.scores_online._visible = false;
_root.btn_mm_start.enabled = false;
_root.btn_mm_tutorial.enabled = false;
_root.btn_mm_ach.enabled = false;
_root.btn_mm_scores.enabled = false;
_root.btn_mm_credits.enabled = false;
startsfx(12);
_root.attachMovie("dlgscores", "dlgscores", _root.getNextHighestDepth(), {_x:350, _y:225});
_root.dlgscores.btn_menu.onPress = function () {
startsfx(12);
_root.dlgscores.removeMovieClip();
_root.btn_mm_start.enabled = true;
_root.btn_mm_tutorial.enabled = true;
_root.btn_mm_ach.enabled = true;
_root.btn_mm_scores.enabled = true;
_root.btn_mm_credits.enabled = true;
};
_root.dlgscores.dlgbig_hard.onPress = function () {
startsfx(12);
localscores_draw(1);
};
_root.dlgscores.dlgbig_normal.onPress = function () {
startsfx(12);
localscores_draw(0);
};
localscores_draw(0);
}
function counttotalscore(diff) {
var _local2;
var _local4 = 0;
_local2 = 0;
while (_local2 < MAX_LEVELS) {
if ((_root.levelscores[_local2][diff] != 0) && (_root.levelscores[_local2][diff] != undefined)) {
_local4 = _local4 + Math.floor(_root.levelscores[_local2][diff]);
}
_local2++;
}
return(_local4);
}
function localscores_draw(diff) {
var _local2;
var _local3;
var _local7 = 0;
_local2 = 0;
while (_local2 < MAX_LEVELS) {
_local3 = "scoreline" + _local2;
if (_root.dlgscores[_local3] == undefined) {
_root.dlgscores.attachMovie("score_line", _local3, _root.dlgscores.getNextHighestDepth(), {_x:(Math.floor(_local2 / 5) * 110) + -158, _y:-58 + ((_local2 % 5) * 17)});
}
_root.dlgscores[_local3].score_label = ("gate " + (_local2 + 1)) + ":";
if ((_root.levelscores[_local2][diff] == 0) || (_root.levelscores[_local2][diff] == undefined)) {
_root.dlgscores[_local3].score_value = "n/a";
} else {
_root.dlgscores[_local3].score_value = _root.levelscores[_local2][diff];
_local7 = _local7 + Math.floor(_root.levelscores[_local2][diff]);
}
_local2++;
}
_root.dlgscores.scores_total = "total: " + _local7;
if (diff == 0) {
_root.dlgscores.scores_title = "scores: normal";
} else {
_root.dlgscores.scores_title = "scores: hard";
}
}
function showonlinescores(diff, nick, localscore) {
if (diff == 0) {
var _local3 = {n:[10, 15, 0, 2, 10, 5, 6, 5, 6, 11, 4, 9, 9, 3, 6, 10], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var _local4 = _local3.f(0, "");
if (nick != undefined) {
mochi.as2.MochiScores.showLeaderboard({boardID:_local4, score:localscore, name:nick, hideDoneButton:true, onDisplay:function () {
}, onClose:function () {
}});
} else {
mochi.as2.MochiScores.showLeaderboard({boardID:_local4, hideDoneButton:true, onDisplay:function () {
}, onClose:function () {
}});
}
} else {
var _local3 = {n:[6, 11, 1, 14, 15, 2, 15, 6, 5, 0, 0, 5, 8, 3, 14, 0], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var _local4 = _local3.f(0, "");
if (nick != undefined) {
mochi.as2.MochiScores.showLeaderboard({boardID:_local4, score:localscore, name:nick, hideDoneButton:true, onDisplay:function () {
}, onClose:function () {
}});
} else {
mochi.as2.MochiScores.showLeaderboard({boardID:_local4, hideDoneButton:true, onDisplay:function () {
}, onClose:function () {
}});
}
}
}
function onlinescores() {
_root.scores_local._visible = false;
_root.scores_online._visible = false;
_root.btn_mm_start.enabled = false;
_root.btn_mm_tutorial.enabled = false;
_root.btn_mm_ach.enabled = false;
_root.btn_mm_scores.enabled = false;
_root.btn_mm_credits.enabled = false;
startsfx(12);
if (onlinedepth == undefined) {
onlinedepth = _root.getNextHighestDepth();
}
_root.attachMovie("dlgonlinescores", "dlgonlinescores", onlinedepth, {_x:0, _y:0});
_root.dlgonlinescores.btn_menu.onPress = function () {
mochi.as2.MochiScores.closeLeaderboard();
startsfx(12);
_root.dlgonlinescores.removeMovieClip();
_root.btn_mm_start.enabled = true;
_root.btn_mm_tutorial.enabled = true;
_root.btn_mm_ach.enabled = true;
_root.btn_mm_scores.enabled = true;
_root.btn_mm_credits.enabled = true;
};
_root.dlgonlinescores.dlgbig_normal.onPress = function () {
_root.dlgonlinescores.dlgbig_normal._alpha = 50;
_root.dlgonlinescores.dlgbig_normal.enabled = false;
_root.dlgonlinescores.dlgbig_hard._alpha = 100;
_root.dlgonlinescores.dlgbig_hard.enabled = true;
_root.dlgonlinescores.scoreline.text = "local score (normal): " + counttotalscore(0);
mochi.as2.MochiScores.closeLeaderboard();
_root.dlgonlinescores.currdiff = 0;
showonlinescores(0);
};
_root.dlgonlinescores.dlgbig_hard.onPress = function () {
_root.dlgonlinescores.dlgbig_normal._alpha = 100;
_root.dlgonlinescores.dlgbig_normal.enabled = true;
_root.dlgonlinescores.dlgbig_hard._alpha = 50;
_root.dlgonlinescores.dlgbig_hard.enabled = false;
_root.dlgonlinescores.scoreline.text = "local score (hard): " + counttotalscore(1);
mochi.as2.MochiScores.closeLeaderboard();
_root.dlgonlinescores.currdiff = 1;
showonlinescores(1);
};
_root.dlgonlinescores.dlgbig_submit.onPress = function () {
if (_root.dlgonlinescores.submitnick.text.length > 0) {
mochi.as2.MochiScores.closeLeaderboard();
showonlinescores(_root.dlgonlinescores.currdiff, _root.dlgonlinescores.submitnick.text, counttotalscore(_root.dlgonlinescores.currdiff));
_root.dlgonlinescores.submitnick.text = "";
_root.dlgonlinescores.bottomline.text = "";
_root.dlgonlinescores.submitnick._visible = false;
_root.dlgonlinescores.dlgbig_submit._visible = false;
}
};
_root.dlgonlinescores.dlgbig_normal.onPress.apply(null);
}
function initsfx() {
var _local2;
_local2 = 0;
while (_local2 < _root.sfx.length) {
_root.sfx[_local2].object = new Sound();
_root.sfx[_local2].object.attachSound(_root.sfx[_local2].linkage);
_local2++;
}
}
function tro(obj) {
var _local1;
trace("----");
for (_local1 in obj) {
trace((_local1 + "=") + obj[_local1]);
}
trace("----");
}
function startsfx(idx) {
if (_root.soundmuted) {
return(undefined);
}
if ((_root.sfx[idx].laststart == undefined) || ((_root.currframe - _root.sfx[idx].laststart) > _root.sfx[idx].len)) {
if (_root.sfx[idx].loop) {
_root.sfx[idx].object.start(0, 100000);
} else {
_root.sfx[idx].object.start();
}
if (_root.sfx[idx].vol != undefined) {
_root.sfx[idx].object.setVolume(_root.sfx[idx].vol);
}
_root.sfx[idx].laststart = _root.currframe;
}
}
function stopsfx(idx) {
_root.sfx[idx].object.stop();
}
function stopallsfx() {
var _local2;
_local2 = 0;
while (_local2 < _root.sfx.length) {
_root.sfx[_local2].object.stop();
_local2++;
}
}
function resetallsfx() {
var _local2;
_local2 = 0;
while (_local2 < _root.sfx.length) {
_root.sfx[_local2].laststart = undefined;
_local2++;
}
}
function savestate() {
var _local3 = "";
var _local2;
_local2 = 0;
while (_local2 < MAX_ACH) {
_local3 = _local3 + (ach[_local2] + ";");
_local2++;
}
_local2 = 0;
while (_local2 < MAX_LEVELS) {
_local3 = _local3 + (((levelacc[_local2][0] + ";") + levelacc[_local2][1]) + ";");
_local2++;
}
_local2 = 0;
while (_local2 < MAX_LEVELS) {
_local3 = _local3 + (((levelscores[_local2][0] + ";") + levelscores[_local2][1]) + ";");
_local2++;
}
trace("savestate:" + _local3);
_root.local_data.data.gamestate = _local3;
}
function loadstate() {
var _local5;
var _local4;
var _local2;
var _local3;
_local5 = _root.local_data.data.gamestate;
trace("loadstate:" + _local5);
_local4 = _local5.split(";");
_local2 = 0;
while (_local2 < MAX_ACH) {
if ((_local4[_local2] == undefined) || (isNaN(_local4[_local2]))) {
ach[_local2] = 0;
} else {
ach[_local2] = _local4[_local2];
}
_local2++;
}
_local2 = MAX_ACH;
while (_local2 < (MAX_ACH + (2 * MAX_LEVELS))) {
_local3 = 0;
while (_local3 < 2) {
if ((_local4[_local2 + _local3] == undefined) || (isNaN(_local4[_local2 + _local3]))) {
levelacc[(_local2 - MAX_ACH) / 2][_local3] = 0;
} else {
levelacc[(_local2 - MAX_ACH) / 2][_local3] = _local4[_local2 + _local3];
}
if ((_local4[(_local2 + (2 * MAX_LEVELS)) + _local3] == undefined) || (isNaN(_local4[(_local2 + (2 * MAX_LEVELS)) + _local3]))) {
levelscores[(_local2 - MAX_ACH) / 2][_local3] = 0;
} else {
levelscores[(_local2 - MAX_ACH) / 2][_local3] = _local4[(_local2 + (2 * MAX_LEVELS)) + _local3];
}
_local3++;
}
_local2 = _local2 + 2;
}
}
function sitelock(urls_allowed) {
var _local4 = true;
var _local5 = _url.split("://");
if (_local5[0] == "file") {
_local4 = false;
}
real_domain = _local5[1].split("/");
for (x in urls_allowed) {
if (urls_allowed[x] == real_domain[0]) {
_local4 = false;
}
}
if (_local4) {
var _local2;
for (_local2 in _root) {
_root[_local2]._visible = false;
}
_root.attachMovie("sitelock_err", "sitelock_err", _root.getNextHighestDepth(), {_x:350, _y:210});
stop();
}
}
var glow_ach = (new flash.filters.GlowFilter(16777215, 1.9, 15, 15, 1, 3, false, false));
var tutorial;
var tutorialprogress;
var difficulty;
var titlepos;
var decopos;
var tmpframe;
var ach;
var levelacc;
var levelscores;
var stateloaded;
var soundmuted = false;
var cansubmit;
var onlinedepth;
var achdesc = ["kill a robot", "kill 50 robots", "kill 100 robots", "kill 250 robots", "kill 500 robots", "kill 1000 robots", "kill 2500 robots", "kill 5000 robots", "fully upgraded laser turret", "fully upgraded plasma turret", "fully upgraded EEMP800", "fully upgraded EEMP1000", "fully upgraded basic catapult", "fully upgraded enhanced catapult", "fully upgraded bouncer bullet catapult", "fully upgraded XV1000 monster", "maximum shield level", "maximum weapon area", "maximum recycle level", "maximum auto repair level", "maximum energy pool", "more than 10 barricades used on one level", "more than 25 barricades used on one level", "more than 50 barricades used on one level", "more than 100 barricades used on one level", "scored over 100 on a level", "scored over 100 on 5 levels", "scored over 100 on 10 levels", "scored over 100 on all levels", "last level completed"];
var MAX_ACH = 30;
var MAX_LEVELS = 15;
var SFX_LIMIT = 7;
var sfx = [{linkage:"gamemainmusic", len:0, loop:true}, {linkage:"bgmusic1", len:0, loop:true}, {linkage:"", len:0, loop:true}, {linkage:"", len:0, loop:true}, {linkage:"powerup", len:0, loop:false}, {linkage:"enemylasershot", len:12, loop:false, vol:20}, {linkage:"ufo_pass", len:0, loop:false}, {linkage:"explode2", len:25, loop:false}, {linkage:"button", len:0, loop:false}, {linkage:"levelstart", len:0, loop:false}, {linkage:"lasershot", len:12, loop:false, vol:30}, {linkage:"explode2b", len:25, loop:false}, {linkage:"galaxymapbutton", len:0, loop:false}];
urls_allowed = ["smartcode.hu", "www.smartcode.hu", "www.flashgamelicense.com", "flashgamelicense.com", "gamesbutler.com", "www.gamesbutler.com"];
if (SITELOCK != 0) {
sitelock(urls_allowed);
}
initsfx();
if (SPONSOR == 1) {
_root.attachMovie("gamesbutler_logo", "gamesbutler_logo", _root.getNextHighestDepth(), {_x:10, _y:10});
_root.gamesbutler_logo.onPress = function () {
getURL ("http://www.gamesbutler.com", "_blank");
};
}
_root.diff_normal._visible = false;
_root.diff_hard._visible = false;
_root.scores_local._visible = false;
_root.scores_online._visible = false;
_root.currframe = 0;
if (_root.ach == undefined) {
_root.ach = Array();
}
if (_root.cansubmit == undefined) {
_root.cansubmit = false;
}
var k;
if (_root.levelacc == undefined) {
_root.levelacc = Array();
k = 0;
while (k < MAX_LEVELS) {
_root.levelacc[k] = Array();
k++;
}
}
if (_root.levelscores == undefined) {
_root.levelscores = Array();
k = 0;
while (k < MAX_LEVELS) {
_root.levelscores[k] = Array();
k++;
}
}
_root.attachMovie("mm_deco", "mm_deco", _root.getNextHighestDepth(), {_x:0, _y:450});
_root.attachMovie("mm_title2", "mm_title", _root.getNextHighestDepth(), {_x:265, _y:-148});
stopallsfx();
startsfx(0);
_root.sclogo.onRollOver = function () {
this.filters = [glow_ach];
};
_root.sclogo.onRollOut = function () {
this.filters = undefined;
};
_root.sclogo.onPress = function () {
getURL ("http://www.smartcode.hu", "_blank");
};
_root.bigspace.onEnterFrame = function () {
var _local2;
_root.bigspace._x = -100 + (100 * Math.sin((Math.PI * _root.currframe) / 400));
_root.bigspace._y = -100 + (100 * Math.cos((Math.PI * _root.currframe) / 400));
_root.currframe++;
_root.mm_title._y = -148 + _root.currframe;
if (_root.mm_title._y > 2) {
_root.mm_title._y = 2;
}
_root.mm_title._alpha = 70 + Math.floor(Math.random() * 30);
_root.mm_deco._y = 450 - _root.currframe;
if (_root.mm_deco._y < 244) {
_root.mm_deco._y = 244;
}
};
_root.diff_normal.onPress = function () {
_root.difficulty = 0;
_root.gotoAndPlay("levels");
};
_root.diff_hard.onPress = function () {
_root.difficulty = 1;
_root.gotoAndPlay("levels");
};
_root.btn_mm_start.onPress = function () {
startsfx(12);
_root.diff_normal._visible = true;
_root.diff_hard._visible = true;
_root.scores_local._visible = false;
_root.scores_online._visible = false;
};
_root.btn_mm_tutorial.onPress = function () {
startsfx(12);
_root.currlevel = 100;
tutorial = 0;
tutorialprogress = 0;
gotoAndPlay ("game");
};
_root.btn_mm_scores.onPress = function () {
startsfx(12);
_root.scores_local._visible = true;
_root.scores_online._visible = true;
_root.diff_normal._visible = false;
_root.diff_hard._visible = false;
_root.scores_local.onPress = function () {
localscores();
};
_root.scores_online.onPress = function () {
onlinescores();
};
};
_root.btn_mm_ach.onPress = function () {
var _local3;
var _local5;
var _local4;
_root.btn_mm_start.enabled = false;
_root.btn_mm_tutorial.enabled = false;
_root.btn_mm_ach.enabled = false;
_root.btn_mm_scores.enabled = false;
_root.btn_mm_credits.enabled = false;
startsfx(12);
_root.attachMovie("dlgach", "dlgach", _root.getNextHighestDepth(), {_x:350, _y:225});
_root.dlgach.btn_menu.onPress = (_root.dlgach.menu.onPress = function () {
startsfx(12);
_root.dlgach.removeMovieClip();
_root.btn_mm_start.enabled = true;
_root.btn_mm_tutorial.enabled = true;
_root.btn_mm_ach.enabled = true;
_root.btn_mm_scores.enabled = true;
_root.btn_mm_credits.enabled = true;
});
_local3 = 0;
while (_local3 < MAX_ACH) {
_local4 = "achtile" + _local3;
_local5 = "tile" + ((_local3 % 15) + 1);
_root.dlgach.attachMovie(_local5, _local4, _root.dlgach.getNextHighestDepth(), {_x:((Math.floor(_local3 / 15) * 150) + -125) + ((_local3 % 3) * 50), _y:-43 + ((Math.floor(_local3 / 3) % 5) * 25)});
_root.dlgach[_local4].achindex = _local3;
if (_local3 >= 15) {
_root.dlgach[_local4].attachMovie(_local5, _local5, 0, {_x:0, _y:-3});
}
if (((_root.ach[_local3] != undefined) && (!isNaN(_root.ach[_local3]))) && (_root.ach[_local3] > 0)) {
_root.dlgach[_local4].filters = [glow_ach];
_root.dlgach[_local4].onEnterFrame = function () {
this._alpha = 70 + Math.floor(Math.random() * 30);
};
} else {
_root.dlgach[_local4].onEnterFrame = function () {
};
}
_root.dlgach[_local4].onRollOver = function () {
if ((_root.ach[this.achindex] == 0) || (_root.ach[this.achindex] == undefined)) {
_root.dlgach.ach_desc = achdesc[this.achindex] + "<br>not yet reached";
} else if (((this.achindex >= 1) && (this.achindex <= 7)) || ((this.achindex >= 26) && (this.achindex <= 28))) {
_root.dlgach.ach_desc = achdesc[this.achindex] + "<br>Reached";
} else {
_root.dlgach.ach_desc = ((achdesc[this.achindex] + "<br>Reached: ") + _root.ach[this.achindex]) + " time(s)";
}
};
_root.dlgach[_local4].onRollOut = function () {
_root.dlgach.ach_desc = "";
};
_local3++;
}
};
_root.btn_mm_credits.onPress = function () {
startsfx(12);
_root.gotoAndPlay("credits");
};
if ((stateloaded == undefined) || (stateloaded == false)) {
loadstate();
stateloaded = true;
}
stop();
Frame 5
function addspaceship(proto, fromx, fromy, tox, toy, duration, mode) {
inst = (proto + "_") + _root.currframe;
_root.attachMovie(proto, inst, _root.getNextHighestDepth(), {_x:fromx, _y:fromy});
_root[inst].startframe = _root.currframe;
_root[inst].fromx = fromx;
_root[inst].fromy = fromy;
_root[inst].origw = _root[inst]._width;
_root[inst].origh = _root[inst]._height;
if (mode == 1) {
_root[inst]._width = 1;
_root[inst]._height = 1;
}
_root[inst].mode = mode;
_root[inst].tox = tox;
_root[inst].toy = toy;
_root[inst].duration = duration;
_root[inst].cacheAsBitmap = true;
}
function incspaceships() {
var _local2;
for (c in _root) {
if (c.substring(0, 9) == "spaceship") {
if ((_root[c].mode == 1) && ((_root.currframe - _root[c].startframe) == (_root[c].duration / 2))) {
startsfx(6);
}
_local2 = (_root.currframe - _root[c].startframe) / _root[c].duration;
_local2 = _local2 * _local2;
if (_local2 > 1) {
_root[c].removeMovieClip();
continue;
}
_root[c]._x = _root[c].fromx + ((_root[c].tox - _root[c].fromx) * _local2);
_root[c]._y = _root[c].fromy + ((_root[c].toy - _root[c].fromy) * _local2);
if (_root[c].mode == 1) {
_root[c]._width = _root[c].origw * _local2;
_root[c]._height = _root[c].origh * _local2;
}
}
}
}
var gates = [[265, 59], [173, 105], [102, 166], [85, 238], [103, 302], [184, 347], [272, 366], [372, 361], [472, 329], [557, 276], [607, 205], [610, 132], [574, 82], [483, 53], [383, 45]];
_root.attachMovie("mm_spacebase", "mm_spacebase", _root.getNextHighestDepth(), {_x:350, _y:225, _width:1, _height:1});
_root.titlepos = _root.mm_title._y;
_root.decopos = _root.mm_deco._y;
_root.tmpframe = _root.currframe;
_root.menu.onPress = function () {
var _local2;
_root.currframe = 0;
for (_local2 in _root) {
_root[_local2].removeMovieClip();
}
startsfx(12);
gotoAndPlay ("mainmenu");
};
_root.bigspace.onEnterFrame = function () {
var i;
_root.bigspace._x = -100 + (100 * Math.sin((Math.PI * _root.currframe) / 400));
_root.bigspace._y = -100 + (100 * Math.cos((Math.PI * _root.currframe) / 400));
_root.currframe++;
var _local2 = _root.currframe - _root.tmpframe;
_root.mm_deco._y = _root.decopos + (_local2 * 4);
if (_root.mm_deco._y > 450) {
_root.mm_deco._visible = false;
}
_root.mm_title._y = _root.titlepos - (_local2 * 4);
if (_root.mm_title._y < -164) {
_root.mm_title._visible = false;
}
_root.mm_title._alpha = 70 + Math.floor(Math.random() * 30);
switch (_local2 % 500) {
case 10 :
addspaceship("spaceship1", 200, 450, -304, 270, 50, 1);
break;
case 400 :
case 50 :
addspaceship("spaceship1", 250, 450, -304, 220, 50, 1);
break;
case 51 :
addspaceship("spaceship2", 450, -100, 650, 450, 150, 2);
break;
case 100 :
addspaceship("spaceship3", 750, 150, 200, -188, 150, 1);
break;
case 150 :
addspaceship("spaceship2", 150, -100, 350, 450, 150, 2);
break;
case 151 :
addspaceship("spaceship4", -500, 200, 750, 400, 200, 2);
break;
case 350 :
addspaceship("spaceship2", 50, -100, 250, 450, 150, 2);
break;
case 370 :
addspaceship("spaceship5", 350, 513, 900, 200, 50, 1);
}
if (_local2 <= 50) {
_root.mm_spacebase._width = (425 * Math.sqrt(_local2)) / 7.07106781186548;
_root.mm_spacebase._height = (317 * Math.sqrt(_local2)) / 7.07106781186548;
} else if (((_local2 - 51) % 2) == 0) {
i = Math.floor((_local2 - 51) / 2);
if (i < _root.gates.length) {
var _local3 = "gate" + i;
_root.attachMovie("mm_gate", _local3, _root.getNextHighestDepth(), {_x:_root.gates[i][0], _y:_root.gates[i][1]});
_root[_local3].title = "gate " + (i + 1);
if ((i != 0) && (_root.levelacc[i][_root.difficulty] != 1)) {
_root[_local3].title2 = "locked";
_root[_local3].mm_play._visible = false;
} else {
_root[_local3].title2 = "";
_root[_local3].mm_play.onPress = function () {
_root.currlevel = i;
tutorial = -1;
gotoAndPlay ("game");
};
}
}
}
incspaceships();
};
stop();
Frame 6
function corrections() {
var _local2;
_local2 = 0;
while (_local2 < robotprops.length) {
if (_root.difficulty == 0) {
robotprops[_local2].hp = Math.floor(robotprops[_local2].hp * ROBOTHP_CORRECTION_NORMAL);
robotprops[_local2].rvalue = Math.floor(robotprops[_local2].rvalue * ROBOTVALUE_CORRECTION_NORMAL);
} else {
robotprops[_local2].hp = Math.floor(robotprops[_local2].hp * ROBOTHP_CORRECTION_HARD);
robotprops[_local2].rvalue = Math.floor(robotprops[_local2].rvalue * ROBOTVALUE_CORRECTION_HARD);
}
_local2++;
}
}
function calctotal() {
var _local3;
var _local1;
var _local4 = Array();
var _local2 = Array();
_local1 = 0;
while (_local1 < ROBOT_LAST) {
_local2[_local1] = 0;
_local1++;
}
_local3 = 0;
while (_local3 < 15) {
_local4 = calclevel(_local3);
_local1 = 0;
while (_local1 < ROBOT_LAST) {
_local2[_local1] = _local2[_local1] + _local4[_local1];
_local1++;
}
_local3++;
}
_local1 = 0;
while (_local1 < ROBOT_LAST) {
trace(((_local1 + 1) + ": ") + _local2[_local1]);
_local1++;
}
}
function mainbtns_visible(enable) {
_root.buyturret._visible = enable;
_root.buycatapult._visible = enable;
_root.buybarricade._visible = enable;
_root.buybaseupgrade._visible = enable;
_root.btn_play._visible = enable;
_root.btn_pause._visible = enable;
_root.btn_fast._visible = enable;
_root.btn_sound._visible = enable;
_root.btn_help._visible = enable;
_root.btn_menu._visible = enable;
}
function addach(idx) {
if (((_root.ach[idx] == undefined) || (_root.ach[idx] == 0)) || (isNaN(_root.ach[idx]))) {
_root.ach[idx] = 0;
showdlgerr("achievement!");
}
_root.ach[idx]++;
if ((idx == 0) && (_root.ach[idx] >= 50)) {
_root.ach[1] = 1;
}
if ((idx == 0) && (_root.ach[idx] >= 100)) {
_root.ach[2] = 1;
}
if ((idx == 0) && (_root.ach[idx] >= 250)) {
_root.ach[3] = 1;
}
if ((idx == 0) && (_root.ach[idx] >= 500)) {
_root.ach[4] = 1;
}
if ((idx == 0) && (_root.ach[idx] >= 1000)) {
_root.ach[5] = 1;
}
if ((idx == 0) && (_root.ach[idx] >= 2500)) {
_root.ach[6] = 1;
}
if ((idx == 0) && (_root.ach[idx] >= 5000)) {
_root.ach[7] = 1;
}
}
function sumarr(a, to) {
var _local2 = 0;
var _local1;
_local1 = 1;
while (_local1 <= to) {
_local2 = _local2 + a[_local1];
_local1++;
}
return(_local2);
}
function xlscomma(num) {
var _local1;
var _local3 = "";
_local1 = 0;
while (_local1 < num.length) {
if (num.charAt(_local1) == ".") {
_local3 = _local3 + ",";
} else {
_local3 = _local3 + num.charAt(_local1);
}
_local1++;
}
return(_local3);
}
function calceff() {
var _local1;
var _local4;
var _local3;
var _local2;
_local1 = 0;
while (_local1 < catapultupgrades.length) {
_local4 = 0;
while (_local4 < catapultupgrades[_local1].freq.length) {
_local3 = 0;
while (_local3 < catapultupgrades[_local1].dmg.length) {
_local2 = 0;
while (_local2 < catapultupgrades[_local1].dmgr.length) {
var _local8 = ((((((((((((("CATAPULT" + (_local1 + 1)) + " ") + _local4) + "-") + catapultupgrades[_local1].freq[_local4]) + " ") + _local3) + "-") + catapultupgrades[_local1].dmg[_local3]) + " ") + _local2) + "-") + catapultupgrades[_local1].dmgr[_local2]) + " ";
var _local5 = ((catapultprops[_local1].cost + sumarr(catapultupgrades[_local1].freq_cost, _local4)) + sumarr(catapultupgrades[_local1].dmg_cost, _local3)) + sumarr(catapultupgrades[_local1].dmgr_cost, _local2);
var _local7 = 1;
var _local6 = (((((_local7 * catapultupgrades[_local1].dmg[_local3]) * catapultupgrades[_local1].dmgr[_local2]) * catapultupgrades[_local1].dmgr[_local2]) * Math.PI) * 25) / catapultupgrades[_local1].freq[_local4];
_local8 = _local8 + ((((_local5 + " ") + Math.floor(_local6)) + " ") + (_local5 / _local6));
trace((((((((((((("CAT" + (_local1 + 1)) + "; (F") + _local4) + "-D") + _local3) + "-DR") + _local2) + "); ") + _local5) + "; ") + xlscomma("" + _local6)) + "; ") + xlscomma("" + (_local5 / _local6)));
_local2++;
}
_local3++;
}
_local4++;
}
_local1++;
}
}
function calclevel(lvl) {
var _local5;
var _local2;
var _local4;
var _local9 = _root["timeline" + lvl];
var _local3;
var _local6;
var _local7;
var _local11 = 0;
var _local10 = 0;
var _local8 = Array();
_local5 = 0;
while (_local5 < ROBOT_LAST) {
_local8[_local5] = 0;
_local5++;
}
_local5 = 0;
while (_local5 < _local9.length) {
_local3 = _local9[_local5].wave;
_local6 = 0;
_local7 = 0;
if (_local3.charAt(0) == "f") {
_local2 = 0;
while (_local2 < _root[_local3].length) {
_local4 = 0;
while (_local4 < _root[_local3][_local2].length) {
if (_root[_local3][_local2][_local4] != 0) {
_local6 = _local6 + _root.robotprops[_root[_local3][_local2][_local4] - 1].hp;
_local7 = _local7 + _root.robotprops[_root[_local3][_local2][_local4] - 1].rvalue;
_local8[_root[_local3][_local2][_local4] - 1]++;
}
_local4++;
}
_local2++;
}
} else {
_local2 = 0;
while (_local2 < _root[_local3].length) {
_local6 = _local6 + (_root[_local3][_local2] * _root.robotprops[_local2].hp);
_local7 = _local7 + (_root[_local3][_local2] * _root.robotprops[_local2].rvalue);
_local8[_local2] = _local8[_local2] + _root[_local3][_local2];
_local2++;
}
}
_local11 = _local11 + _local6;
_local10 = _local10 + _local7;
_local5++;
}
return(_local8);
}
function cloneobj(newproto, obj) {
var _local3;
var _local4 = obj.getDepth();
_local3 = obj._parent.attachMovie(newproto, obj._name, _root.getNextHighestDepth(), obj);
_local3._x = obj._x;
_local3._y = obj._y;
_local3.gotoAndStop(obj._currentframe);
_local3.filters = obj.filters;
_root.itemlist[obj.itemidx] = _local3;
obj.removeMovieClip();
_local3.swapDepths(_local4);
return(_local3);
}
function sellprice(totalcost) {
return(Math.ceil(totalcost / 2));
}
function delitem(itemobj) {
var _local6;
var _local3;
_local6 = 0;
while (_local6 < _root.lastitem) {
if ((_root.itemlist[_local6] == itemobj) || (_root.itemlist[_local6].ancestor == itemobj)) {
if (((itemobj.mtype >= TOWER1) && (itemobj.mtype <= TOWER_LAST)) || ((itemobj.mtype >= CATAPULT1) && (itemobj.mtype <= CATAPULT_LAST))) {
var _local4;
var _local5;
var _local8;
var _local7;
if ((itemobj.mtype >= TOWER1) && (itemobj.mtype <= TOWER_LAST)) {
_local4 = towerprops[itemobj.mtype - TOWER1].acc;
} else {
_local4 = catapultprops[itemobj.mtype - CATAPULT1].acc;
}
_local3 = 0;
while (_local3 < _local4.length) {
_local8 = itemobj.cx + (_local4[_local3].ox * CELL);
_local7 = itemobj.cy + (_local4[_local3].oy * CELL);
_local5 = _root.getInstanceAtDepth(depth(_local8, _local7));
if ((_local5 != undefined) && (_local5._name.substr(0, 10) == "static_acc")) {
_local5.removeMovieClip();
}
_local3++;
}
}
_root.itemlist[_local6].removeMovieClip();
_root.itemlist[_local6] = undefined;
}
_local6++;
}
}
function hidedlgs() {
_root.emptyhand();
_root.dlgprops.itemobj.filters = undefined;
_root.dlgprops.removeMovieClip();
_root.dlgbuyturret.removeMovieClip();
_root.dlgbuycatapult.removeMovieClip();
_root.dlgbuybarricade.removeMovieClip();
_root.dlgbuybaseuprade.removeMovieClip();
_root.range_catapult.removeMovieClip();
_root.range_tower.removeMovieClip();
_root.validplaces.removeMovieClip();
_root.tiptext = "";
staticdepthrepair();
}
function propsdialog(title, itemtype, itemobj, upgrades, vars, labels) {
var _local4;
var _local3;
var _local5;
var _local7 = 0;
var _local8 = 0;
if (_root.iteminhand != -1) {
mousepress();
return(undefined);
}
hidedlgs();
switch (itemtype) {
case BASEID :
proto = "buybaseupgradeimg";
_local7 = -1;
_local8 = 20;
break;
case TOWER1 :
proto = "tow1img";
break;
case TOWER2 :
proto = "tow2img";
break;
case TOWER3 :
proto = "tow3img";
break;
case TOWER4 :
proto = "tow4img";
break;
case CATAPULT1 :
proto = "cat1img";
break;
case CATAPULT2 :
proto = "cat2img";
break;
case CATAPULT3 :
proto = "cat3img";
break;
case CATAPULT4 :
proto = "cat4img";
}
_root.attachMovie("dlgprops", "dlgprops", RD_DLG, {_x:699, _y:450});
_root.dlgprops.itemobj = itemobj;
_root.dlgprops.title = title;
_root.dlgprops.desc = "";
_root.dlgprops.scales._visible = false;
_root.dlgprops.x.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
itemobj.filters = undefined;
_root.range_tower.removeMovieClip();
_root.range_catapult.removeMovieClip();
_root.dlgprops.removeMovieClip();
};
if (itemtype == BASEID) {
_root.dlgprops.sell._visible = false;
} else {
_root.dlgprops.sell.onRollOver = function () {
_root.dlgprops.desc = (("sell item for " + sellprice(itemobj.totalcost)) + ". cost so far: ") + itemobj.totalcost;
};
_root.dlgprops.sell.onRollOut = function () {
_root.dlgprops.desc = "";
};
_root.dlgprops.sell.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
mny(sellprice(itemobj.totalcost));
_root.dlgprops.removeMovieClip();
delitem(itemobj);
staticdepthrepair();
};
}
_root.dlgprops.attachMovie(proto, "dlgdecor", this.dlgprops.getNextHighestDepth(), {_x:-338 + _local7, _y:-45 + _local8});
_local4 = 0;
while (_local4 < vars.length) {
if (upgrades[vars[_local4]] != undefined) {
_local5 = "prop_line" + _local4;
_root.dlgprops.attachMovie("prop_line", _local5, _root.dlgprops.getNextHighestDepth(), {_x:-295, _y:-100 + (_local4 * 15)});
if (((itemtype >= CATAPULT1) && (itemtype <= CATAPULT4)) && ((vars[_local4] == "startv") || (vars[_local4] == "xspread"))) {
_root.dlgprops[_local5].prop_downgrade._visible = true;
} else {
_root.dlgprops[_local5].prop_downgrade._visible = false;
}
_root.dlgprops[_local5].prop_downgrade.propvar = vars[_local4];
_root.dlgprops[_local5].prop_downgrade.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
itemobj[this.propvar + "_level"]--;
propsdialogrefresh(itemtype, itemobj, upgrades, vars, labels);
};
_root.dlgprops[_local5].prop_upgrade.onPress = function () {
var _local3;
if (this.nextcost == undefined) {
return(undefined);
}
if (checktutvalid()) {
return(undefined);
}
if (!mny(-this.nextcost)) {
return(undefined);
}
startsfx(4);
itemobj.totalcost = itemobj.totalcost + this.nextcost;
itemobj[this.propvar + "_level"]++;
if (((itemtype == BASEID) && (this.propvar == "shield")) && (itemobj[this.propvar + "_level"] == (baseupgrades[this.propvar].length - 1))) {
addach(16);
}
if (((itemtype == BASEID) && (this.propvar == "size")) && (itemobj[this.propvar + "_level"] == (baseupgrades[this.propvar].length - 1))) {
addach(17);
}
if (((itemtype == BASEID) && (this.propvar == "recycle")) && (itemobj[this.propvar + "_level"] == (baseupgrades[this.propvar].length - 1))) {
addach(18);
}
if (((itemtype == BASEID) && (this.propvar == "repair")) && (itemobj[this.propvar + "_level"] == (baseupgrades[this.propvar].length - 1))) {
addach(19);
}
if (((itemtype == BASEID) && (this.propvar == "nrgpool")) && (itemobj[this.propvar + "_level"] == (baseupgrades[this.propvar].length - 1))) {
addach(20);
}
if ((itemtype >= CATAPULT1) && (itemtype <= CATAPULT_LAST)) {
var _local4 = 0;
_local3 = 0;
while (_local3 < catapult_vars.length) {
if (itemobj[catapult_vars[_local3] + "_level"] == (catapultupgrades[itemtype - CATAPULT1][catapult_vars[_local3]].length - 1)) {
_local4++;
}
_local3++;
}
if (_local4 == catapult_vars.length) {
addach((12 + itemtype) - CATAPULT1);
}
}
if ((itemtype >= TOWER1) && (itemtype <= TOWER_LAST)) {
var _local4 = 0;
_local3 = 0;
while (_local3 < tower_vars.length) {
if (itemobj[tower_vars[_local3] + "_level"] == (towerupgrades[itemtype - TOWER1][tower_vars[_local3]].length - 1)) {
_local4++;
}
_local3++;
}
if (_local4 == tower_vars.length) {
addach((8 + itemtype) - TOWER1);
}
}
if ((itemtype == BASEID) && (this.propvar == "size")) {
_local3 = 0;
while (_local3 < _root.lastitem) {
if (((_root.itemlist[_local3] != undefined) && (_root.itemlist[_local3].mtype <= CUBE_LAST)) && (_root.itemlist[_local3].cy <= (currbaseborder() + CELL))) {
itemobj.totalcost = itemobj.totalcost - this.nextcost;
mny(this.nextcost);
itemobj.size_level--;
showdlgerr("not enough space!");
return(undefined);
}
_local3++;
}
_local3 = 0;
while (_local3 < _root.lastitem) {
if ((_root.itemlist[_local3] != undefined) && (_root.itemlist[_local3].mtype <= ROBOT_LAST)) {
_root.itemlist[_local3].desty = _root.itemlist[_local3].desty + (CELL * (baseupgrades.size[base.size_level] - baseupgrades.size[base.size_level - 1]));
}
_local3++;
}
}
if (((itemobj.mtype == TOWER1) && (this.propvar == "freq")) && (itemobj.freq_level == 2)) {
itemobj = cloneobj("tow1b", itemobj);
_root.dlgprops.itemobj = itemobj;
}
if (((itemobj.mtype == TOWER1) && (this.propvar == "freq")) && (itemobj.freq_level == 4)) {
itemobj = cloneobj("tow1c", itemobj);
_root.dlgprops.itemobj = itemobj;
}
if (((itemobj.mtype == TOWER2) && (this.propvar == "freq")) && (itemobj.freq_level == 2)) {
itemobj = cloneobj("tow2b", itemobj);
_root.dlgprops.itemobj = itemobj;
}
if (((itemobj.mtype == TOWER2) && (this.propvar == "freq")) && (itemobj.freq_level == 4)) {
itemobj = cloneobj("tow2c", itemobj);
_root.dlgprops.itemobj = itemobj;
}
if (itemtype == BASEID) {
drawbase();
}
propsdialogrefresh(itemtype, itemobj, upgrades, vars, labels);
if (this.nextcost != undefined) {
this._parent._parent.desc = ("cost: " + this.nextcost) + " units";
}
};
_root.dlgprops[_local5].prop_upgrade.propvar = vars[_local4];
_root.dlgprops[_local5].prop_upgrade.onRollOver = function () {
this._parent._parent.desc = ("cost: " + this.nextcost) + " units";
};
_root.dlgprops[_local5].prop_upgrade.onRollOut = function () {
this._parent._parent.desc = "";
};
}
_local4++;
}
if ((itemtype >= TOWER1) && (itemtype <= TOWER4)) {
_root.dlgprops.attachMovie("prop_line_priority", "prop_line_priority", _root.dlgprops.getNextHighestDepth(), {_x:-295, _y:-100 + (_local4 * 15)});
_root.dlgprops.prop_line_priority.prop_label = "priority";
_root.dlgprops.prop_line_priority.prop_line_pribtn1.prop_label = "first";
_root.dlgprops.prop_line_priority.prop_line_pribtn2.prop_label = "strong";
_root.dlgprops.prop_line_priority.prop_line_pribtn3.prop_label = "weak";
_root.dlgprops.prop_line_priority.prop_line_pribtn4.prop_label = "random";
if (itemobj.priority == undefined) {
itemobj.priority = 1;
}
_root.dlgprops.prop_line_priority.prop_line_pribtn1.onPress = function () {
this.filters = [_root.glow1];
this._parent.prop_line_pribtn2.filters = undefined;
this._parent.prop_line_pribtn3.filters = undefined;
this._parent.prop_line_pribtn4.filters = undefined;
itemobj.priority = 1;
};
_root.dlgprops.prop_line_priority.prop_line_pribtn2.onPress = function () {
this.filters = [_root.glow1];
this._parent.prop_line_pribtn1.filters = undefined;
this._parent.prop_line_pribtn3.filters = undefined;
this._parent.prop_line_pribtn4.filters = undefined;
itemobj.priority = 2;
};
_root.dlgprops.prop_line_priority.prop_line_pribtn3.onPress = function () {
this.filters = [_root.glow1];
this._parent.prop_line_pribtn1.filters = undefined;
this._parent.prop_line_pribtn2.filters = undefined;
this._parent.prop_line_pribtn4.filters = undefined;
itemobj.priority = 3;
};
_root.dlgprops.prop_line_priority.prop_line_pribtn4.onPress = function () {
this.filters = [_root.glow1];
this._parent.prop_line_pribtn1.filters = undefined;
this._parent.prop_line_pribtn2.filters = undefined;
this._parent.prop_line_pribtn3.filters = undefined;
itemobj.priority = 4;
};
_root.dlgprops.prop_line_priority["prop_line_pribtn" + itemobj.priority].filters = [_root.glow1];
}
propsdialogrefresh(itemtype, itemobj, upgrades, vars, labels);
}
function createrectarea(mn, depth, cmin, cmax, color) {
_root.createEmptyMovieClip(mn, depth);
_root[mn].beginFill(color, 10);
_root[mn].lineStyle(2, color, 30);
_root[mn].moveTo(sx(cmin.x, cmin.y), sy(cmin.x, cmin.y, 0));
_root[mn].lineTo(sx(cmax.x, cmin.y), sy(cmax.x, cmin.y, 0));
_root[mn].lineTo(sx(cmax.x, cmax.y), sy(cmax.x, cmax.y, 0));
_root[mn].lineTo(sx(cmin.x, cmax.y), sy(cmin.x, cmax.y, 0));
_root[mn].endFill();
_root[mn].cmin = cmin;
_root[mn].cmax = cmax;
}
function propsdialogrefresh(itemtype, itemobj, upgrades, vars, labels) {
var _local2;
var _local4;
var _local6;
var _local8;
var _local5;
_local2 = 0;
while (_local2 < vars.length) {
_local6 = "prop_line" + _local2;
_local8 = itemobj[vars[_local2] + "_level"];
_root.dlgprops[_local6].prop_label = labels[_local2];
if ((upgrades[vars[_local2]].length - 1) == itemobj[vars[_local2] + "_level"]) {
_root.dlgprops[_local6].prop_upgrade._visible = false;
} else {
_root.dlgprops[_local6].prop_upgrade._visible = true;
}
if (itemobj[vars[_local2] + "_level"] == 0) {
_root.dlgprops[_local6].prop_downgrade._visible = false;
} else if (((itemtype >= CATAPULT1) && (itemtype <= CATAPULT4)) && ((vars[_local2] == "startv") || (vars[_local2] == "xspread"))) {
_root.dlgprops[_local6].prop_downgrade._visible = true;
}
if ((itemtype >= TOWER1) && (itemtype <= TOWER_LAST)) {
_local5 = towerscales;
}
if ((itemtype >= CATAPULT1) && (itemtype <= CATAPULT_LAST)) {
_local5 = catapultscales;
}
if (itemtype == BASEID) {
_local5 = basescales;
}
if (_local5[vars[_local2] + "_inv"]) {
_root.dlgprops[_local6].scales.scales_curr._width = Math.floor((100 * (_local5[vars[_local2] + "_min"] - upgrades[vars[_local2]][_local8])) / (_local5[vars[_local2] + "_min"] - _local5[vars[_local2] + "_max"]));
_root.dlgprops[_local6].scales.scales_full._width = Math.floor((100 * (_local5[vars[_local2] + "_min"] - upgrades[vars[_local2]][upgrades[vars[_local2]].length - 1])) / (_local5[vars[_local2] + "_min"] - _local5[vars[_local2] + "_max"]));
_root.dlgprops[_local6].scales.scales_next._visible = false;
_local4 = 0;
while (_local4 < MAX_UPGRADES) {
_root.dlgprops[_local6].scales["scales_grid" + _local4]._x = Math.floor((100 * (_local5[vars[_local2] + "_min"] - upgrades[vars[_local2]][_local4])) / (_local5[vars[_local2] + "_min"] - _local5[vars[_local2] + "_max"]));
_local4++;
}
} else {
_root.dlgprops[_local6].scales.scales_curr._width = Math.floor((100 * ((-_local5[vars[_local2] + "_min"]) + upgrades[vars[_local2]][_local8])) / (_local5[vars[_local2] + "_max"] - _local5[vars[_local2] + "_min"]));
_root.dlgprops[_local6].scales.scales_full._width = Math.floor((100 * ((-_local5[vars[_local2] + "_min"]) + upgrades[vars[_local2]][upgrades[vars[_local2]].length - 1])) / (_local5[vars[_local2] + "_max"] - _local5[vars[_local2] + "_min"]));
_root.dlgprops[_local6].scales.scales_next._visible = false;
_local4 = 0;
while (_local4 < MAX_UPGRADES) {
_root.dlgprops[_local6].scales["scales_grid" + _local4]._x = Math.floor((100 * ((-_local5[vars[_local2] + "_min"]) + upgrades[vars[_local2]][_local4])) / (_local5[vars[_local2] + "_max"] - _local5[vars[_local2] + "_min"]));
_local4++;
}
}
_local4 = 0;
while (_local4 < MAX_UPGRADES) {
if (_local4 < upgrades[vars[_local2]].length) {
if (_local4 == _local8) {
_root.dlgprops[_local6].prop_upgrade.nextcost = upgrades[vars[_local2] + "_cost"][_local8 + 1];
_root.dlgprops[_local6].prop_upgrade.nextvalue = upgrades[vars[_local2]][_local8 + 1];
_root.dlgprops[_local6].prop_upgrade.currvalue = upgrades[vars[_local2]][_local8];
}
}
_local4++;
}
_local2++;
}
if ((itemtype >= TOWER1) && (itemtype <= TOWER_LAST)) {
var _local17 = Object();
var _local16 = Object();
_local17.x = (LOX - 1) * CELL;
_local17.y = itemobj.cy;
_local16.x = ((LOX + LW) - 1) * CELL;
_local16.y = itemobj.cy + (upgrades.range[itemobj.range_level] * CELL);
_root.range_tower.removeMovieClip();
createrectarea("range_tower", RD_RANGE, _local17, _local16, 16750848);
}
if ((itemtype >= CATAPULT1) && (itemtype <= CATAPULT_LAST)) {
var _local11;
var _local12 = catapultprops[itemtype - CATAPULT1];
var _local13 = upgrades.startv[itemobj.startv_level];
var _local15 = upgrades.xspread[itemobj.xspread_level];
_root.range_catapult.removeMovieClip();
_root.createEmptyMovieClip("range_catapult", RD_RANGE);
_root.range_catapult.beginFill(16750848, 10);
_root.range_catapult.lineStyle(2, 16750848, 30);
_local11 = catrange(itemobj.cx + _local12.startxoff, itemobj.cy + _local12.startyoff, itemobj.cz + _local12.startzoff, (-_local15) / 2, _local13, _local13);
_root.range_catapult.moveTo(sx(_local11.x, _local11.y), sy(_local11.x, _local11.y, 0));
_local11 = catrange(itemobj.cx + _local12.startxoff, itemobj.cy + _local12.startyoff, itemobj.cz + _local12.startzoff, (-_local15) / 2, _local13 + _local12.maxv, _local13 + _local12.maxv);
_root.range_catapult.lineTo(sx(_local11.x, _local11.y), sy(_local11.x, _local11.y, 0));
_local11 = catrange(itemobj.cx + _local12.startxoff, itemobj.cy + _local12.startyoff, itemobj.cz + _local12.startzoff, _local15 / 2, _local13 + _local12.maxv, _local13 + _local12.maxv);
_root.range_catapult.lineTo(sx(_local11.x, _local11.y), sy(_local11.x, _local11.y, 0));
_local11 = catrange(itemobj.cx + _local12.startxoff, itemobj.cy + _local12.startyoff, itemobj.cz + _local12.startzoff, _local15 / 2, _local13, _local13);
_root.range_catapult.lineTo(sx(_local11.x, _local11.y), sy(_local11.x, _local11.y, 0));
_root.range_catapult.endFill();
}
}
function catrange(cx, cy, cz, vx, vy, vz) {
var _local1;
_local1 = (((-2 * vz) - GRAVITY) - Math.sqrt((((2 * vz) + GRAVITY) * ((2 * vz) + GRAVITY)) + ((8 * GRAVITY) * cz))) / (-2 * GRAVITY);
return({x:cx + (_local1 * vx), y:cy + (_local1 * vy)});
}
function putiteminhand(item) {
var _local2;
_root.iteminhand = item;
switch (item) {
case TOWER1 :
_local2 = "tow1img";
break;
case TOWER2 :
_local2 = "tow2img";
break;
case TOWER3 :
_local2 = "tow3img";
break;
case TOWER4 :
_local2 = "tow4img";
break;
case CATAPULT1 :
_local2 = "cat1img";
break;
case CATAPULT2 :
_local2 = "cat2img";
break;
case CATAPULT3 :
_local2 = "cat3img";
break;
case CATAPULT4 :
_local2 = "cat4img";
break;
case CUBE5 :
_local2 = "cube5";
break;
case CUBE6 :
_local2 = "cube6";
break;
case CUBE1 :
_local2 = "cube1";
break;
case CUBE2 :
_local2 = "cube2";
break;
case CUBE3 :
_local2 = "cube3";
break;
case CUBE4 :
_local2 = "cube4";
break;
case CUBE9 :
_local2 = "cube9";
break;
case CUBE10 :
_local2 = "cube10";
}
if ((item >= CUBE1) && (item <= CUBE_LAST)) {
_root.attachMovie("validplace_small", "iteminhandvalid_mc", RD_INHANDVALID, {_x:_root._xmouse, _y:_root._ymouse, _alpha:50});
} else {
_root.attachMovie("validplace", "iteminhandvalid_mc", RD_INHANDVALID, {_x:_root._xmouse, _y:_root._ymouse, _alpha:50});
acc(item, 0);
}
_root.attachMovie(_local2, "iteminhand_mc", RD_INHAND, {_x:_root._xmouse, _y:_root._ymouse});
_root.tiptext = "press \"esc\" to discard item";
}
function acc(item, mode, ccx, ccy) {
var _local7;
var _local6;
var _local5;
var _local11;
var _local17;
if ((item >= TOWER1) && (item <= TOWER_LAST)) {
_local17 = (10 + item) - TOWER1;
_local11 = towerprops[item - TOWER1].acc;
} else {
_local17 = (5 + item) - CATAPULT1;
_local11 = catapultprops[item - CATAPULT1].acc;
}
_local7 = 0;
while (_local7 < _local11.length) {
_local6 = _local11[_local7].ox * CELL;
_local5 = _local11[_local7].oy * CELL;
switch (mode) {
case 0 :
_root.iteminhandvalid_mc.attachMovie(_local11[_local7].mn, "accitem" + _local7, _local7, {_x:sx(_local6, _local5) - OX, _y:sy(_local6, _local5, 0) - OY, _alpha:70});
break;
case 1 :
if (((((this.getInstanceAtDepth(depth(ccx, ccy)) != undefined) || (this.getInstanceAtDepth(depth(ccx, ccy + CELL)) != undefined)) || (this.getInstanceAtDepth(depth(ccx + CELL, ccy)) != undefined)) || (this.getInstanceAtDepth(depth(ccx + CELL, ccy + CELL)) != undefined)) || (this.getInstanceAtDepth(depth(ccx + _local6, ccy + _local5)) != undefined)) {
return(false);
}
var _local10 = this.getInstanceAtDepth(depth((ccx + _local6) - CELL, ccy + _local5));
var _local9 = this.getInstanceAtDepth(depth(ccx + _local6, (ccy + _local5) - CELL));
var _local8 = this.getInstanceAtDepth(depth((ccx + _local6) - CELL, (ccy + _local5) - CELL));
if ((((((_local10 != undefined) && (_local10.mtype != undefined)) && (_local10.mtype >= TOWER1)) && (_local10.mtype <= CATAPULT_LAST)) || ((((_local9 != undefined) && (_local9.mtype != undefined)) && (_local9.mtype >= TOWER1)) && (_local9.mtype <= CATAPULT_LAST))) || ((((_local8 != undefined) && (_local8.mtype != undefined)) && (_local8.mtype >= TOWER1)) && (_local8.mtype <= CATAPULT_LAST))) {
return(false);
}
if (!inrect((ccx + _local6) - (CELL / 2), (ccy + _local5) - (CELL / 2), _root.validplaces.cmin.x, _root.validplaces.cmin.y, _root.validplaces.cmax.x, _root.validplaces.cmax.y)) {
return(false);
}
break;
case 2 :
createstaticitem(_root, _local11[_local7].mn, "acc", ccx + _local6, ccy + _local5, 0);
}
_local7++;
}
return(true);
}
function sx(cx, cy) {
return((OX + cx) - cy);
}
function sy(cx, cy, cz) {
return((OY - cz) + ((cx + cy) / 2));
}
function cx(sx, sy) {
return(((sy - OY) - (OX / 2)) + (sx / 2));
}
function cy(sx, sy) {
return(((sy - OY) + (OX / 2)) - (sx / 2));
}
function depth(cx, cy, w) {
if (w == undefined) {
w = CELL;
}
return(((1000 + (((cx + cy) - w) * SW)) + cy) - (w / 2));
}
function v2fr(vx, vy) {
var _local1 = 1 + Math.floor((9 * (Math.atan2(vy, vx) + 0.098174770424681)) / Math.PI);
if (_local1 < 0) {
_local1 = 0;
}
if (_local1 > 9) {
_local1 = 9;
}
return(_local1);
}
function createstaticitem(ancestor, proto, prefix, cx, cy, cz, w, h) {
if (ancestor.getInstanceAtDepth(depth(cx, cy)) != undefined) {
trace("sbang");
ancestor.getInstanceAtDepth(depth(cx, cy)).removeMovieClip();
}
var _local2 = ((("static_" + prefix) + proto) + "_") + (_root.itemid++);
ancestor.attachMovie(proto, _local2, depth(cx, cy));
ancestor[_local2]._x = sx(cx, cy);
ancestor[_local2]._y = sy(cx, cy, cz);
ancestor[_local2].cx = cx;
ancestor[_local2].cy = cy;
ancestor[_local2].cz = cz;
ancestor[_local2].cacheAsBitmap = true;
if (w != undefined) {
ancestor[_local2]._width = w;
ancestor[_local2]._height = h;
}
return(ancestor[_local2]);
}
function depthrepair() {
var _local3;
var _local2;
_local3 = 0;
while (_local3 < _root.lastitem) {
_local2 = _root.itemlist[_local3];
if (_local2 != undefined) {
var _local5 = _local2.getDepth();
var _local4 = Math.floor(depth(_local2.cx, _local2.cy, _local2.w));
if (_local5 != _local4) {
_local2.swapDepths(_local4);
}
}
_local3++;
}
}
function staticdepthrepair() {
var _local2;
for (_local2 in _root) {
if (_local2.substring(0, 6) == "static") {
_root[_local2].swapDepths(depth(_root[_local2].cx, _root[_local2].cy));
}
}
}
function drawbase() {
var _local2;
var _local4;
var _local3 = _root;
for (_local2 in _root) {
if ((_local2.substring(0, 6) == "static") && (_local2.substring(0, 10) != "static_acc")) {
_root[_local2].removeMovieClip();
}
}
switch (base.shield_level) {
case 0 :
_root.currwall = createstaticitem(_local3, "basewall1", "", (LOX + 1) * CELL, 0, 0);
break;
case 1 :
_root.currwall = createstaticitem(_local3, "basewall2", "", (LOX + 1) * CELL, 0, 0);
break;
case 2 :
_root.currwall = createstaticitem(_local3, "basewall3", "", (LOX + 1) * CELL, 0, 0);
break;
case 3 :
_root.currwall = createstaticitem(_local3, "basewall3", "", (LOX + 1) * CELL, 0, 0);
createstaticitem(_local3, "basewall1", "", (LOX - 5) * CELL, 0, 0);
createstaticitem(_local3, "basewall1", "", (LOX + 13) * CELL, 0, 0);
break;
case 4 :
_root.currwall = createstaticitem(_local3, "basewall3", "", (LOX + 1) * CELL, 0, 0);
createstaticitem(_local3, "basewall2", "", (LOX - 5) * CELL, 0, 0);
createstaticitem(_local3, "basewall2", "", (LOX + 13) * CELL, 0, 0);
}
switch (base.repair_level) {
case 1 :
createstaticitem(_local3, "rainbowblast", "", (LOX + 12) * CELL, 1, 120);
break;
case 2 :
createstaticitem(_local3, "rainbowblast", "", (LOX + 12) * CELL, 1, 120, 50, 66);
break;
case 3 :
createstaticitem(_local3, "rainbowblast", "", (LOX + 12) * CELL, 1, 120);
createstaticitem(_local3, "rainbowblast", "", (LOX + 12) * CELL, 2, 140);
break;
case 4 :
createstaticitem(_local3, "rainbowblast", "", (LOX + 12) * CELL, 2, 140);
createstaticitem(_local3, "rainbowblast", "", (LOX + 12) * CELL, 1, 120, 50, 66);
}
switch (base.recycle_level) {
case 0 :
createstaticitem(_local3, "basetower1", "", (LOX + 0) * CELL, 0, 0);
createstaticitem(_local3, "basetower1", "", (LOX + 12) * CELL, 0, 0);
break;
case 1 :
createstaticitem(_local3, "basetower2", "", (LOX + 0) * CELL, 0, 0);
createstaticitem(_local3, "basetower2", "", (LOX + 12) * CELL, 0, 0);
break;
case 2 :
createstaticitem(_local3, "basetower3", "", (LOX + 0) * CELL, 0, 0);
createstaticitem(_local3, "basetower3", "", (LOX + 12) * CELL, 0, 0);
break;
case 3 :
createstaticitem(_local3, "basetower3", "", (LOX + 0) * CELL, 0, 0);
createstaticitem(_local3, "basetower3", "", (LOX + 12) * CELL, 0, 0);
createstaticitem(_local3, "basetower1", "", (LOX + 12) * CELL, -2 * CELL, 0);
createstaticitem(_local3, "basewall1", "", (LOX + 1) * CELL, -2 * CELL, 0);
break;
case 4 :
createstaticitem(_local3, "basetower3", "", (LOX + 0) * CELL, 0, 0);
createstaticitem(_local3, "basetower3", "", (LOX + 12) * CELL, 0, 0);
createstaticitem(_local3, "basetower3", "", (LOX + 12) * CELL, -2 * CELL, 0);
createstaticitem(_local3, "basewall3", "", (LOX + 1) * CELL, -2 * CELL, 0);
}
_local4 = -1;
while (_local4 < (LW + 1)) {
switch (_local4) {
case LW :
case -1 :
_local2 = "cube8";
break;
case LW - 1 :
case 0 :
_local2 = "cube7";
break;
default :
_local2 = "cube7s";
}
createstaticitem(_root, _local2, "", (LOX + _local4) * CELL, currbaseborder(), 0);
_local4++;
}
}
function currbaseborder() {
return(DEF_BASEBORDER + (baseupgrades.size[base.size_level] * CELL));
}
function createitem(type, ancestor, cx, cy, cz, vx, vy, vz, hp, vlen, desty, itemidx, p1, p2, p3) {
var _local5;
var _local3;
var _local8;
if (vy == -1) {
_local5 = "d";
} else if (vy == 1) {
_local5 = "a";
} else if (vx == -1) {
_local5 = "w";
} else if (vx == 1) {
_local5 = "s";
} else {
_local5 = "i";
}
switch (type) {
case undefined :
case 0 :
return(undefined);
case ROBOT1 :
proto = "r1-" + _local5;
break;
case ROBOT2 :
proto = "r2-" + _local5;
break;
case ROBOT3 :
proto = "r3-" + _local5;
break;
case ROBOT4 :
proto = "r4-" + _local5;
break;
case ROBOT5 :
proto = "r5-" + _local5;
break;
case ROBOT6 :
proto = "r6-" + _local5;
break;
case ROBOT7 :
proto = "r7-" + _local5;
break;
case ROBOT8 :
proto = "r8-" + _local5;
break;
case ROBOT9 :
proto = "r9-" + _local5;
break;
case ROBOT10 :
proto = "r10-" + _local5;
break;
case ROBOT11 :
proto = "r11-" + _local5;
break;
case ROBOT12 :
proto = "r12-" + _local5;
break;
case ROBOT13 :
proto = "r13-" + _local5;
break;
case ROBOT14 :
proto = "Main robot 1" + _local5;
break;
case ROBOT15 :
proto = "Main robot 2" + _local5;
break;
case ROBOT16 :
proto = "Main robot 3" + _local5;
break;
case ROBOT17 :
proto = "Main robot 4" + _local5;
break;
case ROBOT18 :
proto = "Main robot 5" + _local5;
break;
case ROBOT_LAST :
proto = "robot";
break;
case BULLET1 :
proto = "r1-b";
break;
case BULLET2 :
proto = "r2-b";
break;
case BULLET3 :
proto = "r3-b";
break;
case BULLET4 :
proto = "r4-b";
break;
case BULLET5 :
proto = "r5-b";
break;
case BULLET6 :
proto = "r6-b";
break;
case BULLET7 :
proto = "r7-b";
break;
case BULLET8 :
proto = "r8-b";
break;
case BULLET9 :
proto = "r9-b";
break;
case BULLET10 :
proto = "r10-b";
break;
case BULLET11 :
proto = "r11-b";
break;
case BULLET12 :
proto = "r12-b";
break;
case BULLET13 :
proto = "r13-b";
break;
case BULLET14 :
proto = "Main robot 1b";
break;
case BULLET15 :
proto = "Main robot 2b";
break;
case BULLET16 :
proto = "Main robot 3b";
break;
case BULLET17 :
proto = "Main robot 4b";
break;
case BULLET18 :
proto = "Main robot 5b";
break;
case CUBE1 :
proto = "cube1";
break;
case CUBE2 :
proto = "cube2";
break;
case CUBE3 :
proto = "cube3";
break;
case CUBE4 :
proto = "cube4";
break;
case CUBE5 :
proto = "cube5";
break;
case CUBE6 :
proto = "cube6";
break;
case CUBE7 :
proto = "cube7";
break;
case CUBE8 :
proto = "cube8";
break;
case CUBE9 :
proto = "cube9";
break;
case CUBE10 :
proto = "cube10";
break;
case CUBE11 :
proto = "cube11";
break;
case CUBE12 :
proto = "cube12";
break;
case TOWER1 :
proto = "tow1a";
break;
case TOWER2 :
proto = "tow2a";
break;
case TOWER3 :
proto = "tow4a";
break;
case TOWER4 :
proto = "tow4b";
break;
case CATAPULT1 :
proto = "cat1";
break;
case CATAPULT2 :
proto = "cat2";
break;
case CATAPULT3 :
proto = "cat3";
break;
case CATAPULT4 :
proto = "cat4";
break;
case CATBULL1 :
proto = "cat1b";
break;
case CATBULL2 :
proto = "cat2b";
break;
case CATBULL3 :
proto = "cat3b";
break;
case CATBULL4 :
proto = "cat4b";
break;
case TOWBULL1 :
proto = "starbullet1";
break;
case TOWBULL1B :
proto = "starbullet2";
break;
case TOWBULL1C :
proto = "starbullet3";
break;
case TOWBULL2 :
case TOWBULL2B :
case TOWBULL2C :
proto = "starbullet4";
break;
case TOWBULL3 :
case TOWBULL3B :
case TOWBULL3C :
proto = "starbullet1";
break;
case TOWBULL4 :
case TOWBULL4B :
case TOWBULL4C :
proto = "starbullet1";
}
if (itemidx != -1) {
_root.itemlist[itemidx].removeMovieClip();
_root.itemlist[itemidx] = undefined;
}
if ((type >= CUBE1) && (type <= CUBE_LAST)) {
_local8 = cubeprops[type - CUBE1].w;
}
if (type <= ROBOT_LAST) {
_local8 = robotprops[type - ROBOT1].w;
}
var _local4 = (proto + "_") + (_root.itemid++);
if (this.getInstanceAtDepth(depth(cx, cy, _local8)) != undefined) {
trace("bang");
return(undefined);
}
if ((type >= CATAPULT1) && (type <= CATAPULT_LAST)) {
if (!mny(-catapultprops[type - CATAPULT1].cost)) {
return(undefined);
}
}
if ((type >= TOWER1) && (type <= TOWER_LAST)) {
if (!mny(-towerprops[type - TOWER1].cost)) {
return(undefined);
}
}
if ((type >= CUBE1) && (type <= CUBE_LAST)) {
if (!mny(-cubeprops[type - CUBE1].cost)) {
return(undefined);
}
}
_root.attachMovie(proto, _local4, depth(cx, cy, _local8));
_root[_local4]._x = sx(cx, cy);
_root[_local4]._y = sy(cx, cy, cz);
_root[_local4].mtype = type;
_root[_local4].ancestor = ancestor;
_root[_local4].cx = cx;
_root[_local4].cy = cy;
_root[_local4].cz = cz;
_root[_local4].cacheAsBitmap = true;
_root[_local4].vx = vx;
_root[_local4].vy = vy;
_root[_local4].vz = vz;
_root[_local4].vlen = vlen;
_root[_local4].smc = 0;
_root[_local4].w = _local8;
_root[_local4].stat = ST_MOVE;
if ((itemidx == -1) && (type <= ROBOT_LAST)) {
_root[_local4].p1 = 0;
_root[_local4].p2 = ((Math.random() < 0.5) ? -1 : 1);
_root[_local4].p3 = MAX_COLL;
} else {
_root[_local4].p1 = p1;
_root[_local4].p2 = p2;
_root[_local4].p3 = p3;
}
_root[_local4].hp = hp;
if (type <= ROBOT_LAST) {
if ((_root.tutorial != -1) && (hp == robotprops[type - ROBOT1].hp)) {
hp = hp / 2;
_root[_local4].hp = hp;
}
_root[_local4].attachMovie("robothp", "robothp", 0);
_root[_local4].robothp._width = Math.min(150, Math.floor(robotprops[type - ROBOT1].hp * 0.1));
if (type >= ROBOT_FIRSTBOSS) {
_root[_local4].robothp._y = -92;
_root[_local4].robothp._height = 3;
} else {
_root[_local4].robothp._y = -52;
}
_root[_local4].robothp._x = 0;
_root[_local4].robothp.gotoAndStop(1 + Math.floor(50 - ((50 * hp) / robotprops[type - ROBOT1].hp)));
if (hp == robotprops[type - ROBOT1].hp) {
_root[_local4].robothp._visible = false;
}
}
_root[_local4].desty = desty;
if ((type >= TOWER1) && (type <= TOWER_LAST)) {
_root[_local4].gotoAndStop(5);
}
if (type < ROBOT_LAST) {
_root[_local4].gotoAndPlay(Math.floor(Math.random() * 10));
}
if ((type >= CATBULL1) && (type <= CATBULL_LAST)) {
_root[_local4]._visible = false;
_root[_local4].p1 = catapultprops[type - CATBULL1].wait;
}
_local3 = 0;
while (_local3 < _root.lastitem) {
if (_root.itemlist[_local3] == undefined) {
break;
}
_local3++;
}
_root.itemlist[((itemidx == -1) ? (_local3) : (itemidx))] = _root[_local4];
_root[_local4].itemidx = ((itemidx == -1) ? (_local3) : (itemidx));
if (_local3 == _root.lastitem) {
_root.lastitem++;
}
if ((type >= CATAPULT1) && (type <= CATAPULT_LAST)) {
_local3 = 0;
while (_local3 < catapult_vars.length) {
_root[_local4][catapult_vars[_local3] + "_level"] = 0;
_local3++;
}
_root[_local4].totalcost = catapultprops[type - CATAPULT1].cost;
_root[_local4].onRollOver = function () {
if (_root.iteminhand == -1) {
this.filters = [_root.glow1];
}
};
_root[_local4].onRollOut = function () {
if (_root.dlgprops.itemobj != this) {
this.filters = undefined;
}
};
_root[_local4].onPress = function () {
if (checktutvalid()) {
return(undefined);
}
propsdialog("upgrade catapult >", type, this, _root.catapultupgrades[type - CATAPULT1], catapult_vars, catapult_varlabels);
};
}
if ((type >= TOWER1) && (type <= TOWER_LAST)) {
_local3 = 0;
while (_local3 < tower_vars.length) {
_root[_local4][tower_vars[_local3] + "_level"] = 0;
_local3++;
}
_root[_local4].totalcost = towerprops[type - TOWER1].cost;
_root[_local4].priority = 1;
_root[_local4].onRollOver = function () {
if (_root.iteminhand == -1) {
this.filters = [_root.glow1];
}
};
_root[_local4].onRollOut = function () {
if (_root.dlgprops.itemobj != this) {
this.filters = undefined;
}
};
_root[_local4].onPress = function () {
if (checktutvalid()) {
return(undefined);
}
propsdialog("upgrade tower >", type, this, _root.towerupgrades[type - TOWER1], tower_vars, tower_varlabels);
};
}
return(_local4);
}
function incitem(i) {
var _local2;
_local2 = _root.itemlist[i];
if (_local2 == undefined) {
return(undefined);
}
if (_local2.mtype >= BULLET1) {
if (_local2.mtype >= CATBULL1) {
_local2.p1--;
if (_local2.p1 <= 0) {
_local2.vz = _local2.vz - GRAVITY;
_local2.shade._y = _local2.cz + (_local2.cz / 2);
_local2.shade._x = _local2.cz / 2;
_local2._visible = true;
} else {
return(undefined);
}
}
_local2.cx = _local2.cx + _local2.vx;
_local2.cy = _local2.cy + _local2.vy;
if (_local2.cy > MAX_Y) {
_local2.removeMovieClip();
_root.itemlist[i] = undefined;
return(undefined);
}
if ((_local2.cx > MAX_X) && (_local2.vx > 0)) {
_local2.vx = -_local2.vx;
}
if ((_local2.cx < MIN_X) && (_local2.vx < 0)) {
_local2.vx = -_local2.vx;
}
_local2.cz = _local2.cz + _local2.vz;
_local2._x = sx(_local2.cx, _local2.cy);
_local2._y = sy(_local2.cx, _local2.cy, _local2.cz);
_local2.swapDepths(_root.depth(_local2.cx, _local2.cy));
return(undefined);
}
if (_local2.stat != ST_MOVE) {
return(undefined);
}
_local2.smc++;
if (_local2.smc < _local2.vlen) {
return(undefined);
}
_local2.smc = 0;
if ((_local2.mtype >= ROBOT1) && (_local2.mtype <= ROBOT_LAST)) {
if (_local2.vy > 0) {
_local2._x = _local2._x - 2;
_local2._y++;
_local2.cy = _local2.cy + 2;
_local2.swapDepths(_root.depth(_local2.cx, _local2.cy, _local2.w));
}
if (_local2.vy < 0) {
_local2._x = _local2._x + 2;
_local2._y--;
_local2.cy = _local2.cy - 2;
_local2.swapDepths(_root.depth(_local2.cx, _local2.cy, _local2.w));
}
if (_local2.vx > 0) {
_local2._x = _local2._x + 2;
_local2._y++;
_local2.cx = _local2.cx + 2;
_local2.swapDepths(_root.depth(_local2.cx, _local2.cy, _local2.w));
}
if (_local2.vx < 0) {
_local2._x = _local2._x - 2;
_local2._y--;
_local2.cx = _local2.cx - 2;
_local2.swapDepths(_root.depth(_local2.cx, _local2.cy, _local2.w));
}
return(undefined);
}
}
function sgn(i) {
if (i < 0) {
return(-1);
}
if (i > 0) {
return(1);
}
return(0);
}
function itemdir(m, idx) {
createitem(m.mtype, m.ancestor, m.cx, m.cy, m.cz, m.vx, m.vy, m.vz, m.hp, m.vlen, m.desty, idx, m.p1, m.p2, m.p3);
}
function findtarget(maxy, priority) {
var _local3;
var _local2;
var _local7 = 100000 /* 0x0186A0 */;
var _local5 = -1;
var _local6 = 0;
var _local8 = 100000 /* 0x0186A0 */;
switch (priority) {
case 1 :
_local3 = 0;
while (_local3 < _root.lastitem) {
_local2 = _root.itemlist[_local3];
if ((_local2 == undefined) || (_local2.mtype > ROBOT_LAST)) {
} else if ((_local2.cy <= maxy) && (_local2.cy < _local7)) {
_local7 = _local2.cy;
_local5 = _local3;
}
_local3++;
}
break;
case 2 :
_local3 = 0;
while (_local3 < _root.lastitem) {
_local2 = _root.itemlist[_local3];
if ((_local2 == undefined) || (_local2.mtype > ROBOT_LAST)) {
} else if ((_local2.cy <= maxy) && (_local2.hp > _local6)) {
_local6 = _local2.hp;
_local5 = _local3;
}
_local3++;
}
break;
case 3 :
_local3 = 0;
while (_local3 < _root.lastitem) {
_local2 = _root.itemlist[_local3];
if ((_local2 == undefined) || (_local2.mtype > ROBOT_LAST)) {
} else if ((_local2.cy <= maxy) && (_local2.hp < _local8)) {
_local8 = _local2.hp;
_local5 = _local3;
}
_local3++;
}
break;
case 4 :
_local3 = Math.floor(_root.lastitem * Math.random());
for(;;){
if (_local3 >= _root.lastitem) {
break;
}
_local2 = _root.itemlist[_local3];
if ((_local2 == undefined) || (_local2.mtype > ROBOT_LAST)) {
} else if (_local2.cy <= maxy) {
return(_local3);
}
_local3++;
};
}
return(_local5);
}
function findplace(cx, cy) {
var _local3;
var _local2;
_local3 = 0;
while (_local3 < _root.lastitem) {
_local2 = _root.itemlist[_local3];
if ((_local2 != undefined) && (_local2.mtype <= COLL_LIMIT)) {
if (((((cx - _local2.cx) < CELL) && ((cx - _local2.cx) > (-CELL))) && ((cy - _local2.cy) < CELL)) && ((cy - _local2.cy) > (-CELL))) {
return(_local3);
}
}
_local3++;
}
return(-1);
}
function findcube(cx, cy) {
var _local3;
var _local2;
var _local8 = -1;
var _local7 = 100000 /* 0x0186A0 */;
var _local6;
_local3 = 0;
while (_local3 < _root.lastitem) {
_local2 = _root.itemlist[_local3];
if (((_local2 != undefined) && (_local2.mtype >= CUBE1)) && (_local2.mtype <= CUBE_LAST)) {
if (((((cx - _local2.cx) < (CELL + 2)) && ((cx - _local2.cx) > ((-CELL) - 2))) && ((cy - _local2.cy) < (CELL + 2))) && ((cy - _local2.cy) > ((-CELL) - 2))) {
_local6 = ((cx - _local2.cx) * (cx - _local2.cx)) + ((cy - _local2.cy) * (cy - _local2.cy));
if (_local6 < _local7) {
_local8 = _local3;
_local7 = _local6;
}
}
}
_local3++;
}
return(_local8);
}
function findrobot(cx, cy, w) {
var _local3;
var _local2;
_local3 = 0;
while (_local3 < _root.lastitem) {
_local2 = _root.itemlist[_local3];
if (((_local2 != undefined) && (_local2.mtype >= ROBOT1)) && (_local2.mtype <= ROBOT_LAST)) {
if (((((cx - _local2.cx) < w) && ((cx - _local2.cx) > (-_local2.w))) && ((cy - _local2.cy) < w)) && ((cy - _local2.cy) > (-_local2.w))) {
return(_local3);
}
}
_local3++;
}
return(-1);
}
function radialdmg(cx, cy, r, dmg) {
var _local3;
var _local2;
_local3 = 0;
while (_local3 < _root.lastitem) {
_local2 = _root.itemlist[_local3];
if (((_local2 != undefined) && (_local2.mtype <= ROBOT_LAST)) && (((((_local2.cx - (_local2.w / 2)) - cx) * ((_local2.cx - (_local2.w / 2)) - cx)) + (((_local2.cy - (_local2.w / 2)) - cy) * ((_local2.cy - (_local2.w / 2)) - cy))) < (r * r))) {
robotdmg(_local2, _local3, dmg);
}
_local3++;
}
}
function robotdmg(rm, ridx, dmg) {
var _local4;
var _local3;
if ((((rm.hp == undefined) || (rm.mtype == undefined)) || (isNaN(rm.mtype))) || (isNaN(rm.hp))) {
trace(((("bad robot idx: " + ridx) + " ") + rm) + "!!");
if (rm == undefined) {
trace("v1");
}
if (rm == "") {
trace("v2");
}
if (isNaN(rm)) {
trace("v3");
}
_root.itemlist[ridx] = undefined;
return(undefined);
}
rm.hp = rm.hp - dmg;
rm.robothp._visible = true;
rm.robothp.gotoAndStop(1 + Math.floor(50 - ((50 * rm.hp) / robotprops[rm.mtype - ROBOT1].hp)));
if (rm.hp <= 0) {
_local4 = 0;
while (_local4 < _root.lastitem) {
_local3 = _root.itemlist[_local4];
if (((((_root.itemlist[_local4] != undefined) && (ridx != _local4)) && (_local3.mtype >= TOWBULL1)) && (_local3.mtype <= TOWBULL_LAST)) && (_local3.p2 == ridx)) {
_local3.p1 = _local3.p1 + MAX_Y;
_local3.p2 = -2;
}
if ((((_root.itemlist[_local4] != undefined) && (_local3.mtype >= TOWER1)) && (_local3.mtype <= TOWER_LAST)) && (_local3.p2 == ridx)) {
_local3.p2 = -1;
}
_local4++;
}
mny(_root.robotprops[rm.mtype - ROBOT1].rvalue * baseupgrades.recycle[base.recycle_level]);
_root.totalearned = _root.totalearned + _root.robotprops[rm.mtype - ROBOT1].rvalue;
addach(0);
if (rm.mtype >= ROBOT_FIRSTBOSS) {
_root.attachMovie("blast4", "blast4", this.getNextHighestDepth(), {_x:rm._x, _y:rm._y - 50});
} else {
switch (_root.currframe % 3) {
case 0 :
_root.attachMovie("blast2", "blast2", this.getNextHighestDepth(), {_x:rm._x, _y:rm._y - 30});
break;
case 1 :
_root.attachMovie("blast3", "blast2", this.getNextHighestDepth(), {_x:rm._x, _y:rm._y - 30});
break;
case 2 :
_root.attachMovie("fireboom", "fireboom", this.getNextHighestDepth(), {_x:rm._x, _y:rm._y - 30});
}
}
startsfx(11);
_root.bg.attachMovie("blastmark" + (1 + Math.floor(Math.random() * 9)), "blastmark" + _root.bg.getNextHighestDepth(), _root.bg.getNextHighestDepth(), {_x:rm._x, _y:rm._y - 10, _alpha:50});
_root.bg.cacheAsBitmap = true;
rm.removeMovieClip();
_root.itemlist[ridx] = undefined;
}
}
function resumemove(li, index) {
li.flameanim.removeMovieClip();
li.stat = ST_MOVE;
li.p1 = 0;
li.p2 = ((Math.random() < 0.5) ? -1 : 1);
li.p3 = MAX_COLL;
li.vx = 0;
li.vy = -1;
itemdir(li, index);
}
function rblast(proto, offx, offy, cx, cy, r) {
var _local3;
_local3 = RD_RADIUSANIM;
while (_local3 <= RD_RADIUSANIM_LAST) {
if (this.getInstanceAtDepth(_local3) == undefined) {
_root.attachMovie("radiusanim", "radiusanim", _local3, {_x:cx, _y:cy, _width:2 * r, _height:r});
_root.attachMovie(proto, proto, _root.getNextHighestDepth(), {_x:cx + offx, _y:cy + offy});
startsfx(7);
return(undefined);
}
_local3++;
}
}
function handleitems() {
var _local5;
var _local6;
var _local3;
var _local4;
var _local10;
var _local11;
var _local7;
var _local9;
var _local19;
var _local18;
var _local24;
var _local12;
var _local22;
var _local20;
var _local25;
var _local23;
var _local15;
var _local14;
var _local21;
_local5 = 0;
for ( ; _local5 < _root.lastitem ; _local5++) {
_local3 = _root.itemlist[_local5];
if (_local3 == "") {
_root.itemlist[_local5] = undefined;
_local3 = undefined;
}
if (_local3 == undefined) {
} else if (_local3.mtype >= BULLET1) {
if (_local3.mtype >= CATBULL1) {
if ((_local3.cz <= 0) && (_local3.vz < 0)) {
var _local13 = catapultupgrades[_local3.mtype - CATBULL1];
switch (_local3.mtype) {
case CATBULL1 :
rblast("blast2", 0, 0, _local3._x, _local3._y, _local13.dmgr[_local3.ancestor.dmgr_level]);
radialdmg(_local3.cx, _local3.cy, _local13.dmgr[_local3.ancestor.dmgr_level], _local13.dmg[_local3.ancestor.dmg_level]);
_local3.removeMovieClip();
_root.itemlist[_local5] = undefined;
break;
case CATBULL2 :
rblast("electricblast2", 0, 0, _local3._x, _local3._y, _local13.dmgr[_local3.ancestor.dmgr_level]);
radialdmg(_local3.cx, _local3.cy, _local13.dmgr[_local3.ancestor.dmgr_level], _local13.dmg[_local3.ancestor.dmg_level]);
_local3.removeMovieClip();
_root.itemlist[_local5] = undefined;
break;
case CATBULL3 :
_local3.vz = -_local3.vz;
rblast("yellowsparks", 0, 10, _local3._x, _local3._y, _local13.dmgr[_local3.ancestor.dmgr_level]);
radialdmg(_local3.cx, _local3.cy, ((_local3.ancestor == undefined) ? (cubeprops[CUBE9 - CUBE1].dmgr) : (_local13.dmgr[_local3.ancestor.dmgr_level])), ((_local3.ancestor == undefined) ? (cubeprops[CUBE9 - CUBE1].dmg) : (_local13.dmg[_local3.ancestor.dmg_level])));
break;
case CATBULL4 :
_local3.vz = -_local3.vz;
rblast("purplesparks", 0, 0, _local3._x, _local3._y, _local13.dmgr[_local3.ancestor.dmgr_level]);
radialdmg(_local3.cx, _local3.cy, _local13.dmgr[_local3.ancestor.dmgr_level], _local13.dmg[_local3.ancestor.dmg_level]);
}
}
continue;
}
_local3.p1--;
if (_local3.p1 <= 0) {
if ((_local3._x != undefined) && (!isNaN(_local3._x))) {
if (_local3.mtype < TOWBULL1) {
_local7 = _root.robotprops[_local3.mtype - BULLET1];
_root.attachMovie("blast1", "blast1", this.getNextHighestDepth(), {_x:_local3._x + _local7.xoff, _y:_local3._y + _local7.yoff, _width:_local7.bsize, _height:_local7.bsize});
_root.currwall.attachMovie("blastmark" + (1 + Math.floor(Math.random() * 9)), "blastmark" + _root.currwall.getNextHighestDepth(), _root.currwall.getNextHighestDepth(), {_x:(_local3._x + _local7.xoff) - _root.currwall._x, _y:(_local3._y + _local7.yoff) - _root.currwall._y, _alpha:20, _width:30, _height:30});
_root.currwall.cacheAsBitmap = true;
} else {
_local7 = _root.towerprops[_local3.mtype - TOWBULL1];
_root.attachMovie("blast1short", "blast1short", this.getNextHighestDepth(), {_x:_local3._x, _y:_local3._y, _width:_local7.bsize, _height:_local7.bsize});
}
if (_local3.p2 != -1) {
_local9 = _root.itemlist[_local3.p2];
if ((_local9 != undefined) && (_local3.p2 != undefined)) {
robotdmg(_local9, _local3.p2, towerupgrades[_local3.mtype - TOWBULL1].dmg[_local3.ancestor.dmg_level]);
}
} else {
var _local26 = robotprops[_local3.mtype - BULLET1].dmg * baseupgrades.shield[base.shield_level];
totalbasedmg = totalbasedmg + _local26;
basehp = basehp - _local26;
if (((_root.tutorial == -1) && (basehp < 0)) && (_root.dlgbig == undefined)) {
basehp = 0;
_root.simpause = true;
_root.attachMovie("dlgbig", "dlgbig", _root.getNextHighestDepth(), {_x:350, _y:200});
_root.dlgbig.title = "game over";
_root.dlgbig.line1 = "total damage on base: " + Math.floor(_root.totalbasedmg);
_root.dlgbig.line2 = "total money spent: " + (-_root.totalspent);
_root.dlgbig.line3 = "better luck next time!";
_root.dlgbig.line4 = "";
_root.savestate();
trace("money: " + _root.money);
_root.dlgbig.retry.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
initlevel(_root.currlevel);
};
_root.dlgbig.next.onPress = function () {
cls();
_root.gotoAndPlay("levels");
};
_root.dlgbig.menu.onPress = function () {
cls();
_root.gotoAndPlay("mainmenu");
};
}
basehp_txt = (Math.floor(basehp) + "/") + baseupgrades.nrgpool[base.nrgpool_level];
}
}
_local3.removeMovieClip();
_root.itemlist[_local5] = undefined;
} else if ((_local3.p2 != -1) && (_local3.p2 != -2)) {
_local9 = _root.itemlist[_local3.p2];
_local3.vx = (_local9.cx - _local3.cx) / _local3.p1;
_local3.vy = (_local9.cy - _local3.cy) / _local3.p1;
}
} else if ((_local3.mtype >= CATAPULT1) && (_root.robotcount > 0)) {
_local3.p1--;
if (_local3.p1 <= 0) {
var _local13 = catapultprops[_local3.mtype - CATAPULT1];
var _local16 = catapultupgrades[_local3.mtype - CATAPULT1];
_local15 = _local3.cx + _local13.startxoff;
_local14 = _local3.cy + _local13.startyoff;
_local21 = _local13.startzoff;
_local19 = (_local16.xspread[_local3.xspread_level] * Math.random()) - (_local16.xspread[_local3.xspread_level] / 2);
_local18 = _local16.startv[_local3.startv_level] + (Math.random() * _local13.maxv);
_local24 = _local16.startv[_local3.startv_level] + (Math.random() * _local13.maxv);
_root.createitem(CATBULL1 + (_local3.mtype - CATAPULT1), _local3, _local15, _local14, _local21, _local19, _local18, _local24, 0, 0, 0, -1);
_local3.gotoAndPlay(2);
_local3.p1 = catapultupgrades[_local3.mtype - CATAPULT1].freq[_local3.freq_level];
}
} else if (_local3.mtype >= TOWER1) {
_local3.p1--;
if (_local3.p1 <= 0) {
if (_local3.p2 == -1) {
_local3.p2 = findtarget(_local3.cy + (towerupgrades[_local3.mtype - TOWER1].range[_local3.range_level] * CELL), _local3.priority);
}
if (_local3.p2 != -1) {
_local9 = _root.itemlist[_local3.p2];
_local22 = _local9.cx;
_local20 = _local9.cy;
_local25 = 24 + (Math.random() * 10);
_local12 = Math.sqrt((((_local22 - _local3.cx) * (_local22 - _local3.cx)) + ((_local20 - _local3.cy) * (_local20 - _local3.cy))) + ((_local25 - _local3.cz) * (_local25 - _local3.cz)));
_local15 = _local3.cx + ((towerprops[_local3.mtype - TOWER1].r * (_local22 - _local3.cx)) / _local12);
_local14 = _local3.cy + ((towerprops[_local3.mtype - TOWER1].r * (_local20 - _local3.cy)) / _local12);
_local21 = towerprops[_local3.mtype - TOWER1].h;
_local23 = towerprops[_local3.mtype - TOWER1].bspeed;
_local19 = (_local23 * (_local22 - _local15)) / _local12;
_local18 = (_local23 * (_local20 - _local14)) / _local12;
_local24 = (_local23 * (_local25 - _local21)) / _local12;
_root.createitem(TOWBULL1 + (_local3.mtype - TOWER1), _local3, _local15, _local14, _local21, _local19, _local18, _local24, 0, 0, 0, -1, Math.ceil(_local12 / _local23), _local3.p2);
_local3.gotoAndStop(v2fr(_local19, _local18));
startsfx(10);
_local3.p1 = towerupgrades[_local3.mtype - TOWER1].freq[_local3.freq_level];
}
}
} else if (_local3.stat == ST_FIRE) {
_local3.p1--;
if (_local3.p1 <= 0) {
startsfx(5);
_root.createitem(BULLET1 + (_local3.mtype - ROBOT1), _local3, _local3.cx, _local3.cy - 1, 0, (2 * Math.random()) - 1, -_root.robotprops[_local3.mtype - ROBOT1].bspeed, 0, 0, 0, 0, -1, Math.floor(_local3.cy / _root.robotprops[_local3.mtype - ROBOT1].bspeed) + 0, -1);
_local3.p1 = _root.robotprops[_local3.mtype - ROBOT1].freq;
}
} else if (_local3.stat == ST_DOZER) {
if (_local3.p1 != -1) {
var _local8 = _root.itemlist[_local3.p1];
if (((_local8 != undefined) && (_local8.mtype >= CUBE1)) && (_local8.mtype <= CUBE_LAST)) {
_local8.hp--;
if (_local8.hp <= 0) {
_root.attachMovie("blast2", "blast2", this.getNextHighestDepth(), {_x:_local8._x, _y:_local8._y - 10});
_local8.removeMovieClip();
_root.itemlist[_local3.p1] = undefined;
resumemove(_local3, _local5);
}
} else {
resumemove(_local3, _local5);
}
} else if (_local3.stat != ST_WAIT) {
_local3.stat = ST_WAIT;
_local3.p1 = WAITFRAMES;
}
} else if (_local3.stat == ST_WAIT) {
_local3.p1--;
if (_local3.p1 <= 0) {
resumemove(_local3, _local5);
}
} else {
if ((_local3.vx != 0) && (_local3.vy == 0)) {
_local3.p1--;
if (_local3.p1 == 0) {
_local3.vx = 0;
_local3.vy = -1;
itemdir(_local3, _local5);
_local3 = _root.itemlist[_local5];
}
}
if ((_local3.cy <= _local3.desty) && ((_local3.vx != 0) || (_local3.vy != 0))) {
_local3.vx = 0;
_local3.vy = 0;
itemdir(_local3, _local5);
_local3 = _root.itemlist[_local5];
_local3.stat = ST_FIRE;
_local3.p1 = Math.floor(Math.random() * _root.robotprops[_local3.mtype - ROBOT1].freq);
} else if (((_local3.cx <= MIN_X) && (_local3.vx < 0)) || ((_local3.cx >= (((LOX + LW) - 1) * CELL)) && (_local3.vx > 0))) {
_local3.vx = -_local3.vx;
_local3.vy = 0;
itemdir(_local3, _local5);
_local3 = _root.itemlist[_local5];
_local3.p2 = _local3.vx;
if (_local3.cx <= MIN_X) {
_local3.cx = MIN_X;
} else {
_local3.cx = ((LOX + LW) - 1) * CELL;
}
_local3._x = _local15(_local3.cx, _local3.cy);
_local3._y = _local14(_local3.cx, _local3.cy, _local3.cz);
}
}
}
_local5 = 0;
while (_local5 < _root.lastitem) {
_local3 = _root.itemlist[_local5];
if (((_local3 == undefined) || (_local3.mtype >= COLL_LIMIT)) || (_local3.stat != ST_MOVE)) {
} else {
_local10 = _local3.cx + (_local3.vx * 2);
_local11 = _local3.cy + (_local3.vy * 2);
if ((_local3.vx != 0) || (_local3.vy != 0)) {
_local6 = 0;
while (_local6 < _root.lastitem) {
if (_local5 != _local6) {
_local4 = _root.itemlist[_local6];
if ((_local4 == undefined) || (_local4.mtype >= COLL_LIMIT)) {
} else if (((((_local10 - _local4.cx) < _local3.w) && ((_local10 - _local4.cx) > (-_local4.w))) && ((_local11 - _local4.cy) < _local3.w)) && ((_local11 - _local4.cy) > (-_local4.w))) {
var _local17 = _root["timeline" + _root.currlevel];
if (((((_local4.mtype == CUBE3) || (_local4.mtype == CUBE4)) || (_local4.mtype == CUBE9)) || (_local4.mtype == CUBE10)) || ((_local17[_root.timeline_currwave].delbarr && (_local4.mtype <= CUBE_LAST)) && (_local4.mtype >= CUBE1))) {
rblast("blast2", 0, 0, _local4._x, _local4._y, cubeprops[_local4.mtype - CUBE1].dmgr);
radialdmg(_local4.cx, _local4.cy, cubeprops[_local4.mtype - CUBE1].dmgr, cubeprops[_local4.mtype - CUBE1].dmg);
if ((_local4.mtype == CUBE9) || (_local4.mtype == CUBE10)) {
_root.createitem(CATBULL3, undefined, _local4.cx, _local4.cy - 1, 30, 0, 1, 2, 0, 0, 0, -1);
}
_local4.removeMovieClip();
_root.itemlist[_local6] = undefined;
} else {
if (((_local3.vx != 0) && (_local3.vy == 0)) && (sgn(_local4.cx - _local3.cx) == sgn(_local3.vx))) {
_local3.vx = -_local3.vx;
_local3.vy = 0;
itemdir(_local3, _local5);
_local3 = _root.itemlist[_local5];
_local3.p1 = CELL / 2;
_local3.p2 = _local3.vx;
_local3.p3--;
if (_local3.p3 <= 0) {
_local3.vx = 0;
_local3.vy = 0;
itemdir(_local3, _local5);
_local3 = _root.itemlist[_local5];
_local3.stat = ST_DOZER;
_local3.p1 = findcube(_local3.cx, _local3.cy);
if (_local3.p1 != -1) {
_local3.attachMovie("sunblast", "flameanim", this.getNextHighestDepth(), {_x:0, _y:-30});
}
}
_local10 = _local3.cx + (_local3.vx * 2);
_local11 = _local3.cy + (_local3.vy * 2);
}
if ((_local3.vx == 0) && (_local3.vy < 0)) {
_local3.vx = _local3.p2;
_local3.vy = 0;
itemdir(_local3, _local5);
_local3 = _root.itemlist[_local5];
_local3.p1 = CELL / 2;
_local10 = _local3.cx + (_local3.vx * 2);
_local11 = _local3.cy + (_local3.vy * 2);
}
}
}
}
_local6++;
}
}
}
_local5++;
}
}
function delbarr() {
var _local4;
var _local3;
_local4 = 0;
while (_local4 < _root.lastitem) {
_local3 = _root.itemlist[_local4];
if (_local3 == undefined) {
} else if ((_local3.mtype >= CUBE1) && (_local3.mtype <= CUBE_LAST)) {
_root.attachMovie("blast2", "blast2", this.getNextHighestDepth(), {_x:_local3._x, _y:_local3._y - 10});
_local3.removeMovieClip();
_root.itemlist[_local4] = undefined;
}
_local4++;
}
}
function updatelocks() {
var _local3 = _root["timeline" + _root.currlevel];
var _local2;
if (_root.timeline_currwave == -1) {
_local2 = 0;
} else {
_local2 = _root.timeline_currwave;
}
if (((_local3[_local2].lock[0] && (_local3[_local2].lock[1])) && (_local3[_local2].lock[2])) && (_local3[_local2].lock[3])) {
turret_txt = "locked";
buyturret.enabled = false;
} else {
turret_txt = "";
buyturret.enabled = true;
}
if (((_local3[_local2].lock[4] && (_local3[_local2].lock[5])) && (_local3[_local2].lock[6])) && (_local3[_local2].lock[7])) {
buycatapult.enabled = false;
catapult_txt = "locked";
} else {
buycatapult.enabled = true;
catapult_txt = "";
}
if (_local3[_local2].lock[8]) {
buybarricade.enabled = false;
barricade_txt = "locked";
} else {
buybarricade.enabled = true;
barricade_txt = "";
}
if (_local3[_local2].lock[9]) {
buybaseupgrade.enabled = false;
base_txt = "locked";
} else {
buybaseupgrade.enabled = true;
base_txt = "";
}
}
function itemwaves() {
var _local12;
var _local9 = _root["timeline" + _root.currlevel];
var _local5;
var _local2;
var _local4;
var _local3;
if ((_root.timeline_sendwave || (_root.timeline_currwave == -1)) || (_root.currframe > (_root.timeline_laststart + _local9[_root.timeline_currwave].frames))) {
if (_local9[_root.timeline_currwave + 1].manualstart && (_root.timeline_sendwave == false)) {
updatelocks();
if ((_root.robotcount == 0) && (_root.timeline_currwave == _root.timeline_wavefinished)) {
if (_root.btn_send._visible == false) {
startsfx(9);
}
_root.btn_send._visible = true;
if ((_root.dialoghint == undefined) && (_local9[_root.timeline_currwave + 1].hint != undefined)) {
_root.attachMovie("dialogtut", "dialoghint", RD_DIALOGTUT2, {_x:100, _y:10});
_root.dialoghint.text = _local9[_root.timeline_currwave + 1].hint;
}
return(undefined);
}
} else {
trace("totalearned:" + _root.totalearned);
_root.timeline_currwave++;
updatelocks();
staticdepthrepair();
if (_root.timeline_currwave < _local9.length) {
_root.timeline_sendwave = false;
wave_txt = (("wave " + (_root.timeline_currwave + 1)) + "/") + _local9.length;
_root.timeline_laststart = _root.currframe;
_root.timeline_wavename = _local9[_root.timeline_currwave].wave;
_root.waveline = 0;
_root.wavespeed = _local9[_root.timeline_currwave].speed;
_root.wavemindist = _local9[_root.timeline_currwave].mindist;
trace("wave: " + _root.timeline_wavename);
_local3 = _root[_root.timeline_wavename];
_local5 = 0;
_root.tmpwave = Array();
_local2 = 0;
while (_local2 < _local3.length) {
_local4 = 0;
while (_local4 < _local3[_local2]) {
_root.tmpwave[_local5++] = _local2;
_local4++;
}
_local2++;
}
_local2 = 0;
while (_local2 < 500) {
var _local8;
var _local7;
var _local6;
_local7 = Math.floor(Math.random() * _local5);
_local6 = Math.floor(Math.random() * _local5);
_local8 = _root.tmpwave[_local7];
_root.tmpwave[_local7] = _root.tmpwave[_local6];
_root.tmpwave[_local6] = _local8;
_local2++;
}
}
}
}
if (((_root.robotcount == 0) && (_root.timeline_currwave >= _local9.length)) && (_root.dlgbig == undefined)) {
_root.attachMovie("dlgbig", "dlgbig", _root.getNextHighestDepth(), {_x:350, _y:200});
if (_root.currlevel == (MAX_LEVELS - 1)) {
_root.dlgbig.title = "game completed";
_root.dlgbig.next._visible = false;
} else {
_root.dlgbig.title = "congrats!";
}
_root.dlgbig.line1 = "total damage on base: " + Math.floor(_root.totalbasedmg);
_root.dlgbig.line2 = "total money spent: " + (-_root.totalspent);
var _local11 = Math.floor(100000 / (_root.totalbasedmg - (_root.totalspent / 10)));
trace("endoflevel totalearned:" + _root.totalearned);
_root.dlgbig.line3 = ("overall result: " + _local11) + " points";
if (_root.levelscores[_root.currlevel][_root.difficulty] < _local11) {
_root.levelscores[_root.currlevel][_root.difficulty] = _local11;
_root.dlgbig.line4 = "best score! submit it from main menu.";
_root.cansubmit = true;
} else {
_root.dlgbig.line4 = "";
}
var _local10 = 0;
_local2 = 0;
while (_local2 < MAX_LEVELS) {
if (_root.levelscores[_local2][_root.difficulty] >= 100) {
_local10++;
}
_local2++;
}
if (_local11 > 100) {
addach(25);
}
if (_local10 >= 5) {
addach(26);
}
if (_local10 >= 10) {
addach(27);
}
if (_local10 == MAX_LEVELS) {
addach(28);
}
if ((_root.currlevel + 1) == MAX_LEVELS) {
addach(29);
}
if ((_root.currlevel + 1) < MAX_LEVELS) {
_root.levelacc[_root.currlevel + 1][_root.difficulty] = 1;
}
_root.savestate();
_root.dlgbig.retry.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
initlevel(_root.currlevel);
};
_root.dlgbig.next.onPress = function () {
cls();
_root.gotoAndPlay("levels");
};
_root.dlgbig.menu.onPress = function () {
cls();
_root.gotoAndPlay("mainmenu");
};
}
if ((_root.currframe % 25) == 0) {
depthrepair();
if (_local9[_root.timeline_currwave + 1].manualstart == false) {
wavecd_txt = "next: " + Math.floor((_local9[_root.timeline_currwave].frames - (_root.currframe - _root.timeline_laststart)) / 25);
} else {
wavecd_txt = "";
}
}
_local3 = _root[_root.timeline_wavename];
if (_root.timeline_wavename.charAt(0) == "f") {
if ((_root.currframe % _root.wavespeed) == 0) {
_local2 = 0;
while (_local2 < 12) {
_root.createitem(_local3[_root.waveline][_local2], 0, (CELL * LOX) + (_local2 * CELL), 36 * CELL, 0, 0, -1, 0, _root.robotprops[_local3[_root.waveline][_local2] - ROBOT1].hp, _root.robotprops[_local3[_root.waveline][_local2] - ROBOT1].speed, (_root.wavemindist + currbaseborder()) + (_root.waveline * CELL), -1);
_local2++;
}
_root.waveline++;
if (_root.waveline >= _local3.length) {
_root.timeline_wavefinished = _root.timeline_currwave;
}
}
} else if ((_root.currframe % _root.wavespeed) == 0) {
if (_root.waveline < _root.tmpwave.length) {
var _local14 = (CELL * LOX) + Math.floor((Math.random() * (LW - 1)) * CELL);
var _local13 = 36 * CELL;
if (findplace(_local14, _local13) == -1) {
_local12 = ROBOT1 + tmpwave[_root.waveline];
_root.createitem(_local12, 0, _local14, _local13, 0, 0, -1, 0, _root.robotprops[_local12 - ROBOT1].hp, _root.robotprops[_local12 - ROBOT1].speed, (_root.wavemindist + currbaseborder()) + (Math.floor(_root.waveline / 6) * CELL), -1);
_root.waveline++;
if (_root.waveline == _root.tmpwave.length) {
_root.timeline_wavefinished = _root.timeline_currwave;
}
}
}
}
}
function inclevel() {
var _local2;
_root.robotcount = 0;
_local2 = 0;
while (_local2 < _root.lastitem) {
_root.incitem(_local2);
if ((_root.itemlist[_local2] != undefined) && (_root.itemlist[_local2].mtype <= ROBOT_LAST)) {
_root.robotcount++;
}
_local2++;
}
var _local10 = new Date();
var _local8 = 25;
var _local7 = _root.currframe % _local8;
var _local9;
timearr[_local7] = _local10.getTime();
if (_local7 == (_local8 - 1)) {
_local9 = timearr[0];
} else {
_local9 = timearr[_local7 + 1];
}
_root.handleitems();
_root.itemwaves();
if (((_root.currframe % 25) == 0) && (!_root.btn_send._visible)) {
var _local4 = baseupgrades.nrgpool[base.nrgpool_level];
if (basehp < _local4) {
basehp = basehp + baseupgrades.repair[base.repair_level];
if (basehp > _local4) {
basehp = _local4;
}
basehp_txt = (Math.floor(basehp) + "/") + _local4;
}
}
_root.currframe++;
if (iteminhand != -1) {
var _local5;
var _local6;
_root.iteminhand_mc._x = _root._xmouse;
_root.iteminhand_mc._y = _root._ymouse;
_local5 = CELL * Math.floor(cx(_root._xmouse, _root._ymouse + 45) / CELL);
_local6 = CELL * Math.floor(cy(_root._xmouse, _root._ymouse + 45) / CELL);
if (((_local5 >= (LOX * CELL)) && (_local5 <= (((LOX + LW) - 1) * CELL))) && (_local6 > 0)) {
_root.iteminhandvalid_mc._visible = true;
} else {
_root.iteminhandvalid_mc._visible = false;
}
_root.iteminhandvalid_mc._x = sx(_local5, _local6);
_root.iteminhandvalid_mc._y = sy(_local5, _local6, 0);
}
if ((_root.tutorial != -1) && (_root.dialogtut == undefined)) {
var _local3 = _root["tutorial" + _root.tutorial][_root.tutorialprogress];
_root.attachMovie("dialogtut", "dialogtut", RD_DIALOGTUT, {_x:_local3.box[0], _y:_local3.box[1]});
_root.attachMovie("dialogtutcircle", "dialogtutcircle", RD_DIALOGTUTCIRCLE, {_x:_local3.circ[0], _y:_local3.circ[1], _width:2 * _local3.circ[2], _height:2 * _local3.circ[2]});
_root.dialogtut.text = _local3.box[2];
}
}
function showdlgerr(errtext) {
_root.dlgerr.removeMovieClip();
_root.attachMovie("dlgerr", "dlgerr", _root.getNextHighestDepth(), {_x:505, _y:317});
_root.dlgerr.errtxt = errtext;
}
function mny(diff) {
diff = Math.floor(diff);
if (isNaN(diff)) {
trace("bad mny");
return(undefined);
}
if (diff < 0) {
totalspent = totalspent + diff;
}
if ((_root.money + diff) < 0) {
showdlgerr(("can't afford! (" + diff) + ")");
return(false);
}
_root.money = _root.money + diff;
_root.money_txt = _root.money;
return(true);
}
function delmcs(obj) {
for (e in obj) {
obj[e].removeMovieClip();
}
}
function initlevel(level) {
var _local2;
var _local7;
var _local6;
_root.money = 0;
_root.barricadesused = 0;
if (_root.tutorial != -1) {
mny(500);
} else {
mny(timeline_money[level]);
}
_root.currlevel = level;
level_txt = ("Level " + (level + 1)) + ((_root.difficulty == 0) ? "-NRM" : "-HRD");
basehp = baseupgrades.nrgpool[0];
basehp_txt = (basehp + "/") + baseupgrades.nrgpool[0];
delmcs(_root.bg);
_root.bg.cacheAsBitmap = true;
wave_txt = "wave 1/" + _root["timeline" + level].length;
totalspent = 0;
totalbasedmg = 0;
resetallsfx();
_root.itemlist = Array();
_root.lastitem = 0;
_root.currframe = 0;
_root.itemid = 0;
_root.robotcount = 0;
_root.simpause = false;
_root.totalearned = 0;
_root.timeline_currwave = -1;
_root.timeline_laststart = -1000000;
_root.timeline_sendwave = false;
_root.timeline_wavefinished = -1;
_local2 = 0;
while (_local2 < base_vars.length) {
base[base_vars[_local2] + "_level"] = 0;
_local2++;
}
cls();
drawbase();
if (_root.tutorial != -1) {
_root.attachMovie("dialogtut", "dialogtut2", RD_DIALOGTUT2, {_x:507, _y:10});
_root.dialogtut2.text = "to quit the tutorial press escape any time";
}
}
function cls() {
var _local2;
for (_local2 in _root) {
_root[_local2].removeMovieClip();
}
}
function inrect(cx, cy, xmin, ymin, xmax, ymax) {
if ((((cx >= xmin) && (cx <= xmax)) && (cy >= ymin)) && (cy <= ymax)) {
return(true);
}
return(false);
}
function emptyhand() {
_root.iteminhandvalid_mc.removeMovieClip();
_root.iteminhand_mc.removeMovieClip();
_root.iteminhand = -1;
_root.validplaces.removeMovieClip();
_root.tiptext = "";
}
function checktutvalid(onscreen) {
if (_root.tutorial != -1) {
var _local2 = _root["tutorial" + _root.tutorial][_root.tutorialprogress];
if (onscreen && (!_local2.onscreen)) {
return(true);
}
if ((((_root._xmouse - _local2.circ[0]) * (_root._xmouse - _local2.circ[0])) + ((_root._ymouse - _local2.circ[1]) * (_root._ymouse - _local2.circ[1]))) > (_local2.circ[2] * _local2.circ[2])) {
return(true);
}
_root.dialogtut.removeMovieClip();
_root.dialogtutcircle.removeMovieClip();
_root.tutorialprogress++;
return(false);
}
startsfx(8);
return(false);
}
function mousepress() {
if (checktutvalid(true)) {
return(undefined);
}
staticdepthrepair();
if (_root.iteminhand != -1) {
var _local2;
var _local3;
var _local4 = 0;
_local2 = CELL * Math.floor(cx(_root._xmouse, _root._ymouse + 45) / CELL);
_local3 = CELL * Math.floor(cy(_root._xmouse, _root._ymouse + 45) / CELL);
if ((_root.iteminhand >= CUBE1) && (_root.iteminhand <= CUBE_LAST)) {
_local4 = _root.cubeprops[_root.iteminhand - CUBE1].hp;
_root.barricadesused++;
if (_root.barricadesused == 10) {
addach(21);
}
if (_root.barricadesused == 25) {
addach(22);
}
if (_root.barricadesused == 50) {
addach(23);
}
if (_root.barricadesused == 100) {
addach(24);
}
}
if ((_local2 > (((LOX + LW) + 1) * CELL)) || (_local2 < ((LOX - 1) * CELL))) {
emptyhand();
return(undefined);
}
if (inrect(_local2 - (CELL / 2), _local3 - (CELL / 2), _root.validplaces.cmin.x, _root.validplaces.cmin.y, _root.validplaces.cmax.x, _root.validplaces.cmax.y)) {
if (((_root.iteminhand >= CUBE1) && (_root.iteminhand <= CUBE_LAST)) && (findrobot(_local2, _local3, CELL) != -1)) {
return(undefined);
}
if (acc(_root.iteminhand, 1, _local2, _local3) && (_root.createitem(_root.iteminhand, 0, _local2, _local3, 0, 0, 0, 0, _local4, 0, 0, -1, towerprops[iteminhand - TOWER1].freq, -1))) {
acc(_root.iteminhand, 2, _local2, _local3);
if ((_root.iteminhand < CUBE1) || (_root.iteminhand > CUBE_LAST)) {
emptyhand();
}
}
}
}
}
var OX = 359;
var OY = 18;
var LOX = 5;
var LOY = 2;
var LW = 12;
var CELL = 18;
var SW = 700;
var SH = 450;
var MIN_X = (LOX * CELL);
var MAX_X = (((LOX + LW) - 1) * CELL);
var MAX_COLL = 5;
var GRAVITY = 0.1;
var MAX_Y = (35 * CELL);
var WAITFRAMES = 75;
var MAX_UPGRADES = 5;
var DEF_BASEBORDER = (5 * CELL);
var ROBOTHP_CORRECTION_NORMAL = 1;
var ROBOTVALUE_CORRECTION_NORMAL = 1;
var ROBOTHP_CORRECTION_HARD = 1.4;
var ROBOTVALUE_CORRECTION_HARD = 0.9;
var RD_RANGE = 1;
var RD_VALIDPLACES = 2;
var RD_RADIUSANIM = 3;
var RD_RADIUSANIM_LAST = 99;
var RD_DLG = 700000;
var RD_INHANDVALID = 700001;
var RD_INHAND = 700002;
var RD_DIALOGTUT = 700003;
var RD_DIALOGTUT2 = 700004;
var RD_DIALOGTUTCIRCLE = 700005;
var BASEID = -1;
var ROBOT1 = 1;
var ROBOT2 = 2;
var ROBOT3 = 3;
var ROBOT4 = 4;
var ROBOT5 = 5;
var ROBOT6 = 6;
var ROBOT7 = 7;
var ROBOT8 = 8;
var ROBOT9 = 9;
var ROBOT10 = 10;
var ROBOT11 = 11;
var ROBOT12 = 12;
var ROBOT13 = 13;
var ROBOT14 = 14;
var ROBOT15 = 15;
var ROBOT16 = 16;
var ROBOT17 = 17;
var ROBOT18 = 18;
var ROBOT_LAST = 19;
var ROBOT_FIRSTBOSS = 14;
var CUBE1 = 20;
var CUBE2 = 21;
var CUBE3 = 22;
var CUBE4 = 23;
var CUBE5 = 24;
var CUBE6 = 25;
var CUBE7 = 26;
var CUBE8 = 27;
var CUBE9 = 28;
var CUBE10 = 29;
var CUBE11 = 30;
var CUBE12 = 31;
var CUBE_LAST = 31;
var COLL_LIMIT = 50;
var TOWER1 = 50;
var TOWER2 = 51;
var TOWER3 = 52;
var TOWER4 = 53;
var TOWER1B = 54;
var TOWER1C = 55;
var TOWER2B = 56;
var TOWER2C = 57;
var TOWER3B = 58;
var TOWER3C = 59;
var TOWER4B = 60;
var TOWER4C = 61;
var TOWER_LAST = 61;
var CATAPULT1 = 75;
var CATAPULT2 = 76;
var CATAPULT3 = 77;
var CATAPULT4 = 78;
var CATAPULT_LAST = 78;
var BULLET1 = 101;
var BULLET2 = 102;
var BULLET3 = 103;
var BULLET4 = 104;
var BULLET5 = 105;
var BULLET6 = 106;
var BULLET7 = 107;
var BULLET8 = 108;
var BULLET9 = 109;
var BULLET10 = 110;
var BULLET11 = 111;
var BULLET12 = 112;
var BULLET13 = 113;
var BULLET14 = 114;
var BULLET15 = 115;
var BULLET16 = 116;
var BULLET17 = 117;
var BULLET18 = 118;
var TOWBULL1 = 150;
var TOWBULL1B = 151;
var TOWBULL1C = 152;
var TOWBULL2 = 153;
var TOWBULL2B = 154;
var TOWBULL2C = 155;
var TOWBULL3 = 156;
var TOWBULL3B = 157;
var TOWBULL3C = 158;
var TOWBULL4 = 159;
var TOWBULL4B = 160;
var TOWBULL4C = 161;
var TOWBULL_LAST = 161;
var CATBULL1 = 180;
var CATBULL2 = 181;
var CATBULL3 = 182;
var CATBULL4 = 183;
var CATBULL_LAST = 183;
var ST_MOVE = 1;
var ST_FIRE = 2;
var ST_DOZER = 3;
var ST_WAIT = 4;
var robotprops = [{xoff:21, yoff:-42, bsize:20, freq:100, dmg:1, hp:50, bspeed:18, speed:3, rvalue:10, w:CELL}, {xoff:21, yoff:-42, bsize:25, freq:100, dmg:1, hp:75, bspeed:18, speed:2, rvalue:12, w:CELL}, {xoff:21, yoff:-42, bsize:30, freq:100, dmg:2, hp:100, bspeed:18, speed:2, rvalue:15, w:CELL}, {xoff:21, yoff:-42, bsize:35, freq:100, dmg:2, hp:125, bspeed:18, speed:2, rvalue:17, w:CELL}, {xoff:21, yoff:-42, bsize:40, freq:100, dmg:2, hp:140, bspeed:18, speed:3, rvalue:17, w:CELL}, {xoff:21, yoff:-42, bsize:45, freq:100, dmg:3, hp:160, bspeed:18, speed:2, rvalue:20, w:CELL}, {xoff:21, yoff:-42, bsize:20, freq:100, dmg:3, hp:175, bspeed:18, speed:2, rvalue:20, w:CELL}, {xoff:21, yoff:-42, bsize:20, freq:100, dmg:3, hp:190, bspeed:18, speed:1, rvalue:22, w:CELL}, {xoff:21, yoff:-42, bsize:20, freq:100, dmg:4, hp:200, bspeed:18, speed:1, rvalue:25, w:CELL}, {xoff:21, yoff:-42, bsize:20, freq:100, dmg:4, hp:225, bspeed:18, speed:1, rvalue:25, w:CELL}, {xoff:21, yoff:-42, bsize:20, freq:100, dmg:4, hp:250, bspeed:18, speed:3, rvalue:27, w:CELL}, {xoff:21, yoff:-42, bsize:20, freq:100, dmg:5, hp:275, bspeed:18, speed:3, rvalue:30, w:CELL}, {xoff:20, yoff:-37, bsize:50, freq:100, dmg:5, hp:300, bspeed:18, speed:2, rvalue:30, w:CELL}, {xoff:20, yoff:-42, bsize:100, freq:50, dmg:5, hp:1000, bspeed:9, speed:1, rvalue:100, w:2 * CELL}, {xoff:20, yoff:-72, bsize:100, freq:20, dmg:5, hp:1500, bspeed:9, speed:2, rvalue:100, w:5 * CELL}, {xoff:20, yoff:-62, bsize:100, freq:25, dmg:5, hp:1100, bspeed:18, speed:2, rvalue:100, w:4 * CELL}, {xoff:20, yoff:-82, bsize:100, freq:33, dmg:5, hp:1000, bspeed:9, speed:2, rvalue:100, w:2 * CELL}, {xoff:31, yoff:-64, bsize:100, freq:25, dmg:5, hp:4500, bspeed:18, speed:3, rvalue:100, w:3 * CELL}];
var cubeprops = [{hp:150, cost:20, w:CELL, dmg:50, dmgr:55, desc:"medium barricade"}, {hp:200, cost:25, w:CELL, dmg:50, dmgr:60, desc:"strong barricade"}, {hp:50, cost:30, w:CELL, dmg:70, dmgr:70, desc:"explosive trap"}, {hp:50, cost:35, w:CELL, dmg:70, dmgr:90, desc:"explosive trap v2.0"}, {hp:50, cost:10, w:CELL, dmg:50, dmgr:46, desc:"basic barricade"}, {hp:100, cost:15, w:CELL, dmg:50, dmgr:50, desc:"enforced basic barricade"}, {hp:50, cost:10, w:CELL}, {hp:50, cost:10, w:CELL}, {hp:50, cost:60, w:CELL, dmg:25, dmgr:50, desc:"fragmentation bomb"}, {hp:50, cost:75, w:CELL, dmg:25, dmgr:60, desc:"fragmentation bomb v2.0"}, {hp:50, cost:10, w:CELL}, {hp:50, cost:10, w:CELL}];
var towerprops = [{h:34, r:20, bspeed:18, bsize:20, cost:100, desc:"laser turret. 125 upgrades", acc:[{ox:2, oy:0, mn:"tile10"}, {ox:2, oy:1, mn:"tile10"}, {ox:-1, oy:0, mn:"cube5s"}, {ox:-1, oy:1, mn:"cube5s"}]}, {h:34, r:20, bspeed:18, bsize:20, cost:200, desc:"plasma turret. 125 upgrades", acc:[{ox:0, oy:-1, mn:"tile9"}, {ox:1, oy:-1, mn:"tile9"}, {ox:0, oy:2, mn:"tile9"}, {ox:1, oy:2, mn:"tile9"}]}, {h:34, r:20, bspeed:18, bsize:20, cost:350, desc:"EEMP800 turret. 125 upgrades", acc:[{ox:2, oy:0, mn:"tile13"}, {ox:2, oy:1, mn:"tile13"}, {ox:0, oy:2, mn:"tile13"}, {ox:1, oy:2, mn:"tile13"}]}, {h:40, r:20, bspeed:9, bsize:40, cost:400, desc:"EEMP1000 turret. 125 upgrades", acc:[{ox:2, oy:0, mn:"tile11"}, {ox:2, oy:1, mn:"tile11"}, {ox:0, oy:2, mn:"tile11"}, {ox:1, oy:2, mn:"tile11"}, {ox:-1, oy:0, mn:"tile11"}, {ox:-1, oy:1, mn:"tile11"}, {ox:0, oy:-1, mn:"tile11"}, {ox:1, oy:-1, mn:"tile11"}]}];
var towerscales = {freq_max:10, freq_min:70, freq_inv:true, dmg_max:42, dmg_min:5, dmg_inv:false, range_max:30, range_min:5, range_inv:false};
var towerupgrades = [{freq:[50, 42, 35, 27, 22], freq_cost:[0, 20, 20, 25, 25], dmg:[10, 15, 20, 25, 30], dmg_cost:[0, 25, 25, 25, 25], range:[10, 13, 16, 19, 22], range_cost:[0, 20, 20, 30, 30]}, {freq:[50, 40, 30, 20, 15], freq_cost:[0, 30, 30, 35, 40], dmg:[15, 19, 23, 27, 31], dmg_cost:[0, 35, 35, 35, 35], range:[10, 15, 20, 25, 30], range_cost:[0, 25, 25, 40, 40]}, {freq:[60, 49, 38, 25, 14], freq_cost:[0, 50, 45, 40, 35], dmg:[20, 25, 30, 35, 40], dmg_cost:[0, 50, 40, 35, 30], range:[12, 15, 18, 22, 25], range_cost:[0, 20, 30, 40, 40]}, {freq:[50, 40, 30, 16, 10], freq_cost:[0, 35, 35, 35, 35], dmg:[20, 25, 30, 35, 42], dmg_cost:[0, 40, 40, 40, 40], range:[8, 10, 13, 17, 22], range_cost:[0, 15, 15, 25, 25]}];
var tower_vars = ["freq", "dmg", "range"];
var tower_varlabels = ["fire rate", "damage", "fire range"];
var base = Object();
var basescales = {shield_max:0.6, shield_min:1.2, shield_inv:true, size_max:4, size_min:0, size_inv:false, recycle_max:1.4, recycle_min:0.5, recycle_inv:false, repair_max:2, repair_min:0, repair_inv:false, nrgpool_max:900, nrgpool_min:0, nrgpool_inv:false};
var baseupgrades = {shield:[1, 0.9, 0.8, 0.7, 0.6], shield_cost:[0, 300, 400, 500, 600], size:[0, 1, 2, 3, 4], size_cost:[0, 100, 100, 150, 150], recycle:[1, 1.1, 1.2, 1.3, 1.4], recycle_cost:[0, 400, 500, 600, 700], repair:[0, 0.5, 1, 1.5, 2], repair_cost:[0, 200, 300, 400, 500], nrgpool:[500, 600, 700, 800, 900], nrgpool_cost:[0, 200, 300, 400, 500]};
var base_vars = ["shield", "size", "recycle", "repair", "nrgpool"];
var base_varlabels = ["shield", "weapon area", "recycle", "auto repair", "energy pool"];
var catapultscales = {freq_max:10, freq_min:70, freq_inv:true, dmg_max:42, dmg_min:5, dmg_inv:false, dmgr_max:100, dmgr_min:0, dmgr_inv:false, startv_max:4, startv_min:0, startv_inv:false, xspread_max:2, xspread_min:0.5, xspread_inv:false};
var catapultupgrades = [{freq:[60, 50, 45, 40, 35], freq_cost:[0, 40, 50, 52, 57], dmg:[10, 15, 19, 22, 25], dmg_cost:[0, 30, 30, 42, 42], dmgr:[50, 57, 64], dmgr_cost:[0, 60, 100], startv:[2, 2.5, 3, 3.5, 4], startv_cost:[0, 10, 10, 10, 10], xspread:[0.5, 0.875, 1.25, 1.625, 2], xspread_cost:[0, 10, 10, 10, 10]}, {freq:[60, 50, 45, 40, 33], freq_cost:[0, 50, 50, 50, 50], dmg:[12, 16, 20, 23, 27], dmg_cost:[0, 35, 35, 35, 35], dmgr:[50, 57, 64], dmgr_cost:[0, 60, 80], startv:[2, 2.5, 3, 3.5, 4], startv_cost:[0, 10, 10, 10, 10], xspread:[0.5, 0.875, 1.25, 1.625, 2], xspread_cost:[0, 10, 10, 10, 10]}, {freq:[50, 45, 40, 35, 30], freq_cost:[0, 65, 75, 85, 95], dmg:[14, 16, 18, 21, 24], dmg_cost:[0, 35, 35, 40, 40], dmgr:[50, 60, 70], dmgr_cost:[0, 125, 175], startv:[2, 2.5, 3, 3.5, 4], startv_cost:[0, 10, 10, 10, 10], xspread:[0.5, 0.875, 1.25, 1.625, 2], xspread_cost:[0, 10, 10, 10, 10]}, {freq:[50, 45, 40, 35, 30], freq_cost:[0, 75, 85, 95, 105], dmg:[16, 18, 20, 23, 26], dmg_cost:[0, 40, 40, 45, 45], dmgr:[50, 62, 75], dmgr_cost:[0, 125, 200], startv:[2, 2.5, 3, 3.5, 4], startv_cost:[0, 10, 10, 10, 10], xspread:[0.5, 0.875, 1.25, 1.625, 2], xspread_cost:[0, 10, 10, 10, 10]}];
var catapultprops = [{wait:7, maxv:1, startxoff:0, startyoff:5, startzoff:50, bsize:40, cost:150, desc:"basic catapult", acc:[{ox:2, oy:0, mn:"tile6"}, {ox:2, oy:1, mn:"tile6"}, {ox:-1, oy:0, mn:"cube3s"}, {ox:-1, oy:1, mn:"cube3s"}]}, {wait:9, maxv:1, startxoff:0, startyoff:5, startzoff:53, bsize:20, cost:200, desc:"enhanced catapult", acc:[{ox:2, oy:0, mn:"tile10"}, {ox:2, oy:1, mn:"tile10"}, {ox:-1, oy:0, mn:"tile10"}, {ox:-1, oy:1, mn:"tile10"}]}, {wait:9, maxv:1, startxoff:0, startyoff:5, startzoff:53, bsize:20, cost:500, desc:"bouncer bullet catapult", acc:[{ox:2, oy:0, mn:"tile10"}, {ox:2, oy:1, mn:"tile10"}, {ox:0, oy:2, mn:"tile10"}, {ox:1, oy:2, mn:"tile10"}]}, {wait:7, maxv:1, startxoff:0, startyoff:30, startzoff:62, bsize:20, cost:700, desc:"the XV1000 monster", acc:[{ox:2, oy:0, mn:"tile11"}, {ox:2, oy:1, mn:"tile11"}, {ox:0, oy:2, mn:"tile11"}, {ox:1, oy:2, mn:"tile11"}, {ox:-1, oy:0, mn:"tile11"}, {ox:-1, oy:1, mn:"tile11"}, {ox:0, oy:-1, mn:"tile11"}, {ox:1, oy:-1, mn:"tile11"}]}];
var catapult_vars = ["freq", "dmg", "dmgr", "startv", "xspread"];
var catapult_varlabels = ["fire rate", "damage", "expl. radius", "fire range", "fire spread"];
var waveline;
var wavespeed;
var wavemindist;
var robotcount = 0;
var oldvolume;
var totalspent;
var totalbasedmg;
var totalearned;
var basehp;
var money;
var simspeed = 1;
var simpause = false;
var barricadesused;
var f_wave1 = [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]];
var f_wave2 = [[8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 18, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 8], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
var f_wave3 = [[0, 0, 0, 9, 9, 9, 9, 9, 9, 0, 0, 0], [0, 0, 9, 0, 0, 0, 0, 0, 0, 9, 0, 0], [0, 9, 0, 2, 2, 2, 2, 2, 2, 0, 9, 0], [9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9], [0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0]];
var f_wave5 = [[3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3], [3, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 3], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3], [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3]];
var f_wave6 = [[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]];
var f_wave7 = [[0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 0, 0, 0, 0, 16, 0, 3, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0]];
var f_wave8 = [[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]];
var f_wave9 = [[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]];
var f_wave10 = [[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]];
var f_wave11 = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]];
var f_wave12 = [[4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0]];
var f_wave13 = [[6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0]];
var f_wave14 = [[7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0]];
var f_wave15 = [[8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0]];
var f_wave16 = [[9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 0, 9, 0, 9, 0, 9, 0, 9, 0, 9, 0]];
var f_wave17 = [[10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0]];
var f_wave18 = [[11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11]];
var f_wave19 = [[12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0]];
var f_wave20 = [[12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [12, 0, 12, 0, 12, 0, 12, 0, 12, 0, 12, 0]];
var f_wave21 = [[13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0]];
var f_wave22 = [[13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [13, 0, 13, 0, 13, 0, 13, 0, 13, 0, 13, 0]];
var f_wave23 = [[8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 14, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 14, 0, 0, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 0, 0, 14, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8], [0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0], [8, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 8], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
var f_wave24 = [[0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0]];
var f_wave25 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 14, 0, 0, 0, 0, 0, 16, 0, 0, 0, 14], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0], [0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14]];
var f_wave26 = [[13, 0, 0, 17, 0, 0, 0, 0, 0, 17, 0, 13], [0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0], [13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13], [0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0]];
var f_wave27 = [[6, 6, 6, 0, 0, 0, 0, 18, 0, 6, 6, 6]];
var f_wave28 = [[9, 9, 9, 0, 0, 0, 18, 0, 0, 9, 9, 9]];
var f_wave29 = [[11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11], [11, 11, 0, 0, 17, 0, 0, 0, 0, 0, 11, 11], [11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11], [11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11], [11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11], [11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11], [11, 11, 0, 0, 0, 0, 0, 0, 17, 0, 11, 11]];
var f_wave30 = [[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]];
var f_wave31 = [[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]];
var f_wave32 = [[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]];
var f_wave33 = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]];
var f_wave34 = [[6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]];
var f_wave35 = [[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]];
var f_wave36 = [[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]];
var f_wave37 = [[9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]];
var f_wave38 = [[3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3], [3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 0], [0, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]];
var f_wave39 = [[3, 3, 3, 3, 3, 0, 14, 3, 3, 3, 3, 3]];
var f_wave40 = [[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0]];
var f_wave41 = [[0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0]];
var f_wave42 = [[0, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 0], [0, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 0], [0, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 0], [0, 0, 0, 0, 11, 11, 11, 11, 0, 0, 0, 0]];
var f_wave43 = [[0, 2, 3, 2, 0, 0, 0, 0, 2, 3, 2, 0], [0, 3, 2, 3, 0, 0, 0, 0, 3, 2, 3, 0], [0, 2, 3, 2, 0, 0, 0, 0, 2, 3, 2, 0]];
var f_wave44 = [[0, 4, 0, 4, 0, 0, 0, 0, 4, 0, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 0, 4, 0, 0, 0, 0, 4, 0, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 0, 4, 0, 0, 0, 0, 4, 0, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 0, 4, 0, 0, 0, 0, 4, 0, 4, 0]];
var f_wave45 = [[9, 9, 9, 0, 0, 0, 18, 0, 0, 9, 9, 9], [9, 9, 9, 0, 0, 0, 0, 0, 0, 9, 9, 9], [9, 9, 9, 0, 0, 0, 0, 0, 0, 9, 9, 9]];
var f_wave46 = [[11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 0, 11, 0, 0, 0, 17, 0, 0, 11, 0, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 0, 11, 0, 11, 0, 0, 11, 0, 11, 0, 11]];
var f_wave47 = [[11, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 0, 11, 0, 0, 0, 0, 0, 0, 11, 0, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 0, 11, 0, 11, 0, 0, 11, 0, 11, 0, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 0, 11, 0, 11, 0, 0, 11, 0, 11, 0, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 0, 11, 0, 11, 0, 0, 11, 0, 11, 0, 11], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [11, 0, 11, 0, 11, 0, 0, 11, 0, 11, 0, 11]];
var f_wave48 = [[0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0]];
var r_wave1 = [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave2 = [0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave3 = [0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave4 = [20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave5 = [0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave6 = [0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave7 = [20, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave8 = [0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave9 = [0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave10 = [0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave11 = [100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave12 = [0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave13 = [50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave14 = [25, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave15 = [0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave16 = [0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave17 = [0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave18 = [0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave19 = [0, 0, 50, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave20 = [0, 0, 0, 50, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave21 = [0, 0, 0, 0, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave22 = [0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave23 = [0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave24 = [0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave25 = [0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave26 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave27 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave28 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0];
var r_wave29 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0];
var r_wave30 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0];
var r_wave31 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0];
var r_wave32 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0];
var r_wave33 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0];
var r_wave34 = [10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave35 = [0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave36 = [10, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave37 = [30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave38 = [0, 20, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave39 = [0, 0, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave40 = [0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave41 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0];
var r_wave42 = [0, 0, 0, 30, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave43 = [0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0];
var r_wave44 = [0, 50, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave45 = [0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0];
var r_wave46 = [0, 0, 0, 40, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave47 = [0, 0, 0, 0, 30, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave48 = [60, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_wave49 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 0, 0, 0, 0, 0];
var r_wave50 = [0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_twave1 = [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_twave2 = [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var r_twave3 = [20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var timeline0 = [{wave:"f_wave40", manualstart:true, frames:750, speed:24, mindist:CELL * 6, delbarr:false, lock:[0, 1, 1, 1, 1, 1, 1, 1, 0, 0], hint:"droids are approaching! use turrets to destroy them!"}, {wave:"r_wave2", manualstart:false, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 1, 1, 1, 1, 1, 1, 1, 0, 0]}, {wave:"f_wave41", manualstart:true, frames:750, speed:24, mindist:CELL * 6, delbarr:false, lock:[0, 1, 1, 1, 1, 1, 1, 1, 0, 0]}, {wave:"r_wave5", manualstart:false, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 1, 1, 1, 1, 1, 1, 1, 0, 0]}, {wave:"f_wave42", manualstart:true, frames:750, speed:24, mindist:CELL * 6, delbarr:false, lock:[0, 1, 1, 1, 1, 1, 1, 1, 0, 0]}];
var timeline1 = [{wave:"r_wave1", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 1, 1, 1, 1, 1, 1, 0, 0], hint:"a new, stronger turret is unlocked."}, {wave:"r_wave2", manualstart:false, frames:500, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 1, 1, 1, 1, 1, 1, 0, 0]}, {wave:"f_wave38", manualstart:true, frames:500, speed:24, mindist:CELL * 3, delbarr:false, lock:[0, 0, 1, 1, 1, 1, 1, 1, 0, 0]}, {wave:"f_wave39", manualstart:true, frames:500, speed:24, mindist:CELL * 7, delbarr:true, lock:[0, 0, 1, 1, 1, 1, 1, 1, 0, 0]}];
var timeline2 = [{wave:"r_wave5", manualstart:true, frames:500, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 1, 0, 1, 1, 1, 0, 0], hint:"new turret and catapult unlocked."}, {wave:"r_wave34", manualstart:false, frames:500, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 1, 0, 1, 1, 1, 0, 0]}, {wave:"r_wave6", manualstart:false, frames:750, speed:24, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 1, 0, 1, 1, 1, 0, 0]}, {wave:"r_wave7", manualstart:false, frames:750, speed:24, mindist:CELL * 7, delbarr:true, lock:[0, 0, 0, 1, 0, 1, 1, 1, 0, 0]}, {wave:"r_wave13", manualstart:false, frames:750, speed:24, mindist:CELL * 7, delbarr:true, lock:[0, 0, 0, 1, 0, 1, 1, 1, 0, 0]}, {wave:"r_wave11", manualstart:false, frames:750, speed:18, mindist:CELL * 7, delbarr:true, lock:[0, 0, 0, 1, 0, 1, 1, 1, 0, 0]}, {wave:"f_wave46", manualstart:true, frames:500, speed:24, mindist:CELL * 9, delbarr:true, lock:[0, 0, 0, 1, 0, 1, 1, 1, 0, 0], hint:"boss attack! prepare for battle!"}];
var timeline3 = [{wave:"r_wave1", manualstart:true, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0], hint:"robots within sight. blast them! new catapult unlocked"}, {wave:"r_wave2", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"r_wave3", manualstart:false, frames:750, speed:18, mindist:CELL * 9, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"f_wave1", manualstart:true, frames:750, speed:36, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"r_wave4", manualstart:true, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"r_wave5", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"r_wave6", manualstart:false, frames:750, speed:18, mindist:CELL * 9, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"f_wave3", manualstart:true, frames:750, speed:36, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"r_wave7", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"r_wave8", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"r_wave9", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"r_wave10", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0]}, {wave:"f_wave2", manualstart:true, frames:750, speed:18, mindist:CELL * 3, delbarr:true, lock:[0, 0, 0, 1, 0, 0, 1, 1, 0, 0], hint:"something big is approaching, be careful!"}];
var timeline4 = [{wave:"r_wave4", manualstart:true, frames:750, speed:24, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 0, 1, 0, 0], hint:"new weapons unlocked. check out the bouncer!"}, {wave:"f_wave43", manualstart:true, frames:750, speed:36, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 0, 1, 0, 0]}, {wave:"r_wave6", manualstart:false, frames:750, speed:24, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 0, 1, 0, 0]}, {wave:"f_wave44", manualstart:true, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 0, 1, 0, 0]}, {wave:"r_wave16", manualstart:true, frames:1000, speed:24, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 0, 1, 0, 0]}, {wave:"r_wave24", manualstart:false, frames:750, speed:24, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 1, 0, 0, 0, 1, 0, 0]}, {wave:"f_wave45", manualstart:true, frames:750, speed:24, mindist:CELL * 6, delbarr:true, lock:[0, 0, 0, 1, 0, 0, 0, 1, 0, 0]}];
var timeline5 = [{wave:"r_wave5", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], hint:"all weapons are available. use them!"}, {wave:"r_wave6", manualstart:false, frames:750, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave7", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave5", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave6", manualstart:false, frames:750, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave7", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave15", manualstart:true, frames:500, speed:18, mindist:CELL * 1, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave22", manualstart:true, frames:500, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave24", manualstart:true, frames:500, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave26", manualstart:true, frames:750, speed:18, mindist:CELL * 1, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave7", manualstart:true, frames:250, speed:36, mindist:CELL * 2, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], hint:"beware, boss ahead!"}];
var timeline6 = [{wave:"f_wave30", manualstart:true, frames:500, speed:18, mindist:CELL * 1, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave31", manualstart:false, frames:500, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave32", manualstart:false, frames:500, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave33", manualstart:false, frames:500, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave34", manualstart:false, frames:500, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave35", manualstart:false, frames:500, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave36", manualstart:false, frames:500, speed:18, mindist:CELL * 7, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave37", manualstart:false, frames:500, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave44", manualstart:true, frames:1000, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave24", manualstart:true, frames:350, speed:18, mindist:CELL * 15, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave45", manualstart:false, frames:750, speed:36, mindist:CELL * 7, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}];
var timeline7 = [{wave:"r_wave1", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1], hint:"telecomm failure. sorry, no base upgrades this time. good luck!"}, {wave:"r_wave34", manualstart:false, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"r_wave35", manualstart:false, frames:750, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"r_wave36", manualstart:false, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"r_wave37", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"f_wave8", manualstart:true, frames:750, speed:36, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"f_wave9", manualstart:true, frames:750, speed:36, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"r_wave7", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"r_wave16", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"r_wave17", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {wave:"f_wave23", manualstart:true, frames:750, speed:36, mindist:CELL * 2, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 1], hint:"beware, bosses ahead!"}];
var timeline8 = [{wave:"r_wave4", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave5", manualstart:false, frames:750, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave6", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave12", manualstart:true, frames:1000, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave11", manualstart:false, frames:1000, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave13", manualstart:false, frames:1000, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave14", manualstart:true, frames:750, speed:36, mindist:CELL * 1, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave15", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave16", manualstart:false, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave17", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave18", manualstart:false, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave19", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave20", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave21", manualstart:true, frames:750, speed:18, mindist:CELL * 2, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave5", manualstart:true, frames:250, speed:36, mindist:CELL * 1, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], hint:"beware, bosses ahead!"}];
var timeline9 = [{wave:"r_wave37", manualstart:true, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave8", manualstart:true, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave8", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave13", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave13", manualstart:true, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave42", manualstart:false, frames:750, speed:18, mindist:CELL * 8, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave10", manualstart:true, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave26", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave22", manualstart:true, frames:750, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave29", manualstart:true, frames:750, speed:36, mindist:CELL * 5, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}];
var timeline10 = [{wave:"r_wave1", manualstart:true, frames:750, speed:18, mindist:CELL * 1, delbarr:false, lock:[1, 1, 1, 1, 1, 1, 1, 1, 0, 1], hint:"aaargh... no power. use just traps and barricades..."}, {wave:"r_wave34", manualstart:false, frames:750, speed:18, mindist:CELL * 1, delbarr:false, lock:[1, 1, 1, 1, 1, 1, 1, 1, 0, 1]}, {wave:"r_wave35", manualstart:false, frames:500, speed:18, mindist:CELL * 1, delbarr:false, lock:[1, 1, 1, 1, 1, 1, 1, 1, 0, 1]}, {wave:"f_wave48", manualstart:true, frames:500, speed:18, mindist:CELL * 10, delbarr:true, lock:[1, 1, 1, 1, 1, 1, 1, 1, 0, 1]}, {wave:"r_wave39", manualstart:false, frames:500, speed:18, mindist:CELL * 1, delbarr:false, lock:[1, 1, 1, 1, 1, 1, 1, 1, 0, 1]}];
var timeline11 = [{wave:"r_wave3", manualstart:true, frames:500, speed:18, mindist:CELL * 1, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave36", manualstart:false, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave37", manualstart:true, frames:500, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave5", manualstart:true, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave8", manualstart:false, frames:500, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave20", manualstart:true, frames:500, speed:36, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave19", manualstart:false, frames:750, speed:18, mindist:CELL * 7, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave22", manualstart:false, frames:500, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave25", manualstart:true, frames:500, speed:18, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave27", manualstart:false, frames:500, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave25", manualstart:true, frames:250, speed:36, mindist:CELL * 3, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], hint:"beware, bosses ahead!"}];
var timeline12 = [{wave:"f_wave1", manualstart:true, frames:750, speed:36, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave8", manualstart:true, frames:750, speed:36, mindist:CELL * 7, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave16", manualstart:false, frames:750, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave42", manualstart:true, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave22", manualstart:true, frames:750, speed:54, mindist:CELL * 7, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave48", manualstart:true, frames:1000, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave44", manualstart:false, frames:1000, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave31", manualstart:false, frames:750, speed:18, mindist:CELL * 7, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave26", manualstart:true, frames:250, speed:54, mindist:CELL * 7, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}];
var timeline13 = [{wave:"r_wave11", manualstart:true, frames:1000, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0], hint:"we're short on explosives, don't use traps in this battle!"}, {wave:"r_wave6", manualstart:false, frames:1000, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"r_wave11", manualstart:false, frames:1000, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"r_wave12", manualstart:false, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"r_wave14", manualstart:true, frames:750, speed:18, mindist:CELL * 1, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"r_wave10", manualstart:true, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"r_wave22", manualstart:true, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"r_wave26", manualstart:false, frames:750, speed:18, mindist:CELL * 8, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"r_wave49", manualstart:true, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"r_wave29", manualstart:false, frames:750, speed:18, mindist:CELL * 8, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"f_wave27", manualstart:true, frames:250, speed:18, mindist:CELL * 3, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"f_wave28", manualstart:false, frames:250, speed:18, mindist:CELL * 6, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}, {wave:"f_wave27", manualstart:false, frames:250, speed:18, mindist:CELL * 9, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 1, 0]}];
var timeline14 = [{wave:"f_wave1", manualstart:true, frames:1000, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], hint:"the final battle..."}, {wave:"r_wave12", manualstart:false, frames:1000, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave13", manualstart:false, frames:1000, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave9", manualstart:true, frames:750, speed:72, mindist:CELL * 4, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave42", manualstart:false, frames:750, speed:18, mindist:CELL * 5, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave43", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave21", manualstart:true, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave46", manualstart:false, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave18", manualstart:true, frames:750, speed:18, mindist:CELL * 6, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_wave49", manualstart:false, frames:750, speed:18, mindist:CELL * 8, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"f_wave47", manualstart:true, frames:250, speed:18, mindist:CELL * 7, delbarr:true, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}];
var timeline100 = [{wave:"r_twave1", manualstart:true, frames:100, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_twave2", manualstart:true, frames:100, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_twave3", manualstart:true, frames:100, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {wave:"r_twave3", manualstart:true, frames:100, speed:18, mindist:CELL * 3, delbarr:false, lock:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}];
var tutorial0 = [{circ:[506, 285, 35], box:[255, 214, "to build a new turret click this icon"], pause:true, onscreen:false}, {circ:[383, 393, 40], box:[235, 234, "now choose the basic laser turret"], pause:true, onscreen:false}, {circ:[445, 88, 60], box:[209, 126, "place your turret to the valid green area near the base"], pause:true, onscreen:true}, {circ:[55, 43, 40], box:[134, 10, "now let the enemy approach!"], pause:true, onscreen:false}, {circ:[445, 88, 60], box:[209, 126, "now upgrade your turret to make it more efficient!"], pause:true, onscreen:false}, {circ:[652, 371, 50], box:[235, 234, "press the upgrade button of your choice"], pause:true, onscreen:false}, {circ:[652, 371, 50], box:[235, 234, "ok, now choose another..."], pause:true, onscreen:false}, {circ:[652, 371, 50], box:[235, 234, "and yet another..."], pause:true, onscreen:false}, {circ:[55, 43, 40], box:[134, 10, "okay, check out what happens. wait until the wave is completed"], pause:true, onscreen:false}, {circ:[612, 239, 35], box:[295, 214, "now let's build some barricades. hurry, they're coming!"], pause:true, onscreen:false}, {circ:[571, 393, 40], box:[235, 234, "choose an explosive one!"], pause:true, onscreen:false}, {circ:[320, 140, 40], box:[235, 234, "place some on the road"], pause:true, onscreen:true}, {circ:[348, 161, 40], box:[235, 234, "place some on the road"], pause:true, onscreen:true}, {circ:[419, 193, 40], box:[235, 234, "place some on the road"], pause:true, onscreen:true}, {circ:[447, 201, 40], box:[235, 234, "place some on the road"], pause:true, onscreen:true}, {circ:[361, 193, 40], box:[235, 234, "and one more..."], pause:true, onscreen:true}, {circ:[55, 43, 40], box:[134, 10, "okay, that's enough. click here when the button appears"], pause:true, onscreen:false}, {circ:[560, 264, 40], box:[235, 234, "it's time to build a catapult"], pause:true, onscreen:false}, {circ:[381, 393, 40], box:[235, 234, "now choose the basic catapult"], pause:true, onscreen:false}, {circ:[557, 145, 50], box:[219, 126, "place the catapult right next to the the laser"], pause:true, onscreen:true}, {circ:[557, 145, 50], box:[219, 126, "click it to see it's range, and other possible upgrades"], pause:true, onscreen:false}, {circ:[154, 46, 20], box:[184, 10, "the tutorial is now over, you already know the basics"], pause:true, onscreen:false}];
var timeline_money = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1500, 1000, 1000, 1000, 1000];
var timeline_currwave;
var timeline_laststart;
var timeline_wavename;
var timeline_sendwave;
var timeline_wavefinished;
var tmpwave;
var itemlist = Array();
var lastitem = 0;
var currframe = 0;
var currlevel;
var itemid = 0;
var dbg;
var timearr = Array();
var iteminhand = -1;
var currwall;
corrections();
initlevel(_root.currlevel);
stopallsfx();
startsfx(1);
fscommand ("allowscale", false);
_root.buyturret.onRollOver = function () {
_root.tiptext = "build new turret";
};
_root.buyturret.onRollOut = function () {
_root.tiptext = "";
};
_root.buyturret.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
hidedlgs();
_root.attachMovie("dlgbuyturret", "dlgbuyturret", RD_DLG, {_x:699, _y:450});
var _local4 = ["dlg_tow1", "dlg_tow2", "dlg_tow3", "dlg_tow4"];
var _local7 = [TOWER1, TOWER2, TOWER3, TOWER4];
var _local3;
var _local10 = _root["timeline" + _root.currlevel];
_local3 = 0;
while (_local3 < _local7.length) {
if (_local10[Math.max(0, _root.timeline_currwave)].lock[_local3]) {
_root.dlgbuyturret[_local4[_local3] + "_txt"] = "locked";
_root.dlgbuyturret[_local4[_local3]].enabled = false;
}
_root.dlgbuyturret[_local4[_local3]].myitemid = _local7[_local3];
_root.dlgbuyturret[_local4[_local3]].onPress = function () {
if (checktutvalid()) {
return(undefined);
}
var _local4 = {x:(LOX - 1) * CELL, y:0};
var _local3 = {x:((LOX + LW) - 1) * CELL, y:currbaseborder() - CELL};
createrectarea("validplaces", RD_VALIDPLACES, _local4, _local3, 6750054);
putiteminhand(this.myitemid);
_root.dlgbuyturret.removeMovieClip();
};
_root.dlgbuyturret[_local4[_local3]].onRollOver = function () {
_root.dlgbuyturret.desc = (("cost: " + towerprops[this.myitemid - TOWER1].cost) + " units. ") + towerprops[this.myitemid - TOWER1].desc;
};
_root.dlgbuyturret[_local4[_local3]].onRollOut = function () {
_root.dlgbuyturret.desc = "";
};
_local3++;
}
_root.dlgbuyturret.x.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
_root.dlgbuyturret.removeMovieClip();
};
};
_root.buycatapult.onRollOver = function () {
_root.tiptext = "build new catapult";
};
_root.buycatapult.onRollOut = function () {
_root.tiptext = "";
};
_root.buycatapult.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
hidedlgs();
_root.attachMovie("dlgbuycatapult", "dlgbuycatapult", RD_DLG, {_x:699, _y:450});
var _local4 = ["dlg_cat1", "dlg_cat2", "dlg_cat3", "dlg_cat4"];
var _local7 = [CATAPULT1, CATAPULT2, CATAPULT3, CATAPULT4];
var _local3;
var _local10 = _root["timeline" + _root.currlevel];
_local3 = 0;
while (_local3 < _local7.length) {
if (_local10[Math.max(0, _root.timeline_currwave)].lock[_local3 + 4]) {
_root.dlgbuycatapult[_local4[_local3] + "_txt"] = "locked";
_root.dlgbuycatapult[_local4[_local3]].enabled = false;
}
_root.dlgbuycatapult[_local4[_local3]].myitemid = _local7[_local3];
_root.dlgbuycatapult[_local4[_local3]].onPress = function () {
if (checktutvalid()) {
return(undefined);
}
var _local4 = {x:(LOX - 1) * CELL, y:0};
var _local3 = {x:((LOX + LW) - 1) * CELL, y:currbaseborder() - CELL};
createrectarea("validplaces", RD_VALIDPLACES, _local4, _local3, 6750054);
putiteminhand(this.myitemid);
_root.dlgbuycatapult.removeMovieClip();
};
_root.dlgbuycatapult[_local4[_local3]].onRollOver = function () {
_root.dlgbuycatapult.desc = (("cost: " + catapultprops[this.myitemid - CATAPULT1].cost) + " units. ") + catapultprops[this.myitemid - CATAPULT1].desc;
};
_root.dlgbuycatapult[_local4[_local3]].onRollOut = function () {
_root.dlgbuycatapult.desc = "";
};
_local3++;
}
_root.dlgbuycatapult.x.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
_root.dlgbuycatapult.removeMovieClip();
};
};
_root.buybarricade.onRollOver = function () {
_root.tiptext = "build barricades & traps";
};
_root.buybarricade.onRollOut = function () {
_root.tiptext = "";
};
_root.buybarricade.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
hidedlgs();
_root.attachMovie("dlgbuybarricade", "dlgbuybarricade", RD_DLG, {_x:699, _y:450});
var _local4 = ["dlg_cube5", "dlg_cube6", "dlg_cube1", "dlg_cube2", "dlg_cube3", "dlg_cube4", "dlg_cube9", "dlg_cube10"];
var _local7 = [CUBE5, CUBE6, CUBE1, CUBE2, CUBE3, CUBE4, CUBE9, CUBE10];
var _local3;
_local3 = 0;
while (_local3 < _local7.length) {
_root.dlgbuybarricade[_local4[_local3]].myitemid = _local7[_local3];
_root.dlgbuybarricade[_local4[_local3]].onPress = function () {
if (checktutvalid()) {
return(undefined);
}
var _local4 = {x:(LOX - 1) * CELL, y:currbaseborder()};
var _local3 = {x:(((LOX + LW) - 1) * CELL) + 1, y:25 * CELL};
createrectarea("validplaces", RD_VALIDPLACES, _local4, _local3, 6750054);
putiteminhand(this.myitemid);
_root.dlgbuybarricade.removeMovieClip();
};
_root.dlgbuybarricade[_local4[_local3]].onRollOver = function () {
_root.dlgbuybarricade.desc = (("cost: " + cubeprops[this.myitemid - CUBE1].cost) + " units. ") + cubeprops[this.myitemid - CUBE1].desc;
};
_root.dlgbuybarricade[_local4[_local3]].onRollOut = function () {
_root.dlgbuybarricade.desc = "";
};
_local3++;
}
_root.dlgbuybarricade.x.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
_root.dlgbuybarricade.removeMovieClip();
};
};
_root.buybaseupgrade.onRollOver = function () {
_root.tiptext = "upgrade base";
};
_root.buybaseupgrade.onRollOut = function () {
_root.tiptext = "";
};
_root.buybaseupgrade.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
hidedlgs();
propsdialog("choose an upgrade >", BASEID, base, _root.baseupgrades, base_vars, base_varlabels);
};
_root.btn_fast.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
if (_root.simspeed == 1) {
_root.simspeed = 3;
_root.btn_fast.filters = [_root.glow2];
} else {
_root.simspeed = 1;
_root.btn_fast.filters = undefined;
}
};
_root.btn_help.onPress = function () {
_root.attachMovie("dlghelp", "dlghelp", _root.getNextHighestDepth(), {_x:350, _y:200});
};
_root.btn_play._visible = false;
_root.btn_send._visible = false;
_root.btn_pause.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
emptyhand();
_root.buyturret._visible = false;
_root.buycatapult._visible = false;
_root.buybarricade._visible = false;
_root.buybaseupgrade._visible = false;
_root.tiptext = "";
_root.dlgbuyturret.removeMovieClip();
_root.dlgbuycatapult.removeMovieClip();
_root.dlgbuybarricade.removeMovieClip();
_root.simpause = true;
this._visible = false;
_root.btn_play._visible = true;
};
_root.btn_play.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
_root.buyturret._visible = true;
_root.buycatapult._visible = true;
_root.buybarricade._visible = true;
_root.buybaseupgrade._visible = true;
_root.simpause = false;
this._visible = false;
_root.btn_pause._visible = true;
};
_root.btn_send.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
_root.timeline_sendwave = true;
this._visible = false;
_root.dialoghint.removeMovieClip();
_root.currframe = 0;
resetallsfx();
};
_root.btn_menu.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
if (_root.tutorial != -1) {
delmcs(_root);
_root.gotoAndPlay("mainmenu");
return(undefined);
}
_root.simpause = true;
mainbtns_visible(false);
_root.attachMovie("dlgquit", "dlgquit", _root.getNextHighestDepth(), {_x:350, _y:200});
_root.dlgquit.resume.onPress = function () {
mainbtns_visible(true);
_root.simpause = false;
_root.dlgquit.removeMovieClip();
};
_root.dlgquit.retry.onPress = function () {
mainbtns_visible(true);
initlevel(_root.currlevel);
};
_root.dlgquit.menu.onPress = function () {
_root.savestate();
delmcs(_root);
_root.gotoAndPlay("mainmenu");
};
};
_root.btn_sound.onPress = function () {
if (checktutvalid()) {
return(undefined);
}
var _local2 = new Sound();
if (_root.soundmuted == false) {
_root.oldvolume = _local2.getVolume();
_local2.setVolume(0);
_root.btn_sound.filters = [_root.glow2];
_root.soundmuted = true;
} else {
_local2.setVolume(_root.oldvolume);
_root.btn_sound.filters = undefined;
_root.soundmuted = false;
}
};
var glow1 = (new flash.filters.GlowFilter(3394815, 0.8, 10, 10, 1, 3, false, false));
var glow2 = (new flash.filters.GlowFilter(16777215, 1.9, 15, 15, 1, 3, false, false));
stop();
Instance of Symbol 483 MovieClip [tableclick] "tableclick" in Frame 6
on (press) {
_root.mousepress();
}
onClipEvent (enterFrame) {
var i;
if (!_root.simpause) {
i = 0;
while (i < _root.simspeed) {
_root.inclevel();
i++;
}
}
}
onClipEvent (keyDown) {
var i;
if (Key.getCode() == 27) {
if (_root.tutorial != -1) {
for (c in _root) {
_root[c].removeMovieClip();
}
_root.gotoAndPlay("mainmenu");
}
_root.hidedlgs();
_root.iteminhandvalid_mc.removeMovieClip();
_root.iteminhand_mc.removeMovieClip();
_root.iteminhand = -1;
_root.tiptext = "";
}
if (Key.getCode() == 80) {
if (!_root.simpause) {
_root.btn_pause.onPress.apply(_root.btn_pause);
} else {
_root.btn_play.onPress.apply(_root.btn_play);
}
}
if (Key.getCode() == 70) {
_root.btn_fast.onPress.apply(null);
}
if (Key.getCode() == 83) {
if (_root.btn_send._visible) {
_root.btn_send.onPress.apply(_root.btn_send);
}
}
if (Key.getCode() == 77) {
_root.btn_sound.onPress.apply(null);
}
if (((Key.getCode() == 52) && (_root.dlgprops != undefined)) && (_root.dlgprops.prop_line_priority != undefined)) {
switch (_root.dlgprops.itemobj.priority) {
case 1 :
_root.dlgprops.prop_line_priority.prop_line_pribtn2.onPress.apply(_root.dlgprops.prop_line_priority.prop_line_pribtn2);
break;
case 2 :
_root.dlgprops.prop_line_priority.prop_line_pribtn3.onPress.apply(_root.dlgprops.prop_line_priority.prop_line_pribtn3);
break;
case 3 :
_root.dlgprops.prop_line_priority.prop_line_pribtn4.onPress.apply(_root.dlgprops.prop_line_priority.prop_line_pribtn4);
break;
case 4 :
_root.dlgprops.prop_line_priority.prop_line_pribtn1.onPress.apply(_root.dlgprops.prop_line_priority.prop_line_pribtn1);
}
}
i = 0;
while (i < 5) {
if ((Key.getCode() == (49 + i)) && (_root.dlgprops != undefined)) {
_root.dlgprops["prop_line" + i].prop_upgrade.onPress.apply(_root.dlgprops["prop_line" + i].prop_upgrade);
}
i++;
}
if ((Key.getCode() == 82) && (_root.dlgprops != undefined)) {
_root.dlgprops.prop_line3.prop_downgrade.onPress.apply(_root.dlgprops.prop_line3.prop_downgrade);
}
if ((Key.getCode() == 84) && (_root.dlgprops != undefined)) {
_root.dlgprops.prop_line4.prop_downgrade.onPress.apply(_root.dlgprops.prop_line4.prop_downgrade);
}
}
Frame 7
_root.bigspace._x = -100 + (100 * Math.sin((Math.PI * _root.currframe) / 400));
_root.bigspace._y = -100 + (100 * Math.cos((Math.PI * _root.currframe) / 400));
for (c in _root) {
_root[c].removeMovieClip();
}
if (SPONSOR == 1) {
_root.attachMovie("gamesbutler_logo", "gamesbutler_logo", _root.getNextHighestDepth(), {_x:193, _y:26, _width:340, _height:133});
_root.gamesbutler_logo.onPress = function () {
getURL ("http://www.gamesbutler.com", "_blank");
};
}
stop();
_root.menu.onPress = function () {
var _local2;
_root.currframe = 0;
for (_local2 in _root) {
_root[_local2].removeMovieClip();
}
startsfx(12);
gotoAndPlay ("mainmenu");
};
_root.schomepage.onRollOver = function () {
this.filters = [glow_ach];
};
_root.schomepage.onRollOut = function () {
this.filters = undefined;
};
_root.schomepage.onPress = function () {
getURL ("http://www.smartcode.hu", "_blank");
};
_root.bigspace.onEnterFrame = function () {
_root.bigspace._x = -100 + (100 * Math.sin((Math.PI * _root.currframe) / 400));
_root.bigspace._y = -100 + (100 * Math.cos((Math.PI * _root.currframe) / 400));
_root.currframe++;
_root.about._alpha = 70 + Math.floor(Math.random() * 30);
};
Symbol 197 MovieClip [dlgerr] Frame 50
this.removeMovieClip();
Symbol 399 MovieClip [dlghelp] Frame 1
this.dlgbig_next.onPress = function () {
gotoAndStop (2);
};
this.btn_menu.onPress = function () {
_root.dlghelp.removeMovieClip();
};
stop();
Symbol 399 MovieClip [dlghelp] Frame 2
this.dlgbig_next.onPress = function () {
gotoAndStop (3);
};
this.btn_menu.onPress = function () {
_root.dlghelp.removeMovieClip();
};
stop();
Symbol 399 MovieClip [dlghelp] Frame 3
this.dlgbig_next.onPress = function () {
gotoAndStop (4);
};
this.btn_menu.onPress = function () {
_root.dlghelp.removeMovieClip();
};
stop();
Symbol 399 MovieClip [dlghelp] Frame 4
this.dlgbig_next.onPress = function () {
gotoAndStop (5);
};
this.btn_menu.onPress = function () {
_root.dlghelp.removeMovieClip();
};
stop();
Symbol 399 MovieClip [dlghelp] Frame 5
this.dlgbig_next.onPress = function () {
gotoAndStop (6);
};
this.btn_menu.onPress = function () {
_root.dlghelp.removeMovieClip();
};
stop();
Symbol 399 MovieClip [dlghelp] Frame 6
this.dlgbig_next.onPress = function () {
gotoAndStop (1);
};
this.btn_menu.onPress = function () {
_root.dlghelp.removeMovieClip();
};
stop();
Symbol 1801 MovieClip [__Packages.mochi.as2.MochiSync] Frame 0
class mochi.as2.MochiSync
{
var _syncContainer;
function MochiSync () {
_syncContainer = {};
}
function getProp(name) {
return(_syncContainer[name]);
}
function setProp(name, value) {
if (_syncContainer[name] == value) {
return(undefined);
}
_syncContainer[name] = value;
mochi.as2.MochiServices.send("sync_propUpdate", {name:name, value:value});
}
function triggerEvent(eventType, args) {
switch (eventType) {
case SYNC_REQUEST :
mochi.as2.MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY :
_syncContainer[args.name] = args.value;
}
}
static var SYNC_REQUEST = "SyncRequest";
static var SYNC_PROPERTY = "UpdateProperty";
}
Symbol 1802 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _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.8 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 _local6 = "_mochiservices_com_" + id;
var _local5 = new MovieClipLoader();
var _local3 = {};
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servURL) {
_servURL = urlOptions().servURL;
}
var _local4 = _servURL + _services;
if (urlOptions().servicesURL) {
_local4 = urlOptions().servicesURL;
}
allowDomains(_local4);
_clip = clip.createEmptyMovieClip(_local6, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
if (_local3.waitInterval != null) {
clearInterval(_local3.waitInterval);
}
_local3.onLoadError = loadError;
_local3.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_local3.onLoadComplete = function (target_mc) {
target_mc.MochiServices = mochi.as2.MochiServices;
};
_local3.startTime = getTimer();
_local3.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_local3.waitInterval = setInterval(_local3, "wait", 1000);
_local5.addListener(_local3);
_local5.loadClip((((((_local4 + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options)) + "&api_version=") + getVersion(), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
static function loadError(target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
disconnect();
onError.apply(null, [errorCode]);
}
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, 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.onEvent = function (pkg) {
switch (pkg.target) {
case "events" :
mochi.as2.MochiEvents.triggerEvent(pkg.event, pkg.args);
break;
case "coins" :
mochi.as2.MochiSocial.triggerEvent(pkg.event, pkg.args);
break;
case "sync" :
mochi.as2.MochiServices.servicesSync.triggerEvent(pkg.event, pkg.args);
}
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function updateCopy(args) {
send("coins_updateCopy", args, null, null);
}
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)) {
trace("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + methodName);
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 = {};
var _local6;
if (_root._url.indexOf("mochiad_options") != -1) {
var _local2 = (_root._url.indexOf("mochiad_options") + "mochiad_options".length) + 1;
_local6 = _root._url.substr(_local2, _root._url.length);
} else if (_root.mochiad_options) {
_local6 = _root.mochiad_options;
}
if (_local6) {
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 function setContainer(clip) {
}
static function stayOnTop(clip) {
}
static var _servURL = "http://www.mochiads.com/static/lib/services/";
static var _services = "services.swf";
static var _mochiLC = "MochiLC.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
static var servicesSync = new mochi.as2.MochiSync();
}
Symbol 1803 MovieClip [__Packages.mochi.as2.MochiEventDispatcher] Frame 0
class mochi.as2.MochiEventDispatcher
{
var eventTable;
function MochiEventDispatcher () {
eventTable = {};
}
function buildDelegate(thisObject, thatObject) {
var _local2 = {thisObject:thisObject, thatObject:thatObject};
if (thatObject != undefined) {
var funct = ((typeof(thatObject) == "string") ? (thisObject[thatObject]) : (thatObject));
_local2.delegate = function (args) {
funct.call(thisObject, args);
};
} else {
_local2.delegate = thisObject;
}
return(_local2);
}
function compareDelegate(d_A, d_B) {
if ((d_A.thisObject != d_B.thisObject) || (d_A.thatObject != d_B.thatObject)) {
return(false);
}
return(true);
}
function addEventListener(event, thisObject, thatObject) {
removeEventListener(event, thisObject, thatObject);
eventTable[event].push(buildDelegate(thisObject, thatObject));
}
function removeEventListener(event, thisObject, thatObject) {
var _local3 = buildDelegate(thisObject, thatObject);
if (eventTable[event] == undefined) {
eventTable[event] = [];
return(undefined);
}
for (var _local4 in eventTable[event]) {
if (!compareDelegate(eventTable[event][_local4], _local3)) {
continue;
}
eventTable[event].splice(Number(_local4), 1);
}
}
function triggerEvent(event, args) {
if (eventTable[event] == undefined) {
return(undefined);
}
for (var _local4 in eventTable[event]) {
eventTable[event][_local4].delegate(args);
}
}
}
Symbol 1804 MovieClip [__Packages.mochi.as2.MochiEvents] Frame 0
class mochi.as2.MochiEvents
{
function MochiEvents () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function startSession(achievementID) {
mochi.as2.MochiServices.send("events_beginSession", {achievementID:achievementID}, null, null);
}
static function setNotifications(clip, style) {
var _local2 = {};
for (var _local3 in style) {
_local2[_local3] = style[_local3];
}
_local2.clip = clip;
mochi.as2.MochiServices.send("events_setNotifications", _local2, null, null);
}
static function addEventListener(eventType, thisObject, thatObject) {
_dispatcher.addEventListener(eventType, thisObject, thatObject);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, thisObject, thatObject) {
_dispatcher.removeEventListener(eventType, thisObject, thatObject);
}
static function startPlay(tag) {
if (tag == undefined) {
tag = "gameplay";
}
mochi.as2.MochiServices.send("events_setRoundID", {tag:String(tag)}, null, null);
}
static function endPlay() {
mochi.as2.MochiServices.send("events_clearRoundID", null, null, null);
}
static function trackEvent(tag, value) {
mochi.as2.MochiServices.send("events_trackEvent", {tag:tag, value:value}, null, null);
}
static var ACHIEVEMENT_RECEIVED = "AchievementReceived";
static var ALIGN_TOP_LEFT = "ALIGN_TL";
static var ALIGN_TOP = "ALIGN_T";
static var ALIGN_TOP_RIGHT = "ALIGN_TR";
static var ALIGN_LEFT = "ALIGN_L";
static var ALIGN_CENTER = "ALIGN_C";
static var ALIGN_RIGHT = "ALIGN_R";
static var ALIGN_BOTTOM_LEFT = "ALIGN_BL";
static var ALIGN_BOTTOM = "ALIGN_B";
static var ALIGN_BOTTOM_RIGHT = "ALIGN_BR";
static var FORMAT_SHORT = "ShortForm";
static var FORMAT_LONG = "LongForm";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 1805 MovieClip [__Packages.mochi.as2.MochiSocial] Frame 0
class mochi.as2.MochiSocial
{
function MochiSocial () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showLoginWidget(options) {
mochi.as2.MochiServices.setContainer();
mochi.as2.MochiServices.stayOnTop();
mochi.as2.MochiServices.send("coins_showLoginWidget", {options:options});
}
static function hideLoginWidget() {
mochi.as2.MochiServices.send("coins_hideLoginWidget");
}
static function requestLogin() {
mochi.as2.MochiServices.send("coins_requestLogin");
}
static function getUserInfo() {
mochi.as2.MochiServices.send("coins_getUserInfo");
}
static function saveUserProperties(properties) {
mochi.as2.MochiServices.send("coins_saveUserProperties", properties);
}
static function addEventListener(eventType, delegate) {
_dispatcher.addEventListener(eventType, delegate);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, delegate) {
_dispatcher.removeEventListener(eventType, delegate);
}
static var LOGGED_IN = "LoggedIn";
static var LOGGED_OUT = "LoggedOut";
static var LOGIN_SHOW = "LoginShow";
static var LOGIN_HIDE = "LoginHide";
static var LOGIN_SHOWN = "LoginShown";
static var PROFILE_SHOW = "ProfileShow";
static var PROFILE_HIDE = "ProfileHide";
static var PROPERTIES_SAVED = "PropertySaved";
static var WIDGET_LOADED = "WidgetLoaded";
static var USER_INFO = "UserInfo";
static var ERROR = "Error";
static var IO_ERROR = "IOError";
static var NO_USER = "NoUser";
static var PROPERTIES_SIZE = "PropertiesSize";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 1806 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) {
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 1807 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 543 MovieClip [blast1] Frame 13
this.removeMovieClip();
Symbol 544 MovieClip [blast1short] Frame 11
this.removeMovieClip();
Symbol 579 MovieClip [blast2] Frame 17
this.removeMovieClip();
Symbol 614 MovieClip [blast3] Frame 17
this.removeMovieClip();
Symbol 657 MovieClip [fireboom] Frame 21
this.removeMovieClip();
Symbol 658 MovieClip [blast4] Frame 51
this.removeMovieClip();
Symbol 724 MovieClip [electricblast2] Frame 20
this.removeMovieClip();
Symbol 863 MovieClip [purplesparks] Frame 69
this.removeMovieClip();
Symbol 954 MovieClip [yellowsparks] Frame 19
this.removeMovieClip();
Symbol 985 MovieClip [cat1] Frame 1
stop();
Symbol 1012 MovieClip [cat2] Frame 1
stop();
Symbol 1032 MovieClip [cat3] Frame 1
stop();
Symbol 1050 MovieClip [cat4] Frame 1
stop();
Symbol 1562 MovieClip [radiusanim] Frame 15
this.removeMovieClip();
Symbol 1754 MovieClip Frame 53
stop();
Symbol 1760 MovieClip Frame 15
stop();
Symbol 1761 MovieClip Frame 15
stop();
Symbol 1762 MovieClip Frame 1
Stage.showMenu = false;
_root.stop();
Symbol 1762 MovieClip Frame 237
_root.play();