Frame 1
txtPercent = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
txtPercentage = txtPercent + "% loaded";
loader.gotoAndStop(txtPercent);
Frame 2
if (_root.getBytesLoaded() >= _root.getBytesTotal()) {
gotoAndPlay ("introStartFrame");
} else {
gotoAndPlay ("loadingFrame");
}
Frame 88
stages = ["burger", "cheese", "grape", "pancakes", "cream", "tomato", "smackaid", "tabasco", "froot", "buffalo", "apple", "try1", "try4", "fry1", "loops", "fry5", "fries", "rabbit", "marmalade", "cookies", "wackaid", "radish", "fry4", "crackaid", "lemon", "try2", "try3", "try5", "fry2", "fry3"];
stages = ["burger", "cheese", "grape", "pancakes", "cream", "tomato", "smackaid", "tabasco", "froot", "buffalo", "apple", "try1", "try4", "fry1", "loops"];
stagesB = ["fry5", "fries", "rabbit", "marmalade", "cookies", "wackaid", "radish", "fry4", "crackaid", "lemon", "try2", "try3", "try5", "fry2", "fry3"];
totalstages = _root.stages.length;
function loadGame() {
saved = SharedObject.getLocal("questData");
playerData = saved.data.saveData;
if (playerData == undefined) {
playerData = 1;
}
if (playerData >= 15) {
playerData = 15;
}
trace("playerData = " + playerData);
stageNum = playerData;
musicSwitch = saved.data.music;
if (musicSwitch == undefined) {
musicSwitch = "on";
}
}
function clearSave() {
saved.data.saveData = 1;
saved.data.score = 0;
saved.data.music = "on";
saved.flush();
}
stop();
keyHit = true;
onEnterFrame = function () {
if (Key.isDown(32)) {
if (!keyHit) {
nextFrame();
}
keyHit = true;
} else {
keyHit = false;
}
};
loadGame();
Frame 89
stop();
Frame 90
stop();
keyHit = true;
onEnterFrame = function () {
if (Key.isDown(32)) {
if (!keyHit) {
nextFrame();
}
keyHit = true;
} else {
keyHit = false;
}
};
stop();
Frame 91
stop();
clearGame();
currentMap = "world";
if ((_root.playerData == undefined) || (_root.playerData == 1)) {
}
Frame 92
function playSound(sound) {
if (musicSwitch == "on") {
mySoundManager.playSound(sound, 0, 0);
}
}
function resetVars() {
coinCollect = 0;
boltCollect = 0;
goalCollect = 0;
goalComplete = false;
stageComplete = false;
enemyCount = 0;
itemCount = 0;
blockCount = 0;
boltUpdate();
coinUpdate();
hud.coinbox.gotoAndStop(1);
}
function loadGame() {
saved = SharedObject.getLocal("questData");
playerData = saved.data.saveData;
if (playerData == undefined) {
playerData = 1;
}
stageNum = playerData;
musicSwitch = saved.data.music;
if (musicSwitch == undefined) {
musicSwitch = "on";
}
}
function saveGame() {
if (playerData < stageNum) {
playerData = stageNum;
}
saved.data.saveData = playerData;
saved.data.music = musicSwitch;
saved.flush();
trace((((("playerData equals " + playerData) + ". And saved is ") + saved.data.saveData) + ". And music is") + saved.data.music);
}
function clearSave() {
saved.data.saveData = 1;
saved.data.score = 0;
saved.data.music = "on";
saved.flush();
}
function breakDown(input) {
var _local9 = [];
var _local4 = [];
var _local3 = [];
var _local7 = stageData[input].split("#");
stageName = stages[input];
var _local6 = [];
_local6 = _local7[1].split("|");
var _local2 = 0;
while (_local2 < h) {
_local4[_local2] = [];
_local4[_local2] = _local6[_local2].split(",");
var _local1 = 0;
while (_local1 < 12) {
_local4[_local2][_local1] = parseInt(_local4[_local2][_local1]);
_local1++;
}
_local2++;
}
var _local5 = [];
_local5 = _local7[2].split("|");
_local2 = 0;
while (_local2 < h) {
_local3[_local2] = [];
_local3[_local2] = _local5[_local2].split(",");
var _local1 = 0;
while (_local1 < 12) {
_local3[_local2][_local1] = parseInt(_local3[_local2][_local1]);
_local1++;
}
_local2++;
}
theme = tempTheme;
myMap = _local4;
objectLayer = _local3;
map.create(myMap);
map.objects(objectLayer);
buildMap(myMap);
}
function loadStage(numero) {
stageTitle = "Stage " + (numero + 1);
trace("Load " + stageTitle);
if (currentMap == "world") {
currentMap = "world2";
} else if (currentMap == "world2") {
currentMap = "world";
}
resetVars();
game.attachMovie("blank", currentMap, ++mapDepth);
breakDown(numero);
questGame = new Game(player);
myAstar.newMap(myMap[0].length, myMap.length);
buildMap(myMap);
i = 1;
while (i <= _root.enemyCount) {
_root.game[currentMap]["enemy" + i].findTarget();
i++;
}
}
function buildMap(map) {
var _local2 = 0;
while (_local2 < map.length) {
var _local1 = 0;
while (_local1 < map[0].length) {
if ((((map[_local2][_local1] == 0) || (map[_local2][_local1] == 1)) || (map[_local2][_local1] == 13)) || (map[_local2][_local1] == 14)) {
myAstar.setCost(_local1, _local2, 1);
} else {
myAstar.setWalkable(_local1, _local2, false);
}
_local1++;
}
_local2++;
}
}
function buildMap2() {
var _local3 = map[0].length;
var _local4 = map.length;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
_local1++;
}
_local2++;
}
}
function debugMenu() {
attachMovie("levelselect", "levelselect", 9999);
clearGame();
}
function stageSelect() {
clearGame();
attachMovie("stageSelect", "stageSelect", 9999);
}
function screenIntro() {
trace("Load the stage intro screen.");
introPlay = true;
attachMovie("screenTransition", "screen", 500);
}
function screenWin() {
trace("Load win screen.");
attachMovie("screenWin", "screen", 500);
}
function screenDeath() {
trace("Load death screen...");
attachMovie("screenDeath", "screen", 500);
}
function screenGameOver() {
trace("Load game over screen...");
attachMovie("screenDeath", "screen", 500);
}
function screenPause() {
trace("Load pause screen...");
attachMovie("pauseMenu", "screen", 500);
}
function screenInstruct(stage) {
trace("Load stage instructions");
attachMovie("screenInstructions", "screen", 500);
}
function pauseCheck() {
if (!gamePause) {
if (Key.isDown(pauseKey) && (!pauseKeyDown)) {
trace("hello!");
screenPause();
gamePause = true;
pauseKeyDown = true;
} else if (!Key.isDown(pauseKey)) {
pauseKeyDown = false;
}
} else if (Key.isDown(pauseKey) && (!pauseKeyDown)) {
unPause();
gamePause = false;
pauseKeyDown = true;
} else if (!Key.isDown(pauseKey)) {
pauseKeyDown = false;
}
}
function unPause() {
trace("**Unpause**");
screen.removeMovieClip();
gamePause = false;
}
function gameStart() {
trace("The game will now start!!!!");
trace("Attaching the background...");
attachMovie("bg", "bg", 1);
bg.cacheAsBitmap = true;
trace("Attaching the hud...");
attachMovie("hud", "hud", 100, {_x:550});
trace("Loading the level...");
attachMovie("blank", "game", ++d);
game.attachMovie("blank", "world", ++d);
game._xscale = scale;
game._yscale = scale;
firstStage();
trace("Start the music...");
mySoundManager.playSound("ninja_music", 0, 9999);
if (musicSwitch == "on") {
mySoundManager.setSoundVolume("ninja_music", 100);
} else if (musicSwitch == "off") {
mySoundManager.setSoundVolume("ninja_music", 0);
}
}
function firstStage() {
trace("Load the first stage. Which is stage #" + stageNum);
screenIntro();
loadStage(stageNum - 1);
game[currentMap]._x = 800;
game[currentMap]._y = yRandom[random(yRandom.length)];
}
function nextStage() {
trace("Load the next stage.");
screenIntro();
stageNum++;
if (stageNum <= 15) {
saveGame();
loadStage(stageNum - 1);
game[currentMap]._x = 800;
game[currentMap]._y = yRandom[random(yRandom.length)];
} else {
trace("Go to ending");
clearGame();
gotoAndStop ("ending");
}
}
function restart() {
trace("Restart stage " + (stageNum - 1));
loadStage(stageNum - 1);
}
function clearGame() {
game.removeMovieClip();
hud.removeMovieClip();
bg.removeMovieClip();
screen.removeMovieClip();
trace("Stop the music...");
mySoundManager.stopSound("ninja_music");
}
function death() {
trace("Run death function");
lives--;
if (lives > 0) {
screenDeath();
} else {
screenGameOver();
}
}
function transition() {
if (tranStart == false) {
duplicateMovieClip ("game", "gameX", d++);
tranStart = true;
} else if (tranStart == true) {
trace(gameX._x);
gameX._x++;
gameX._y++;
}
}
function mapScroll() {
xdiff = (game[currentMap]._x - questGame.offsetX) / 20;
ydiff = (game[currentMap]._y - questGame.offsetY) / 20;
if (currentMap == "world") {
if (game[currentMap]._x > (questGame.offsetX + 1)) {
game[currentMap]._x = game[currentMap]._x - xdiff;
game[currentMap]._y = game[currentMap]._y - ydiff;
game.world2._x = game.world2._x - xdiff;
game.world2._y = game.world2._y - ydiff;
} else {
game[currentMap]._x = questGame.offsetX;
game[currentMap]._y = questGame.offsetY;
removeMovieClip(game.world2);
}
} else if (currentMap == "world2") {
if (game[currentMap]._x > (questGame.offsetX + 1)) {
game[currentMap]._x = game[currentMap]._x - xdiff;
game[currentMap]._y = game[currentMap]._y - ydiff;
game.world._x = game.world._x - xdiff;
game.world._y = game.world._y - ydiff;
} else {
game[currentMap]._x = questGame.offsetX;
game[currentMap]._y = questGame.offsetY;
removeMovieClip(game.world);
}
}
}
function boltUpdate() {
boltCount = 1;
while (boltCount <= 3) {
hud["bolt" + boltCount].gotoAndStop(1);
boltCount++;
}
boltCount = 1;
while (boltCount <= boltCollect) {
hud["bolt" + boltCount].gotoAndStop(2);
boltCount++;
}
}
function coinUpdate() {
if (coinCollect >= coinMax) {
hud.coin.gotoAndStop(2);
} else {
hud.coin.gotoAndStop(1);
}
}
function ninjaTalk_in() {
if (musicSwitch == "on") {
var _local1 = 1 + random(15);
trace("Ninja Talk: Intro!!! " + _local1);
mySoundManager.playSound("ninjatalk_in_" + _local1, 0, 0);
}
}
function ninjaTalk_out() {
if (musicSwitch == "on") {
var _local1 = 1 + random(15);
trace("Ninja Talk: OUTRO!!! " + _local1);
mySoundManager.playSound("ninjatalk_out_" + _local1, 0, 0);
}
}
var mySoundManager = (new com.managers.SoundManager());
mySoundManager.addSound("snd_chime1");
mySoundManager.addSound("snd_chime2");
mySoundManager.addSound("snd_ascend");
mySoundManager.addSound("snd_magic01");
mySoundManager.addSound("snd_magic02");
mySoundManager.addSound("snd_magic09");
mySoundManager.addSound("snd_magic10");
mySoundManager.addSound("snd_select11");
mySoundManager.addSound("snd_shockzap");
mySoundManager.addSound("snd_shoot");
mySoundManager.addSound("snd_scroll");
mySoundManager.addSound("ninja_music");
mySoundManager.addSound("ninja_snd_01");
mySoundManager.addSound("ninja_snd_02");
mySoundManager.addSound("ninja_snd_03");
mySoundManager.addSound("ninja_snd_04");
mySoundManager.addSound("ninja_snd_05");
mySoundManager.addSound("ninjatalk_in_1");
mySoundManager.addSound("ninjatalk_in_2");
mySoundManager.addSound("ninjatalk_in_3");
mySoundManager.addSound("ninjatalk_in_4");
mySoundManager.addSound("ninjatalk_in_5");
mySoundManager.addSound("ninjatalk_in_6");
mySoundManager.addSound("ninjatalk_in_7");
mySoundManager.addSound("ninjatalk_in_8");
mySoundManager.addSound("ninjatalk_in_9");
mySoundManager.addSound("ninjatalk_in_10");
mySoundManager.addSound("ninjatalk_in_11");
mySoundManager.addSound("ninjatalk_in_12");
mySoundManager.addSound("ninjatalk_in_13");
mySoundManager.addSound("ninjatalk_in_14");
mySoundManager.addSound("ninjatalk_in_15");
mySoundManager.addSound("ninjatalk_out_1");
mySoundManager.addSound("ninjatalk_out_2");
mySoundManager.addSound("ninjatalk_out_3");
mySoundManager.addSound("ninjatalk_out_4");
mySoundManager.addSound("ninjatalk_out_5");
mySoundManager.addSound("ninjatalk_out_6");
mySoundManager.addSound("ninjatalk_out_7");
mySoundManager.addSound("ninjatalk_out_8");
mySoundManager.addSound("ninjatalk_out_9");
mySoundManager.addSound("ninjatalk_out_10");
mySoundManager.addSound("ninjatalk_out_11");
mySoundManager.addSound("ninjatalk_out_12");
mySoundManager.addSound("ninjatalk_out_13");
mySoundManager.addSound("ninjatalk_out_14");
mySoundManager.addSound("ninjatalk_out_15");
_quality = "MEDIUM";
tileW = 40;
tileH = 40;
d = 1;
h = 9;
w = 12;
scale = 90;
mapDepth = 1;
var lives = 2;
var introPlay = false;
var gamePause = false;
var pauseKey = 17;
var pauseKeyDown = false;
var coinCollect = 0;
var coinMax = 0;
var boltCollect = 0;
var goalMax = 0;
var goalCollect = 0;
var goalComplete = false;
var stageComplete = false;
var stageTitle = ("Stage " + stageNum);
var yRandom = [-150, 500, -500, 700, -700];
burger = "1#6,15,7,1,1,1,1,1,1,11,10,7|1,18,2,7,1,1,1,1,1,10,2,16|1,9,2,2,7,1,6,15,15,2,17,8|1,1,9,17,16,1,1,18,2,8,1,12|1,1,1,1,9,4,1,9,16,1,1,12|1,12,12,1,1,1,1,1,5,1,1,1|13,10,15,7,1,1,1,1,1,1,1,1|1,9,2,2,7,1,1,1,11,1,11,11|1,1,9,17,17,4,1,1,11,1,1,1#0,0,0,0,0,0,8,0,0,0,0,0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,0,0,0,0,0,0,0,0|12,12,0,0,0,3,0,0,0,3,3,0|5,0,0,0,0,3,3,0,0,3,3,0|0,0,0,0,3,3,3,0,0,0,3,0|2,0,3,3,3,1,0,3,11,0,3,0|0,0,10,3,3,8,0,0,0,0,3,0|0,0,3,0,0,3,3,0,0,3,3,0|0,3,3,0,0,3,3,3,0,0,0,0|5,0,0,0,0,0,0,0,0,3,3,0";
objectBox = ["none", "player", "coin", "block", "enemy", "eye", "bhead", "enemy4", "door", "bolt", "goal", "blockZ", "gate"];
var map = new mapBuild(myMap);
map.objects(objectLayer);
char.clip = game.clip.char;
char.x = (char.xtile * game.tileW) + (game.tileW / 2);
char.y = (char.ytile * game.tileH) + (game.tileH / 2);
char.width = char.clip._width / 2;
char.height = char.clip._height / 2;
char.clip._x = char.x;
char.clip._y = char.y;
var myAstar = (new be.dauntless.Astar.Astar());
myAstar.newMap(myMap[0].length, myMap.length);
tranStart = false;
_root.onEnterFrame = function () {
if (!gamePause) {
questGame.checkKey();
questGame.movePlayer();
questGame.moveEnemy();
questGame.itemCheck();
questGame.blockCheck();
questGame.doorCheck();
questGame.goalCheck();
}
if ((!stageComplete) && (!introPlay)) {
pauseCheck();
}
mapScroll();
};
clearSave();
gameStart();
stop();
Frame 98
prevFrame();
Frame 101
_root.onEnterFrame = function () {
questGame.checkKey();
questGame.movePlayer();
questGame.moveEnemy();
questGame.itemCheck();
questGame.blockCheck();
};
stop();
Frame 113
mySoundManager.setSoundVolume("ninja_music", 100);
clearGame();
stop();
Symbol 48 MovieClip Frame 9
_parent.removeMovieClip();
Symbol 49 MovieClip [BoltShoot] Frame 1
#initclip 25
Object.registerClass("BoltShoot", BoltShoot);
#endinitclip
stop();
Symbol 51 MovieClip Frame 1
function loadStages() {
var _local2 = 0;
while (_local2 < stages.length) {
loadVariables (("stages/" + stages[_local2]) + ".txt", this);
_local2++;
}
}
function sortStages() {
var _local3 = 0;
while (_local3 < stages.length) {
stageData[_local3] = this[stages[_local3]];
delete this[stages[_local3]];
_local3++;
}
_root.stageData = stageData;
}
stages = _root.stages;
stageData = [];
burger = "1#6,15,7,1,1,1,1,1,1,11,10,7|1,18,2,7,1,1,1,1,1,10,2,16|1,9,2,2,7,1,6,15,15,2,17,8|1,1,9,17,16,1,1,18,2,8,1,12|1,1,1,1,9,4,1,9,16,1,1,12|1,12,12,1,1,1,1,1,5,1,1,1|13,10,15,7,1,1,1,1,1,1,1,1|1,9,2,2,7,1,1,1,11,1,11,11|1,1,9,17,17,4,1,1,11,1,1,1#0,0,0,0,0,0,8,0,0,0,0,0|0,0,0,0,0,0,0,0,2,0,0,0|0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,6,0,0,9,0,0|0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,1,0,0,0,0,0|2,0,0,0,0,0,0,0,0,0,0,2";
cheese = "1#1,1,1,1,1,1,11,1,1,1,1,1|1,1,1,10,7,1,1,1,1,1,1,1|1,1,1,18,17,19,19,19,15,7,1,3|10,15,15,16,1,1,1,1,9,8,1,20|18,2,2,16,1,1,1,1,1,1,1,20|9,17,17,8,1,1,1,1,6,19,19,8|12,12,12,1,1,1,1,1,1,1,1,1|1,1,1,1,1,1,1,1,1,11,1,1|1,1,1,1,1,1,1,1,1,11,1,1#0,0,0,0,0,0,0,0,0,6,0,0|0,8,0,0,0,0,0,0,0,6,0,0|0,0,2,0,0,0,0,0,0,0,0,0|0,0,0,0,0,3,0,3,0,0,0,0|0,0,0,0,3,0,3,0,0,0,2,0|0,0,0,0,0,3,0,3,0,0,0,0|0,0,0,0,0,0,0,0,0,6,0,0|0,1,0,9,0,0,0,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,9,2";
grape = "1#1,1,11,1,1,1,1,1,1,1,11,1|11,1,1,1,1,1,1,1,1,1,1,1|3,1,1,1,1,1,1,1,1,1,10,7|18,15,7,1,1,1,1,11,10,15,2,16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,12,12,1,1,1|12,12,1,12,12,12,12,12,1,1,1,1|3,1,1,1,12,1,1,12,12,12,12,1|20,1,1,1,1,1,1,1,12,1,1,1|20,1,1,1,12,1,1,1,1,1,1,1|9,19,19,4,12,1,1,1,12,1,1,1#0,0,0,0,0,0,0,0,0,0,0,0|0,2,0,0,0,4,0,0,0,8,0,0|0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,3,0|0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,3,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,0,1";
apple = "1#1,1,1,1,1,1,1,1,1,1,1,1|1,11,1,1,11,1,1,1,1,1,12,12|12,12,12,1,12,12,1,12,12,1,12,11|1,12,1,1,1,1,1,1,1,1,1,1|1,12,12,1,12,12,1,12,12,1,12,12|1,1,1,1,1,1,1,1,1,1,1,1|12,12,12,12,12,1,1,1,12,1,12,12|1,1,12,1,12,1,12,1,12,1,1,1|1,1,1,1,1,1,1,1,12,1,1,1#1,0,0,0,0,0,0,0,0,0,0,2|8,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,3,0,0,5,0,0|9,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,3,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,0,10|0,0,0,0,0,0,11,0,0,12,0,0|0,2,0,0,0,0,0,0,0,0,0,2|0,0,6,0,0,0,0,0,0,0,0,4";
try1 = "1#1,1,10,15,15,19,19,19,7,1,1,1|1,1,14,14,14,1,1,1,14,1,1,1|1,1,9,17,16,1,1,1,20,1,1,1|3,1,1,1,20,1,1,1,20,1,1,1|20,1,1,1,18,7,1,10,17,19,19,4|18,19,13,19,17,16,1,20,1,1,1,1|20,1,1,1,1,20,1,20,1,1,1,1|20,1,1,1,1,14,1,14,1,1,1,1|5,1,1,1,6,17,19,8,1,1,1,1#2,0,0,0,0,0,0,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,0,0,0,0,0|0,0,0,0,6,0,0,0,0,0,8,0|0,0,0,0,0,0,0,0,0,0,0,0";
loops = "1#1,1,1,1,1,1,1,1,1,1,1,3|1,1,1,1,1,1,1,1,1,1,1,20|1,1,1,1,1,1,1,1,1,1,1,20|1,1,1,1,1,1,1,1,1,1,1,20|1,1,1,1,1,1,1,1,1,1,1,20|1,1,1,1,1,1,1,1,1,1,1,20|1,1,1,1,1,1,1,1,1,1,1,20|1,1,1,1,1,1,1,1,1,1,1,20|1,1,1,1,1,1,1,1,1,1,1,5#2,12,0,0,0,0,0,0,0,0,0,0|12,12,0,0,0,3,0,0,0,3,3,0|5,0,0,0,0,3,3,0,0,3,3,0|0,0,0,0,3,3,3,0,0,0,3,0|2,0,3,3,3,1,0,3,11,0,3,0|0,0,10,3,3,8,0,0,0,0,3,0|0,0,3,0,0,3,3,0,0,3,3,0|0,3,3,0,0,3,3,3,0,0,0,0|5,0,0,0,0,0,0,0,0,3,3,0";
Symbol 51 MovieClip Frame 4
Symbol 51 MovieClip Frame 7
sortStages();
stop();
this.removeMovieClip();
Symbol 57 MovieClip Frame 1
stop();
onRollOver = function () {
gotoAndStop (2);
};
onRollOut = function () {
gotoAndStop (1);
};
Symbol 58 MovieClip [levelselect] Frame 1
this.swapDepths(9999);
d = 0;
Instance of Symbol 57 MovieClip "original" in Symbol 58 MovieClip [levelselect] Frame 1
onClipEvent (load) {
total = _root.totalstages;
if (this._name == "original") {
ylength = Math.ceil(total / 3);
num = 1;
var y = 0;
while (y < ylength) {
var x = 0;
while (x < 3) {
if (num > total) {
break;
}
duplicateMovieClip (this, (("load_" + x) + "_") + y, ++_parent.d);
_parent[(("load_" + x) + "_") + y]._x = this._x + (105 * x);
_parent[(("load_" + x) + "_") + y]._y = this._y + (30 * y);
_parent[(("load_" + x) + "_") + y].num = num;
_parent[(("load_" + x) + "_") + y].label = (num + "-") + _root.stages[num - 1];
num++;
x++;
}
y++;
}
this._y = -500;
}
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
_root.stageNum = num;
_root.gameStart();
_parent.removeMovieClip();
}
}
Instance of Symbol 57 MovieClip in Symbol 58 MovieClip [levelselect] Frame 1
onClipEvent (load) {
label = "Close";
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("hello");
_parent.removeMovieClip();
}
}
Symbol 58 MovieClip [levelselect] Frame 2
stop();
Symbol 69 MovieClip Frame 210
_parent.gotoAndStop("stand");
Symbol 70 MovieClip [bhead] Frame 1
#initclip 21
Object.registerClass("bhead", EnemyBlock);
#endinitclip
stop();
activated = false;
Symbol 70 MovieClip [bhead] Frame 2
activated = true;
Symbol 109 MovieClip Frame 20
stop();
Symbol 131 MovieClip Frame 15
stop();
Symbol 155 MovieClip Frame 15
stop();
Symbol 162 MovieClip Frame 20
stop();
Symbol 179 MovieClip Frame 84
stop();
Symbol 194 MovieClip Frame 79
stop();
Symbol 218 MovieClip Frame 89
stop();
Symbol 263 MovieClip Frame 74
stop();
Symbol 264 MovieClip [eye] Frame 1
#initclip 22
Object.registerClass("eye", EnemyEye);
#endinitclip
stop();
Symbol 270 MovieClip Frame 40
_parent.removeMovieClip();
Symbol 271 MovieClip [bolt] Frame 1
#initclip 23
Object.registerClass("bolt", Bolt);
#endinitclip
stop();
Symbol 274 MovieClip Frame 10
_parent.removeMovieClip();
Symbol 275 MovieClip [coin] Frame 1
#initclip 24
Object.registerClass("coin", Coin);
#endinitclip
stop();
Symbol 275 MovieClip [coin] Frame 2
Symbol 281 Button
on (press) {
_parent.gotoAndPlay("introStartFrame");
}
Symbol 282 MovieClip Frame 1
stop();
Symbol 1217 MovieClip [__Packages.Player] Frame 0
class Player extends MovieClip
{
var currentMap, dir, downleft, upleft, upright, downright, _x, _y, gotoAndStop, moving, swapDepths, downY, upY, leftX, rightX;
function Player () {
super();
currentMap = _root.currentMap;
depths();
}
function move(_dir) {
if ((xTarget == 0) && (yTarget == 0)) {
if ((pState == "walk") || (pState == "stand")) {
dir = _dir;
if (dir == "left") {
getMyCorners(-20, 0);
if (downleft && (upleft)) {
if (getBlockLeft()) {
pushdown = false;
pushup = false;
moveLeft();
}
}
}
if (dir == "right") {
getMyCorners(20, 0);
if (upright && (downright)) {
if (getBlockRight()) {
pushdown = false;
pushup = false;
moveRight();
}
}
}
if (dir == "up") {
getMyCorners(0, -40);
if (upleft && (upright)) {
if (getBlockUp()) {
pushleft = false;
pushright = false;
moveUp();
}
}
}
if (dir == "down") {
getMyCorners(0, 20);
if (downleft && (downright)) {
if (getBlockDown()) {
pushleft = false;
pushright = false;
moveDown();
}
}
}
if (dir == "stop") {
_x = _x + 0;
_y = _y + 0;
pState = "stand";
if (facing == "up") {
(gotoAndStop("stand_up"));// not popped
} else if (facing == "down") {
(gotoAndStop("stand_dn"));// not popped
} else if (facing == "left") {
(gotoAndStop("stand_lt"));// not popped
} else if (facing == "right") {
(gotoAndStop("stand_rt"));// not popped
}
}
}
}
if (xTarget > 0) {
_x = _x + speed;
xTarget--;
(gotoAndStop("walk_rt"));// not popped
} else if (xTarget < 0) {
_x = _x - speed;
xTarget++;
(gotoAndStop("walk_lt"));// not popped
} else if (yTarget > 0) {
_y = _y + speed;
yTarget--;
(gotoAndStop("walk_dn"));// not popped
} else if (yTarget < 0) {
_y = _y - speed;
yTarget++;
(gotoAndStop("walk_up"));// not popped
} else {
moving = false;
}
if (_dir == "up") {
facing = "up";
} else if (_dir == "down") {
facing = "down";
} else if (_dir == "left") {
facing = "left";
} else if (_dir == "right") {
facing = "right";
}
if (shoot) {
_root.game[currentMap].bolt.action();
_root.boltUpdate();
}
depths();
}
function depths() {
swapDepths((200 + playerTileX()) + (playerTileY() * _root.w));
}
function moveDown() {
yTarget = yTarget + (halfSpace / speed);
pState = "walk";
}
function moveUp() {
yTarget = yTarget - (halfSpace / speed);
pState = "walk";
}
function moveLeft() {
xTarget = xTarget - (halfSpace / speed);
pState = "walk";
}
function moveRight() {
xTarget = xTarget + (halfSpace / speed);
pState = "walk";
}
function getX() {
return(_x);
}
function getY() {
return(_y);
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
function playerTileX() {
return(Math.floor(_x / 20));
}
function playerTileY() {
return(Math.floor(_y / 20));
}
function getMyCorners(x, y) {
downY = Math.floor((((_y + (height / 2)) - 1) + y) / _root.map.game.tileH);
upY = Math.floor((_y + y) / _root.map.game.tileH);
leftX = Math.floor(((_x - (width / 2)) + x) / _root.map.game.tileW);
rightX = Math.floor((((_x + (width / 2)) - 1) + x) / _root.map.game.tileW);
upleft = _root.map.game[(("t_" + upY) + "_") + leftX].walkable;
downleft = _root.map.game[(("t_" + downY) + "_") + leftX].walkable;
upright = _root.map.game[(("t_" + upY) + "_") + rightX].walkable;
downright = _root.map.game[(("t_" + downY) + "_") + rightX].walkable;
}
function getBlockLeft() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileX() == (_root.game[currentMap]["block_" + _local3].newTileX() + 2)) {
if ((playerTileY() == _root.game[currentMap]["block_" + _local3].newTileY()) || ((playerTileY() + 1) == _root.game[currentMap]["block_" + _local3].newTileY())) {
_root.game[currentMap]["block_" + _local3].getMyCorners(-20, 0);
var _local4 = true;
if (_root.game[currentMap]["block_" + _local3].downleft) {
} else {
_local4 = false;
}
if (_root.game[currentMap]["block_" + _local3].upleft) {
} else {
_local4 = false;
}
if (_root.game[currentMap]["block_" + _local3].getBlockLeft()) {
} else {
_local4 = false;
}
if (this != "player") {
}
if (_local4) {
blockleft = true;
} else {
blockleft = false;
break;
}
} else {
blockleft = true;
}
} else {
blockleft = true;
}
_local3++;
}
return(blockleft);
}
function getBlockRight() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileX() == (_root.game[currentMap]["block_" + _local3].newTileX() - 2)) {
if ((playerTileY() == _root.game[currentMap]["block_" + _local3].newTileY()) || ((playerTileY() + 1) == _root.game[currentMap]["block_" + _local3].newTileY())) {
_root.game[currentMap]["block_" + _local3].getMyCorners(20, 0);
_root.game[currentMap]["block_" + _local3].getBlockRight();
if ((_root.game[currentMap]["block_" + _local3].upright && (_root.game[currentMap]["block_" + _local3].downright)) && (_root.game[currentMap]["block_" + _local3].blockright)) {
blockright = true;
} else {
blockright = false;
break;
}
} else {
blockright = true;
blockTick++;
}
} else {
blockright = true;
blockTick++;
}
_local3++;
}
return(blockright);
}
function getBlockUp() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileY() == (_root.game[currentMap]["block_" + _local3].newTileY() + 2)) {
if (((playerTileX() == _root.game[currentMap]["block_" + _local3].newTileX()) || ((playerTileX() - 1) == _root.game[currentMap]["block_" + _local3].newTileX())) || ((_root.game[currentMap]["block_" + _local3].playerTileX() + 1) == _root.game[currentMap]["block_" + _local3].newTileX())) {
_root.game[currentMap]["block_" + _local3].getMyCorners(0, -20);
_root.game[currentMap]["block_" + _local3].getBlockUp();
if ((_root.game[currentMap]["block_" + _local3].upleft && (_root.game[currentMap]["block_" + _local3].upright)) && (_root.game[currentMap]["block_" + _local3].blockup)) {
trace("up good!");
blockup = true;
} else {
blockup = false;
break;
}
} else {
blockup = true;
}
} else {
blockup = true;
}
_local3++;
}
return(blockup);
}
function getBlockDown() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileY() == (_root.game[currentMap]["block_" + _local3].newTileY() - 2)) {
if (((playerTileX() == _root.game[currentMap]["block_" + _local3].newTileX()) || ((playerTileX() - 1) == _root.game[currentMap]["block_" + _local3].newTileX())) || ((playerTileX() + 1) == _root.game[currentMap]["block_" + _local3].newTileX())) {
_root.game[currentMap]["block_" + _local3].getMyCorners(0, 20);
_root.game[currentMap]["block_" + _local3].getBlockDown();
if ((_root.game[currentMap]["block_" + _local3].downleft && (_root.game[currentMap]["block_" + _local3].downright)) && (_root.game[currentMap]["block_" + _local3].blockdown)) {
blockdown = true;
} else {
blockdown = false;
break;
}
} else {
blockdown = true;
}
} else {
blockdown = true;
}
_local3++;
}
return(blockdown);
}
function pushCounter() {
if (!pushOK) {
if (pushTicker < 10) {
pushTicker++;
} else {
pushOK = true;
}
}
}
function attack() {
if ((!shoot) && (_root.boltCollect > 0)) {
shoot = true;
_root.boltCollect--;
trace("I attack!");
(gotoAndStop("attack"));// not popped
_root.playSound("snd_shoot");
_root.game[currentMap].attachMovie("boltShoot", "bolt", 3000, {_x:_x, _y:_y});
_root.game[currentMap].bolt.facing = facing;
}
}
function die() {
trace("I am DEAD");
}
function deathShock() {
trace("I am DEAD by SHOCK.");
(gotoAndStop("shock"));// not popped
death = true;
}
function deathShoot(shootDir) {
trace("I am DEAD by SHOT.");
(gotoAndStop("die_" + shootDir));// not popped
death = true;
}
var height = 40;
var width = 40;
var speed = 5;
var halfSpace = 40;
var pState = "stand";
var xTarget = 0;
var yTarget = 0;
var shoot = false;
var facing = "down";
var blockleft = true;
var blockright = true;
var blockup = true;
var blockdown = true;
var pushdown = false;
var pushup = false;
var pushleft = false;
var pushright = false;
var pushing = false;
var pushTicker = 0;
var pushOK = false;
var blockTick = 0;
var death = false;
}
Symbol 1218 MovieClip [__Packages.Block] Frame 0
class Block extends Player
{
var currentMap, oldX, tileX, oldY, tileY, currentX, currentY, xTarget, yTarget, pState, dir, blockleft, downleft, upleft, moveLeft, blockdown, downright, moveDown, blockup, upright, moveUp, blockright, moveRight, _x, _y, moving, swapDepths, downY, height, upY, leftX, width, rightX, num;
function Block (_player, _enemies) {
super();
currentMap = _root.currentMap;
depths();
oldX = tileX();
oldY = tileY();
currentX = tileX();
currentY = tileY();
}
function move(_dir) {
if ((xTarget == 0) && (yTarget == 0)) {
if ((pState == "walk") || (pState == "stand")) {
dir = _dir;
if (((dir == "left") && (Key.isDown(37))) || ((dir == "left") && (Key.isDown(65)))) {
if (newTileX() == (playerTileX() - 1)) {
if ((newTileY() == (playerTileY() + 1)) || (newTileY() == playerTileY())) {
getBlockLeft();
if (blockleft) {
getMyCorners(-20, 0);
if (downleft && (upleft)) {
moveLeft();
}
}
}
}
if (_root.game[currentMap].player.pushdown) {
if (newTileY() == (playerTileY() + 1)) {
if (((newTileX() == playerTileX()) || (newTileX() == (playerTileX() + 1))) || (newTileX() == (playerTileX() - 1))) {
getBlockDown();
if (blockdown) {
getMyCorners(0, 20);
if (downleft && downright) {
moveDown();
}
}
}
}
}
if (_root.game[currentMap].player.pushup) {
if (newTileY() == playerTileY()) {
if (((newTileX() == playerTileX()) || (newTileX() == (playerTileX() + 1))) || (newTileX() == (playerTileX() - 1))) {
getBlockUp();
if (blockup) {
getMyCorners(0, -20);
if (upleft && upright) {
moveUp();
}
}
}
}
}
}
if (dir == "right") {
if (newTileX() == (playerTileX() + 2)) {
if ((newTileY() == (playerTileY() + 1)) || (newTileY() == playerTileY())) {
getBlockRight();
if (blockright) {
getMyCorners(20, 0);
if (upright && (downright)) {
moveRight();
}
}
}
}
if (_root.game[currentMap].player.pushdown) {
if (newTileY() == (playerTileY() + 1)) {
if (((newTileX() == playerTileX()) || (newTileX() == (playerTileX() + 1))) || (newTileX() == (playerTileX() - 1))) {
getBlockDown();
if (blockdown) {
getMyCorners(0, 20);
if (downleft && downright) {
moveDown();
}
}
}
}
}
if (_root.game[currentMap].player.pushup) {
if (newTileY() == playerTileY()) {
if (((newTileX() == playerTileX()) || (newTileX() == (playerTileX() + 1))) || (newTileX() == (playerTileX() - 1))) {
getBlockUp();
if (blockup) {
getMyCorners(0, -20);
if (upleft && upright) {
moveUp();
}
}
}
}
}
}
if (((dir == "up") && (Key.isDown(38))) || ((dir == "up") && (Key.isDown(87)))) {
if (newTileY() == (playerTileY() - 1)) {
if (((newTileX() == playerTileX()) || (newTileX() == (playerTileX() + 1))) || (newTileX() == (playerTileX() - 1))) {
getBlockUp();
if (blockup) {
getMyCorners(0, -20);
if (upleft && (upright)) {
moveUp();
}
}
}
}
if (_root.game[currentMap].player.pushleft) {
if (newTileX() == (playerTileX() - 1)) {
if ((newTileY() == (playerTileY() + 1)) || (newTileY() == playerTileY())) {
getBlockLeft();
if (blockleft) {
getMyCorners(-20, 0);
if (downleft && upleft) {
moveLeft();
}
}
}
}
}
if (_root.game[currentMap].player.pushright) {
if (newTileX() == (playerTileX() + 2)) {
if ((newTileY() == (playerTileY() + 1)) || (newTileY() == playerTileY())) {
getBlockRight();
if (blockright) {
getMyCorners(20, 0);
if (upright && downright) {
moveRight();
}
}
}
}
}
}
if (dir == "down") {
if (((newTileY() == (playerTileY() + 2)) && (Key.isDown(40))) || ((newTileY() == (playerTileY() + 2)) && (Key.isDown(83)))) {
if (((newTileX() == playerTileX()) || (newTileX() == (playerTileX() + 1))) || (newTileX() == (playerTileX() - 1))) {
getBlockDown();
if (blockdown) {
getMyCorners(0, 20);
if (downleft && (downright)) {
moveDown();
}
}
}
}
if (_root.game[currentMap].player.pushleft) {
if (newTileX() == (playerTileX() - 1)) {
if ((newTileY() == (playerTileY() + 1)) || (newTileY() == playerTileY())) {
getBlockLeft();
if (blockleft) {
getMyCorners(-20, 0);
if (downleft && upleft) {
moveLeft();
}
}
}
}
}
if (_root.game[currentMap].player.pushright) {
if (newTileX() == (playerTileX() + 2)) {
if ((newTileY() == (playerTileY() + 1)) || (newTileY() == playerTileY())) {
getBlockRight();
if (blockright) {
getMyCorners(20, 0);
if (upright && downright) {
moveRight();
}
}
}
}
}
}
if (dir == "stop") {
_x = _x + 0;
_y = _y + 0;
pState = "stand";
}
}
}
if (xTarget > 0) {
if (xTarget == (halfSpace / speed)) {
}
_x = _x + speed;
xTarget--;
if (!_root.game[currentMap].player.death) {
_root.game[currentMap].player.gotoAndStop("push_rt");
}
} else if (xTarget < 0) {
if (xTarget == (halfSpace / speed)) {
}
_x = _x - speed;
xTarget++;
if (!_root.game[currentMap].player.death) {
_root.game[currentMap].player.gotoAndStop("push_lt");
}
} else if (yTarget > 0) {
if (yTarget == (halfSpace / speed)) {
}
_y = _y + speed;
yTarget--;
if (!_root.game[currentMap].player.death) {
_root.game[currentMap].player.gotoAndStop("push_dn");
}
} else if (yTarget < 0) {
if (yTarget == (halfSpace / speed)) {
}
_y = _y - speed;
yTarget++;
if (!_root.game[currentMap].player.death) {
_root.game[currentMap].player.gotoAndStop("push_up");
}
} else {
moving = false;
_root.game[currentMap].player.pushing = false;
}
depths();
}
function depths() {
swapDepths((200 + newTileX()) + (newTileY() * _root.w));
}
function setMovable(x, y) {
trace("-------");
trace((("old x= " + oldX) + " old y= ") + oldY);
_root.map.game[(("t_" + oldY) + "_") + oldX].walkable = true;
trace((("new x= " + (oldX + x)) + " new y= ") + (oldY + y));
_root.map.game[(("t_" + (oldY + y)) + "_") + (oldX + x)].walkable = false;
oldY = oldY + y;
oldX = oldX + x;
}
function getMyCorners(x, y) {
downY = Math.floor((((_y + (height / 2)) - 1) + y) / _root.map.game.tileH);
upY = Math.floor(((_y + y) - 20) / _root.map.game.tileH);
leftX = Math.floor(((_x - (width / 2)) + x) / _root.map.game.tileW);
rightX = Math.floor((((_x + (width / 2)) - 1) + x) / _root.map.game.tileW);
upleft = _root.map.game[(("t_" + upY) + "_") + leftX].walkable;
downleft = _root.map.game[(("t_" + downY) + "_") + leftX].walkable;
upright = _root.map.game[(("t_" + upY) + "_") + rightX].walkable;
downright = _root.map.game[(("t_" + downY) + "_") + rightX].walkable;
}
function getBlockLeft() {
if (activated) {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (_local3 != num) {
if (newTileX() == (_root.game[currentMap]["block_" + _local3].newTileX() + 2)) {
if (((newTileY() == _root.game[currentMap]["block_" + _local3].newTileY()) || ((newTileY() + 1) == _root.game[currentMap]["block_" + _local3].newTileY())) || ((newTileY() - 1) == _root.game[currentMap]["block_" + _local3].newTileY())) {
blockleft = false;
break;
}
blockleft = true;
} else {
blockleft = true;
}
}
_local3++;
}
} else {
blockleft = false;
}
if (activated) {
var _local3 = 1;
while (_local3 <= _root.enemyCount) {
if (_local3 != num) {
if (newTileX() == (_root.game[currentMap]["enemy" + _local3].playerTileX() + 2)) {
if (((newTileY() == _root.game[currentMap]["enemy" + _local3].playerTileY()) || ((newTileY() + 1) == _root.game[currentMap]["enemy" + _local3].playerTileY())) || ((newTileY() - 1) == _root.game[currentMap]["enemy" + _local3].playerTileY())) {
blockleft = false;
break;
}
}
}
_local3++;
}
}
return(blockleft);
}
function getBlockRight() {
if (activated) {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (_local3 != num) {
if (newTileX() == (_root.game[currentMap]["block_" + _local3].newTileX() - 2)) {
if (((newTileY() == _root.game[currentMap]["block_" + _local3].newTileY()) || ((newTileY() + 1) == _root.game[currentMap]["block_" + _local3].newTileY())) || ((newTileY() - 1) == _root.game[currentMap]["block_" + _local3].newTileY())) {
blockright = false;
break;
}
blockright = true;
} else {
blockright = true;
}
}
_local3++;
}
} else {
blockright = false;
}
if (activated) {
var _local3 = 1;
while (_local3 <= _root.enemyCount) {
if (_local3 != num) {
if (newTileX() == (_root.game[currentMap]["enemy" + _local3].playerTileX() - 2)) {
if (((newTileY() == _root.game[currentMap]["enemy" + _local3].playerTileY()) || ((newTileY() + 1) == _root.game[currentMap]["enemy" + _local3].playerTileY())) || ((newTileY() - 1) == _root.game[currentMap]["enemy" + _local3].playerTileY())) {
blockright = false;
break;
}
}
}
_local3++;
}
}
return(blockright);
}
function getBlockUp() {
if (activated) {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (_local3 != num) {
if (newTileY() == (_root.game[currentMap]["block_" + _local3].newTileY() + 2)) {
if (((newTileX() == _root.game[currentMap]["block_" + _local3].newTileX()) || ((newTileX() - 1) == _root.game[currentMap]["block_" + _local3].newTileX())) || ((newTileX() + 1) == _root.game[currentMap]["block_" + _local3].newTileX())) {
blockup = false;
break;
}
blockup = true;
} else {
blockup = true;
}
}
_local3++;
}
} else {
blockup = false;
}
if (activated) {
var _local3 = 1;
while (_local3 <= _root.enemyCount) {
if (_local3 != num) {
if (newTileY() == (_root.game[currentMap]["enemy" + _local3].playerTileY() + 2)) {
if (((newTileX() == _root.game[currentMap]["enemy" + _local3].playerTileX()) || ((newTileX() - 1) == _root.game[currentMap]["enemy" + _local3].playerTileX())) || ((newTileX() + 1) == _root.game[currentMap]["enemy" + _local3].playerTileX())) {
blockup = false;
break;
}
}
}
_local3++;
}
}
return(blockup);
}
function getBlockDown() {
if (activated) {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (_local3 != num) {
if (newTileY() == (_root.game[currentMap]["block_" + _local3].newTileY() - 2)) {
if (((newTileX() == _root.game[currentMap]["block_" + _local3].newTileX()) || ((newTileX() - 1) == _root.game[currentMap]["block_" + _local3].newTileX())) || ((newTileX() + 1) == _root.game[currentMap]["block_" + _local3].newTileX())) {
blockdown = false;
break;
}
blockdown = true;
} else {
blockdown = true;
}
}
_local3++;
}
} else {
blockdown = false;
}
if (activated) {
var _local3 = 1;
while (_local3 <= _root.enemyCount) {
if (_local3 != num) {
if (newTileY() == (_root.game[currentMap]["enemy" + _local3].playerTileY() - 2)) {
if (((newTileX() == _root.game[currentMap]["enemy" + _local3].playerTileX()) || ((newTileX() - 1) == _root.game[currentMap]["enemy" + _local3].playerTileX())) || ((newTileX() + 1) == _root.game[currentMap]["enemy" + _local3].playerTileX())) {
blockdown = false;
break;
}
}
}
_local3++;
}
}
return(blockdown);
}
function newTileX() {
return(Math.floor(_x / 20));
}
function newTileY() {
return(Math.floor(_y / 20));
}
function playerTileX() {
return(Math.floor(_root.game[currentMap].player._x / 20));
}
function playerTileY() {
return(Math.floor(_root.game[currentMap].player._y / 20));
}
function action(_dir) {
move(_dir);
}
var enemies = [];
var offsetX = 20;
var offsetY = 20;
var speed = 5;
var halfSpace = 40;
var activated = true;
}
Symbol 1219 MovieClip [__Packages.Enemy] Frame 0
class Enemy extends Player
{
var currentMap, world, oldX, tileX, oldY, tileY, myPath, blockleft, xTarget, moveLeft, blockright, moveRight, blockup, yTarget, moveUp, blockdown, moveDown, move, dir, playerTileX, playerTileY, blockTick;
function Enemy () {
super();
trace("Hello! I'm a monster. My name is " + this);
moving = false;
currentMap = _root.currentMap;
world = _root.game[currentMap].tiles;
oldX = tileX();
oldY = tileY();
_root.map.game[(("t_" + tileY()) + "_") + tileX()].walkable = false;
}
function action() {
if ((findTimer++) > 30) {
findTimer = 0;
}
if (active) {
attack();
if (!moving) {
findTarget();
if (myPath.length > 0) {
if ((myPath[1].x - myPath[0].x) == -1) {
getBlockLeft();
if (blockleft) {
if (xTarget == (halfSpace / speed)) {
}
moveLeft();
myPath.shift();
moving = true;
}
} else if ((myPath[1].x - myPath[0].x) == 1) {
getBlockRight();
if (blockright) {
if (xTarget == (halfSpace / speed)) {
}
moveRight();
myPath.shift();
moving = true;
}
} else if ((myPath[1].y - myPath[0].y) == -1) {
getBlockUp();
if (blockup) {
if (yTarget == (halfSpace / speed)) {
}
moveUp();
myPath.shift();
moving = true;
}
} else if ((myPath[1].y - myPath[0].y) == 1) {
getBlockDown();
if (blockdown) {
if (yTarget == (halfSpace / speed)) {
}
moveDown();
myPath.shift();
moving = true;
}
}
}
}
move(dir);
}
}
function activate() {
trace("enemy activated!!!");
_root.map.game[(("t_" + tileY()) + "_") + tileX()].walkable = true;
active = true;
}
function setMovable(x, y) {
trace("-------");
trace((("old x= " + oldX) + " old y= ") + oldY);
_root.map.game[(("t_" + oldY) + "_") + oldX].walkable = true;
trace((("new x= " + (oldX + x)) + " new y= ") + (oldY + y));
_root.map.game[(("t_" + (oldY + y)) + "_") + (oldX + x)].walkable = false;
oldY = oldY + y;
oldX = oldX + x;
_root.buildMap(_root.myMap);
}
function attack() {
if (tileX() == _root.game[currentMap].player.tileX()) {
if (tileY() == _root.game[currentMap].player.tileY()) {
trace("hello. I'm here to kill you!");
_root.game[currentMap].player.deathShock();
active = false;
}
}
}
function findTarget() {
_root.myAstar.setStartPoint(tileX(), tileY());
_root.myAstar.setEndPoint(_root.game[currentMap].player.tileX(), _root.game[currentMap].player.tileY());
_root.myAstar.setClipping("no");
myPath = _root.myAstar.findPath();
if (!myPath) {
trace("no Path has been found");
}
}
function getBlockLeft() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileX() == (_root.game[currentMap]["block_" + _local3].newTileX() + 2)) {
if (((playerTileY() == _root.game[currentMap]["block_" + _local3].newTileY()) || ((playerTileY() + 1) == _root.game[currentMap]["block_" + _local3].newTileY())) || ((playerTileY() - 1) == _root.game[currentMap]["block_" + _local3].newTileY())) {
blockleft = false;
break;
}
blockleft = true;
} else {
blockleft = true;
}
_local3++;
}
return(blockleft);
}
function getBlockRight() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileX() == (_root.game[currentMap]["block_" + _local3].newTileX() - 2)) {
if (((playerTileY() == _root.game[currentMap]["block_" + _local3].newTileY()) || ((playerTileY() + 1) == _root.game[currentMap]["block_" + _local3].newTileY())) || ((playerTileY() - 1) == _root.game[currentMap]["block_" + _local3].newTileY())) {
blockright = false;
break;
}
blockright = true;
blockTick++;
} else {
blockright = true;
blockTick++;
}
_local3++;
}
return(blockright);
}
function getBlockUp() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileY() == (_root.game[currentMap]["block_" + _local3].newTileY() + 2)) {
if (((playerTileX() == _root.game[currentMap]["block_" + _local3].newTileX()) || ((playerTileX() - 1) == _root.game[currentMap]["block_" + _local3].newTileX())) || ((playerTileX() + 1) == _root.game[currentMap]["block_" + _local3].newTileX())) {
blockup = false;
break;
}
blockup = true;
} else {
blockup = true;
}
_local3++;
}
return(blockup);
}
function getBlockDown() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileY() == (_root.game[currentMap]["block_" + _local3].newTileY() - 2)) {
if (((playerTileX() == _root.game[currentMap]["block_" + _local3].newTileX()) || ((playerTileX() - 1) == _root.game[currentMap]["block_" + _local3].newTileX())) || ((playerTileX() + 1) == _root.game[currentMap]["block_" + _local3].newTileX())) {
blockdown = false;
break;
}
blockdown = true;
} else {
blockdown = true;
}
_local3++;
}
return(blockdown);
}
var speed = 4;
var halfSpace = 40;
var moving = false;
var active = false;
var findTimer = 0;
}
Symbol 1220 MovieClip [__Packages.EnemyBlock] Frame 0
class EnemyBlock extends Block
{
var currentMap, gotoAndStop, xTarget, yTarget, move, _x, _y;
function EnemyBlock () {
super();
currentMap = _root.currentMap;
}
function action(_dir) {
if (!activated) {
if ((tileX() == _root.game[currentMap].bolt.tileX()) && (tileY() == _root.game[currentMap].bolt.tileY())) {
gotoAndStop("active");
_root.playSound("snd_shockzap");
activated = true;
_root.game[currentMap].bolt.hit();
}
}
if ((activated || (xTarget > 0)) || (yTarget > 0)) {
move(_dir);
}
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
var collected = false;
var activated = false;
}
Symbol 1221 MovieClip [__Packages.EnemyEye] Frame 0
class EnemyEye extends MovieClip
{
var currentMap, gotoAndStop, facing, swapDepths, _x, _y;
function EnemyEye () {
super();
currentMap = _root.currentMap;
_root.map.game[(("t_" + tileY()) + "_") + tileX()].walkable = false;
depths();
}
function action() {
if (!kill) {
if (((((newTileY() == _root.game[currentMap].player.playerTileY()) || (newTileY() == (_root.game[currentMap].player.playerTileY() - 1))) || (newTileY() == (_root.game[currentMap].player.playerTileY() + 1))) || (newTileY() == (_root.game[currentMap].player.playerTileY() + 2))) || (newTileY() == (_root.game[currentMap].player.playerTileY() - 2))) {
if (newTileX() <= _root.game[currentMap].player.playerTileX()) {
(gotoAndStop("warning_right"));// not popped
} else {
(gotoAndStop("warning_left"));// not popped
}
} else if (((((newTileX() == _root.game[currentMap].player.playerTileX()) || (newTileX() == (_root.game[currentMap].player.playerTileX() - 1))) || (newTileX() == (_root.game[currentMap].player.playerTileX() + 1))) || (newTileX() == (_root.game[currentMap].player.playerTileX() + 2))) || (newTileX() == (_root.game[currentMap].player.playerTileX() - 2))) {
if (newTileY() >= _root.game[currentMap].player.playerTileY()) {
(gotoAndStop("warning_up"));// not popped
} else {
(gotoAndStop("warning_down"));// not popped
}
} else {
(gotoAndStop("stand"));// not popped
}
if ((_root.game[currentMap].player.xTarget == 0) && (_root.game[currentMap].player.yTarget == 0)) {
if (newTileX() == playerTileX()) {
if (tileY() > _root.game[currentMap].player.tileY()) {
kill = true;
i = 1;
while (i <= _root.blockCount) {
gap = 0;
while (gap < (tileY() - _root.game[currentMap].player.tileY())) {
if ((((_root.game[currentMap]["block_" + i].newTileX() == newTileX()) && (_root.game[currentMap]["block_" + i].tileY() == ((tileY() - gap) - 1))) || (((_root.game[currentMap]["block_" + i].newTileX() - 1) == newTileX()) && (_root.game[currentMap]["block_" + i].tileY() == ((tileY() - gap) - 1)))) || (((_root.game[currentMap]["block_" + i].newTileX() + 1) == newTileX()) && (_root.game[currentMap]["block_" + i].tileY() == ((tileY() - gap) - 1)))) {
dontKill();
break;
}
gap++;
}
i++;
}
gap = 0;
while (gap < (tileY() - _root.game[currentMap].player.tileY())) {
if (!_root.map.game[(("t_" + ((tileY() - gap) - 1)) + "_") + tileX()].walkable) {
dontKill();
break;
}
gap++;
}
if (kill) {
facing = "up";
(gotoAndStop("shoot_up"));// not popped
killPlayer();
}
} else if (tileY() < _root.game[currentMap].player.tileY()) {
kill = true;
i = 1;
while (i <= _root.blockCount) {
gap = 0;
while (gap < (_root.game[currentMap].player.tileY() - tileY())) {
if ((((_root.game[currentMap]["block_" + i].newTileX() == newTileX()) && (_root.game[currentMap]["block_" + i].tileY() == ((tileY() + gap) + 1))) || (((_root.game[currentMap]["block_" + i].newTileX() - 1) == newTileX()) && (_root.game[currentMap]["block_" + i].tileY() == ((tileY() + gap) + 1)))) || (((_root.game[currentMap]["block_" + i].newTileX() + 1) == newTileX()) && (_root.game[currentMap]["block_" + i].tileY() == ((tileY() + gap) + 1)))) {
dontKill();
break;
}
gap++;
}
i++;
}
gap = 0;
while (gap < (_root.game[currentMap].player.tileY() - tileY())) {
if (!_root.map.game[(("t_" + ((tileY() + gap) + 1)) + "_") + tileX()].walkable) {
dontKill();
break;
}
gap++;
}
if (kill) {
facing = "down";
(gotoAndStop("shoot_down"));// not popped
killPlayer();
}
}
} else if ((newTileY() == playerTileY()) || (newTileY() == (playerTileY() + 1))) {
if (tileX() > _root.game[currentMap].player.tileX()) {
kill = true;
i = 1;
while (i <= _root.blockCount) {
gap = 0;
while (gap < (tileX() - _root.game[currentMap].player.tileX())) {
if ((((_root.game[currentMap]["block_" + i].newTileY() == newTileY()) && (_root.game[currentMap]["block_" + i].tileX() == ((tileX() - gap) - 1))) || (((_root.game[currentMap]["block_" + i].newTileY() - 1) == newTileY()) && (_root.game[currentMap]["block_" + i].tileX() == ((tileX() - gap) - 1)))) || (((_root.game[currentMap]["block_" + i].newTileY() + 1) == newTileY()) && (_root.game[currentMap]["block_" + i].tileX() == ((tileX() - gap) - 1)))) {
dontKill();
break;
}
gap++;
}
i++;
}
gap = 0;
while (gap < (tileX() - _root.game[currentMap].player.tileX())) {
if (!_root.map.game[(("t_" + tileY()) + "_") + ((tileX() - gap) - 1)].walkable) {
dontKill();
break;
}
gap++;
}
if (kill) {
facing = "left";
(gotoAndStop("shoot_left"));// not popped
killPlayer();
}
} else if (tileX() < _root.game[currentMap].player.tileX()) {
kill = true;
i = 1;
while (i <= _root.blockCount) {
gap = 0;
while (gap < (_root.game[currentMap].player.tileX() - tileX())) {
if ((((_root.game[currentMap]["block_" + i].newTileY() == newTileY()) && (_root.game[currentMap]["block_" + i].tileX() == (tileX() + gap))) || (((_root.game[currentMap]["block_" + i].newTileY() - 1) == newTileY()) && (_root.game[currentMap]["block_" + i].tileX() == (tileX() + gap)))) || (((_root.game[currentMap]["block_" + i].newTileY() + 1) == newTileY()) && (_root.game[currentMap]["block_" + i].tileX() == (tileX() + gap)))) {
dontKill();
break;
}
gap++;
}
i++;
}
gap = 0;
while (gap < (_root.game[currentMap].player.tileX() - tileX())) {
if (!_root.map.game[(("t_" + tileY()) + "_") + ((tileX() + gap) + 1)].walkable) {
dontKill();
break;
}
gap++;
}
if (kill) {
facing = "right";
(gotoAndStop("shoot_right"));// not popped
killPlayer();
}
}
}
}
}
}
function killPlayer() {
_root.game[currentMap].player.deathShoot(facing);
}
function dontKill() {
kill = false;
}
function depths() {
swapDepths((200 + newTileX()) + (newTileY() * _root.w));
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
function newTileX() {
return(Math.floor(_x / 20));
}
function newTileY() {
return(Math.floor(_y / 20));
}
function playerTileX() {
return(Math.floor(_root.game[currentMap].player._x / 20));
}
function playerTileY() {
return(Math.floor(_root.game[currentMap].player._y / 20));
}
var collected = false;
var i = 0;
var gap = 0;
var kill = false;
}
Symbol 1222 MovieClip [__Packages.Bolt] Frame 0
class Bolt extends MovieClip
{
var currentMap, gotoAndStop, _x, _y;
function Bolt () {
super();
currentMap = _root.currentMap;
}
function action() {
if (!collected) {
if ((tileX() == _root.game[currentMap].player.tileX()) && (tileY() == _root.game[currentMap].player.tileY())) {
collected = true;
gotoAndStop("collect");
_root.playSound("snd_magic01");
_root.boltCollect++;
_root.boltUpdate();
}
}
}
function boltUpdate() {
boltCount = 1;
while (boltCount <= 3) {
_root.hud["bolt" + boltCount].gotoAndStop(1);
boltCount++;
}
boltCount = 1;
while (boltCount <= _root.boltCollect) {
_root.hud["bolt" + boltCount].gotoAndStop(2);
boltCount++;
}
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
var collected = false;
var boltCount = 0;
}
Symbol 1223 MovieClip [__Packages.Coin] Frame 0
class Coin extends MovieClip
{
var currentMap, gotoAndStop, _x, _y;
function Coin () {
super();
currentMap = _root.currentMap;
}
function action() {
if (!collected) {
if ((tileX() == _root.game[currentMap].player.tileX()) && (tileY() == _root.game[currentMap].player.tileY())) {
collected = true;
_root.playSound("snd_chime2");
gotoAndStop("collect");
_root.coinCollect++;
_root.hud.coinbox.gotoAndStop(_root.coinCollect + 1);
doorCheck();
}
}
}
function doorCheck() {
if (_root.coinCollect >= _root.coinMax) {
trace("I collected all coins!");
_root.playSound("snd_magic09");
_root.game[currentMap].door.activate();
activateEnemies();
deactivateBlocks();
_root.coinUpdate();
}
}
function activateEnemies() {
i = 1;
while (i <= _root.enemyCount) {
_root.game[currentMap]["enemy" + i].activate();
i++;
}
}
function deactivateBlocks() {
i = 1;
while (i <= _root.blockCount) {
_root.game[currentMap]["block_" + i].activated = false;
_root.game[currentMap]["block_" + i].gotoAndStop("done");
i++;
}
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
var collected = false;
var i = 1;
}
Symbol 1224 MovieClip [__Packages.BoltShoot] Frame 0
class BoltShoot extends MovieClip
{
var currentMap, facing, _x, _y, gotoAndStop, pState;
function BoltShoot () {
super();
currentMap = _root.currentMap;
}
function action() {
if (active) {
if (facing == "up") {
moveUp();
} else if (facing == "down") {
moveDown();
} else if (facing == "left") {
moveLeft();
} else if (facing == "right") {
moveRight();
}
}
if ((((_x < 0) || (_x > 480)) || (_y < 0)) || (_y > 360)) {
hit();
}
}
function hit() {
_root.game[currentMap].player.shoot = false;
gotoAndStop("hit");
}
function moveDown() {
_y = _y + speed;
pState = "walk";
}
function moveUp() {
_y = _y - speed;
pState = "walk";
}
function moveLeft() {
_x = _x - speed;
pState = "walk";
}
function moveRight() {
_x = _x + speed;
pState = "walk";
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
var speed = 10;
var active = true;
}
Symbol 1225 MovieClip [__Packages.Door] Frame 0
class Door extends MovieClip
{
var currentMap, gotoAndStop, _x, _y;
function Door () {
super();
currentMap = _root.currentMap;
}
function action() {
if (activated && (!triggered)) {
if ((tileX() == _root.game[currentMap].player.tileX()) && (tileY() == _root.game[currentMap].player.tileY())) {
if ((_root.game[currentMap].player.xTarget == 0) && (_root.game[currentMap].player.yTarget == 0)) {
(gotoAndStop("get"));// not popped
trace("You win!!!");
_root.playSound("snd_magic02");
win();
triggered = true;
}
}
}
}
function win() {
_root.stageComplete = true;
_root.gamePause = true;
_root.game[currentMap].player.gotoAndStop("victory");
}
function activate() {
activated = true;
gotoAndStop("activate");
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
var activated = false;
var triggered = false;
}
Symbol 1226 MovieClip [__Packages.Goal] Frame 0
class Goal extends MovieClip
{
var currentMap, _x, _y;
function Goal () {
super();
currentMap = _root.currentMap;
}
function action() {
}
function doorCheck() {
if (_root.coinCollect >= _root.coinMax) {
trace("I collected all coins!");
_root.game[currentMap].door.activate();
}
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
function newTileX() {
return(Math.floor(_x / 20));
}
function newTileY() {
return(Math.floor(_y / 20));
}
var activated = false;
var collected = false;
}
Symbol 1227 MovieClip [__Packages.BlockZ] Frame 0
class BlockZ extends Block
{
var currentMap, move, newTileX, newTileY, gotoAndStop;
function BlockZ (_player, _enemies) {
super();
currentMap = _root.currentMap;
}
function action(_dir) {
move(_dir);
goalCheck();
}
function goalCheck() {
if (activated) {
var _local3 = 1;
while (_local3 <= _root.goalCount) {
var _local4 = newTileX() == _root.game[currentMap]["goal_" + _local3].newTileX();
var _local5 = newTileY() == _root.game[currentMap]["goal_" + _local3].newTileY();
if (_local4 && (_local5)) {
gotoAndStop("active");
solid = true;
break;
}
solid = false;
gotoAndStop("stand");
_local3++;
}
}
}
function goalSet(aAllChecked) {
trace("Activate goal");
trace("Deactivate all blocks");
var _local3 = 1;
while (_local3 <= _root.blockCount) {
_root.game[currentMap]["block_" + _local3].activated = false;
_local3++;
}
}
var activated = true;
var solid = false;
var z = true;
}
Symbol 1228 MovieClip [__Packages.Gate] Frame 0
class Gate extends MovieClip
{
var ogDepth, getDepth, gotoAndStop, swapDepths, _x, _y;
function Gate () {
super();
lock();
ogDepth = getDepth();
depths();
}
function action() {
}
function lock() {
gotoAndStop("locked");
_root.map.game[(("t_" + tileY()) + "_") + tileX()].walkable = false;
}
function unlock() {
gotoAndStop("open");
swapDepths(ogDepth);
}
function unlockwalk() {
trace("unlocky baby!");
_root.map.game[(("t_" + tileY()) + "_") + tileX()].walkable = true;
}
function depths() {
swapDepths((200 + newTileX()) + (newTileY() * _root.w));
}
function newTileX() {
return(Math.floor(_x / 20));
}
function newTileY() {
return(Math.floor(_y / 20));
}
function tileX() {
if ((_x % 40) != 0) {
return(Math.floor((_x - 20) / 40));
}
return(Math.floor(_x / 40));
}
function tileY() {
if ((_y % 40) != 0) {
return(Math.floor((_y - 20) / 40));
}
return(Math.floor(_y / 40));
}
var locked = false;
}
Symbol 1229 MovieClip [__Packages.EnemySeeker] Frame 0
class EnemySeeker extends Player
{
var myOldX, tileX, myOldY, tileY, currentMap, xlessthanplayer, xmorethanplayer, xsameasplayer, ylessthanplayer, ymorethanplayer, ysameasplayer, xTarget, yTarget, dir, move, playerTileX, playerTileY, blockleft, blockright, blockTick, blockup, blockdown;
function EnemySeeker () {
super();
moving = false;
myOldX = tileX();
myOldY = tileY();
currentMap = _root.currentMap;
}
function action() {
trace((("I am working" + tileX()) + " asdsd ") + _root.game[currentMap].player.tileX());
xlessthanplayer = tileX() < _root.game[currentMap].player.tileX();
xmorethanplayer = tileX() > _root.game[currentMap].player.tileX();
xsameasplayer = tileX() == _root.game[currentMap].player.tileX();
ylessthanplayer = tileY() < _root.game[currentMap].player.tileY();
ymorethanplayer = tileY() > _root.game[currentMap].player.tileY();
ysameasplayer = tileY() == _root.game[currentMap].player.tileY();
if (searchMode == "horiz") {
if ((xTarget == 0) && (yTarget == 0)) {
if (goOK) {
if (xlessthanplayer) {
dir = "right";
} else if (xmorethanplayer) {
dir = "left";
} else if (xsameasplayer) {
if (ymorethanplayer) {
dir = "up";
} else if (ylessthanplayer) {
dir = "down";
}
}
} else {
dir = "stop";
}
} else {
trace("goOk = false");
goOK = false;
}
} else if (searchMode == "verti") {
if ((xTarget == 0) && (yTarget == 0)) {
if (goOK) {
if (ymorethanplayer) {
dir = "up";
} else if (ylessthanplayer) {
dir = "down";
} else if (ysameasplayer) {
if (xlessthanplayer) {
dir = "right";
} else if (xmorethanplayer) {
dir = "left";
}
}
} else {
dir = "stop";
}
} else {
trace("goOk = false");
goOK = false;
}
} else if (searchMode == "random") {
move(moveDir);
randomTimer();
}
if (dir == "right") {
move("right");
} else if (dir == "left") {
move("left");
} else if (dir == "up") {
move("up");
} else if (dir == "down") {
move("down");
}
if (!goOK) {
if (ticks < 15) {
ticks++;
} else {
goOK = true;
ticks = 0;
}
}
searchTimer();
}
function searchTimer() {
var _local3 = false;
var _local2 = 0;
if (myOldX != tileX()) {
_local2++;
}
if (myOldY != tileY()) {
_local2++;
}
if (_local2 == 2) {
_local3 = true;
} else {
searchTick = 0;
}
if (_local3 == true) {
if (searchTick < searchDelay) {
searchTick++;
} else {
switchMode();
searchTick = 0;
}
}
}
function randomTimer() {
var _local3 = false;
var _local2 = 0;
if (myOldX == tileX()) {
_local2++;
} else {
myOldX = tileX();
}
if (myOldY == tileY()) {
_local2++;
} else {
myOldY = tileY();
}
if (_local2 == 2) {
_local3 = true;
} else {
randomTick = 0;
}
if (_local3 == true) {
if (randomTick < searchDelay) {
randomTick++;
} else {
switchDir();
randomTick = 0;
}
}
}
function switchMode() {
if (searchMode == "horiz") {
trace("Switch to vertical searchMode");
searchMode = "verti";
} else if (searchMode == "verti") {
trace("Switch to horizontal searchMode");
searchMode = "horiz";
}
if (random(50) == 0) {
trace("Switch to random searchMode");
}
}
function switchDir() {
trace("Time to move in a different direction.");
moveDir = directions[random(4)];
trace("I am now moving... " + moveDir);
}
function getBlockLeft() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileX() == (_root.game[currentMap]["block_" + _local3].newTileX() + 2)) {
if (((playerTileY() == _root.game[currentMap]["block_" + _local3].newTileY()) || ((playerTileY() + 1) == _root.game[currentMap]["block_" + _local3].newTileY())) || ((playerTileY() - 1) == _root.game[currentMap]["block_" + _local3].newTileY())) {
blockleft = false;
break;
}
blockleft = true;
} else {
blockleft = true;
}
_local3++;
}
return(blockleft);
}
function getBlockRight() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileX() == (_root.game[currentMap]["block_" + _local3].newTileX() - 2)) {
if (((playerTileY() == _root.game[currentMap]["block_" + _local3].newTileY()) || ((playerTileY() + 1) == _root.game[currentMap]["block_" + _local3].newTileY())) || ((playerTileY() - 1) == _root.game[currentMap]["block_" + _local3].newTileY())) {
blockright = false;
break;
}
blockright = true;
blockTick++;
} else {
blockright = true;
blockTick++;
}
_local3++;
}
return(blockright);
}
function getBlockUp() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileY() == (_root.game[currentMap]["block_" + _local3].newTileY() + 2)) {
if (((playerTileX() == _root.game[currentMap]["block_" + _local3].newTileX()) || ((playerTileX() - 1) == _root.game[currentMap]["block_" + _local3].newTileX())) || ((playerTileX() + 1) == _root.game[currentMap]["block_" + _local3].newTileX())) {
blockup = false;
break;
}
blockup = true;
} else {
blockup = true;
}
_local3++;
}
return(blockup);
}
function getBlockDown() {
var _local3 = 1;
while (_local3 <= _root.blockCount) {
if (playerTileY() == (_root.game[currentMap]["block_" + _local3].newTileY() - 2)) {
if (((playerTileX() == _root.game[currentMap]["block_" + _local3].newTileX()) || ((playerTileX() - 1) == _root.game[currentMap]["block_" + _local3].newTileX())) || ((playerTileX() + 1) == _root.game[currentMap]["block_" + _local3].newTileX())) {
blockdown = false;
break;
}
blockdown = true;
} else {
blockdown = true;
}
_local3++;
}
return(blockdown);
}
var speed = 4;
var halfSpace = 20;
var moving = false;
var searchMode = "horiz";
var searchDelay = 90;
var searchTick = 0;
var randomDelay = 10;
var randomTick = 0;
var goOK = true;
var ticks = 0;
var directions = ["up", "down", "left", "right"];
var moveDir = "up";
}
Symbol 1230 MovieClip [__Packages.mapBuild] Frame 0
class mapBuild
{
var mapData, currentMap, game, borderCount;
function mapBuild (_mapData) {
mapData = _mapData;
currentMap = _root.currentMap;
game = {tileW:_root.tileW, tileH:_root.tileH};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = true;
game.Tile1.prototype.frame = 1;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 2;
game.Tile3 = function () {
};
game.Tile3.prototype.walkable = false;
game.Tile3.prototype.frame = 3;
game.Tile4 = function () {
};
game.Tile4.prototype.walkable = false;
game.Tile4.prototype.frame = 4;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
game.Tile6 = function () {
};
game.Tile6.prototype.walkable = false;
game.Tile6.prototype.frame = 6;
game.Tile7 = function () {
};
game.Tile7.prototype.walkable = false;
game.Tile7.prototype.frame = 7;
game.Tile8 = function () {
};
game.Tile8.prototype.walkable = false;
game.Tile8.prototype.frame = 8;
game.Tile9 = function () {
};
game.Tile9.prototype.walkable = false;
game.Tile9.prototype.frame = 9;
game.Tile10 = function () {
};
game.Tile10.prototype.walkable = false;
game.Tile10.prototype.frame = 10;
game.Tile11 = function () {
};
game.Tile11.prototype.walkable = false;
game.Tile11.prototype.frame = 11;
game.Tile12 = function () {
};
game.Tile12.prototype.walkable = false;
game.Tile12.prototype.frame = 12;
game.Tile13 = function () {
};
game.Tile13.prototype.walkable = true;
game.Tile13.prototype.frame = 13;
game.Tile14 = function () {
};
game.Tile14.prototype.walkable = true;
game.Tile14.prototype.frame = 14;
game.Tile15 = function () {
};
game.Tile15.prototype.walkable = false;
game.Tile15.prototype.frame = 15;
game.Tile16 = function () {
};
game.Tile16.prototype.walkable = false;
game.Tile16.prototype.frame = 16;
game.Tile17 = function () {
};
game.Tile17.prototype.walkable = false;
game.Tile17.prototype.frame = 17;
game.Tile18 = function () {
};
game.Tile18.prototype.walkable = false;
game.Tile18.prototype.frame = 18;
game.Tile19 = function () {
};
game.Tile19.prototype.walkable = false;
game.Tile19.prototype.frame = 19;
game.Tile20 = function () {
};
game.Tile20.prototype.walkable = false;
game.Tile20.prototype.frame = 20;
}
function init() {
}
function buildAstar() {
}
function create(map) {
currentMap = _root.currentMap;
d = 0;
_root.game[currentMap].attachMovie("stage_bg", "stage_bg", ++d, {_x:-40, _y:-40});
_root.game[currentMap].attachMovie("stage_fg", "stage_fg", 9913, {_x:-40, _y:-40});
_root.game[currentMap].attachMovie("blank", "tiles", ++d);
game.world = _root.game[currentMap].tiles;
var _local7 = map[0].length;
var _local8 = map.length;
var _local5 = 0;
while (_local5 < _local8) {
var _local4 = 0;
while (_local4 < _local7) {
var _local3 = (("t_" + _local5) + "_") + _local4;
game[_local3] = new game["Tile" + map[_local5][_local4]]();
game.world.attachMovie("tile", _local3, (_local5 * 100) + (_local4 * 2));
game.world[_local3]._x = _local4 * game.tileW;
game.world[_local3]._y = _local5 * game.tileH;
game.world[_local3].gotoAndStop(game[_local3].frame);
_local4++;
}
_local5++;
}
_root.game[currentMap].tiles.cacheAsBitmap = true;
}
function border() {
_root.game[currentMap].attachMovie("blank", "border", ++d);
_root.game[currentMap].attachMovie("blank", "border2", 9999);
game.world = _root.game[currentMap].border;
game.world2 = _root.game[currentMap].border2;
borderCount = 0;
var _local3 = 0;
while (_local3 < (_root.h + 2)) {
if (_local3 == 0) {
var _local4 = 0;
while (_local4 < (_root.w + 2)) {
game.world.attachMovie("tile", "border" + borderCount, -100 + (_local4 * 2), {_x:(_local4 * game.tileW) - game.tileW, _y:-game.tileH});
game.world["border" + borderCount].gotoAndStop("tree");
borderCount++;
_local4++;
}
}
if ((_local3 >= 0) && (_local3 < _root.h)) {
game.world.attachMovie("tile", "border" + borderCount, (_local3 * 100) + 26, {_x:-game.tileW, _y:_local3 * game.tileH});
game.world["border" + borderCount].gotoAndStop("tree");
borderCount++;
game.world.attachMovie("tile", "border" + borderCount, (_local3 * 100) + 24, {_x:12 * game.tileW, _y:_local3 * game.tileH});
game.world["border" + borderCount].gotoAndStop("tree");
borderCount++;
}
if (_local3 == _root.h) {
var _local4 = 0;
while (_local4 < (_root.w + 2)) {
game.world2.attachMovie("tile", "border" + borderCount, (_local3 * 100) + (_local4 * 2), {_x:(_local4 * game.tileW) - game.tileW, _y:(_local3 * game.tileH) + 10});
game.world2["border" + borderCount].gotoAndStop("tree");
borderCount++;
_local4++;
}
}
_local3++;
}
}
function objects(objectLayer) {
d++;
var _local9 = objectLayer[0].length;
var _local10 = objectLayer.length;
_root.coinMax = 0;
_root.coinCollect = 0;
objectNum = 1;
itemNum = 1;
blockNum = 1;
goalNum = 1;
gateNum = 1;
_root.enemyCount = 0;
_root.itemCount = 0;
_root.blockCount = 0;
_root.goalCount = 0;
_root.gateCount = 0;
var _local4 = 0;
while (_local4 < _local10) {
var _local3 = 0;
while (_local3 < _local9) {
if (objectLayer[_local4][_local3] == 1) {
var _local6 = "player";
} else if ((objectLayer[_local4][_local3] == 4) || (objectLayer[_local4][_local3] == 5)) {
var _local6 = "enemy" + objectNum;
_root.enemyCount++;
objectNum++;
} else if ((objectLayer[_local4][_local3] == 2) || (objectLayer[_local4][_local3] == 9)) {
var _local6 = "item" + itemNum;
_root.itemCount++;
itemNum++;
} else if (((objectLayer[_local4][_local3] == 3) || (objectLayer[_local4][_local3] == 6)) || (objectLayer[_local4][_local3] == 11)) {
var _local6 = "block_" + blockNum;
_root.blockCount++;
blockNum++;
} else if (objectLayer[_local4][_local3] == 8) {
var _local6 = "door";
} else if (objectLayer[_local4][_local3] == 10) {
_root.goalCount++;
var _local6 = "goal_" + goalNum;
goalNum++;
} else if (objectLayer[_local4][_local3] == 12) {
_root.gateCount++;
var _local6 = "gate_" + gateNum;
gateNum++;
}
_root.game[currentMap].attachMovie(_root.objectBox[objectLayer[_local4][_local3]], _local6, d++, {_x:(_local3 * _root.tileW) + (_root.tileW / 2), _y:(_local4 * _root.tileH) + (_root.tileW / 2)});
if (objectLayer[_local4][_local3] == 3) {
_root.game[currentMap][_local6].num = blockNum - 1;
}
if (objectLayer[_local4][_local3] == 2) {
_root.coinMax++;
}
_local3++;
}
_local4++;
}
}
var d = 0;
var objectNum = 1;
var itemNum = 1;
var blockNum = 1;
var goalNum = 1;
var gateNum = 1;
}
Symbol 1231 MovieClip [__Packages.be.dauntless.Astar.Astar] Frame 0
class be.dauntless.Astar.Astar
{
var map, mapW, mapH, startPoint, endPoint, heap;
function Astar () {
}
function setMap(_map) {
map = _map;
mapW = map[0].length;
mapH = map.length;
}
function newMap(w, h) {
w = mf(w);
h = mf(h);
map = new Array(h);
var _local3 = h;
while ((_local3--) > 0) {
map[_local3] = new Array(w);
var _local2 = w;
while ((_local2--) > 0) {
var _local4 = new be.dauntless.Astar.Tile(_local2, _local3);
map[_local3][_local2] = _local4;
}
}
mapW = w;
mapH = h;
}
function setStartPoint(x, y) {
startPoint = new Array(x, y);
}
function setClipping(cl) {
clippingMode = cl;
}
function setEndPoint(x, y) {
endPoint = new Array(x, y);
}
function findPath() {
openMap();
if (!ready()) {
return(false);
}
heap = new be.dauntless.Astar.BinaryHeap();
var _local11 = false;
var _local13 = map[startPoint[1]][startPoint[0]];
_local13.setOpen();
_local13.setG(0);
_local13.setH(endPoint[0], endPoint[1]);
_local13.setParent(_local13);
heap.addToHeap(_local13);
while ((heap.getLength() > 0) && (!_local11)) {
var _local4 = heap.getLowest();
if ((_local4.x == endPoint[0]) && (_local4.y == endPoint[1])) {
_local11 = true;
break;
}
_local4.setClosed();
var _local3 = findSurroundingTiles(_local4);
var _local2 = _local3.length;
while ((_local2--) > 0) {
if (!_local3[_local2].getOpen()) {
_local3[_local2].setOpen();
_local3[_local2].setParent(_local4);
_local3[_local2].setH(endPoint[0], endPoint[1]);
_local3[_local2].setG(_local4.getG());
heap.addToHeap(_local3[_local2]);
} else {
var _local6 = (_local3[_local2].getH() + _local4.getG()) + _local3[_local2].getCost();
if (_local6 < _local3[_local2].getF()) {
var _local5 = _local3[_local2].id;
_local3[_local2].setParent(_local4);
_local3[_local2].setG(_local4.getG());
heap.updateList(heap.getPosition(_local5));
}
}
}
}
if (!_local11) {
trace("There is no path!");
return(false);
}
var _local12 = new Array();
var _local9 = endPoint[0];
var _local8 = endPoint[1];
map[_local8][_local9].notice();
_local12.push(map[_local8][_local9]);
var _local10 = map[_local8][_local9].getParent();
_local9 = _local10.x;
_local8 = _local10.y;
while ((_local9 != startPoint[0]) || (_local8 != startPoint[1])) {
var _local7 = map[_local8][_local9];
_local12.push(_local7);
_local7.notice();
_local10 = _local7.getParent();
_local9 = _local10.x;
_local8 = _local10.y;
}
_local12.push(map[startPoint[1]][startPoint[0]]);
map[startPoint[1]][startPoint[0]].notice();
_local12.reverse();
return(_local12);
}
function findSurroundingTiles(current) {
var _local2 = new Array();
var _local4 = current.x;
var _local3 = current.y;
var _local5 = map[_local3][_local4 - 1];
var _local6 = map[_local3][_local4 - -1];
var _local7 = map[_local3 - -1][_local4];
var _local8 = map[_local3 - 1][_local4];
if (_local5.walkable && (!_local5.isClosed())) {
_local2.push(_local5);
_local5.costDown();
}
if (_local6.walkable && (!_local6.isClosed())) {
_local2.push(_local6);
_local6.costDown();
}
if (_local7.walkable && (!_local7.isClosed())) {
_local2.push(_local7);
_local7.costDown();
}
if (_local8.walkable && (!_local8.isClosed())) {
_local2.push(_local8);
_local8.costDown();
}
if (clippingMode == "semi") {
var _local9 = map[_local3 - 1][_local4 - 1];
var _local10 = map[_local3 - -1][_local4 - 1];
var _local11 = map[_local3 - 1][_local4 - -1];
var _local12 = map[_local3 - -1][_local4 - -1];
if (((_local9.walkable && (!_local9.isClosed())) && (_local8.walkable)) && (_local5.walkable)) {
_local2.push(_local9);
_local9.costUp();
}
if (((_local11.walkable && (!_local11.isClosed())) && (_local8.walkable)) && (_local6.walkable)) {
_local2.push(_local11);
_local11.costUp();
}
if (((_local12.walkable && (!_local12.isClosed())) && (_local7.walkable)) && (_local6.walkable)) {
_local2.push(_local12);
_local12.costUp();
}
if (((_local10.walkable && (!_local10.isClosed())) && (_local7.walkable)) && (_local5.walkable)) {
_local2.push(_local10);
_local10.costUp();
}
} else if (clippingMode == "full") {
var _local9 = map[_local3 - 1][_local4 - 1];
var _local11 = map[_local3 - 1][_local4 - -1];
var _local12 = map[_local3 - -1][_local4 - -1];
var _local10 = map[_local3 - -1][_local4 - 1];
if (_local9.walkable && (!_local9.isClosed())) {
_local2.push(_local9);
_local9.costUp();
}
if (_local11.walkable && (!_local11.isClosed())) {
_local2.push(_local11);
_local11.costUp();
}
if (_local12.walkable && (!_local12.isClosed())) {
_local2.push(_local12);
_local12.costUp();
}
if (_local10.walkable && (!_local10.isClosed())) {
_local2.push(_local10);
_local10.costUp();
}
}
return(_local2);
}
function ready() {
if (map == undefined) {
trace("No map specified");
return(false);
}
var _local3 = startPoint[0];
if ((_local3 != mf(startPoint[0])) || (startPoint[1] != mf(startPoint[1]))) {
trace("Startpoint isn't valid");
return(false);
}
if ((endPoint[0] != mf(endPoint[0])) || (endPoint[1] != mf(endPoint[1]))) {
trace("Endpoint isn't valid");
return(false);
}
if ((startPoint[0] < 0) || (startPoint[0] >= mapW)) {
trace("Startpoint isn't valid");
return(false);
}
if ((startPoint[1] < 0) || (startPoint[1] >= mapH)) {
trace("Startpoint isn't valid");
return(false);
}
if ((endPoint[0] < 0) || (endPoint[0] >= mapW)) {
trace("EndPoint isn't valid");
return(false);
}
if ((endPoint[1] < 0) || (endPoint[1] >= mapH)) {
trace("EndPoint isn't valid");
return(false);
}
var _local2 = map[endPoint[1]][endPoint[0]];
if (!_local2.walkable) {
trace("Endpoint isn't walkable.");
return(false);
}
if (!_local2.walkable) {
trace("Startpoint isn't walkable.");
return(false);
}
return(true);
}
function setCost(x, y, c) {
map[y][x].setCost(c);
}
function setWalkable(x, y, b) {
map[y][x].setWalkable(b);
}
function toggleWalkable(x, y) {
map[y][x].toggleWalkable();
}
function openMap() {
var _local3 = mapH;
while ((_local3--) > 0) {
var _local2 = mapW;
while ((_local2--) > 0) {
map[_local3][_local2].reset();
}
}
}
function setStandardCost(c) {
standardCost = c;
}
function setDiagonalCost(c) {
diagonalCost = c;
}
static var standardCost = 1;
static var diagonalCost = 1.141;
var mf = Math.floor;
var clippingMode = "full";
}
Symbol 1232 MovieClip [__Packages.be.dauntless.Astar.BinaryHeap] Frame 0
class be.dauntless.Astar.BinaryHeap
{
var heap;
function BinaryHeap () {
heap = new Array(null);
}
function addToHeap(newTile) {
heap.push(newTile);
var _local2 = heap.length - 1;
var _local4 = Math.floor(_local2 / 2);
while (_local2 != 1) {
if (heap[_local2].getF() <= heap[Math.floor(_local2 / 2)].getF()) {
var _local3 = heap[Math.floor(_local2 / 2)];
heap[Math.floor(_local2 / 2)] = heap[_local2];
heap[_local2] = _local3;
_local2 = Math.floor(_local2 / 2);
} else {
break;
}
}
}
function getLowest() {
var _local3 = 1;
var _local2;
var _local5 = heap[1];
if (heap.length == 2) {
heap.pop();
} else {
heap[1] = heap.pop();
}
_local2 = _local3;
if (((_local3 * 2) - -1) <= (heap.length - 1)) {
if (heap[_local2].getF() >= heap[_local2 * 2].getF()) {
_local3 = 2 * _local2;
}
if (heap[_local3].getF() >= heap[(_local2 * 2) - -1].getF()) {
_local3 = (2 * _local2) - -1;
}
} else if ((2 * _local2) <= (heap.length - 1)) {
if (heap[_local2].getF() >= heap[2 * _local2].getF()) {
_local3 = 2 * _local2;
}
}
if (_local2 != _local3) {
var _local4 = heap[_local2];
heap[_local2] = heap[_local3];
heap[_local3] = _local4;
// unexpected jump
}
return(_local5);
}
function getLength() {
return(heap.length - 1);
}
function getPosition(id) {
var _local2 = heap.length;
while ((_local2--) > 0) {
if (heap[_local2].id == id) {
return(_local2);
}
}
}
function updateList(cp_) {
var _local2 = cp_;
var _local4 = Math.floor(_local2 / 2);
while (_local2 != 1) {
if (heap[_local2].getF() <= heap[Math.floor(_local2 / 2)].getF()) {
var _local3 = heap[Math.floor(_local2 / 2)];
heap[Math.floor(_local2 / 2)] = heap[_local2];
heap[_local2] = _local3;
_local2 = Math.floor(_local2 / 2);
} else {
break;
}
}
}
}
Symbol 1233 MovieClip [__Packages.be.dauntless.Astar.Tile] Frame 0
class be.dauntless.Astar.Tile
{
var x, y, id, parent, h, g;
function Tile (xp, yp) {
x = xp;
y = yp;
id = ids++;
cost = be.dauntless.Astar.Astar.standardCost;
}
function setWalkable(b) {
walkable = b;
}
function setOpen() {
inOpen = true;
closed = false;
}
function setClosed() {
inOpen = false;
closed = true;
}
function isClosed() {
return(closed);
}
function getOpen() {
return(inOpen);
}
function setParent(t) {
parent = t;
}
function getParent() {
return(parent);
}
function setH(ex, ey) {
h = (Math.abs(ex - x) * be.dauntless.Astar.Astar.standardCost) + (Math.abs(ey - y) * be.dauntless.Astar.Astar.standardCost);
}
function setG(_g) {
g = _g + getCost();
}
function getF() {
return(getG() + h);
}
function getH() {
return(h);
}
function setCost(_cost) {
cost = _cost;
}
function getG() {
return(g);
}
function getCost() {
return(cost * (gUp ? (be.dauntless.Astar.Astar.diagonalCost) : (be.dauntless.Astar.Astar.standardCost)));
}
function toggleWalkable() {
walkable = !walkable;
}
function reset() {
inOpen = (closed = (gUp = false));
parent = null;
h = (g = null);
}
function costUp() {
gUp = true;
}
function costDown() {
gUp = false;
}
function notice() {
}
static var count = 0;
var inOpen = false;
var closed = false;
static var ids = 0;
var gUp = false;
var cost = be.dauntless.Astar.Astar.standardCost;
var walkable = true;
}
Symbol 1234 MovieClip [__Packages.Game] Frame 0
class Game
{
var currentMap, player, dir, i;
function Game (_player, _enemies) {
currentMap = _root.currentMap;
player = _root.game[currentMap].player;
var _local3 = _root.enemyCount;
player.swapDepths(2994);
_root.game[currentMap]._x = _root.game[currentMap]._x + offsetX;
_root.game[currentMap]._y = _root.game[currentMap]._y + offsetY;
}
function checkKey() {
if (!Key.isDown(32)) {
keyHit = false;
}
if (Key.isDown(39) || (Key.isDown(68))) {
dir = "right";
} else if (Key.isDown(37) || (Key.isDown(65))) {
dir = "left";
} else if (Key.isDown(38) || (Key.isDown(87))) {
dir = "up";
} else if (Key.isDown(40) || (Key.isDown(83))) {
dir = "down";
} else {
dir = "stop";
}
if (Key.isDown(32)) {
if (!keyHit) {
player.attack();
keyHit = true;
}
}
if (Key.isDown(192)) {
}
if (Key.isDown(82)) {
player.deathShock();
}
return(dir);
}
function movePlayer() {
if ((!player.death) && (!player.pushing)) {
player.move(dir);
}
}
function moveEnemy() {
i = 1;
while (i <= _root.enemyCount) {
_root.game[currentMap]["enemy" + i].action();
i++;
}
}
function itemCollect() {
}
function itemCheck() {
i = 1;
while (i <= _root.itemCount) {
_root.game[currentMap]["item" + i].action();
i++;
}
}
function blockCheck() {
i = 1;
while (i <= _root.blockCount) {
_root.game[currentMap]["block_" + i].action(dir);
i++;
}
}
function doorCheck() {
_root.game[currentMap].door.action();
}
function goalCheck() {
if ((!_root.goalComplete) && (_root.goalCount > 0)) {
var _local6 = 0;
i = 1;
while (i <= _root.blockCount) {
var _local3 = 1;
while (_local3 <= _root.goalCount) {
var _local4 = _root.game[currentMap]["block_" + i].newTileX() == _root.game[currentMap]["goal_" + _local3].newTileX();
var _local5 = _root.game[currentMap]["block_" + i].newTileY() == _root.game[currentMap]["goal_" + _local3].newTileY();
if (_local4 && (_local5)) {
if (_root.game[currentMap]["block_" + i].z) {
_local6++;
}
}
_local3++;
}
i++;
}
if (_local6 == _root.goalCount) {
i = 1;
while (i <= _root.blockCount) {
var _local3 = 1;
while (_local3 <= _root.goalCount) {
var _local4 = _root.game[currentMap]["block_" + i].newTileX() == _root.game[currentMap]["goal_" + _local3].newTileX();
var _local5 = _root.game[currentMap]["block_" + i].newTileY() == _root.game[currentMap]["goal_" + _local3].newTileY();
if (_local4 && (_local5)) {
trace("turn off block_" + i);
_root.game[currentMap]["block_" + i].activated = false;
_root.game[currentMap]["block_" + i].gotoAndStop("done");
}
_local3++;
}
i++;
}
i = 1;
while (i <= _root.gateCount) {
_root.game[currentMap]["gate_" + i].unlock();
i++;
}
_root.goalComplete = true;
}
_root.goalCollect = _local6;
}
}
var enemies = [];
var offsetX = 26;
var offsetY = 55;
var keyHit = false;
}
Symbol 1235 MovieClip [__Packages.com.managers.SoundManager] Frame 0
class com.managers.SoundManager extends MovieClip
{
var thisMC, sounds_array, globalSound_snd, theSoundClipMC, getNextHighestDepth, createEmptyMovieClip;
function SoundManager (aSoundRef) {
super();
thisMC = aSoundRef;
sounds_array = new Array();
}
function init() {
}
function addSound(aSoundLinkage_str) {
trace(("*****addSound(" + aSoundLinkage_str) + ")");
globalSound_snd = new Sound(this);
var _local7 = ("sndHolder_" + String(sounds_array.length)) + "_mc";
var _local5 = thisMC.getNextHighestDepth();
var _local6 = thisMC.createEmptyMovieClip(_local7, _local5);
theSoundClipMC = _local6;
var _local3 = MovieClip(theSoundClipMC);
var _local2 = new Sound(_local3);
_local2.attachSound(aSoundLinkage_str);
sounds_array.push(_local3);
var _local8 = new com.managers.SoundDataObject(aSoundLinkage_str, _local2);
sounds_array.push(_local8);
}
function getSound(aSoundLinkage_str) {
var _local2;
var _local6 = sounds_array.length;
_local2 = 0;
while (_local2 < _local6) {
var _local3 = sounds_array[_local2];
var _local5 = _local3.__get__name();
if (aSoundLinkage_str == _local5) {
var _local4 = _local3.__get__sound();
return(_local4);
}
_local2++;
}
}
function playSound(aSoundLinkage_str, aOffset_num, aLoopCount_num) {
trace((((("playSound = " + aSoundLinkage_str) + " ") + aOffset_num) + " ") + aLoopCount_num);
stopSound(aSoundLinkage_str);
var _local3 = getSound(aSoundLinkage_str);
_local3.start(aOffset_num, aLoopCount_num);
}
function stopSound(aSoundLinkage_str) {
trace("stopSound = " + aSoundLinkage_str);
var _local3 = getSound(aSoundLinkage_str);
_local3.stop(aSoundLinkage_str);
}
function setSoundVolume(aSoundLinkage_str, aVolume_num) {
var _local2 = getSound(aSoundLinkage_str);
_local2.setVolume(aVolume_num);
}
function getSoundVolume(aSoundLinkage_str) {
var _local2 = getSound(aSoundLinkage_str);
return(_local2.getVolume());
}
function tweenSoundVolume(aSoundLinkage_str, aTargetVolume_num, aNumberOfFrames) {
trace(((((("*****tweenSoundVolume(" + aSoundLinkage_str) + ",") + aTargetVolume_num) + ",") + aNumberOfFrames) + ")");
var _local3 = getSoundVolume(aSoundLinkage_str);
if (_local3 == undefined) {
} else {
var _local4 = aTargetVolume_num;
var _local6 = Math.abs(_local3 - _local4);
if (_local6 < aNumberOfFrames) {
_local6 = aNumberOfFrames;
}
var _local5 = 1;
if (_local3 < _local4) {
_local5 = 1;
} else if (_local3 > _local4) {
_local5 = -1;
} else {
trace("tCurrentVolume == tTargetVolume");
}
var _local8 = _local6 / aNumberOfFrames;
if (_local8 < 1) {
_local8 = 1;
}
var _local14 = _local8 * _local5;
var _local13 = ("tweenHolder_" + aSoundLinkage_str) + "_mc";
trace("this = " + this);
var _local10 = getNextHighestDepth();
trace("tNextDepth = " + _local10);
var _local11 = createEmptyMovieClip(_local13, _local10);
trace("soundMCTweenThing = " + _local11);
var _local2 = MovieClip(_local11);
_local2.ref = this;
_local2.targetVolume = _local4;
_local2.modNumber = _local5;
_local2.soundLinkage = aSoundLinkage_str;
_local2.changePerFrame = _local14;
_local2.onEnterFrame = function () {
var _local2 = this.ref.getSoundVolume(this.soundLinkage);
if (this.modNumber > 0) {
if (_local2 > this.targetVolume) {
this.onEnterFrame = null;
}
} else if (this.modNumber < 0) {
if (_local2 < this.targetVolume) {
this.onEnterFrame = null;
}
} else {
trace("this.modNumber == 0 in Sound Manager, something is broken");
}
var _local3 = _local2 + this.changePerFrame;
this.ref.setSoundVolume(aSoundLinkage_str, _local3);
};
}
}
function setGlobalVolume(aVolume_num) {
globalSound_snd.setVolume(aVolume_num);
}
}
Symbol 1236 MovieClip [__Packages.com.managers.SoundDataObject] Frame 0
class com.managers.SoundDataObject extends Object
{
var name_str, sound_snd;
function SoundDataObject (aSoundName_str, aSound_snd) {
super();
name_str = aSoundName_str;
sound_snd = aSound_snd;
}
function get sound() {
return(sound_snd);
}
function get name() {
return(name_str);
}
}
Symbol 424 Button
on (release) {
gotoAndPlay ("play");
}
Symbol 427 MovieClip Frame 42
stop();
Symbol 427 MovieClip Frame 64
_root.play();
Symbol 503 MovieClip Frame 18
_root.playSound("snd_ascend");
Symbol 503 MovieClip Frame 19
stop();
Symbol 520 MovieClip Frame 14
_root.playSound("ninja_snd_01");
Symbol 520 MovieClip Frame 44
_root.playSound("ninja_snd_01");
Symbol 520 MovieClip Frame 64
_root.playSound("ninja_snd_02");
Symbol 520 MovieClip Frame 78
_root.playSound("ninja_snd_02");
Symbol 520 MovieClip Frame 89
_root.playSound("ninja_snd_02");
Symbol 520 MovieClip Frame 109
_root.playSound("ninja_snd_03");
Symbol 520 MovieClip Frame 122
_root.playSound("ninja_snd_04");
Symbol 520 MovieClip Frame 138
_root.mySoundManager.stopSound("ninja_snd_04");
Symbol 520 MovieClip Frame 217
_root.playSound("ninja_snd_05");
Symbol 520 MovieClip Frame 238
_root.mySoundManager.stopSound("ninja_snd_05");
Symbol 534 MovieClip Frame 9
_root.playSound("ninja_snd_01");
Symbol 534 MovieClip Frame 26
_root.playSound("ninja_snd_01");
Symbol 534 MovieClip Frame 33
_root.playSound("ninja_snd_01");
Symbol 534 MovieClip Frame 86
_root.playSound("ninja_snd_03");
Symbol 534 MovieClip Frame 96
_root.playSound("ninja_snd_02");
Symbol 534 MovieClip Frame 119
_root.playSound("ninja_snd_01");
Symbol 534 MovieClip Frame 133
_root.playSound("ninja_snd_01");
Symbol 547 MovieClip Frame 18
_root.playSound("ninja_snd_01");
Symbol 547 MovieClip Frame 60
_root.playSound("ninja_snd_03");
Symbol 547 MovieClip Frame 69
_root.playSound("ninja_snd_02");
Symbol 547 MovieClip Frame 108
_root.playSound("ninja_snd_01");
Symbol 547 MovieClip Frame 131
_root.playSound("ninja_snd_01");
Symbol 547 MovieClip Frame 139
_root.mySoundManager.stopSound("ninja_snd_01");
Symbol 570 MovieClip Frame 1
_root.ninjaTalk_out();
Symbol 570 MovieClip Frame 90
_root.nextStage();
stop();
Symbol 593 MovieClip Frame 147
_root.death();
stop();
Symbol 608 MovieClip Frame 105
_root.death();
stop();
Symbol 624 MovieClip Frame 105
_root.death();
stop();
Symbol 635 MovieClip Frame 121
_root.death();
stop();
Symbol 636 MovieClip [player] Frame 1
#initclip 33
Object.registerClass("player", Player);
#endinitclip
stop();
Symbol 636 MovieClip [player] Frame 2
stop();
Symbol 636 MovieClip [player] Frame 44
stop();
Symbol 641 MovieClip Frame 10
stop();
Symbol 642 MovieClip Frame 4
stop();
Symbol 644 MovieClip [door] Frame 1
#initclip 26
Object.registerClass("door", Door);
#endinitclip
stop();
Symbol 651 MovieClip Frame 1
stop();
Symbol 655 MovieClip [block] Frame 1
#initclip 27
Object.registerClass("block", Block);
#endinitclip
barrelframe = 1 + random(2);
trace("bf " + barrelframe);
barrel.gotoAndStop(barrelframe);
stop();
Symbol 655 MovieClip [block] Frame 4
barrel.gotoAndStop(barrelframe);
Symbol 658 MovieClip [goal] Frame 1
#initclip 28
Object.registerClass("goal", Goal);
#endinitclip
stop();
Symbol 664 MovieClip Frame 42
stop();
Symbol 665 MovieClip [blockZ] Frame 1
#initclip 29
Object.registerClass("blockZ", BlockZ);
#endinitclip
stop();
Symbol 665 MovieClip [blockZ] Frame 3
_root.playSound("snd_select11");
Symbol 680 MovieClip Frame 1
stop();
Symbol 686 Button
on (release) {
if (!_root.gamePause) {
_root.screenPause();
_root.gamePause = true;
}
}
Symbol 690 Button
on (release) {
if (!_root.gamePause) {
if (_root.musicSwitch == "on") {
_root.musicSwitch = "off";
gotoAndStop ("off");
_root.mySoundManager.setSoundVolume("ninja_music", 0);
trace("Set sounds off... " + _root.getVolume());
} else if (_root.musicSwitch == "off") {
_root.musicSwitch = "on";
_root.mySoundManager.setSoundVolume("ninja_music", 100);
trace("Set sounds on... " + _root.getVolume());
}
_root.saveGame();
}
}
Symbol 696 Button
on (release) {
if (!_root.gamePause) {
_root.game[_root.currentMap].player.deathShock();
}
}
Symbol 699 MovieClip Frame 6
stop();
Symbol 700 MovieClip Frame 1
stop();
Symbol 700 MovieClip Frame 2
stop();
Symbol 710 MovieClip Frame 1
stop();
Symbol 710 MovieClip Frame 2
stop();
Symbol 710 MovieClip Frame 3
stop();
Symbol 710 MovieClip Frame 4
stop();
Symbol 710 MovieClip Frame 5
stop();
Symbol 710 MovieClip Frame 6
stop();
Symbol 710 MovieClip Frame 7
stop();
Symbol 710 MovieClip Frame 8
stop();
Symbol 711 MovieClip [hud] Frame 1
Symbol 718 MovieClip Frame 38
_parent.unlockwalk();
Symbol 718 MovieClip Frame 102
stop();
Symbol 719 MovieClip [gate] Frame 1
#initclip 30
Object.registerClass("gate", Gate);
#endinitclip
stop();
Symbol 726 MovieClip [enemySeeker] Frame 1
#initclip 31
Object.registerClass("enemySeeker", EnemySeeker);
#endinitclip
stop();
Symbol 792 MovieClip [enemy] Frame 1
#initclip 32
Object.registerClass("enemy", Enemy);
#endinitclip
stop();
Symbol 803 MovieClip [screenDeath] Frame 1
this.swapDepths(9999);
_root.gamePause = true;
Symbol 803 MovieClip [screenDeath] Frame 30
_root.restart();
Symbol 803 MovieClip [screenDeath] Frame 60
stop();
_root.gamePause = false;
this.removeMovieClip();
Symbol 810 MovieClip [screenTransition] Frame 1
_root.gamePause = true;
_root.introPlay = true;
Symbol 810 MovieClip [screenTransition] Frame 25
_root.playSound("snd_magic02");
Symbol 810 MovieClip [screenTransition] Frame 100
_root.playSound("snd_magic10");
Symbol 810 MovieClip [screenTransition] Frame 127
_root.gamePause = false;
_root.introPlay = false;
_root.ninjaTalk_in();
this.removeMovieClip();
Symbol 810 MovieClip [screenTransition] Frame 130
Symbol 812 MovieClip [screenWin] Frame 1
this.swapDepths(9999);
_root.gamePause = true;
Symbol 812 MovieClip [screenWin] Frame 40
stop();
_root.nextStage();
this.removeMovieClip();
Symbol 818 MovieClip Frame 1
function select() {
trace("go to stage #" + num);
_root.stageNum = num;
_root.gameStart();
_parent.removeMovieClip();
gotoAndStop (1);
}
function mouseOn() {
gotoAndStop (2);
}
function mouseOff() {
gotoAndStop (1);
}
function mouseClick() {
gotoAndStop (1);
}
if (active) {
onRollOut = mouseOff;
onRollOver = mouseOn;
onRelease = select;
onReleaseOutside = mouseOff;
onPress = mouseClick;
}
stop();
Symbol 824 Button
on (release) {
_root.gotoAndStop("instruct");
this.removeMovieClip();
}
Symbol 827 Button
on (release) {
sure.gotoAndStop(2);
}
Symbol 835 Button
on (release) {
gotoAndStop (2);
}
Symbol 840 Button
on (release) {
_root.clearSave();
gotoAndStop (1);
_root.gotoAndStop("title");
}
Symbol 844 Button
on (release) {
gotoAndStop (1);
}
Symbol 845 MovieClip Frame 1
stop();
Symbol 869 MovieClip [stageSelect] Frame 1
function stageDisplay() {
var _local2 = 1;
while (_local2 <= stageMax) {
this[_local2].num = _local2;
_local2++;
}
if (stageData < stageMax) {
target = Math.floor(stageData / increment);
gotoAndStop(stageData);
_local2 = 1;
while (_local2 <= stageData) {
this[_local2].active = true;
_local2++;
}
} else {
gotoAndStop(stageMax);
_local2 = 1;
while (_local2 <= stageMax) {
this[_local2].active = true;
_local2++;
}
}
}
increment = 6;
stageData = 18;
stageData = _root.playerData;
stageMax = 24;
stageDisplay();
stopAllSounds();
this.swapDepths(9999);
d = 0;
Symbol 869 MovieClip [stageSelect] Frame 2
stop();
Symbol 873 Button
on (release) {
_root.unPause();
}
Symbol 875 Button
on (release) {
_root.gotoAndStop("levelselect");
_root.clearGame();
}
Symbol 889 MovieClip [screenInstructions] Frame 1
stop();
keyHit = true;
onEnterFrame = function () {
if (Key.isDown(32)) {
if (!keyHit) {
_root.gamePause = false;
_root.introPlay = false;
_root.ninjaTalk_in();
this.removeMovieClip();
}
keyHit = true;
} else {
keyHit = false;
}
};
Symbol 897 MovieClip Frame 1
stop();
Symbol 928 MovieClip Frame 540
_root.gotoAndStop("instruct");
Symbol 931 Button
on (release) {
gotoAndStop ("instruct");
}
Symbol 932 Button
on (release) {
gotoAndPlay ("play");
}
Symbol 1039 MovieClip Frame 213
stop();
Symbol 1046 Button
on (release) {
gotoAndPlay ("leavebuttons");
}
Symbol 1054 MovieClip Frame 13
stop();
Symbol 1054 MovieClip Frame 225
_root.play();
Symbol 1055 Button
on (release) {
gotoAndPlay ("play");
}
Symbol 1070 Button
on (press) {
gotoAndPlay ("inst");
}
Symbol 1083 Button
on (release) {
trace("go to stage #1");
_root.stageNum = 1;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1087 Button
on (release) {
trace("go to stage #2");
_root.stageNum = 2;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1090 Button
on (release) {
trace("go to stage #3");
_root.stageNum = 3;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1093 Button
on (release) {
trace("go to stage #4");
_root.stageNum = 4;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1096 Button
on (release) {
trace("go to stage #5");
_root.stageNum = 5;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1099 Button
on (release) {
trace("go to stage 6");
_root.stageNum = 6;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1102 Button
on (release) {
trace("go to stage #7");
_root.stageNum = 7;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1105 Button
on (release) {
trace("go to stage #8");
_root.stageNum = 8;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1108 Button
on (release) {
trace("go to stage #9");
_root.stageNum = 9;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1111 Button
on (release) {
trace("go to stage #10");
_root.stageNum = 10;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1114 Button
on (release) {
trace("go to stage #11");
_root.stageNum = 11;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1117 Button
on (release) {
trace("go to stage #12");
_root.stageNum = 12;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1120 Button
on (release) {
trace("go to stage #13");
_root.stageNum = 13;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1123 Button
on (release) {
trace("go to stage #14");
_root.stageNum = 14;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1126 Button
on (release) {
trace("go to stage #15");
_root.stageNum = 15;
_root.gameStart();
_root.gotoAndStop("gameplay");
}
Symbol 1134 Button
on (release) {
gotoAndPlay ("scroll");
}
Symbol 1146 Button
on (release) {
gotoAndPlay ("stageselect");
}
Symbol 1157 Button
on (release) {
gotoAndPlay ("gate");
}
Symbol 1163 Button
on (release) {
gotoAndPlay ("barrel");
}
Symbol 1174 Button
on (release) {
gotoAndPlay ("scroll2");
}
Symbol 1178 MovieClip Frame 120
stop();
Symbol 1178 MovieClip Frame 320
stop();
Symbol 1178 MovieClip Frame 444
stop();
Symbol 1179 MovieClip Frame 19
stop();
if (_root.playerData == undefined) {
}
gotoAndStop(18 + _root.playerData);
trace(" playerData equals = " + _root.playerData);
Symbol 1179 MovieClip Frame 36
stop();
Symbol 1179 MovieClip Frame 522
stop();
Symbol 1195 MovieClip Frame 1
this.swapDepths(9998);
_visible = false;
Symbol 1215 Button
on (release) {
_root.gotoAndStop("title");
}
Symbol 1216 MovieClip Frame 455
stop();