Frame 2
stop();
MochiAd.showPreGameAd({id:"7ee56b8e252120c5", res:"500x350"});
this.onEnterFrame = function () {
var _local3 = getBytesLoaded();
var _local2 = getBytesTotal();
bar._xscale = (100 * _local3) / _local2;
if ((_local3 >= _local2) && (_local2 > 0)) {
this.onEnterFrame = undefined;
}
};
Frame 3
function buildGame() {
if (((level == 5) && (stage == 3)) || ((level == 4) && (stage == 5))) {
_root.playMusic("musicIntro");
} else if ((level == 1) || (level == 3)) {
_root.playMusic("musicA");
} else if ((level == 2) || (level == 4)) {
_root.playMusic("musicB");
} else if (level == 5) {
_root.playMusic("musicC");
}
gamePause = false;
if ((level != 2) && (level != 5)) {
this.attachMovie("bg", "bg", this.getNextHighestDepth());
this.attachMovie("bg2", "bg2", this.getNextHighestDepth());
}
this.attachMovie("bg3", "bg3", this.getNextHighestDepth());
this.createEmptyMovieClip("game", this.getNextHighestDepth());
this.attachMovie("ui", "ui", this.getNextHighestDepth());
initGameUI();
game.attachMovie("map", "map", game.getNextHighestDepth());
game.createEmptyMovieClip("enemy", game.getNextHighestDepth());
game.active = [];
this.bg.gotoAndStop(level);
if ((level == 4) && (stage == 5)) {
this.bg._xscale = (this.bg._yscale = 80);
}
this.bg2.gotoAndStop(("l" + level) + stage);
this.bg3.gotoAndStop(("l" + level) + stage);
game.map.gotoAndStop((level + "-") + stage);
game.map.platform._visible = false;
game.map.ground._visible = false;
this.attachMovie("levelShow", "levelShow", this.getNextHighestDepth());
this.levelShow.mc.level.gotoAndStop(level);
this.levelShow.mc.stage.gotoAndStop(stage);
this.levelShow.mc.levelName.gotoAndStop(level);
if (((level == 5) && (stage == 3)) || ((level == 4) && (stage == 5))) {
} else {
this.createEmptyMovieClip("delay", this.getNextHighestDepth());
this.delay.onEnterFrame = function () {
for (var _local3 in _root.game.enemy) {
if (tmpNum == undefined) {
var tmpNum = 0;
}
tmpNum++;
}
_root.showEnemyNum(_root.ui.enemyNum, tmpNum);
_root.showEnemyNum(_root.ui.enemyRemain, 0);
this.removeMovieClip();
};
}
stageWidth = 500;
stageHeight = 350;
sceneWidth = Math.round(game.map._width);
sceneHeight = Math.round(game.map._height);
bgDx = (bg._width - stageWidth) / (sceneWidth - stageWidth);
bgDy = (bg._height - stageHeight) / (sceneHeight - stageHeight);
bg2Dx = (bg2._width - stageWidth) / (sceneWidth - stageWidth);
bg2Dy = (bg2._height - stageHeight) / (sceneHeight - stageHeight);
bg3Dx = (bg3._width - stageWidth) / (sceneWidth - stageWidth);
bg3Dy = (bg3._height - stageHeight) / (sceneHeight - stageHeight);
game.scrolling = function () {
if (this.player._xscale > 0) {
this._x = this._x + Math.round(((150 - this.player._x) - this._x) * 0.1);
if (Key.isDown(duckCode) || (Key.isDown(duck2Code))) {
this._y = this._y + Math.round(((120 - this.player._y) - this._y) * 0.07);
} else {
this._y = this._y + Math.round(((240 - this.player._y) - this._y) * 0.2);
}
} else {
this._x = this._x + Math.round(((350 - this.player._x) - this._x) * 0.1);
if (Key.isDown(duckCode) || (Key.isDown(duck2Code))) {
this._y = this._y + Math.round(((120 - this.player._y) - this._y) * 0.07);
} else {
this._y = this._y + Math.round(((240 - this.player._y) - this._y) * 0.2);
}
}
if (this._x > 0) {
this._x = 0;
} else if ((-this._x) > (sceneWidth - stageWidth)) {
this._x = stageWidth - sceneWidth;
}
if (this._y > 0) {
this._y = 0;
} else if ((-this._y) > (sceneHeight - stageHeight)) {
this._y = stageHeight - sceneHeight;
}
bg._x = Math.round(bgDx * this._x);
bg._y = Math.round(bgDy * this._y);
bg2._x = Math.round(bg2Dx * this._x);
bg2._y = Math.round(bg2Dy * this._y);
bg3._x = Math.round(bg3Dx * this._x);
bg3._y = Math.round(bg3Dy * this._y);
};
game.setTimer = function () {
if ((--this.timer) < 0) {
this.timer = 0;
showTime();
_root.ui.ntb.play();
} else if ((this.timer % 30) == 0) {
showTime();
}
};
var _local9 = 180;
if (level > 3) {
_local9 = 300;
}
game.timer = 30 * _local9;
showTime();
game.findEnemy = function () {
for (var _local2 in this.enemy) {
if (this.enemy[_local2]._visible == false) {
if (this.enemy[_local2].box._y == -50) {
continue;
}
this.showPosition(this.enemy[_local2].box);
continue;
}
this.showPosition(this.enemy[_local2]);
}
};
game.showPosition = function (mc) {
var _local5 = mc._x + this._x;
var _local4 = mc._y + this._y;
if ((((_local5 > 0) && (_local5 < 500)) && (_local4 > 0)) && (_local4 < 350)) {
return(undefined);
}
var _local3 = _local5 - 250;
var _local2 = _local4 - 175;
if (Math.abs(_local3 / _local2) > 1.42857142857143) {
var _local7 = ((Math.abs(_local3) / _local3) * 250) + 250;
var _local9 = 175 + (Math.abs(250 / _local3) * _local2);
} else {
var _local7 = 250 + (Math.abs(175 / _local2) * _local3);
var _local9 = ((Math.abs(_local2) / _local2) * 175) + 175;
}
var _local6 = ui.getNextHighestDepth();
var _local8 = ui.attachMovie("radarShow", "rs" + _local6, _local6, {_x:_local7, _y:_local9});
_local8._rotation = 57.3 * Math.atan2(_local2, _local3);
};
game.spCnt = 0;
game.showEnemy = function () {
if ((++this.spCnt) > 120) {
this.spCnt = 0;
this.findEnemy();
}
};
game.onEnterFrame = function () {
if (Key.isDown(pauseCode)) {
if (!keyArr[pauseCode]) {
keyArr[pauseCode] = 1;
if (gamePause) {
gamePause = false;
playMc(game);
pauseMenu.back();
ui.pauseMc.gotoAndStop("play");
ui.pauseMc.btn.onRelease = ui.pauseMc.btnFunc;
} else if (!pauseMenu) {
gamePause = true;
stopMc(game);
ui.pauseMc.gotoAndStop("pause");
newPauseMenu();
ui.pauseMc.btn.onRelease = ui.pauseMc.btnFunc;
}
}
} else {
keyArr[pauseCode] = 0;
}
if (gamePause) {
return(undefined);
}
this.setTimer();
this.showEnemy();
this.scrolling();
};
if (_root.cs._x != undefined) {
_root.cs.swapDepths(_root.getNextHighestDepth() + 1);
}
}
function chkEnemyLeft() {
if (Number(_root.ui.enemyRemain.num) == Number(_root.ui.enemyNum.num)) {
return(false);
}
return(true);
if (() != null) {
var _local3 = ;
var _local2 = game.enemy[_local3];
if (_local2.box._y != -50) {
do {
} while (() != null);
return(true);
}
// unexpected jump
do {
} while (() != null);
}
return(false);
}
function missionComplete() {
ui.pauseMc.btn.enabled = false;
delete game.player.onEnterFrame;
if (!_root.resultMenu) {
_root.attachMovie("resultMenu", "resultMenu", _root.getNextHighestDepth());
_root.resultMenu.levelName.gotoAndStop(level);
_root.resultMenu._y = -440;
if (game.timer < 0) {
game.timer = 0;
}
showNum(_root.resultMenu.gameScore, currentScore);
showNum(_root.resultMenu.timeBonus, game.timer);
if (_root.game.map.d1.visited) {
var _local3 = 10000;
_root.saveData.data.mdFound[((level * 5) - 5) + stage] = 1;
} else {
var _local3 = 0;
}
showNum(_root.resultMenu.magicDoor, _local3);
currentScore = currentScore + game.timer;
currentScore = currentScore + _local3;
if (_root.fromTheVeryBeginning) {
totaltime = totaltime + game.timer;
}
delete game.setTimer;
showNum(_root.resultMenu.totalScore, currentScore);
_root.resultMenu.nextStage = function () {
var _local3 = function () {
stage++;
if ((stage > 5) || ((level == 5) && (stage == 4))) {
_root[nowMusic].fadeOut();
_root.nowMusic = undefined;
stage = 1;
level++;
_root.resultMenu.onEnterFrame = function () {
this._y = this._y + Math.round((322 - this._y) / 5);
if (this._y == 320) {
this.nextLevel = function () {
removeClip();
if ((level == 6) && (stage == 1)) {
_root.gotoAndStop("winIntro");
} else if ((level == 5) && (stage == 1)) {
if ((((level - 1) * 5) + stage) > _root.saveData.data.missionFinished) {
_root.saveData.data.missionFinished++;
}
_root.gotoAndStop("winMid");
} else {
if ((((level - 1) * 5) + stage) > _root.saveData.data.missionFinished) {
_root.saveData.data.missionFinished++;
}
buildGame();
}
};
this.counter = 60;
this.onEnterFrame = function () {
if ((--this.counter) < 0) {
cutScene2(this.nextLevel);
delete this.onEnterFrame;
}
};
playSound("levelClear");
}
};
} else {
if ((((level - 1) * 5) + stage) > _root.saveData.data.missionFinished) {
_root.saveData.data.missionFinished++;
}
if ((level == 4) && (stage == 5)) {
var _local3 = function () {
removeClip();
_root.gotoAndStop("introBoss1");
};
cutScene2(_local3);
} else if ((level == 5) && (stage == 3)) {
var _local3 = function () {
removeClip();
_root.gotoAndStop("introBoss2");
};
cutScene2(_local3);
} else {
removeClip();
buildGame();
}
}
};
if ((((stage == 5) || ((level == 5) && (stage == 3))) || ((level == 5) && (stage == 2))) || ((level == 4) && (stage == 4))) {
_local3();
} else {
cutScene(_local3);
}
};
_root.resultMenu.btnContinue.onRelease = function () {
this._parent.nextStage();
};
_root.resultMenu.counter = 30;
_root.resultMenu.onEnterFrame = function () {
if ((this._y + 480) > 150) {
if (this.counter > 0) {
this.counter--;
} else if (this.counter == 0) {
playSound("scoreBoard");
this.counter--;
} else {
this._y = this._y + Math.round((-this._y) / 5);
}
} else {
this._y = this._y + Math.round((-320 - this._y) / 5);
}
if (this._y == -2) {
this.onEnterFrame = function () {
if (((Key.isDown(attackCode) || (Key.isDown(attack2Code))) || (Key.isDown(makingIceCode))) || (Key.isDown(makingIce2Code))) {
delete this.onEnterFrame;
this.nextStage();
}
};
}
};
}
}
function missionFail() {
var _local3 = this.createEmptyMovieClip("msnFl", this.getNextHighestDepth());
_local3.counter = 0;
_root.fromTheVeryBeginning = false;
_root.totaltime = 0;
_local3.func = function () {
removeClip();
_root.gotoAndStop("failed");
playerLife = defaultLife;
playerMagicLv = 0;
_root[nowMusic].fadeOut(1);
_root.nowMusic = undefined;
};
_local3.onEnterFrame = function () {
if ((++this.counter) == 40) {
cutScene2(this.func);
}
};
}
function removeClip() {
for (var _local2 in _root) {
if (typeof(_root[_local2]) == "movieclip") {
if (((_root[_local2]._name != "cs") && (_root[_local2].typ != "music")) && (_root[_local2]._name != "_mochiservices_com_7ee56b8e252120c5")) {
_root[_local2].removeMovieClip();
}
}
}
}
function chkLand() {
while (game.map.ground.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
this.dy = 0;
this.jumping = false;
var _local2 = true;
}
if (this.dy >= 0) {
while (game.map.platform.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
this.dy = 0;
this.jumping = false;
var _local2 = true;
}
} else {
while (game.map.ground.hitTest(this._x + game._x, (this._y + game._y) - 40, true)) {
this._y++;
this.dy = 0;
}
}
return(_local2);
}
function chkFall() {
if ((!game.map.ground.hitTest(this._x + game._x, (this._y + 1) + game._y, true)) && (!game.map.platform.hitTest(this._x + game._x, (this._y + 1) + game._y, true))) {
if ((!this.jumping) && (!this.onMovingTile)) {
return(true);
}
}
}
function gForce() {
this.dy = this.dy + g;
this.dy = Math.min(this.maxYspeed, this.dy);
this._y = this._y + Math.round(this.dy);
}
function gForce1(g) {
this.dy = this.dy + g;
this.dy = Math.min(this.maxYspeed, this.dy);
this._y = this._y + Math.round(this.dy);
}
function newPlayer() {
var _local3 = game.attachMovie("player", "player", game.getNextHighestDepth(), {_x:100, _y:100});
_local3.fullLife = function () {
if (this.life < defaultLife) {
playerLife = (this.life = defaultLife);
ui.life.gotoAndStop(this.life);
}
};
_local3.init = function (lf, ml) {
this.life = lf;
if (this.life > 0) {
ui.life.gotoAndStop(this.life);
} else {
ui.life.gotoAndStop(ui.life._totalframes);
}
if (_root.stage == 1) {
this.fullLife();
}
this.magicLv = ml;
showNum(ui.score, currentScore);
this.dx = 0;
this.dy = 0;
this.acl = 0.08;
this.jumping = false;
this.jumpSpeed = 20;
this.maxYspeed = 20;
this.xSpeed = 12;
};
_local3.init(_root.playerLife, _root.playerMagicLv);
_local3.magicUp = function () {
if (this.magicLv < 2) {
this.magicLv++;
_root.playerMagicLv++;
}
};
_local3.magicDown = function () {
if (this.magicLv > 0) {
this.magicLv--;
_root.playerMagicLv--;
}
};
_local3.startJump = function (jumpSpeed) {
this.dy = this.dy + jumpSpeed;
this.jumping = true;
this.onMovingTile = false;
};
_local3.startFall = function () {
this.dy = 0;
this.jumping = true;
this.onMovingTile = false;
this.jumpAction0();
this.mc.gotoAndPlay("top");
};
keyArr = [];
_local3.faceLeft = function () {
if (this._xscale > 0) {
this._xscale = this._xscale * -1;
}
};
_local3.faceRight = function () {
if (this._xscale < 0) {
this._xscale = this._xscale * -1;
}
};
_local3.moveRange = function () {
if (this._x < 20) {
this._x = 20;
} else if (this._x > (sceneWidth - 20)) {
this._x = sceneWidth - 20;
}
if ((this._y > sceneHeight) && (!_root.cs)) {
var _local3 = function () {
game.player.hitAction0();
game.player._x = _root.birthPt[0];
game.player._y = _root.birthPt[1];
game.player.dx = (game.player.dy = 0);
};
cutScene2(_local3);
}
};
_local3.moveAction = function () {
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, (this._y - 5) + game._y, true)) {
this._x = this._x + Math.round(this.dx);
}
if ((((!Key.isDown(leftCode)) && (!Key.isDown(rightCode))) && (!Key.isDown(left2Code))) && (!Key.isDown(right2Code))) {
if (!this.jumping) {
this.dx = this.dx * friction;
} else {
this.dx = this.dx * 0.93;
}
if (Math.abs(this.dx) < this.acl) {
this.dx = 0;
}
}
return(this.dx);
};
_local3.moveActionFriction = function () {
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, (this._y - 5) + game._y, true)) {
this._x = this._x + Math.round(this.dx);
}
this.dx = this.dx * friction;
if (Math.abs(this.dx) < this.acl) {
this.dx = 0;
}
};
_local3.ifHitEnemy = function () {
for (var _local3 in game.enemy) {
if (game.enemy[_local3]._visible == true) {
if (!game.enemy[_local3].hit) {
if (!this.unbreakable) {
if (this.hitMc.hitTest(game.enemy[_local3].hitMc)) {
this.hitAction0();
return(undefined);
}
}
}
} else if (game.enemy[_local3].box.ready) {
var _local2 = game.enemy[_local3].box;
if (Math.abs(this._y - _local2._y) < 5) {
if (Math.abs((this._x + (this._xscale * 0.15)) - _local2._x) < 25) {
this.tmpPick = game.enemy[_local3];
this.pickAction0();
return(undefined);
}
}
}
}
};
_local3.ifAttack = function () {
if (!this.attacking) {
if (Key.isDown(attackCode) || (Key.isDown(attack2Code))) {
if (!keyArr[attackCode]) {
this.iceMode = false;
keyArr[attackCode] = 1;
this.attackAction0();
}
} else {
keyArr[attackCode] = 0;
}
if (Key.isDown(makingIceCode) || (Key.isDown(makingIce2Code))) {
if (!keyArr[makingIceCode]) {
keyArr[makingIceCode] = 1;
this.iceMode = true;
this.attackAction0();
}
} else {
keyArr[makingIceCode] = 0;
}
}
};
_local3.ifMoveIdle = function () {
if (Key.isDown(leftCode) || (Key.isDown(left2Code))) {
this.faceLeft();
this.dx = this.dx + (((-this.xSpeed) - this.dx) * this.acl);
var _local2 = true;
} else if (Key.isDown(rightCode) || (Key.isDown(right2Code))) {
this.faceRight();
this.dx = this.dx + ((this.xSpeed - this.dx) * this.acl);
var _local2 = true;
}
if (_local2) {
this.runAction0();
}
};
_local3.ifMoveRun = function () {
if (Key.isDown(leftCode) || (Key.isDown(left2Code))) {
this.faceLeft();
this.dx = this.dx + (((-this.xSpeed) - this.dx) * this.acl);
} else if (Key.isDown(rightCode) || (Key.isDown(right2Code))) {
this.faceRight();
this.dx = this.dx + ((this.xSpeed - this.dx) * this.acl);
}
};
_local3.ifMoveJump = function () {
if (Key.isDown(leftCode) || (Key.isDown(left2Code))) {
this.faceLeft();
this.dx = this.dx + (((-this.xSpeed) - this.dx) * this.acl);
} else if (Key.isDown(rightCode) || (Key.isDown(right2Code))) {
this.faceRight();
this.dx = this.dx + ((this.xSpeed - this.dx) * this.acl);
}
};
_local3.ifMoveDuck = function () {
if (Key.isDown(leftCode) || (Key.isDown(left2Code))) {
this.faceLeft();
} else if (Key.isDown(rightCode) || (Key.isDown(right2Code))) {
this.faceRight();
}
};
_local3.ifJump = function () {
if (!this.jumping) {
if (Key.isDown(jumpCode) || (Key.isDown(jump2Code))) {
if (!keyArr[jumpCode]) {
keyArr[jumpCode] = 1;
this.startJump(-this.jumpSpeed);
this.jumpAction0();
}
} else {
keyArr[jumpCode] = 0;
}
}
};
_local3.ifDuck = function () {
if (Key.isDown(duckCode) || (Key.isDown(duck2Code))) {
this.duckAction0();
}
};
_local3.ifStandUp = function () {
if ((!Key.isDown(duckCode)) && (!Key.isDown(duck2Code))) {
this.idleAction0();
}
};
_local3.gForce = gForce;
_local3.chkLand = chkLand;
_local3.chkFall = function () {
if ((!game.map.ground.hitTest(this._x + game._x, (this._y + 1) + game._y, true)) && (!game.map.platform.hitTest(this._x + game._x, (this._y + 1) + game._y, true))) {
if (!this.jumping) {
this.startFall();
}
}
};
_local3.jumpAction = function () {
this.ifAttack();
this.ifMoveJump();
this.moveAction();
if (this.dy == 1) {
this.mc.gotoAndPlay("top");
} else if (this.dy > 6) {
this.mc.gotoAndStop("down");
} else if (this.dy < 0) {
this.mc.gotoAndStop("rise");
}
this.gForce();
if (this.chkLand()) {
this.idleAction0();
this.ifJump();
this.landAction0();
}
this.moveRange();
this.ifHitEnemy();
};
_local3.attackAction0 = function () {
this.gotoAndStop(this._currentframe + 10);
if (!this.jumping) {
this.dx = 0;
} else {
this.mc.gotoAndPlay(10);
}
this.enterFrameFunc = this.attackAction;
};
_local3.attackAction = function () {
if (this.jumping) {
this.ifMoveJump();
this.moveAction();
this.gForce();
if (this.chkLand()) {
var _local2 = this.mc._currentframe;
this.gotoAndStop(11);
this.mc.gotoAndPlay(_local2);
}
} else {
this.chkFall();
}
if (this.mc._currentframe == 13) {
if (this._currentframe == 30) {
newBullet(this._x + (this._xscale * 0.5), this._y - 10, 12, 250, this._xscale, this.iceMode, this.magicLv);
} else {
newBullet(this._x + (this._xscale * 0.5), this._y - 50, 12, 250, this._xscale, this.iceMode, this.magicLv);
}
} else {
if (this.mc._currentframe == this.mc._totalframes) {
switch (this._currentframe) {
case 11 :
this.idleAction0();
this.dx = 0;
break;
case 30 :
this.duckAction0();
this.dx = 0;
this.mc.gotoAndStop(this.mc._totalframes);
break;
case 50 :
this.jumpAction0();
break;
case 70 :
this.runAction0();
this.dx = 0;
}
return(undefined);
}
if (this.mc._currentframe > 16) {
if (Key.isDown(attackCode) || (Key.isDown(attack2Code))) {
if (!keyArr[attackCode]) {
this.iceMode = false;
keyArr[attackCode] = 1;
this.mc.gotoAndPlay(10);
}
} else {
keyArr[attackCode] = 0;
}
}
}
if (!this.jumping) {
if (Key.isDown(duckCode) || (Key.isDown(duck2Code))) {
var _local3 = this.mc._currentframe;
this.gotoAndStop("duckAttack");
this.mc.gotoAndPlay(_local3);
} else if (this._currentframe != 11) {
var _local3 = this.mc._currentframe;
this.gotoAndStop("attack");
this.mc.gotoAndPlay(_local3);
}
if (Key.isDown(jumpCode) || (Key.isDown(jump2Code))) {
if (!keyArr[jumpCode]) {
keyArr[jumpCode] = 1;
var _local3 = this.mc._currentframe;
this.gotoAndStop("jumpAttack");
this.mc.gotoAndPlay(_local3);
this.startJump(-this.jumpSpeed);
}
} else {
keyArr[jumpCode] = 0;
}
}
if (Key.isDown(leftCode) || (Key.isDown(left2Code))) {
this.faceLeft();
} else if (Key.isDown(rightCode) || (Key.isDown(right2Code))) {
this.faceRight();
}
this.moveRange();
this.ifHitEnemy();
};
_local3.landAction = function () {
this.ifAttack();
this.ifJump();
this.ifMoveJump();
this.gForce();
if (this.mc._currentframe == this.mc._totalframes) {
this.idleAction0();
}
this.ifDuck();
if (this.moveAction() != 0) {
this.runAction0();
}
this.gForce();
this.chkLand();
this.chkFall();
this.moveRange();
this.ifHitEnemy();
};
_local3.duckAction = function () {
this.ifAttack();
this.ifMoveDuck();
this.ifStandUp();
this.moveActionFriction();
this.gForce();
this.chkLand();
this.chkFall();
this.moveRange();
this.ifHitEnemy();
};
_local3.runAction = function () {
this.ifAttack();
this.ifMoveRun();
this.ifJump();
this.ifDuck();
if (this.moveAction() == 0) {
this.idleAction0();
}
this.gForce();
this.chkLand();
this.chkFall();
this.moveRange();
this.ifHitEnemy();
};
_local3.idleAction = function () {
this.ifAttack();
this.ifMoveIdle();
this.ifJump();
this.ifDuck();
this.gForce();
this.chkLand();
this.chkFall();
this.moveRange();
this.ifHitEnemy();
};
_local3.hitAction = function () {
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, (this._y - 5) + game._y, true)) {
this._x = this._x + Math.round(this.dx);
}
this._y = this._y + Math.round(this.dy);
while (game.map.ground.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
var _local2 = true;
}
if (this.dy >= 0) {
while (game.map.platform.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
var _local2 = true;
}
}
if ((!game.map.ground.hitTest(this._x + game._x, (this._y + game._y) + 1, true)) && (!game.map.platform.hitTest(this._x + game._x, (this._y + game._y) + 1, true))) {
this.dy = this.dy + g;
}
this.moveRange();
if (_local2) {
this.dy = this.dy * -0.5;
this.dx = this.dx * 0.5;
if (Math.abs(this.dy) < 0.5) {
this.dy = 0;
}
if (this.mc._currentframe < 15) {
this.mc.gotoAndPlay("land");
var _local4 = random(100);
if (_local4 < 3) {
_local4 = 0;
} else if (_local4 < 10) {
_local4 = random(4);
} else {
_local4 = 1;
}
for (var _local3 in game.enemy) {
if (game.enemy[_local3].box._x == -50) {
game.enemy[_local3].box.drop();
_local4--;
if (_local4 < 0) {
return(undefined);
}
}
}
}
}
if (this.dy > 0) {
if (this.mc._currentframe == 1) {
this.mc.gotoAndStop("down");
}
} else if (this.dy < 0) {
if (this.mc._currentframe == 10) {
this.mc.gotoAndStop("rise");
}
} else if (this.dy == 0) {
if (this.mc._currentframe > 10) {
this.dx = this.dx * 0.7;
}
}
if (this.life <= 0) {
if (this.mc._currentframe == 51) {
this.mc.stop();
} else if (this.mc._currentframe == 50) {
missionFail();
}
}
if ((this.mc._currentframe > 20) && (this.mc._currentframe < 55)) {
var _local4 = this.getNextHighestDepth();
this.attachMovie("bulletFx" + (random(3) + 1), "fx" + _local4, _local4, {_x:(this._width * 0.5) - random(this._width), _y:-30 - random(20)});
} else if (this.mc._currentframe == this.mc._totalframes) {
this.createEmptyMovieClip("unbreakable", this.getNextHighestDepth());
this.unbreakable.counter = 120;
this.unbreakable.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if ((--this.counter) < 0) {
this.removeMovieClip();
} else if ((this.counter % 4) == 0) {
this._parent._alpha = 100;
} else if ((this.counter % 4) == 1) {
this._parent._alpha = 30;
}
};
this.idleAction0();
}
};
_local3.hitAction0 = function () {
if (this.unbreakable || (this._currentframe == 90)) {
return(undefined);
}
_root.playSound("soundHit");
if ((--this.life) > 0) {
ui.life.gotoAndStop(this.life);
} else {
ui.life.gotoAndStop(ui.life._totalframes);
}
_root.playerLife = this.life;
this.magicDown();
this.gotoAndStop("hit");
this.dy = -14;
this.dx = (-this._xscale) * 0.05;
this.enterFrameFunc = this.hitAction;
};
_local3.jumpAction0 = function () {
this.gotoAndStop("jump");
this.enterFrameFunc = this.jumpAction;
};
_local3.duckAction0 = function () {
this.gotoAndStop("duck");
this.enterFrameFunc = this.duckAction;
};
_local3.runAction0 = function () {
this.gotoAndStop("run");
this.enterFrameFunc = this.runAction;
};
_local3.idleAction0 = function () {
this.gotoAndStop("idle");
this.enterFrameFunc = this.idleAction;
};
_local3.pickAction0 = function () {
this.gotoAndStop("pick");
if ((level == 5) && (stage == 3)) {
game.enemy.boss2.soldier--;
} else {
_root.showEnemyNum(_root.ui.enemyRemain, _root.ui.enemyRemain.num + 1);
}
delete this.tmpPick.box.onEnterFrame;
this.enterFrameFunc = this.pickAction;
};
_local3.pickAction = function () {
if (this.mc._currentframe < 5) {
this.tmpPick.box._x = this.tmpPick.box._x + (((this._x + (this._xscale * 0.2)) - this.tmpPick.box._x) / 5);
} else if (this.mc._currentframe == 5) {
this.tmpPick.box._x = -50;
this.tmpPick.box._y = -50;
}
this.mc.box.gotoAndStop(this.tmpPick.box._currentframe);
if (this.mc._currentframe == this.mc._totalframes) {
this.tmpPick._x = -50;
this.tmpPick._y = -50;
if (this.tmpPick.tmpFunc == undefined) {
this.tmpPick.tmpFunc = this.tmpPick.onEnterFrame;
}
delete this.tmpPick.onEnterFrame;
if (!chkEnemyLeft()) {
missionComplete();
}
this.idleAction0();
}
};
_local3.landAction0 = function () {
this.mc.gotoAndStop("land");
this.mc.play();
this.enterFrameFunc = this.landAction;
};
_local3.magicFx = function () {
if (!random(2)) {
var _local2 = game.getNextHighestDepth();
var _local5 = game.attachMovie("magicFx", "fx" + _local2, _local2, {_x:((this._x + (this._xscale * 0.1)) + random(20)) - 10, _y:this._y - random(20)});
}
};
_local3.idleAction0();
_local3.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
this.enterFrameFunc();
this.magicFx();
};
}
function newBullet(startx, starty, speed, range, xscale, iceMode, magicLv) {
_root.playSound("soundAttack");
var _local4 = game.getNextHighestDepth();
var _local12 = game.attachMovie("bullet", "bullet" + _local4, _local4, {_x:startx, _y:starty});
game.attachMovie("bulletFx5", "fx" + (_local4 + 1), _local4 + 1, {_x:startx, _y:starty});
_local12._xscale = xscale;
_local12.dx = (speed * xscale) * 0.01;
_local12.dy = -1;
if (magicLv == 0) {
range = 100;
} else if (magicLv == 1) {
range = 250;
} else if (magicLv == 2) {
range = 400;
}
_local12.dmg = (magicLv * 30) + 30;
_local12.counter = Math.round(range / speed);
if (iceMode) {
_local12.counter = 0;
_local12.dx = xscale * 0.25;
_local12.onEnterFrame = function () {
this._y = this._y + this.dy;
this.dy = this.dy + 0.1;
this._x = this._x + this.dx;
if ((--this.counter) < 0) {
var _local2 = game.getNextHighestDepth();
newIceBlock(this);
this.removeMovieClip();
}
};
} else {
_local12.expl = function () {
var _local3 = game.getNextHighestDepth();
game.attachMovie("hitFx", "fx" + _local3, _local3, {_x:this._x, _y:this._y});
_root.playSound("soundHitEnemy");
this.removeMovieClip();
};
_local12.onEnterFrame = function () {
this._y = this._y + this.dy;
this.dy = this.dy + 0.1;
this._x = this._x + this.dx;
for (var _local2 in game.enemy) {
var _local5 = game.enemy[_local2];
if (!_local5.box._x) {
if (_local5.hitMc.hitTest(this.hitMc)) {
_local5.hitAction0(this.dmg);
this.expl();
return(undefined);
}
}
}
if ((--this.counter) < 0) {
var _local3 = game.getNextHighestDepth();
var _local5 = game.attachMovie("bulletFx6", "fx" + _local3, _local3, {_x:this._x, _y:this._y});
_local5 = game.attachMovie("bulletFx6", "fx" + (_local3 + 1), _local3 + 1, {_x:this._x + random(10), _y:this._y + random(8)});
_local5 = game.attachMovie("bulletFx6", "fx" + (_local3 + 2), _local3 + 2, {_x:this._x - random(10), _y:this._y + random(8)});
this.removeMovieClip();
} else {
if ((this.counter % 3) == 0) {
var _local3 = game.getNextHighestDepth();
var _local5 = game.attachMovie("bulletFx0", "fx" + _local3, _local3, {_x:this._x, _y:this._y, _xscale:this._xscale});
}
if (!random(3)) {
var _local3 = this.getNextHighestDepth();
this.attachMovie("bulletFx" + (1 + random(3)), "fx" + _local3, _local3, {_x:-random(50), _y:random(30) - 15});
}
}
};
}
}
function newIceBlock(who) {
var _local10 = _root.game.map.getNextHighestDepth();
var _local8 = _root.game.map.platform.getNextHighestDepth();
_root.playSound("soundIce");
if (_root.game.map.ice3 || (_root.game.map.ice2)) {
if (_root.game.map.ice3) {
_root.game.map.ice3._name = "ice" + _local10;
var _local12 = true;
}
var _local5 = _root.game.map.attachMovie("iceBlock", "ice3", _local10, {_x:who._x, _y:who._y});
var _local11 = _root.game.map.platform.attachMovie("iceBlock", "ice" + _local8, _local8, {_x:who._x, _y:who._y});
_local5.gotoAndStop("ice3");
_local11.gotoAndStop("hit3");
if (_local12) {
_local5.counter = 80;
} else {
_local5.counter = 90;
}
var _local9 = 3;
} else if (_root.game.map.ice1) {
var _local5 = _root.game.map.attachMovie("iceBlock", "ice2", _local10, {_x:who._x, _y:who._y});
var _local11 = _root.game.map.platform.attachMovie("iceBlock", "ice" + _local8, _local8, {_x:who._x, _y:who._y});
_local5.gotoAndStop("ice2");
_local11.gotoAndStop("hit2");
_local5.counter = 120;
var _local9 = 2;
} else {
var _local5 = _root.game.map.attachMovie("iceBlock", "ice1", _local10, {_x:who._x, _y:who._y});
var _local11 = _root.game.map.platform.attachMovie("iceBlock", "ice" + _local8, _local8, {_x:who._x, _y:who._y});
_local5.gotoAndStop("ice1");
_local11.gotoAndStop("hit1");
_local5.counter = 150;
var _local9 = 1;
}
_local5.dy = 0;
_local5.hit = _local11;
var _local3 = 0;
while (_local3 < (5 - _local9)) {
var _local4 = game.getNextHighestDepth();
game.attachMovie("bulletFx0", "fx" + _local4, _local4, {_x:(_local5._x + (_local3 * 20)) - 40, _y:_local5._y});
_local3++;
}
_local5.onEnterFrame = function () {
if ((--this.counter) < 0) {
if (this.hit._x) {
this.hit.removeMovieClip();
}
this._alpha = this._alpha - 10;
this._y = this._y + this.dy;
this.dy = this.dy + (g + 0.1);
if (this._alpha < 0) {
this.removeMovieClip();
}
} else if (this.counter < 30) {
if ((this.counter % 3) == 0) {
this._alpha = 50;
} else {
this._alpha = 100;
}
}
};
}
function turn0() {
this.gotoAndStop("turn");
this.enterFrameFunc = this.turn;
}
function turn() {
if (this.mc._currentframe == this.mc._totalframes) {
this._xscale = this._xscale * -1;
this.moveAction0();
}
}
function moveAction0() {
this.gotoAndStop("move");
this.enterFrameFunc = this.moveAction;
}
function moveAction() {
this.dx = this._xscale * this.xSpeed;
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, this._y + game._y, true)) {
this._x = this._x + Math.round(this.dx);
}
this.chkLand();
if (!this.chkFall()) {
this.chkTurn();
} else {
this.gForce();
}
}
function moveRange() {
if (this._x < 20) {
this._x = 20;
} else if (this._x > (sceneWidth - 20)) {
this._x = sceneWidth - 20;
}
if (this._y > sceneHeight) {
this._x = _root.birthPt[0];
this._y = _root.birthPt[1];
}
}
function chkTurn() {
if (game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, (this._y + game._y) - 5, true)) {
var _local2 = true;
} else if (game.map.ground.hitTest(this._x + game._x, (this._y + game._y) + 2, true)) {
if (!game.map.ground.hitTest((this._x + game._x) + ((20 * Math.abs(this.dx)) / this.dx), (this._y + game._y) + 2, true)) {
var _local2 = true;
}
} else if (game.map.platform.hitTest(this._x + game._x, (this._y + game._y) + 2, true)) {
if (!game.map.platform.hitTest((this._x + game._x) + ((20 * Math.abs(this.dx)) / this.dx), (this._y + game._y) + 2, true)) {
var _local2 = true;
}
}
if (_local2) {
this.turn0();
}
}
function toBox() {
this._visible = false;
this.magicShow.removeMovieClip();
this.box = newBox(this);
this.counter = this.boxCount - 35;
this.enterFrameFunc = function () {
if ((--this.counter) < 0) {
this._x = this.box._x;
this._y = this.box._y;
this._visible = true;
var _local3 = game.getNextHighestDepth();
game.attachMovie("smokeFx", "fx" + _local3, _local3, {_x:this._x, _y:this._y - 30});
this.moveAction0();
_root.playSound("soundToBox");
this.hit = false;
this.mc.play();
this.box.removeMovieClip();
} else if (this.counter < 30) {
if ((this.counter % 4) == 0) {
this.box.filters = null;
} else if ((this.counter % 4) == 1) {
whiteFilter(this.box, 30);
}
} else if (this.counter < 60) {
if ((this.counter % 8) == 0) {
this.box.filters = null;
} else if ((this.counter % 8) == 1) {
whiteFilter(this.box, 30);
}
}
};
}
function newBox(host) {
var _local5 = game.getNextHighestDepth();
var _local4 = game.attachMovie("box", "box" + _local5, _local5, {_x:host._x, _y:host._y - 30});
_local4.host = host;
_local4.gotoAndStop(random(_local4._totalframes) + 1);
_local5 = game.getNextHighestDepth();
game.attachMovie("smokeFx", "fx" + _local5, _local5, {_x:host._x, _y:host._y - 30});
_local4.dy = -5;
_root.playSound("soundToBox");
_local4.moveRange = moveRange;
_local4.drop = function () {
this.filters = null;
if ((level == 5) && (stage == 3)) {
game.enemy.boss2.soldier++;
} else {
_root.showEnemyNum(_root.ui.enemyRemain, _root.ui.enemyRemain.num - 1);
}
this._x = game.player._x;
this._y = game.player._y;
this.dx = ((2 * random(2)) - 1) * (random(6) + 1);
this.dy = -5 - random(5);
this.counter = this.host.boxCount;
this.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if ((--this.counter) < -20) {
this.host._x = this._x;
this.host._y = this._y;
this.host._visible = true;
var _local2 = game.getNextHighestDepth();
game.attachMovie("smokeFx", "fx" + _local2, _local2, {_x:this._x, _y:this._y - 30});
this.host.onEnterFrame = this.host.tmpFunc;
delete this.host.tmpFunc;
this.host.moveAction0();
this.host.hit = false;
this.host.mc.play();
this.removeMovieClip();
return(undefined);
}
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, this._y + game._y, true)) {
this._x = this._x + Math.round(this.dx);
}
this._y = this._y + Math.round(this.dy);
this.moveRange();
if ((!game.map.ground.hitTest(this._x + game._x, (this._y + game._y) + 1, true)) && (!game.map.platform.hitTest(this._x + game._x, (this._y + game._y) + 1, true))) {
this.dy = this.dy + g;
} else {
this.dx = this.dx * 0.8;
}
if (!this.ready) {
if ((++this.counter) > 30) {
this.ready = true;
}
}
this.chkLand();
};
};
_local4.chkLand = function () {
while (game.map.ground.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
var _local2 = true;
}
if (this.dy >= 0) {
while (game.map.platform.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
var _local2 = true;
}
}
if (_local2) {
this.dy = this.dy * -0.5;
}
};
_local4.counter = 0;
_local4.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
this._y = this._y + Math.round(this.dy);
if ((!game.map.ground.hitTest(this._x + game._x, (this._y + game._y) + 1, true)) && (!game.map.platform.hitTest(this._x + game._x, (this._y + game._y) + 1, true))) {
this.dy = this.dy + g;
}
if (this._y > game.map._height) {
this._y = 0;
}
if (!this.ready) {
if ((++this.counter) > 30) {
this.ready = true;
}
}
this.chkLand();
};
return(_local4);
}
function hitAction0(dmg) {
if (!this.hit) {
this.hit = true;
this.counter = 0;
this.attachMovie("magicShow", "magicShow", this.getNextHighestDepth(), {_y:-70});
this.magicShow._xscale = this._xscale;
this.tempFunc = this.enterFrameFunc;
game.freezeList.push(this);
this.enterFrameFunc = this.hitAction;
this.mc.stop();
}
this.counter = this.counter + dmg;
if (this.counter >= this.hp) {
this.toBox();
return(undefined);
}
}
function hitAction() {
this.magicShow.bar._xscale = 100 * (this.counter / this.hp);
this._y = this._y + Math.round(this.dy);
if ((!game.map.ground.hitTest(this._x + game._x, (this._y + game._y) + 1, true)) && (!game.map.platform.hitTest(this._x + game._x, (this._y + game._y) + 1, true))) {
this.dy = this.dy + g;
}
this.chkLand();
if (!random(2)) {
var _local3 = this.getNextHighestDepth();
this.attachMovie("bulletFx" + (random(3) + 1), "fx" + _local3, _local3, {_x:(this._width * 0.5) - random(this._width), _y:-random(this._height)});
}
this.counter = this.counter - 0.5;
if (this.counter <= 0) {
this.mc.play();
this.hit = false;
this.magicShow.removeMovieClip();
for (var _local2 in game.freezeList) {
if (game.freezeList[_local2] == this) {
game.freezeList.splice(_local2, 1);
}
}
this.enterFrameFunc = this.tempFunc;
}
}
function newToy1(xPos, yPos) {
var _local3 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("soldier", "enemy" + _local3, _local3, {_x:xPos, _y:yPos});
_local2.xSpeed = 0.01;
_local2.dx = 0;
_local2.dy = 0;
_local2.hp = 50;
_local2.boxCount = 350;
_local2.maxYspeed = 20;
_local2.toBox = toBox;
_local2.hitAction0 = hitAction0;
_local2.hitAction = hitAction;
_local2.turn0 = turn0;
_local2.turn = turn;
_local2.moveAction0 = moveAction0;
_local2.moveAction = moveAction;
_local2.moveRange = moveRange;
_local2.chkTurn = chkTurn;
_local2.gForce = gForce;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.moveAction0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if (((((this._x + game._x) < -200) || ((this._x + game._x) > 700)) || ((this._y + game._y) < -200)) || ((this._y + game._y) > 550)) {
return(undefined);
}
this.moveRange();
this.enterFrameFunc();
};
}
function newToy2(xPos, yPos) {
var _local3 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("car", "enemy" + _local3, _local3, {_x:xPos, _y:yPos});
_local2.xSpeed = 0.03;
_local2.dx = 0;
_local2.dy = 0;
_local2.hp = 60;
_local2.boxCount = 350;
_local2.maxYspeed = 15;
_local2.toBox = toBox;
_local2.hitAction0 = hitAction0;
_local2.hitAction = hitAction;
_local2.turn0 = turn0;
_local2.turn = turn;
_local2.moveAction0 = moveAction0;
_local2.moveAction = moveAction;
_local2.moveRange = moveRange;
_local2.chkTurn = chkTurn;
_local2.gForce = gForce;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.moveAction0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if (((((this._x + game._x) < -200) || ((this._x + game._x) > 700)) || ((this._y + game._y) < -200)) || ((this._y + game._y) > 550)) {
return(undefined);
}
this.moveRange();
this.enterFrameFunc();
};
}
function newToy3(xPos, yPos) {
var _local3 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("locomotive", "enemy" + _local3, _local3, {_x:xPos, _y:yPos});
_local2.xSpeed = 0.05;
_local2.dx = 0;
_local2.dy = 0;
_local2.hp = 100;
_local2.boxCount = 250;
_local2.maxYspeed = 25;
_local2.toBox = toBox;
_local2.hitAction0 = hitAction0;
_local2.hitAction = hitAction;
_local2.turn0 = turn0;
_local2.turn = turn;
_local2.moveAction0 = moveAction0;
_local2.moveAction = moveAction;
_local2.moveRange = moveRange;
_local2.chkTurn = chkTurn;
_local2.gForce = gForce;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.moveAction0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if (((((this._x + game._x) < -200) || ((this._x + game._x) > 700)) || ((this._y + game._y) < -200)) || ((this._y + game._y) > 550)) {
return(undefined);
}
this.moveRange();
this.enterFrameFunc();
};
}
function newToy4(xPos, yPos) {
var _local4 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("soldierWithGun", "enemy" + _local4, _local4, {_x:xPos, _y:yPos});
_local2.xSpeed = 0.01;
_local2.dx = 0;
_local2.dy = 0;
_local2.hp = 100;
_local2.boxCount = 300;
_local2.maxYspeed = 20;
_local2.toBox = toBox;
_local2.hitAction0 = hitAction0;
_local2.hitAction = hitAction;
_local2.moveRange = moveRange;
_local2.turn0 = turn0;
_local2.turn = turn;
_local2.shoot0 = function () {
this.gotoAndStop("shoot");
this.enterFrameFunc = this.shoot;
};
_local2.shoot = function () {
if (this.mc._currentframe == 30) {
var _local4 = getGlbPt(this.mc);
var _local3 = game.getNextHighestDepth();
var _local2 = game.attachMovie("blt1", "blt" + _local3, _local3, {_x:_local4[0] - game._x, _y:_local4[1] - game._y});
_local2._xscale = this._xscale;
_local2.xs = _local2._xscale * 0.06;
_local2.counter = 40;
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
this._x = this._x + this.xs;
if ((--this.counter) < 0) {
this.removeMovieClip();
} else if (this.hitTest(game.player.hitMc)) {
game.player.hitAction0();
this.removeMovieClip();
}
};
} else if (this.mc._currentframe == this.mc._totalframes) {
this.moveAction0();
}
this.chkLand();
this.chkFall();
this.gForce();
};
_local2.moveAction0 = function () {
this.gotoAndStop("move");
this.enterFrameFunc = this.moveAction;
};
_local2.moveAction = function () {
if (((this._y - game.player._y) < 10) && ((this._y - game.player._y) > -50)) {
if (Math.abs(this._x - game.player._x) < 250) {
if (((this._xscale == 100) && (this._x > game.player._x)) || ((this._xscale == -100) && (this._x < game.player._x))) {
if (!random(20)) {
this.turn0();
}
} else if (!random(20)) {
this.shoot0();
}
}
}
this.dx = this._xscale * this.xSpeed;
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, this._y + game._y, true)) {
this._x = this._x + Math.round(this.dx);
}
this.chkLand();
if (!this.chkFall()) {
this.chkTurn();
} else {
this.gForce();
}
};
_local2.chkTurn = chkTurn;
_local2.gForce = gForce;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.moveAction0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if (((((this._x + game._x) < -200) || ((this._x + game._x) > 700)) || ((this._y + game._y) < -200)) || ((this._y + game._y) > 550)) {
return(undefined);
}
this.moveRange();
this.enterFrameFunc();
};
}
function newToy5(xPos, yPos) {
var _local3 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("bear", "enemy" + _local3, _local3, {_x:xPos, _y:yPos});
_local2.xSpeed = 0.01;
_local2.dx = 0;
_local2.dy = 0;
_local2.hp = 100;
_local2.boxCount = 250;
_local2.maxYspeed = 20;
_local2.toBox = toBox;
_local2.hitAction0 = hitAction0;
_local2.hitAction = hitAction;
_local2.turn0 = turn0;
_local2.turn = turn;
_local2.chkTurn = chkTurn;
_local2.gForce = gForce1;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.moveRange = moveRange;
_local2.moveAction0 = function () {
this.gotoAndStop("move");
this.enterFrameFunc = this.moveAction;
};
_local2.jump0 = function () {
if (random(2)) {
this.dy = -8;
} else {
this.dy = -10;
}
this.gotoAndStop("jump");
};
_local2.specMove = function () {
if (((this._y - game.player._y) < 10) && ((this._y - game.player._y) > -50)) {
if (Math.abs(this._x - game.player._x) < 250) {
var _local2 = true;
if (((this._xscale == 100) && (this._x > game.player._x)) || ((this._xscale == -100) && (this._x < game.player._x))) {
if (!random(20)) {
this.turn0();
}
} else if (!random(35)) {
this.jump0();
}
}
}
if (!_local2) {
if (!random(80)) {
this.turn0();
}
}
};
_local2.moveAction = function () {
this.dx = this._xscale * this.xSpeed;
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, (this._y + game._y) - 5, true)) {
this._x = this._x + Math.round(this.dx);
}
if (this.chkLand()) {
if (this._currentframe != 1) {
this.gotoAndStop("move");
var _local2 = game.getNextHighestDepth();
game.attachMovie("dust", "fx" + _local2, _local2, {_x:this._x, _y:this._y});
}
}
if (!this.chkFall()) {
this.specMove();
this.chkTurn();
}
this.gForce(0.8);
this.moveRange();
};
_local2.moveAction0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if (((((this._x + game._x) < -200) || ((this._x + game._x) > 700)) || ((this._y + game._y) < -200)) || ((this._y + game._y) > 550)) {
return(undefined);
}
this.enterFrameFunc();
};
}
function newToy6(xPos, yPos) {
var _local3 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("doll", "enemy" + _local3, _local3, {_x:xPos, _y:yPos});
_local2.xSpeed = 0.04;
_local2.dx = 0;
_local2.dy = 0;
_local2.hp = 60;
_local2.boxCount = 240;
_local2.maxYspeed = 20;
_local2.toBox = toBox;
_local2.hitAction0 = hitAction0;
_local2.hitAction = hitAction;
_local2.turn0 = turn0;
_local2.turn = turn;
_local2.chkTurn = chkTurn;
_local2.gForce = gForce1;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.moveRange = moveRange;
_local2.moveAction0 = function () {
this.gotoAndStop("move");
this.enterFrameFunc = this.moveAction;
};
_local2.jump0 = function () {
if (random(2)) {
this.dy = -9;
} else {
this.dy = -14;
}
this.gotoAndStop("jump");
};
_local2.specMove = function () {
if (((this._y - game.player._y) < 10) && ((this._y - game.player._y) > -50)) {
if (Math.abs(this._x - game.player._x) < 250) {
var _local2 = true;
if (((this._xscale == 100) && (this._x > game.player._x)) || ((this._xscale == -100) && (this._x < game.player._x))) {
if (!random(10)) {
this.turn0();
}
} else if (!random(20)) {
this.jump0();
}
}
}
if (!_local2) {
if (!random(80)) {
this.turn0();
}
}
};
_local2.moveAction = function () {
this.dx = this._xscale * this.xSpeed;
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, (this._y + game._y) - 5, true)) {
this._x = this._x + Math.round(this.dx);
}
if (this.chkLand()) {
if (this._currentframe != 1) {
this.gotoAndStop("move");
var _local2 = game.getNextHighestDepth();
game.attachMovie("dust", "fx" + _local2, _local2, {_x:this._x, _y:this._y});
}
}
if (!this.chkFall()) {
this.specMove();
this.chkTurn();
}
this.gForce(0.8);
this.moveRange();
};
_local2.moveAction0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if (((((this._x + game._x) < -200) || ((this._x + game._x) > 700)) || ((this._y + game._y) < -200)) || ((this._y + game._y) > 550)) {
return(undefined);
}
this.enterFrameFunc();
};
}
function newToy7(xPos, yPos) {
var _local4 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("jackInTheBox", "enemy" + _local4, _local4, {_x:xPos, _y:yPos});
_local2.xSpeed = 0.04;
_local2.dx = 0;
_local2.dy = 0;
_local2.hp = 150;
_local2.boxCount = 200;
_local2.maxYspeed = 20;
_local2.toBox = toBox;
_local2.hitTmp = hitAction0;
_local2.hitAction = hitAction;
_local2.gForce = gForce;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.moveRange = moveRange;
_local2.turn0 = function () {
this._xscale = this._xscale * -1;
};
_local2.idle0 = function () {
this.gotoAndStop("idle");
this.enterFrameFunc = function () {
if (((this._y - game.player._y) < 10) && ((this._y - game.player._y) > -50)) {
if (Math.abs(this._x - game.player._x) < 250) {
var _local2 = true;
if (((this._xscale == 100) && (this._x > game.player._x)) || ((this._xscale == -100) && (this._x < game.player._x))) {
if (!random(10)) {
this.turn0();
}
} else if (Math.abs(this._x - game.player._x) < 150) {
if (!random(20)) {
this.attack0();
}
} else if (!random(20)) {
this.jump0();
return(undefined);
}
}
}
if (!_local2) {
if (!random(80)) {
this.turn0();
}
}
if (!random(80)) {
this.jump0();
return(undefined);
}
this.chkLand();
this.chkFall();
this.gForce();
};
};
_local2.jump0 = function () {
this.gotoAndStop("idle");
this.dy = -10 - random(10);
this.enterFrameFunc = function () {
this.dx = this._xscale * this.xSpeed;
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, (this._y + game._y) - 5, true)) {
this._x = this._x + Math.round(this.dx);
}
this.gForce();
if (this.chkLand()) {
this.idle0();
}
this.chkFall();
};
};
_local2.attack0 = function () {
this.gotoAndStop("attack");
this.enterFrameFunc = function () {
if (this.mc._currentframe == 12) {
this.hitAction0 = this.hitTmp;
} else if (this.mc._currentframe == 37) {
var _local4 = getGlbPt(this.mc);
var _local3 = game.getNextHighestDepth();
var _local2 = game.attachMovie("bullet", "blt" + _local3, _local3, {_x:_local4[0] - game._x, _y:_local4[1] - game._y});
_local2._xscale = this._xscale;
_local2.dx = this._xscale * 0.06;
_local2.dy = -1;
_local2.counter = 30;
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this.dy = this.dy + 0.1;
if ((--this.counter) < 0) {
var _local2 = game.getNextHighestDepth();
game.attachMovie("hitFx", "fx" + _local2, _local2, {_x:this._x, _y:this._y});
this.removeMovieClip();
} else if (this.hitTest(game.player.hitMc)) {
game.player.hitAction0();
var _local2 = game.getNextHighestDepth();
game.attachMovie("hitFx", "fx" + _local2, _local2, {_x:this._x, _y:this._y});
this.removeMovieClip();
}
};
} else if (this.mc._currentframe == 42) {
delete this.hitAction0;
} else if (this.mc._currentframe == this.mc._totalframes) {
this.idle0();
}
this.chkLand();
this.chkFall();
this.gForce();
};
};
_local2.moveAction0 = _local2.idle0;
_local2.idle0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
if (((((this._x + game._x) < -200) || ((this._x + game._x) > 700)) || ((this._y + game._y) < -200)) || ((this._y + game._y) > 550)) {
return(undefined);
}
this.moveRange();
this.enterFrameFunc();
};
}
function newToy8(xPos, yPos) {
var _local3 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("plane", "enemy" + _local3, _local3, {_x:xPos, _y:yPos});
_local2.xSpeed = 0.04;
_local2.dx = 0;
_local2.dy = 0;
_local2.hp = 80;
_local2.boxCount = 250;
_local2.maxYspeed = 15;
_local2.toBox = toBox;
_local2.hitAction0 = hitAction0;
_local2.hitAction = hitAction;
_local2.moveRange = moveRange;
_local2.turn0 = turn0;
_local2.turn = turn;
_local2.gForce = gForce;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.startRise = function () {
if (!this.riseCnt) {
this.createEmptyMovieClip("riseCnt", this.getNextHighestDepth());
}
this.riseCnt.counter = 70;
this.riseCnt.onEnterFrame = function () {
this._parent._y = this._parent._y - 1;
if ((--this.counter) < 0) {
this.removeMovieClip();
}
};
};
_local2.moveAction0 = function () {
this.gotoAndStop("move");
this.counter = 0;
this.enterFrameFunc = this.moveAction;
};
_local2.moveAction = function () {
this.dx = this._xscale * this.xSpeed;
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, this._y + game._y, true)) {
this._x = this._x + Math.round(this.dx);
if ((this._x < 30) || (this._x > (sceneWidth - 30))) {
this.turn0();
}
} else {
this.turn0();
}
if (game.map.ground.hitTest(this._x + game._x, (this._y + 5) + game._y, true)) {
this.startRise();
}
if (this._y > (sceneHeight - 100)) {
this.startRise();
}
};
_local2.moveAction0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
this.moveRange();
this.enterFrameFunc();
};
}
function newSanta1(xPos, yPos) {
var _local3 = game.enemy.getNextHighestDepth();
var _local2 = game.enemy.attachMovie("santa", "boss", _local3, {_x:xPos, _y:yPos});
_local2.life = 10;
ui.bossLife.gotoAndStop(_local2.life + 1);
ui.bossLife._y = ui.bossLife._y - 40;
_local2.xSpeed = 0.12;
_local2.dx = 0;
_local2.dy = 0;
_local2.chkTurn = chkTurn;
_local2.gForce = gForce;
_local2.chkLand = chkLand;
_local2.chkFall = chkFall;
_local2.startFall = startFall;
_local2.maxYspeed = 25;
_local2.moveRange = moveRange;
_local2.hitTmp = function () {
this.life--;
ui.bossLife.gotoAndStop(this.life + 1);
if (this.life == 0) {
this.red.removeMovieClip();
this.filters = undefined;
}
this.gotoAndStop("hit");
this.dy = -12;
this.dx = ((this._x - game.player._x) / Math.abs(this._x - game.player._x)) * 5;
this.enterFrameFunc = this.hitAction;
this.counter = 100;
};
_local2.hitTmp2 = function () {
var _local2 = this.attachMovie("protectFx", "fx" + this.getNextHighestDepth(), this.getNextHighestDepth());
_local2.blendMode = 4;
_local2._alpha = 60;
};
_local2.hitAction0 = _local2.hitTmp2;
_local2.hitAction = function () {
if (!game.map.ground.hitTest((this._x + ((20 * Math.abs(this.dx)) / this.dx)) + game._x, this._y + game._y, true)) {
this._x = this._x + Math.round(this.dx);
}
this.moveRange();
this.chkTurn;
this.gForce();
if (this.chkLand()) {
this.dx = this.dx * 0.85;
this.gotoAndStop("land");
}
this.chkFall();
if (this.life == 0) {
if ((--this.counter) < 0) {
missionComplete();
delete this.onEnterFrame;
} else {
var _local2 = this.getNextHighestDepth();
this.attachMovie("bulletFx" + (random(3) + 1), "fx" + _local2, _local2, {_x:(this._width * 0.5) - random(this._width), _y:-50 - random(20)});
}
} else if ((--this.counter) < 0) {
if (this.life == 3) {
this.xSpeed = 0.15;
this.createEmptyMovieClip("red", this.getNextHighestDepth());
this.red.counter = 0;
this.red.onEnterFrame = function () {
if ((++this.counter) > 100) {
this.counter = 0;
} else if ((this.counter % 10) == 0) {
redFilter(this._parent, 100);
} else if ((this.counter % 10) == 1) {
this._parent.filters = undefined;
}
};
} else if (this.life == 1) {
this.xSpeed = 0.18;
this.red.onEnterFrame = function () {
if ((++this.counter) > 100) {
this.counter = 0;
} else if ((this.counter % 5) == 0) {
redFilter(this._parent, 100);
} else if ((this.counter % 5) == 1) {
this._parent.filters = undefined;
}
};
}
this.hitAction0 = this.hitTmp2;
this.idle0();
} else if (this.counter > 20) {
var _local2 = this.getNextHighestDepth();
this.attachMovie("bulletFx" + (random(3) + 1), "fx" + _local2, _local2, {_x:(this._width * 0.5) - random(this._width), _y:-50 - random(20)});
}
};
_local2.turn = (_local2.turn0 = function () {
this._xscale = this._xscale * -1;
this.dx = this._xscale * this.xSpeed;
});
_local2.idle0 = function () {
this.gotoAndStop("idle");
this.counter = 60;
this.enterFrameFunc = this.idle;
};
_local2.idle = function () {
this.gForce();
this.chkLand();
this.chkFall();
if ((--this.counter) < 0) {
this.run0();
}
};
_local2.run0 = function () {
this.gotoAndStop("run");
this.dx = this._xscale * this.xSpeed;
this.counter = 60;
this.enterFrameFunc = this.run;
};
_local2.run = function () {
this._x = this._x + this.dx;
if ((this._x <= 0) && (this._xscale == -100)) {
this.turn();
} else if ((this._x >= sceneWidth) && (this._xscale == 100)) {
this.turn();
} else if (this.counter > 0) {
this.counter--;
} else if (!random(100)) {
this.tired0();
}
this.gForce();
this.chkLand();
this.chkFall();
};
_local2.tired0 = function () {
this.gotoAndStop("tired");
this.counter = 100;
if (this.life < 4) {
this.counter = 60;
if (this.life == 1) {
thsi.counter = 40;
}
}
this.hitAction0 = this.hitTmp;
this.enterFrameFunc = this.tired;
};
_local2.tired = function () {
if ((--this.counter) < 0) {
this.hitAction0 = this.hitTmp2;
this.idle0();
}
this.gForce();
this.chkLand();
this.chkFall();
};
_local2.idle0();
_local2.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
this.enterFrameFunc();
};
}
function newZass1(xPos, yPos) {
var _local9 = game.enemy.getNextHighestDepth();
var _local3 = game.enemy.attachMovie("zass", "boss2", _local9, {_x:xPos, _y:yPos});
_local3.life = 10;
_local3.range = function () {
if (this._x < 20) {
this._x = 20;
this.dx = ((this.dx > 0) ? (this.dx) : (-this.dx));
} else if (this._x > (sceneWidth - 20)) {
this._x = sceneWidth - 20;
this.dx = ((this.dx < 0) ? (this.dx) : (-this.dx));
}
};
_local3.soldier = 0;
ui.bossLife.gotoAndStop(_local3.life + 1);
ui.bossLife._y = ui.bossLife._y - 40;
_local3.dx = 0;
_local3.dy = 0;
_local3.dropList = [];
_local3.dropList[1] = [6, 7, 8, 7, 8, 7];
_local3.dropList[2] = [4, 4, 6, 8, 7, 7];
_local3.dropList[3] = [2, 4, 5, 6, 6];
_local3.dropList[4] = [1, 4, 5, 6, 6];
_local3.dropList[5] = [2, 3, 3, 4, 5];
_local3.dropList[6] = [1, 3, 3, 4, 5];
_local3.dropList[7] = [1, 1, 1, 2, 2];
_local3.dropList[8] = [1, 1, 1, 2];
_local3.dropList[9] = [1, 1, 1, 2];
_local3.dropList[10] = [1, 1, 2];
_local3.hitTmp = function () {
if ((--this.life) == 0) {
if (game.timer != 0) {
var _local2 = 300 - Math.round(game.timer / 30);
if (saveData.data.beatZass != 0) {
saveData.data.beatZass = Math.min(_local2, saveData.data.beatZass);
} else {
saveData.data.beatZass = _local2;
}
}
this.hitAction0 = this.hitTmp2;
}
this.gotoAndStop("hit");
ui.bossLife.gotoAndStop(this.life + 1);
this.dy = -18 - random(5);
this.dx = ((this._x - game.player._x) / Math.abs(this._x - game.player._x)) * (random(4) + 3);
};
_local3.hitTmp2 = function () {
var _local2 = this.attachMovie("protectFx", "fx" + this.getNextHighestDepth(), this.getNextHighestDepth());
_local2._y = _local2._y + 20;
_local2.blendMode = 4;
_local2._alpha = 60;
};
_local3.hitAction0 = _local3.hitTmp2;
_local3.hitAction = function () {
this._x = this._x + this.dx;
this.dy = this.dy + g;
this._y = this._y + this.dy;
this.range();
while (game.map.ground.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
}
if (game.map.ground.hitTest(this._x + game._x, (this._y + game._y) + 1, true)) {
this.dy = this.dy * -0.6;
this.dx = this.dx * 0.6;
if (this.life == 0) {
if (!this.lose) {
missionComplete();
} else {
this.lose = true;
}
}
} else if ((--this.counter) < 0) {
this.hitAction0 = this.hitTmp2;
this.drop0();
}
};
_local3.getNewPt = function () {
do {
var x = ((game.player._x + random(600)) - 300);
var _local2 = (game.player._y - 70) - random(200);
} while ((x < 0) || (x > sceneWidth));
this.desPt = [x, _local2];
};
_local3.idle0 = function () {
this.getNewPt();
this.gotoAndStop("idle");
this.counter = 0;
this.enterFrameFunc = this.idle;
};
_local3.idle = function () {
this.dx = this.dx + ((((this.desPt[0] - this._x) / 40) - this.dx) / 40);
this.dy = this.dy + ((((this.desPt[1] - this._y) / 20) - this.dy) / 20);
this._x = this._x + this.dx;
this._y = this._y + this.dy;
if ((++this.counter) > 50) {
if (!random(10)) {
this.getNewPt();
this.counter = 0;
} else if (this.soldier == 0) {
if (!random(10)) {
if (this._y < (game.player._y - 50)) {
this.crash0();
}
}
} else if (!random(60)) {
this.attack0();
}
}
};
_local3.drop0 = function () {
this.getNewPt();
this.gotoAndStop("drop");
this.mc2.gotoAndStop(this.mc2._totalframes);
this.counter = 0;
this.soldierMade = 0;
this.enterFrameFunc = this.drop;
};
_local3.drop = function () {
if (this.mc2._currentframe == this.mc2._totalframes) {
this.dx = this.dx + ((((this.desPt[0] - this._x) / 40) - this.dx) / 40);
this.dy = this.dy + ((((this.desPt[1] - this._y) / 20) - this.dy) / 20);
this._x = this._x + this.dx;
this._y = this._y + this.dy;
if ((++this.counter) > 50) {
if (!random(10)) {
this.getNewPt();
this.counter = 0;
} else if (!random(5)) {
if ((this._x > 250) && (this._x < (sceneWidth - 250))) {
this.mc2.gotoAndPlay(1);
}
}
}
} else if (this.mc2._currentframe == 20) {
this.newBall(this.dropList[this.life][this.soldierMade]);
this.counter = 0;
if ((++this.soldierMade) == this.dropList[this.life].length) {
this.soldier = this.soldier + this.soldierMade;
this.idle0();
}
}
};
_local3.newBall = function (typ) {
var _local4 = game.getNextHighestDepth();
var _local3 = game.attachMovie("zassBall", "ball" + _local4, _local4, {_x:this._x, _y:this._y + 17});
_local3.typ = typ;
_local3.dy = 0;
_local3.expl = function () {
var _local3 = game.getNextHighestDepth();
_root.playSound("soundToBox");
game.attachMovie("smokeFx", "fx" + _local3, _local3, {_x:this._x, _y:this._y - 10});
_root["newToy" + this.typ](this._x, this._y - 17);
this.removeMovieClip();
};
_local3.onEnterFrame = function () {
this._y = this._y + this.dy;
this.dy = this.dy + 0.5;
if (game.map.ground.hitTest(this) || (game.map.platform.hitTest(this._x + game._x, this._y + game._y, true))) {
this.expl();
}
};
};
_local3.attack0 = function () {
this.gotoAndStop("attack");
this.counter = 50;
this.desPt = [game.player._x, game.player._y];
this.enterFrameFunc = this.attack;
};
_local3.attack = function () {
if (this.counter > 0) {
this.counter--;
if ((this.counter % 3) == 0) {
this.filters = null;
} else if ((this.counter % 3) == 1) {
redFilter(this, 50);
}
return(undefined);
}
this.dx = this.dx + ((((this.desPt[0] - this._x) / 20) - this.dx) / 8);
this.dy = this.dy + ((((this.desPt[1] - this._y) / 20) - this.dy) / 8);
this._x = this._x + this.dx;
this._y = this._y + this.dy;
if ((Math.abs(this._x - this.desPt[0]) < 5) && (Math.abs(this._y - this.desPt[1]) < 5)) {
if (!random(5)) {
this.idle0();
}
}
};
_local3.crash0 = function () {
this.gotoAndStop("attack");
var _local2 = getRotation(this._x, this._y, game.player._x, game.player._y);
var _local3 = 20;
this.down = false;
this.counter = 20 + (this.life * 3);
this.dx = _local3 * Math.cos(_local2 * 0.0174);
this.dy = _local3 * Math.sin(_local2 * 0.0174);
this.enterFrameFunc = this.crash;
};
_local3.crash = function () {
if (this.counter > 0) {
this.counter--;
if ((this.counter % 3) == 0) {
this.filters = null;
} else if ((this.counter % 3) == 1) {
redFilter(this, 50);
}
return(undefined);
}
this._x = this._x + this.dx;
if (this._x < 20) {
this.idle0();
} else if (this._x > (game.map._width - 20)) {
this.idle0();
}
this._y = this._y + this.dy;
while (game.map.ground.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
}
if (game.map.ground.hitTest(this._x + game._x, (this._y + game._y) + 1, true)) {
this.coma0();
var _local2 = game.getNextHighestDepth();
game.attachMovie("dust", "fx" + _local2, _local2, {_x:this._x, _y:this._y + 10});
}
};
_local3.coma0 = function () {
this.gotoAndStop("coma");
this.counter = 40 + (this.life * 16);
this.hitAction0 = this.hitTmp;
this.enterFrameFunc = this.coma;
};
_local3.coma = function () {
var _local2 = this.getNextHighestDepth();
this.attachMovie("bulletFx" + (random(3) + 1), "fx" + _local2, _local2, {_x:50 - random(100), _y:-50 - random(50)});
this._x = this._x + this.dx;
this.dy = this.dy + g;
this._y = this._y + this.dy;
this.range();
while (game.map.ground.hitTest(this._x + game._x, this._y + game._y, true)) {
this._y--;
}
if (game.map.ground.hitTest(this._x + game._x, (this._y + game._y) + 1, true)) {
this.dy = this.dy * -0.6;
this.dx = this.dx * 0.6;
if (this.dy > 0.3) {
_local2 = game.getNextHighestDepth();
game.attachMovie("dust", "fx" + _local2, _local2, {_x:this._x, _y:this._y + 10});
}
if (this.life == 0) {
missionComplete();
}
}
if (((--this.counter) < 0) && (this.life != 0)) {
this.hitAction0 = this.hitTmp2;
this.drop0();
}
};
_local3.drop0();
_local3.onEnterFrame = function () {
if (gamePause) {
return(undefined);
}
this.enterFrameFunc();
};
}
function setSecretDoor(doorIn, doorOut) {
doorIn.link = doorOut;
doorIn.counter = (doorOut.counter = 0);
doorIn.transpot = (doorOut.transpot = function (door) {
door.visited = true;
game.player._x = door.link._x + (game.player._xscale * 0.5);
game.player._y = door.link._y - 50;
game._x = (250 - game.player._x) - game._x;
game._y = (200 - game.player._y) - game._y;
});
doorIn.onEnterFrame = function () {
if (this.counter > 0) {
this.counter--;
} else if ((Math.abs(game.player._x - this._x) < 10) && (Math.abs(game.player._y - this._y) < 10)) {
this.counter = 90;
cutScene2(this.transpot, this);
}
};
doorOut.link = doorIn;
doorOut.onEnterFrame = function () {
if (this.counter > 0) {
this.counter--;
} else if ((Math.abs(game.player._x - this._x) < 10) && (Math.abs(game.player._y - this._y) < 10)) {
this.counter = 90;
cutScene2(this.transpot, this);
}
};
}
function setMovingTile1(tile, xs, ys, len) {
if (xs) {
tile.dx = 1;
tile.xspeed = xs;
tile.startx = tile._x;
tile.endx = tile._x + len;
tile.onEnterFrame = function () {
if (this.dx > 0) {
var _local5 = Math.round((this.endx - this._x) / 5);
} else {
var _local5 = Math.round((this.startx - this._x) / 5);
}
var _local3 = getMin(this.xspeed * this.dx, _local5);
for (var _local4 in _root.game.active) {
if (!_root.game.active[_local4].jumping) {
if (this.hitTest(_root.game.active[_local4]._x + _root.game._x, (_root.game.active[_local4]._y + _root.game._y) + 1, true)) {
_root.game.active[_local4]._x = _root.game.active[_local4]._x + _local3;
_root.game.active[_local4].onMovingTile = true;
}
}
}
this._x = this._x + _local3;
this._parent._parent[this._name]._x = this._parent._parent[this._name]._x + _local3;
if (_local5 == 0) {
this.dx = this.dx * -1;
}
};
} else if (ys) {
tile.dy = 1;
tile.yspeed = ys;
tile.starty = tile._y;
tile.endy = tile._y + len;
tile.onEnterFrame = function () {
if (this.dy > 0) {
var _local5 = Math.round((this.endy - this._y) / 5);
} else {
var _local5 = Math.round((this.starty - this._y) / 5);
}
var _local3 = getMin(this.yspeed * this.dy, _local5);
for (var _local4 in _root.game.active) {
if (!_root.game.active[_local4].jumping) {
if (this.hitTest(_root.game.active[_local4]._x + _root.game._x, (_root.game.active[_local4]._y + _root.game._y) + 1, true)) {
_root.game.active[_local4]._y = _root.game.active[_local4]._y + _local3;
_root.game.active[_local4].onMovingTile = true;
}
}
}
this._y = this._y + _local3;
this._parent._parent[this._name]._y = this._parent._parent[this._name]._y + _local3;
if (_local5 == 0) {
this.dy = this.dy * -1;
}
};
}
}
function setMovingTile4(tile, speed) {
tile.speed = speed;
tile.onEnterFrame = function () {
for (var _local3 in _root.game.active) {
if (!_root.game.active[_local3].jumping) {
if (this.hitTest(_root.game.active[_local3]._x + _root.game._x, (_root.game.active[_local3]._y + _root.game._y) + 1, true)) {
_root.game.active[_local3]._x = _root.game.active[_local3]._x + this.speed;
}
}
}
};
}
function setMovingTile5(tile, hangTime) {
tile.starty = tile._y;
tile.counter = 0;
tile.hangTime = hangTime;
tile.startFall = function () {
this.counter = (this.counter2 = 0);
this.dy = 0;
this.onEnterFrame = function () {
this._alpha = this._alpha - 2;
this._y = this._y + this.dy;
this._parent._parent[this._name]._y = this._parent._parent[this._name]._y + this.dy;
this.dy = this.dy + (g + 0.1);
if ((++this.counter) > 120) {
this._y = this.starty;
this._parent._parent[this._name]._y = this.starty - 10;
this._alpha = 0;
this.wait();
}
};
};
tile.wait = function () {
this.counter = (this.counter2 = 0);
this.onEnterFrame = function () {
if (this.hitTest(_root.game.player._x + _root.game._x, (_root.game.player._y + _root.game._y) + 1, true)) {
this.counter2 = 0;
if ((++this.counter) > this.hangTime) {
this.startFall();
} else if (this.counter > (this.hangTime - 15)) {
if ((this.counter % 3) == 0) {
this._parent._parent[this._name]._alpha = 50;
} else {
this._parent._parent[this._name]._alpha = 100;
}
}
} else if ((++this.counter2) > 30) {
this.counter = 0;
}
if (this._parent._parent[this._name]._alpha < 100) {
this._parent._parent[this._name]._alpha = this._parent._parent[this._name]._alpha + 10;
}
};
};
tile.wait();
}
function gotoPage(link) {
var _local3 = _root.attachMovie("cutScene", "cs", _root.getNextHighestDepth());
_local3.link = link;
_local3.onEnterFrame = function () {
if (this._currentframe == 5) {
_root.gotoAndStop(this.link);
}
};
}
function cutScene(func, mc) {
var _local3 = _root.attachMovie("cutScene", "cs", _root.getNextHighestDepth());
_local3.func = func;
if (mc != undefined) {
_local3.mc = mc;
}
_local3.onEnterFrame = function () {
if (this._currentframe == 7) {
if (this.mc) {
this.func(this.mc);
} else {
this.func();
}
}
};
}
function cutScene1(func, mc) {
var _local3 = _root.attachMovie("cutScene1", "cs", _root.getNextHighestDepth());
_local3.func = func;
if (mc != undefined) {
_local3.mc = mc;
}
_local3.onEnterFrame = function () {
if (this._currentframe == 35) {
if (this.mc) {
this.func(this.mc);
} else {
this.func();
}
}
};
}
function cutScene2(func, mc) {
var _local3 = _root.attachMovie("cutScene2", "cs", _root.getNextHighestDepth());
_local3.func = func;
if (mc != undefined) {
_local3.mc = mc;
}
_local3.onEnterFrame = function () {
if (this._currentframe == 35) {
if (this.mc) {
this.func(this.mc);
} else {
this.func();
}
}
};
}
function setSelMsn() {
if (saveData.data.missionFinished == undefined) {
saveData.data.missionFinished = 1;
saveData.data.mdFound = [];
saveData.data.beatZass = 0;
}
if (saveData.flush(1000) != true) {
saveData.data.missionFinished = 1;
saveData.data.mdFound = [];
saveData.data.beatZass = 0;
}
var _local8 = 0;
var _local7 = 0;
while (_local7 < 25) {
if (saveData.data.mdFound[_local7] == 1) {
_local8++;
}
_local7++;
}
mdTxt.text = ("Magic door found: " + _local8) + "/8";
if (saveData.data.beatZass == 0) {
bzTxt.text = "Beat zass in ??? seconds";
} else {
bzTxt.text = ("Beat zass in " + saveData.data.beatZass) + " seconds";
}
_local7 = 1;
while (_local7 <= 5) {
var _local6 = 1;
while (_local6 <= 5) {
var _local3 = _root[("m" + _local7) + _local6];
_local3.num = _local7;
_local3.num2 = _local6;
if ((((_local7 - 1) * 5) + _local6) <= saveData.data.missionFinished) {
_local3.gotoAndStop(_local7);
_local3.numMc.gotoAndStop(_local6);
_local3.numMc.mc.gotoAndStop(1);
_local3.star.gotoAndStop(1);
_local3.clr = function () {
delete this.onRelease;
};
_local3.sel = function () {
this.showMc.gotoAndStop(2);
_root.level = this.num;
_root.stage = this.num2;
if ((_root.level == 5) && (_root.stage == 3)) {
var _local3 = function () {
_root.gotoAndStop("introBoss2");
};
_root.cutScene2(_local3);
} else if ((_root.level == 4) && (_root.stage == 5)) {
var _local3 = function () {
_root.gotoAndStop("introBoss1");
};
_root.cutScene2(_local3);
} else {
if ((_root.level == 1) && (_root.stage == 1)) {
_root.fromTheVeryBeginning = true;
} else {
_root.fromTheVeryBeginning = false;
}
_root.totaltime = 0;
_root.gotoPage("gaming");
}
};
_local3.onPress = function () {
this._y = this._y + 2;
};
_local3.onRollOver = function () {
this.star.play();
this.numMc.mc.play();
};
_local3.onRollOut = (_local3.onReleaseOutside = function () {
this.star.gotoAndStop(1);
this.numMc.mc.gotoAndStop(1);
});
_local3.onRelease = function () {
this._y = this._y - 2;
this.sel();
var _local4 = 1;
while (_local4 <= 5) {
var _local3 = 1;
while (_local3 <= 5) {
_root[("m" + _local4) + _local3].clr();
_local3++;
}
_local4++;
}
};
_local3.onReleaseOutside = function () {
this._y = this._y - 2;
};
} else {
_local3.gotoAndStop(_local3._totalframes);
}
_local6++;
}
_local7++;
}
}
function initGameUI() {
ui.ntb.gotoAndStop("zeroAlpha");
ui.pauseMc.btnFunc = function () {
if (gamePause) {
gamePause = false;
playMc(game);
pauseMenu.back();
this._parent.gotoAndStop("play");
ui.pauseMc.btn.onRelease = ui.pauseMc.btnFunc;
} else if (!pauseMenu) {
gamePause = true;
stopMc(game);
this._parent.gotoAndStop("pause");
newPauseMenu();
ui.pauseMc.btn.onRelease = ui.pauseMc.btnFunc;
}
};
ui.pauseMc.btn.onRelease = ui.pauseMc.btnFunc;
if (music) {
ui.musicMc.gotoAndStop("stop");
} else {
ui.musicMc.gotoAndStop("play");
}
ui.musicMc.btnFunc = function () {
if (music) {
music = false;
_root[nowMusic].fadeOut(5);
this._parent.gotoAndStop("play");
} else {
music = true;
_root[nowMusic].fadeIn(5);
this._parent.gotoAndStop("stop");
}
ui.musicMc.btn.onRelease = ui.musicMc.btnFunc;
};
ui.musicMc.btn.onRelease = ui.musicMc.btnFunc;
}
function stopMc(mc) {
mc.stop();
for (var _local2 in mc) {
if (typeof(mc[_local2]) == "movieclip") {
if (mc[_local2]._parent == mc) {
stopMc(mc[_local2]);
}
}
}
}
function playMc(mc) {
for (var _local2 in mc) {
if (typeof(mc[_local2]) == "movieclip") {
if (mc[_local2]._parent == mc) {
playMc(mc[_local2]);
}
}
}
if (!mc.sap) {
mc.play();
}
}
function newPauseMenu() {
if (!pauseMenu._x) {
this.attachMovie("pauseMenu", "pauseMenu", this.getNextHighestDepth());
pauseMenu._y = -pauseMenu._height;
}
pauseMenu.btnQuit.onRelease = function () {
var _local2 = function () {
game.removeMovieClip();
bg.removeMovieClip();
bg2.removeMovieClip();
bg3.removeMovieClip();
pauseMenu.removeMovieClip();
ui.removeMovieClip();
playerLife = defaultLife;
playerMagicLv = 0;
currentScore = 0;
_root.gotoAndStop("title");
};
cutScene(_local2);
};
pauseMenu.back = function () {
this.onEnterFrame = function () {
this._y = this._y + Math.round((((-this._height) - 20) - this._y) / 4);
if (this._y < (-this._height)) {
gamePause = false;
playMc(game);
ui.pauseMc.gotoAndStop("play");
ui.pauseMc.btn.onRelease = ui.pauseMc.btnFunc;
this.removeMovieClip();
}
};
};
pauseMenu.btnContinue.onRelease = function () {
this._parent.back();
};
pauseMenu.onEnterFrame = function () {
this._y = this._y + Math.round((-this._y) / 4);
if (this._y == 0) {
delete this.onEnterFrame;
}
};
}
function showTime() {
var _local1 = 1000 + (game.timer / 30);
var _local4 = Number(_local1.toString().slice(3, 4)) + 1;
var _local3 = Number(_local1.toString().slice(2, 3)) + 1;
var _local2 = Number(_local1.toString().slice(1, 2)) + 1;
ui.time.num1.gotoAndStop(_local4);
ui.time.num10.gotoAndStop(_local3);
ui.time.num100.gotoAndStop(_local2);
}
function showEnemyNum(mc, num) {
var _local1 = 100 + num;
var _local4 = Number(_local1.toString().slice(2, 3)) + 1;
var _local3 = Number(_local1.toString().slice(1, 2)) + 1;
mc.num1.gotoAndStop(_local4);
mc.num10.gotoAndStop(_local3);
mc.num = num;
}
function showNum(mc, num) {
var _local1 = 1000000000 + num;
var _local11 = Number(_local1.toString().slice(9, 10)) + 1;
var _local10 = Number(_local1.toString().slice(8, 9)) + 1;
var _local9 = Number(_local1.toString().slice(7, 8)) + 1;
var _local8 = Number(_local1.toString().slice(6, 7)) + 1;
var _local7 = Number(_local1.toString().slice(5, 6)) + 1;
var _local6 = Number(_local1.toString().slice(4, 5)) + 1;
var _local5 = Number(_local1.toString().slice(3, 4)) + 1;
var _local4 = Number(_local1.toString().slice(2, 3)) + 1;
var _local3 = Number(_local1.toString().slice(1, 2)) + 1;
mc.num1.gotoAndStop(_local11);
mc.num10.gotoAndStop(_local10);
mc.num100.gotoAndStop(_local9);
mc.num1000.gotoAndStop(_local8);
mc.num10000.gotoAndStop(_local7);
mc.num100000.gotoAndStop(_local6);
mc.num1000000.gotoAndStop(_local5);
mc.num10000000.gotoAndStop(_local4);
mc.num100000000.gotoAndStop(_local3);
}
function newPowerUp(xPos, yPos) {
var _local3 = game.getNextHighestDepth();
var _local4 = game.attachMovie("powerUp", "pu" + _local3, _local3, {_x:xPos, _y:yPos});
_local4.onEnterFrame = function () {
if (((((this._x + game._x) < 0) || ((this._x + game._x) > 500)) || ((this._y + game._y) < 0)) || ((this._y + game._y) > 350)) {
return(undefined);
}
if (this.hitTest(game.player.hitMc)) {
game.player.magicUp();
_root.playSound("soundCoin");
this.removeMovieClip();
}
};
}
function newPowerUp(xPos, yPos) {
var _local1 = game.getNextHighestDepth();
var _local4 = game.attachMovie("coin", "coin" + _local1, _local1, {_x:xPos, _y:yPos});
}
function newLifeUp(xPos, yPos) {
var _local1 = game.getNextHighestDepth();
var _local4 = game.attachMovie("coin", "coin" + _local1, _local1, {_x:xPos, _y:yPos});
}
function newCoin(xPos, yPos, type) {
var _local3 = game.getNextHighestDepth();
var _local4 = game.attachMovie("coin", "coin" + _local3, _local3, {_x:xPos, _y:yPos});
_local4.coin = true;
_local4.type = type;
if (_local4.type == "life") {
_local4.gotoAndStop("life");
} else if (_local4.type == "magic") {
_local4.gotoAndStop("magic");
} else if (type != undefined) {
_local4.gotoAndStop(type);
}
_local4.onEnterFrame = function () {
if (this.hitMc.hitTest(game.player.hitMc)) {
if (this.type == "life") {
if (game.player.life < _root.maxLife) {
game.player.life = game.player.life + 2;
if (game.player.life > _root.maxLife) {
game.player.life = _root.maxLife;
}
_root.playerLife = game.player.life;
ui.life.gotoAndStop(game.player.life);
var _local3 = game.getNextHighestDepth();
var _local4 = game.attachMovie("scoreShow", "nm" + _local3, _local3, {_x:this._x, _y:this._y - 30});
_local4.gotoAndStop("life");
} else {
showScoreEffect(this._x + game._x, (this._y + game._y) - 30, 500);
}
} else if (this.type == "magic") {
if (game.player.magicLv == 2) {
showScoreEffect(this._x + game._x, (this._y + game._y) - 30, 500);
} else {
game.player.magicUp();
var _local3 = game.getNextHighestDepth();
var _local4 = game.attachMovie("scoreShow", "nm" + _local3, _local3, {_x:this._x, _y:this._y - 30});
_local4.gotoAndStop("power");
}
} else {
showScoreEffect(this._x + game._x, (this._y + game._y) - 30, this.score);
}
this.hit();
}
};
_local4.hit = function () {
whiteFilter(this);
_root.playSound("soundCoin");
this.swapDepths(game.getNextHighestDepth() + 1);
this.onEnterFrame = function () {
this._xscale = this._xscale + 10;
this._yscale = this._yscale + 10;
this._alpha = this._alpha - 10;
if (this._alpha < 0) {
this.removeMovieClip();
}
};
};
}
function showScoreEffect(xpos, ypos, score) {
var _local4 = ui.getNextHighestDepth();
var _local2 = ui.attachMovie("scoreShow", "nm" + _local4, _local4, {_x:xpos, _y:ypos});
_local2.gotoAndStop("s" + score);
_local2.score = score;
var _local3 = getRotation(_local2._x, _local2._y, 480, 0);
_local2.dx = 4 * Math.cos(_local3 * 0.0174);
_local2.dy = 4 * Math.sin(_local3 * 0.0174);
_local2.onEnterFrame = function () {
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this.dx = this.dx * 1.12;
this.dy = this.dy * 1.12;
this._xscale = this._xscale - 2.5;
this._yscale = this._xscale;
this._alpha = this._alpha - 2.5;
if ((this._x > 470) && (this._y < 20)) {
currentScore = currentScore + this.score;
showNum(ui.score, currentScore);
this.removeMovieClip();
}
};
}
function whiteFilter(mc, blurXY) {
var _local5 = 16777215 /* 0xFFFFFF */;
var _local11 = 100;
if (blurXY == undefined) {
var _local8 = 100;
var _local7 = 100;
} else {
var _local8 = blurXY;
var _local7 = blurXY;
}
var _local9 = 1;
var _local3 = 1;
var _local6 = true;
var _local10 = false;
var _local4 = new flash.filters.GlowFilter(_local5, _local11, _local8, _local7, _local9, _local3, _local6, _local10);
var _local1 = new Array();
_local1.push(_local4);
mc.filters = _local1;
}
function redFilter(mc, blurXY) {
var _local5 = 16711680 /* 0xFF0000 */;
var _local11 = 100;
if (blurXY == undefined) {
var _local8 = 100;
var _local7 = 100;
} else {
var _local8 = blurXY;
var _local7 = blurXY;
}
var _local9 = 1;
var _local3 = 1;
var _local6 = true;
var _local10 = false;
var _local4 = new flash.filters.GlowFilter(_local5, _local11, _local8, _local7, _local9, _local3, _local6, _local10);
var _local1 = new Array();
_local1.push(_local4);
mc.filters = _local1;
}
function getDis(ax, ay, bx, by) {
return(Math.sqrt((ax - bx) * (ax - bx), (ay - by) * (ay - by)));
}
function getMin(a, b) {
if (Math.abs(a) < Math.abs(b)) {
return(a);
}
return(b);
}
function getMax(a, b) {
if (Math.abs(a) > Math.abs(b)) {
return(a);
}
return(b);
}
function getGlbPt(mc) {
var _local1 = {x:0, y:0};
mc.localToGlobal(_local1);
return([_local1.x, _local1.y]);
}
function getRotation(pointAx, pointAy, pointBx, pointBy) {
var _local2 = pointBx - pointAx;
var _local3 = pointBy - pointAy;
var _local1 = Math.round(Math.atan2(_local3, _local2) * 57.33);
return(_local1);
}
function playSound(what) {
if (music) {
if (_root.soundMc._x == undefined) {
_root.createEmptyMovieClip("soundMc", _root.getNextHighestDepth());
}
if (_root.soundMc[what] == undefined) {
_root.soundMc[what] = new Sound(_root.soundMc);
_root.soundMc[what].attachSound(what);
}
_root.soundMc[what].start();
}
}
function stopSound(what) {
_root[what].stop(what);
}
function playMusic(what) {
if (_root[what] == undefined) {
var _local3 = _root.createEmptyMovieClip(what, _root.getNextHighestDepth());
_local3.typ = "music";
_local3.music = new Sound(_local3);
_local3.music.attachSound(what);
_local3.music.setVolume(0);
_local3.fadeIn = function (step) {
if (this.music.getVolume() == 0) {
this.music.start(0, 999);
}
if (step == undefined) {
this.step = 2;
} else {
this.step = step;
}
this.music.setVolume(this.music.getVolume() + this.step);
this.onEnterFrame = function () {
var _local2 = this.music.getVolume() + this.step;
if (_local2 >= 100) {
this.music.setVolume(100);
delete this.onEnterFrame;
} else {
this.music.setVolume(_local2);
}
};
};
_local3.fadeOut = function (step) {
if (step == undefined) {
this.step = 2;
} else {
this.step = step;
}
this.music.setVolume(this.music.getVolume() - this.step);
this.onEnterFrame = function () {
var _local2 = this.music.getVolume() - this.step;
if (_local2 <= 0) {
this.music.setVolume(0);
this.music.stop();
delete this.onEnterFrame;
} else {
this.music.setVolume(_local2);
}
};
};
}
if (music) {
if (nowMusic != what) {
_root[nowMusic].fadeOut();
_root[what].fadeIn();
}
}
nowMusic = what;
}
g = 1.5;
friction = 0.6;
platform = game.map.platform;
ground = game.map.ground;
leftCode = 37;
rightCode = 39;
jumpCode = 38;
duckCode = 40;
left2Code = 65;
right2Code = 68;
jump2Code = 87;
duck2Code = 83;
attackCode = 74;
attack2Code = 90;
makingIceCode = 75;
makingIce2Code = 88;
pauseCode = 80;
playerLife = 6;
playerMagicLv = 0;
currentScore = 0;
defaultLife = 6;
maxLife = 10;
music = true;
Stage.scaleMode = "noScale";
_root.saveData = SharedObject.getLocal("wrapAttackSave");
mochi.MochiServices.connect("7ee56b8e252120c5");
_root.kongregateServices.connect();
_root.setMask(maskMc);
this._lockroot = true;
Frame 4
gotoAndStop ("logo");
Frame 20
stop();
Frame 30
_root.playMusic("musicTitle");
if (music) {
musicMc.gotoAndStop("stop");
} else {
musicMc.gotoAndStop("play");
}
musicMc.btnFunc = function () {
if (music) {
music = false;
_root[nowMusic].fadeOut(5);
this._parent.gotoAndStop("play");
} else {
music = true;
_root[nowMusic].fadeIn(5);
this._parent.gotoAndStop("stop");
}
musicMc.btn.onRelease = musicMc.btnFunc;
};
musicMc.btn.onRelease = musicMc.btnFunc;
btnPlay.onRelease = function () {
gotoPage("intro");
};
btnCredit.onRelease = function () {
gotoPage("credit");
};
btnScores.onRelease = function () {
var _local1 = mochi.MochiScores.showLeaderboard({boardID:"2aec548e14ab151b"});
_local1.onClose = function () {
};
gotoPage("scores");
};
btnHelp.onRelease = function () {
gotoPage("help");
};
ani.onEnterFrame = function () {
if (!random(30)) {
var _local2 = this.attachMovie("snow", "snow" + this.getNextHighestDepth(), this.getNextHighestDepth());
_local2._xscale = (_local2._yscale = random(30) + 10);
_local2._x = random(600) - 100;
_local2._y = -5;
_local2.xs = Math.random();
_local2.ys = Math.random() + 0.1;
_local2.onEnterFrame = function () {
this._x = this._x + this.xs;
this._y = this._y + this.ys;
if (this._y > 360) {
this.removeMovieClip();
}
};
}
};
stop();
Frame 40
btnBack.onRelease = function () {
gotoPage("title");
};
Frame 50
btnBack.onRelease = function () {
gotoPage("title");
};
Frame 60
stop();
Frame 70
btnBack.onRelease = function () {
gotoPage("title");
};
setSelMsn();
playMusic("musicIntro");
Frame 80
btnPlay.onRelease = function () {
gotoPage("selectMission");
};
playMusic("musicIntro");
Frame 90
btnPlay.onRelease = function () {
gotoPage("gaming");
};
playMusic("musicIntro");
Frame 100
btnPlay.onRelease = function () {
gotoPage("gaming");
};
playMusic("musicIntro");
Frame 110
buildGame();
Frame 120
btnPlayagain.onRelease = function () {
currentScore = 0;
gotoPage("selectMission");
};
btnSubmit.onRelease = function () {
if (!_root.sendScore) {
_root.attachMovie("sendScore", "sendScore", _root.getNextHighestDepth());
btnPlayagain.enabled = false;
this.enabled = false;
}
};
showNum(failedScore, currentScore);
Frame 130
playMusic("win");
btnPlay.onRelease = function () {
gotoPage("gaming");
};
Frame 140
playMusic("win");
Symbol 1699 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.7");
}
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;
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) {
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) {
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;
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) {
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 _local9 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local9._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local9.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local9._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local8;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
_local6.lc = _local5;
_local4.lc = _local8;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
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 1700 MovieClip [__Packages.mochi.MochiServices] Frame 0
class mochi.MochiServices
{
static var _id, _container, _clip, _sendChannelName, _rcvChannelName, __get__comChannelName, onError, _listenChannel, _rcvChannel, _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("1.35");
}
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";
_rcvChannelName = val;
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.MochiServices.onError = onError;
} else if (mochi.MochiServices.onError == undefined) {
mochi.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();
_rcvChannel.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 _local2 = "_mochiservices_com_" + id;
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
allowDomains(_gatewayURL);
_clip = clip.createEmptyMovieClip(_local2, 10336, false);
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
mochi.MochiServices.disconnect();
mochi.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.MochiServices.disconnect();
mochi.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_loaderListener.waitInterval = setInterval(_loaderListener, "wait", 1000);
_loader.addListener(_loaderListener);
_loader.loadClip(_gatewayURL, _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain = function (d) {
return(true);
};
_rcvChannel.allowInsecureDomain = _rcvChannel.allowDomain;
_rcvChannel._nextcallbackID = 0;
_rcvChannel._callbacks = {};
listen();
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.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_clip, version:getVersion()});
_rcvChannel.onStatus = function (infoObject) {
mochi.MochiServices.onStatus(infoObject);
};
_rcvChannel.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];
};
_rcvChannel.onError = function () {
mochi.MochiServices.onError.apply(null, ["IOError"]);
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
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 = _rcvChannel._callbacks[_local1.callbackID];
}
delete _rcvChannel._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:_rcvChannel._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:_rcvChannel._nextcallbackID});
}
_rcvChannel._callbacks[_rcvChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_rcvChannel._nextcallbackID++;
}
static function addLinkEvent(url, burl, btn, onClick) {
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]);
}
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 () {
var _local3;
var _local2 = new LoadVars();
var timeout = 1500;
var t0 = getTimer();
var ping = this.createEmptyMovieClip("ping", 777);
this.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
delete this.ping;
getURL (url + s, "_blank");
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
delete this.ping;
getURL (burl, "_blank");
}
};
ping.loadMovie("http://x.mochiads.com/linkping.swf?t=" + getTimer());
if (onClick != undefined) {
onClick();
}
};
}
static var _gatewayURL = "http://www.mochiads.com/static/lib/services/services.swf";
static var _listenChannelName = "__mochiservices";
static var _connecting = false;
static var _connected = false;
}
Symbol 1701 MovieClip [__Packages.mochi.MochiScores] Frame 0
class mochi.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.MochiScores.boardID = boardID;
mochi.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
if (options.clip != null) {
if ((options.clip != mochi.MochiServices.__get__clip()) || (mochi.MochiServices.__get__childClip()._target == undefined)) {
mochi.MochiServices.disconnect();
mochi.MochiServices.connect(mochi.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 (typeof(options.score) == "object") {
if (options.score.text != undefined) {
options.score = options.score.text;
}
}
}
if (options.onDisplay != null) {
options.onDisplay();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
_root.gotoPage("title");
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
mochi.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
mochi.MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
mochi.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.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 12 Button
on (release) {
getURL ("http://kongregate.com/", "_blank");
}
Symbol 39 MovieClip Frame 1
_root.stop();
Symbol 39 MovieClip Frame 180
_root.nextFrame();
Symbol 58 MovieClip [bg] Frame 1
sap = true;
stop();
Symbol 95 MovieClip [bg2] Frame 1
sap = true;
stop();
Symbol 168 MovieClip [bg3] Frame 1
sap = true;
stop();
Symbol 179 MovieClip [box] Frame 1
stop();
Symbol 183 MovieClip Frame 1
this._visible = false;
Symbol 219 MovieClip [car] Frame 1
sap = true;
stop();
Symbol 264 MovieClip [magicFx] Frame 15
this.removeMovieClip();
Symbol 277 MovieClip [magicShow] Frame 1
stop();
Symbol 277 MovieClip [magicShow] Frame 5
this.removeMovieClip();
Symbol 286 MovieClip Frame 1
_root.newToy1(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 301 MovieClip Frame 1
_root.birthPt = [Math.round(this._x), Math.round(this._y)];
_root.newPlayer();
_root.game.active.push(_root.game.player);
_root.game.player._x = _root.birthPt[0];
_root.game.player._y = _root.birthPt[1];
_root.game._x = (250 - _root.game.player._x) - _root.game._x;
_root.game._y = (200 - _root.game.player._y) - _root.game._y;
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 304 MovieClip Frame 1
_root.newCoin(this._x, this._y, 1);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 307 MovieClip Frame 1
var tmp = ((_root.stage % 2) + 2);
_root.newCoin(this._x, this._y, tmp);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 310 MovieClip Frame 1
_root.newCoin(this._x, this._y, "life");
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 316 MovieClip Frame 1
_root.newToy2(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 319 MovieClip Frame 1
_root.newCoin(this._x, this._y, "magic");
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 328 MovieClip Frame 1
_root.newToy5(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 349 MovieClip Frame 1
var tmp = ((_root.stage % 3) + 7);
_root.newCoin(this._x, this._y, tmp);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 352 MovieClip Frame 1
var tmp = ((_root.stage % 2) + 10);
_root.newCoin(this._x, this._y, tmp);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 371 MovieClip Frame 1
_root.setMovingTile5(s1, 10);
_root.setMovingTile5(s2, 10);
_root.setMovingTile5(s3, 10);
Symbol 374 MovieClip Frame 1
_root.newToy4(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 377 MovieClip Frame 1
var tmp = ((_root.stage % 3) + 4);
_root.newCoin(this._x, this._y, tmp);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 390 MovieClip Frame 1
_root.newToy3(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 399 MovieClip Frame 1
_root.setMovingTile1(m1, 3, 0, 300);
_root.setMovingTile1(m2, 3, 0, 300);
Symbol 405 MovieClip Frame 1
_root.setMovingTile5(s1, 30);
_root.setMovingTile5(s2, 30);
_root.setMovingTile5(s3, 30);
_root.setMovingTile5(s4, 30);
_root.setMovingTile5(s5, 30);
_root.setMovingTile5(s6, 30);
_root.setMovingTile5(s7, 30);
Symbol 408 MovieClip Frame 1
_root.newToy8(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 413 MovieClip Frame 1
_root.setMovingTile5(s1, 30);
_root.setMovingTile5(s2, 30);
_root.setMovingTile5(s3, 30);
Symbol 436 MovieClip Frame 1
_root.setMovingTile1(m1, 0, 5, 400);
Symbol 439 MovieClip Frame 1
_root.newToy6(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 444 MovieClip Frame 1
_root.setMovingTile5(s1, 30);
_root.setMovingTile5(s2, 30);
_root.setMovingTile5(s3, 30);
_root.setMovingTile1(m1, 0, 3, 200);
Symbol 449 MovieClip Frame 1
_root.setMovingTile1(m1, 5, 0, 500);
_root.setMovingTile1(m2, 0, 5, 250);
Symbol 452 MovieClip Frame 1
_root.newToy7(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 457 MovieClip Frame 1
_root.setMovingTile1(m1, 0, 5, 330);
_root.setMovingTile1(m2, 0, 3, 500);
_root.setMovingTile1(m3, 0, 4, 500);
_root.setMovingTile1(m4, 0, 3, 500);
_root.setMovingTile1(m5, 0, 5, 450);
_root.setMovingTile1(m6, 0, 5, 330);
_root.setMovingTile1(m7, 3, 0, 350);
Symbol 462 MovieClip Frame 1
_root.setMovingTile5(s1, 30);
_root.setMovingTile5(s2, 30);
Symbol 493 MovieClip Frame 1
_root.setMovingTile1(m1, 5, 0, 400);
Symbol 498 MovieClip Frame 1
_root.setMovingTile1(m1, 5, 0, 300);
Symbol 503 MovieClip Frame 1
_root.setMovingTile1(m1, 0, 4, 430);
Symbol 505 MovieClip Frame 1
_root.setMovingTile5(s1, 10);
_root.setMovingTile5(s2, 10);
_root.setMovingTile5(s3, 10);
_root.setMovingTile5(s4, 10);
_root.setMovingTile5(s5, 10);
Symbol 508 MovieClip Frame 1
_root.newSanta1(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 524 MovieClip Frame 1
_root.setMovingTile1(m1, 0, 6, 400);
_root.setMovingTile5(s1, 20);
_root.setMovingTile5(s2, 20);
_root.setMovingTile5(s3, 20);
_root.setMovingTile5(s4, 20);
Symbol 529 MovieClip Frame 1
_root.setMovingTile1(m1, 0, 5, 520);
_root.setMovingTile1(m2, 0, 4, 330);
_root.setMovingTile1(m3, 5, 0, 330);
Symbol 538 MovieClip Frame 1
_root.newZass1(this._x, this._y);
this.swapDepths(_parent.getNextHighestDepth());
this.removeMovieClip();
Symbol 539 MovieClip [map] Frame 1
sap = true;
stop();
Symbol 539 MovieClip [map] Frame 28
_root.setSecretDoor(d1, d2);
Symbol 539 MovieClip [map] Frame 43
_root.setSecretDoor(d1, d2);
Symbol 539 MovieClip [map] Frame 53
_root.setSecretDoor(d1, d2);
Symbol 539 MovieClip [map] Frame 63
_root.setSecretDoor(d1, d2);
Symbol 539 MovieClip [map] Frame 83
_root.setSecretDoor(d1, d2);
Symbol 539 MovieClip [map] Frame 88
_root.setSecretDoor(d1, d2);
Symbol 539 MovieClip [map] Frame 108
_root.setSecretDoor(d1, d2);
Symbol 539 MovieClip [map] Frame 113
_root.setSecretDoor(d1, d2);
Symbol 559 MovieClip [soldier] Frame 1
stop();
sap = true;
Symbol 573 MovieClip [hitFx] Frame 15
this.removeMovieClip();
Symbol 593 MovieClip [smokeFx] Frame 17
this.removeMovieClip();
Symbol 648 MovieClip Frame 24
stop();
Symbol 659 MovieClip Frame 6
stop();
Symbol 685 MovieClip Frame 24
stop();
Symbol 698 MovieClip Frame 3
stop();
Symbol 698 MovieClip Frame 9
play();
Symbol 698 MovieClip Frame 11
stop();
Symbol 698 MovieClip Frame 14
stop();
Symbol 719 MovieClip Frame 23
stop();
Symbol 737 MovieClip Frame 13
gotoAndPlay (3);
Symbol 767 MovieClip Frame 5
_root.playSound("soundPick");
Symbol 768 MovieClip [player] Frame 1
stop();
sap = true;
Symbol 789 MovieClip [bulletFx0] Frame 11
this.removeMovieClip();
Symbol 806 MovieClip [bulletFx1] Frame 9
this.removeMovieClip();
Symbol 823 MovieClip [bulletFx2] Frame 9
this.removeMovieClip();
Symbol 840 MovieClip [bulletFx3] Frame 9
this.removeMovieClip();
Symbol 847 MovieClip [bulletFx5] Frame 7
this.removeMovieClip();
Symbol 868 MovieClip [bulletFx6] Frame 15
this.removeMovieClip();
Symbol 889 MovieClip [uiLife] Frame 1
stop();
Symbol 910 MovieClip Frame 1
sap = true;
stop();
Symbol 922 MovieClip Frame 1
stop();
Symbol 932 MovieClip Frame 1
stop();
Symbol 953 MovieClip Frame 1
sap = true;
stop();
Symbol 971 MovieClip Frame 1
sap = true;
stop();
Symbol 992 MovieClip Frame 1
sap = true;
stop();
Symbol 1002 MovieClip Frame 1
this.onRelease = function () {
getURL ("http://www.kongregate.com?gamereferral=wrap-attack", "_blank");
};
Symbol 1018 MovieClip Frame 1
sap = true;
stop();
Symbol 1029 MovieClip Frame 1
sap = true;
stop();
Symbol 1031 MovieClip [levelShow] Frame 56
this.removeMovieClip();
Symbol 1068 MovieClip [coin] Frame 1
score = 100;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 2
score = 200;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 3
score = 200;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 4
score = 500;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 5
score = 500;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 6
score = 500;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 7
score = 1000;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 8
score = 1000;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 9
score = 1000;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 10
score = 2000;
stop();
sap = true;
Symbol 1068 MovieClip [coin] Frame 11
score = 2000;
stop();
sap = true;
Symbol 1083 MovieClip [locomotive] Frame 1
sap = true;
stop();
Symbol 1133 MovieClip [soldierWithGun] Frame 1
sap = true;
stop();
Symbol 1146 MovieClip [doll] Frame 1
sap = true;
stop();
Symbol 1161 MovieClip [bear] Frame 1
sap = true;
stop();
Symbol 1206 MovieClip [jackInTheBox] Frame 1
sap = true;
stop();
Symbol 1244 MovieClip Frame 5
stop();
Symbol 1245 MovieClip [santa] Frame 1
sap = true;
stop();
Symbol 1276 MovieClip [protectFx] Frame 16
this.removeMovieClip();
Symbol 1292 MovieClip Frame 37
stop();
Symbol 1304 MovieClip Frame 28
this._parent.gotoAndStop("coma");
stop();
Symbol 1305 MovieClip [zass] Frame 1
sap = true;
stop();
Symbol 1346 MovieClip Frame 1
sap = true;
stop();
Symbol 1368 MovieClip Frame 1
sap = true;
stop();
Symbol 1392 MovieClip Frame 1
stop();
Symbol 1409 MovieClip [plane] Frame 1
sap = true;
stop();
Symbol 1418 MovieClip Frame 31
this._parent.removeMovieClip();
Symbol 1422 MovieClip Frame 31
this._parent.removeMovieClip();
Symbol 1423 MovieClip [scoreShow] Frame 1
sap = true;
stop();
Symbol 1428 MovieClip [radarShow] Frame 41
this.removeMovieClip();
Symbol 1437 MovieClip [dust] Frame 9
this.removeMovieClip();
Symbol 1440 MovieClip [cutScene] Frame 12
this.removeMovieClip();
Symbol 1441 MovieClip [cutScene1] Frame 76
this.removeMovieClip();
Symbol 1443 MovieClip [cutScene2] Frame 76
this.removeMovieClip();
Symbol 1451 MovieClip [sendScore] Frame 1
this.btnSend.onRelease = function () {
mochi.MochiScores.showLeaderboard({boardID:"2aec548e14ab151b", score:_root.currentScore, name:this._parent.yourName.text});
_root.currentScore = 0;
_root.gotoPage("scores");
trace(this._parent.yourName.text);
if (!this._parent.win) {
trace("lose sumbit");
_root.kongregateScores.submit(_root.currentScore);
_root.kongregateStats.submit("highscores", _root.currentScore);
var _local4 = 0;
var _local3 = 0;
while (_local3 < 25) {
if (_root.saveData.data.mdFound[_local3] == 1) {
_local4++;
}
_local3++;
}
_root.kongregateStats.submit("magicdoor", _local4);
_root.currentScore = 0;
} else {
trace("win sumbit");
_root.kongregateScores.submit(_root.currentScore);
_root.kongregateStats.submit("highscores", _root.currentScore);
var _local4 = 0;
var _local3 = 0;
while (_local3 < 25) {
if (_root.saveData.data.mdFound[_local3] == 1) {
_local4++;
}
_local3++;
}
_root.kongregateStats.submit("magicdoor", _local4);
_root.kongregateStats.submit("beatzass", _root.saveData.data.beatZass);
if (_root.totaltime != 0) {
_root.kongregateStats.submit("totaltime", Math.round(_root.totaltime / 30));
}
_root.currentScore = 0;
_root.totaltime = 0;
}
this._parent.removeMovieClip();
};
Symbol 1455 MovieClip Frame 25
_root.playSound("funnautLogo");
Symbol 1455 MovieClip Frame 139
_root.gotoAndStop("title");
stop();
Symbol 1497 MovieClip Frame 108
gotoAndPlay ("loop");
Symbol 1502 MovieClip Frame 1
this.onRelease = function () {
getURL ("http://www.kongregate.com?gamereferral=wrap-attack", "_blank");
};
Symbol 1506 MovieClip Frame 1
a.onEnterFrame = (b.onEnterFrame = function () {
this._y--;
if (this._y <= -350) {
this._y = 350;
}
});
Symbol 1606 MovieClip Frame 1
stop();
Symbol 1619 MovieClip Frame 971
this.onRelease = function () {
_root.gotoPage("selectMission");
};
Symbol 1619 MovieClip Frame 1110
var tmp = function () {
_root.gotoAndStop("selectMission");
};
_root.cutScene1(tmp);
stop();
Symbol 1628 MovieClip Frame 430
var tmp = function () {
_root.gotoAndStop("gaming");
};
_root.cutScene2(tmp);
stop();
Symbol 1637 MovieClip Frame 349
var tmp = function () {
_root.gotoAndStop("gaming");
};
_root.cutScene2(tmp);
stop();
Symbol 1644 MovieClip Frame 71
stop();
Symbol 1670 MovieClip Frame 775
var tmp = function () {
_root.gotoAndStop("gaming");
};
_root.cutScene2(tmp);
stop();
Symbol 1677 MovieClip Frame 768
_root.gotoPage("win");
Symbol 1698 MovieClip Frame 658
_root.showNum(finalScore, _root.currentScore);
Symbol 1698 MovieClip Frame 666
_root.showNum(finalScore, _root.currentScore);
stop();
btnBack.onRelease = function () {
_root.currentScore = 0;
_root.gotoPage("logo");
};
btnSubmit.onRelease = function () {
if (!_root.sendScore) {
var _local3 = _root.attachMovie("sendScore", "sendScore", _root.getNextHighestDepth());
_local3.win = true;
this._parent.btnBack.enabled = false;
this.enabled = false;
}
};