Frame 1
stop();
mochi.as2.MochiAd.showPreGameAd({id:"423f30003a49e639", res:"640x480"});
mochi.as2.MochiServices.connect("423f30003a49e639");
Frame 201
var score = 0;
var muted = false;
var gamemode = 0;
var selectedmap = 0;
var homepage = "http://www.flashninjaclan.com/qqq2_strategy_games.php";
var sound = new Sound(_root);
sound.setVolume(40);
var hcm = new ContextMenu();
hcm.hideBuiltInItems();
_root.menu = hcm;
stop();
Instance of Symbol 143 MovieClip in Frame 201
on (release) {
getURL ("http://www.java-gaming.com", "_blank");
}
Instance of Symbol 145 MovieClip in Frame 201
on (release) {
getURL ("http://www.flashninjaclan.com", "_blank");
}
Frame 202
stop();
Frame 203
function playMode(n) {
_root.gamemode = n;
nextFrame();
}
stop();
map1.onRollOver = (map2.onRollOver = (map3.onRollOver = (map4.onRollOver = function () {
eval ("mc" + this._name).gotoAndStop(2);
})));
map1.onRollOut = (map2.onRollOut = (map3.onRollOut = (map4.onRollOut = function () {
eval ("mc" + this._name).gotoAndStop(1);
})));
map1.onPress = (map2.onPress = (map3.onPress = (map4.onPress = function () {
switch (this._name) {
case "map1" :
_root.selectedmap = 0;
break;
case "map2" :
_root.selectedmap = 1;
break;
case "map3" :
_root.selectedmap = 2;
break;
case "map4" :
_root.selectedmap = 3;
}
nextFrame();
})));
Instance of Symbol 159 MovieClip "mcmap2" in Frame 203
onClipEvent (mouseDown) {
if ((this._currentframe == 1) && (this.hitTest(_root.supermarker))) {
this.gotoAndStop(6);
_root.selectedmap = 1;
_root.gotoAndStop("diff");
_root.supermarker.swapDepths(9999);
_root.supermarker.removeMovieClip();
}
}
Instance of Symbol 163 MovieClip "mcmap3" in Frame 203
onClipEvent (mouseDown) {
if ((this._currentframe == 1) && (this.hitTest(_root.supermarker))) {
this.gotoAndStop(6);
_root.selectedmap = 2;
_root.gotoAndStop("diff");
_root.supermarker.swapDepths(9999);
_root.supermarker.removeMovieClip();
}
}
Instance of Symbol 168 MovieClip "mcmap4" in Frame 203
onClipEvent (mouseDown) {
if ((this._currentframe == 1) && (this.hitTest(_root.supermarker))) {
this.gotoAndStop(6);
_root.selectedmap = 3;
_root.gotoAndStop("diff");
_root.supermarker.swapDepths(9999);
_root.supermarker.removeMovieClip();
}
}
Instance of Symbol 172 MovieClip "mcmap1" in Frame 203
onClipEvent (mouseDown) {
if ((this._currentframe == 1) && (this.hitTest(_root.supermarker))) {
this.gotoAndStop(6);
_root.selectedmap = 0;
_root.gotoAndStop("diff");
_root.supermarker.swapDepths(9999);
_root.supermarker.removeMovieClip();
}
}
Instance of Symbol 174 MovieClip "supermarker" in Frame 203
onClipEvent (load) {
this._visible = false;
startDrag (this, true);
}
Frame 205
function closeDialogs() {
if (imarker != null) {
overlay.dialogcancel.hide();
}
overlay.dialogenemy.hide();
overlay.dialoginfo.hide();
overlay.dialogitem.hide();
overlay.dialogreturn.hide();
}
function init() {
var _local3 = 5;
var _local6;
var _local5;
var _local4;
score = 0;
closeDialogs();
map = attachMovie("mapcontainer", "mapcontainer", this.getNextHighestDepth());
map._x = 5;
map._y = 15;
map.swapDepths(overlay);
map.gotoAndStop(selectedmap + 1);
mapW = map._width;
mapH = map._height;
tilesW = tiles[0].length;
tilesH = tiles.length;
megamap = _root.createEmptyMovieClip("mmap", _root.getNextHighestDepth());
cursor = map.attachMovie("cursor", "cursor", _local3++);
mcstatics = map.createEmptyMovieClip("statics", _local3++);
mcenemies = map.createEmptyMovieClip("enemies", _local3++);
mcfriends = map.createEmptyMovieClip("friends", _local3++);
mcweapons = map.createEmptyMovieClip("weapons", _local3++);
if (selectedmap == 0) {
bx = 7;
by = 11;
ex1 = 3;
ey1 = 0;
ex2 = 20;
ey2 = 0;
tilewidth = 21;
tileheight = 13;
money = 1200;
entryX = 75;
entryY = 0;
entryX1 = 585;
entryY1 = 0;
} else if (selectedmap == 1) {
bx = 18;
by = 11;
ex1 = 17;
ey1 = 0;
tilewidth = 21;
tileheight = 13;
entryX = 495;
entryY = 0;
} else if (selectedmap == 2) {
bx = 19;
by = 11;
ex1 = 4;
ey1 = 0;
ex2 = 0;
ey2 = 9;
tilewidth = 21;
tileheight = 13;
money = 1200;
entryX = 105;
entryY = 0;
entryX1 = 0;
entryY1 = 255;
} else if (selectedmap == 3) {
bx = 20;
by = 11;
ex1 = 4;
ey1 = 0;
tilewidth = 21;
tileheight = 13;
entryX = 105;
entryY = 0;
}
_local3 = 0;
while (_local3 < 7) {
_local4 = overlay["item" + _local3];
_local4.id = _local3;
_local4.onRollOver = itemMarkerOver;
_local4.onRollOut = itemMarkerOut;
_local4.onPress = itemMarkerMove;
_local4.cacheAsBitmap = true;
overlay["price" + _local3].text = itemPrice[_local3];
_local3++;
}
megamap.cacheAsBitmap = true;
megamap._alpha = 0;
overlay.map._width = 65;
overlay.map._height = 62;
if (gamemode == 1) {
(waveMax = 40);
_local3 = 0;
while (_local3 < waveMax) {
enemyHealth[_local3] = Math.floor(enemyHealth[_local3] * 0.6);
_local3++;
}
} else if (gamemode == 2) {
(waveMax = 50);
_local3 = 0;
while (_local3 < waveMax) {
enemyHealth[_local3] = Math.floor(enemyHealth[_local3] * 0.75);
_local3++;
}
} else if (gamemode == 3) {
waveMax = 1000;
_local3 = 0;
while (_local3 < 59) {
enemyHealth[_local3++] = enemyHealth[_local3++] * 0.95;
}
_local3 = 60;
while (_local3 < waveMax) {
enemyCount.push(enemyCount[_local3 - 60]);
enemyDesign.push(enemyDesign[_local3 - 60]);
enemyDelay.push(enemyDelay[_local3 - 60]);
enemySpeed.push(enemySpeed[_local3 - 60] * 1.02);
Math.floor(enemyHealth.push(enemyHealth[_local3 - 1] * 1.06));
if (enemyDesign[_local3] == 6) {
enemyHealth[_local3] = enemyHealth[_local3] * 0.6;
enemySpeed[_local3] = 2.5;
}
Math.floor((enemyHealth[_local3 - 1] = enemyHealth[_local3 - 1] * 0.9));
Math.floor(enemyMoney.push(enemyMoney[_local3 - 1] * 1.03));
enemyDamage.push(enemyDamage[_local3 - 60] + 6);
_local3++;
}
}
changeBalance(0);
onEnterFrame = main;
overlay.btnNextWave.gotoAndStop(2);
}
function MinspawnEnemy(posx, posy, Speed, health, Money) {
var _local3 = mcenemies.attachMovie("enemy", "e" + mcenemies.getNextHighestDepth(), mcenemies.getNextHighestDepth(), {_x:posx, _y:posy});
_local3.dx = 0;
_local3.dy = 1;
_local3.speed = Speed;
_local3.money = Money;
_local3.damage = 1;
_local3.health = (_local3.healthInit = health);
_local3.gotoAndStop(7);
_local3.onPress = function () {
if (paused) {
return(undefined);
}
closeDialogs();
overlay.dialogenemy.show();
selectedEnemy = this;
this.filters = new Array(new flash.filters.GlowFilter(3394815, 0.8, 10, 10, 3, 3, false, false));
overlay.dialogenemy.money.text = this.money;
overlay.dialogenemy.speed.text = this.speed;
overlay.dialogenemy.damage.text = this.damage;
_root.onMouseDown = function () {
delete this.onMouseDown;
selectedEnemy.filters = new Array();
overlay.dialogenemy.hide();
};
};
enemyLeft++;
enemies.push(_local3);
}
function main() {
var _local4;
var _local3;
var _local8;
var _local5;
var _local2;
if (_root._ymouse > 390) {
imarker.stopDrag();
imarker._visible = false;
} else {
imarker.startDrag(true);
imarker._visible = true;
}
if ((money < 0) || (money == undefined)) {
money = 0;
}
if (!minimoving) {
if (Key.isDown(32) && (imarker != null)) {
itemMarkerCleanup();
}
}
tileX = Math.floor(map._xmouse / 30);
tileY = Math.floor(map._ymouse / 30);
cursor._x = tileX * 30;
cursor._y = tileY * 30;
cursor.gotoAndStop(((tiles[tileY][tileX] == 0) ? 1 : 2));
if (paused) {
return(undefined);
}
if (((waveLeft--) == 0) && (wave != waveMax)) {
nextWave();
}
waveSeconds = Math.floor(waveLeft / 30);
if (enemyMake > 0) {
if ((waveSkip--) < 0) {
spawnEnemy();
waveSkip = enemyDelay[wave];
}
}
if (waveTimeout > 0) {
if ((--waveTimeout) == 0) {
overlay.btnNextWave.gotoAndStop(2);
}
}
_local3 = 0;
while (_local3 < friends.length) {
if (friends[_local3].valueOf() == undefined) {
friends[_local3] = friends[friends.length - 1];
friends.pop();
}
_local2 = friends[_local3];
if (friends[_local3].waiting > 0) {
friends[_local3].waiting--;
}
if (_local2.working > 0) {
_local2.xin["red_bar" + _local2.level]._yscale = 100 - (100 * ((_local2.working--) / upgradeBuildDelay[_local2.id][_local2.level - 1]));
if (_local2.working == 0) {
if (_local2.id == 6) {
j = 0;
while (j < friends.length) {
if ((((_local2._x - friends[j]._x) * (_local2._x - friends[j]._x)) + ((_local2._y - friends[j]._y) * (_local2._y - friends[j]._y))) <= (_local2.range * _local2.range)) {
if (friends[j].id != 6) {
friends[j].attack = friends[j].attack + Math.floor(friends[j].attack * 0.09);
} else if (friends[j].id == 6) {
}
}
j++;
}
} else {
k = 0;
while (k < friends.length) {
llm = friends[k];
if (llm.id == 6) {
if ((((_local2._x - llm._x) * (_local2._x - llm._x)) + ((_local2._y - llm._y) * (_local2._y - llm._y))) <= (llm.range * llm.range)) {
if (_local2.level == 1) {
_local2.attack = _local2.attack * 1.1;
} else if (_local2.id == 0) {
_local2.attack = _local2.attack + Math.ceil((upgradeAttack[_local2.id][_local2.level - 1] * llm.level) / 9);
_local2.attack = Math.floor(_local2.attack);
} else if (_local2.id == 1) {
_local2.attack = _local2.attack + Math.ceil((upgradeAttack[_local2.id][_local2.level - 1] * llm.level) / 8.8);
_local2.attack = Math.floor(_local2.attack);
} else if ((_local2.id == 2) || (_local2.id == 3)) {
_local2.attack = _local2.attack + Math.ceil((upgradeAttack[_local2.id][_local2.level - 1] * llm.level) / 8.3);
_local2.attack = Math.floor(_local2.attack);
} else if (_local2.id == 4) {
_local2.attack = _local2.attack + Math.ceil((upgradeAttack[_local2.id][_local2.level - 1] * llm.level) / 8.9);
_local2.attack = Math.floor(_local2.attack);
} else if (_local2.id == 5) {
_local2.attack = _local2.attack + Math.ceil((upgradeAttack[_local2.id][_local2.level - 1] * llm.level) / 6.7);
_local2.attack = Math.floor(_local2.attack);
}
}
}
k++;
}
}
_local2.xin.hide();
_local2.leveltxt._visible = true;
playSound(4);
}
}
_local3++;
}
_local3 = 0;
while (_local3 < enemies.length) {
if (enemies[_local3].health < 1) {
if (enemies[_local3]._currentframe == 2) {
MinspawnEnemy(enemies[_local3]._x, enemies[_local3]._y, enemies[_local3].speed, int(enemies[_local3].healthInit / 15), enemies[_local3].money);
MinspawnEnemy(enemies[_local3]._x + 3, enemies[_local3]._y + 3, enemies[_local3].speed, int(enemies[_local3].healthInit / 15), enemies[_local3].money);
MinspawnEnemy(enemies[_local3]._x - 3, enemies[_local3]._y - 3, enemies[_local3].speed, int(enemies[_local3].healthInit / 15), enemies[_local3].money);
MinspawnEnemy(enemies[_local3]._x - 3, enemies[_local3]._y + 3, enemies[_local3].speed, int(enemies[_local3].healthInit / 15), enemies[_local3].money);
}
if (enemies[_local3] == selectedEnemy) {
overlay.dialogenemy.hide();
}
changeBalance(enemies[_local3].money);
score = score + enemies[_local3].healthInit;
enemies[_local3].mark.removeMovieClip();
enemies[_local3].gotoAndPlay(8);
enemies.splice(_local3, 1);
enemyLeft--;
playSound(3);
if (((wave == waveMax) && (enemies.length == 0)) && (enemyMake == 0)) {
gameOverAndGoto(8);
}
if (wave > waveMax) {
gameOverAndGoto(8);
}
}
_local2 = enemies[_local3];
_local4 = _local2.speed;
if (_local2 == selectedEnemy) {
overlay.dialogenemy.health.text = (Math.floor(_local2.health) + "/") + Math.floor(_local2.healthInit);
}
if (_local2.poisoned > 0) {
_local2.poisoned--;
_local2.health = _local2.health - _local2.poisonedBy;
} else if ((new flash.geom.Transform(_local2)).colorTransform.greenOffset == 70) {
(new flash.geom.Transform(_local2)).colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (_local2.slowed > 0) {
_local2.slowed--;
_local4 = _local4 - (_local4 * _local2.slowedBy);
} else if ((new flash.geom.Transform(_local2)).colorTransform.blueOffset == 120) {
(new flash.geom.Transform(_local2)).colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
_local2.healthbar.bar._xscale = 100 * (_local2.health / _local2.healthInit);
_local8 = _local2._x + (_local2.dx * _local4);
_local5 = _local2._y + (_local2.dy * _local4);
if (!megamap.hitTest((15 * _local2.dx) + _local8, (15 * _local2.dy) + _local5, true)) {
if ((_local5 + (15 * _local2.dy)) > mapH) {
health = health - _local2.damage;
playSound(6);
_local8 = entryX;
_local5 = entryY;
_local2.dx = 0;
_local2.dy = 1;
} else {
_local8 = (Math.floor(_local8 / 30) * 30) + 15;
_local5 = (Math.floor(_local5 / 30) * 30) + 15;
_local2.dx = ((_local2.dx == 0) ? ((megamap.hitTest(_local8 - 55, _local5, true) ? -1 : 1)) : 0);
_local2.dy = ((_local2.dy == 0) ? ((megamap.hitTest(_local8, _local5 - 55, true) ? -1 : 1)) : 0);
_local2.mc._xscale = Math.abs(_local2.mc._xscale) * (-(_local2.dx + _local2.dy));
}
}
if (enemies[_local3]._currentframe != 6) {
enemies[_local3].xx = false;
enemies[_local3].yy = false;
if (enemies[_local3].finded) {
if (enemies[_local3].xx == false) {
if (enemies[_local3].xvmap[enemies[_local3].xy] < enemies[_local3].xvmap[enemies[_local3].xy + 1]) {
if (enemies[_local3]._x >= enemies[_local3].xvmap[enemies[_local3].xy + 1]) {
enemies[_local3].xx = true;
} else if (map.hei.hitTest(enemies[_local3]._x, enemies[_local3]._y, true)) {
enemies[_local3]._x = enemies[_local3]._x + (_local4 * 0.4);
} else {
enemies[_local3]._x = enemies[_local3]._x + _local4;
}
}
if (enemies[_local3].xvmap[enemies[_local3].xy] > enemies[_local3].xvmap[enemies[_local3].xy + 1]) {
if (enemies[_local3]._x <= enemies[_local3].xvmap[enemies[_local3].xy + 1]) {
enemies[_local3].xx = true;
} else if (map.hei.hitTest(enemies[_local3]._x, enemies[_local3]._y, true)) {
enemies[_local3]._x = enemies[_local3]._x - (_local4 * 0.4);
} else {
enemies[_local3]._x = enemies[_local3]._x - _local4;
}
}
if (enemies[_local3].xvmap[enemies[_local3].xy] == enemies[_local3].xvmap[enemies[_local3].xy + 1]) {
enemies[_local3].xx = true;
}
}
if (enemies[_local3].yy == false) {
if (enemies[_local3].yvmap[enemies[_local3].xy] < enemies[_local3].yvmap[enemies[_local3].xy + 1]) {
if (enemies[_local3]._y >= enemies[_local3].yvmap[enemies[_local3].xy + 1]) {
enemies[_local3].yy = true;
} else if (map.hei.hitTest(enemies[_local3]._x, enemies[_local3]._y, true)) {
enemies[_local3]._y = enemies[_local3]._y + (_local4 * 0.4);
} else {
enemies[_local3]._y = enemies[_local3]._y + _local4;
}
}
if (enemies[_local3].yvmap[enemies[_local3].xy] > enemies[_local3].yvmap[enemies[_local3].xy + 1]) {
if (enemies[_local3]._y <= enemies[_local3].yvmap[enemies[_local3].xy + 1]) {
enemies[_local3].yy = true;
} else if (map.hei.hitTest(enemies[_local3]._x, enemies[_local3]._y, true)) {
enemies[_local3]._y = enemies[_local3]._y - (_local4 * 0.4);
} else {
enemies[_local3]._y = enemies[_local3]._y - _local4;
}
}
if (enemies[_local3].yvmap[enemies[_local3].xy] == enemies[_local3].yvmap[enemies[_local3].xy + 1]) {
enemies[_local3].yy = true;
}
}
if (enemies[_local3].xx && (enemies[_local3].yy)) {
enemies[_local3].xy++;
enemies[_local3].xx = false;
enemies[_local3].yy = false;
}
} else {
tt(enemies[_local3]);
}
} else {
var _local6 = enemies[_local3]._x - map.fang._x;
var _local7 = enemies[_local3]._y - map.fang._y;
var _local10 = Math.sqrt((_local6 * _local6) + (_local7 * _local7));
var _local11 = _local6 / _local10;
var _local12 = _local7 / _local10;
if (enemies[_local3].slowed > 0) {
enemies[_local3]._x = enemies[_local3]._x - (1.25 * _local11);
enemies[_local3]._y = enemies[_local3]._y - (1.25 * _local12);
} else {
enemies[_local3]._x = enemies[_local3]._x - (2 * _local11);
enemies[_local3]._y = enemies[_local3]._y - (2 * _local12);
}
}
if (enemies[_local3].hitTest(map.fang) && ((enemies[_local3].health > 0) || (enemies[_local3].health == undefined))) {
health = health - _local2.damage;
playSound(6);
enemies[_local3].mark.removeMovieClip();
enemies[_local3].gotoAndPlay(8);
enemies.splice(_local3, 1);
enemyLeft--;
}
if ((enemies[_local3] != undefined) && (enemies[_local3] != null)) {
_local4 = 0;
while (_local4 < friends.length) {
_local2 = friends[_local4];
var _local6 = enemies[_local3]._x - _local2._x;
var _local7 = enemies[_local3]._y - _local2._y;
var _local9 = (_local6 * _local6) + (_local7 * _local7);
if (_local2.id != 6) {
if ((_local2.working > 0) || (_local2.waiting > 0)) {
} else if (_local9 <= _local2.rangesquared) {
_local2.waiting = _local2.delay;
itemAttacks(_local2, enemies[_local3]);
playSound(5);
}
}
_local4++;
}
}
_local3++;
}
if (health <= 0) {
gameOverAndGoto(6);
}
}
function nextWave() {
playSound(7);
waveLeft = waveInit;
waveTimeout = 0;
enemyMake = enemyCount[wave++];
}
function spawnEnemy() {
overlay.btnNextWave.gotoAndStop(1);
if ((selectedmap == 1) || (selectedmap == 3)) {
var _local3 = mcenemies.attachMovie("enemy", "e" + mcenemies.getNextHighestDepth(), mcenemies.getNextHighestDepth(), {_x:entryX, _y:entryY});
} else if (_root.at) {
_root.at = !_root.at;
var _local3 = mcenemies.attachMovie("enemy", "e" + mcenemies.getNextHighestDepth(), mcenemies.getNextHighestDepth(), {_x:entryX1, _y:entryY1});
} else {
_root.at = !_root.at;
var _local3 = mcenemies.attachMovie("enemy", "e" + mcenemies.getNextHighestDepth(), mcenemies.getNextHighestDepth(), {_x:entryX, _y:entryY});
}
_local3.dx = 0;
_local3.dy = 1;
_local3.speed = enemySpeed[wave - 1];
_local3.money = enemyMoney[wave - 1];
_local3.damage = enemyDamage[wave - 1];
_local3.health = (_local3.healthInit = enemyHealth[wave - 1]);
_local3.gotoAndStop(enemyDesign[wave - 1]);
_local3.onPress = function () {
if (paused) {
return(undefined);
}
closeDialogs();
overlay.dialogenemy.show();
selectedEnemy = this;
this.filters = new Array(new flash.filters.GlowFilter(3394815, 0.8, 10, 10, 3, 3, false, false));
overlay.dialogenemy.money.text = this.money;
overlay.dialogenemy.speed.text = this.speed;
overlay.dialogenemy.damage.text = this.damage;
_root.onMouseDown = function () {
delete this.onMouseDown;
selectedEnemy.filters = new Array();
overlay.dialogenemy.hide();
};
};
enemyLeft++;
if ((--enemyMake) == 0) {
if (_root.fast) {
nextWave();
changeBalance(waveSeconds * 2);
score = score + waveSeconds;
} else {
overlay.btnNextWave.gotoAndStop(2);
}
}
enemies.push(_local3);
}
function itemMarkerOver() {
if (paused) {
return(undefined);
}
var _local2 = overlay.dialoginfo;
_local2.name.text = itemNames[this.id];
_local2.description.text = itemDescriptions[this.id];
_local2.attack.text = itemAttack[this.id];
_local2.delay.text = itemDelay[this.id];
_local2.range.text = itemRange[this.id];
_local2.show();
}
function itemMarkerOut() {
overlay.dialoginfo.hide();
}
function itemMarkerMove() {
if ((this._alpha != 100) || (paused)) {
playSound(6);
return(undefined);
}
closeDialogs();
imarker.removeMovieClip();
imarker = _root.attachMovie("item", "im", _root.getNextHighestDepth(), {_x:-1000, _y:-1000});
imarker.startDrag(true);
imarker.id = this.id;
imarker.gotoAndStop(this.id + 1);
imarker.xin.hide();
imarker.leveltxt._visible = false;
imarker.rangemc._width = (imarker.rangemc._height = itemRange[this.id] * 2);
imarker.onMouseDown = itemInit;
overlay.dialogcancel.show();
}
function itemMarkerCleanup() {
imarker.removeMovieClip();
imarker = null;
overlay.dialogcancel.hide();
delete imarker.onMouseDown;
}
function itemInit() {
if ((tiles[tileY][tileX] != 0) || (_ymouse > 400)) {
return(undefined);
}
tiles[tileY][tileX] = -1;
vmap = new Array((4 * tilewidth) * tileheight);
cp = 0;
afinded = false;
bfinded = false;
finded = false;
canput = 1;
if (map.fang.hitTest(imarker.hitarea)) {
canput = 0;
}
if ((money == undefined) || (money == null)) {
money = 0;
}
if (money < 0) {
money = 0;
}
if (itemPrice[this.id] > money) {
canput = 0;
}
if (canput == 1) {
i = 0;
while (i < enemies.length) {
if (enemies[i].hitTest(imarker.hitarea)) {
canput = 0;
break;
}
i++;
}
}
a = 0;
while (a < tilewidth) {
b = 0;
while (b < tileheight) {
if ((tiles[b][a] == -2) && (canput == 1)) {
fmap[b][a] = 0;
} else if (canput == 1) {
fmap[b][a] = tiles[b][a];
}
b++;
}
a++;
}
vmap.splice(0);
vmap[1] = [bx, by, 1, 0];
fmap[by][bx] = 1;
p = 1;
i = 1;
while (vmap[i] != undefined) {
t = 0;
while (t < 4) {
if (fmap[vmap[i][1] + parrow[t][1]][vmap[i][0] + parrow[t][0]] == 0) {
p++;
vmap[p] = [vmap[i][0] + parrow[t][0], vmap[i][1] + parrow[t][1], vmap[i][2] + 1, i];
fmap[vmap[i][1] + parrow[t][1]][vmap[i][0] + parrow[t][0]] = 1;
}
t++;
}
if ((selectedmap == 0) || (selectedmap == 2)) {
if ((vmap[i][0] == ex1) && (vmap[i][1] == (ey1 + 1))) {
afinded = true;
}
if ((vmap[i][0] == ex2) && (vmap[i][1] == (ey2 + 1))) {
bfinded = true;
}
if (afinded && (bfinded)) {
finded = true;
break;
}
} else if ((vmap[i][0] == ex1) && (vmap[i][1] == (ey1 + 1))) {
finded = true;
cp = i;
break;
}
i++;
}
if (finded) {
var _local2 = mcfriends.attachMovie("item", "i" + mcfriends.getNextHighestDepth(), mcfriends.getNextHighestDepth(), {_x:(tileX * 30) + 15, _y:(tileY * 30) + 15});
_local2.gotoAndStop(this.id + 1);
_local2.level = 0;
_local2.id = this.id;
_local2.attack = itemAttack[_local2.id];
_local2.delay = itemDelay[_local2.id];
_local2.range = itemRange[_local2.id];
_local2.rangesquared = _local2.range * _local2.range;
_local2.working = (_local2.waiting = 0);
_local2.rangemc.hide();
_local2.leveltxt._visible = false;
_local2.hitarea._height = imarker[ninjahit]._height;
_local2.hitarea._width = imarker[ninjahit]._width;
_local2.hitarea.onRollOut = itemOut;
_local2.hitarea.onRollOver = itemOver;
_local2.hitarea.onPress = itemPressed;
friends.push(_local2);
itemNextLevel(_local2);
changeBalance(-itemPrice[_local2.id]);
i = 0;
while (i < enemies.length) {
enemies[i].finded = false;
i++;
}
} else {
tiles[tileY][tileX] = 0;
}
}
function itemPressed() {
if (this._parent.working || (paused)) {
return(undefined);
}
closeDialogs();
var _local2 = overlay.dialogitem;
var _local4 = this._parent.id;
var _local3 = this._parent.level;
_local2._visible = true;
_local2.info = (itemNames[_local4] + " lv. ") + _local3;
_local2.attack = this._parent.attack;
_local2.delay = this._parent.delay;
_local2.range = this._parent.range;
if (_local2._visible == true) {
itemMarkerCleanup();
}
_local2.pricelevel = ((_local3 != itemMaxLevels[_local4]) ? (upgradePrice[_local4][_local3]) : 0);
_local2.priceresale = upgradeResale[_local4][_local3 - 1];
if (_local3 < itemMaxLevels[_local4]) {
_local2.attacknext = upgradeAttack[_local4][_local3];
_local2.rangenext = upgradeRange[_local4][_local3];
_local2.delaynext = upgradeDelay[_local4][_local3];
} else {
_local2.attacknext = (_local2.rangenext = (_local2.delaynext = "max"));
}
selectedFriend = this._parent;
_local2.gotoAndStop(1);
_local2.show();
}
function itemOver() {
if (this._parent.working) {
return(undefined);
}
this._parent.rangemc.show();
cursor.hide();
}
function itemOut() {
if (this._parent.working) {
return(undefined);
}
this._parent.rangemc.hide();
cursor.show();
}
function itemAttacks(from, to) {
var _local4 = mcweapons.attachMovie("weapon", "mc" + mcweapons.getNextHighestDepth(), mcweapons.getNextHighestDepth(), {_x:from._x, _y:from._y, from:from, to:to, it:0.1});
_local4.onEnterFrame = function () {
if ((this.from.attack == undefined) || (this.from.attack < 0)) {
this.from.attack = 50;
}
if (paused) {
return(undefined);
}
if ((this.to.valueOf() == undefined) || (this.from.valueOf() == undefined)) {
delete this.onEnterFrame;
this.removeMovieClip();
return(undefined);
}
this._x = this.from._x + ((this.to._x - this.from._x) * this.it);
this._y = this.from._y + ((this.to._y - this.from._y) * this.it);
this.it = this.it + 0.2;
if (Math.floor(this.it) == 1) {
delete this.onEnterFrame;
if (this.to._currentframe == 6) {
if (this.from._currentframe == 4) {
this.to.health = this.to.health - (this.from.attack * 2);
} else {
this.to.health = this.to.health - int(this.from.attack * 0.75);
}
} else {
this.to.health = this.to.health - this.from.attack;
}
this.to.collision.gotoAndPlay(2);
switch (this.from.id) {
case 1 :
var _local4 = mcweapons.attachMovie("multiple", "mc" + mcweapons.getNextHighestDepth(), mcweapons.getNextHighestDepth(), {_x:this.to._x, _y:this.to._y});
_local4.onEnterFrame = function () {
this._xscale = (this._yscale = this._yscale + 5);
this._alpha = this._alpha - 2;
if (this._xscale > 130) {
delete this.onEnterFrame;
this.removeMovieClip();
}
};
var _local2 = 0;
var _local3;
while (_local2 < enemies.length) {
_local3 = ((this._y - enemies[_local2]._y) * (this._y - enemies[_local2]._y)) + ((this._x - enemies[_local2]._x) * (this._x - enemies[_local2]._x));
if ((_local3 < (this.from.range * this.from.range)) && (enemies[_local2] != this.to)) {
enemies[_local2].health = enemies[_local2].health - (this.from.attack * 0.38);
}
_local2++;
}
break;
case 2 :
this.to.slowed = 90;
this.to.slowedBy = 0.5;
(new flash.geom.Transform(this.to)).colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 120, 0);
break;
case 3 :
this.to.poisoned = 150;
if (this.to._currentframe == 6) {
this.to.poisonedBy = this.from.attack / 300;
} else {
this.to.poisonedBy = this.from.attack / 600;
}
(new flash.geom.Transform(this.to)).colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 70, 0, 0);
break;
case 4 :
if (!((this.to.health < (this.to.healthInit / 2)) && ((Math.random() * 100) < (2 * (this.from.level + 1))))) {
break;
}
this.to.health = 0;
textEffect("instantdeath", this.to._x, this.to._y);
}
this.removeMovieClip();
}
};
}
function itemSell() {
if (selectedFriend.id == 6) {
j = 0;
while (j < friends.length) {
if (friends[j].id != 6) {
if ((((friends[j]._x - selectedFriend._x) * (friends[j]._x - selectedFriend._x)) + ((friends[j]._y - selectedFriend._y) * (friends[j]._y - selectedFriend._y))) <= (selectedFriend.range * selectedFriend.range)) {
friends[j].attack = Math.floor(friends[j].attack / (1 + (selectedFriend.level / 9)));
var _local1 = itemAttack[friends[j].id];
p = 1;
while (p < friends[j].level) {
_local1 = _local1 + upgradeAttack[friends[j].id][p];
p++;
}
if (friends[j].attack < _local1) {
friends[j].attack = _local1;
}
}
}
j++;
}
}
selectedFriend.mark.removeMovieClip();
changeBalance(upgradeResale[selectedFriend.id][selectedFriend.level - 1]);
tiles[(selectedFriend._y - 15) / 30][(selectedFriend._x - 15) / 30] = 0;
selectedFriend.removeMovieClip();
closeDialogs();
playSound(1);
i = 0;
while (i < enemies.length) {
enemies[i].finded = false;
i++;
}
}
function itemNextLevel(o) {
if (o == undefined) {
o = selectedFriend;
}
if ((upgradePrice[o.id][o.level] > money) || (o.level > (itemMaxLevels[o.id] - 1))) {
playSound(6);
return(undefined);
}
changeBalance(-upgradePrice[o.id][o.level]);
o.attack = o.attack + upgradeAttack[o.id][o.level];
o.delay = o.delay - upgradeDelay[o.id][o.level];
o.range = o.range + upgradeRange[o.id][o.level];
o.rangemc._width = (o.rangemc._height = o.range * 2);
o.leveltxt.text = "lv. " + (o.level + 1);
o.xin.show();
o.itemOut();
o.leveltxt._visible = false;
o.working = upgradeBuildDelay[o.id][o.level++];
overlay.dialogitem.hide();
}
function changeBalance(n) {
if (((n == null) || (n == undefined)) || (n > 12000)) {
n = 500;
}
money = money + n;
var _local1 = 0;
while (_local1 < 7) {
overlay["item" + _local1]._alpha = ((itemPrice[_local1] > money) ? 25 : 100);
_local1++;
}
}
function playSound(n) {
if (muted) {
return(undefined);
}
var _local1 = new Sound();
_local1.attachSound("sfx" + n);
_local1.start(0, 0);
}
function textEffect(s, x, y) {
var _local2 = mcweapons.attachMovie("texteffect", "t" + mcweapons.getNextHighestDepth(), mcweapons.getNextHighestDepth(), {_x:x, _y:y});
_local2.gotoAndStop(s);
_local2.onEnterFrame = function () {
this._alpha = this._alpha - 5;
this._xscale = (this._yscale = this._yscale + 2);
if (this._alpha < 1) {
delete this.onEnterFrame;
this.removeMovieClip();
}
};
}
function gameOverAndGoto(n) {
delete this.onEnterFrame;
overlay.removeMovieClip();
itemMarkerCleanup();
if (gamemode == 2) {
score = score * 2;
}
if (gamemode == 3) {
score = score * 5;
}
_quality = "HIGH";
gotoAndStop(n +200);
}
_root._quality = "MEDIUM";
stop();
_root.fast = false;
_root.at = false;
MovieClip.prototype.show = function () {
this._visible = true;
};
MovieClip.prototype.hide = function () {
this._visible = false;
};
var enemyCount = [17, 7, 18, 18, 22, 7, 15, 18, 2, 11, 20, 7, 18, 18, 2, 18, 16, 17, 17, 7, 18, 18, 18, 18, 3, 7, 18, 18, 10, 11, 18, 20, 18, 18, 3, 18, 16, 18, 20, 7, 11, 7, 20, 24, 3, 18, 18, 7, 18, 6, 18, 18, 20, 24, 2, 18, 11, 18, 20, 24];
var enemyDelay = [35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35];
var enemyMoney = [4, 5, 6, 7, 7, 8, 10, 12, 100, 15, 17, 19, 20, 22, 200, 24, 28, 30, 36, 40, 43, 46, 50, 52, 400, 56, 60, 64, 71, 80, 87, 93, 100, 107, 650, 117, 123, 132, 141, 151, 162, 173, 185, 193, 1000, 207, 219, 233, 247, 260, 274, 287, 303, 318, 1200, 338, 371, 400, 450, 515];
var enemySpeed = [1.5, 1.5, 2, 2, 1.5, 2, 2.25, 2, 2, 0.005, 2, 1.75, 2.5, 2, 0.005, 2.5, 4, 2, 2, 2.25, 4, 2, 0.005, 2.5, 1.75, 3.5, 2, 1.5, 2, 0.005, 2, 1.5, 2.25, 0.005, 1.5, 2, 2.25, 2.25, 0.005, 2, 3.25, 2, 2, 1.5, 1.5, 2.25, 0.005, 2, 1.75, 3, 2, 0.005, 2.25, 1.5, 1.5, 2.5, 0.005, 1.75, 2, 2];
var enemyDamage = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7];
var enemyDesign = [1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 3, 2, 1, 4, 6, 5, 3, 4, 1, 2, 3, 4, 6, 4, 3, 2, 1, 5, 1, 6, 3, 4, 4, 6, 2, 1, 5, 4, 6, 2, 1, 2, 3, 4, 5, 4, 6, 2, 1, 4, 1, 6, 3, 4, 5, 4, 6, 3, 1, 5];
var enemyHealth = [60, 85, 75, 80, 88, 130, 128, 157, 800, 80, 261, 370, 350, 413, 700, 575, 700, 815, 970, 1450, 1325, 1470, 700, 1800, 3200, 2600, 2400, 2730, 3276, 1400, 3793, 4599, 5428, 2300, 25000, 7620, 8000, 8800, 3500, 13700, 11700, 15900, 13900, 14900, 40000, 15000, 7000, 27000, 22000, 24000, 26300, 12000, 32000, 35500, 120000, 40000, 49000, 18000, 58000, 64000];
i = 0;
while (i < 60) {
if ((enemyDesign[i] != 2) && (enemyDesign[i] != 6)) {
if (enemyCount[i] > 18) {
enemyCount[i] = Math.ceil(enemyCount[i] * 0.6);
enemyHealth[i] = Math.ceil(enemyHealth[i] * 1.23);
enemyMoney[i] = Math.ceil(enemyMoney[i] * 1.65);
} else if (enemyCount[i] > 12) {
enemyCount[i] = Math.ceil(enemyCount[i] * 0.8);
enemyHealth[i] = Math.ceil(enemyHealth[i] * 1.14);
enemyMoney[i] = Math.ceil(enemyMoney[i] * 1.25);
}
}
i++;
}
var itemDescriptions = new Array("Basic damage ninja", "AOE Splash Ninja.", "Slows Pirates", "Poisons enemies over time. Extra Damage to flying enemies", "This ninja has the ability to kill a pirate instantly if the enemy's life is less than 50%.", "Ultimate Damage Ninja.", "This Boost Ninja itself does not attack. It just increases the range and attack of other ninjas.");
var itemNames = new Array("Basic ninja", "Shuriken ninja", "Ice ninja", "Poision ninja", "Instant death ninja", "Ultimate ninja", "Boost ninja");
var itemAttack = new Array(10, 30, 35, 44, 10, 200, 1.1);
var itemDelay = new Array(33, 41, 42, 40, 44, 50, 0);
var itemRange = new Array(55, 60, 75, 70, 75, 75, 80);
var itemPrice = new Array(70, 300, 500, 500, 800, 1300, 1500);
var itemMaxLevels = new Array(6, 6, 6, 6, 6, 6, 6);
var tiles;
var fmap;
var parrow = new Array([1, 0], [0, 1], [-1, 0], [0, -1]);
if (selectedmap == 0) {
tiles = [[-1, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -1], [0, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2], [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, 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, 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, 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]];
} else if (selectedmap == 1) {
tiles = [[-1, -1, 0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 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, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0], [-1, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1], [0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, 0, 0, 0, -2, -2, -2, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 0, 0], [-1, 0, 0, 0, 0, -2, -2, -2, 0, 0, 0, -2, -2, -2, 0, 0, -1, -1, 0, -2, -2], [0, 0, 0, 0, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0], [0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0], [0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0], [0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0], [-1, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1]];
} else if (selectedmap == 2) {
tiles = [[0, 0, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -1, -1, 0, 0], [-1, -1, -1, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0], [-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, 0, 0, 0, -2, 0, -1, 0, 0], [0, 0, 0, 0, 0, -1, -1, 0, -2, -2, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0], [-1, 0, 0, 0, 0, -1, -1, 0, -2, 0, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0], [-2, -2, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0, -2, -2, -2, 0, 0, 0, 0, 0], [-1, -2, -2, 0, 0, -2, -2, -2, -2, -2, 0, 0, -2, -2, 0, 0, 0, 0, 0, -2, 0], [0, -2, -2, -2, -2, -2, -2, 0, 0, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, -2, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 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, -2, -2, 0, 0, 0, -2, -2, -2, -2], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0, 0, 0, -2, -2, -2, -2], [-1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0, 0, -2, -2, -2, -2]];
} else if (selectedmap == 3) {
tiles = [[-1, -1, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1], [-1, -1, -1, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1], [-1, -1, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0], [0, -1, -1, -1, 0, 0, 0, -1, 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, -1, -1, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 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, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, -2, -2, -2], [-1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, -1, -1, 0, -2, -2, -2, -2], [-1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, -2, -2, 0]];
}
if (selectedmap == 0) {
fmap = [[-1, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -1], [0, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2], [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, 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, 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, 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]];
} else if (selectedmap == 1) {
fmap = [[-1, -1, 0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 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, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0], [-1, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1], [0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, 0, 0, 0, -2, -2, -2, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 0, 0], [-1, 0, 0, 0, 0, -2, -2, -2, 0, 0, 0, -2, -2, -2, 0, 0, -1, -1, 0, -2, -2], [0, 0, 0, 0, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0], [0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0], [0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0], [0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0], [-1, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1]];
} else if (selectedmap == 2) {
fmap = [[0, 0, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -1, -1, 0, 0], [-1, -1, -1, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0], [-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, 0, 0, 0, -2, 0, -1, 0, 0], [0, 0, 0, 0, 0, -1, -1, 0, -2, -2, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0], [-1, 0, 0, 0, 0, -1, -1, 0, -2, 0, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0], [-2, -2, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, 0, -2, -2, -2, 0, 0, 0, 0, 0], [-1, -2, -2, 0, 0, -2, -2, -2, -2, -2, 0, 0, -2, -2, 0, 0, 0, 0, 0, -2, 0], [0, -2, -2, -2, -2, -2, -2, 0, 0, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, -2, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 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, -2, -2, 0, 0, 0, -2, -2, -2, -2], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0, 0, 0, -2, -2, -2, -2], [-1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, 0, 0, -2, -2, -2, -2]];
} else if (selectedmap == 3) {
fmap = [[-1, -1, -1, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1], [-1, -1, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1], [-1, -1, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0], [0, -1, -1, -1, 0, 0, 0, -1, 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, -1, -1, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 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, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, -2, -2, -2], [-1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, -1, -1, 0, -2, -2, -2, -2], [-1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, -2, -2, 0]];
}
var upgradeAttack = [[0, 5, 10, 10, 10, 10], [0, 25, 25, 30, 40, 50], [0, 30, 35, 35, 50, 60], [0, 30, 35, 35, 50, 70], [0, 10, 10, 15, 15, 15], [0, 100, 100, 100, 100, 125], [0, 0, 0, 0, 0, 0]];
var upgradePrice = [[0, 80, 100, 150, 200, 400], [0, 300, 500, 700, 800, 900], [0, 500, 600, 800, 1000, 1200], [0, 500, 600, 800, 1000, 1200], [0, 800, 1000, 1100, 1300, 1500], [0, 1100, 1200, 1300, 1500, 1600], [0, 1500, 1600, 1700, 1800, 1900]];
var upgradeRange = [[0, 5, 5, 5, 10, 10], [0, 5, 5, 10, 10, 15], [0, 5, 5, 5, 10, 10], [0, 5, 5, 5, 8, 12], [0, 5, 5, 5, 8, 12], [0, 5, 5, 5, 8, 12], [0, 2, 2, 2, 2, 2]];
var upgradeDelay = [[0, 2, 2, 2, 2, 2], [0, 2, 3, 5, 5, 5], [0, 3, 3, 4, 5, 5], [0, 3, 3, 4, 5, 5], [0, 3, 3, 4, 5, 5], [0, 5, 5, 5, 5, 10], [0, 0, 0, 0, 0, 0]];
var upgradeBuildDelay = [[40, 60, 80, 90, 100, 100], [40, 60, 80, 90, 100, 100], [40, 60, 80, 90, 100, 100], [40, 60, 80, 90, 100, 100], [40, 60, 80, 90, 100, 100], [40, 60, 80, 90, 100, 100], [1, 1, 1, 1, 1, 1]];
var upgradeResale = new Array(7);
var g;
var h;
var i = 0;
while (i < 7) {
upgradeResale[i] = new Array(itemMaxLevels[i]);
h = 0;
while (h < itemMaxLevels[i]) {
upgradeResale[i][h] = itemPrice[i];
g = 0;
while (g < h) {
upgradeResale[i][h] = upgradeResale[i][h] + upgradePrice[i][g];
g++;
}
upgradeResale[i][h] = Math.ceil(upgradeResale[i][h] / 1.2);
h++;
}
i++;
}
var paused = false;
var fps = 30;
var mms = 20;
var health = 50;
var money = 850;
var stageW = 640;
var stageH = 480;
var wave = 0;
var waveMax = 0;
var waveInit = 1800;
var waveLeft = waveInit;
var waveSkip = 0;
var waveTimeout = 0;
var waveSeconds = 0;
var selectedEnemy;
var selectedFriend;
var selectedStatic;
var enemyLeft = 0;
var enemyMake = 0;
var enemies = new Array();
var friends = new Array();
var mapW = 0;
var mapH = 0;
var tileX = 0;
var tileY = 0;
var tilesW = 0;
var tilesH = 0;
var entryX = 0;
var entryY = 5;
var cursor;
var megamap;
var imarker = null;
var toDelete;
var minimap = overlay.map.createEmptyMovieClip("minimap", 1);
var markers = overlay.map.createEmptyMovieClip("markers", 2);
var markersi = 1;
var minimoving = false;
var map;
var mcenemies;
var mcfriends;
var mcstatics;
var mcweapons;
overlay.btnNextWave.onPress = function () {
if (this._currentframe == 2) {
nextWave();
this.gotoAndStop(1);
changeBalance(waveSeconds * 2);
score = score + waveSeconds;
}
};
overlay.faseBut.onPress = function () {
if (this._currentframe == 1) {
if (overlay.btnNextWave._currentframe == 2) {
nextWave();
changeBalance(waveSeconds * 2);
score = score + waveSeconds;
overlay.btnNextWave.gotoAndStop(1);
}
this.gotoAndStop(2);
_root.fast = true;
} else {
this.gotoAndStop(1);
_root.fast = false;
}
};
overlay.btnMainMenu.onPress = function () {
closeDialogs();
paused = true;
overlay.dialogreturn.show();
};
tt = function (_loc2) {
_loc2.vmap = new Array((4 * tilewidth) * tileheight);
_loc2.cp = 0;
_loc2.ex = int(_loc2._x / 30);
_loc2.ey = int(_loc2._y / 30);
_loc2.finded = false;
a = 0;
while (a < tilewidth) {
b = 0;
while (b < tileheight) {
if (tiles[b][a] == -2) {
fmap[b][a] = 0;
} else {
fmap[b][a] = tiles[b][a];
}
b++;
}
a++;
}
_loc2.vmap.splice(0);
_loc2.vmap[1] = [bx, by, 1, 0];
fmap[by][bx] = 1;
p = 1;
i = 1;
while (_loc2.vmap[i] != undefined) {
t = 0;
while (t < 4) {
if (fmap[_loc2.vmap[i][1] + parrow[t][1]][_loc2.vmap[i][0] + parrow[t][0]] == 0) {
p++;
_loc2.vmap[p] = [_loc2.vmap[i][0] + parrow[t][0], _loc2.vmap[i][1] + parrow[t][1], _loc2.vmap[i][2] + 1, i];
fmap[_loc2.vmap[i][1] + parrow[t][1]][_loc2.vmap[i][0] + parrow[t][0]] = 1;
}
t++;
}
if ((_loc2.vmap[i][0] == _loc2.ex) && (_loc2.vmap[i][1] == _loc2.ey)) {
_loc2.finded = true;
_loc2.cp = i;
break;
}
i++;
}
tempcp = _loc2.cp;
if (_loc2.finded) {
_loc2.xvmap = new Array();
_loc2.yvmap = new Array();
i = 0;
while (_loc2.cp != 1) {
_loc2.xvmap[i] = (_loc2.vmap[_loc2.cp][0] * 30) + 15;
_loc2.yvmap[i] = (_loc2.vmap[_loc2.cp][1] * 30) + 15;
i++;
_loc2.cp = _loc2.vmap[_loc2.cp][3];
}
_loc2.xy = 0;
_loc2.endxy = i - 1;
a = 0;
while (a < tilewidth) {
b = 0;
while (b < tileheight) {
if (tiles[b][a] == 1) {
tiles[b][a] = 0;
}
b++;
}
a++;
}
}
};
init();
overlay.btnMute.onPress = function () {
if (this._currentframe == 1) {
this.nextFrame();
muted = true;
sound.setVolume(0);
} else {
this.prevFrame();
muted = false;
sound.setVolume(40);
}
};
Frame 206
stop();
stopAllSounds();
if (_root.selectedmap == 0) {
var o = {n:[4, 4, 1, 2, 9, 15, 11, 14, 13, 2, 10, 10, 13, 13, 0, 10], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
} else if (_root.selectedmap == 1) {
var o = {n:[9, 13, 1, 14, 5, 3, 1, 13, 6, 5, 9, 5, 14, 0, 1, 12], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
} else if (_root.selectedmap == 2) {
var o = {n:[5, 8, 7, 3, 9, 14, 5, 3, 12, 12, 13, 1, 11, 3, 4, 6], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
} else if (_root.selectedmap == 3) {
var o = {n:[11, 5, 12, 4, 9, 13, 15, 0, 10, 6, 15, 9, 8, 10, 14, 15], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
}
stop();
Frame 207
stop();
stop();
Frame 208
stop();
stopAllSounds();
if (_root.selectedmap == 0) {
var o = {n:[4, 4, 1, 2, 9, 15, 11, 14, 13, 2, 10, 10, 13, 13, 0, 10], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
} else if (_root.selectedmap == 1) {
var o = {n:[9, 13, 1, 14, 5, 3, 1, 13, 6, 5, 9, 5, 14, 0, 1, 12], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
} else if (_root.selectedmap == 2) {
var o = {n:[5, 8, 7, 3, 9, 14, 5, 3, 12, 12, 13, 1, 11, 3, 4, 6], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
} else if (_root.selectedmap == 3) {
var o = {n:[11, 5, 12, 4, 9, 13, 15, 0, 10, 6, 15, 9, 8, 10, 14, 15], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.score});
}
Frame 209
stop();
stop();
Frame 210
stop();
stopAllSounds();
Frame 211
stop();
if (_root.setscores == 0) {
var o = {n:[4, 4, 1, 2, 9, 15, 11, 14, 13, 2, 10, 10, 13, 13, 0, 10], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID});
} else if (_root.setscores == 1) {
var o = {n:[9, 13, 1, 14, 5, 3, 1, 13, 6, 5, 9, 5, 14, 0, 1, 12], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID});
} else if (_root.setscores == 2) {
var o = {n:[5, 8, 7, 3, 9, 14, 5, 3, 12, 12, 13, 1, 11, 3, 4, 6], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID});
} else if (_root.setscores == 3) {
var o = {n:[11, 5, 12, 4, 9, 13, 15, 0, 10, 6, 15, 9, 8, 10, 14, 15], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID});
}
Frame 212
stop();
Symbol 10 MovieClip [texteffect] Frame 1
stop();
Symbol 25 MovieClip [mapcontainer] Frame 1
stop();
Symbol 25 MovieClip [mapcontainer] Frame 2
stop();
trace(this.hei);
Symbol 25 MovieClip [mapcontainer] Frame 3
stop();
Symbol 25 MovieClip [mapcontainer] Frame 4
stop();
Symbol 28 MovieClip [cursor] Frame 1
stop();
Symbol 28 MovieClip [cursor] Frame 2
stop();
Symbol 41 MovieClip Frame 1
this.red_bar1._yscale = -1;
this.red_bar2._yscale = -1;
this.red_bar3._yscale = -1;
this.red_bar4._yscale = -1;
this.red_bar5._yscale = -1;
this.red_bar6._yscale = -1;
Symbol 54 MovieClip [item] Frame 1
stop();
Symbol 54 MovieClip [item] Frame 2
stop();
Symbol 54 MovieClip [item] Frame 3
stop();
Symbol 54 MovieClip [item] Frame 4
stop();
Symbol 54 MovieClip [item] Frame 5
stop();
Symbol 54 MovieClip [item] Frame 6
stop();
Symbol 54 MovieClip [item] Frame 7
stop();
Symbol 77 MovieClip [percikan] Frame 1
stop();
Symbol 96 MovieClip [enemy] Frame 1
stop();
Symbol 96 MovieClip [enemy] Frame 2
stop();
Symbol 96 MovieClip [enemy] Frame 3
stop();
Symbol 96 MovieClip [enemy] Frame 4
stop();
Symbol 96 MovieClip [enemy] Frame 5
stop();
Symbol 96 MovieClip [enemy] Frame 6
stop();
Symbol 96 MovieClip [enemy] Frame 7
stop();
Symbol 96 MovieClip [enemy] Frame 17
this.removeMovieClip();
Symbol 354 MovieClip [__Packages.mochi.as2.MochiAd] Frame 0
class mochi.as2.MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("3.0 as2");
}
static function showPreGameAd(options) {
var _local26 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local2});
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local9 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local9);
var clip = options.clip;
var _local8 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local7 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local7._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local7.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local7._mochiad_loaded = true;
if (_local7._url.indexOf("http") != 0) {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
}
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
mochi.as2.MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local9 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local9;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local9);
_local6.lc = _local5;
_local4.lc = _local9;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
if (clip._mochiad._containerLCName != undefined) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local3);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
}
Symbol 355 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _loader, _loaderListener, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function get childClip() {
return(_clip);
}
static function getVersion() {
return("3.0");
}
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) {
if ((!_connected) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.as2.MochiServices.onError = onError;
} else if (mochi.as2.MochiServices.onError == undefined) {
mochi.as2.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var _local3 = "_mochiservices_com_" + id;
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servicesURL != undefined) {
_servicesURL = urlOptions().servicesURL;
}
allowDomains(_servicesURL);
_clip = clip.createEmptyMovieClip(_local3, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, [errorCode]);
};
_loaderListener.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_loaderListener.startTime = getTimer();
_loaderListener.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_loaderListener.waitInterval = setInterval(_loaderListener, "wait", 1000);
_loader.addListener(_loaderListener);
_loader.loadClip((((_servicesURL + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.as2.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel._nextcallbackID = 0;
_listenChannel._callbacks = {};
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_clip, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _listenChannel._callbacks[_local1.callbackID];
}
delete _listenChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
if ((args.options != null) && (args.options.onError != null)) {
args.options.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
} else {
if ((_clip == undefined) || (!_connecting)) {
onError.apply(null, ["NotConnected"]);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
}
_listenChannel._callbacks[_listenChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_listenChannel._nextcallbackID++;
}
static function urlOptions() {
var _local5 = {};
if (_root.mochiad_options) {
var _local4 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
_local5[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local5);
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var _local2 = new Object();
_local2.mav = getVersion();
_local2.swfv = btn.getSWFVersion() || 6;
_local2.swfurl = btn._url;
_local2.fv = System.capabilities.version;
_local2.os = System.capabilities.os;
_local2.lang = System.capabilities.language;
_local2.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var _local3 = 0;
for (var _local6 in _local2) {
if (_local3 != 0) {
s = s + "&";
}
_local3++;
s = ((s + _local6) + "=") + escape(_local2[_local6]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var _local7 = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://x.mochiads.com/linkping.swf?t=" + getTimer());
_local7.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
mochi.as2.MochiServices.netup = false;
}
};
}
var _local4 = btn.createEmptyMovieClip("clk", 1001);
_local4._alpha = 0;
_local4.beginFill(1044735);
_local4.moveTo(0, 0);
_local4.lineTo(0, btn._height);
_local4.lineTo(btn._width, btn._height);
_local4.lineTo(btn._width, 0);
_local4.lineTo(0, 0);
_local4.endFill();
_local4.onRelease = function () {
if (mochi.as2.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static var _servicesURL = "http://www.mochiads.com/static/lib/services/services.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
}
Symbol 356 MovieClip [__Packages.mochi.as2.MochiScores] Frame 0
class mochi.as2.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.as2.MochiScores.boardID = boardID;
mochi.as2.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
if ((options.clip == null) || (options.clip == undefined)) {
options.clip = mochi.as2.MochiServices.clip;
}
if ((options.clip != mochi.as2.MochiServices.__get__clip()) || (mochi.as2.MochiServices.__get__childClip()._target == undefined)) {
mochi.as2.MochiServices.disconnect();
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;
}
}
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 357 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 116 Button
on (release) {
getURL ("http://www.flashninjaclan.com", "_blank");
}
Symbol 122 Button
on (release) {
getURL ("http://www.flashninjaclan.com/sitescores.php?ID=3341", "_blank");
}
Symbol 129 Button
on (press) {
nextFrame();
}
Symbol 132 Button
on (release) {
_root.gotoAndStop("scoreframe");
}
Symbol 138 Button
on (press) {
getURL (_root.homepage, "_blank");
}
Symbol 152 Button
on (press) {
prevFrame();
}
Symbol 159 MovieClip Frame 1
stop();
Symbol 159 MovieClip Frame 6
stop();
Symbol 163 MovieClip Frame 1
stop();
Symbol 163 MovieClip Frame 6
stop();
Symbol 168 MovieClip Frame 1
stop();
Symbol 168 MovieClip Frame 6
stop();
Symbol 172 MovieClip Frame 1
stop();
Symbol 172 MovieClip Frame 6
stop();
Symbol 186 Button
on (press) {
playMode(2);
}
Symbol 190 Button
on (press) {
playMode(3);
}
Symbol 193 Button
on (press) {
playMode(1);
}
Symbol 227 MovieClip Frame 1
stop();
Symbol 227 MovieClip Frame 2
stop();
Symbol 262 Button
on (press) {
_parent._parent.itemNextLevel();
}
Symbol 265 Button
on (press) {
gotoAndStop (2);
}
Symbol 267 Button
on (press) {
hide();
}
Symbol 270 Button
on (press) {
_parent._parent.itemSell();
gotoAndStop (1);
}
Symbol 273 Button
on (press) {
gotoAndStop (1);
}
Symbol 274 MovieClip Frame 1
stop();
Symbol 274 MovieClip Frame 2
stop();
Symbol 278 Button
on (press) {
_root._quality = "HIGH";
}
Symbol 280 Button
on (press) {
_root._quality = "MEDIUM";
}
Symbol 282 Button
on (press) {
_root._quality = "LOW";
}
Symbol 286 Button
on (press) {
_parent._parent.paused = false;
this.hide();
this.prevFrame();
}
Symbol 289 Button
on (press) {
stopAllSounds();
nextFrame();
}
Symbol 292 Button
on (press) {
_parent._parent.gameOverAndGoto(1);
}
Symbol 295 Button
on (press) {
prevFrame();
}
Symbol 297 MovieClip Frame 1
stop();
Symbol 297 MovieClip Frame 2
stop();
Symbol 312 MovieClip Frame 1
stop();
Symbol 312 MovieClip Frame 2
stop();
Symbol 315 MovieClip Frame 1
stop();
Symbol 315 MovieClip Frame 2
stop();
Symbol 328 MovieClip Frame 31
stop();
Symbol 333 Button
on (press) {
stopAllSounds();
gotoAndStop (201);
}
Symbol 334 Button
on (press) {
getURL (_parent.homepage, "_blank");
}
Symbol 342 Button
on (press) {
stopAllSounds();
gotoAndStop (201);
}
Symbol 345 Button
on (press) {
stopAllSounds();
_root.gotoAndStop("maingame");
}
Symbol 347 Button
on (release) {
_root.setscores = 0;
_root.gotoAndStop("viewscores");
}
Symbol 348 Button
on (release) {
_root.setscores = 1;
_root.gotoAndStop("viewscores");
}
Symbol 349 Button
on (release) {
_root.setscores = 2;
_root.gotoAndStop("viewscores");
}
Symbol 350 Button
on (release) {
_root.setscores = 3;
_root.gotoAndStop("viewscores");
}
Symbol 352 Button
on (press) {
gotoAndStop (201);
}