Combined Code
movieClip 4 node {
}
movieClip 7 {
}
movieClip 8 scoreup {
}
movieClip 10 {
}
movieClip 12 {
}
movieClip 16 buttonmaintext {
}
movieClip 18 outter {
}
frame 1 {
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
mb = '__mochibot__';
mbc = 'mochibot.com';
g = _global ? _global : _level0._root;
if (g[mb + swfid]) {
return g[mb + swfid];
}
s = System.security;
x = mc._root.getSWFVersion;
fv = x ? mc.getSWFVersion() : (_global ? 6 : 5);
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == 'localWithFile') {
return null;
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
u = 'http://' + mbc + '/my/core.swf?mv=7&fv=' + fv + '&v=' + escape(/:$version) + '&swfid=' + escape(swfid) + '&l=' + lv + '&f=' + mc + (sb ? '&sb=' + sb : '') + (trk ? '&t=1' : '');
lv = fv > 6 ? mc.getNextHighestDepth() : (g[mb + 'level'] ? g[mb + 'level'] + 1 : lv);
g[mb + 'level'] = lv;
if (fv == 5) {
res = '_level' + lv;
if (!eval(res)) {
loadMovieNum(u, lv);
}
return res;
}
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
return res;
}
function checkDomains() {
var v3 = true;
var v4 = _url;
var v1 = 0;
while (v1 < allowedDomains.length) {
var v2 = allowedDomains[v1];
if (checkDomain(v2, v4) == true) {
v3 = false;
}
++v1;
}
if (v3) {
failed();
} else {
passed();
}
}
function passed() {
play();
}
function failed() {
stop();
_root._y = 10000;
_root._x = 10000;
__com_mochibot__('4d4ef60d', this, 10301, true);
MochiAd.showPreGameAd({'id': '13fde46a0be7bdb3', 'res': '640x384', 'background': 10338291, 'color': 7902692, 'outline': 15659002, 'no_bg': true});
}
function checkDomain(checkDomain, url) {
var v2 = url.indexOf('://') + 3;
var v6 = url.indexOf('/', v2);
var v1 = url.substring(v2, v6);
if (v1.indexOf(':') > 0) {
v1 = v1.substring(0, v1.indexOf(':'));
}
var v5 = v1.lastIndexOf('.') - 1;
var v4 = v1.lastIndexOf('.', v5) + 1;
v1 = v1.substring(v4, v1.length);
if (v1 == checkDomain) {
return true;
} else {
return false;
}
}
var rversion = 1.1;
var soundsloaded = false;
MENU = new ContextMenu();
MENU.customItems.push(devfunc);
MENU.customItems.push(sponsorfunc);
MENU.builtInItems.zoom = false;
MENU.builtInItems.quality = true;
MENU.builtInItems.play = false;
MENU.builtInItems.loop = false;
MENU.builtInItems.rewind = false;
MENU.builtInItems.forward_back = false;
MENU.builtInItems.print = false;
devfunc = new ContextMenuItem('Game by voidSkipper and Krystal Nekoi', dev);
MENU.customItems.push(sponsorfunc);
MENU.customItems.push(devfunc);
_root.menu = MENU;
urlInd.text = _url;
var allowedDomains = ['armorgames.com'];
stop();
onEnterFrame = function () {
if (getBytesLoaded() != getBytesTotal()) {
preload.text = Math.round(getBytesLoaded()) + '/' + Math.round(getBytesTotal());
stop();
} else {
checkDomains();
onEnterFrame = null;
}
};
}
movieClip 389 __Packages.MochiAd {
#initclip
if (!_global.MochiAd) {
var v1 = function () {};
_global.MochiAd = v1;
var v2 = v1.prototype;
v1.getVersion = function () {
return '2.1';
};
v1.showPreGameAd = function (options) {
var v27 = {'clip': _root, 'ad_timeout': 3000, 'fadeout_time': 250, 'regpt': 'o', 'method': 'showPreloaderAd', 'color': 16747008, 'background': 16777161, 'outline': 13994812, 'ad_started': function () {
this.clip.stop();
}, 'ad_finished': function () {
this.clip.play();
}};
options = MochiAd._parseOptions(options, v27);
var clip = options.clip;
var v23 = 11000;
var v26 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)) {
options.ad_finished();
return undefined;
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var v14 = MochiAd._getRes(options);
var v4 = v14[0];
var v13 = v14[1];
mc._x = v4 * 0.5;
mc._y = v13 * 0.5;
var chk = mc.createEmptyMovieClip('_mochiad_wait', 3);
chk._x = v4 * -0.5;
chk._y = v13 * -0.5;
var v7 = chk.createEmptyMovieClip('_mochiad_bar', 4);
v7._x = 10;
v7._y = v13 - 20;
var v22 = options.color;
delete options.color;
var v19 = options.background;
delete options.background;
var v24 = options.outline;
delete options.outline;
var v5 = v7.createEmptyMovieClip('_outline', 1);
v5.beginFill(v19);
v5.moveTo(0, 0);
v5.lineTo(v4 - 20, 0);
v5.lineTo(v4 - 20, 10);
v5.lineTo(0, 10);
v5.lineTo(0, 0);
v5.endFill();
var v3 = v7.createEmptyMovieClip('_inside', 2);
v3.beginFill(v22);
v3.moveTo(0, 0);
v3.lineTo(v4 - 20, 0);
v3.lineTo(v4 - 20, 10);
v3.lineTo(0, 10);
v3.lineTo(0, 0);
v3.endFill();
v3._xscale = 0;
var v6 = v7.createEmptyMovieClip('_outline', 3);
v6.lineStyle(0, v24, 100);
v6.moveTo(0, 0);
v6.lineTo(v4 - 20, 0);
v6.lineTo(v4 - 20, 10);
v6.lineTo(0, 10);
v6.lineTo(0, 0);
chk.ad_msec = v23;
chk.ad_timeout = v26;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var v2 = 100 * (1 - (getTimer() - this.fadeout_start) / this.fadeout_time);
if (v2 > 0) {
this._parent._alpha = v2;
} else {
var v3 = this._parent._parent;
MochiAd.unload(v3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {};
mc.lc.adjustProgress = function (msec) {
var v2 = this.mc._mochiad_wait;
v2.server_control = true;
v2.started = getTimer();
v2.ad_msec = msec;
};
chk.onEnterFrame = function () {
var v6 = this._parent._parent;
var v12 = this._parent._mochiad_ctr;
var v5 = getTimer() - this.started;
var v3 = false;
var v4 = v6.getBytesTotal();
var v8 = v6.getBytesLoaded();
var v10 = 100 * v8 / v4;
var v11 = 100 * v5 / chk.ad_msec;
var v9 = this._mochiad_bar._inside;
var v2 = Math.min(100, Math.min(v10 || 0, v11));
v2 = Math.max(this.last_pcnt, v2);
this.last_pcnt = v2;
v9._xscale = v2;
if (!chk.showing) {
var v7 = v12.getBytesTotal();
if (v7 > 0 || typeof v7 == 'undefined') {
chk.showing = true;
chk.started = getTimer();
} else {
if (v5 > chk.ad_timeout) {
v3 = true;
}
}
}
if (v5 > chk.ad_msec) {
v3 = true;
}
if (v4 > 0 && v8 >= v4 && v3) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
};
v1.showInterLevelAd = function (options) {
var v13 = {'clip': _root, 'ad_timeout': 2000, 'fadeout_time': 250, 'regpt': 'o', 'method': 'showTimedAd', 'ad_started': function () {
this.clip.stop();
}, 'ad_finished': function () {
this.clip.play();
}};
options = MochiAd._parseOptions(options, v13);
var clip = options.clip;
var v10 = 11000;
var v12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)) {
options.ad_finished();
return undefined;
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var v5 = MochiAd._getRes(options);
var v14 = v5[0];
var v11 = v5[1];
mc._x = v14 * 0.5;
mc._y = v11 * 0.5;
var chk = mc.createEmptyMovieClip('_mochiad_wait', 3);
chk.ad_msec = v10;
chk.ad_timeout = v12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var v2 = 100 * (1 - (getTimer() - this.fadeout_start) / this.fadeout_time);
if (v2 > 0) {
this._parent._alpha = v2;
} else {
var v3 = this._parent._parent;
MochiAd.unload(v3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {};
mc.lc.adjustProgress = function (msec) {
var v2 = this.mc._mochiad_wait;
v2.server_control = true;
v2.started = getTimer();
v2.ad_msec = msec - 250;
};
chk.onEnterFrame = function () {
var v5 = this._parent._mochiad_ctr;
var v4 = getTimer() - this.started;
var v2 = false;
if (!chk.showing) {
var v3 = v5.getBytesTotal();
if (v3 > 0 || typeof v3 == 'undefined') {
chk.showing = true;
chk.started = getTimer();
} else {
if (v4 > chk.ad_timeout) {
v2 = true;
}
}
}
if (v4 > chk.ad_msec) {
v2 = true;
}
if (v2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
};
v1.showTimedAd = function (options) {
MochiAd.showInterLevelAd(options);
};
v1.showPreloaderAd = function (options) {
MochiAd.showPreGameAd(options);
};
v1._allowDomains = function (server) {
var v1 = ((server.split('/'))[2].split(':'))[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain('*');
System.security.allowDomain(v1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain('*');
System.security.allowInsecureDomain(v1);
}
}
return v1;
};
v1._loadCommunicator = function (options) {
var v26 = {'clip': _root, 'com_server': 'http://x.mochiads.com/com/1/', 'method': 'loadCommunicator', 'depth': 10337, 'id': '_UNKNOWN_'};
options = MochiAd._parseOptions(options, v26);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = MochiAd.getVersion();
var v18 = options.clip;
var v20 = '_mochiad_com_' + options.id;
if (!MochiAd._isNetworkAvailable()) {
return null;
}
if (v18[v20]) {
return v18[v20].lc;
}
var v21 = options.com_server + options.id;
MochiAd._allowDomains(v21);
delete options.id;
delete options.com_server;
var v25 = options.depth;
delete options.depth;
var v17 = v18.createEmptyMovieClip(v20, v25);
var v11 = v17.createEmptyMovieClip('_mochiad_com', 1);
for (var v15 in options) {
v11[v15] = options[v15];
}
var v6 = new LocalConnection();
var v16 = ['', Math.floor((new Date()).getTime()), random(999999)].join('_');
v6.mc = v17;
v6.name = v16;
v6.allowDomain = function (d) {
return true;
};
v6.allowInsecureDomain = v6.allowDomain;
v6.connect(v16);
v17.lc = v6;
v11.lc = v16;
v6._id = 0;
v6._queue = [];
v6.rpcResult = function (cb_arg) {
var v8 = parseInt(cb_arg);
var v4 = this._callbacks[v8];
if (!v4) {
return undefined;
}
delete this._callbacks[v8];
var v5 = [];
var v3 = 2;
while (v3 < v4.length) {
v5.push(v4[v3]);
++v3;
}
v3 = 1;
while (v3 < arguments.length) {
v5.push(arguments[v3]);
++v3;
}
var v6 = v4[1];
var v7 = v4[0];
if (v7 && typeof v6 == 'string') {
v6 = v7[v6];
}
if (v6) {
v6.apply(v7, v5);
}
};
v6._didConnect = function (endpoint) {
this._endpoint = endpoint;
var v4 = this._queue;
delete this._queue;
var v5 = this.doSend;
var v2 = 0;
while (v2 < v4.length) {
var v3 = v4[v2];
v5.apply(this, v3);
++v2;
}
};
v6.doSend = function (args, cbobj, cbfn) {
if (this._endpoint == null) {
var v4 = [];
var v3 = 0;
while (v3 < arguments.length) {
v4.push(arguments[v3]);
++v3;
}
this._queue.push(v4);
return undefined;
}
this._id += 1;
var v5 = this._id;
if (cbfn === undefined || cbfn === null) {
cbfn = cbobj;
}
this._callbacks[v5] = [cbobj, cbfn];
var v7 = new LocalConnection();
var v9 = v7.send(this._endpoint, 'rpc', v5, args);
};
v6._callbacks = {};
v6._callbacks[0] = [v6, '_didConnect'];
v11.st = getTimer();
v11.loadMovie(v21 + '.swf', 'POST');
return v6;
};
v1.fetchHighScores = function (options, callbackObj, callbackMethod) {
var v1 = MochiAd._loadCommunicator({'id': options.id});
if (!v1) {
return false;
}
var v4 = ['fetchHighScores', options];
v1.doSend(['fetchHighScores', options], callbackObj, callbackMethod);
return true;
};
v1.sendHighScore = function (options, callbackObj, callbackMethod) {
var v1 = MochiAd._loadCommunicator({'id': options.id});
if (!v1) {
return false;
}
var v4 = ['sendHighScore', options];
v1.doSend(['sendHighScore', options], callbackObj, callbackMethod);
return true;
};
v1.load = function (options) {
var v13 = {'clip': _root, 'server': 'http://x.mochiads.com/srv/1/', 'method': 'load', 'depth': 10333, 'id': '_UNKNOWN_'};
options = MochiAd._parseOptions(options, v13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = MochiAd.getVersion();
var v9 = options.clip;
if (!MochiAd._isNetworkAvailable()) {
return null;
}
if (v9._mochiad_loaded) {
return null;
}
var v12 = options.depth;
delete options.depth;
var v6 = v9.createEmptyMovieClip('_mochiad', v12);
var v11 = MochiAd._getRes(options);
options.res = v11[0] + 'x' + v11[1];
options.server += options.id;
delete options.id;
v9._mochiad_loaded = true;
var v4 = v6.createEmptyMovieClip('_mochiad_ctr', 1);
for (var v7 in options) {
v4[v7] = options[v7];
}
var v10 = v4.server;
delete v4.server;
var v14 = MochiAd._allowDomains(v10);
v6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var v5 = new LocalConnection();
var v8 = ['', Math.floor((new Date()).getTime()), random(999999)].join('_');
v5.mc = v6;
v5.name = v8;
v5.hostname = v14;
v5.allowDomain = function (d) {
return true;
};
v5.allowInsecureDomain = v5.allowDomain;
v5.connect(v8);
v6.lc = v5;
v4.lc = v8;
v4.st = getTimer();
v4.loadMovie(v10 + '.swf', 'POST');
return v6;
};
v1.unload = function (clip) {
if (typeof clip == 'undefined') {
clip = _root;
}
if (clip.clip && clip.clip._mochiad) {
clip = clip.clip;
}
if (!clip._mochiad) {
return false;
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return true;
};
v1._isNetworkAvailable = function () {
if (System.security) {
var v1 = System.security;
if (v1.sandboxType == 'localWithFile') {
return false;
}
}
return true;
};
v1._getRes = function (options) {
var v3 = options.clip.getBounds();
var v2 = 0;
var v1 = 0;
if (typeof options.res != 'undefined') {
var v4 = options.res.split('x');
v2 = parseFloat(v4[0]);
v1 = parseFloat(v4[1]);
} else {
v2 = v3.xMax - v3.xMin;
v1 = v3.yMax - v3.yMin;
}
if (v2 == 0 || v1 == 0) {
v2 = Stage.width;
v1 = Stage.height;
}
return [v2, v1];
};
v1._parseOptions = function (options, defaults) {
var v4 = {};
for (var v8 in defaults) {
v4[v8] = defaults[v8];
}
if (options) {
for (v8 in options) {
v4[v8] = options[v8];
}
}
if (_root.mochiad_options) {
var v5 = _root.mochiad_options.split('&');
var v2 = 0;
while (v2 < v5.length) {
var v3 = v5[v2].split('=');
v4[unescape(v3[0])] = unescape(v3[1]);
++v2;
}
}
return v4;
};
ASSetPropFlags(_global.MochiAd.prototype, null, 1);
}
#endinitclip
}
movieClip 390 __Packages.Node {
#initclip
if (!_global.Node) {
var v1 = function (x, y, xv, yv, self, b, f, r, s) {
this.x = x;
this.y = y;
this.xv = xv;
this.yv = yv;
this.self = self;
this.self._rotation = random(45);
this.self.cacheAsBitmap = true;
this.bounce = b;
this.friction = f;
this.r = r;
this.solid = s;
self._x = x;
self._y = y;
};
_global.Node = v1;
var v2 = v1.prototype;
v2.update = function (multiplier) {
if (!this.solid) {
if (_root.worldspeed > 0) {
this.yv += _root.gravity;
}
this.x += this.xv * multiplier;
this.y += this.yv * multiplier;
this.self._x = this.x;
this.self._y = this.y;
this.self.stop();
} else {
this.xv = 0;
this.yv = 0;
}
if (this != _root.connectpoint) {
this.self.gotoAndStop(1);
} else {
this.self.gotoAndStop(3);
}
};
ASSetPropFlags(_global.Node.prototype, null, 1);
}
#endinitclip
}
movieClip 391 __Packages.Constraint {
#initclip
if (!_global.Constraint) {
var v1 = function (a, b, len, tolerance) {
this.a = a;
this.b = b;
this.dlen = len;
this.tolerance = tolerance;
if (a.solid || b.solid) {
this.tolerance *= 6;
}
};
_global.Constraint = v1;
var v2 = v1.prototype;
v2.render = function () {
_root.cline.lineStyle(16, 8947848, 100);
_root.cline.moveTo(this.a.x, this.a.y);
_root.cline.lineTo(this.b.x, this.b.y);
_root.cline.lineStyle(8, 10066329, 100);
_root.cline.moveTo(this.a.x, this.a.y);
_root.cline.lineTo(this.b.x, this.b.y);
this.rednum = (Math.abs(this.dlen - this.alen) / this.tolerance) * 100;
_root.cline.lineStyle(16, 16711680, (this.rednum - 50) * 2);
_root.cline.moveTo(this.a.x, this.a.y);
_root.cline.lineTo(this.b.x, this.b.y);
};
v2.breakself = function (alen) {
if (alen > this.dlen + this.tolerance || alen < this.dlen - this.tolerance) {
this.tempx = this.a.x;
this.tempy = this.a.y;
this.tempxv = this.a.xv;
this.tempyv = this.a.yv;
this.olda = this.a;
this.a = _root.createNode(this.tempx, this.tempy, this.tempxv, this.tempyv, 0, 0.5, 0.5);
this.tolerance = 10000;
_root.createParticleSpray(this.a.x, this.a.y, 13434879, random(6) + 3, 10, 0, 360, 12, 5, 0.9, 0);
_root.killorphans(this.olda, this.b);
}
};
v2.update = function () {
this.xd = this.a.x + this.a.xv - (this.b.x + this.b.xv);
this.yd = this.a.y + this.a.yv - (this.b.y + this.b.yv);
this.alen = Math.sqrt(this.xd * this.xd + this.yd * this.yd);
this.breakself(this.alen);
if (this.a.y > _root.cam._y - 300 && this.a.y < _root.cam._y + 300) {
this.render();
} else {
if (this.b.y > _root.cam._y - 300 && this.b.y < _root.cam._y + 300) {
this.render();
}
}
if (_root.worldspeed > 0) {
this.dx = this.xd / this.alen;
this.dy = this.yd / this.alen;
this.force = (this.dlen - this.alen) * 0.5;
this.dxf = this.dx * this.force;
this.dyf = this.dy * this.force;
if (!this.a.solid && !this.b.solid) {
this.a.xv += this.dxf;
this.a.yv += this.dyf;
this.b.xv -= this.dxf;
this.b.yv -= this.dyf;
} else {
if (!this.a.solid && this.b.solid) {
this.a.xv += this.dxf;
this.a.yv += this.dyf;
} else {
if (this.a.solid && !this.b.solid) {
this.b.xv -= this.dxf;
this.b.yv -= this.dyf;
}
}
}
}
};
ASSetPropFlags(_global.Constraint.prototype, null, 1);
}
#endinitclip
}
movieClip 392 __Packages.Particle {
#initclip
if (!_global.Particle) {
var v1 = function (x, y, xv, yv, c, d, s, u) {
this.ox = x;
this.x = this.ox;
this.oy = y;
this.y = this.oy;
this.col = c;
this.decay = d - random(u) * 0.1;
this.str = s;
this.xv = xv;
this.yv = yv;
};
_global.Particle = v1;
var v2 = v1.prototype;
v2.update = function () {
this.str *= this.decay;
this.alp *= this.decay;
this.xv *= this.decay;
this.yv *= this.decay;
if (this.alp <= 5 || this.str < 2) {
return 'dead';
}
this.x += this.xv;
this.y += this.yv;
_root.particlemc.lineStyle(this.str, this.col, this.alp);
_root.particlemc.moveTo(this.ox, this.oy);
_root.particlemc.lineTo(this.x, this.y);
this.ox = this.x;
this.oy = this.y;
};
v2.alp = 100;
ASSetPropFlags(_global.Particle.prototype, null, 1);
}
#endinitclip
}
frame 2 {
stop();
}
movieClip 28 {
}
button 34 {
on (press) {
getURL('http://www.armorgames.com', '_blank');
}
}
movieClip 37 {
frame 1 {
_root.stop();
gotoAndPlay(2);
}
frame 218 {
_root.nextFrame();
}
}
frame 3 {
play();
}
movieClip 41 {
}
movieClip 47 {
}
frame 13 {
stop();
onMouseDown = function () {
play();
};
}
frame 17 {
onEnterFrame = function () {
if (instructionvid._currentframe == 1030) {
instructionvid.stop();
play();
}
};
instructionskip.onRelease = function () {
play();
};
}
movieClip 159 {
}
frame 22 {
stop();
}
frame 28 {
function dist(a, b, c, d) {
xd = a - c;
yd = b - d;
return Math.sqrt(xd * xd + yd * yd);
}
function createNode(x, y, xv, yv, r, b, f, s) {
nodes.push(new Node(x, y, xv, yv, attachMovie('node', 'Node:' + nodeid, _root.getNextHighestDepth(), {'_width': r * 2, '_height': r * 2}), b, f, r, s));
++nodeid;
return nodes[nodes.length - 1];
}
function constrainNodes(a, b, len, tolerance) {
return constraints.push(new Constraint(a, b, len, tolerance));
}
function updatesparkdoll() {
cline.clear();
i = 0;
while (i < nodes.length) {
nodes[i].update(worldspeed);
n = nodes[i];
if (n.y + n.r > 585) {
n.y = 585 - n.r;
n.yv = -Math.abs(n.yv * n.bounce);
n.xv *= n.friction;
}
++i;
}
i = 0;
while (i < constraints.length) {
constraints[i].update();
++i;
}
}
function dist(a, b, c, d) {
xd = a - c;
yd = b - d;
return Math.sqrt(xd * xd + yd * yd);
}
function makeparticle(x, y, col, speed, dir, strength, uniformity, decay) {
vx = Math.cos(dir) * speed;
vy = Math.sin(dir) * speed;
particles.push(new Particle(x, y, vx, vy, col, decay, strength, uniformity));
}
function createParticleSpray(x, y, col, density, speed, dir, spread, strength, uniformity, decay, diru) {
standardspread = spread / density;
if (spread == 360) {
rotaterand = random(50);
}
i = 0;
while (i < density) {
tempdir = (standardspread * i + dir + random(diru) - random(diru) + rotaterand) / 57.2957795130823;
makeparticle(x, y, col, speed, tempdir, strength, uniformity, decay);
++i;
}
}
function updateparticles() {
particlemc.clear();
j = 0;
while (j < particles.length) {
if (particles[j].update() == 'dead') {
delete particles[j];
particles.splice(j, 1);
--j;
}
++j;
}
}
function rhittest(r, ax, ay, bx, by) {
dx = ax - bx;
dy = ay - by;
dista = dx * dx + dy * dy;
len = r * r;
if (dista > len) {
return false;
} else {
return true;
}
}
function addjoint(x, y) {
createParticleSpray(x, y, 255, 8, 10, 0, 360, 10, 0, 0.9, 0);
var v3 = 450 - y;
if (v3 > scoreheight) {
pheight = Math.abs(Math.round(v3 - scoreheight));
score += pheight * scoremultiplier;
ptext = '+' + pheight.toString() + '!';
plusmc = attachMovie('scoreup', 'scoreup' + scoreups++, _root.getNextHighestDepth(), {'_x': x, '_y': y, 'plus': ptext});
plusmc.onEnterFrame = function () {
this.swapDepths(_root.getNextHighestDepth());
if (this._currentframe == 35) {
this.stop();
delete this.onEnterFrame;
this.swapDepths(_root.getNextHighestDepth());
this.removeMovieClip();
}
};
if (!freezemode && !speciallock) {
if (special + pheight <= specialmax) {
special += pheight;
return createNode(x, y, 0, 0, jointsize, jointbounce, jointfriction, false);
}
special = specialmax;
speciallock = true;
createParticleSpray(hud._x + 790, hud._y + 10, 4474111, 7, 5, 0, 360, 15, 0, 0.95, 0);
}
}
return createNode(x, y, 0, 0, jointsize, jointbounce, jointfriction, false);
}
function addfoundation(x, y) {
return createNode(x, y, 0, 0, jointsize, 0, 0, true);
}
function finddrawoffer() {
api.clear();
api.lineStyle(3, 255, 30);
drawfroms.splice(0);
i = 0;
while (i < nodes.length) {
if (rhittest(offerdrawl, _xmouse, _ymouse, nodes[i].x, nodes[i].y)) {
drawfroms.push(nodes[i]);
}
if (nodes[i].y > 540 && !gameending) {
gameending = true;
}
++i;
}
if (drawfroms.length > 0) {
place = true;
a = drawfroms;
found = new Object();
found.obj = undefined;
found.len = offerdrawl + 1;
i = 0;
while (i < a.length) {
chckdist = dist(_xmouse, _ymouse, a[i].x, a[i].y);
if (chckdist < found.len) {
found.obj = a[i];
found.len = chckdist;
}
++i;
}
if (!connectmode) {
if (found.len > snapl) {
api.moveTo(found.obj.x, found.obj.y);
api.lineTo(_xmouse, _ymouse);
} else {
found.obj.self.gotoAndStop(2);
}
} else {
if (dist(connectpoint.x, connectpoint.y, found.obj.x, found.obj.y) <= joindist) {
api.lineStyle(3, 65280, 30);
} else {
api.lineStyle(3, 16711680, 30);
}
api.moveTo(connectpoint.x, connectpoint.y);
api.lineTo(found.obj.x, found.obj.y);
}
} else {
place = false;
}
}
function mousethrow() {
if (connectmode) {
if (dist(connectpoint.x, connectpoint.y, found.obj.x, found.obj.y) <= joindist && dist(found.obj.x, found.obj.y, _xmouse, _ymouse) <= csnapl) {
if (connectpoint != found.obj) {
double = false;
i = 0;
while (i < constraints.length) {
if (constraints[i].a == connectpoint && constraints[i].b == found.obj) {
double = true;
break;
}
if (constraints[i].b == connectpoint && constraints[i].a == found.obj) {
double = true;
break;
}
++i;
}
if (!double) {
cooldown = cooldownmax;
createParticleSpray(found.obj.x, found.obj.y, 65280, 8, 10, 0, 360, 10, 0, 0.9, 0);
createParticleSpray(connectpoint.x, connectpoint.y, 65280, 8, 10, 0, 360, 10, 0, 0.9, 0);
constrainNodes(found.obj, connectpoint, dist(found.obj.x, found.obj.y, connectpoint.x, connectpoint.y), breakpoint);
}
}
}
connectmode = false;
connectpoint = undefined;
} else {
if (place) {
if (found.len < snapl) {
connectmode = true;
connectpoint = found.obj;
} else {
constrainNodes(found.obj, addjoint(_xmouse, _ymouse), found.len, breakpoint);
cooldown = cooldownmax;
connectmode = true;
connectpoint = nodes[nodes.length - 1];
}
} else {
connectmode = false;
connectpoint = undefined;
}
}
}
function countbolts() {
tempbolts = 0;
i = 0;
while (i < nodes.length) {
if (nodes[i].r > 0) {
++tempbolts;
}
++i;
}
return tempbolts;
}
function specialactivate() {
if (Key.isDown(32) && speciallock) {
freezemode = true;
worldspeed = 0;
hud.freezemarker._xscale = 150;
hud.freezemarker._yscale = 150;
}
}
function wallhittest(ax, ay, bx, by, cx, cy, r) {
var v1 = bx - ax;
var v2 = by - ay;
var v5 = v1 * v1 + v2 * v2;
u = ((cx - ax) * v1 + (cy - ay) * v2) / v5;
if (u < 1.0e-005 || u > 1) {
return false;
}
ix = ax + u * v1;
iy = ay + u * v2;
ixd = ix - cx;
iyd = iy - cy;
rawdist = ixd * ixd + iyd * iyd;
if (rawdist <= r * r) {
return true;
} else {
return false;
}
}
function finddelete() {
api.clear();
i = 0;
while (i < nodes.length) {
var v3 = false;
if (rhittest(joindist, _xmouse, _ymouse, nodes[i].x, nodes[i].y)) {
j = 0;
while (j < constraints.length) {
if (constraints[j].a == nodes[i] || constraints[j].b == nodes[i]) {
var v2 = constraints[j].a;
var v1 = constraints[j].b;
if (wallhittest(v2.x, v2.y, v1.x, v1.y, _xmouse, _ymouse, 8)) {
targetpylon = j;
api.lineStyle(16, 16777215, 50);
api.moveTo(v2.x, v2.y);
api.lineTo(v1.x, v1.y);
v3 = true;
break;
} else {
targetpylon = undefined;
}
}
++j;
}
}
if (v3) {
break;
}
++i;
}
}
function deletepylon() {
if (targetpylon != undefined) {
var v2 = constraints[targetpylon].a;
var v1 = constraints[targetpylon].b;
delete constraints[targetpylon];
constraints.splice(targetpylon, 1);
killorphans(v2, v1);
cooldown = cooldownmax;
}
}
function multipliers() {
if (special > specialmax * 0.75) {
hud.four._xscale = 150;
hud.four._yscale = 150;
hud.three._xscale = 100;
hud.three._xscale = 100;
hud.two._xscale = 100;
hud.two._yscale = 100;
scoremultiplier = 4;
} else {
if (special > specialmax * 0.5) {
hud.four._xscale = 100;
hud.four._yscale = 100;
hud.three._xscale = 150;
hud.three._xscale = 150;
hud.two._xscale = 100;
hud.two._yscale = 100;
scoremultiplier = 3;
} else {
if (special > specialmax * 0.25) {
hud.four._xscale = 100;
hud.four._yscale = 100;
hud.three._xscale = 100;
hud.three._xscale = 100;
hud.two._xscale = 150;
hud.two._yscale = 150;
scoremultiplier = 2;
} else {
hud.four._xscale = 100;
hud.four._yscale = 100;
hud.three._xscale = 100;
hud.three._xscale = 100;
hud.two._xscale = 100;
hud.two._yscale = 100;
scoremultiplier = 1;
}
}
}
}
function killorphans(a, b) {
af = false;
bf = false;
if (a.solid) {
af = true;
}
if (b.solid) {
bf = true;
}
i = 0;
while (i < constraints.length) {
if (af && bf) {
return undefined;
}
if (!af) {
if (constraints[i].a == a || constraints[i].b == a) {
af = true;
}
}
if (!bf) {
if (constraints[i].a == b || constraints[i].b == b) {
bf = true;
}
}
++i;
}
if (!af || !bf) {
i = 0;
while (i < nodes.length) {
if (nodes[i] == a && !af) {
if (found.obj == a) {
found.obj = undefined;
connectmode = false;
place = false;
}
a.self.removeMovieClip();
nodes.splice(i, 1);
af = true;
}
if (nodes[i] == b && !bf) {
if (found.obj == b) {
found.obj = undefined;
connectmode = false;
place = false;
}
b.self.removeMovieClip();
nodes.splice(i, 1);
bf = true;
}
if (af && bf) {
break;
}
++i;
}
}
}
function updatetower() {
if (!gamepaused && !gameend) {
if (Key.isDown(80) && getTimer() - pausetime > 200) {
pausetime = getTimer();
gamepaused = true;
}
multipliers();
if (cooldown < cooldownmax) {
hud.cooldownbar._xscale = 100 - (cooldown / cooldownmax) * 100;
}
if (cooldown > 0) {
--cooldown;
}
if (freezemode) {
special -= 2;
if (special < 2) {
special = 0;
freezemode = false;
worldspeed = worldspeedset;
speciallock = false;
hud.freezemarker._xscale = 100;
hud.freezemarker._yscale = 100;
}
} else {
specialactivate();
}
hud.specialbar._xscale = (special / specialmax) * 100;
if (!speciallock) {
special *= specialdecay;
hud.specialbar._alpha = 30;
hud.freezemarker._alpha = 10;
} else {
hud.specialbar._alpha = 80;
hud.freezemarker._alpha = 30;
}
updatesparkdoll();
if (!Key.isDown(16)) {
finddrawoffer();
} else {
found.obj = undefined;
connectmode = false;
place = false;
finddelete();
}
updateparticles();
crane.swapDepths(getNextHighestDepth());
clouds.swapDepths(getNextHighestDepth());
api.swapDepths(getNextHighestDepth());
hud.swapDepths(getNextHighestDepth());
if (gameending && gametimeout > 0) {
--gametimeout;
} else {
if (gameending && gametimeout <= 0) {
gameend = true;
}
}
} else {
if (gameend) {
connectpoint = undefined;
api.removeMovieClip();
animatepoints();
updatesparkdoll();
updateparticles();
if (!scorecont._visible) {
scorecont._visible = true;
}
scorecont.swapDepths(getNextHighestDepth());
if (scorecont._alpha < 100) {
scorecont._alpha += 5;
}
if (hud._alpha > 50) {
hud._alpha -= 5;
} else {
hud.unloadMovie();
}
} else {
if (gamepaused) {
if (Key.isDown(80) && getTimer() - pausetime > 200) {
pausetime = getTimer();
gamepaused = false;
}
}
}
}
}
function cleanupworld() {
gameend = true;
cline.removeMovieClip();
api.removeMovieClip();
i = 0;
while (i < nodes.length) {
nodes[i].self.removeMovieClip();
delete nodes[i];
++i;
}
nodes.splice(0);
i = 0;
while (i < constraints.length) {
delete constraints[i];
++i;
}
constraints.splice(0);
scorecont.removeMovieClip();
particlemc.removeMovieClip();
i = 0;
while (i < particles.length) {
delete particles[i];
++i;
}
particles.splice(0);
drawfroms.splice(0);
clouds.removeMovieClip();
crane.removeMovieClip();
hud.removeMovieClip();
}
function camupdate() {
scorecont._y = cam._y - 5;
hud._y = cam._y - 273;
hud._x = cam._x - 425;
crane._y = cam._y * -0.15 + 100;
fence._y = cam._y * 0.15 + 350;
factories._y = cam._y * 0.25 - 80;
city._y = cam._y * 0.35 + 100;
higher = false;
i = 0;
while (i < nodes.length) {
if (nodes[i].y < maxheight) {
maxheight = nodes[i].y;
higher = true;
}
++i;
}
if (!higher) {
maxheight = 450;
i = 0;
while (i < nodes.length) {
if (nodes[i].y < maxheight) {
maxheight = nodes[i].y;
higher = true;
}
++i;
}
}
background._y = cam._y * 0.5 - 37.3;
endscreen._y = cam._y;
if (_ymouse > cam._y + 200 || _ymouse < cam._y - 200) {
cam._y += (_ymouse - cam._y) * 0.03;
}
findheight();
if (cam._y + halfheight > 600) {
cam._y = 300;
}
if (maxheight < 0) {
if (cam._y - halfheight < maxheight - 350) {
cam._y = maxheight - 50;
}
} else {
if (cam._y - halfheight < -350) {
cam._y = -50;
}
}
}
function scoreupdate() {
amax = 450 - maxheight;
if (amax > scoreheight) {
scoreheight = Math.round(amax);
}
}
var constraints = new Array();
var nodes = new Array();
var nodeid = 0;
var worldspeedset = 0.2;
var worldspeed = 0.2;
var gravity = 0.7;
var cline = createEmptyMovieClip('constraintline', _root.getNextHighestDepth());
var particles = new Array();
var particlemc = createEmptyMovieClip('particle', _root.getNextHighestDepth());
var drawfroms = new Array();
var soundholder = createEmptyMovieClip('bgm', _root.getNextHighestDepth());
if (!soundsloaded) {
soundholder.loadMovie('http://games.mochiads.com/c/g/insurgo/bgm.swf');
soundsloaded = true;
}
var offerdrawl = 115;
var joindist = 250;
var snapl = 30;
var api = createEmptyMovieClip('api', _root.getNextHighestDepth());
var place = false;
var jointsize = 8;
var jointbounce = 0.6;
var jointfriction = 0.8;
var breakpoint = 25;
var connectmode = false;
var connectpoint;
var cooldown = 15;
var cooldownmax = 15;
var gamepaused = false;
var gameend = false;
var gameending = false;
var gametimeout = 150;
var scoreups = 0;
var special = 0;
var specialdecay = 0.999;
var specialmax = 800;
var speciallock = false;
var freezemode = false;
var targetpylon = undefined;
var scoremultiplier = 0;
var score = 0;
var pausetime = 0;
scorecont._visible = false;
scorecont._alpha = 0;
onMouseDown = function () {
if (!gameend && !gameending && cooldown == 0 && !gamepaused) {
if (!Key.isDown(16)) {
mousethrow();
} else {
deletepylon();
}
}
};
scorecont.restartbutton.onRelease = function () {
if (gameend) {
cleanupworld();
_root.gotoAndPlay('pregame');
}
};
stop();
maxheight = 600;
higher = false;
scoreheight = 0;
endscreen._visible = false;
endscreen._alpha = 0;
addfoundation(400, 450);
addfoundation(600, 450);
halfheight = 300;
onEnterFrame = function () {
if (Key.isDown(77)) {
stopAllSounds();
}
camupdate();
updatetower();
scoreupdate();
};
}
movieClip 166 {
}
movieClip 168 {
frame 1 {
function camControl() {
parentColor.setTransform(camColor.getTransform());
var v4 = sX / this._width;
var v3 = sY / this._height;
_parent._x = cX - this._x * v4;
_parent._y = cY - this._y * v3;
_parent._xscale = 100 * v4;
_parent._yscale = 100 * v3;
}
function resetStage() {
var v2 = {'ra': 100, 'rb': 0, 'ga': 100, 'gb': 0, 'ba': 100, 'bb': 0, 'aa': 100, 'ab': 0};
parentColor.setTransform(v2);
_parent._xscale = 100;
_parent._yscale = 100;
_parent._x = 0;
_parent._y = 0;
}
this._visible = false;
var oldMode = Stage.scaleMode;
Stage.scaleMode = 'exactFit';
var cX = Stage.width / 2;
var cY = Stage.height / 2;
var sX = Stage.width;
var sY = Stage.height;
Stage.scaleMode = oldMode;
var camColor = new Color(this);
var parentColor = new Color(_parent);
this.onEnterFrame = camControl;
camControl();
this.onUnload = resetStage;
}
}
movieClip 338 {
}
movieClip 340 {
}
movieClip 342 {
}
movieClip 344 {
}
movieClip 346 {
}
movieClip 349 {
}
movieClip 362 {
}
movieClip 364 {
}
movieClip 366 {
}
movieClip 368 {
}
movieClip 370 {
}
movieClip 373 {
}
movieClip 374 {
}
movieClip 377 {
}
movieClip 380 {
}
movieClip 383 {
}
movieClip 386 {
}
movieClip 388 {
}