Frame 1
function runIt() {
delete this.onEnterFrame;
gotoAndStop ("intro");
}
but_start._visible = false;
aup = false;
this.onEnterFrame = function () {
var _local4 = this.getBytesTotal();
var _local3 = this.getBytesLoaded();
var _local2 = Math.round((_local3 / _local4) * 100);
loader.gotoAndStop(_local2);
if (_local2 >= 100) {
but_start._visible = true;
but_start.onPress = function () {
runIt();
};
this.onEnterFrame = function () {
if (!Key.isDown(65)) {
aup = true;
}
if (aup && (Key.isDown(65))) {
aup = false;
runIt();
}
};
}
};
Stage.showMenu = false;
stop();
var CPMStarPoolID = 1052;
var CPMStarSubPoolID = 42;
System.security.allowDomain("server.cpmstar.com");
adBox.loadMovie((("http://server.cpmstar.com/adviewas2.swf?poolid=" + CPMStarPoolID) + "&subpoolid=") + CPMStarSubPoolID);
Instance of Symbol 253 MovieClip [API Connector (NewgroundsAPI)] in Frame 1
//component parameters
onClipEvent (construct) {
encryption_key = "ZlIciHDj96vYaWsqYox29OYMl9ebcLuh";
movie_id = "10886";
movie_version = "";
fake_session = true;
debug = true;
error_screens = true;
medal_popups = true;
}
Frame 3
stop();
Frame 4
function runMedal(nam) {
var _local1 = nam;
com.newgrounds.API.unlockMedal(_local1);
}
function clearDat() {
_root.so.clear();
_root.updateProg();
}
function showSword(who) {
i = 0;
while (i < 9) {
var hid = eval ("who.s" + i);
hid._visible = false;
i++;
}
sho = eval ("who.s" + cursword);
sho._visible = true;
}
function updateProg() {
_root.curmag = 0;
_root.curarmor = 0;
_root.cursword = 0;
_root.numdeaths = 0;
if (_root.so.data.numdeaths != undefined) {
_root.curmag = so.data.curmag;
_root.curarmor = so.data.curarmor;
_root.cursword = so.data.cursword;
_root.numdeaths = so.data.numdeaths;
}
var _local2 = new Color(men.prog.masker);
_local2.setRGB(armorarray[_root.curarmor]);
men.prog.arm.text = "-" + _root.curarmor;
men.prog.mag.text = "-" + _root.curmag;
men.prog.sword.text = "-" + _root.cursword;
men.prog.deaths.text = "-" + _root.numdeaths;
showSword(men.prog.swordthing);
men.prog.magthing.updateMe();
}
function goTime() {
delete this.onEnterFrame;
_root.gotoAndStop("map");
}
stop();
_root.gameending = false;
_root._quality = "High";
_root.qualset = "High";
_root.so = SharedObject.getLocal("oukoku");
armorarray = new Array("0xB56A39", "0x69E2B1", "0x4C4C4C", "0xBFBFBF", "0x6FA637", "0x4665A0", "0xE6001E", "0xF7F7F7", "0xFFC219");
armorstrokearray = new Array("0x3A2212", "0x187851", "0x1E1E1E", "0x515151", "0x334D1A", "0x253752", "0x7E011B", "0x6A6A6A", "0x765301");
updateProg();
this.onEnterFrame = function () {
if (!Key.isDown(65)) {
aup = true;
}
if (Key.isDown(65) && (aup)) {
aup = false;
goTime();
}
};
men.but_cleardata.onPress = function () {
men.sure._visible = true;
};
men.but_cleardata.onRollOver = function () {
this.gotoAndStop(2);
};
men.but_cleardata.onRollOut = function () {
this.gotoAndStop(1);
};
men.but_cleardata.onReleaseOutside = function () {
this.gotoAndStop(1);
};
Frame 5
function setNoise(v) {
if (!_root.museoff) {
this.bgmusic.trak.setVolume(v);
}
}
function playLoudSound(m) {
if (!_root.sfxoff) {
s = new Sound(this.loud);
s.attachSound(m);
s.start();
}
}
function playSound(m) {
if (!_root.sfxoff) {
s = new Sound(this.sfx);
s.attachSound(m);
s.setVolume(sfnoise);
s.start();
}
}
function runMusic(m) {
stopAllSounds();
bgmusic.trak = new Sound(this.bgmusic);
bgmusic.trak.attachSound(m);
this.bgmusic.trak.setVolume(bgnoise);
bgmusic.trak.start(0, 999);
if (_root.museoff) {
bgmusic.trak.setVolume(0);
}
}
function freshSave() {
_root.so.data.datime = _root.datime;
_root.so.data.xp = _root.xp;
_root.so.data.fairyaccomplished = _root.fairyaccomplished;
_root.so.data.numdeaths = _root.numdeaths;
_root.so.data.keycount = _root.keycount;
_root.so.data.woodcount = _root.woodcount;
_root.so.data.deliveredwood = _root.deliveredwood;
_root.so.data.gotfairy = _root.gotfairy;
_root.so.data.gotboots = _root.gotboots;
_root.so.data.gotkey = _root.gotkey;
_root.so.data.dooropen = _root.dooropen;
_root.so.data.gotaxe = _root.gotaxe;
_root.so.data.nextpointer = _root.nextpointer;
_root.so.data.curarmor = _root.curarmor;
_root.so.data.curmag = _root.curmag;
_root.so.data.cursword = _root.cursword;
_root.so.data.treechops = new Array();
_root.so.data.spells = new Array();
_root.so.data.dungeondoors = new Array();
_root.so.data.dungeonkeys = new Array();
_root.so.data.gems = new Array();
_root.so.data.enarray = new Array();
_root.so.data.spawns = new Array();
var _local2 = 0;
while (_local2 < _root.treechops.length) {
_root.so.data.treechops[_local2] = _root.treechops[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < _root.spells.length) {
_root.so.data.spells[_local2] = _root.spells[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < _root.dungeondoors.length) {
_root.so.data.dungeondoors[_local2] = _root.dungeondoors[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < _root.dungeonkeys.length) {
_root.so.data.dungeonkeys[_local2] = _root.dungeonkeys[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < _root.gems.length) {
_root.so.data.gems[_local2] = _root.gems[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < _root.enarray.length) {
_root.so.data.enarray[_local2] = _root.enarray[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < _root.spawns.length) {
_root.so.data.spawns[_local2] = _root.spawns[_local2];
_local2++;
}
_root.so.flush();
}
function addSpawn() {
var _local1 = new Array("", "", false);
spawns.push(_local1);
}
function colorMe(who) {
var _local2 = new Color(who.fill);
var _local1 = new Color(who.stroke);
_local2.setRGB(armorarray[curarmor]);
_local1.setRGB(armorstrokearray[curarmor]);
}
function getShot() {
btm.dispose();
btm = new flash.display.BitmapData(640, 480, true, 16777215);
_root.psign.attachBitmap(btm, 0);
o = _root;
var _local2 = new flash.geom.Matrix();
_local2.tx = 0;
_local2.ty = 0;
_local2.a = 1;
alf = 1;
var _local3 = new flash.geom.ColorTransform(1, 1, 1, alf, 0, 0, 0, 0);
btm.draw(o, _local2, _local3);
psign.filters = [];
psign.filters = new Array(filter);
}
function chkPause() {
if (!Key.isDown(P)) {
pup = true;
}
if (Key.isDown(P) && (pup)) {
pup = false;
if (game._x != undefined) {
if (!platpause) {
pauseIt();
platpause = true;
} else {
platpause = false;
unPause();
}
}
if (mappy._x != undefined) {
if (!pausy) {
pauseIt();
pausy = true;
} else {
unPause();
pausy = false;
}
}
}
}
function pauseIt() {
pguts._visible = true;
pguts.updateMe();
playSound("pausesound");
setNoise(0);
getShot();
game.boss.guts.guts2.stop();
game.boss.guts.stop();
game.boss.guts.head.guts.stop();
var _local1 = 0;
while (_local1 < baddies.length) {
var _local2 = baddies[_local1];
if (_local2.troll) {
_local2.guts.stop();
}
_local1++;
}
}
function unPause() {
playSound("pausesound");
pguts._visible = false;
if (!game.boss.guts.lastframe) {
game.boss.guts.play();
}
if (!game.boss.guts.head.guts.lastframe) {
game.boss.guts.head.guts.play();
}
var _local1 = 0;
while (_local1 < baddies.length) {
var _local2 = baddies[_local1];
if (_local2.troll) {
_local2.guts.play();
}
_local1++;
}
game.boss.guts.guts2.play();
btm.dispose();
psign.filters = [];
setNoise(bgnoise);
}
function addEnem() {
var _local1 = new Array();
var _local2 = random(3);
_local1.link = "map_enemy" + _local2;
_local1.x = random(900) - 450;
_local1.y = random(900) - 450;
_local1.typ = _local2;
enarray.push(_local1);
}
function getNextThing() {
if (nextpointer == 0) {
this.nextxp = armorprogression[curarmor];
if (_root.armorprogression[_root.curarmor] == 99999) {
_root.nextpointer = 1;
this.nextxp = magicprogression[curmag];
if (_root.magicprogression[_root.curmag] == 99999) {
_root.nextpointer = 2;
this.nextxp = attackprogression[cursword];
}
}
}
if (nextpointer == 1) {
this.nextxp = magicprogression[curmag];
if (_root.magicprogression[_root.curmag] == 99999) {
_root.nextpointer = 2;
this.nextxp = attackprogression[cursword];
if (_root.attackprogression[cursword] == 99999) {
_root.nextpointer = 0;
this.nextxp = armorprogression[curarmor];
}
}
}
if (nextpointer == 2) {
this.nextxp = attackprogression[cursword];
if (_root.attackprogression[cursword] == 99999) {
_root.nextpointer = 0;
this.nextxp = armorprogression[curarmor];
if (_root.armorprogression[_root.curarmor] == 99999) {
_root.nextpointer = 1;
this.nextxp = magicprogression[curmag];
}
}
}
if (((magicprogression[curmag] == 99999) && (armorprogression[curarmor] == 99999)) && (attackprogression[cursword] == 99999)) {
if (this.nextxp != "MAX") {
_root.runMedal("Grinder");
}
this.nextxp = "MAX";
}
}
function runFade() {
this.attachMovie("fader", "fader", 99999);
who = _root.mappy.dude;
goalx = 320 - who._x;
goaly = 240 - who._y;
distx = goalx - _root.mappy._x;
disty = goaly - _root.mappy._y;
_root.mappy._x = _root.mappy._x + (distx / 1);
_root.mappy._y = _root.mappy._y + (disty / 1);
}
function runTran() {
fader.gotoAndPlay(1);
pausy = true;
who = _root.mappy.dude;
goalx = 320 - who._x;
goaly = 240 - who._y;
distx = goalx - _root.mappy._x;
disty = goaly - _root.mappy._y;
_root.mappy._x = _root.mappy._x + (distx / 1);
_root.mappy._y = _root.mappy._y + (disty / 1);
}
function fadedIn() {
fader.unloadMovie();
fader.removeMovieClip();
pausy = false;
}
function startPlat(terr, lev, hitthing) {
if (this._currentframe == 5) {
if (lev < 500) {
if (lev < 200) {
this.platlev = (("platlev" + terr) + "_") + lev;
_root.hitloc = new Array(hitthing._x, hitthing._y);
this.gotoAndStop("plat");
} else {
_root.pausy = true;
hudd.mapfade.gotoAndPlay(2);
dest = hitthing.typ;
mappy.dude.guts.gotoAndStop("rest_" + mappy.dude.dir);
}
} else {
this.platlev = (("platlev" + terr) + "_") + lev;
_root.hitloc = new Array(1620, -750);
this.gotoAndStop("plat");
}
}
}
stop();
_root._quality = _root.qualset;
bgnoise = 40;
sfnoise = 40;
this.loud = this.createEmptyMovieClip("loud", 4885122);
this.bgmusic = this.createEmptyMovieClip("bgmusic", 4885120);
this.sfx = this.createEmptyMovieClip("sfx", 4885121);
this.U = 38;
this.R = 39;
this.L = 37;
this.D = 40;
this.atk = 65;
delete game.onEnterFrame;
delete this.onEnterFrame;
game.unloadMovie();
game.removeMovieClip();
who = _root.mappy.dude;
goalx = 320 - who._x;
goaly = 240 - who._y;
distx = goalx - _root.mappy._x;
disty = goaly - _root.mappy._y;
_root.mappy._x = _root.mappy._x + (distx / 1);
_root.mappy._y = _root.mappy._y + (disty / 1);
this.attachMovie("pausesign", "psign", 9991111);
pguts = this.attachMovie("pausesign_guts", "pguts", 9991112);
pguts._visible = false;
this.P = 80;
var matrix = new Array();
matrix = matrix.concat([0.308600038290024, 0.609399974346161, 0.0820000022649765, 0, 0]);
matrix = matrix.concat([0.308600008487701, 0.609399974346161, 0.0820000022649765, 0, 0]);
matrix = matrix.concat([0.308600008487701, 0.609399974346161, 0.0820000246167183, 0, 0]);
matrix = matrix.concat([0, 0, 0, 1, 0]);
var filter = (new flash.filters.ColorMatrixFilter(matrix));
if (!inited) {
inited = true;
_root.rightbridge = true;
_root.gemtranny = -1;
mapp = new Array(320, 240);
this.maxhp = 100;
this.curhp = this.maxhp;
this.maxmag = 100;
this.magamt = this.maxmag;
this.xp = 0;
this.datime = 0;
armorprogression = new Array(25, 50, 100, 180, 280, 400, 550, 800, 99999);
magicprogression = new Array(45, 90, 150, 250, 380, 530, 750, 950, 99999);
attackprogression = new Array(120, 185, 270, 450, 650, 1100, 1500, 1950, 99999);
powarray = new Array(1, 1.5, 4, 8, 13, 20, 35, 45, 65);
magpowarray = new Array(10, 20, 30, 45, 65, 80, 120, 150, 200);
usemagarray = new Array(1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2);
armstrength = new Array(1, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1);
fairyaccomplished = false;
indungeon = false;
pastdungeon = false;
keycount = 0;
woodcount = 0;
deliveredwood = false;
gotfairy = false;
gotaxe = false;
numdeaths = 0;
gotboots = false;
gotkey = false;
dooropen = false;
nextpointer = 0;
curarmor = 0;
curmag = 0;
cursword = 0;
_root.nospeed = false;
treechops = new Array();
spells = new Array(false, false, false, false, true);
dungeondoors = new Array(false, false, false);
dungeonkeys = new Array(false, false, false, false);
gems = new Array(false, false, false);
getNextThing();
curcat = 1;
enarray = new Array();
enarray[0] = new Array();
enarray[0].link = "boss0";
enarray[0].x = 1200;
enarray[0].y = 1020;
enarray[0].typ = 99;
enarray[1] = new Array();
enarray[1].link = "boss1";
enarray[1].x = 15;
enarray[1].y = -1525;
enarray[1].typ = 98;
enarray[2] = new Array();
enarray[2].link = "wizard0";
enarray[2].x = 500;
enarray[2].y = 300;
enarray[2].typ = 199;
enarray[3] = new Array();
enarray[3].link = "wizard1";
enarray[3].x = 7;
enarray[3].y = -1805;
enarray[3].typ = 198;
enarray[4] = new Array();
enarray[4].link = "wizard2";
enarray[4].x = 535;
enarray[4].y = -960;
enarray[4].typ = 197;
enarray[5] = new Array();
enarray[5].link = "dungeon0";
enarray[5].x = -1440;
enarray[5].y = 375;
enarray[5].typ = 200;
enarray[6] = new Array();
enarray[6].link = "wizard4";
enarray[6].x = 130;
enarray[6].y = 290;
enarray[6].typ = 194;
enarray[7] = new Array();
enarray[7].link = "boss2";
enarray[7].x = -1440;
enarray[7].y = -295;
enarray[7].typ = 97;
spawns = new Array();
if (_root.so.data.numdeaths == undefined) {
var i = 0;
while (i < 7) {
addEnem();
i++;
}
var i = 0;
while (i < 24) {
addSpawn();
i++;
}
_root.freshSave();
} else {
var test = isNaN(so.data.xp);
if ((so.data.xp == undefined) || (test)) {
so.data.xp = 0;
}
so.data.datime = 9999999 /* 0x98967F */;
_root.nospeed = true;
_root.datime = so.data.datime;
_root.xp = so.data.xp;
fairyaccomplished = so.data.fairyaccomplished;
keycount = so.data.keycount;
woodcount = so.data.woodcount;
deliveredwood = so.data.deliveredwood;
gotfairy = so.data.gotfairy;
gotaxe = so.data.gotaxe;
gotboots = so.data.gotboots;
gotkey = so.data.gotkey;
dooropen = so.data.dooropen;
nextpointer = so.data.nextpointer;
curarmor = so.data.curarmor;
curmag = so.data.curmag;
cursword = so.data.cursword;
numdeaths = so.data.numdeaths;
dungeondoors = new Array();
dungeonkeys = new Array();
gems = new Array();
treechops = new Array();
spells = new Array();
enarray = new Array();
spawns = new Array();
var i = 0;
while (i < _root.so.data.spawns.length) {
_root.spawns[i] = _root.so.data.spawns[i];
i++;
}
var i = 0;
while (i < _root.so.data.enarray.length) {
_root.enarray[i] = _root.so.data.enarray[i];
i++;
}
var i = 0;
while (i < _root.so.data.treechops.length) {
_root.treechops[i] = _root.so.data.treechops[i];
i++;
}
var i = 0;
while (i < _root.so.data.spells.length) {
_root.spells[i] = _root.so.data.spells[i];
i++;
}
var i = 0;
while (i < _root.so.data.dungeondoors.length) {
_root.dungeondoors[i] = _root.so.data.dungeondoors[i];
i++;
}
var i = 0;
while (i < _root.so.data.dungeonkeys.length) {
_root.dungeonkeys[i] = _root.so.data.dungeonkeys[i];
i++;
}
var i = 0;
while (i < _root.so.data.gems.length) {
_root.gems[i] = _root.so.data.gems[i];
i++;
}
getNextThing();
}
var saver = true;
var i = 0;
while (i < _root.dungeondoors.length) {
if (!_root.dungeondoors[i]) {
saver = false;
}
i++;
}
if (saver) {
mapp = new Array(1620, -600);
mappy.dude._x = mapp[0];
mappy.dude._y = mapp[1];
mappy.gotoAndStop(2);
}
}
msgbox.unloadMovie();
msgbox.removeMovieClip();
hud.unloadMovie();
hud.removeMovieClip();
mappy.dude._x = mapp[0];
mappy.dude._y = mapp[1];
pausy = true;
runFade();
var numenems = 0;
var i = 0;
while (i < enarray.length) {
if (!enarray[i].dead) {
if (enarray[i].typ <= 10) {
numenems++;
}
}
i++;
}
if (numenems < 7) {
addEnem();
}
Frame 6
function runEnd() {
gotoAndStop ("end");
}
function addFireSpurt(who) {
spurts.push(who);
who.cv = 0;
who.maxcv = 30;
}
function runSpurts() {
var _local2 = 0;
while (_local2 < spurts.length) {
var _local1 = spurts[_local2];
if (!_local1.shooting) {
_local1.cv++;
if (_local1.cv >= _local1.maxcv) {
_local1.cv = 0;
_local1.shooting = true;
_local1.gotoAndPlay("warn");
}
}
_local2++;
}
}
function shootSpurt(who) {
who.guts.gotoAndStop("spurt");
}
function endSpurt(who) {
who.guts.gotoAndStop("norm");
who.shooting = false;
}
function endLevelup() {
_root.setNoise(_root.bgnoise);
this.attachMovie("plat_hud", "hud", 983);
updateHUD();
hud._visible = true;
if ((!game.bossbattle) || (game.boss.dead)) {
hud.bosslife._visible = false;
}
platpause = false;
flashIt();
if (!game.boss.guts.guts2.lastframe) {
game.boss.guts.guts2.play();
}
levelup.removeMovieClip();
levelup.unloadMovie();
_root.freshSave();
}
function runUp() {
if ((!_root.gameending) && (nextxp != "MAX")) {
flashIt();
hud._visible = false;
platpause = true;
game.boss.guts.guts2.stop();
this.attachMovie("levelup", "levelup", 999989);
}
}
function addxp(num, full) {
if (nextxp != "MAX") {
if (!full) {
xp = xp + Math.round(num / 10);
} else {
xp = xp + num;
}
hud.showxp = (xp + "/") + nextxp;
if (xp >= nextxp) {
runUp();
}
} else {
hud.showxp = "MAXED!";
}
}
function updateHUD(hit, use) {
showSword(game.dude.guts.sword);
if (((!game.bossbattle) || (game.boss.dead)) || ((game.boss.typ == 97) && (game.boss.shielded))) {
hud.bosslife._visible = false;
} else {
hud.bosslife.nam.text = game.boss.nam;
var _local2 = game.boss;
hud.bosslife.bar._xscale = (_local2.hp / _local2.maxhp) * 100;
if (hud.bosslife.bar._xscale <= 0) {
hud.bosslife.bar._xscale = 0;
}
}
addxp(0);
if (curhp < 0) {
curhp = 0;
}
if (curhp > maxhp) {
curhp = maxhp;
}
hud.lifebar2._xscale = hud.lifebar._xscale;
hud.lifebar._xscale = (curhp / maxhp) * 100;
hud.lifebar2.goalsc = hud.lifebar._xscale;
hud.lifebar2.tim = 0;
if (hit) {
hud.lifebar2.onEnterFrame = function () {
this.tim++;
if (this.tim >= 1) {
if (this._xscale > this.goalsc) {
var _local2 = this.goalsc - this._xscale;
this._xscale = this._xscale + (_local2 / 5);
} else {
delete this.onEnterFrame;
}
}
};
} else {
hud.lifebar2._xscale = hud.lifebar._xscale;
}
hud.pointer._x = hud.magbar._x + (145.3 * usemagarray[curmag]);
if (magamt < 0) {
magamt = 0;
}
if (magamt > maxmag) {
magamt = maxmag;
}
hud.magbar2._xscale = hud.magbar._xscale;
hud.magbar._xscale = (magamt / maxmag) * 100;
hud.magbar2.goalsc = hud.magbar._xscale;
hud.magbar2.tim = 0;
if (use) {
hud.magbar2.onEnterFrame = function () {
this.tim++;
if (this.tim >= 1) {
if (this._xscale > this.goalsc) {
var _local2 = this.goalsc - this._xscale;
this._xscale = this._xscale + (_local2 / 5);
} else {
delete this.onEnterFrame;
}
}
};
} else {
hud.magbar2._xscale = hud.magbar._xscale;
}
}
function addEnem(who) {
if (baddies == undefined) {
baddies = new Array();
}
baddies.push(who);
who.xvel = 0;
who.hitcv = 0;
who.yvel = 0;
who.aicv = 0;
who.storedhits = 0;
who.origscale = who._xscale;
}
function flashIt() {
game.flasher._alpha = 100;
game.flasher.onEnterFrame = function () {
this._alpha = this._alpha - 25;
if (this._alpha <= 0) {
delete this.onEnterFrame;
}
};
}
function moveBads() {
var _local11 = 0;
while (_local11 < 3) {
var _local9 = game["dais" + _local11];
if (_local9.hit) {
_local9.hitcv++;
if (_local9.hitcv >= 5) {
_local9.hitcv = 0;
_local9.hit = false;
}
}
_local11++;
}
_local11 = 0;
while (_local11 < baddies.length) {
b = baddies[_local11];
if ((b._x < -2500) || (b._x > 2500)) {
removeBad(b);
}
if (!b.groundimmune) {
b.xvel = b.xvel * game.fric;
b.yvel = b.yvel + game.grav;
}
b._x = b._x + b.xvel;
b._y = b._y + b.yvel;
b.virtx = b._x + game._x;
b.virty = b._y + game._y;
if (((!b.spearing) && (!b.boss)) && (!b.independent)) {
if (game.dude._x > b._x) {
b._xscale = -b.origscale;
} else {
b._xscale = b.origscale;
}
}
if ((((!b.dead) && (b.hp > 0)) && (!b.groundimmune)) || (b.boss && (!b.groundimmune))) {
while (game.bg.hitTest(b.virtx, b.virty, true)) {
b.onground = true;
b._y = b._y - 1;
b.virty = b.virty - 1;
b.yvel = 0;
b.numhits = 0;
}
}
dudeHit(b, b.guts.hitarea);
if (b.typ == 0) {
if (!game.dude.dead) {
if (b.hit) {
b.hitcv++;
b.guts.gotoAndStop("hit");
if (b.hitcv >= 5) {
b.hit = false;
b.guts.gotoAndPlay("rest");
}
}
b.aicv++;
if (b.aicv >= 25) {
b.dec = random(3);
if ((b.dec == 0) && (b.onground)) {
if (game.dude._x < b._x) {
b.xvel = -25;
} else {
b.xvel = 25;
}
b.yvel = -20;
b.onground = false;
}
b.aicv = random(20);
}
}
}
if (b.typ == 1) {
if (!game.dude.dead) {
if (b.hit) {
b.hitcv++;
b.guts.gotoAndStop("hit");
if (b.hitcv >= 5) {
b.hit = false;
b.guts.gotoAndPlay("rest");
}
b.groundimmune = false;
}
if (b.onground) {
aicv++;
if (aicv >= 15) {
aicv = 0;
if (game.dude._x < b._x) {
b.xvel = -35;
} else {
b.xvel = 35;
}
b.yvel = -30 - random(15);
b.onground = false;
}
}
}
}
if (b.typ == 98) {
b.xvel = 0;
b.yvel = 0;
if (!game.dude.dead) {
if (!game.boss.dead) {
if (game.dude._x < b._x) {
b._xscale = -100;
} else {
b._xscale = 100;
}
if (b.upp) {
b.aicv++;
if (b.aicv >= 15) {
b.upp = false;
b.dec = 1;
b.aicv = 0;
}
}
if (b.dec == 1) {
b.guts.head.gotoAndStop("fire");
}
if (b.dec == 3) {
b.aicv++;
if (b.aicv >= 5) {
game.boss.guts.gotoAndPlay("down1");
game.boss.head.gotoAndStop("rest");
b.dec = 0;
}
}
if (b.dec == 2) {
b.aicv++;
if (b.aicv >= 50) {
if (b._x == 110) {
b._x = 850;
} else {
b._x = 110;
}
b.aicv = 0;
b.dec = 0;
b.guts.gotoAndPlay("up1");
b.guts.head.gotoAndStop("rest");
}
}
if (b.hit) {
b.hit = false;
b.gotoAndPlay("hit");
}
} else if (!b.dead) {
_root.game.boss.ball0._visible = false;
_root.game.boss.ball1._visible = false;
_root.game.boss.ball2._visible = false;
b.dead = true;
b.guts.gotoAndStop("die");
}
}
}
if (b.typ == 97) {
if (!game.dude.dead) {
if (b.form2) {
b.shielded = false;
if (b._x < (game.lef - 100)) {
b._x = game.lef - 100;
}
if (b._x > (game.rig - 100)) {
b._x = game.rig - 100;
}
}
if (!game.boss.dead) {
if (b.shielded) {
var _local13 = true;
if (((!game.dais0.dead) || (!game.dais1.dead)) || (!game.dais2.dead)) {
_local13 = false;
}
if (_local13) {
b.shielded = false;
hud.bosslife._visible = true;
updateHUD();
b.speed = 10;
}
}
if (b.hit) {
if (b.hitcv == 0) {
if (!b.form2) {
b.gotoAndPlay("hit");
b.guts.hitarea.gotoAndPlay("hit");
} else {
b.guts.hitarea.gotoAndPlay("hit");
}
}
b.hitcv++;
if (b.hitcv >= 5) {
b.hit = false;
b.hitcv = 0;
}
}
if (!b.form2) {
if (b.shielded) {
if (b.dir == -1) {
b._x = b._x - b.speed;
} else {
b._x = b._x + b.speed;
}
if (b._x < -300) {
b.dir = 1;
}
if (b._x > 850) {
b.dir = -1;
}
b.fireballcv++;
if (b.fireballcv >= 5) {
b.guts.mouth.gotoAndStop("open");
if (!b.mouthopen) {
playSound("fball1");
b.mouthopen = true;
dragonBall();
}
if (b.fireballcv >= 10) {
b.mouthopen = false;
b.guts.mouth.gotoAndStop(1);
b.fireballcv = 0;
}
}
} else {
if (b.dir == -1) {
b._x = b._x - b.speed;
} else {
b._x = b._x + b.speed;
}
if (b._x < -245) {
b.dir = 1;
}
if (b._x > 850) {
b.dir = -1;
}
if (b.ydir == -1) {
b._y = b._y - b.speed;
} else {
b._y = b._y + b.speed;
}
if (b._y < -800) {
b.ydir = 1;
}
if (b._y > 150) {
b.ydir = -1;
}
b.fireballcv++;
if (b.fireballcv >= 15) {
b.guts.mouth.gotoAndStop("open");
if (!b.mouthopen) {
playSound("fball1");
b.mouthopen = true;
dragonBall();
}
if (b.fireballcv >= 20) {
b.mouthopen = false;
b.guts.mouth.gotoAndStop(1);
b.fireballcv = 0;
}
}
}
}
}
}
}
if (b.typ == 502) {
if (!game.dude.dead) {
if (!game.boss.dead) {
if (b.hit) {
if (b.hitcv == 0) {
b.gotoAndPlay("hit");
}
b.hitcv++;
if (b.hitcv >= 5) {
b.hit = false;
b.hitcv = 0;
}
}
if (b.dir == -1) {
b.goal = -300;
} else {
b.goal = 1250;
}
var _local18 = Math.abs(game.dude._x - b._x);
var _local14 = Math.abs(b.goal - b._x);
if (_local14 < 50) {
b.dir = b.dir * -1;
}
if (b.goal < b._x) {
b._x = b._x - 5;
b._xscale = 100;
} else {
b._x = b._x + 5;
b._xscale = -100;
}
if (_local18 > 180) {
if (!b.walking) {
b.walking = true;
b.attacking = false;
b.guts.gotoAndPlay("walk");
}
} else {
b.walking = false;
if (!b.attacking) {
b.attacking = true;
b.guts.gotoAndPlay("atk0");
}
}
var _local7 = game.fish0;
var _local10 = game.fish1;
_local7.cv++;
if (_local7.cv >= 50) {
rocks = new Array();
_local7.dir = _local7.dir * -1;
_local10.dir = _local10.dir * -1;
_local7.cv = 0;
var _local5 = game.attachMovie("rock", "rock" + effcv, effcv + 55441);
effcv++;
_local5._x = _local7._x;
_local5._y = _local7._y;
var _local12 = random(2);
if (_local12 == 0) {
_local12 = -1;
}
_local5._xscale = _local5._xscale * _local12;
_local5.xvel = 7 * _local7.dir;
_local5.yvel = -10;
_local5._xscale = 70;
_local5._yscale = _local5._xscale;
rocks.push(_local5);
_local5 = game.attachMovie("rock", "rock" + effcv, effcv + 55441);
effcv++;
_local12 = random(2);
if (_local12 == 0) {
_local12 = -1;
}
_local5._xscale = _local5._xscale * _local12;
_local5._x = _local10._x;
_local5._y = _local10._y;
_local5.xvel = 7 * _local10.dir;
_local5.yvel = -10;
_local5._xscale = 70;
_local5._yscale = _local5._xscale;
rocks.push(_local5);
}
var _local6 = 0;
while (_local6 < rocks.length) {
var _local4 = rocks[_local6];
if (!_local4.smacked) {
_local4._x = _local4._x + _local4.xvel;
_local4._y = _local4._y + _local4.yvel;
_local4.yvel = _local4.yvel + (game.grav * 0.7);
if (!_local4.stuck) {
dudeHit(_local4, _local4);
if (game.bg.hitTest(_local4._x + game._x, _local4._y + game._y, true)) {
_local4.stuck = true;
playSound("hit2");
_local4.gotoAndPlay("break");
_local4.yvel = 0;
while (game.bg.hitTest(_local4._x + game._x, _local4._y + game._y, true)) {
_local4._y--;
}
}
}
}
_local6++;
}
_local6 = 0;
while (_local6 < moverocks.length) {
var _local4 = moverocks[_local6];
_local4._x = _local4._x + (_local4.godir * 25);
if (_local4.hitTest(b.guts.zone) && (!_local4.stuck)) {
b.gotoAndPlay("hit");
playSound("hit" + random(3));
_local4.stuck = true;
_local4.gotoAndPlay("break");
var _local3 = b;
_local3.hp = _local3.hp - 150;
hud.bosslife.bar._xscale = (_local3.hp / _local3.maxhp) * 100;
if (hud.bosslife.bar._xscale <= 0) {
hud.bosslife.bar._xscale = 0;
}
if ((_local3.hp <= 0) && (!_local3.dead)) {
nogo = false;
if (_local3 == game.boss) {
nogo = true;
}
_local3.dead = true;
if (!_local3.boss) {
showXP(_local3, nogo);
addxp(_local3.xp, true);
_local3.guts.gotoAndPlay("die");
} else {
if (_root.gems[1] && _root.gems[0]) {
_root.runMedal("Worthy-chibi");
}
_local3.guts.gotoAndStop("die");
}
} else {
_local3.hit = true;
_local3.hitcv = 0;
}
}
_local6++;
}
}
}
}
if (b.typ == 501) {
if (!game.dude.dead) {
if (!game.boss.dead) {
if (b.hit) {
if (b.hitcv == 0) {
b.gotoAndPlay("hit");
}
b.hitcv++;
if (b.hitcv >= 5) {
b.hit = false;
b.hitcv = 0;
}
}
b.aicv++;
if (((b.aicv >= 100) && (!b.spinning)) && (!b.dizzy)) {
b.spinning = true;
b.guts.gotoAndPlay("atk0");
b.aicv = 0;
b.gox = 0;
}
if (b.dizzy) {
if (b.aicv >= 70) {
b.dizzy = false;
b.weak = false;
}
}
if (b.spinning) {
if (b.ready) {
if (b.dir == -1) {
b.gox = b.gox - 0.8;
} else {
b.gox = b.gox + 0.8;
}
b._x = b._x - b.gox;
if (b.aicv >= b.spindist) {
b.spindist = 56;
b.aicv = 0;
b.spinning = false;
if (b.dir == -1) {
b.dir = 1;
b._xscale = 100;
} else {
b.dir = -1;
b._xscale = -100;
}
b.ready = false;
b.guts.gotoAndPlay("dizzy");
b.dizzy = true;
}
}
}
}
}
}
if (b.typ == 500) {
if (!game.dude.dead) {
if (game.boss.dead) {
clearInterval(this.intr);
}
if (!game.boss.dead) {
if (b.gotaxe) {
if (b._x < game.dude._x) {
b._xscale = -100;
} else {
b._xscale = 100;
}
}
if (b.hit) {
if (b.hitcv == 0) {
b.gotoAndPlay("hit");
}
b.hitcv++;
if (b.hitcv >= 5) {
b.hit = false;
b.hitcv = 0;
}
}
if (b.gotaxe) {
var _local18 = Math.abs(b._x - game.dude._x);
if (!b.attacking) {
if (_local18 < 210) {
b.guts.gotoAndPlay("atk0");
b.attacking = true;
} else if (_local18 < 850) {
b.guts.gotoAndPlay("toss");
b.attacking = true;
}
}
} else if (b.comp.stuck) {
b.weak = true;
var _local18 = b.comp._x - b._x;
if (!b.comp.hitTest(b.guts.hitarea)) {
if (!b.walking) {
b.walking = true;
b.guts.gotoAndPlay("walk");
clearInterval(this.intr);
this.intr = setInterval(moveKnight, 30);
}
} else {
clearInterval(this.intr);
b.walking = false;
if (!b.gettingaxe) {
b.comp.unloadMovie();
b.comp.removeMovieClip();
b.gettingaxe = true;
b.guts.gotoAndPlay("retrieve");
}
}
}
}
}
}
if (b.typ == 99) {
if (!game.dude.dead) {
if (!game.boss.dead) {
if (b.hit) {
b.hit = false;
b.gotoAndPlay("hit");
}
if (b.mod == 0) {
b.aicv++;
if (b.aicv >= 50) {
b.mod = 1;
b.aicv = 0;
b.guts.gotoAndStop("charge");
}
}
if (b.mod == 2) {
b.guts.gotoAndStop("throw");
}
} else if (!b.dead) {
b.dead = true;
_root.game.boss.ball0._visible = false;
_root.game.boss.ball1._visible = false;
_root.game.boss.ball2._visible = false;
b.guts.gotoAndStop("die");
}
} else {
b.guts.gotoAndStop("rest");
}
}
if (b.typ == 3) {
if (!game.dude.dead) {
if (b.hit) {
b.hitcv++;
b.guts.gotoAndStop("hit");
if (b.hitcv >= 5) {
b.hit = false;
b.aicv = 0;
b.walking = false;
b.resting = true;
b.attacking = false;
b.guts.gotoAndPlay("rest");
}
} else if (b.onground) {
if (!b.attacking) {
b.aicv++;
if (b.aicv >= 100) {
b.dec = random(5);
b.aicv = random(25);
b.walking = false;
b.resting = false;
}
var _local8 = game.dude;
if (b.dec >= 2) {
if (b._x < _local8._x) {
b._x = b._x + 3;
b._xscale = -100;
if (!b.walking) {
b.guts.gotoAndPlay("walk");
b.resting = false;
b.walking = true;
}
}
if (b._x > _local8._x) {
b._x = b._x - 3;
b._xscale = 100;
if (!b.walking) {
b.guts.gotoAndPlay("walk");
b.resting = false;
b.walking = true;
}
}
}
if (b.dec == 1) {
if (!b.resting) {
b.resting = true;
b.walking = false;
b.guts.gotoAndPlay("rest");
}
}
if (b.dec == 0) {
if (b._x < _local8._x) {
b._x = b._x - 3;
b._xscale = 100;
if (!b.walking) {
b.guts.gotoAndPlay("walk");
b.resting = false;
b.walking = true;
}
}
if (b._x > _local8._x) {
b._x = b._x + 3;
b._xscale = -100;
if (!b.walking) {
b.guts.gotoAndPlay("walk");
b.resting = false;
b.walking = true;
}
}
}
var _local17 = Math.abs(b._x - _local8._x);
if (_local17 < 96) {
b.attacking = true;
b.resting = false;
b.walking = false;
if (b._x > _local8._x) {
b._xscale = 100;
} else {
b._xscale = -100;
}
b.guts.gotoAndPlay("atk");
}
}
}
}
}
if (b.typ == 5) {
if ((!game.dude.dead) && (!b.dead)) {
if (b.hit) {
if (!b.runninghit) {
b.runninghit = true;
b.gotoAndPlay("hit");
}
b.hitcv++;
if (b.hitcv >= 5) {
b.runninghit = false;
b.hit = false;
b.hitcv = 0;
b.guts.head.gotoAndStop(1);
} else {
b.guts.head.gotoAndPlay(2);
}
}
b.aicv++;
if (b.aicv >= 50) {
b.guts.gotoAndPlay("atk");
b.aicv = 0;
}
}
}
if (b.typ == 4) {
if (!game.dude.dead) {
if (b.hit) {
b.hitcv++;
if (b.hitcv >= 5) {
b.hit = false;
}
if (b._currentframe == 1) {
b.gotoAndPlay("hit");
}
}
b.web.clear();
b.web.lineStyle(8, 16777215);
b.web.moveTo(b.xhome, b.home - 300);
b.web.lineTo(b.xhome, b._y - 130);
b.aicv++;
var _local15 = b.home + 265;
if (b.aicv >= b.upamt) {
if ((b._y < _local15) && (!b.arrived)) {
b._y = b._y + 16;
b.wait = 0;
} else {
b.wait++;
b.arrived = true;
if (b.wait > b.downamt) {
if (b._y > b.home) {
b._y = b._y - 10;
} else {
b.arrived = false;
b.aicv = 0;
b.wait = 0;
}
}
}
}
}
}
if (b.typ == 2) {
if (!game.dude.dead) {
if (b.hit) {
b._yscale = -100;
b.guts._y = 2;
b.hitcv++;
b.guts.gotoAndStop("hit");
b.dewinged = true;
b.groundimmune = false;
if (b.hitcv >= 5) {
b.hit = false;
b.guts.gotoAndStop("rest");
}
}
if (!b.dewinged) {
if (!b.activated) {
var _local16 = Math.abs(b._x - game.dude._x);
if (_local16 < 320) {
b.activated = true;
b.vertdist = 100;
b.maxwait = random(5);
b.wait = 0;
}
}
if (b.activated) {
if (b.vertdist > 1) {
b.vertdist = Math.abs(game.dude._y - b._y);
b.vdist = game.dude._y - b._y;
b._y = b._y + (b.vdist / 4);
} else if (!b.spearing) {
if (b.wait < b.maxwait) {
b.wait++;
} else {
if (game.dude._x < b._x) {
b.dir = -1;
} else {
b.dir = 1;
}
b.spearing = true;
}
} else {
b.absvel = Math.abs(b.xvel);
if (b.absvel < 30) {
b.xvel = b.xvel + (1.5 * b.dir);
}
}
}
}
}
}
_local11++;
}
}
function reviveDemon() {
game.boss.groundimmune = false;
game.boss.independent = false;
game.boss.nomove = false;
game.boss.gotoAndPlay("hit");
game.boss.dead = false;
game.boss.hp = game.boss.maxhp;
game.boss.nam = "Demon Eye";
updateHUD();
}
function moveKnight() {
if ((!_root.platpause) && (!_root.freeze)) {
if (_root.game.boss._x > _root.game.boss.comp._x) {
_root.game.boss._x = _root.game.boss._x - 2;
} else {
_root.game.boss._x = _root.game.boss._x + 2;
}
}
}
function chkAwardGet(who) {
if ((who.hitTest(game.dude.guts.hitarea1) && (!_root.platpause)) && (!_root.freeze)) {
platpause = true;
flashIt();
playSound("gleam");
game.dude.nootheranims = true;
game.dude.guts.gotoAndPlay("itemget");
if (game.boss.typ == 99) {
game.dude.guts.item.attachMovie("boots2", "guts", 0);
_root.gotboots = true;
}
if (game.boss.typ == 98) {
game.dude.guts.item.attachMovie("key", "guts", 0);
_root.gotkey = true;
}
if (game.boss.typ == 500) {
var _local2 = game.dude.guts.item.attachMovie("gem0", "guts", 0);
_local2._x = -63;
_local2._y = -155;
_root.gems[0] = true;
_root.gemtranny = 0;
}
if (game.boss.typ == 501) {
var _local2 = game.dude.guts.item.attachMovie("gem1", "guts", 0);
_local2._x = -63;
_local2._y = -155;
_root.gems[1] = true;
_root.gemtranny = 1;
}
if (game.boss.typ == 502) {
var _local2 = game.dude.guts.item.attachMovie("gem2", "guts", 0);
_local2._x = -63;
_local2._y = -155;
_root.gems[2] = true;
_root.gemtranny = 2;
}
delete who.onEnterFrame;
game.boss._visible = false;
_root.freshSave();
}
}
function tossAxe(who) {
var _local3 = game.attachMovie("knight0_axe", "axe", 71100 + effcv);
who.gotaxe = false;
who.comp = _local3;
_local3._xscale = who._xscale;
_local3.comp = who;
effcv++;
_local3.dir = who._xscale / -100;
_local3._x = who._x + (50 * _local3.dir);
_local3._y = who._y - 80;
var _local5 = Math.abs(game.dude._x - who._x);
if (_local5 < 350) {
_local3.xvel = 16 * _local3.dir;
_local3.yvel = -27;
}
if ((_local5 >= 350) && (_local5 < 500)) {
_local3.xvel = 23 * _local3.dir;
_local3.yvel = -30;
}
if (_local5 >= 500) {
_local3.xvel = 25 * _local3.dir;
_local3.yvel = -37;
}
_local3.onEnterFrame = function () {
if ((!_root.platpause) && (!_root.freeze)) {
if (!this.stuck) {
if (!this.comp.dead) {
_root.dudeHit(this, this.hitarea, true);
_root.dudeHit(this, this.hitarea1, true);
_root.dudeHit(this, this.hitarea2, true);
}
this._x = this._x + this.xvel;
this._y = this._y + this.yvel;
this.yvel = this.yvel + _root.game.grav;
this._rotation = this._rotation + (25 * this.dir);
if (_root.game.bg.hitTest(this._x + game._x, (this._y + 70) + game._y, true) || (this._y > 380)) {
this.cv = 0;
playSound("hit2");
this._rotation = -200 * this.dir;
_root.screenShake(10);
this.stuck = true;
}
} else if (this.cv < 5) {
this.cv++;
_root.dudeHit(this, this.hitarea, true);
_root.dudeHit(this, this.hitarea1, true);
_root.dudeHit(this, this.hitarea2, true);
}
}
};
}
function retrieveAxe(who) {
who.weak = false;
who.comp = undefined;
who.gotaxe = true;
who.attacking = false;
who.walking = false;
who.gettingaxe = false;
}
function knight0AtkEnd(who) {
who.attacking = false;
}
function defeatBoss() {
noleave = true;
_root.game.boss.ball0._visible = false;
_root.game.boss.ball1._visible = false;
_root.game.boss.ball2._visible = false;
whichboss.dead = true;
showXP(game.boss, nogo);
addxp(game.boss.xp, true);
game.boss.guts.gotoAndStop("award");
whichboss = 0;
}
function dudeHit(b, box) {
if ((((box.hitTest(game.dude.guts.hitarea1) && (!b.dead)) && (!_root.platpause)) && (!_root.freeze)) && (!b.weak)) {
if (((!game.dude.hit) && (!game.dude.flashing)) && (!game.dude.magicking)) {
playLoudSound("gethit");
playLoudSound("ah");
flashIt();
var _local2 = b.dam * _root.armstrength[_root.curarmor];
if (game.dude.shielded) {
_local2 = _local2 * 0.6;
}
curhp = curhp - _local2;
updateHUD(true);
chunks(game.dude._x, game.dude._y - 50);
if (curhp <= 0) {
runDeath();
} else {
game.dude.hit = true;
}
game.dude.jumping = true;
if (b._x < game.dude._x) {
game.dude.xvel = 35;
game.dude._xscale = -1 * game.dude.sc;
} else {
game.dude.xvel = -35;
game.dude._xscale = 1 * game.dude.sc;
}
game.dude.yvel = -30;
}
}
}
function addBossBall() {
var tar = eval ("game.boss.ball" + game.boss.numballs);
tar._visible = true;
game.boss.numballs++;
if (game.boss.numballs == 3) {
game.boss.mod = 2;
game.boss.numballs = 0;
}
}
function grabBall() {
var tar = eval ("game.boss.ball" + game.boss.numballs);
tar._visible = false;
game.boss.numballs++;
}
function ballBomb() {
var _local3 = game.attachMovie("boss1_hairball", "hball" + effcv, effcv + 999981);
effcv++;
_local3._x = locs[ballpointer];
ballpointer++;
if (ballpointer >= locs.length) {
ballpointer = 0;
}
_local3._y = -1200;
_local3.yvel = 0;
if ((game.boss.numballs == 3) && (!game.boss.dead)) {
game.boss.numballs = 0;
game.boss.mod = 0;
game.boss.guts.gotoAndStop("rest");
}
_local3.onEnterFrame = function () {
if ((!_root.platpause) && (!freeze)) {
this.virtx = this._x + game._x;
this.virty = this._y + game._y;
this.yvel = this.yvel + (_root.game.grav * 0.2);
this._y = this._y + this.yvel;
if (_root.game.bg.hitTest(this.virtx, this.virty, true)) {
_root.makeBSplode(this._x, (this._y - this.yvel) - 10);
this.unloadMovie();
this.removeMovieClip();
}
}
};
}
function removeBad(who) {
who.unloadMovie();
who.removeMovieClip();
}
function runDeath() {
if (!game.dude.dead) {
_root.onbridge = false;
_root.rightbridge = false;
_root.playSound("death");
_root.playLoudSound("ohno");
_root.setNoise(0);
_root.numdeaths++;
_root.freshSave();
game.dude.shielded = false;
w = game.attachMovie("platweaponholder", "weap" + spcv, 7382 + spcv);
w._visible = false;
w._x = game.dude._x;
w._y = game.dude._y - 100;
w._xscale = game.dude.sc * 0.55;
w._yscale = w._xscale;
w._rotation = -90;
if (game.dude._xscale == (1 * game.dude.sc)) {
w.xvel = 5 + random(3);
} else {
w.xvel = -5 - random(3);
}
w.yvel = -20 - random(5);
w.createEmptyMovieClip("dum", 0);
w.dum.onEnterFrame = function () {
yib = this._parent;
if (!yib._visible) {
yib._visible = !yib._visible;
}
yib._x = yib._x + yib.xvel;
yib.xvel = yib.xvel * 0.9;
yib._y = yib._y + yib.yvel;
yib.yvel = yib.yvel + yib._parent.grav;
yib.ang = Math.atan2(yib.yvel, yib.xvel);
yib.degs = Math.round((yib.ang * 180) / Math.PI);
yib._rotation = yib.degs;
ground = yib._parent;
yib.virtx = ground._x + yib._x;
yib.virty = (ground._y + yib._y) + 6;
if (ground.bg.hitTest(yib.virtx, yib.virty, true)) {
chunks(yib._x, yib._y);
yib.swapDepths(ground.bg.getDepth() - 1);
delete this.onEnterFrame;
}
};
spcv++;
game.dude.dead = true;
game.dude.guts.gotoAndPlay("die");
}
}
function runCircle() {
c = this.attachMovie("circ", "circ", 9890);
d = this.attachMovie("circ", "circ2", 9889);
c._visible = false;
d._visible = false;
c._xscale = 200;
c._yscale = c._xscale;
c._x = random(640);
c._y = random(480);
c.comp = d;
c.tim = 0;
c.off = 4;
game.dude.virtx = game._x + game.dude._x;
game.dude.virty = game._y + game.dude._y;
c.onEnterFrame = function () {
this.tim++;
if (this.tim >= 30) {
if (!this._visible) {
this._visible = !this._visible;
this.comp._visible = this._visible;
}
if (this._parent.game.dude._xscale == (-1 * game.dude.sc)) {
this.correct = 10;
} else {
this.correct = -10;
}
this.goalx = this._parent.game.dude.virtx + this.correct;
this.goaly = this._parent.game.dude.virty - 10;
this.distx = this.goalx - this._x;
this.disty = this.goaly - this._y;
this._x = this._x + (this.distx / 10);
this._y = this._y + (this.disty / 10);
this.distsc = -this._xscale;
this.comp._xscale = this._xscale * 5;
this.comp._yscale = this.comp._xscale;
this.comp._x = this._x;
this.comp._y = this._y;
if ((this._xscale > 15) && (!this.goup)) {
this._xscale = this._xscale + (this.distsc / 10);
if (this._xscale <= 15) {
this.goup = true;
}
}
if (this.goup) {
if (!this.bounced) {
this._xscale = this._xscale + this.off;
this.off--;
if (this.off <= 1) {
this.bounced = true;
}
} else if (this._xscale > 5) {
this._xscale = this._xscale - 4;
}
}
this._yscale = this._xscale;
if (this._xscale <= 5) {
this.comp.unloadMovie();
this.comp.removeMovieClip();
var _local4 = true;
var _local3 = 0;
while (_local3 < _root.dungeondoors.length) {
if (!_root.dungeondoors[_local3]) {
_local4 = false;
}
_local3++;
}
if (!_local4) {
_root.indungeon = false;
}
this._parent.endPlat();
this.unloadMovie();
this.removeMovieClip();
delete this.onEnterFrame;
}
}
};
}
function endPlat() {
_root.pausy = true;
this.attachMovie("blackout", "blackout", 9891);
goBack();
}
function goBack() {
var saver = true;
var _local3 = 0;
while (_local3 < _root.dungeondoors.length) {
if (!_root.dungeondoors[_local3]) {
saver = false;
}
_local3++;
}
curhp = maxhp;
magamt = maxmag;
_root.rightbridge = true;
blackout.tim = 0;
blackout.onEnterFrame = function () {
this.tim++;
if (this.tim >= 20) {
var _local3 = false;
if (!saver) {
mapp = new Array(320, 240);
} else {
mapp = new Array(1620, -600);
if (!_root.pastdungeon) {
_local3 = true;
}
}
this._parent.runMap(_local3);
this.unloadMovie();
this.removeMovieClip();
}
};
hud.unloadMovie();
hud.removeMovieClip();
_root.freshSave();
}
function chunks(x, y) {
r = 0;
while (r < 10) {
p = game.attachMovie("spark2", "sp" + r, (25 + r) + spcv);
spcv++;
p._x = x;
p._y = y;
p.xvel = random(10) * ((game.dude._xscale / game.dude.sc) * 5);
p.yvel = random(30) * -1;
p.onEnterFrame = function () {
this._x = this._x + this.xvel;
this.xvel = this.xvel * 0.8;
this._y = this._y + this.yvel;
this.yvel = this.yvel + game.grav;
if (this._y > 500) {
delete this.onEnterFrame;
this.removeMovieClip();
this.unloadMovie();
}
};
r++;
}
}
function makeSpark(x, y, who) {
cl = game.attachMovie("clack", "clack" + spcv, 25 + spcv);
cl._x = game.dude._x + ((game.dude._xscale / game.dude.sc) * 70);
cl._y = game.dude._y - 50;
cl._xscale = (game.dude._xscale / game.dude.sc) * 100;
spcv++;
r = 0;
while (r < 6) {
p = game.attachMovie("spark", "sp" + r, (25 + r) + spcv);
spcv++;
p._x = x;
p._y = y;
p.xvel = random(20) * ((game.dude._xscale / game.dude.sc) * 10);
p.yvel = random(30) * -1;
p.onEnterFrame = function () {
this._x = this._x + this.xvel;
this.xvel = this.xvel * 0.8;
this._y = this._y + this.yvel;
this.yvel = this.yvel + game.grav;
if (this._y > 500) {
delete this.onEnterFrame;
this.removeMovieClip();
this.unloadMovie();
}
};
r++;
}
}
function chkSlash(box, magic, fireball, who) {
if (box.hitTest(game.wizard) && (!game.wizard.fairy)) {
playLoudSound("wahm");
if ((!fireball) && (!magic)) {
flashIt();
game.wizard.gotoAndPlay("shielded");
var _local12 = 5 * _root.armstrength[_root.curarmor];
if (game.dude.shielded) {
_local12 = _local12 * 0.6;
}
curhp = curhp - _local12;
updateHUD();
chunks(game.dude._x, game.dude._y - 50);
if (curhp <= 0) {
runDeath();
} else {
game.dude.hit = true;
}
game.dude.jumping = true;
if (game.wizard._x < game.dude._x) {
game.dude.xvel = 35;
game.dude._xscale = -1 * game.dude.sc;
} else {
game.dude.xvel = -35;
game.dude._xscale = game.dude.sc;
}
game.dude.yvel = -30;
} else {
game.wizard.gotoAndPlay("shielded");
if (fireball) {
removeDBall(who);
}
}
}
if (box.hitTest(game.wizardo)) {
if ((!fireball) && (!magic)) {
flashIt();
game.wizardo.gotoAndPlay("shielded");
var _local12 = 5 * _root.armstrength[_root.curarmor];
if (game.dude.shielded) {
_local12 = _local12 * 0.6;
}
curhp = curhp - _local12;
updateHUD();
chunks(game.dude._x, game.dude._y - 50);
if (curhp <= 0) {
runDeath();
} else {
game.dude.hit = true;
}
game.dude.jumping = true;
if (game.wizardo._x < game.dude._x) {
game.dude.xvel = 35;
game.dude._xscale = -1 * game.dude.sc;
} else {
game.dude.xvel = -35;
game.dude._xscale = 1 * game.dude.sc;
}
game.dude.yvel = -30;
} else {
game.wizardo.gotoAndPlay("shielded");
if (fireball) {
removeDBall(who);
}
}
}
var _local5 = 0;
while (_local5 < 3) {
var _local3 = game["dais" + _local5];
if (box.hitTest(_local3.guts.hitarea) && (!_local3.dead)) {
if (!_local3.hit) {
playSound("hit" + random(3));
_local3.hit = true;
_local3.gotoAndPlay("hit");
_local3.pointer++;
var _local10 = Math.floor(_local3.pointer / 2);
_local3.guts.gotoAndStop(_local10);
if (_local3.pointer >= _local3.maxx) {
_local3.dead = true;
}
if (_local3._x > game.dude._x) {
_local3.godir = 1;
} else {
_local3.godir = -1;
}
_local3.xp = 5;
showXP(_local3, true);
addxp(_local3.xp, true);
makeSpark(_local3._x - (_local3.godir * 20), _local3._y - 150, _local3);
}
}
_local5++;
}
_local5 = 0;
while (_local5 < rocks.length) {
var _local3 = rocks[_local5];
if ((box.hitTest(_local3) && (!_local3.stuck)) && (!fireball)) {
playSound("hit" + random(3));
_local3.smacked = true;
moverocks.push(_local3);
if (_local3._x > game.dude._x) {
_local3.godir = 1;
} else {
_local3.godir = -1;
}
makeSpark(_local3._x - (_local3.godir * 20), _local3._y - 50, _local3);
}
_local5++;
}
_local5 = 0;
while (_local5 < baddies.length) {
tin = baddies[_local5];
if ((box.hitTest(tin.guts.hitarea) && (!tin.hit)) && (!tin.dead)) {
if (tin.typ == 97) {
if (tin.shielded) {
playLoudSound("wahm");
tin.guts.shield._visible = true;
tin.guts.shield.onEnterFrame = function () {
if ((!_root.platpause) && (!_root.freeze)) {
this.cv++;
if (this.cv >= 10) {
this._alpha = this._alpha - 10;
if (this._alpha <= 0) {
this.cv = 0;
this._alpha = 100;
this._visible = false;
delete this.onEnterFrame;
}
}
}
};
}
}
if (!tin.shielded) {
playSound("hit" + random(3));
if (!magic) {
if (!fireball) {
tin.hp = tin.hp - powarray[cursword];
} else {
tin.hp = tin.hp - (0.5 * powarray[cursword]);
}
} else {
tin.hp = tin.hp - magpowarray[curmag];
}
if (tin.boss) {
hud.bosslife.bar._xscale = (tin.hp / tin.maxhp) * 100;
if (hud.bosslife.bar._xscale <= 0) {
hud.bosslife.bar._xscale = 0;
}
}
if (atktimer < 13) {
combos++;
if (combos >= 1) {
showcombo = combos + 1;
j = this.attachMovie("combonums", "combonums", 87390);
j.num.txt = showcombo;
}
} else {
combos = 0;
}
atktimer = 0;
if (!fireball) {
var _local6 = game.dude._xscale / game.dude.sc;
} else {
var _local9 = Math.abs(who._xscale);
var _local6 = who._xscale / _local9;
}
if (!tin.nomove) {
tin.yvel = -24;
tin.onground = false;
tin.xvel = 10 * _local6;
}
tin.numhits++;
if (!fireball) {
makeSpark(tin._x - (_local6 * 20), tin._y - 50, tin);
}
if (fireball) {
removeDBall(who);
}
if ((tin.hp <= 0) && (!tin.dead)) {
nogo = false;
if (tin == game.boss) {
nogo = true;
}
tin.dead = true;
_root.game.boss.ball0._visible = false;
_root.game.boss.ball1._visible = false;
_root.game.boss.ball2._visible = false;
if (!tin.boss) {
showXP(tin, nogo);
addxp(tin.xp, true);
tin.guts.gotoAndPlay("die");
} else if (tin.typ != 97) {
tin.guts.gotoAndStop("die");
if (tin.typ == 99) {
_root.runMedal("Furball-slayer");
}
if (tin.typ == 98) {
_root.runMedal("Dragon-slayer");
}
if (tin.typ == 500) {
if (_root.gems[1] && (_root.gems[2])) {
_root.runMedal("Worthy-chibi");
}
}
if (tin.typ == 501) {
if (_root.gems[0] && (_root.gems[2])) {
_root.runMedal("Worthy-chibi");
}
}
if (tin.typ == 502) {
if (_root.gems[1] && (_root.gems[0])) {
_root.runMedal("Worthy-chibi");
}
}
} else if (!tin.form2) {
tin.guts.hitarea.gotoAndPlay("hit");
tin.guts.gotoAndPlay("die");
tin.form2 = true;
} else {
_root.runMedal("Demon-slayer");
tin.guts.gotoAndPlay("die2");
}
} else {
tin.hit = true;
tin.hitcv = 0;
}
}
}
_local5++;
}
}
function dragonUp() {
if (!game.boss.dead) {
game.boss.upp = true;
}
}
function dragonBallStop() {
if (!game.boss.dead) {
game.boss.upp = false;
game.boss.dec = 3;
game.boss.aicv = 0;
}
}
function dragonDown() {
if (!game.boss.dead) {
game.boss.aicv = 0;
game.boss.dec = 2;
game.boss.down = true;
}
}
function dragonBall(who) {
var _local3 = game.attachMovie("fireball", "fireball" + effcv, 200119 + effcv);
effcv++;
if (game.boss.typ != 97) {
_local3._x = (((who._x + who._parent._x) + who._parent._parent._x) + who._parent._parent._parent._x) + who._parent._parent._parent._parent._x;
_local3._y = (((who._y + who._parent._y) + who._parent._parent._y) + who._parent._parent._parent._y) + who._parent._parent._parent._parent._y;
_local3.dir = 1;
if (game.boss._xscale == -100) {
var _local6 = _local3._x - game.boss._x;
_local3._x = game.boss._x - _local6;
_local3.dir = -1;
}
_local3.xvel = (random(5) + 1) * _local3.dir;
_local3.yvel = -(random(15) + 10);
_local3.dam = 30;
} else {
_local3._x = game.boss._x + 100;
_local3._y = game.boss._y + 165;
_local3.xvel = 0;
_local3.yvel = 1;
_local3.dam = 115;
}
var _local7 = Math.atan2(_local3.yvel, _local3.xvel);
var _local5 = Math.round((_local7 * 180) / Math.PI);
_local3._rotation = _local5;
_local3.onEnterFrame = function () {
if ((!platpause) && (!freeze)) {
dudeHit(this, this.hitarea);
var _local4 = Math.atan2(this.yvel, this.xvel);
var _local3 = Math.round((_local4 * 180) / Math.PI);
this._rotation = _local3;
this._x = this._x + this.xvel;
this.xvel = this.xvel * 0.99;
this.virtx = this._x + game._x;
this.virty = this._y + game._y;
if (this.dam == 30) {
this.yvel = this.yvel + (_root.game.grav * 0.2);
} else {
this.yvel = this.yvel + (_root.game.grav * 0.4);
}
this._y = this._y + this.yvel;
if (_root.game.bg.hitTest(this.virtx, this.virty, true)) {
_root.makeBSplode(this._x, (this._y - this.yvel) - 10);
this.unloadMovie();
this.removeMovieClip();
}
if ((this._y > 600) || (_root.game.boss.dead)) {
this.unloadMovie();
this.removeMovieClip();
}
}
};
}
function showXP(who, nogo) {
var _local4 = random(10);
if (nogo) {
_local4 = 8;
}
if ((_local4 <= 7) && (_local4 > 4)) {
hr = game.attachMovie("plat_heart", "heart" + spcv, 25 + spcv);
spcv++;
var _local5 = fg.getDepth();
if (_local5 < (25 + spcv)) {
fg.swapDepths(25 + spcv);
spcv++;
}
hr._x = who._x;
hr._y = who._y;
hr.onEnterFrame = function () {
if ((!_root.platpause) && (!freeze)) {
this._y = this._y - 2;
this.virty = this._parent._y + this._y;
if (this.hitTest(this._parent.dude.guts.hitarea1)) {
playLoudSound("exclaim" + random(10));
playLoudSound("get");
_root.curhp = _root.curhp + 15;
updateHUD();
this._parent.dude.gotoAndPlay("flash");
this._parent.dude.glow = true;
delete this.onEnterFrame;
this.unloadMovie();
this.removeMovieClip();
}
if (this.virty < 0) {
delete this.onEnterFrame;
this.unloadMovie();
this.removeMovieClip();
}
}
};
}
if (_local4 <= 4) {
mb = game.attachMovie("plat_magic", "magbot" + spcv, 25 + spcv);
mb._x = who._x;
mb._y = who._y;
mb.yvel = -10;
mb.tim = 0;
mb.onEnterFrame = function () {
this.tim++;
this._y = this._y + this.yvel;
this.yvel = this.yvel + game.grav;
this.virtx = game._x + this._x;
this.virty = game._y + this._y;
while (game.bg.hitTest(this.virtx, this.virty, true)) {
this._y--;
this.virty--;
this.yvel = 0;
}
if (this.hitTest(game.dude.guts.hitarea1) && (this.tim > 10)) {
playLoudSound("exclaim" + random(4));
playLoudSound("get");
_root.magamt = _root.magamt + 15;
_root.updateHUD();
_root.game.dude.gotoAndPlay("flash");
_root.game.dude.glow = true;
this.unloadMovie();
this.removeMovieClip();
delete this.onEnterFrame;
}
};
spcv++;
var _local5 = fg.getDepth();
if (_local5 < (25 + spcv)) {
fg.swapDepths(25 + spcv);
spcv++;
}
}
bl = game.attachMovie("points", "points" + spcv, 25 + spcv);
bl._x = who._x;
bl._y = who._y;
bl.timer = 0;
bl.msg = "XP: " + who.xp;
spcv++;
bl.onEnterFrame = function () {
this._y = this._y - 3;
this.timer++;
if (this.timer > 20) {
this._alpha = this._alpha - 10;
}
if (this.timer > 35) {
delete this.onEnterFrame;
this.unloadMovie();
this.removeMovieClip();
}
};
}
function runMap(godungeon) {
_root.freshSave();
if (((game.wizard != undefined) || (game.blacksmith != undefined)) || (game.boss.typ == 97)) {
mapp = new Array(hitloc[0], hitloc[1] + 100);
}
game.unloadMovie();
game.removeMovieClip();
gotoAndStop ("map");
if (_root.indungeon || (godungeon)) {
_root.mappy.gotoAndStop(2);
_root.pausy = true;
dest = hitthing.typ;
mappy.dude.guts.gotoAndStop("rest_" + mappy.dude.dir);
mappy.tranIt();
}
who = _root.mappy.dude;
goalx = 320 - who._x;
goaly = 240 - who._y;
distx = goalx - _root.mappy._x;
disty = goaly - _root.mappy._y;
_root.mappy._x = _root.mappy._x + (distx / 1);
_root.mappy._y = _root.mappy._y + (disty / 1);
}
function blacksmithGive() {
if (!_root.gotaxe) {
if (_root.gotfairy) {
playLoudSound("get");
showWords("I am 'GLITCH' the blacksmith. Thanks for rescuing my pixie pet, take this axe in exchange. Press 'A' on the map screen to use it. It's strong enough for trees, but won't hurt enemies.");
blacky = true;
_root.fairyaccomplished = true;
} else {
playLoudSound("get");
showWords("I had to flee the beasts in the middle of the night. I left my pet pixie behind. Return her to me and I'll give you my axe.");
}
} else {
playLoudSound("get");
showWords("The axe I gave you is perfect for cutting down trees, but won't hurt enemies. Press 'A' on the map to use it.");
}
}
function giveSpell(num, sec) {
autoexit = false;
if (num == 0) {
flashIt();
if (!spells[num]) {
spells[num] = true;
playLoudSound("spell");
showWords("The other wizards have gone into hiding...they asked me to give you this spell. May it rain pain upon your enemies. Press 'S' for your spell list. Find the other wizards for more spells!");
} else {
playLoudSound("spell");
showWords("You have my spell. Seek the other wizards' hiding places for more spells!");
}
magamt = maxmag;
updateHUD();
}
if (num == 1) {
if (!spells[num]) {
if (!sec) {
if (woodcount < 100) {
playLoudSound("get");
showWords("The beasts destroyed our house! We need 100 cords of wood to re-build. My grandpa would be so grateful for your help!");
autoexit = true;
} else if (!deliveredwood) {
playLoudSound("get");
showWords("Thank you so much for the wood. My grandpa wants to speak with you...");
deliveredwood = true;
game.wizard.guts.gotoAndStop("happy");
}
} else {
flashIt();
playLoudSound("spell");
showWords("May this spell shield you from enemy attacks.");
spells[num] = true;
magamt = maxmag;
updateHUD();
}
} else if (!sec) {
playLoudSound("get");
showWords("Come back to see grandpa again? Go on ahead!");
} else {
playLoudSound("spell");
flashIt();
showWords("You have my spell. Find the other wizards to gain their powers!");
magamt = maxmag;
updateHUD();
}
}
if (num == 2) {
curhp = maxhp;
updateHUD();
flashIt();
if (!spells[num]) {
spells[num] = true;
playLoudSound("spell");
showWords("You dissolved the spell concealing my house. You must be the hero legend foretold. Use this spell when your health is low.");
} else {
playLoudSound("spell");
showWords("You already have my spell. Use it to re-gain lost health!");
}
}
if (num == 3) {
flashIt();
magamt = maxmag;
updateHUD();
if (!spells[num]) {
spells[num] = true;
playLoudSound("spell");
showWords("You have discovered my secret dungeon lair. Use this spell to toggle fireball shooting. The spell costs no manna, but each fireball depletes manna based on your magic level. May your flaming sword protect your path!");
} else {
playLoudSound("spell");
showWords("I detect that you are already carrying my spell. Use it to shoot fireballs better than Italian plumbers!");
}
}
if (num == 4) {
if (!_root.gotboots) {
flashIt();
playLoudSound("spell");
showWords("My master, 'GLITCH,' the blacksmith, was chased away by the beasts! Free me and I'll lead you to him! Magic footwear will let you walk on water!");
} else if (!game.fairygo) {
game.fairygo = true;
platpause = false;
wizardgot = false;
}
}
_root.freshSave();
if (((_root.spells[0] && (_root.spells[1])) && (_root.spells[2])) && (_root.spells[3])) {
_root.runMedal("Chibi-mage");
}
}
function showWords(txt) {
hud.msg._visible = true;
hud.msg.guts.text = txt;
wordsup = true;
aup = false;
game.dude.aup = false;
game.dude.attacking = false;
game.dude.xvel = 0;
}
function chkContinue() {
if (!Key.isDown(atk)) {
aup = true;
}
if (aup && (Key.isDown(atk))) {
aup = false;
hud.msg._visible = false;
wordsup = false;
game.dude.aup = false;
if (!blacky) {
platpause = false;
game.dude.guts.gotoAndPlay("rest");
if (Key.isDown(L) || (Key.isDown(R))) {
if (!game.boss.dead) {
game.dude.guts.gotoAndPlay("walk");
}
}
game.blacksmith.guts.gotoAndStop("rest");
} else {
flashIt();
_root.playLoudSound("spell");
blacky = false;
game.dude.guts.gotoAndPlay("itemget");
game.dude.guts.item.attachMovie("axe", "guts", 0);
_root.gotaxe = true;
game.blacksmith.guts.gotoAndStop("retract");
}
if (autoexit) {
runMap();
}
}
}
function phys(who) {
if ((game.wizard._x != undefined) && (!wizardgot)) {
if (!game.fairygo) {
var _local5 = game.wizard._x - who._x;
var _local4 = game.wizard._y - who._y;
var _local6 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
if (_local6 < 160) {
wizardgot = true;
platpause = true;
who.guts.gotoAndStop("rest");
game.wizard.guts.gotoAndStop("cast");
}
} else if (game.wizard.guts.hitzone.hitTest(game.dude) && (!_root.gotfairy)) {
flashIt();
wizardgot = true;
platpause = true;
who.guts.gotoAndStop("rest");
game.wizard.guts.gotoAndStop("freed");
playLoudSound("spell");
showWords("Thank you ever so much! Follow me on the map to find my master!");
_root.gotfairy = true;
_root.freshSave();
}
}
if ((game.wizardo._x != undefined) && (!wizardogot)) {
var _local6 = Math.abs(game.wizardo._x - who._x);
if (_local6 < 150) {
wizardogot = true;
platpause = true;
who.guts.gotoAndStop("rest");
game.wizardo.guts.gotoAndStop("cast");
}
}
if ((game.blacksmith._x != undefined) && (!blacksmithgot)) {
var _local6 = Math.abs(game.blacksmith._x - who._x);
if (_local6 < 180) {
blacksmithgot = true;
platpause = true;
who.guts.gotoAndStop("rest");
if (!_root.gotaxe) {
game.blacksmith.guts.gotoAndStop("give");
} else {
blacksmithGive();
}
}
}
if (who.glow) {
h = 0;
while (h < 2) {
sp = game.attachMovie("spark", "sp" + spcv, 25 + spcv);
spcv++;
sp.xvel = game.dude.xvel;
sp._x = (game.dude._x + random(50)) - 25;
sp._y = game.dude._y - random(50);
sp.yvel = -3;
sp.onEnterFrame = function () {
this._x = this._x + this.xvel;
this.xvel = this.xvel * 0.9;
this._y = this._y + this.yvel;
this.yvel = this.yvel - 0.4;
this._xscale = this._xscale - 5;
this._yscale = this._xscale;
if (this._xscale <= 0) {
delete this.onEnterFrame;
this.unloadMovie();
this.removeMovieClip();
}
};
h++;
}
who.glowcv++;
if (who.glowcv >= 15) {
who.glowcv = 0;
who.glow = false;
}
}
atktimer++;
who.yvel = who.yvel + game.grav;
who.xvel = who.xvel * game.fric;
if (who.yvel > 25) {
who.yvel = 25;
}
who._y = who._y + who.yvel;
who._x = who._x + who.xvel;
who.virtx = who._x + game._x;
who.virty = who._y + game._y;
who.absxvel = Math.abs(who.xvel);
if (who.absxvel > 0) {
if ((who.virtx < 0) || (who.virtx > 640)) {
if (!noleave) {
if (_root.onbridge) {
_root.onbridge = false;
if (_root.rightbridge) {
if (who.virtx < 0) {
_root.rightbridge = false;
}
} else if (who.virtx > 640) {
_root.rightbridge = true;
}
if (_root.rightbridge) {
mapp[0] = 1100;
mapp[1] = 700;
} else {
mapp[0] = 850;
mapp[1] = 900;
}
}
pausy = true;
runMap();
} else {
_root.hud._visible = true;
_root.hud.reminder._visible = true;
_root.hud.reminder.cv = 0;
}
}
}
if (who._x < game.lef) {
who._x = game.lef;
}
if (who._x > game.rig) {
who._x = game.rig;
}
if (_root.hud.reminder._visible) {
_root.hud.reminder.cv++;
if (_root.hud.reminder.cv >= 100) {
_root.hud.reminder.cv = 0;
_root.hud.reminder._visible = false;
}
}
if (who.yvel > 0) {
while (game.bg.hitTest(who.virtx, who.virty, true)) {
who._y = who._y - 1;
who.virty = who.virty - 1;
who.yvel = 0;
if (who.jumping) {
if (who.dead) {
who.guts.gotoAndPlay("bounce");
runCircle();
who.xvel = 0;
}
who.jumping = false;
if (!who.attacking) {
who.anim = 3;
}
}
}
if (_root.gotboots) {
while (game.waterwalk.hitTest(who.virtx, who.virty, true)) {
who._y = who._y - 1;
who.virty = who.virty - 1;
who.yvel = 0;
if (who.jumping) {
if (who.dead) {
who.guts.gotoAndPlay("bounce");
runCircle();
who.xvel = 0;
}
who.jumping = false;
if (!who.attacking) {
who.anim = 3;
}
}
}
}
}
if (who.shielded) {
game.shield._x = who._x;
game.shield._y = who._y;
game.shield._xscale = who._xscale;
game.shield._yscale = who._yscale;
} else {
game.shield.unloadMovie();
game.shield.removeMovieClip();
}
}
function screenShake(amt) {
g = game.createEmptyMovieClip("shaker", 745);
g.rightt = true;
g.amt = amt;
g.onEnterFrame = function () {
if (this.rightt) {
this._parent.startoff = this.amt;
} else {
this._parent.startoff = -this.amt;
}
this.rightt = !this.rightt;
this.amt--;
if (this.amt == 0) {
this.startoff = 0;
delete this.onEnterFrame;
}
};
}
function centerOn(who) {
var _local2 = -1;
if (who._xscale == who.sc) {
_local2 = -1;
} else {
_local2 = 1;
}
game.goalx = (320 - who._x) + (100 * _local2);
game.fg._x = game._x * 0.7;
var _local4 = game.goalx - game._x;
game._x = game._x + ((_local4 / 8) + game.startoff);
game._y = 390 - who._y;
if (game._x > (-game.lef)) {
game._x = -game.lef;
}
if (game._x < ((-game.rig) + 640)) {
game._x = (-game.rig) + 640;
}
if (game._y < 0) {
game._y = 0;
}
game.farbg._x = -game._x;
game.farbg._y = -game._y;
game.flasher._x = -game._x;
game.flasher._y = -game._y;
if ((game.dude._y > 1000) && (!platended)) {
game.dude.dead = true;
_root.playLoudSound("ohno");
mapp = new Array(320, 240);
_root.onbridge = false;
_root.rightbridge = false;
platended = true;
numdeaths++;
endPlat();
}
}
function magAtk(who) {
var _local3 = maxmag * usemagarray[curmag];
if (_local3 <= magamt) {
magamt = magamt - _local3;
updateHUD(false, true);
who.magicking = true;
who.attacking = false;
flashIt();
goob = game.createEmptyMovieClip("goober", 32937);
goob.tim = 0;
goob.cv = 0;
goob.lim = 8;
goob.onEnterFrame = function () {
if ((!_root.platpause) && (!freeze)) {
this.tim++;
if ((this.tim > 8) && (this.tim < (10 + this.lim))) {
g = game.attachMovie("mball" + curmag, "ball" + this.cv, 88829 + this.cv);
this.cv++;
g._rotation = -90;
g._x = game.dude._x + ((game.dude._xscale / game.dude.sc) * -28);
g._y = game.dude._y - 100;
g._xscale = 50;
g._yscale = g._xscale;
g.xvel = random(80) - 40;
g.yvel = (random(5) + 5) * -5;
g.onEnterFrame = function () {
if ((!_root.platpause) && (!freeze)) {
this.xvel = this.xvel * 0.9;
this.yvel = this.yvel + this._parent.grav;
this._x = this._x + this.xvel;
if (this.yvel > 0) {
this.nexty = this._y + this.yvel;
while ((this._y < this.nexty) && (!this.hit)) {
this._y++;
this.virty++;
h = 0;
while (h < baddies.length) {
yin = baddies[h];
if (yin.hitTest(this.virtx, this.virty, true)) {
makeSplode(this._x, this._y);
this.hit = true;
this.removeMovieClip();
this.unloadMovie();
}
h++;
}
if (game.bg.hitTest(this.virtx, this.virty, true) || (this.virty > 480)) {
makeSplode(this._x, this._y);
this.hit = true;
this.removeMovieClip();
this.unloadMovie();
}
}
} else {
this._y = this._y + this.yvel;
}
}
this.ang = Math.atan2(this.yvel, this.xvel);
this.degs = Math.round((this.ang * 180) / Math.PI);
this._rotation = this.degs;
this.virtx = game._x + this._x;
this.virty = game._y + this._y;
};
}
if (this.tim >= (10 + this.lim)) {
delete this.onEnterFrame;
}
}
};
}
}
function magControls() {
magchooser = game.magchooser;
if (!Key.isDown(R)) {
rup = true;
}
if (Key.isDown(R) && (rup)) {
rup = false;
if (magchooser.rdy) {
magchooser.sel++;
if (magchooser.sel > (magchooser.nams.length - 1)) {
magchooser.sel = 0;
}
var _local2 = magchooser["c" + magchooser.sel];
magchooser.light._x = _local2._x;
magchooser.light._y = _local2._y;
if (spells[magchooser.sel]) {
magchooser.holder.msg.text = magchooser.nams[magchooser.sel];
} else {
magchooser.holder.msg.text = "NEED TO LEARN SPELL";
}
}
}
if (!Key.isDown(L)) {
lup = true;
}
if (Key.isDown(L) && (lup)) {
lup = false;
if (magchooser.rdy) {
magchooser.sel--;
if (magchooser.sel < 0) {
magchooser.sel = magchooser.nams.length - 1;
}
var _local2 = magchooser["c" + magchooser.sel];
magchooser.light._x = _local2._x;
magchooser.light._y = _local2._y;
if (spells[magchooser.sel]) {
magchooser.holder.msg.text = magchooser.nams[magchooser.sel];
} else {
magchooser.holder.msg.text = "NEED TO LEARN SPELL";
}
}
}
if (!Key.isDown(magbut)) {
game.dude.sup = true;
}
if (Key.isDown(magbut) && (game.dude.sup)) {
game.dude.sup = false;
exitMagThing();
}
if (!Key.isDown(atk)) {
aup = true;
}
if (Key.isDown(atk) && (aup)) {
aup = false;
game.dude.aup = false;
if (magchooser.rdy) {
cancelled = false;
if (magchooser.sel == 4) {
playLoudSound("nevermind");
var cancelled = true;
exitMagThing();
}
if (magchooser.sel == 3) {
if (_root.spells[3]) {
flashIt();
cancelled = true;
playLoudSound("fire");
playLoudSound("spell");
magFire(game.dude);
exitMagThing();
}
}
var _local3 = maxmag * usemagarray[curmag];
if ((_local3 <= magamt) && (spells[magchooser.sel])) {
if (magchooser.sel == 0) {
game.dude.anim = 8;
playLoudSound("attack");
magAtk(game.dude);
}
if (magchooser.sel == 2) {
game.dude.anim = 8;
playLoudSound("life");
magHeal(game.dude);
}
if (magchooser.sel == 1) {
game.dude.anim = 8;
playLoudSound("shield");
magShield(game.dude);
}
playLoudSound("spell");
exitMagThing();
} else if (!cancelled) {
playLoudSound("notenoughmagic");
}
}
}
}
function magHeal(who) {
flashIt();
var _local3 = maxmag * usemagarray[curmag];
magamt = magamt - _local3;
_root.curhp = _root.curhp + 35;
this._parent.dude.gotoAndPlay("flash");
this._parent.dude.glow = true;
updateHUD(false, true);
game.dude.aup = false;
}
function magFire(who) {
flashIt();
if (fireballson) {
var _local2 = 0;
while (_local2 < dfireballs.length) {
var _local3 = dfireballs[_local2];
_local3.unloadMovie();
_local3.removeMovieClip();
_local2++;
}
}
fireballson = !fireballson;
this._parent.dude.gotoAndPlay("flash");
this._parent.dude.glow = true;
updateHUD(false, true);
game.dude.aup = false;
}
function removeDBall(who) {
var _local1 = 0;
while (_local1 < dfireballs.length) {
var _local2 = dfireballs[_local1];
if (who == _local2) {
makeFireBallBurst(_local2._x, _local2._y);
dfireballs.splice(_local1, 1);
who.unloadMovie();
who.removeMovieClip();
}
_local1++;
}
}
function makeFireBallBurst(x, y) {
var _local1 = game.attachMovie("fireballburst", "fburst" + effcv, effcv + 7711);
effcv++;
_local1._x = x;
_local1._y = y;
_local1._xscale = 70;
_local1._yscale = _local1._xscale;
}
function moveDudeFireballs() {
var _local2 = 0;
while (_local2 < dfireballs.length) {
var _local1 = dfireballs[_local2];
_local1._x = _local1._x + _local1.xvel;
_local1.virtx = _local1._x + game._x;
_local1.virty = _local1._y + game._y;
chkSlash(_local1, false, true, _local1);
if ((_local1.virtx > 750) || (game.bg.hitTest(_local1.virtx, _local1.virty, true))) {
removeDBall(_local1);
}
_local2++;
}
}
function dudeFireball(who) {
var _local4 = 5 * usemagarray[curmag];
var _local5 = magamt - _local4;
if (_local5 > 0) {
playSound("fball0");
magamt = magamt - _local4;
updateHUD();
var _local1 = game.attachMovie("magfirewrap", "dball" + effcv, effcv + 778);
effcv++;
dfireballs.push(_local1);
var _local3 = who._xscale / who.sc;
_local1._x = who._x + (35 * _local3);
_local1._y = who._y - 25;
_local1._xscale = who.sc * 0.5;
_local1._yscale = _local1._xscale;
_local1._xscale = _local1._xscale * _local3;
_local1.xvel = 15 * _local3;
_local1.cacheAsBitmap = true;
_local1.guts.nam.text = "";
}
}
function magShield(who) {
flashIt();
var _local4 = maxmag * usemagarray[curmag];
magamt = magamt - _local4;
this._parent.dude.gotoAndPlay("flash");
this._parent.dude.glow = true;
var _local2 = this.game.attachMovie("shieldcover", "shield", 9911);
var _local3 = game.fg.getDepth();
if (_local3 <= 9911) {
game.fg.swapDepths(9912);
}
_local2._x = game.dude._x;
_local2._y = game.dude._y;
game.fg.swapDepths(9912);
_local2._xscale = game.dude._xscale;
_local2._yscale = game.dude._yscale;
game.dude.shielded = true;
updateHUD(false, true);
game.dude.aup = false;
}
function exitMagThing() {
var _local1 = 0;
while (_local1 < baddies.length) {
var _local2 = baddies[_local1];
if (_local2.troll) {
_local2.guts.play();
}
_local1++;
}
freeze = false;
var _local3 = game.dude;
_local3.xvel = 0;
_local3.attacking = false;
_local3.guts.gotoAndStop("rest");
if (Key.isDown(R) || (Key.isDown(L))) {
if (!game.boss.dead) {
_local3.guts.gotoAndPlay("walk");
}
}
game.magchooser.unloadMovie();
game.magchooser.removeMovieClip();
}
function runMagic(who) {
_root.playSound("gleam");
_root.playLoudSound("spelltime");
var _local2 = 0;
while (_local2 < baddies.length) {
var _local4 = baddies[_local2];
if (_local4.troll) {
_local4.guts.stop();
}
_local2++;
}
who.attacking = false;
freeze = true;
aup = true;
sup = true;
flashIt();
var _local3 = game.attachMovie("magchooser", "magchooser", 8872111);
_local3.rdy = false;
_local3._x = who._x;
_local3._y = who._y;
_local3.sel = 0;
_local3.ikes = new Array("magwrapping", "magshield", "maglife", "magfire", "magexit");
_local3.nams = new Array("MAGIC ATTACK", "MAGIC SHIELD", "RESTORE LIFE", "MAGIC FIREBALLS", "CANCEL & EXIT");
_local2 = 0;
while (_local2 < _local3.ikes.length) {
var _local6 = _local3["c" + _local2];
if (spells[_local2]) {
var _local5 = _local6.attachMovie(_local3.ikes[_local2], "guts", 0);
if (_local2 == 3) {
if (_root.fireballson) {
_local5.nam.text = "ON";
} else {
_local5.nam.text = "OFF";
}
}
} else {
_local6.attachMovie("magquestion", "guts", 0);
}
_local2++;
}
}
function makeSplode(x, y) {
playSound("splosion1");
spl = game.attachMovie("splode", "splosion" + spcv, 63726 + spcv);
spcv++;
spl._x = x;
spl._y = y;
spl.which = random(2);
if (spl.which == 0) {
spl._xscale = 100;
} else {
spl._xscale = -100;
}
}
function makeBSplode(x, y) {
playSound("splosion1");
spl = game.attachMovie("splode2", "splosion" + spcv, 63726 + spcv);
spcv++;
screenShake(10);
spl._x = x;
spl._y = y;
spl.which = random(2);
if (spl.which == 0) {
spl._xscale = 100;
} else {
spl._xscale = -100;
}
}
function endMagic(who) {
who.magicking = false;
if (!who.jumping) {
who.xvel = 0;
}
restAtk();
}
function controls(who) {
if (!who.dead) {
if ((!who.hit) && (!who.magicking)) {
if (Key.isDown(R)) {
if (!who.attacking) {
who.xvel = who.xvel + who.speed;
who._xscale = 1 * who.sc;
if ((!who.jumping) && (who.anim != 3)) {
who.anim = 1;
}
}
}
if (Key.isDown(L)) {
if (!who.attacking) {
who.xvel = who.xvel - who.speed;
who._xscale = -1 * who.sc;
if ((!who.jumping) && (who.anim != 3)) {
who.anim = 1;
}
}
}
if (!Key.isDown(U)) {
who.uup = true;
}
if (Key.isDown(U) && (who.uup)) {
who.uup = false;
if (((!who.jumping) && (who.anim != 3)) && (who.yvel < 15)) {
who.jumping = true;
if (!who.attacking) {
who.anim = 2;
}
who.yvel = -who.jumpht;
}
}
if ((Key.isDown(atk) && (!who.attacking)) && (who.aup)) {
if (fireballson) {
dudeFireball(who);
}
who.attacking = true;
who.anim = 3 + curatk;
var _local2 = curatk - 1;
playSound("swing" + _local2);
playSound("yell" + random(5));
curatk++;
if (curatk > 3) {
curatk = 1;
}
who.aup = false;
}
if (Key.isDown(atk)) {
who.aup = false;
} else {
who.aup = true;
}
if (((((!Key.isDown(R)) && (!Key.isDown(L))) && (!who.jumping)) && (who.anim != 3)) && (!who.attacking)) {
who.anim = 0;
}
if (!Key.isDown(magbut)) {
who.sup = true;
}
if (Key.isDown(magbut) && (who.sup)) {
who.sup = false;
runMagic(who);
who.anim = 9;
}
if (Key.isDown(magbut)) {
who.sup = false;
}
}
if (who.flashing) {
who.flashcv++;
who._visible = !who._visible;
if (who.flashcv >= 20) {
who.flashing = false;
who.flashcv = 0;
}
}
if (who.hit) {
who.anim = 7;
who.hitcv++;
if (who.hitcv >= 15) {
who.flashing = true;
resetAtk(who);
who.hit = false;
who.hitcv = 0;
}
}
if ((prevanim != who.anim) && (!who.nootheranims)) {
prevanim = who.anim;
switch (who.anim) {
case 0 :
who.guts.gotoAndPlay("rest");
break;
case 1 :
who.guts.gotoAndPlay("walk");
break;
case 2 :
who.guts.gotoAndPlay("jump");
break;
case 3 :
who.guts.gotoAndPlay("land");
break;
case 4 :
who.guts.gotoAndPlay("atk1");
break;
case 5 :
who.guts.gotoAndPlay("atk2");
break;
case 6 :
who.guts.gotoAndPlay("atk3");
break;
case 7 :
who.guts.gotoAndPlay("hit");
break;
case 8 :
who.guts.gotoAndPlay("magic");
break;
case 9 :
who.guts.gotoAndPlay("magchoose");
}
if (who.anim == 3) {
who.anim = 0;
prevanim = 0;
if (Key.isDown(R) || (Key.isDown(L))) {
prevanim = 1;
}
}
}
}
}
function resetAtk(who) {
who.attacking = false;
who.anim = 0;
prevanim = -1;
}
function endAttack(who) {
resetAtk(who);
who.guts.gotoAndPlay("rest");
}
function jumpRecover(who) {
if ((!_root.platpause) && (!freeze)) {
if (Key.isDown(R) || (Key.isDown(L))) {
who.guts.gotoAndPlay("walk");
} else {
who.guts.gotoAndPlay("rest");
}
}
}
runFade();
_root._quality = _root.qualset;
rocks = new Array();
moverocks = new Array();
noleave = false;
blacky = false;
wizardogot = false;
blacksmithgot = false;
wizardgot = false;
wordsup = false;
fireballson = false;
dfireballs = new Array();
freeze = false;
platended = false;
game.unloadMovie();
game.removeMovieClip();
baddies = new Array();
this.attachMovie(platlev, "game", 0);
game.dude.sc = game.dude._xscale;
game.fric = 0.6;
this.attachMovie("plat_hud", "hud", 983);
game.bg.cacheAsBitmap = true;
game.bg2.cacheAsBitmap = true;
game.farbg.cacheAsBitmap = true;
msgbox.unloadMovie();
msgbox.removeMovieClip();
effcv = 0;
platpause = false;
this.magbut = 83;
spcv = 0;
if (game.boss._x != undefined) {
game.bossbattle = true;
}
updateHUD();
spurts = new Array();
ballpointer = 0;
var locs = new Array();
locs[0] = -350;
locs[1] = -185;
locs[2] = 40;
locs[3] = 530;
locs[4] = 730;
locs[5] = 870;
locs[6] = 40;
locs[7] = 530;
locs[8] = 40;
locs[9] = 530;
locs[10] = 40;
locs[11] = 530;
atktimer = 100;
prevanim = 0;
curatk = 1;
game.startoff = 0;
game.dude.flashcv = 0;
game.dude.hitcv = 0;
game.dude.xvel = 0;
game.dude.yvel = 0;
game.dude.speed = 8;
game.dude.jumpht = 35;
game.dude.glowcv = 0;
game.dude.jumping = true;
game._x = 320 - game.dude._x;
game._y = 390 - game.dude._y;
if (game._x > (-game.lef)) {
game._x = -game.lef;
}
if (game._x < ((-game.rig) + 640)) {
game._x = (-game.rig) + 640;
}
if (game._y < 0) {
game._y = 0;
}
game.farbg._x = -game._x;
game.farbg._y = -game._y;
game.flasher._x = -game._x;
game.flasher._y = -game._y;
delete game.onEnterFrame;
delete this.onEnterFrame;
game.onEnterFrame = function () {
if (game.fric > 0.6) {
game.fric = 0.6;
}
if (!freeze) {
chkPause();
}
if ((!platpause) && (!freeze)) {
_root.datime++;
if (!game.dude.magicking) {
if (fireballson) {
moveDudeFireballs();
}
runSpurts();
phys(game.dude);
moveBads();
centerOn(game.dude);
}
controls(game.dude);
}
if (wordsup) {
chkContinue();
}
if (freeze) {
magControls();
}
};
Frame 7
stop();
if (((((!_root.spells[0]) && (!_root.spells[1])) && (!_root.spells[2])) && (!_root.spells[3])) && (!_root.gotaxe)) {
_root.runMedal("Speed-runner");
}
_root.freshSave();
_root.gameending = true;
delete this.onEnterFrame;
_root._quality = "High";
_root.qualset = "High";
inited = false;
_root.pastdungeon = false;
mapp = new Array(1620, -600);
stopAllSounds();
delete game.onEnterFrame;
delete this.onEnterFrame;
game.unloadMovie();
game.removeMovieClip();
hud.unloadMovie();
hud.removeMovieClip();
levelup.removeMovieClip();
levelup.unloadMovie();
Symbol 22 MovieClip Frame 1
stop();
Symbol 71 MovieClip Frame 1
function updateMe() {
m1.guts.stop();
m2.guts.stop();
m3.guts.stop();
m4.guts.stop();
m5.guts.stop();
i = 0;
while (i < 9) {
hid = eval ("m" + i);
hid._visible = false;
sho = eval ("m" + _root.curmag);
sho._visible = true;
i++;
}
}
updateMe();
Symbol 91 MovieClip [platweaponholder] Frame 1
_root.showSword(this);
Symbol 117 MovieClip [pausesign_guts] Frame 1
function switchQual(n) {
var _local3 = 0;
while (_local3 < 3) {
var _local4 = this["a" + _local3];
_local4.gotoAndStop(1);
_local4.nam.text = nams[_local3];
_local3++;
}
var _local6 = this["a" + n];
_local6.gotoAndStop(2);
_local6.nam.text = nams[n];
_root._quality = sett[n];
_root.qualset = sett[n];
}
function updateMe() {
if (_root.museoff) {
mchk.chk._visible = false;
}
if (_root.sfxoff) {
schk.chk._visible = false;
}
var _local2 = new Color(masker);
_local2.setRGB(_root.armorarray[_root.curarmor]);
arm.text = "-" + _root.curarmor;
mag.text = "-" + _root.curmag;
sword.text = "-" + _root.cursword;
deaths.text = "-" + _root.numdeaths;
showSword(swordthing);
magthing.updateMe();
}
updateMe();
var nams = new Array("H", "M", "L");
var sett = new Array("High", "Medium", "Low");
if (_root.qualset == "High") {
switchQual(0);
}
if (_root.qualset == "Medium") {
switchQual(1);
}
if (_root.qualset == "Low") {
switchQual(2);
}
var i = 0;
while (i < 3) {
var tar = this["a" + i];
tar.id = i;
tar.onPress = function () {
switchQual(this.id);
};
i++;
}
but_walk.onPress = function () {
getURL ("http://armorgames.com/guide/chibi-knight-video-guide", "_blank");
};
but_ag.onPress = function () {
getURL ("http://www.armorgames.com", "_blank");
};
mchk.onPress = function () {
if (this.chk._visible) {
this.chk._visible = false;
muse.text = "Off";
_root.museoff = true;
} else {
this.chk._visible = true;
muse.text = "On";
_root.museoff = false;
}
};
schk.onPress = function () {
if (this.chk._visible) {
this.chk._visible = false;
sfx.text = "Off";
_root.sfxoff = true;
} else {
this.chk._visible = true;
sfx.text = "On";
_root.sfxoff = false;
}
};
Symbol 123 Button
on (release) {
com.newgrounds.API.loadNewgrounds();
}
Symbol 142 Button
on (release) {
nextFrame();
}
Symbol 143 Button
on (release) {
prevFrame();
}
Symbol 147 Button
on (release) {
selectPeriod("Today");
}
Symbol 150 Button
on (release) {
selectPeriod("This Week");
}
Symbol 153 Button
on (release) {
selectPeriod("This Month");
}
Symbol 156 Button
on (release) {
selectPeriod("This Year");
}
Symbol 159 Button
on (release) {
selectPeriod("All-Time");
}
Symbol 160 MovieClip Frame 1
function selectPeriod(p) {
_parent.loadScores(10, p);
period = p;
gotoAndStop (1);
}
stop();
Symbol 161 MovieClip [Score Board (NewgroundsAPI)] Frame 1
#initclip 23
Object.registerClass("Score Board (NewgroundsAPI)", com.newgrounds.components.ScoreTable);
#endinitclip
loadScores(10);
Symbol 189 MovieClip Frame 1
onEnterFrame = function () {
if (_visible) {
_rotation = (_rotation + 30);
} else {
delete onEnterFrame;
}
};
Symbol 191 MovieClip Frame 10
stop();
Symbol 193 MovieClip Frame 37
_parent.setGotoFrame("done");
stop();
Symbol 205 MovieClip [NewgroundsAPIAsset_Medal_Popup] Frame 1
function endDelay() {
clearInterval(pop_delay);
gotoAndPlay ("closeme");
}
_visible = true;
icon._visible = false;
pop_delay = setInterval(endDelay, 3000);
Symbol 205 MovieClip [NewgroundsAPIAsset_Medal_Popup] Frame 2
medal.attachIcon(icon);
Symbol 205 MovieClip [NewgroundsAPIAsset_Medal_Popup] Frame 10
icon._visible = true;
medal_name = medal.getName();
medal_value = medal.getValue() + "pts";
stop();
Symbol 205 MovieClip [NewgroundsAPIAsset_Medal_Popup] Frame 21
this.removeMovieClip();
_visible = false;
stop();
Symbol 211 MovieClip [NewgroundsAPIAsset_Login_Warning] Frame 1
function endDelay() {
clearInterval(pop_delay);
gotoAndPlay ("closeme");
}
_x = 0;
_y = 0;
_visible = true;
pop_delay = setInterval(endDelay, 6000);
Symbol 211 MovieClip [NewgroundsAPIAsset_Login_Warning] Frame 10
stop();
Symbol 211 MovieClip [NewgroundsAPIAsset_Login_Warning] Frame 21
this.removeMovieClip();
_visible = false;
stop();
Symbol 214 MovieClip [NewgroundsAPIAsset_Connection_Error] Frame 1
function endDelay() {
clearInterval(pop_delay);
gotoAndPlay ("closeme");
}
_x = 0;
_y = 0;
_visible = true;
pop_delay = setInterval(endDelay, 6000);
Symbol 214 MovieClip [NewgroundsAPIAsset_Connection_Error] Frame 10
stop();
Symbol 214 MovieClip [NewgroundsAPIAsset_Connection_Error] Frame 21
this.removeMovieClip();
_visible = false;
stop();
Symbol 235 MovieClip [NewgroundsAPIAsset_big_popup_background] Frame 1
var w = Math.round(this._width);
var h = Math.round(this._height);
if (w < 80) {
w = 80;
}
if (h < 80) {
h = 80;
}
this._width = 350;
this._height = 120;
t._width = w - 2;
t._x = 1;
b._width = w - 2;
b._x = 1;
c._width = w - 2;
c._x = 1;
c._height = h - 2;
c._y = 1;
l._height = h - 2;
l._y = 1;
r._height = h - 2;
r._y = 1;
tr._x = w - 7;
r._x = w - 7;
br._x = w - 7;
b._y = h - 7;
bl._y = h - 7;
br._y = h - 7;
shadow._width = w + 10;
shadow._height = h + 10;
Symbol 239 Button
on (release) {
this._visible = false;
this.removeMovieClip();
}
Symbol 245 Button
on (release) {
getURL (official_version_url, "_blank");
}
Symbol 247 MovieClip [NewgroundsAsset_New_Version_Available] Frame 1
_x = (Stage.width / 2);
_y = (Stage.height / 2);
background._width = Stage.width + 200;
background._height = Stage.height + 200;
background._x = -(_x + 100);
background._y = -(_y + 100);
Symbol 248 Button
on (release) {
getURL (official_version_url, "_blank");
}
Symbol 252 MovieClip [NewgroundsAsset_Illegal_Host] Frame 1
_x = (Stage.width / 2);
_y = (Stage.height / 2);
background._width = Stage.width + 200;
background._height = Stage.height + 200;
background._x = -(_x + 100);
background._y = -(_y + 100);
Symbol 253 MovieClip [API Connector (NewgroundsAPI)] Frame 1
#initclip 24
Object.registerClass("API Connector (NewgroundsAPI)", com.newgrounds.components.APIConnector);
#endinitclip
Symbol 253 MovieClip [API Connector (NewgroundsAPI)] Frame 20
_visible = false;
Symbol 266 MovieClip Frame 1
stop();
Symbol 164 MovieClip [__Packages.com.newgrounds.API] Frame 0
class com.newgrounds.API
{
static var version, user_email, movie_id, debug, session_id, connected, tracker_id, timeout, encryption_key, user_id, user_name, host, ad_url, eventDispatcher, last_command, ad_swf_url;
function API () {
}
static function setMovieVersion(v) {
if (v) {
version = String(v);
}
}
static function setUserEmail(e) {
user_email = e;
}
static function setFakeSession(fake) {
fake_session = fake;
}
static function setPreload(p) {
preload = p;
}
static function getPercentLoaded() {
var _local2;
if (preload && (preload_items > 0)) {
_local2 = 80;
var _local4 = Math.round((preload_items_loaded / preload_items) * 20);
var _local3 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * _local2) + _local4;
} else {
_local2 = 100;
var _local3 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * _local2);
}
return(_local3);
}
static function reportNewAsset() {
if (preload) {
preload_items++;
}
}
static function reportAssetLoaded() {
if (preload) {
preload_items_loaded++;
}
}
static function populateMedals(medal_list) {
if (medals === null) {
medals = new Array();
var _local2 = 0;
while (_local2 < medal_list.length) {
var _local1 = medal_list[_local2];
medals.push(new com.newgrounds.Medal(_local1.medal_id, _local1.medal_name, _local1.medal_value, _local1.medal_difficulty, _local1.medal_unlocked, _local1.medal_icon));
_local2++;
}
}
}
static function populateSaveGroups(save_group_list, file_path) {
com.newgrounds.SaveFile.setFilePath(file_path);
save_groups = new Array();
var _local6 = 0;
while (_local6 < save_group_list.length) {
var _local2 = save_group_list[_local6];
var _local5 = new com.newgrounds.SaveGroup(_local2.group_id, _local2.group_name, _local2.group_type);
var _local4 = 0;
while (_local4 < _local2.keys.length) {
var _local3 = _local2.keys[_local4];
_local5.addKey(_local3.id, _local3.name, _local3.type);
_local4++;
}
_local4 = 0;
while (_local4 < _local2.ratings.length) {
var _local1 = _local2.ratings[_local4];
_local5.addRating(_local1.id, _local1.name, _local1.min, _local1.max, _local1.float);
_local4++;
}
save_groups.push(_local5);
_local6++;
}
}
static function populateScoreBoards(score_boards) {
scoreboards = new Array();
var _local1 = 0;
while (_local1 < score_boards.length) {
scoreboards.push(new com.newgrounds.ScoreBoard(score_boards[_local1].id, score_boards[_local1].name));
_local1++;
}
}
static function getOfficialVersionURL() {
var _local1 = (((GATEWAY_URL + "?tracker_id=") + movie_id) + "&command_id=loadOfficalVersion&seed=") + Math.random();
if (debug) {
_local1 = _local1 + "&debug=1";
}
return(_local1);
}
static function hasUserSession() {
if (session_id && (publisher_id)) {
return(true);
}
if (_root.NewgroundsAPI_PublisherID && (_root.NewgroundsAPI_SessionID)) {
return(true);
}
return(false);
}
static function isNewgrounds() {
return(((publisher_id == 1) || (_root.NewgroundsAPI_PublisherID == 1)) || (getHost().toLowerCase().indexOf("ungrounded.net") > -1));
}
static function hasPublisher() {
return(publisher_id || (_root.NewgroundsAPI_PublisherID));
}
static function hasUserEmail() {
if (user_email) {
return(true);
}
return(false);
}
static function isConnected() {
return(connected);
}
static function getTrackerID() {
return(tracker_id);
}
static function connectionTimeOut() {
reportAssetLoaded();
clearInterval(timeout);
callListener(com.newgrounds.APIEvent.MOVIE_CONNECTED, false, new com.newgrounds.APIError("CONNECTION_FAILED", "Connection to API gateway timed out."));
}
static function connectMovie(m_id, encrypt_key, debug_mode) {
if (connected) {
return(undefined);
}
sendMessage("Connecting to the Newgrounds API Gateway...");
var _local2 = function () {
com.newgrounds.API.connectionTimeOut();
};
timeout = setInterval(_local2, 10000, null);
if (!m_id) {
fatalError("API.connectMovie() - missing required movie_id parameter", "connectMovie");
}
movie_id = String(m_id);
tracker_id = Number(movie_id.substring(0, movie_id.indexOf(":")));
encryption_key = encrypt_key;
debug = debug_mode;
if (_root.NewgroundsAPI_PublisherID) {
publisher_id = _root.NewgroundsAPI_PublisherID;
if (_root.NewgroundsAPI_SessionID) {
session_id = _root.NewgroundsAPI_SessionID;
}
} else if (fake_session) {
publisher_id = 1;
session_id = "D3bu64p1U53R";
user_id = 10;
user_name = "API-Debugger";
} else {
if (debug) {
publisher_id = 1;
}
session_id = null;
user_id = 0;
user_name = "Guest";
}
if (_root.NewgroundsAPI_UserName) {
user_name = _root.NewgroundsAPI_UserName;
}
if (_root.NewgroundsAPI_UserID) {
user_id = _root.NewgroundsAPI_UserID;
}
reportNewAsset();
connected = true;
sendCommand("connectMovie", {host:getHost(), movie_version:version});
}
static function getHost() {
if (!host) {
var _local1 = _url;
if ((_local1.indexOf("http://") > -1) or (_local1.indexOf("https://") > -1)) {
host = _local1.split("/")[2].toLowerCase();
} else {
host = LOCAL_HOST;
}
}
return(host);
}
static function isPublishedHost() {
for (var _local1 in PREVIEW_HOSTS) {
if (getHost() == PREVIEW_HOSTS[_local1]) {
return(false);
}
}
return(true);
}
static function loadNewgrounds() {
sendCommand("loadNewgrounds", {host:getHost()}, true);
}
static function loadMySite() {
sendCommand("loadMySite", {host:getHost()}, true);
}
static function loadCustomLink(link) {
sendCommand("loadCustomLink", {host:getHost(), link:link}, true);
}
static function logCustomEvent(event) {
sendCommand("logCustomEvent", {host:getHost(), event:event});
}
static function getScoreBoard(board) {
for (var _local2 in scoreboards) {
if ((typeof(board) == "string") && (scoreboards[_local2].name == board)) {
return(scoreboards[_local2]);
}
if ((typeof(board) == "number") && (scoreboards[_local2].id == board)) {
return(scoreboards[_local2]);
}
}
}
static function postScore(board, value, get_best) {
if ((!board) or (value == undefined)) {
sendError({command_id:"postScore"}, new com.newgrounds.APIError("MISSING_PARAM", "missing required parameter(s)"));
return(undefined);
}
sendSecureCommand("postScore", {user_name:user_name, board:board, value:value, get_best:get_best, publisher_id:publisher_id});
}
static function loadScores(board) {
var _local3 = "loadScores";
if (!board.__get__id()) {
sendError({command_id:_local3}, new com.newgrounds.APIError("MISSING_PARAM", "missing required ScoreBoard instance"));
return(undefined);
}
if (!hasUserSession()) {
callListener(com.newgrounds.APIEvent.SCORES_LOADED, false, new com.newgrounds.APIError("SITE_ID_REQUIRED", ("Host '" + getHost()) + "' does not have high scores enabled"));
return(undefined);
}
var _local1 = {};
_local1.publisher_id = publisher_id;
_local1.period = board.period;
_local1.board = board.id;
_local1.num_results = board.num_results;
_local1.page = board.page;
sendCommand(_local3, _local1);
}
static function unlockMedal(medal, x, y) {
if (!medal) {
sendError({command_id:"unlockMedal"}, new com.newgrounds.APIError("MISSING_PARAM", "missing required medal name"));
return(undefined);
}
if (typeof(medal) != "object") {
medal = getMedal(medal);
}
callListener(com.newgrounds.APIEvent.UNLOCK_MEDAL, true, {medal:medal, x:x, y:y});
if (hasUserSession() or debug) {
sendMessage(("Attempting to unlock '" + medal.getName()) + "'");
var _local3 = new Object();
_local3.medal_id = medal.getID();
sendSecureCommand("unlockMedal", _local3);
} else {
sendMessage(("Unlocking '" + medal.getName()) + "'");
medal.setUnlocked(true);
var _local2 = loadLocal("medals_unlocked");
if (!_local2) {
_local2 = new Object();
}
_local2[medal.getID()] = true;
saveLocal("medals_unlocked", _local2);
}
}
static function loadMedals() {
if (medals) {
callListener(com.newgrounds.APIEvent.MEDALS_LOADED, true, {medals:medals});
return(undefined);
}
var _local1 = new Object();
if (hasUserSession()) {
_local1.publisher_id = publisher_id;
_local1.user_id = user_id;
}
sendCommand("getMedals", _local1);
}
static function getMedals() {
return(medals);
}
static function getMedal(identifier) {
for (var _local3 in medals) {
var _local1 = medals[_local3];
if ((typeof(identifier) == "string") && (_local1.getName() == identifier)) {
return(_local1);
}
if (_local1.getID() == identifier) {
return(_local1);
}
}
sendWarning(("Could not find the medal '" + identifier) + "'");
}
static function saveLocal(save_id, save_data, size_allocation) {
if (!sharedObjects[save_id]) {
sharedObjects[save_id] = SharedObject.getLocal((("ng_ap_secure_" + movie_id) + "_") + save_id);
}
sharedObjects[save_id].data[save_id] = encodeData(save_data);
sharedObjects[save_id].flush();
}
static function loadLocal(save_id) {
if (!sharedObjects[save_id]) {
sharedObjects[save_id] = SharedObject.getLocal((("ng_ap_secure_" + movie_id) + "_") + save_id);
}
sharedObjects[save_id].flush();
echo((("sharedobject " + save_id) + " is: ") + sharedObjects[save_id].data[save_id]);
if (sharedObjects[save_id].data[save_id]) {
echo("decoded: " + decodeData(sharedObjects[save_id].data[save_id]));
return(decodeData(sharedObjects[save_id].data[save_id]));
}
return(null);
}
static function encodeData(data) {
return(compressHex(com.newgrounds.encoders.RC4.encrypt(com.newgrounds.encoders.JSON.encode(data), encryption_key)));
}
static function decodeData(base) {
return(com.newgrounds.encoders.JSON.decode(com.newgrounds.encoders.RC4.decrypt(uncompressHex(base), encryption_key)));
}
static function compressHex(hex_value) {
var _local6 = hex_value.length % 6;
var _local4 = "";
var _local5 = new com.newgrounds.encoders.BaseN(compression_radix);
var _local1 = 0;
while (_local1 < hex_value.length) {
var _local2 = Number("0x" + hex_value.substr(_local1, 6));
_local4 = _local4 + _local5.encode(_local2, 4);
_local1 = _local1 + 6;
}
return(_local6 + _local4);
}
static function uncompressHex(base_value) {
var _local9 = Number(base_value.charAt(0));
var _local7 = "";
var _local3;
var _local8 = new com.newgrounds.encoders.BaseN(compression_radix);
var _local2 = 1;
while (_local2 < base_value.length) {
var _local6 = base_value.substr(_local2, 4);
var _local5 = _local8.decode(_local6);
var _local1 = dec2hex(_local5);
if ((_local2 + 4) < base_value.length) {
_local3 = 6;
} else {
_local3 = _local9;
}
while (_local1.length < _local3) {
_local1 = "0" + _local1;
}
_local7 = _local7 + _local1;
_local2 = _local2 + 4;
}
return(_local7);
}
static function dec2hex(dec) {
var _local4 = "0123456789ABCDEF";
var _local3 = "";
while (dec > 0) {
var _local2 = dec % 16;
_local3 = _local4.charAt(_local2) + _local3;
dec = (dec - _local2) / 16;
}
return(_local3);
}
static function getSaveGroup(group) {
if ((save_groups == null) || (save_groups.length < 1)) {
return(null);
}
var _local1 = 0;
while (_local1 <= save_groups.length) {
if ((typeof(group) == "number") or (Number(group).toString() == String(group))) {
if (save_groups[_local1].getID() == Number(group)) {
return(save_groups[_local1]);
}
} else if (typeof(group) == "string") {
if (save_groups[_local1].getName().toLowerCase() == group.toLowerCase()) {
return(save_groups[_local1]);
}
}
_local1++;
}
return(null);
}
static function lookupSaveFiles(save_group) {
var _local1 = "lookupSaveFiles";
var _local2 = {publisher_id:publisher_id, group_id:save_group.getID(), query:com.newgrounds.encoders.JSON.encode(save_group.getQuery(true))};
sendCommand(_local1, _local2);
}
static function newSaveFile(group) {
var _local1 = getSaveGroup(group);
if (_local1) {
return(_local1.newFile());
}
var _local2 = new com.newgrounds.APIError("INVALID_SAVE_GROUP", ("'" + group) + "' is not a valid save group.");
sendError({command_id:"newSaveFile"}, _local2);
}
static function newSaveQuery(group) {
var _local1 = getSaveGroup(group);
if (_local1) {
return(_local1.newQuery());
}
var _local2 = new com.newgrounds.APIError("INVALID_SAVE_GROUP", ("'" + group) + "' is not a valid save group.");
sendError({command_id:"newSaveQuery"}, _local2);
}
static function checkFilePrivs(file) {
if (user_id) {
var _local1 = user_id;
} else {
var _local1 = 0;
}
var _local2 = {group:file.getGroup().getID(), filename:file.getName(), user_id:_local1, publisher_id:publisher_id};
sendCommand("checkFilePrivs", _local2);
}
static function saveFile(file, overwrite) {
var _local1;
_local1 = {group:file.getGroup().getID(), filename:file.getName(), description:file.getDescription(), draft:file.__get__draft(), user_name:user_name};
if (overwrite) {
_local1.overwrite = overwrite;
}
if (file.getDuplicateID()) {
_local1.save_id = file.getDuplicateID();
}
if (file.getKeys().length > 0) {
_local1.keys = file.getKeys();
}
var _local3;
_local3 = {file:file.getRawContents()};
if (file.getThumbnailImageScan()) {
_local3.thumbnail = file.getThumbnailImageScan();
}
save_file = file;
sendSecureCommand("saveFile", _local1, null, _local3);
}
static function rateSaveFile(file, rating, vote) {
var _local1 = {group:file.getGroup().getID(), save_id:file.getID(), rating_id:rating.rating_id, vote:vote, user_id:user_id};
sendSecureCommand("rateSaveFile", _local1);
}
static function getConfirmation(command_name, event, msg, target, confirm, cancel) {
var _local1 = new com.newgrounds.APIError("CONFIRM_REQUEST", msg);
_local1.confirm = function () {
target[confirm]();
};
_local1.cancel = function () {
target[cancel]();
};
_local1.command = command_name;
callListener(event, false, _local1);
}
static function doEvent(e) {
switch (e.command_id) {
case "connectMovie" :
clearInterval(timeout);
sendMessage("You have successfully connected to the Newgrounds API Gateway");
sendMessage(("Movie identified as \"" + e.movie_name) + "\"");
callListener(com.newgrounds.APIEvent.MOVIE_CONNECTED, e.success, {movie_name:e.movie_name});
var _local6 = false;
if (e.ad_status === -1) {
var _local10 = "This movie was not approved to run Flash Ads.";
sendWarning(_local10);
sendWarning(("visit " + AD_TERMS_URL) + " to view our approval guidelines");
if (!e.ad_url) {
callListener(com.newgrounds.APIEvent.ADS_APPROVED, false, new com.newgrounds.APIError("FLASH_ADS_NOT_APPROVED", _local10));
} else {
_local6 = true;
}
} else if (e.ad_status === 0) {
var _local10 = "Flash Ads are currently awaiting approval.";
sendNotice(_local10);
if (!e.ad_url) {
callListener(com.newgrounds.APIEvent.ADS_APPROVED, false, new com.newgrounds.APIError("FLASH_ADS_NOT_APPROVED", _local10));
} else {
_local6 = true;
}
}
if (e.ad_url) {
ad_url = unescape(e.ad_url);
if (!_local6) {
sendMessage("This movie has been approved to run Flash Ads!");
}
callListener(com.newgrounds.APIEvent.ADS_APPROVED, true);
}
if (e.deny_host) {
var _local10 = getHost() + " does not have permission to run this movie!";
sendWarning(_local10);
sendWarning("\tUpdate your API configuration to unblock " + getHost());
callListener(com.newgrounds.APIEvent.HOST_BLOCKED, true, {movie_url:unescape(e.movie_url), redirect_url:getOfficialVersionURL()});
} else if (e.movie_version) {
sendWarning("According to your API Configuration, this version is out of date.");
if (version) {
sendWarning("\tThe this movie is version " + version);
}
sendWarning("\tThe most current version is " + e.movie_version);
callListener(com.newgrounds.APIEvent.NEW_VERSION_AVAILABLE, true, {movie_version:e.movie_version, movie_url:unescape(e.movie_url), redirect_url:getOfficialVersionURL()});
}
if (e.request_portal_url) {
sendCommand("setPortalID", {portal_url:_url});
}
if (preload) {
reportNewAsset();
var _local7 = {};
if (hasUserSession()) {
_local7.publisher_id = publisher_id;
_local7.user_id = user_id;
}
sendCommand("preloadSettings", _local7);
}
reportAssetLoaded();
break;
case "preloadSettings" :
if (e.medals) {
populateMedals(e.medals);
if ((!hasUserSession()) and (!debug)) {
echo("checking for sharedobject medals...");
var _local3 = loadLocal("medals_unlocked");
if (_local3) {
for (var _local5 in _local3) {
var _local5 = Number(_local5);
if (_local3[_local5]) {
var _local2 = getMedal(_local5);
echo("now unlocking " + _local2.getName());
_local2.setUnlocked(true);
}
}
}
}
}
if (e.save_groups) {
populateSaveGroups(e.save_groups, e.save_file_path);
}
if (e.score_boards) {
populateScoreBoards(e.score_boards);
}
reportAssetLoaded();
break;
case "logCustomEvent" :
if (e.success) {
sendMessage(("Event '" + e.event) + "' was logged.");
}
callListener(com.newgrounds.APIEvent.EVENT_LOGGED, e.success, {event:e.event});
break;
case "postScore" :
var _local8;
if (e.success) {
var _local4 = "User";
if (user_email) {
_local4 = user_email;
} else if (user_name) {
_local4 = user_name;
}
var _local17 = getScoreBoard(e.board);
sendMessage(((((_local4 + " posted ") + e.value) + " to '") + _local17.name) + "'");
_local8 = {board:_local17, value:e.value, username:_local4};
}
callListener(com.newgrounds.APIEvent.SCORE_POSTED, e.success, _local8);
break;
case "loadScores" :
_local8 = new Object();
var _local17 = getScoreBoard(e.board);
if (_local17.exists()) {
_local17.setScores(e.scores, e.period, e.page, e.num_results);
}
callListener(com.newgrounds.APIEvent.SCORES_LOADED, e.success, {board:_local17});
break;
case "unlockMedal" :
var _local21 = getMedal(e.medal_name);
_local21.setUnlocked(true);
sendMessage(("Successfuly unlocked '" + _local21.getName()) + "'");
callListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, e.success, {medal:_local21});
break;
case "getMedals" :
populateMedals(e.medals);
callListener(com.newgrounds.APIEvent.MEDALS_LOADED, e.success, {medals:medals});
break;
case "lookupSaveFiles" :
var _local11 = getSaveGroup(e.group_id).getQuery();
_local11.onExecuted(e.files);
break;
case "rateSaveFile" :
var _local15 = getSaveGroup(e.group_id);
var _local13 = _local15.getFile(e.save_id);
if (e.already_voted) {
var _local24 = new com.newgrounds.APIError("PERMISSION_DENIED", "You have already voted on this item today");
callListener(com.newgrounds.APIEvent.VOTE_COMPLETE, false, {error:_local24, file:_local13});
return(undefined);
}
if (e.success) {
var _local9 = _local13.onVoted(e);
callListener(com.newgrounds.APIEvent.VOTE_COMPLETE, e.success, {rating:_local9, file:_local13});
} else {
callListener(com.newgrounds.APIEvent.VOTE_COMPLETE, e.success, {file:_local13});
}
break;
case "saveFile" :
if (save_file) {
if (!save_file.exists()) {
save_file.setID(e.save_id, true);
}
save_file.onSaved(e);
callListener(com.newgrounds.APIEvent.FILE_SAVED, e.success, {file:save_file});
}
save_file = null;
break;
case "checkFilePrivs" :
_local8 = {file:save_file, filename:e.filename, group:e.group, exists:e.exists, can_write:e.can_write};
if (e.duplicate_id) {
_local8.duplicate_id = e.duplicate_id;
}
callListener(com.newgrounds.APIEvent.FILE_PRIVS_LOADED, e.success, _local8);
}
}
static function getDispatcher() {
if (!eventDispatcher) {
eventDispatcher = new com.newgrounds.APIEventDispatcher();
}
return(eventDispatcher);
}
static function hasEventListener(event) {
return(getDispatcher().hasEventListener(event));
}
static function addEventListener(event, listener, target) {
echo(("Adding a listener for '" + event) + "'");
getDispatcher().addEventListener(event, listener, target);
}
static function removeEventListener(event, target) {
getDispatcher().removeEventListener(event, target);
}
static function callListener(event, success, data, target) {
echo("Fired Event: " + event);
var _local1 = new com.newgrounds.APIEvent(event, success, target, data);
if (data.isError()) {
_local1.error = data;
} else {
_local1.data = data;
}
getDispatcher().dispatchEvent(_local1);
if ((event == com.newgrounds.APIEvent.MOVIE_CONNECTED) && (!success)) {
connected = false;
}
bridge.sendEvent(event, {success:success, data:data});
}
static function sendError(c, e) {
switch (c.command_id) {
case "connectMovie" :
clearInterval(timeout);
callListener(com.newgrounds.APIEvent.MOVIE_CONNECTED, false, {error:e, response:c});
break;
case "saveFile" :
callListener(com.newgrounds.APIEvent.FILE_SAVED, false, {error:e, file:save_file, response:c});
save_file = null;
}
bridge.sendError(com.newgrounds.APIEvent.API_ERROR, {command:c.command_id, error:e});
trace((((((("[Newgrounds API ERROR] :: " + c.command_id) + "() - ") + e.name) + ":") + newline) + "\t\t\t\t") + e.message);
}
static function sendWarning(m, c) {
if (c) {
m = m + ((("\r[Newgrounds API WARNING] :: \tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
trace("[Newgrounds API WARNING] :: " + m);
}
static function sendNotice(m, c) {
if (c) {
m = m + ((("\r[Newgrounds API NOTICE] :: \tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
trace("[Newgrounds API NOTICE] :: " + m);
}
static function fatalError(m, c) {
if (c) {
m = m + ((("\r\tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
throw (((("***ERROR*** frame=" + _root._currentframe) + ", class=API") + newline) + newline) + m;
}
static function sendSecureCommand(command, secure_params, unsecure_params, files) {
if (((!debug) && (!hasUserSession())) && (!hasUserEmail())) {
sendError({command_id:command}, new com.newgrounds.APIError("IDENTIFICATION_REQUIRED", ("You must be logged in, or provide an e-mail address using 'API.setUserEmail(\"name@domain.com\");' to use " + command) + "()."));
return(undefined);
}
if (!command) {
fatalError("Missing command", "sendSecureCommand");
}
if (!secure_params) {
fatalError("Missing secure_params", "sendSecureCommand");
}
if (!unsecure_params) {
unsecure_params = new Object();
}
var _local2 = "";
var _local1 = 0;
while (_local1 < 16) {
_local2 = _local2 + compression_radix.charAt(Math.floor(Math.random() * compression_radix.length));
_local1++;
}
if (debug && (!fake_session)) {
secure_params.session_id = "";
} else {
secure_params.session_id = session_id;
}
secure_params.as_version = 2;
secure_params.user_email = user_email;
secure_params.publisher_id = publisher_id;
secure_params.seed = _local2;
secure_params.command_id = command;
var _local8 = com.newgrounds.encoders.JSON.encode(secure_params);
var _local9 = com.newgrounds.encoders.MD5.calculate(_local2);
var _local6 = com.newgrounds.encoders.RC4.encrypt(_local8, encryption_key);
var _local7 = _local9 + _local6;
unsecure_params.secure = compressHex(_local7);
sendCommand("securePacket", unsecure_params, false, files);
}
static function sendCommand(command, params, open_browser, files) {
if ((!connected) and (command != "connectMovie")) {
var _local12 = (("API." + command) + "() - API.connectMovie() must be called before this command can be called") + newline;
fatalError(_local12, "connectMovie");
}
if (open_browser) {
var _local2 = new Object();
} else {
var _local2 = new LoadVars();
}
_local2.command_id = command;
_local2.tracker_id = movie_id;
if (debug) {
_local2.debug = debug;
}
if (params) {
for (var _local9 in params) {
_local2[_local9] = params[_local9];
}
}
if (files) {
for (var _local9 in files) {
_local2[_local9] = files[_local9];
}
}
if (open_browser) {
var _local7 = (GATEWAY_URL + "?seed=") + Math.random();
for (var _local9 in _local2) {
_local7 = _local7 + ((("&" + escape(_local9)) + "=") + escape(_local2[_local9]));
}
getURL (_local7, "_blank");
_local2.removeMovieClip();
} else {
var _local10 = new LoadVars();
_local10.remember_command_id = _local2.command_id;
_local10.onData = function (data) {
com.newgrounds.API.echo(("INPUT: \r" + data) + newline);
if (data) {
var _local2 = com.newgrounds.encoders.JSON.decode(data);
} else {
var _local2 = {success:false};
}
if (!_local2.success) {
if ((!_local2.error_code) && (!_local2.error_msg)) {
_local2.error_code = "CONNECTION_FAILED";
_local2.error_msg = "Could not contact the API Gateway";
_local2.command_id = this.remember_command_id;
}
var _local4 = new com.newgrounds.APIError(_local2.error_code, _local2.error_msg);
com.newgrounds.API.sendError(_local2, _local4);
} else {
com.newgrounds.API.doEvent(_local2);
}
};
var _local6 = new Array();
for (var _local8 in _local2) {
_local6.push((_local8 + "=") + escape(_local2[_local8]));
}
echo((("POST " + GATEWAY_URL) + "?") + _local6.join("&"));
_local2.sendAndLoad((GATEWAY_URL + "?seed=") + Math.random(), _local10, "POST");
last_command = _local2.command_id;
}
}
static function renderAd(target) {
if (ad_swf_url) {
target.background = target.createEmptyMovieClip("background", 100);
target.background.beginFill(0);
target.background.moveTo(0, 0);
target.background.lineTo(300, 0);
target.background.lineTo(300, 250);
target.background.lineTo(0, 250);
target.background.lineTo(0, 0);
target.background.endFill();
target.mask = target.createEmptyMovieClip("mask", 101);
target.mask.beginFill(0);
target.mask.moveTo(0, 0);
target.mask.lineTo(300, 0);
target.mask.lineTo(300, 250);
target.mask.lineTo(0, 250);
target.mask.lineTo(0, 0);
target.mask.endFill();
target.clip = target.createEmptyMovieClip("clip", 102);
target.clip.ad = target.clip.createEmptyMovieClip("ad", 100);
target.clip.setMask(target.mask);
loadMovie (ad_swf_url, target.clip.ad);
callListener(com.newgrounds.APIEvent.AD_ATTACHED, true, null, target);
} else {
callListener(com.newgrounds.APIEvent.AD_ATTACHED, false, new com.newgrounds.APIError("FLASH_ADS_NOT_APPROVED", "Unable to render ad"));
}
}
static function attachFlashAd(target) {
System.security.allowDomain("http://server.cpmstar.com");
System.security.allowDomain("http://www.cpmstar.com");
System.security.allowDomain("https://server.cpmstar.com");
System.security.allowDomain("https://www.cpmstar.com");
System.security.allowInsecureDomain("http://server.cpmstar.com");
System.security.allowInsecureDomain("http://www.cpmstar.com");
System.security.allowInsecureDomain("https://server.cpmstar.com");
System.security.allowInsecureDomain("https://www.cpmstar.com");
if (checkAdFlood()) {
ad_swf_url = null;
} else if (checkAdCache()) {
reportNewAsset();
var _local1 = new LoadVars();
_local1.onData = function (data) {
if (data) {
com.newgrounds.API.ad_swf_url = data;
} else {
com.newgrounds.API.ad_swf_url = null;
}
com.newgrounds.API.reportAssetLoaded();
com.newgrounds.API.renderAd(target);
};
if (ad_url.indexOf("?") > -1) {
_local1.load((ad_url + "&random=") + Math.random());
} else {
_local1.load((ad_url + "?random=") + Math.random());
}
if (!ad_warning) {
ad_warning = true;
sendMessage("You may get a security sandbox violation from this ad. This is nothing to worry about!");
}
} else if (ad_swf_url) {
renderAd(target);
}
}
static function checkAdFlood() {
if (!ad_url) {
return(false);
}
var _local2 = new Date();
var _local1 = _local2.getTime();
if (_local1 >= ad_flood) {
if ((_local1 - ad_flood) > 1000) {
ad_flood = _local1 + 1000;
} else {
ad_flood = _local1;
sendWarning("This movie is attempting to load multiple ads at too high of a frequency; you may have a bad preloader loop.");
return(true);
}
}
return(false);
}
static function checkAdCache() {
if (!ad_url) {
return(false);
}
var _local2 = new Date();
var _local1 = _local2.getTime();
if (_local1 >= ad_url_cache) {
ad_url_cache = _local1 + 300000;
return(true);
}
return(false);
}
static function sendMessage(m, r) {
var _local1 = "[Newgrounds API] :: " + m;
if (r) {
return(_local1);
}
trace(_local1);
}
static function echo(m) {
if (do_echo) {
trace(m);
}
}
static var do_echo = false;
static var GATEWAY_URL = "http://www.ngads.com/gateway_v2.php";
static var AD_TERMS_URL = "http://www.newgrounds.com/wiki/flashads/terms/";
static var COMMANDS_WIKI_URL = "http://www.newgrounds.com/wiki/flashapi/commands/";
static var LOCAL_HOST = "localhost";
static var PREVIEW_HOSTS = new Array(LOCAL_HOST);
static var ad_url_cache = 0;
static var ad_flood = 0;
static var ad_warning = false;
static var save_file = null;
static var publisher_id = 1;
static var fake_session = false;
static var medals = null;
static var scoreboards = new Array();
static var save_groups = null;
static var compression_radix = "/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X";
static var errors = com.newgrounds.APIError.init_codes();
static var sharedObjects = new Object();
static var bridge = new com.newgrounds.Bridge(_root.NewgroundsAPI_SandboxID);
static var preload = false;
static var preload_items = 0;
static var preload_items_loaded = 0;
}
Symbol 165 MovieClip [__Packages.com.newgrounds.Bridge] Frame 0
class com.newgrounds.Bridge
{
var widget_id, receiver, transmitter;
function Bridge (id) {
widget_id = id;
receiver = new LocalConnection();
transmitter = new LocalConnection();
receiver.receiveEvent = function (event, params) {
com.newgrounds.API.callListener(event, params.success, params.data);
};
receiver.connect("rec_" + widget_id);
}
function sendError(command, params) {
if (widget_id) {
transmitter.send(widget_id, "sendError", command, params);
}
}
function sendEvent(event, params) {
if (widget_id) {
transmitter.send(widget_id, "sendEvent", event, params);
}
}
function sendCommand(command, params) {
if (widget_id) {
transmitter.send(widget_id, "sendCommand", command, params);
}
}
}
Symbol 166 MovieClip [__Packages.com.newgrounds.SaveFile] Frame 0
class com.newgrounds.SaveFile
{
static var file_path;
var _group, _filename, _file_id, _contents, _thumbnail, _thumbnail_url, raw, img, _file_url, _description, scanner;
function SaveFile (_group) {
this._group = _group;
_filename = null;
_file_id = null;
_contents = null;
_thumbnail = null;
_thumbnail_url = null;
raw = null;
img = null;
_draft = false;
_keys = new Array();
_ratings = new Array();
_file_url = null;
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_PRIVS_LOADED, checkPrivs, this);
}
static function setFilePath(path) {
file_path = path + "/";
}
function get name() {
return(_filename);
}
function set name(s) {
_filename = s;
//return(name);
}
function get id() {
return(_file_id);
}
function get description() {
return(_description);
}
function set description(s) {
_description = s;
//return(description);
}
function get contents() {
return(_contents);
}
function set contents(o) {
_contents = o;
//return(contents);
}
function get thumbnailUrl() {
return(_thumbnail_url);
}
function set thumbnailUrl(s) {
_thumbnail_url = s;
//return(thumbnailUrl);
}
function get fileUrl() {
return(_file_url);
}
function set fileUrl(s) {
_file_url = s;
//return(fileUrl);
}
function get draft() {
return(_draft);
}
function set draft(d) {
_draft = d;
//return(draft);
}
function get group() {
return(_group);
}
function get groupId() {
return(_group.getID());
}
function get groupName() {
return(_group.getName());
}
function get groupType() {
return(_group.getType());
}
function get locked() {
return(_locked);
}
function get shared() {
return(_isShared());
}
function get isPrivate() {
return(_isPrivate());
}
function get isPublic() {
return(_isPublic());
}
function get approved() {
return(_isApproved());
}
function get keys() {
return(_keys);
}
function get ratings() {
return(_ratings);
}
function getID() {
return(_file_id);
}
function exists() {
return(!(_file_id === null));
}
function getGroup() {
return(_group);
}
function getName() {
return(_filename);
}
function _isPrivate() {
return(status == STATUS.PRIVATE);
}
function _isShared() {
return(status > STATUS.PRIVATE);
}
function _isApproved() {
return(status > STATUS.UNAPPROVED);
}
function _isPublic() {
if (_isPrivate()) {
return(false);
}
if (_group.isType("SYSTEM") or _group.isType("PRIVATE")) {
return(false);
}
if (_group.isType("PUBLIC")) {
return(true);
}
if (_isApproved()) {
return(true);
}
return(false);
}
function isLocked() {
return(_locked);
}
function getDescription() {
return(_description);
}
function getShared() {
return(_draft);
}
function getThumbnailImageScan() {
return(img);
}
function getRawContents() {
return(raw);
}
function getDuplicateID() {
return(duplicate_id);
}
function getKeys() {
return(_keys);
}
function getKey(key) {
var _local3 = getGroup().getKey(key);
var _local2 = 0;
while (_local2 < _keys.length) {
if (_keys[_local2].id == _local3.key_id) {
return(_keys[_local2].value);
}
_local2++;
}
}
function getRating(rating) {
var _local2 = getGroup().getRating(rating);
if (_ratings[_local2.rating_id]) {
return(_ratings[_local2.rating_id]);
}
return(null);
}
function overwriteAllowed() {
return(overwrite);
}
function getFileURL() {
return(file_path + _file_url);
}
function overwriteExisting() {
overwrite = true;
}
function setID(id, add_to_group) {
_file_id = id;
if (add_to_group) {
getGroup().addFile(this);
}
}
function setName(filename, locked) {
_filename = filename;
_locked = locked;
}
function setDescription(description) {
_description = description;
}
function setDraft(draft) {
_draft = draft;
}
function setContents(_contents) {
this._contents = _contents;
}
function setThumbnail(thumb) {
if (thumb) {
_thumbnail = thumb;
} else {
_thumbnail = null;
}
}
function setThumbnailURL(url) {
_thumbnail_url = url;
}
function setFileURL(url) {
_file_url = url;
}
function setPermissions(status, _locked) {
this._locked = _locked;
this.status = status;
}
function setKey(key, val) {
var _local4 = _group.getKeyID(key);
var _local2;
if (!_local4) {
onError(((("'" + key) + "' is not a valid key for the '") + _group.getKeyType(key, true)) + "' save _group", "setKey", "INVALID_VALUE", true);
return(undefined);
}
if ((!_group.keyValueIsValid(key, val)) && (!(val === null))) {
onError((("'" + val) + "' is not a valid ") + _group.getKeyType(key, true), "setKey", "INVALID_VALUE", true);
return(undefined);
}
switch (_group.getKeyType(key, true)) {
case "string" :
if (val) {
val = String(val);
} else {
val = undefined;
}
break;
default :
val = Number(val);
}
var _local5 = {id:_local4, value:val};
for (var _local7 in _keys) {
_local2 = _keys[_local7];
if (_local2.id == _local4) {
_keys[_local7] = _local5;
return(undefined);
}
}
_keys.push(_local5);
}
function setRating(rating, votes, score) {
var _local2 = getGroup().getRating(rating);
if (!votes) {
votes = 0;
}
if (!score) {
score = 0;
}
if (!_local2.is_float) {
score = Math.round(Number(score));
}
_ratings[_local2.rating_id] = {id:Number(_local2.rating_id), name:_local2.rating_name, votes:Number(votes), score:Number(score)};
return(_ratings[_local2.rating_id]);
}
function clearBuffer() {
_contents = null;
raw = null;
img = null;
scanner = null;
overwrite = false;
duplicate_id = null;
}
function onError(msg, funct, code) {
busy = false;
if (!code) {
code = "SAVE_FILE_ERROR";
}
if (!funct) {
funct = "unknown_function";
}
var _local3 = ("getSaveGroup('" + _group.getName()) + "')";
if (exists()) {
funct = (((_local3 + ".getFile('") + getName()) + "').") + funct;
} else {
funct = (_local3 + ".getNewFile().") + funct;
}
var _local5 = new com.newgrounds.APIError(code, msg);
com.newgrounds.API.sendError({command_id:funct}, _local5);
}
function onSaved(p) {
busy = false;
if (!exists()) {
setID(p.save_id, true);
}
setName(p.filename);
setFileURL(p.file_url);
if (p.thumbnail) {
_thumbnail_url = p.thumbnail;
}
}
function onVoted(p) {
trace("ONVOTED WAS CALLED");
return(setRating(p.rating_id, p.votes, p.score));
}
function sendRating(rating, vote) {
var _local6 = null;
if (!com.newgrounds.API.hasUserSession()) {
_local6 = new com.newgrounds.APIError("PERMISSION_DENIED", "You must be logged in to vote on save files");
}
var _local2 = _group.getRating(rating);
if (!_local2) {
_local6 = new com.newgrounds.APIError("PERMISSION_DENIED", ((("'" + rating) + "' is not a valid rating for the '") + _group.getName()) + "' save group");
}
if (_local2.voted === true) {
_local6 = new com.newgrounds.APIError("PERMISSION_DENIED", "You have already voted on this item today");
}
if ((vote < _local2.min_value) or (vote > _local2.max_value)) {
_local6 = new com.newgrounds.APIError("PERMISSION_DENIED", (((("'" + rating) + "' votes must be between ") + _local2.min_value) + " and ") + _local2.max_value);
}
if (_local6) {
com.newgrounds.API.callListener(com.newgrounds.APIEvent.VOTE_COMPLETE, false, {error:_local6, file:this});
return(undefined);
}
_local2.voted = true;
com.newgrounds.API.rateSaveFile(this, _local2, vote);
}
function replace() {
if (busy) {
onError("Another file is currently being saved, please try again later", "replace");
return(undefined);
}
overwriteExisting();
save();
}
function save() {
if (busy) {
onError("Another file is currently being saved, please try again later", "save", "UPLOAD_IN_PROGRESS");
return(undefined);
}
busy = true;
if (isLocked()) {
onError("This file is _locked and cannot be overwritten.", "save", "PERMISSION_DENIED");
return(undefined);
}
if (!_filename) {
onError("Please provide a name for your file.", "save", "MISSING_PARAM");
return(undefined);
}
if (!_contents) {
onError("The file is empty.", "save", "MISSING_PARAM");
return(undefined);
}
img = null;
com.newgrounds.API.checkFilePrivs(this);
}
function checkPrivs(e) {
if (e.data.file.id != id) {
return(undefined);
}
if (e.success) {
if (e.data.can_write) {
can_write = e.data.can_write;
if (e.data.duplicate_id) {
duplicate_id = e.data.duplicate_id;
}
if (e.data.exists && (!overwriteAllowed())) {
onError(("You already have a file named '" + getName()) + "'", "save", "CONFIRM_REQUEST");
} else {
startFile();
}
} else {
onError("This file is _locked and cannot be overwritten", "save", "PERMISSION_DENIED");
}
} else {
onError("There was a problem looking up your file's details. The server may be down.", "save", "UNKNOWN_ERROR");
}
}
function startFile() {
if (can_write) {
if (_thumbnail) {
scanner = new com.newgrounds.encoders.ImageScanner(_thumbnail);
scanner.setCallback(this, "encodeFile");
scanner.startScan(100, 100, true);
} else {
encodeFile();
}
} else {
onError("You do not have permission to save this file.", "save", "PERMISSION_DENIED");
}
}
function encodeFile(img) {
this.img = img;
raw = com.newgrounds.encoders.SerialXML.encode(_contents).toString();
compressFile();
}
function compressFile() {
com.newgrounds.encoders.LZW2.compress(raw, function (s, p) {
p.file.onCompressed(s);
}, {file:this});
}
function onCompressed(compressed) {
raw = escape(compressed);
writeFile();
}
function getProgress() {
}
function writeFile() {
getGroup().getQuery().clearCache();
com.newgrounds.API.saveFile(this);
clearBuffer();
}
function getContents() {
if (_contents) {
com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_LOADED, true, {file:this});
return(undefined);
}
if (!getFileURL()) {
var _local4 = new com.newgrounds.APIError("FILE_NOT_FOUND", "Attempted to load contents of an unsaved file.");
com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_LOADED, false, {file:this, error:_local4});
return(undefined);
}
var _local2 = new LoadVars();
_local2.target = this;
var target = this;
_local2.onData = function (encoded) {
target.onLoaded(encoded);
};
_local2.load(getFileURL());
}
function onLoaded(encoded) {
if (encoded == undefined) {
var _local3 = new com.newgrounds.APIError("FILE_NOT_FOUND", "We could not find the contents for this file. It may have been deleted.");
com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_LOADED, false, {file:this, error:_local3});
return(undefined);
}
com.newgrounds.encoders.LZW.setXMLSafe(true);
_contents = com.newgrounds.encoders.SerialXML.decode(com.newgrounds.encoders.LZW.decompress(encoded));
com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_LOADED, true, {file:this});
}
static var busy = false;
var can_write = false;
var _draft = false;
var status = 0;
var _locked = false;
var overwrite = false;
var duplicate_id = null;
var _keys = null;
var _ratings = null;
static var STATUS = {PRIVATE:1, PUBLIC:2, UNAPPROVED:3, APPROVED:4};
}
Symbol 167 MovieClip [__Packages.com.newgrounds.SaveGroup] Frame 0
class com.newgrounds.SaveGroup
{
var group_name, group_id, group_type, query, ratings, keys, files;
function SaveGroup (group_id, group_name, group_type) {
this.group_name = group_name;
this.group_id = group_id;
this.group_type = group_type;
query = new com.newgrounds.SaveGroupQuery(this);
ratings = new Array();
keys = new Array();
files = new Array();
}
function get id() {
return(group_id);
}
function get name() {
return(group_name);
}
function get type() {
return(group_type);
}
function addFile(file) {
var _local2 = 0;
while (_local2 < files.length) {
if (files[_local2].getID() == file.getID()) {
files[_local2] = file;
return(undefined);
}
_local2++;
}
files.push(file);
}
function getFile(file_id) {
trace("getting the file " + file_id);
var _local2 = 0;
while (_local2 < files.length) {
trace((((("Looking up " + file_id) + " :: ") + files[_local2].getID()) + " || ") + files[_local2].getName());
if (isNumeric(file_id) and (files[_local2].getID() == Number(file_id))) {
return(files[_local2]);
}
if (files[_local2].getName() == file_id) {
return(files[_local2]);
}
_local2++;
}
return(null);
}
function addRating(rating_id, rating_name, min_value, max_value, is_float) {
var _local3 = {rating_id:rating_id, rating_name:rating_name, min_value:min_value, max_value:max_value, is_float:is_float};
if (!getRatingID(rating_name)) {
ratings.push(_local3);
}
}
function getRating(rating_id) {
var _local2 = 0;
while (_local2 < ratings.length) {
if (isNumeric(rating_id) and (ratings[_local2].rating_id == rating_id)) {
return(ratings[_local2]);
}
if (ratings[_local2].rating_name == rating_id) {
return(ratings[_local2]);
}
_local2++;
}
return(null);
}
function getRatingID(rating_id) {
var _local2 = getRating(rating_id);
if (_local2) {
return(_local2.rating_id);
}
return(null);
}
function getRatingName(rating_id) {
var _local2 = getRating(rating_id);
if (_local2) {
return(_local2.rating_name);
}
return(null);
}
function addKey(key_id, key_name, key_type) {
var _local2 = {key_id:key_id, key_name:key_name, key_type:key_type};
if (!getKey(key_name)) {
keys.push(_local2);
}
}
function getKey(key_id) {
var _local2 = 0;
while (_local2 < keys.length) {
if (isNumeric(key_id) and (keys[_local2].key_id == key_id)) {
return(keys[_local2]);
}
if (keys[_local2].key_name == key_id) {
return(keys[_local2]);
}
_local2++;
}
return(null);
}
function getKeyType(key_name, as_string) {
var _local2 = getKey(key_name);
if (_local2) {
return((as_string ? (KEY_TYPES[_local2.key_type]) : (_local2.key_type)));
}
return(null);
}
function getKeyID(key_id) {
var _local2 = getKey(key_id);
if (_local2) {
return(_local2.key_id);
}
return(null);
}
function getKeyName(key_id) {
var _local2 = getKey(key_id);
if (_local2) {
return(_local2.key_name);
}
return(null);
}
function keyValueIsValid(key, value) {
var _local4;
var _local7;
if ((typeof(value) == "number") or (Number(value).toString() == String(value))) {
value = Number(value);
_local4 = ((Math.round(value) === value) ? "integer" : "float");
} else {
_local4 = typeof(value);
if (_local4 == "string") {
var _local6 = "01234567890.-";
var _local5 = true;
var _local2 = 0;
while (_local2 < value.length) {
if (_local6.indexOf(value.charAt(_local2)) < 0) {
_local5 = false;
break;
}
_local2++;
}
if (_local5) {
value = Number(value);
_local4 = "float";
}
}
}
switch (getKeyType(key, true)) {
case "integer" :
_local7 = (_local4 == "integer") or (_local4 == "boolean");
break;
case "float" :
_local7 = ((_local4 == "float") or (_local4 == "integer")) or (_local4 == "boolean");
break;
case "string" :
_local7 = (((_local4 == "string") or (_local4 == "float")) or (_local4 == "integer")) or (_local4 == "boolean");
break;
case "boolean" :
_local7 = (((_local4 == "boolean") or (value == 1)) or (value == 0)) or (value == "");
break;
default :
_local7 = false;
}
return(_local7);
}
function isType(type) {
return(group_type == TYPES[type.toUpperCase()]);
}
function getID() {
return(group_id);
}
function getName() {
return(group_name);
}
function getType() {
return(group_type);
}
function isSystem() {
return(undefined);
}
function getQuery(as_object) {
if (as_object) {
return(query.toObject());
}
return(query);
}
function newQuery() {
query.reset();
return(query);
}
function clearQuery() {
query.reset();
}
function newFile() {
var _local2 = new com.newgrounds.SaveFile(this);
return(_local2);
}
static function isNumeric(value) {
return((typeof(value) == "number") or (Number(value).toString() == String(value)));
}
static var KEY_TYPES = [null, "float", "integer", "string", "boolean"];
static var TYPES = {SYSTEM:0, PRIVATE:1, PUBLIC:2, MODERATED:3};
}
Symbol 169 MovieClip [__Packages.com.newgrounds.SaveGroupQuery] Frame 0
class com.newgrounds.SaveGroupQuery
{
var _group, _num_results, _pages, _page, _randomize_results, file_conditions, key_conditions, rating_conditions, sort_conditions, lookup_keys, lookup_ratings, _group_by;
function SaveGroupQuery (_group) {
this._group = _group;
reset();
}
function get group() {
return(_group);
}
function get groupId() {
return(_group.getID());
}
function get resultsPerPage() {
return(_num_results);
}
function set resultsPerPage(n) {
_num_results = n;
//return(resultsPerPage);
}
function get pages() {
return(_pages);
}
function get page() {
return(_page);
}
function set page(n) {
_page = n;
//return(page);
}
function get randomize() {
return(_randomize_results);
}
function set randomize(b) {
_randomize_results = b;
//return(randomize);
}
function get results() {
return(_results);
}
function clearCache() {
_results = [];
}
function reset() {
file_conditions = new Array();
key_conditions = new Array();
rating_conditions = new Array();
sort_conditions = new Array();
lookup_keys = new Object();
lookup_ratings = new Object();
_num_results = 20;
_page = 1;
_randomize_results = false;
_group_by = new Array();
clearCache();
}
function getGroup() {
return(_group);
}
function getGroupID() {
return(_group.getID());
}
function isRandomized() {
return(_randomize_results);
}
function toObject() {
var _local2;
var _local11 = {page:_page, num_results:_num_results};
if (_randomize_results) {
_local11.randomize = 1;
}
if (!com.newgrounds.ValidationTools.isEmpty(file_conditions)) {
var _local12 = [];
_local2 = 0;
while (_local2 < file_conditions.length) {
var _local6 = file_conditions[_local2];
_local12.push({field:file_fields[_local6.field.toUpperCase()].id, operator:_local6.operator, value:_local6.value});
_local2++;
}
_local11.file_conditions = _local12;
}
if (!com.newgrounds.ValidationTools.isEmpty(key_conditions)) {
_local11.key_conditions = key_conditions;
}
if (!com.newgrounds.ValidationTools.isEmpty(rating_conditions)) {
_local11.rating_conditions = rating_conditions;
}
if (!com.newgrounds.ValidationTools.isEmpty(sort_conditions)) {
var _local14 = [];
_local2 = 0;
while (_local2 < sort_conditions.length) {
var _local3 = sort_conditions[_local2];
if (_local3.table == TABLE_FILES) {
var _local8 = file_fields[_local3.field.toUpperCase()].id;
} else {
var _local8 = _local3.field;
}
var _local5 = {field:_local8, table:_local3.table};
if (_local3.desc) {
_local5.desc = 1;
}
if (_local3.extra) {
_local5.extra = _local3.extra;
}
_local14.push(_local5);
_local2++;
}
_local11.sort_conditions = _local14;
}
if (!com.newgrounds.ValidationTools.isEmpty(lookup_keys)) {
var _local15 = [];
for (_local2 in lookup_keys) {
_local15.push(_local2);
}
_local11.lookup_keys = _local15;
}
if (!com.newgrounds.ValidationTools.isEmpty(lookup_ratings)) {
var _local13 = [];
for (_local2 in lookup_ratings) {
_local13.push(_local2);
}
_local11.lookup_ratings = _local13;
}
if (!com.newgrounds.ValidationTools.isEmpty(_group_by)) {
var _local16 = [];
_local2 = 0;
while (_local2 < _group_by.length) {
var _local4 = _group_by[_local2];
if (_local4.table == TABLE_FILES) {
var _local8 = file_fields[_local4.field.toUpperCase()].id;
} else {
var _local8 = _local4.field;
}
_local16.push({field:_local8, table:_local4.table});
_local2++;
}
_local11.group_by = _local16;
}
return(_local11);
}
function toString() {
var _local9;
var _local2;
var _local11 = [];
_local9 = "Lookup:\r";
var _local14 = [];
for (var _local6 in file_fields) {
_local14.push(" " + _local6);
_local2 = true;
}
_local9 = _local9 + _local14.join(newline);
_local11.push(_local9);
_local9 = "";
_local2 = false;
var _local16 = [];
for (var _local6 in lookup_keys) {
_local16.push((" KEY '" + _group.getKeyName(_local6)) + "'");
_local2 = true;
}
if (_local2) {
_local9 = _local9 + _local16.join(newline);
_local11.push(_local9);
}
_local9 = "";
_local2 = false;
var _local15 = [];
for (var _local6 in lookup_ratings) {
_local15.push((" RATING '" + _group.getRatingName(_local6)) + "'");
_local2 = true;
}
if (_local2) {
_local9 = _local9 + _local15.join(newline);
_local11.push(_local9);
}
_local9 = "Where:\r";
_local2 = false;
var _local8 = [];
var _local6 = 0;
while (_local6 < file_conditions.length) {
var _local7 = file_conditions[_local6];
var _local10 = ((((" " + _local7.field) + " ") + _local7.operator) + " ") + _local7.value;
_local8.push(_local10);
_local2 = true;
_local6++;
}
_local6 = 0;
while (_local6 < key_conditions.length) {
var _local7 = key_conditions[_local6];
var _local10 = ((((" KEY '" + _group.getKeyName(_local7.key_id)) + "' ") + _local7.operator) + " ") + _local7.value;
_local8.push(_local10);
_local2 = true;
_local6++;
}
_local6 = 0;
while (_local6 < rating_conditions.length) {
var _local7 = rating_conditions[_local6];
var _local10 = ((((" RATING '" + _group.getRatingName(_local7.rating_id)) + "' ") + _local7.operator) + " ") + _local7.value;
_local8.push(_local10);
_local2 = true;
_local6++;
}
if (_local2) {
_local9 = _local9 + _local8.join(newline);
_local11.push(_local9);
}
_local9 = "Group By:\r";
_local2 = false;
var _local13 = [];
_local6 = 0;
while (_local6 < _group_by.length) {
var _local4 = _group_by[_local6];
var _local5;
if (_local4.table == TABLE_KEYS) {
_local5 = (" KEY '" + _group.getKeyName(_local4.field)) + "'";
} else if (_local4.table == TABLE_RATINGS) {
_local5 = (" RATING '" + _group.getRatingName(_local4.field)) + "'";
} else {
_local5 = " " + _local4.field;
}
_local13.push(_local5);
_local2 = true;
_local6++;
}
if (_local2) {
_local9 = _local9 + _local13.join(newline);
_local11.push(_local9);
}
_local9 = "Order By:\r";
_local2 = false;
var _local12 = [];
if (isRandomized()) {
_local12.push(" RANDOM");
_local2 = true;
}
_local6 = 0;
while (_local6 < sort_conditions.length) {
var _local3 = sort_conditions[_local6];
if (_local3.table == TABLE_KEYS) {
var _local5 = (" KEY '" + _group.getKeyName(_local3.field)) + "'";
} else if (_local3.table == TABLE_RATINGS) {
var _local5 = ((" RATING '" + _group.getRatingName(_local3.field)) + "' ") + ((_local3.extra == "votes") ? "VOTES" : "SCORE");
} else {
var _local5 = " " + _local3.field;
}
var _local5 = _local5 + (_local3.desc ? " (DESCENDING)" : "");
_local12.push(_local5);
_local2 = true;
_local6++;
}
if (_local2) {
_local9 = _local9 + _local12.join(newline);
_local11.push(_local9);
}
_local11.push("Page:\r " + _page);
_local11.push("Results Per Page:\r " + _num_results);
return(_local11.join(newline));
}
function setResultsPerPage(r) {
_num_results = r;
clearCache();
}
function setPage(p) {
_page = p;
clearCache();
}
function setRandomize(bool) {
_randomize_results = true;
}
function includeKey(key) {
if (!_group.getKeyID(key)) {
trace(((("[SaveGroupQuery Error] :: '" + key) + "' is not a valid key for the '") + _group.__get__name()) + "' group.");
return(undefined);
}
lookup_keys[_group.getKeyID(key)] = 1;
clearCache();
}
function includeRating(rating) {
if (!_group.getRatingID(rating)) {
trace(((("[SaveGroupQuery Error] :: '" + rating) + "' is not a valid rating for the '") + _group.__get__name()) + "' group.");
return(undefined);
}
lookup_ratings[_group.getRatingID(rating)] = 1;
clearCache();
}
function groupBy(field) {
addGroupItem(TABLE_FILES, field);
}
function groupByKey(key) {
if (!_group.getKeyID(key)) {
error(((("'" + key) + "' is not a valid key for the '") + _group.getName()) + "' _group");
return(undefined);
}
addGroupItem(TABLE_KEYS, _group.getKeyID(key));
}
function groupByRating(rating) {
if (!_group.getRatingID(rating)) {
error(((("'" + rating) + "' is not a valid rating for the '") + _group.getName()) + "' _group");
return(undefined);
}
addGroupItem(TABLE_RATINGS, _group.getRatingID(rating));
}
function addGroupItem(table, field) {
_group_by.push({table:table, field:field});
clearCache();
}
function excludeKey(key) {
delete lookup_keys[_group.getKeyID(key)];
clearCache();
}
function excludeRating(rating) {
delete lookup_ratings[_group.getRatingID(rating)];
clearCache();
}
function addCondition(field, operator, value) {
if (((field == "FILE_STATUS") && (typeof(value) == "string")) && (!(com.newgrounds.SaveFile.STATUS[value.toUpperCase()] === undefined))) {
value = com.newgrounds.SaveFile.STATUS[value.toUpperCase()];
}
if (operator == "==") {
operator = "=";
}
if ((!validateOperator(operator)) or (!validateValue(field, value))) {
return(undefined);
}
file_conditions.push({field:field, operator:operator, value:value});
clearCache();
}
function addKeyCondition(key, operator, value) {
if (!_group.getKeyID(key)) {
error(((("'" + key) + "' is not a valid key for the '") + _group.getName()) + "' save _group");
} else if ((!validateOperator(operator)) or (!validateKeyValue(key, value))) {
return(undefined);
}
key_conditions.push({key_id:_group.getKeyID(key), operator:operator, value:value});
clearCache();
}
function addRatingCondition(rating, operator, value, column) {
if (!column) {
column = "SCORE";
}
if (!_group.getRatingID(rating)) {
error(((("'" + rating) + "' is not a valid rating for the '") + _group.getName()) + "' save _group");
} else {
if (!validateOperator(operator)) {
return(undefined);
}
if (!com.newgrounds.ValidationTools.isNumber(value)) {
error(("Expected numeric value for rating '" + rating) + "'");
return(undefined);
}
}
if (!rating_columns[column]) {
var _local2 = [];
for (var _local3 in rating_columns) {
_local2.push(_local3);
}
error((("Invalid rating column '" + column) + "'. Valid columns are ") + _local2.join(", "));
return(undefined);
}
rating_conditions.push({rating_id:_group.getRatingID(rating), operator:operator, value:value, column:rating_columns[column]});
clearCache();
}
function sortOn(field, order) {
if (!file_fields[field]) {
var _local2 = [];
for (var _local3 in file_fields) {
_local2.push(_local3);
}
error((("'" + field) + "' is not a valid sort field. Valid fields are: ") + _local2.join(", "));
return(undefined);
}
addSortCondition(TABLE_FILES, field, order);
}
function sortOnKey(key, order) {
if (!_group.getKeyID(key)) {
error(((("'" + key) + "' is not a valid key for the '") + _group.getName()) + "' _group");
return(undefined);
}
addSortCondition(TABLE_KEYS, _group.getKeyID(key), order);
}
function sortOnRating(rating, order, column) {
if (!_group.getRatingID(rating)) {
error(((("'" + rating) + "' is not a valid rating for the '") + _group.getName()) + "' _group");
return(undefined);
}
if (!column) {
column = "score";
}
addSortCondition(TABLE_RATINGS, _group.getRatingID(rating), order, column);
}
function sortOnRatingScore(rating, order) {
sortOnRating(rating, order, "score");
}
function sortOnRatingVotes(rating, order) {
sortOnRating(rating, order, "votes");
}
function addSortCondition(table, field, order, extra) {
var _local7;
if (((!order) or (order == "")) or (order.toUpperCase() == "ASC")) {
_local7 = false;
} else if (order.toUpperCase() == "DESC") {
_local7 = true;
} else {
error(("'" + order) + "' is not a valid sort order!");
return(undefined);
}
var _local3 = {table:table, field:field, desc:_local7};
if (extra) {
_local3.extra = extra;
}
sort_conditions.push(_local3);
clearCache();
}
function onExecuted(results) {
_results = [];
var _local6 = 0;
while (_local6 < results.length) {
var _local2 = results[_local6];
var _local3 = new com.newgrounds.SaveFile(_group);
_local3.setName(_local2.filename);
_local3.setID(_local2.save_id);
_local3.setDescription(_local2.description);
_local3.setThumbnailURL(_local2.thumb);
_local3.setFileURL(_local2.file);
_local3.setPermissions(_local2.status, _local2.locked);
var _local5 = 0;
while (_local5 < _local2.keys.length) {
_local3.setKey(_local2.keys[_local5].id, _local2.keys[_local5].value);
_local5++;
}
var _local4 = 0;
while (_local4 < _local2.ratings.length) {
_local3.setRating(_local2.ratings[_local4].id, _local2.ratings[_local4].votes, _local2.ratings[_local4].score);
_local4++;
}
getGroup().addFile(_local3);
_results.push(_local3);
_local6++;
}
callEventDispatcher();
}
function hasResults() {
return(_results && (_results.length > 0));
}
function callEventDispatcher() {
com.newgrounds.API.callListener(com.newgrounds.APIEvent.QUERY_COMPLETE, true, {query:this});
}
function execute() {
if (hasResults() && (!isRandomized())) {
callEventDispatcher();
return(undefined);
}
com.newgrounds.API.lookupSaveFiles(_group);
}
function processResults(files) {
return(null);
}
function validateKeyValue(key, value) {
var _local3 = _group.getKeyType(key);
if (_local3) {
var _local2 = com.newgrounds.SaveGroup.KEY_TYPES[_local3];
if ((_local2 == "float") and com.newgrounds.ValidationTools.isFloat(value)) {
return(true);
}
if ((_local2 == "integer") and com.newgrounds.ValidationTools.isInteger(value)) {
return(true);
}
if ((_local2 == "string") and com.newgrounds.ValidationTools.isString(value)) {
return(true);
}
error(((("Expected type " + _local2) + " for key '") + key) + "'");
}
return(false);
}
function validateValue(field, value) {
if (file_fields[field]) {
if ((file_fields[field].type == "integer") and com.newgrounds.ValidationTools.isInteger(value)) {
return(true);
}
if ((file_fields[field].type == "float") and com.newgrounds.ValidationTools.isFloat(value)) {
return(true);
}
if ((file_fields[field].type == "string") and com.newgrounds.ValidationTools.isString(value)) {
return(true);
}
error(((("Expecting " + file_fields[field].type) + " value on '") + field) + "' condition");
} else {
var _local2 = [];
for (var _local4 in file_fields) {
_local2.push(_local4);
}
error((("'" + field) + "' is not a searchable field. Valid fields are: ") + _local2.join(", "));
}
return(false);
}
function validateOperator(operator) {
var _local2 = 0;
while (_local2 < valid_operators.length) {
if (operator == valid_operators[_local2]) {
return(true);
}
_local2++;
}
error((("'" + operator) + "' is not a valid lookup operation. Valid operations are: ") + valid_operators.join(", "));
return(false);
}
function error(msg) {
trace("[QUERY ERROR] :: " + msg);
}
static var TABLE_FILES = 1;
static var TABLE_KEYS = 2;
static var TABLE_RATINGS = 3;
var _results = [];
static var file_fields = {AUTHOR_ID:{id:1, field:"user_id", type:"integer"}, AUTHOR_NAME:{id:2, field:"user_name", type:"string"}, FILE_NAME:{id:3, field:"file_name", type:"string"}, CREATED_ON:{id:4, field:"created", type:"string"}, UPDATED_ON:{id:5, field:"last_update", type:"string"}, TOTAL_VIEWS:{id:6, field:"views", type:"integer"}, FILE_STATUS:{id:7, field:"status", type:"integer"}};
static var rating_columns = {TOTAL_VOTES:"votes", SCORE:"score"};
static var valid_operators = ["=", "<", ">", "!=", "<>", "<=", ">="];
}
Symbol 171 MovieClip [__Packages.com.newgrounds.encoders.ImageScanner] Frame 0
class com.newgrounds.encoders.ImageScanner
{
var image_source, source_width, source_height, sourceBitmap, callback_target, callback_function, hash, cube, basen, xpos, ypos, pixels, busy, canvas_width, canvas_height, resizedBitmap, copyBitmap, output, draw_interval, callback_interval;
function ImageScanner (the_source) {
if (the_source) {
image_source = the_source;
} else {
image_source = _root;
}
reset();
if (typeof(image_source) == "movieclip") {
if (image_source == _root) {
source_width = Stage.width;
source_height = Stage.height;
} else {
source_width = Math.floor(image_source._width);
source_height = Math.floor(image_source._height);
}
sourceBitmap = new flash.display.BitmapData(source_width, source_height, false, 4294967295);
sourceBitmap.draw(_root);
} else if (image_source.width) {
source_width = image_source.width;
source_height = image_source.height;
sourceBitmap = image_source;
} else {
error("You can only use BitMaptData and MovieClip objects to create images");
}
}
function setCallback(target, funct) {
if (target && (funct)) {
callback_target = target;
callback_function = funct;
}
}
function reset() {
callback_target = null;
callback_function = null;
debug.bad_pixels = 0;
hash = "0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ<>?:;-_=+()!&";
var _local3 = Math.pow(hash.length, 2);
trace("MAX COLORS: " + _local3);
var _local2 = Math.floor(Math.pow(_local3, 0.333333333333333)) - 1;
var _local4 = Math.pow(_local2, 3);
cube = _local2;
basen = new com.newgrounds.encoders.BaseN(hash);
xpos = 0;
ypos = 0;
pixels = 0;
busy = false;
}
function startScan(w, h, s) {
if (w) {
image_width = w;
}
if (h) {
image_height = h;
}
if (s != undefined) {
crop = s;
}
var _local7 = _root.getNextHighestDepth();
var _local6 = _root.createEmptyMovieClip("API_image_container_" + _local7, _local7);
var _local5 = _local6.createEmptyMovieClip("canvas", 100);
_local5.attachBitmap(sourceBitmap, 100);
if (crop) {
if ((image_width / source_width) > (image_height / source_height)) {
canvas_width = image_width;
canvas_height = Math.ceil(source_height * (image_width / source_width));
} else {
canvas_height = image_height;
canvas_width = Math.ceil(source_width * (image_height / source_height));
}
} else {
canvas_width = image_width;
canvas_height = image_height;
}
_local5._x = Math.round((image_width - canvas_width) / 2);
_local5._width = canvas_width;
_local5._height = canvas_height;
resizedBitmap = new flash.display.BitmapData(image_width, image_height, false, 4294967295);
resizedBitmap.draw(_local6);
_local6.removeMovieClip();
copyBitmap = new flash.display.BitmapData(image_width, image_height, false, 4294967295);
var _local3 = "" + image_width;
while (_local3.length < 3) {
_local3 = "0" + _local3;
}
var _local4 = "" + image_height;
while (_local4.length < 3) {
_local4 = "0" + _local4;
}
output = _local3 + _local4;
draw_interval = setInterval(this, "drawChunk", 10);
busy = false;
return(resizedBitmap);
}
function getBitmapData() {
return(copyBitmap);
}
function getBytesTotal() {
return((image_width * image_height) * 2);
}
function getBytesScanned() {
return(pixels * 2);
}
function getProgress() {
return(Math.round((getBytesScanned() / getBytesTotal()) * 100));
}
function drawChunk() {
if (!busy) {
busy = true;
var _local2 = 0;
while (_local2 < pixels_per_chunk) {
if (!nextPixel()) {
clearInterval(draw_interval);
callback_interval = setInterval(this, "doCallback", 25);
busy = true;
break;
}
_local2++;
}
busy = false;
}
}
function doCallback() {
busy = false;
clearInterval(callback_interval);
if (callback_target and callback_function) {
callback_target[callback_function](output);
} else {
onScanComplete(output);
}
}
function onScanComplete(packet) {
sendMessage(("packet size: " + output.length) + " bytes", "onScanComplete");
}
function nextPixel() {
var _local15 = xpos;
var _local14 = ypos;
var _local7 = resizedBitmap.getPixel(_local15, _local14);
var _local17 = (_local7 >> 16) & 255;
var _local20 = (_local7 >> 8) & 255;
var _local16 = (_local7 >> 0) & 255;
var _local11 = Math.round(((_local17 + 1) / 256) * cube);
var _local10 = Math.round(((_local20 + 1) / 256) * cube);
var _local13 = Math.round(((_local16 + 1) / 256) * cube);
var _local12 = (((_local11 * (cube + 1)) * (cube + 1)) + (_local10 * (cube + 1))) + _local13;
var _local6 = basen.encode(_local12, 2);
output = output + _local6;
if (_local6.length != 2) {
trace("bad pixel " + _local6);
}
var _local5 = basen.decode(_local6);
var _local18 = _local5;
var _local8 = _local5 % (cube + 1);
_local5 = (_local5 - _local8) / (cube + 1);
var _local9 = _local5 % (cube + 1);
var _local19 = (_local5 - _local9) / (cube + 1);
if (((_local13 != _local8) and (_local10 != _local9)) and (_local11 != _local10)) {
debug.bad_pixels++;
trace((((((("BAD PIXEL " + debug.bad_pixels) + ") ") + _local12) + " != ") + _local18) + " ") + _local6);
trace(basen.debug.lastencode);
}
var _local2 = Math.round((_local19 / cube) * 255).toString(16);
var _local4 = Math.round((_local9 / cube) * 255).toString(16);
var _local3 = Math.round((_local8 / cube) * 255).toString(16);
while (_local2.length < 2) {
_local2 = "0" + _local2;
}
while (_local4.length < 2) {
_local4 = "0" + _local4;
}
while (_local3.length < 2) {
_local3 = "0" + _local3;
}
copyBitmap.setPixel(_local15, _local14, Number((("0x" + _local2) + _local4) + _local3));
pixels++;
if (pixels >= (image_width * image_height)) {
return(false);
}
xpos++;
if (xpos >= image_width) {
xpos = 0;
ypos++;
}
return(true);
}
function error(e, f) {
sendMessage(e, f, "ERROR");
}
function sendMessage(msg, func, type) {
var _local1 = "ImageScanner";
if (func) {
_local1 = _local1 + (("." + func) + "()");
}
if (type) {
_local1 = (type + " in ") + _local1;
}
_local1 = _local1 + (" :: " + msg);
trace(_local1);
}
var image_width = 100;
var image_height = 100;
var crop = true;
var pixels_per_chunk = 500;
var debug = new Object();
}
Symbol 170 MovieClip [__Packages.com.newgrounds.encoders.BaseN] Frame 0
class com.newgrounds.encoders.BaseN
{
var ceiling, hashIndex, bitSize, hashVal, i;
function BaseN (hash) {
ceiling = 100000000000000;
if (hash) {
hashIndex = hash;
} else {
hashIndex = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/";
}
bitSize = hashIndex.length;
hashVal = new Object();
i = 0;
while (i < bitSize) {
hashVal[hashIndex.charAt(i)] = i;
i++;
}
}
function verify(s) {
if (hashVal[s] != undefined) {
return(true);
}
return(false);
}
function encode(n, minchars) {
debug.lastencode = "";
if (typeof(i) != "string") {
n = n.toString();
}
if (n.charAt(0) == "-") {
var _local3 = "-";
n = n.substring(1);
} else {
var _local3 = "";
}
if (String(n).indexOf(".") > -1) {
var _local4 = String(n).split(".", 2);
return(((_local3 + baseNEncoder(_local4[0], minchars)) + ".") + baseNEncoder(_local4[1]));
}
debug.lastencode = debug.lastencode + "\tNo decimal\r";
return(_local3 + baseNEncoder(n, minchars));
}
function decode(s) {
var _local4 = 1;
if (s.charAt(0) == "-") {
_local4 = -1;
s = s.substring(1, s.length);
}
var _local3 = s.indexOf(".");
if (_local3 > -1) {
var _local5 = Math.pow(10, baseNDecoder(s.substring(_local3 + 1, s.length)));
return((baseNDecoder(s.substring(0, _local3)) / _local5) * _local4);
}
return(baseNDecoder(s) * _local4);
}
function baseNEncoder(n, minchars) {
if (!minchars) {
minchars = 1;
}
var _local4 = "";
while (n != 0) {
n = Math.round(n);
var _local3 = n % bitSize;
if (Math.round(_local3) != _local3) {
trace((((((((("BaseN failed on " + n) + "%") + bitSize) + " = ") + _local3) + " ") + int(n)) + " ") + int(bitSize));
}
_local4 = hashIndex.charAt(_local3) + _local4;
debug.lastencode = debug.lastencode + (((((((("\t-> n:" + n) + " % bitSize:") + bitSize) + " = ") + _local3) + ", final char=") + _local4) + newline);
n = n - _local3;
n = n / bitSize;
}
if (minchars) {
while (_local4.length < minchars) {
_local4 = hashIndex.charAt(0) + _local4;
}
}
return(_local4);
}
function baseNDecoder(s) {
var _local2 = 0;
var _local6 = 0;
i = 0;
while (i < s.length) {
var _local3 = s.charAt((s.length - i) - 1);
if (_local3 == hashIndex.charAt(0)) {
var _local5 = 0;
} else {
var _local5 = hashVal[_local3] * Math.pow(bitSize, i);
}
_local2 = _local2 + _local5;
if (_local2 >= ceiling) {
_local6 = _local6 + ((_local2 - (_local2 % ceiling)) / ceiling);
_local2 = _local2 % ceiling;
}
i++;
}
if (_local6 > 0) {
_local2 = "" + _local2;
while (_local2.length < (ceiling.toString().length - 1)) {
_local2 = "0" + _local2;
}
_local2 = ("" + _local6) + _local2;
}
return(_local2);
}
var debug = new Object();
}
Symbol 179 MovieClip [__Packages.com.newgrounds.APIEventDispatcher] Frame 0
class com.newgrounds.APIEventDispatcher
{
function APIEventDispatcher () {
}
function addEventListener(event, callback, target) {
if (!target) {
throw "Attempted to create a listener without providing a target object.";
}
if (!listeners[event]) {
listeners[event] = [];
} else {
removeEventListener(event, target);
}
listeners[event].push({target:target, callback:callback});
}
function removeEventListener(event, target) {
if (!target) {
throw "Attempted to remove a listener without providing a target object.";
}
if ((!listeners[event]) || (listeners[event].length < 1)) {
return(undefined);
}
var _local4 = [];
var _local2 = 0;
while (_local2 < listeners[event].length) {
if (listeners[event][_local2].target != target) {
_local4.push(listeners[event][_local2]);
}
_local2++;
}
listeners[event] = _local4;
}
function dispatchEvent(event) {
if (!hasEventListener(event.__get__type())) {
return(false);
}
collectGarbage(event.__get__type());
var _local2 = 0;
while (_local2 < listeners[event.__get__type()].length) {
var _local4 = listeners[event.__get__type()][_local2].callback;
if (listeners[event.__get__type()][_local2].target) {
var _local5 = listeners[event.__get__type()][_local2].target;
_local4.call(_local5, event);
} else {
_local4(event);
}
_local2++;
}
return(true);
}
function hasEventListener(event) {
return((listeners[event] != undefined) && (listeners[event].length > 0));
}
function collectGarbage(event) {
var _local5 = [];
if (!hasEventListener) {
return(undefined);
}
var _local2 = 0;
while (_local2 < listeners[event].length) {
var _local4 = listeners[event][_local2].target;
if (_local4) {
_local5.push(listeners[event][_local2]);
}
_local2++;
}
listeners[event] = _local5;
}
var listeners = {};
}
Symbol 162 MovieClip [__Packages.com.newgrounds.APIEvent] Frame 0
class com.newgrounds.APIEvent
{
var _type, _target, _success, data;
function APIEvent (type, success, target, data) {
_type = type;
_target = target;
_success = success;
this.data = data;
}
function get target() {
return(_target);
}
function get type() {
return(_type);
}
function get success() {
return(_success);
}
static var MOVIE_CONNECTED = "movieConnected";
static var ADS_APPROVED = "adsApproved";
static var AD_ATTACHED = "adAttached";
static var HOST_BLOCKED = "hostBlocked";
static var NEW_VERSION_AVAILABLE = "newVersionAvailable";
static var EVENT_LOGGED = "eventLogged";
static var SCORE_POSTED = "scorePosted";
static var SCORES_LOADED = "scoresLoaded";
static var UNLOCK_MEDAL = "unlockMedal";
static var MEDAL_UNLOCKED = "medalUnlocked";
static var MEDALS_LOADED = "medalsLoaded";
static var METADATA_LOADED = "metadataLoaded";
static var FILE_PRIVS_LOADED = "filePrivsLoaded";
static var FILE_SAVED = "fileSaved";
static var FILE_LOADED = "fileLoaded";
static var QUERY_COMPLETE = "queryComplete";
static var VOTE_COMPLETE = "voteComplete";
static var API_ERROR = "apiError";
static var UNCAUGHT_EVENT = "uncaughtEvent";
}
Symbol 176 MovieClip [__Packages.com.newgrounds.ScoreBoard] Frame 0
class com.newgrounds.ScoreBoard
{
var _name, _id, _scores;
function ScoreBoard (id, name) {
_name = name;
_id = id;
}
function exists() {
return(Number(_id) > 0);
}
function get id() {
return(_id);
}
function get name() {
return(_name);
}
function get period() {
return(_period);
}
function get page() {
return(_page);
}
function get num_results() {
return(_num_results);
}
function get scores() {
return(_scores);
}
function postScore(value, get_best) {
com.newgrounds.API.postScore(_name, value, get_best);
}
function loadScores(period, page, num_results) {
if (period) {
_period = period;
}
if (page) {
_page = page;
}
if (num_results) {
_num_results = num_results;
}
_scores = [];
com.newgrounds.API.loadScores(this);
}
function setScores(scores, period, page, num_results) {
if (period) {
_period = period;
}
if (page) {
_page = page;
}
if (num_results) {
_num_results = num_results;
}
_scores = [];
var _local2 = 0;
while (_local2 < scores.length) {
var _local4 = ((_num_results * (_page - 1)) + 1) + _local2;
_scores.push(new com.newgrounds.Score(this, _local4, scores[_local2].username, scores[_local2].value, scores[_local2].numeric_value));
_local2++;
}
}
var _period = "Today";
var _num_results = 10;
var _page = 1;
}
Symbol 163 MovieClip [__Packages.com.newgrounds.APIError] Frame 0
class com.newgrounds.APIError
{
var message, name, alias;
function APIError (error, msg) {
if (Number(error).toString() == String(error)) {
error = Number(error);
} else if (error_codes[String(error)]) {
error = error_codes[String(error)];
} else {
error = 0;
}
code = error;
message = msg;
name = error_names[error];
alias = aliases[error];
}
static function init_codes() {
var _local2 = new Object();
var _local1 = 0;
while (_local1 < aliases.length) {
_local2[aliases[_local1]] = _local1;
_local1++;
}
return(_local2);
}
static function init_names() {
var _local5 = new Array();
var _local3 = 0;
while (_local3 < aliases.length) {
var _local2 = aliases[_local3].toLowerCase().split("_");
var _local1 = 0;
while (_local1 < _local2.length) {
_local2[_local1] = _local2[_local1].substr(0, 1).toUpperCase() + _local2[_local1].substr(1, _local2[_local1].length);
for (var _local4 in always_caps) {
if (_local2[_local1].toUpperCase() == always_caps[_local4]) {
_local2[_local1] = _local2[_local1].toUpperCase();
}
}
_local1++;
}
_local5[_local3] = _local2.join(" ");
_local3++;
}
return(_local5);
}
function isError() {
return(true);
}
static var aliases = new Array("UNKNOWN_ERROR", "INVALID_API_ID", "MISSING_PARAM", "INVALID_STAT_ID", "INVALID_COMMAND_ID", "FLASH_ADS_NOT_APPROVED", "PERMISSION_DENIED", "IDENTIFICATION_REQUIRED", "INVALID_EMAIL_ADDRESS", "BANNED_USER", "SESSION_EXPIRED", "INVALID_SCORE", "INVALID_MEDAL", "INVALID_SAVE_GROUP", "FILE_NOT_FOUND", "SITE_ID_REQUIRED", "UPLOAD_IN_PROGRESS", "USER_CANCELLED", "CONFIRM_REQUEST", "ILLEGAL_REQUEST", "CONNECTION_FAILED", "QUERY_INCOMPLETE", "SAVE_FILE_ERROR", "INVALID_VALUE", "SERVER_ERROR");
static var always_caps = new Array("API", "URL", "ID");
static var error_codes = init_codes();
static var error_names = init_names();
var code = 0;
}
Symbol 118 MovieClip [__Packages.com.newgrounds.components.ScoreTable] Frame 0
class com.newgrounds.components.ScoreTable
{
var board_name, board, period, period_select;
function ScoreTable () {
if (!board_name) {
throw "[ERROR] :: Score Board components require the 'Board Name' parameter to be populated";
}
var _local2 = com.newgrounds.API.getScoreBoard(board_name);
if (_local2.exists()) {
board = _local2;
} else {
trace(("[WARNING] :: Could not initialize the scoreboard for '" + board_name) + "'.");
}
period_select.period = period;
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.SCORES_LOADED, scoresLoaded, this);
}
function loadScores(numresults, p) {
if (numresults) {
num_results = numresults;
}
if (p) {
period = p;
}
var _local3 = 0;
while (_local3 < num_results) {
var _local2 = this["score_row_" + _local3];
_local2.gotoAndStop((((_local3 % 2) == 0) ? 1 : 2));
_local2.position = "";
_local2.username = "";
_local2.score = "";
_local3++;
}
board.loadScores(period, 1, num_results);
}
function scoresLoaded(event) {
if (event.data.board.id != board.__get__id()) {
return(undefined);
}
var _local2 = 0;
while (_local2 < num_results) {
var _local3 = this["score_row_" + _local2];
if (board.__get__scores()[_local2]) {
_local3.position = board.__get__scores()[_local2].position + ":";
_local3.username = board.__get__scores()[_local2].username;
_local3.score = board.__get__scores()[_local2].value;
} else {
_local3.position = "";
_local3.username = "";
_local3.score = "";
}
_local2++;
}
}
var num_results = 10;
}
Symbol 168 MovieClip [__Packages.com.newgrounds.ValidationTools] Frame 0
class com.newgrounds.ValidationTools
{
function ValidationTools () {
}
static function isNumber(v) {
if (typeof(v) == "number") {
return(true);
}
if ((typeof(v) == "string") and (Number(v).toString() == v)) {
return(true);
}
return(false);
}
static function isInteger(v) {
if (isNumber(v)) {
v = Number(v);
return(Math.floor(v) == v);
}
return(false);
}
static function isFloat(v) {
return(isNumber(v));
}
static function isString(v) {
if ((typeof(v) == "string") or (typeof(v) == "number")) {
return(true);
}
return(false);
}
static function isEmpty(o) {
for (var _local2 in o) {
return(false);
}
return(true);
}
}
Symbol 172 MovieClip [__Packages.com.newgrounds.encoders.SerialXML] Frame 0
class com.newgrounds.encoders.SerialXML
{
function SerialXML () {
}
static function decode(xml) {
if (!(xml instanceof XML)) {
xml = new XML(xml);
}
var _local2 = populateObject(xml.firstChild, {});
return(_local2.DATA);
}
static function encode(obj) {
var _local1 = new XML();
populateXML(_local1, obj, "DATA");
return(_local1);
}
static function populateObject(child, object) {
var _local6 = child.nodeName;
var _local5 = getValue(_local6, child.attributes.v);
var _local4 = child.attributes.n;
if (object instanceof Array) {
_local4 = object.length;
object.push(_local5);
} else {
object[_local4] = _local5;
}
if (child.hasChildNodes()) {
var _local1 = 0;
while (_local1 < child.childNodes.length) {
populateObject(child.childNodes[_local1], object[_local4]);
_local1++;
}
}
return(object);
}
static function populateXML(child, obj, name) {
if (obj === undefined) {
return(undefined);
}
var _local5 = new XML();
var _local2;
if (obj instanceof Array) {
_local2 = _local5.createElement(getType(obj));
if (name) {
_local2.attributes.n = name;
}
child.appendChild(_local2);
var _local4 = 0;
while (_local4 < obj.length) {
populateXML(_local2, obj[_local4]);
_local4++;
}
} else if (typeof(obj) == "object") {
_local2 = _local5.createElement(getType(obj));
if (name) {
_local2.attributes.n = name;
}
child.appendChild(_local2);
for (var _local4 in obj) {
populateXML(_local2, obj[_local4], _local4);
}
} else {
_local2 = _local5.createElement(getType(obj));
if (name) {
_local2.attributes.n = name;
}
if (getType(obj).length == 1) {
_local2.attributes.v = obj;
}
child.appendChild(_local2);
}
}
static function getValue(type, stringval) {
switch (type.toUpperCase()) {
case "O" :
return(new Object());
case "A" :
return(new Array());
case "N" :
return(Number(stringval));
case "S" :
return(String(stringval));
case "TRUE" :
return(true);
case "FALSE" :
return(false);
}
return(null);
}
static function getType(obj) {
switch (((obj instanceof Array) ? "array" : (typeof(obj)))) {
case "array" :
return("A");
case "object" :
return("O");
case "string" :
return("S");
case "number" :
return("N");
case "boolean" :
return(((obj === true) ? "TRUE" : "FALSE"));
}
return("NULL");
}
}
Symbol 173 MovieClip [__Packages.com.newgrounds.encoders.LZW2] Frame 0
class com.newgrounds.encoders.LZW2
{
static var comp_dict, pos, result, buffer, nbChar, splitStr, len, local, interval;
function LZW2 () {
}
static function doCompressorConfig() {
comp_dict = [];
var _local1 = 0;
while (_local1 < 256) {
comp_dict[String.fromCharCode(_local1)] = _local1;
_local1++;
}
comp_dict["<"] = 256;
comp_dict[">"] = 257;
comp_dict["&"] = 258;
comp_dict["\""] = 259;
comp_dict["'"] = 260;
pos = 0;
result = "";
buffer = "";
nbChar = 256 + skipnum;
}
static function compress(string, callback, callback_params) {
doCompressorConfig();
if (busy) {
trace("[LZW COMPRESSOR] :: Compression can not begin until previous compression or decompression is complete!");
return(undefined);
}
splitStr = string.split("");
string = "";
len = splitStr.length;
local = {delay:30, callback:callback, callback_params:callback_params, compress_chunk:function () {
com.newgrounds.encoders.LZW2.compress_chunk();
}, busy:false, complete:false};
interval = setInterval(local, "compress_chunk", 5);
}
static function getProgress() {
return(Math.round((pos / len) * 100));
}
static function compress_chunk() {
if (local.delay > 0) {
local.delay--;
} else if (!local.busy) {
local.busy = true;
var _local1 = 0;
while (_local1 < max_chunk_length) {
encode_next();
if (local.complete) {
break;
}
_local1++;
}
local.busy = false;
}
if (local.complete) {
trace((((((((("LZW2 complete " + nbChar) + " ") + comp_dict.length) + " ") + len) + " ") + pos) + " ") + skipnum);
clearInterval(interval);
local.callback(result, local.callback_params);
result = "";
buffer = "";
}
}
static function encode_next() {
if (pos <= len) {
var _local1 = splitStr[pos];
if (!(comp_dict[buffer + _local1] === undefined)) {
buffer = buffer + _local1;
} else {
result = result + String.fromCharCode(comp_dict[buffer]);
comp_dict[buffer + _local1] = nbChar;
nbChar++;
buffer = _local1;
}
pos++;
} else {
local.complete = true;
return(undefined);
}
}
static var comp_config = false;
static var skipnum = 5;
static var busy = false;
static var max_chunk_length = 12000;
}
Symbol 174 MovieClip [__Packages.com.newgrounds.encoders.LZW] Frame 0
class com.newgrounds.encoders.LZW
{
function LZW () {
}
static function setXMLSafe(x) {
xmlsafe = x;
}
static function compress(str, escape_chars) {
var _local2 = new Array();
var _local11 = (xmlsafe ? 5 : 0);
var _local5 = 0;
while (_local5 < 256) {
_local2[String.fromCharCode(_local5)] = _local5;
_local5++;
}
if (xmlsafe) {
_local2["<"] = 256;
_local2[">"] = 257;
_local2["&"] = 258;
_local2["\""] = 259;
_local2["'"] = 260;
}
var _local7 = "";
var _local8 = str.split("");
var _local9 = _local8.length;
var _local6 = 256 + _local11;
var _local1 = "";
var _local4;
_local5 = 0;
while (_local5 <= _local9) {
var _local3 = _local8[_local5];
if (!(_local2[_local1 + _local3] === undefined)) {
_local1 = _local1 + _local3;
} else {
_local4 = String.fromCharCode(_local2[_local1]);
if (escape_chars and (((_local2[_local1] < 33) or (_local2[_local1] > 126)) or (_local4 == "%"))) {
_local4 = escape(_local4);
}
_local7 = _local7 + _local4;
_local2[_local1 + _local3] = _local6;
_local6++;
_local1 = _local3;
}
_local5++;
}
return(_local7);
}
static function decompress(str) {
var _local4 = new Array();
var _local10 = (xmlsafe ? 5 : 0);
var _local6 = 0;
while (_local6 < 256) {
var _local9 = String.fromCharCode(_local6);
_local4[_local6] = _local9;
_local6++;
}
if (xmlsafe) {
_local4[256] = "<";
_local4[257] = ">";
_local4[258] = "&";
_local4[259] = "\"";
_local4[260] = "'";
}
var _local11 = str;
var _local13 = _local11.split("");
var _local12 = _local13.length;
var _local7 = 256 + _local10;
var _local1 = "";
var _local2 = "";
var _local8 = "";
_local6 = 0;
while (_local6 < _local12) {
var _local5 = _local11.charCodeAt(_local6);
var _local3 = _local4[_local5];
if (_local1 == "") {
_local1 = _local3;
_local8 = _local8 + _local3;
} else if (_local5 <= (255 + _local10)) {
_local8 = _local8 + _local3;
_local2 = _local1 + _local3;
_local4[_local7] = _local2;
_local7++;
_local1 = _local3;
} else {
_local2 = _local4[_local5];
if (_local2 == undefined) {
_local2 = _local1 + _local1.slice(0, 1);
}
_local8 = _local8 + _local2;
_local4[_local7] = _local1 + _local2.slice(0, 1);
_local7++;
_local1 = _local2;
}
_local6++;
}
return(_local8);
}
static function compress_fp6(str) {
var _local3 = new Array();
var _local10 = (xmlsafe ? 5 : 0);
var _local4 = 0;
while (_local4 < 256) {
_local3[String(_local4)] = _local4;
_local4++;
}
if (xmlsafe) {
var _local14 = String(new String("<").charCodeAt(0));
var _local11 = String(new String(">").charCodeAt(0));
var _local13 = String(new String("&").charCodeAt(0));
var _local15 = String(new String("\"").charCodeAt(0));
var _local12 = String(new String("'").charCodeAt(0));
_local3[_local14] = 256;
_local3[_local11] = 257;
_local3[_local13] = 258;
_local3[_local15] = 259;
_local3[_local12] = 260;
}
var _local7 = "";
var _local16 = str;
var _local8 = _local16.split("");
var _local9 = _local8.length;
var _local6 = 256 + _local10;
var _local1 = new Array();
_local4 = 0;
while (_local4 <= _local9) {
var _local2 = _local8[_local4];
if (_local1.length == 0) {
var _local5 = String(_local2.charCodeAt(0));
} else {
var _local5 = (_local1.join("-") + "-") + String(_local2.charCodeAt(0));
}
if (!(_local3[_local5] === undefined)) {
_local1.push(_local2.charCodeAt(0));
} else {
_local7 = _local7 + String.fromCharCode(_local3[_local1.join("-")]);
_local3[_local5] = _local6;
_local6++;
_local1 = new Array();
_local1.push(_local2.charCodeAt(0));
}
_local4++;
}
return(_local7);
}
static var xmlsafe = false;
}
Symbol 175 MovieClip [__Packages.com.newgrounds.Medal] Frame 0
class com.newgrounds.Medal
{
var _medal_id, _medal_name, _medal_value, _medal_difficulty;
function Medal (id, name, value, difficulty, unlocked, _icon_url) {
if ((((id == undefined) || (name == undefined)) || (value == undefined)) || (difficulty == undefined)) {
com.newgrounds.API.fatalError("Medal instances require an id, name, value and difficulty");
}
_medal_id = id;
_medal_name = name;
_medal_value = value;
_medal_difficulty = difficulty;
if (unlocked) {
_medal_unlocked = true;
}
if (_icon_url) {
this._icon_url = _icon_url;
}
}
function get difficulty() {
return(difficulty_names[_medal_difficulty]);
}
function get difficultyId() {
return(_medal_difficulty);
}
function get icon_url() {
return(_icon_url);
}
function get id() {
return(_medal_id);
}
function get name() {
return(_medal_name);
}
function get unlocked() {
return(_medal_unlocked);
}
function get value() {
return(_medal_value);
}
function isUnlocked() {
return(_medal_unlocked);
}
function unlock() {
if (!isUnlocked()) {
com.newgrounds.API.unlockMedal(this);
}
}
function setUnlocked(u) {
_medal_unlocked = u;
}
function attachIcon(target, depth) {
if (!depth) {
depth = target.getNextHighestDepth();
}
var _local3 = target.createEmptyMovieClip("Asset_Medal_Icon_" + getID(), depth);
if (_icon_url) {
_local3.loadMovie(_icon_url);
} else {
var _local4 = flash.display.BitmapData.loadBitmap("Asset_default_medal_icon_" + getDifficulty(), depth);
_local3.attachBitmap(_local4, depth, true);
}
}
function getID() {
return(_medal_id);
}
function getName() {
return(_medal_name);
}
function getValue() {
return(_medal_value);
}
function getDifficulty(as_string) {
if (as_string) {
return(difficulty_names[_medal_difficulty]);
}
return(_medal_difficulty);
}
var _medal_unlocked = false;
var _icon_loaded = false;
var _icon_width = 50;
var _icon_height = 50;
var _icon_url = null;
static var difficulty_names = new Array(null, "Easy", "Moderate", "Challenging", "Difficult", "Brutal");
}
Symbol 177 MovieClip [__Packages.com.newgrounds.encoders.RC4] Frame 0
class com.newgrounds.encoders.RC4
{
function RC4 () {
}
static function encrypt(src, key) {
var _local3 = strToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(charsToHex(_local2));
}
static function encryptbin(src, key) {
var _local3 = strToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(_local2);
}
static function decrypt(src, key) {
var _local3 = hexToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(charsToStr(_local2));
}
static function initialize(pwd) {
var _local2 = 0;
var _local3;
var _local4 = pwd.length;
var _local1 = 0;
while (_local1 <= 255) {
mykey[_local1] = pwd[_local1 % _local4];
sbox[_local1] = _local1;
_local1++;
}
_local1 = 0;
while (_local1 <= 255) {
_local2 = ((_local2 + sbox[_local1]) + mykey[_local1]) % 256;
_local3 = sbox[_local1];
sbox[_local1] = sbox[_local2];
sbox[_local2] = _local3;
_local1++;
}
}
static function calculate(plaintxt, psw) {
initialize(psw);
var _local1 = 0;
var _local2 = 0;
var _local9 = new Array();
var _local7;
var _local5;
var _local6;
var _local3 = 0;
while (_local3 < plaintxt.length) {
_local1 = (_local1 + 1) % 256;
_local2 = (_local2 + sbox[_local1]) % 256;
_local5 = sbox[_local1];
sbox[_local1] = sbox[_local2];
sbox[_local2] = _local5;
var _local4 = (sbox[_local1] + sbox[_local2]) % 256;
_local7 = sbox[_local4];
_local6 = plaintxt[_local3] ^ _local7;
_local9.push(_local6);
_local3++;
}
return(_local9);
}
static function charsToHex(chars) {
var _local4 = new String("");
var _local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
var _local1 = 0;
while (_local1 < chars.length) {
_local4 = _local4 + (_local3[chars[_local1] >> 4] + _local3[chars[_local1] & 15]);
_local1++;
}
return(_local4);
}
static function hexToChars(hex) {
var _local3 = new Array();
var _local1 = ((hex.substr(0, 2) == "0x") ? 2 : 0);
while (_local1 < hex.length) {
_local3.push(parseInt(hex.substr(_local1, 2), 16));
_local1 = _local1 + 2;
}
return(_local3);
}
static function charsToStr(chars) {
var _local3 = new String("");
var _local1 = 0;
while (_local1 < chars.length) {
_local3 = _local3 + String.fromCharCode(chars[_local1]);
_local1++;
}
return(_local3);
}
static function strToChars(str) {
var _local3 = new Array();
var _local1 = 0;
while (_local1 < str.length) {
_local3.push(str.charCodeAt(_local1));
_local1++;
}
return(_local3);
}
static var sbox = new Array(255);
static var mykey = new Array(255);
}
Symbol 178 MovieClip [__Packages.com.newgrounds.encoders.JSON] Frame 0
class com.newgrounds.encoders.JSON
{
static var start, cache, interval;
function JSON () {
}
static function encode(arg, noquotes) {
var _local3;
var _local2;
var _local6;
var _local1 = "";
var _local4;
if (arg.isSServerVar()) {
var _local8 = "sservervariable";
} else {
var _local8 = typeof(arg);
}
switch (_local8) {
case "sservervariable" :
return("?" + arg.getEncodedValue());
case "object" :
if (arg) {
if (arg instanceof Array) {
_local2 = 0;
while (_local2 < arg.length) {
_local4 = encode(arg[_local2]);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + _local4;
_local2++;
}
return(("[" + _local1) + "]");
}
if (typeof(arg.toString) != "undefined") {
for (_local2 in arg) {
_local4 = arg[_local2];
if ((typeof(_local4) != "undefined") && (typeof(_local4) != "function")) {
_local4 = encode(_local4);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + ((encode(_local2) + ":") + _local4);
}
}
return(("{" + _local1) + "}");
}
}
return("null");
case "number" :
return((isFinite(arg) ? (String(arg)) : "null"));
case "string" :
_local6 = arg.length;
if (noquotes) {
var _local7 = "";
} else {
var _local7 = "\"";
}
_local1 = _local7;
_local2 = 0;
while (_local2 < _local6) {
_local3 = arg.charAt(_local2);
if (_local3 >= " ") {
if ((_local3 == "\\") || (_local3 == "\"")) {
_local1 = _local1 + "\\";
}
_local1 = _local1 + _local3;
} else {
switch (_local3) {
case "\b" :
_local1 = _local1 + "\\b";
break;
case "\f" :
_local1 = _local1 + "\\f";
break;
case newline :
_local1 = _local1 + "\\n";
break;
case "\r" :
_local1 = _local1 + "\\r";
break;
case "\t" :
_local1 = _local1 + "\\t";
break;
default :
_local3 = _local3.charCodeAt();
_local1 = _local1 + (("\\u00" + Math.floor(_local3 / 16).toString(16)) + (_local3 % 16).toString(16));
}
}
_local2 = _local2 + 1;
}
return(_local1 + _local7);
case "boolean" :
return(String(arg));
}
return("null");
}
static function background_encode(arg, callback) {
if (busy) {
trace("[Newgrounds Encoder] :: Cannot encode a new file until the previous file is completed");
return(false);
}
if (!callback) {
trace("[Newgrounds Encoder] :: Missing a callback function, skipping encode");
return(false);
}
busy = true;
var _local2 = new Date();
start = _local2.getTime();
cache = {busy:false, complete:false, arg:arg, target:arg, parents:[], encoded:"", callback:callback, encode_chunk:function () {
com.newgrounds.encoders.JSON.encode_chunk();
}};
if (getType(arg) == "object") {
cache.encoded = "{";
} else if (getType(arg) == "array") {
cache.encoded = "[";
}
interval = setInterval(cache, "encode_chunk", 25);
return(true);
}
static function background_decode(arg, callback) {
if (busy) {
trace("[Newgrounds Encoder] :: Cannot decode a new file until the previous file is completed");
return(false);
}
if (!callback) {
trace("[Newgrounds Encoder] :: Missing a callback function, skipping decode");
return(false);
}
busy = true;
var _local1 = new Date();
start = _local1.getTime();
cache = {busy:false, callback:callback, complete:false, arg:arg, pos:0, parents:["root"], target:null, scratch:"", decode_chunk:function () {
com.newgrounds.encoders.JSON.decode_chunk();
}};
interval = setInterval(cache, "decode_chunk", 25);
return(true);
}
static function decode(text) {
var at = 0;
var ch = " ";
var _value;
var _error = function (m) {
throw {name:"JSONError", message:m, at:at - 1, text:text};
};
var _next = function () {
ch = text.charAt(at);
at = at + 1;
return(ch);
};
var _white = function () {
while (ch) {
if (ch <= " ") {
_next();
} else if (ch == "/") {
switch (_next()) {
case "/" :
while ((_next() && (ch != newline)) && (ch != "\r")) {
}
break;
case "*" :
_next();
for(;;){
if (ch) {
if (ch == "*") {
if (_next() == "/") {
_next();
// unexpected jump
}
} else {
_next();
}
} else {
_error("Unterminated comment");
}
};
break;
default :
_error("Syntax error");
}
} else {
return;
}
}
};
var _string = function () {
var _local4;
var _local1 = "";
var _local3;
var _local2;
var _local5 = false;
if (ch == "\"") {
while (_next()) {
if (ch == "\"") {
_next();
return(_local1);
}
if (ch == "\\") {
switch (_next()) {
case "b" :
_local1 = _local1 + "\b";
break;
case "f" :
_local1 = _local1 + "\f";
break;
case "n" :
_local1 = _local1 + newline;
break;
case "r" :
_local1 = _local1 + "\r";
break;
case "t" :
_local1 = _local1 + "\t";
break;
case "u" :
_local2 = 0;
_local4 = 0;
while (_local4 < 4) {
_local3 = parseInt(_next(), 16);
if (!isFinite(_local3)) {
_local5 = true;
break;
}
_local2 = (_local2 * 16) + _local3;
_local4 = _local4 + 1;
}
if (_local5) {
_local5 = false;
break;
}
_local1 = _local1 + String.fromCharCode(_local2);
break;
default :
_local1 = _local1 + ch;
}
} else {
_local1 = _local1 + ch;
}
}
}
_error("Bad string");
};
var _array = function () {
var _local1 = [];
if (ch == "[") {
_next();
_white();
if (ch == "]") {
_next();
return(_local1);
}
while (ch) {
_local1.push(_value());
_white();
if (ch == "]") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad array");
};
var _object = function () {
var _local2;
var _local1 = {};
if (ch == "{") {
_next();
_white();
if (ch == "}") {
_next();
return(_local1);
}
while (ch) {
_local2 = _string();
_white();
if (ch != ":") {
break;
}
_next();
_local1[_local2] = _value();
_white();
if (ch == "}") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad object");
};
var _number = function () {
var _local1 = "";
var _local2;
if (ch == "-") {
_local1 = "-";
_next();
}
while ((ch >= "0") && (ch <= "9")) {
_local1 = _local1 + ch;
_next();
}
if (ch == ".") {
_local1 = _local1 + ".";
while ((_next() && (ch >= "0")) && (ch <= "9")) {
_local1 = _local1 + ch;
}
}
_local2 = 1 * _local1;
if (!isFinite(_local2)) {
_error("Bad number");
} else {
return(_local2);
}
};
var _word = function () {
switch (ch) {
case "t" :
if (((_next() == "r") && (_next() == "u")) && (_next() == "e")) {
_next();
return(true);
}
break;
case "f" :
if ((((_next() == "a") && (_next() == "l")) && (_next() == "s")) && (_next() == "e")) {
_next();
return(false);
}
break;
case "n" :
if (!(((_next() == "u") && (_next() == "l")) && (_next() == "l"))) {
break;
}
_next();
return(null);
}
_error("Syntax error");
};
_value = function () {
_white();
switch (ch) {
case "{" :
return(_object());
case "[" :
return(_array());
case "\"" :
return(_string());
case "-" :
return(_number());
}
return((((ch >= "0") && (ch <= "9")) ? (_number()) : (_word())));
};
return(_value());
}
static function getType(v) {
if (v instanceof Array) {
return("array");
}
return(typeof(v));
}
static function decode_chunk() {
if ((!cache.busy) && (!cache.complete)) {
cache.busy = true;
var _local1 = 0;
while (_local1 < decode_chunks) {
chunk_decoder();
if (cache.complete) {
break;
}
_local1++;
}
trace(Math.round((cache.pos / cache.arg.length) * 100) + "% decoded");
cache.busy = false;
}
if (cache.complete) {
var _local2 = new Date();
busy = false;
clearInterval(interval);
cache.callback(cache.root, _local2.getTime() - start);
cache.arg = "";
}
}
static function encode_chunk() {
if ((!cache.busy) && (!cache.complete)) {
cache.busy = true;
var _local1 = 0;
while (_local1 < encode_chunks) {
chunk_encoder();
if (cache.complete) {
break;
}
_local1++;
}
cache.busy = false;
}
if (cache.complete) {
var _local3 = new Date();
var _local2 = _local3.getTime();
busy = false;
clearInterval(interval);
cache.callback(cache.encoded, _local2 - start);
cache.encoded = "";
}
}
static function chunk_decoder() {
function _object() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (!com.newgrounds.encoders.JSON.cache.mode) {
com.newgrounds.encoders.JSON.cache.mode = "object";
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 != "\"") {
throw "Malformed object key in encoded string. Keys must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.JSON.cache.scratch = "";
_setTargetValue({});
} else if (_local1 == ",") {
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 != "\"") {
throw "Malformed object key in encoded string. Keys must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.JSON.cache.scratch = "";
} else if (_local1 == "}") {
_useParent();
} else if (_local1 == "\"") {
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 != ":") {
throw "Malformed object notation. Object keys and values must be separated by colons(:)";
}
_addParent(com.newgrounds.encoders.JSON.cache.scratch);
com.newgrounds.encoders.JSON.cache.mode = null;
} else {
if (_local1 == "\\") {
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
}
com.newgrounds.encoders.JSON.cache.scratch = com.newgrounds.encoders.JSON.cache.scratch + _local1;
}
com.newgrounds.encoders.JSON.cache.pos++;
}
function _array() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (!com.newgrounds.encoders.JSON.cache.mode) {
com.newgrounds.encoders.JSON.cache.mode = "array";
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
_setTargetValue([]);
if (_local1 != "]") {
_addArrayKey();
} else {
_useParent();
}
return(undefined);
}
if (_local1 == ",") {
_addArrayKey();
} else if (_local1 == "]") {
_useParent();
}
com.newgrounds.encoders.JSON.cache.pos++;
}
function _boolean() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 == "t") {
_setTargetValue(true);
com.newgrounds.encoders.JSON.cache.pos = com.newgrounds.encoders.JSON.cache.pos + 3;
} else if (_local1 == "f") {
_setTargetValue(false);
com.newgrounds.encoders.JSON.cache.pos = com.newgrounds.encoders.JSON.cache.pos + 4;
} else {
throw "Bool values must be true or false";
}
_useParent();
}
function _null() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 == "n") {
_setTargetValue(null);
com.newgrounds.encoders.JSON.cache.pos = com.newgrounds.encoders.JSON.cache.pos + 2;
} else {
throw "Null values must be null";
}
_useParent();
}
function _string() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (!com.newgrounds.encoders.JSON.cache.mode) {
if (_local1 != "\"") {
throw "Strings must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.JSON.cache.scratch = "";
com.newgrounds.encoders.JSON.cache.mode = "string";
} else if (_local1 == "\"") {
_setTargetValue(com.newgrounds.encoders.JSON.cache.scratch);
_useParent();
} else {
if (_local1 == "\\") {
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
switch (_local1) {
case "n" :
_local1 = newline;
break;
case "r" :
_local1 = newline;
break;
case "t" :
_local1 = "\t";
break;
case "u" :
_local1 = "\\" + _local1;
}
}
com.newgrounds.encoders.JSON.cache.scratch = com.newgrounds.encoders.JSON.cache.scratch + _local1;
}
com.newgrounds.encoders.JSON.cache.pos++;
}
function _number() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
var _local2 = "01234567890.-";
if (!com.newgrounds.encoders.JSON.cache.mode) {
com.newgrounds.encoders.JSON.cache.mode = "number";
com.newgrounds.encoders.JSON.cache.scratch = "";
}
if (_local2.indexOf(_local1) < 0) {
_setTargetValue(Number(com.newgrounds.encoders.JSON.cache.scratch));
_useParent();
} else {
com.newgrounds.encoders.JSON.cache.scratch = com.newgrounds.encoders.JSON.cache.scratch + _local1;
com.newgrounds.encoders.JSON.cache.pos++;
}
}
function _setTargetValue(newval) {
var _local2 = _getParent().obj;
var _local1 = com.newgrounds.encoders.JSON.cache.parents[com.newgrounds.encoders.JSON.cache.parents.length - 1];
_local2[_local1] = newval;
}
function _useParent() {
com.newgrounds.encoders.JSON.cache.mode = com.newgrounds.encoders.JSON.getType(_getParent().obj);
com.newgrounds.encoders.JSON.cache.parents.pop();
}
function _getParent() {
var _local2 = com.newgrounds.encoders.JSON.cache;
var _local1 = 0;
while (_local1 < (com.newgrounds.encoders.JSON.cache.parents.length - 1)) {
_local2 = _local2[com.newgrounds.encoders.JSON.cache.parents[_local1]];
_local1++;
}
return({obj:_local2, name:com.newgrounds.encoders.JSON.cache.parents[_local1]});
}
function _getCurrent() {
var _local2 = com.newgrounds.encoders.JSON.cache;
var _local1 = 0;
while (_local1 < com.newgrounds.encoders.JSON.cache.parents.length) {
_local2 = _local2[com.newgrounds.encoders.JSON.cache.parents[_local1]];
_local1++;
}
return({obj:_local2, name:com.newgrounds.encoders.JSON.cache.parents[_local1]});
}
function _addParent(child) {
com.newgrounds.encoders.JSON.cache.parents.push(child);
}
function _addArrayKey() {
var _local1 = _getCurrent().obj.length;
com.newgrounds.encoders.JSON.cache.parents.push(_local1);
com.newgrounds.encoders.JSON.cache.mode = null;
}
if (cache.pos >= cache.arg.length) {
cache.complete = true;
return(undefined);
}
if (cache.mode) {
eval ("_" + cache.mode)();
} else {
var char = cache.arg.charAt(cache.pos);
switch (char) {
case "{" :
_object();
return;
case "[" :
_array();
return;
case "\"" :
_string();
return;
case "n" :
_null();
return;
case "t" :
_boolean();
return;
case "f" :
_boolean();
return;
default :
_number();
}
}
}
static function chunk_encoder() {
if (cache.complete) {
return(undefined);
}
var _local2 = getType(cache.target);
switch (_local2) {
case "number" :
cache.encoded = cache.encoded + cache.target;
getParent();
break;
case "string" :
cache.encoded = cache.encoded + (("\"" + cache.target.split("\"").join("\\\"")) + "\"");
getParent();
break;
case "boolean" :
cache.encoded = cache.encoded + ((cache.target == true) ? "true" : "false");
getParent();
break;
case "null" :
cache.encoded = cache.encoded + "null";
getParent();
break;
case "array" :
if (cache.target.length < 1) {
cache.encoded = cache.encoded + "]";
getParent();
} else {
cache.parents.push(cache.target);
cache.target = cache.target[0];
if (getType(cache.target) == "array") {
cache.encoded = cache.encoded + "[";
} else if (getType(cache.target) == "object") {
cache.encoded = cache.encoded + "{";
}
}
break;
case "object" :
for (var _local1 in cache.target) {
break;
}
if (_local1 === undefined) {
cache.encoded = cache.encoded + "}";
getParent();
} else {
cache.parents.push(cache.target);
cache.target = cache.target[_local1];
cache.encoded = cache.encoded + (("\"" + _local1.split("\"").join("\\\"")) + "\":");
if (getType(cache.target) == "array") {
cache.encoded = cache.encoded + "[";
} else if (getType(cache.target) == "object") {
cache.encoded = cache.encoded + "{";
}
}
break;
default :
cache.encoded = cache.encoded + "null";
getParent();
}
}
static function getParent() {
if (cache.parents.length > 0) {
var _local1 = cache.parents.pop();
if (getType(_local1) == "array") {
_local1.shift();
} else {
for (var _local3 in _local1) {
delete _local1[_local3];
break;
}
}
if ((getType(_local1) == "object") or (getType(_local1) == "array")) {
for (var _local2 in _local1) {
break;
}
if (!(_local2 === undefined)) {
cache.encoded = cache.encoded + ",";
}
}
cache.target = _local1;
} else {
cache.complete = true;
}
}
static var encode_chunks = 20000;
static var decode_chunks = 20000;
static var busy = false;
}
Symbol 180 MovieClip [__Packages.com.newgrounds.encoders.MD5] Frame 0
class com.newgrounds.encoders.MD5
{
function MD5 () {
}
static function calculate(src) {
return(hex_md5(src));
}
static function hex_md5(src) {
return(binl2hex(core_md5(str2binl(src), src.length * 8)));
}
static function core_md5(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (len % 32));
x[(((len + 64) >>> 9) << 4) + 14] = len;
var _local4 = 1732584193 /* 0x67452301 */;
var _local3 = -271733879;
var _local2 = -1732584194;
var _local1 = 271733878 /* 0x10325476 */;
var _local5 = 0;
while (_local5 < x.length) {
var _local10 = _local4;
var _local9 = _local3;
var _local8 = _local2;
var _local7 = _local1;
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 0], 7, -680876936);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 1], 12, -389564586);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 2], 17, 606105819);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 3], 22, -1044525330);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 4], 7, -176418897);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 5], 12, 1200080426);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 6], 17, -1473231341);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 7], 22, -45705983);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 8], 7, 1770035416);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 9], 12, -1958414417);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 10], 17, -42063);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 11], 22, -1990404162);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 12], 7, 1804603682);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 13], 12, -40341101);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 14], 17, -1502002290);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 15], 22, 1236535329);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 1], 5, -165796510);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 6], 9, -1069501632);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 11], 14, 643717713);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 0], 20, -373897302);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 5], 5, -701558691);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 10], 9, 38016083);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 15], 14, -660478335);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 4], 20, -405537848);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 9], 5, 568446438);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 14], 9, -1019803690);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 3], 14, -187363961);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 8], 20, 1163531501);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 13], 5, -1444681467);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 2], 9, -51403784);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 7], 14, 1735328473);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 12], 20, -1926607734);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 5], 4, -378558);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 8], 11, -2022574463);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 11], 16, 1839030562);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 14], 23, -35309556);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 1], 4, -1530992060);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 4], 11, 1272893353);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 7], 16, -155497632);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 10], 23, -1094730640);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 13], 4, 681279174);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 0], 11, -358537222);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 3], 16, -722521979);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 6], 23, 76029189);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 9], 4, -640364487);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 12], 11, -421815835);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 15], 16, 530742520);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 2], 23, -995338651);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 0], 6, -198630844);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 7], 10, 1126891415);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 14], 15, -1416354905);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 5], 21, -57434055);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 12], 6, 1700485571);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 3], 10, -1894986606);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 10], 15, -1051523);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 1], 21, -2054922799);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 8], 6, 1873313359);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 15], 10, -30611744);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 6], 15, -1560198380);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 13], 21, 1309151649);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 4], 6, -145523070);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 11], 10, -1120210379);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 2], 15, 718787259);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 9], 21, -343485551);
_local4 = safe_add(_local4, _local10);
_local3 = safe_add(_local3, _local9);
_local2 = safe_add(_local2, _local8);
_local1 = safe_add(_local1, _local7);
_local5 = _local5 + 16;
}
return(new Array(_local4, _local3, _local2, _local1));
}
static function md5_cmn(q, a, b, x, s, t) {
return(safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
static function md5_ff(a, b, c, d, x, s, t) {
return(md5_cmn((b & c) | ((~b) & d), a, b, x, s, t));
}
static function md5_gg(a, b, c, d, x, s, t) {
return(md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
}
static function md5_hh(a, b, c, d, x, s, t) {
return(md5_cmn((b ^ c) ^ d, a, b, x, s, t));
}
static function md5_ii(a, b, c, d, x, s, t) {
return(md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
}
static function bit_rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
static function safe_add(x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
}
static function str2binl(str) {
var _local3 = new Array();
var _local4 = 255;
var _local1 = 0;
while (_local1 < (str.length * 8)) {
_local3[_local1 >> 5] = _local3[_local1 >> 5] | ((str.charCodeAt(_local1 / 8) & _local4) << (_local1 % 32));
_local1 = _local1 + 8;
}
return(_local3);
}
static function binl2hex(binarray) {
var _local4 = new String("");
var _local3 = new String("0123456789abcdef");
var _local1 = 0;
while (_local1 < (binarray.length * 4)) {
_local4 = _local4 + (_local3.charAt((binarray[_local1 >> 2] >> (((_local1 % 4) * 8) + 4)) & 15) + _local3.charAt((binarray[_local1 >> 2] >> ((_local1 % 4) * 8)) & 15));
_local1++;
}
return(_local4);
}
}
Symbol 181 MovieClip [__Packages.com.newgrounds.Score] Frame 0
class com.newgrounds.Score
{
var _board, _position, _username, _value, _numeric_value;
function Score (board, position, username, value, numeric_value) {
_board = board;
_position = position;
_username = username;
_value = value;
_numeric_value = numeric_value;
}
function get board() {
return(_board);
}
function get position() {
return(_position);
}
function get username() {
return(_username);
}
function get value() {
return(_value);
}
function get numeric_value() {
return(_numeric_value);
}
static function fromTime(time) {
var _local1 = time.split(":");
var _local2 = Math.round(Number(_local1.pop()) * 1000);
if (_local1.length > 0) {
_local2 = _local2 + (Number(_local1.pop()) * 60);
}
if (_local1.length > 0) {
_local2 = _local2 + (Number(_local1.pop()) * 3600);
}
return(_local2);
}
static function fromDistance(distance) {
var _local1 = distance.indexOf("'");
var _local5 = distance.indexOf("\"", _local1);
var _local3 = Number(distance.substr(0, _local1));
var _local4 = Number(distance.substring(_local1 + 1, _local5));
return(Math.round((_local3 * 12) + _local4));
}
}
Symbol 182 MovieClip [__Packages.com.newgrounds.components.APIConnector] Frame 0
class com.newgrounds.components.APIConnector extends MovieClip
{
var _x, _y, fake_session, movie_id, nextFrame, _visible, error_screens, medal_popups, debug, movie_version, local_data, encryption_key, stop, gotoframe_interval, _totalframes, _framesloaded, gotoAndStop;
function APIConnector () {
super();
_x = Math.round(_x);
_y = Math.round(_y);
if (fake_session and (com.newgrounds.API.getHost() == "localhost")) {
com.newgrounds.API.setFakeSession(true);
}
if (movie_id && (!com.newgrounds.API.isConnected())) {
(nextFrame());// not popped
_visible = false;
setGotoFrame("connecting");
if (error_screens) {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.NEW_VERSION_AVAILABLE, onNewVersion, this);
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.HOST_BLOCKED, onBadHost, this);
}
if (medal_popups) {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.UNLOCK_MEDAL, doUnlock, this);
}
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.MOVIE_CONNECTED, onConnected, this);
if (com.newgrounds.API.isPublishedHost()) {
debug = false;
}
if (movie_version) {
com.newgrounds.API.setMovieVersion(movie_version);
}
if (!com.newgrounds.API.hasUserSession()) {
var _local3 = com.newgrounds.API.loadLocal("api_connector_data");
if (_local3) {
local_data = _local3;
} else {
local_data = {medals_unlocked:new Array()};
}
}
com.newgrounds.API.setPreload(true);
com.newgrounds.API.connectMovie(movie_id, encryption_key, debug);
} else if (movie_id && (com.newgrounds.API.isConnected())) {
_visible = false;
setGotoFrame("done");
}
(stop());// not popped
}
function doUnlock(e) {
var _local5 = _root.attachMovie("NewgroundsAPIAsset_Medal_Popup", "Asset_Medal_Popup_" + e.data.medal.getID(), _root.getNextHighestDepth());
if (e.data.x != undefined) {
_local5._x = e.data.x + 254;
} else {
_local5._x = Stage.width;
}
if (e.data.x != undefined) {
_local5._y = e.data.y + 73;
} else {
_local5._y = Stage.height;
}
_local5.medal = e.data.medal;
var _local3 = com.newgrounds.API.getMedals();
var _local2 = 0;
while (_local2 < _local3.length) {
if ((_local3[_local2].getID() != e.data.medal.getID()) && (_root["medal_pop_" + _local3[_local2].getID()])) {
_root["medal_pop_" + _local3[_local2].getID()]._y = _root["medal_pop_" + _local3[_local2].getID()]._y - 70;
}
_local2++;
}
}
function onLoginError() {
var _local2 = _root.attachMovie("Asset_Login_Warning", "Asset_Login_Warning", _root.getNextHighestDepth());
}
function onConnectionError() {
var _local3 = _root.attachMovie("Asset_Connection_Error", "Asset_Connection_Error", _root.getNextHighestDepth());
setGotoFrame("done");
}
function onConnected(event, params) {
if (event.success) {
setGotoFrame("connected");
if (((error_screens && (com.newgrounds.API.isPublishedHost())) && (com.newgrounds.API.hasPublisher())) && (!com.newgrounds.API.hasUserSession())) {
onLoginError();
}
} else if (error_screens) {
onConnectionError();
}
}
function onNewVersion() {
var _local2 = _root.attachMovie("NewgroundsAsset_New_Version_Available", "NewgroundsAsset_New_Version_Available", _root.getNextHighestDepth());
_local2.official_version_url = com.newgrounds.API.getOfficialVersionURL();
}
function onBadHost() {
var _local2 = _root.attachMovie("NewgroundsAsset_Illegal_Host", "NewgroundsAsset_Illegal_Host", _root.getNextHighestDepth());
_local2.official_version_url = com.newgrounds.API.getOfficialVersionURL();
}
function setGotoFrame(frame) {
if (goto_frame == null) {
goto_frame = frame;
gotoframe_interval = setInterval(this, "gotoFrameIfLoaded", 50);
}
}
function gotoFrameIfLoaded() {
if ((goto_frame != null) && (_framesloaded == _totalframes)) {
_visible = true;
gotoAndStop(goto_frame);
goto_frame = null;
clearInterval(gotoframe_interval);
}
}
var goto_frame = null;
}
Symbol 310 MovieClip Frame 1
function freshMe() {
cul = new Color(col);
cul.setRGB(_root.armorarray[_root.curarmor]);
col.cacheAsBitmap = true;
col.setMask(masker);
col._alpha = 100;
}
if (!this.inited) {
freshMe();
this.inited = true;
}
Symbol 310 MovieClip Frame 16
gotoAndPlay ("rest");
Symbol 310 MovieClip Frame 32
gotoAndPlay ("walk");
Symbol 310 MovieClip Frame 36
stop();
Symbol 310 MovieClip Frame 41
_root.jumpRecover(this._parent);
Symbol 310 MovieClip Frame 44
_root.chkSlash(this.hitarea);
Symbol 310 MovieClip Frame 45
_root.chkSlash(this.hitarea);
Symbol 310 MovieClip Frame 47
_root.endAttack(this._parent);
stop();
Symbol 310 MovieClip Frame 50
_root.chkSlash(this.hitarea);
Symbol 310 MovieClip Frame 51
_root.chkSlash(this.hitarea);
Symbol 310 MovieClip Frame 53
_root.endAttack(this._parent);
stop();
Symbol 310 MovieClip Frame 55
_root.chkSlash(this.hitarea);
Symbol 310 MovieClip Frame 56
_root.chkSlash(this.hitarea);
Symbol 310 MovieClip Frame 59
_root.endAttack(this._parent);
stop();
Symbol 310 MovieClip Frame 63
stop();
Symbol 310 MovieClip Frame 70
_root.screenShake(10);
Symbol 310 MovieClip Frame 83
_root.endMagic(this._parent);
gotoAndPlay ("rest");
Symbol 310 MovieClip Frame 91
stop();
Symbol 310 MovieClip Frame 96
stop();
Symbol 310 MovieClip Frame 97
gotoAndPlay (97);
Symbol 310 MovieClip Frame 98
gotoAndPlay (98);
Symbol 310 MovieClip Frame 99
gotoAndPlay (99);
Symbol 310 MovieClip Frame 111
_root.flashIt();
Symbol 310 MovieClip Frame 125
stop();
_root.runMap();
Symbol 310 MovieClip Frame 140
stop();
Symbol 311 MovieClip [platdude] Frame 1
stop();
Symbol 311 MovieClip [platdude] Frame 2
gotoAndPlay(_currentframe);
Symbol 311 MovieClip [platdude] Frame 3
gotoAndPlay(_currentframe);
Symbol 311 MovieClip [platdude] Frame 4
gotoAndPlay(_currentframe);
Symbol 311 MovieClip [platdude] Frame 5
gotoAndPlay(_currentframe);
Symbol 311 MovieClip [platdude] Frame 6
gotoAndPlay(_currentframe);
Symbol 320 MovieClip [clack] Frame 5
this.removeMovieClip();
this.unloadMovie();
stop();
Symbol 326 MovieClip [combonums] Frame 2
_root.addxp(this.num.txt);
Symbol 326 MovieClip [combonums] Frame 24
stop();
this.unloadMovie();
this.removeMovieClip();
Symbol 328 MovieClip [fader] Frame 13
stop();
_root.fadedIn();
Symbol 332 MovieClip [points] Frame 6
stop();
Symbol 333 MovieClip [spark] Frame 1
this.cacheAsBitmap = true;
Symbol 335 MovieClip [spark2] Frame 1
this.cacheAsBitmap = true;
Symbol 351 MovieClip [splode] Frame 1
_root.chkSlash(this.hitarea, true);
Symbol 351 MovieClip [splode] Frame 23
stop();
this.removeMovieClip();
this.unloadMovie();
Symbol 363 MovieClip [splode2] Frame 1
this.dam = 50;
_root.dudeHit(this, this.hitarea);
Symbol 363 MovieClip [splode2] Frame 23
stop();
this.removeMovieClip();
this.unloadMovie();
Symbol 409 MovieClip Frame 1
if (!this.inited) {
this._parent.xp = 3;
this._parent.hp = 10;
this._parent.typ = 0;
this._parent.dam = 20;
_root.addEnem(this._parent);
this.inited = true;
this.cols = new Array("0x0099FF", "0x00CC00", "0xFF9900", "0xFFFF00");
var mycol = cols[random(cols.length)];
var dacol = new Color(bgcol);
dacol.setRGB(mycol);
bgcol.setMask(msk);
bgcol.cacheAsBitmap = true;
eye.gotoAndPlay(random(30));
}
Symbol 409 MovieClip Frame 11
gotoAndPlay ("rest");
Symbol 409 MovieClip Frame 24
stop();
_root.removeBad(this._parent);
Symbol 434 MovieClip Frame 1
if (!this.inited) {
this._parent.xp = 6;
this._parent.hp = 14;
this._parent.typ = 1;
this._parent.dam = 35;
_root.addEnem(this._parent);
this.inited = true;
this.cols = new Array("0x0099FF", "0x00CC00", "0xFF9900", "0xFFFF00");
var mycol = cols[random(cols.length)];
var dacol = new Color(bgcol);
dacol.setRGB(mycol);
bgcol.setMask(msk);
bgcol.cacheAsBitmap = true;
}
Symbol 434 MovieClip Frame 9
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 434 MovieClip Frame 40
stop();
_root.removeBad(this._parent);
Symbol 451 MovieClip Frame 1
stop();
if (!this.inited) {
this._parent.xp = 8;
this._parent.hp = 5;
this._parent.typ = 2;
this._parent.dam = 35;
this._parent.groundimmune = true;
_root.addEnem(this._parent);
this.inited = true;
this.cols = new Array("0x0099FF", "0x00CC00", "0xFF9900", "0xFFFF00");
var mycol = cols[random(cols.length)];
var dacol = new Color(bgcol);
dacol.setRGB(mycol);
bgcol.setMask(msk);
bgcol.cacheAsBitmap = true;
}
Symbol 451 MovieClip Frame 27
stop();
_root.removeBad(this._parent);
Symbol 506 MovieClip Frame 1
if (!this.inited) {
this._parent.xp = 25;
this._parent.hp = 35;
this._parent.typ = 3;
this._parent.dam = 55;
_root.addEnem(this._parent);
this.inited = true;
this._parent.independent = true;
}
Symbol 506 MovieClip Frame 9
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 506 MovieClip Frame 14
_root.dudeHit(this._parent, box);
Symbol 506 MovieClip Frame 15
_root.dudeHit(this._parent, box);
Symbol 506 MovieClip Frame 16
_root.dudeHit(this._parent, box);
Symbol 506 MovieClip Frame 25
this._parent.attacking = false;
this._parent.walking = false;
this._parent.resting = false;
this._parent.aicv = random(25);
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 506 MovieClip Frame 36
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("walk");
}
Symbol 506 MovieClip Frame 71
stop();
_root.removeBad(this._parent);
Symbol 555 MovieClip [plat_hud] Frame 1
if (!this.inited) {
reminder._visible = false;
this.inited = true;
msg._visible = false;
cul = new Color(col);
cul.setRGB(_root.armorarray[_root.curarmor]);
col.cacheAsBitmap = true;
col.setMask(masker);
col._alpha = 100;
this.arm = "LEVEL - " + _root.curarmor;
this.mag = "LEVEL - " + _root.curmag;
this.att = "LEVEL - " + _root.cursword;
}
Symbol 558 MovieClip [knight0_axe] Frame 1
this.dam = 130;
Symbol 565 MovieClip [rock] Frame 1
stop();
this.dam = 75;
Symbol 565 MovieClip [rock] Frame 12
stop();
this.unloadMovie();
this.removeMovieClip();
Symbol 576 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 584 MovieClip [platlev0_0] Frame 1
this.lef = 0;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 585 MovieClip [platlev0_1] Frame 1
this.lef = -300;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 586 MovieClip [platlev0_2] Frame 1
this.lef = -300;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 609 MovieClip Frame 1
stop();
Symbol 610 MovieClip Frame 1
stop();
if (!this.inited) {
this.inited = true;
this.pointer = 1;
this.maxx = 14;
this.hitcv = 0;
}
Symbol 610 MovieClip Frame 2
gotoAndPlay(_currentframe);
Symbol 610 MovieClip Frame 3
gotoAndPlay(_currentframe);
Symbol 610 MovieClip Frame 4
gotoAndPlay(_currentframe);
Symbol 610 MovieClip Frame 5
gotoAndPlay(_currentframe);
Symbol 610 MovieClip Frame 6
gotoAndPlay(_currentframe);
Symbol 610 MovieClip Frame 7
gotoAndPlay(_currentframe);
Symbol 623 MovieClip Frame 1
stop();
Symbol 629 MovieClip Frame 1
stop();
Symbol 639 MovieClip Frame 1
if (!this.inited) {
this._parent.fireballcv = 0;
this.shield._visible = false;
this.shield.cv = 0;
this._parent.nam = "Demon Beast";
this._parent.aicv = 0;
this._parent.mod = 0;
this._parent.xp = 650;
this._parent.hp = 750;
this._parent.maxhp = this._parent.hp;
this._parent.weak = true;
this._parent.independent = true;
this._parent.groundimmune = true;
this._parent.typ = 97;
this._parent.dir = -1;
this._parent.ydir = -1;
this._parent.shielded = true;
this._parent.speed = 15;
this._parent.dam = 130;
this._parent.nomove = true;
this._parent.boss = true;
_root.addEnem(this._parent);
this.inited = true;
_root.updateHUD();
}
Symbol 639 MovieClip Frame 30
if (!this._parent.dead) {
gotoAndPlay ("rest");
}
Symbol 639 MovieClip Frame 31
_root.playSound("splosion1");
_root.flashIt();
_root.setNoise(0);
Symbol 639 MovieClip Frame 32
_root.playLoudSound("raaar");
Symbol 639 MovieClip Frame 35
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 39
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 42
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 45
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 48
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 51
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 55
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 58
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 61
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 64
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 67
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 73
_root.reviveDemon();
Symbol 639 MovieClip Frame 85
stop();
this.lastframe = true;
this._parent.lastframe = true;
Symbol 639 MovieClip Frame 87
_root.setNoise(0);
Symbol 639 MovieClip Frame 89
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 91
_root.playSound("splosion1");
_root.flashIt();
Symbol 639 MovieClip Frame 93
_root.playSound("splosion1");
_root.defeatBoss();
_root.flashIt();
Symbol 639 MovieClip Frame 120
stop();
var b = _root.attachMovie("blackout", "blacky", 9911102201);
b._alpha = 0;
b.onEnterFrame = function () {
if ((!_root.platpause) && (!_root.freeze)) {
this._alpha = this._alpha + 2;
if (this._alpha >= 100) {
delete this.onEnterFrame;
_root.runEnd();
this.unloadMovie();
this.removeMovieClip();
}
}
};
Symbol 639 MovieClip Frame 121
stop();
Symbol 640 MovieClip Frame 1
stop();
Symbol 643 MovieClip [platlev0_97] Frame 1
this.lef = -250;
this.rig = 900;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("finalboss");
Symbol 649 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 650 MovieClip [platlev1_0] Frame 1
this.lef = -400;
this.rig = 1500;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 651 MovieClip [platlev1_1] Frame 1
this.lef = -400;
this.rig = 1500;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 656 MovieClip Frame 1
if (!this.inited) {
this.inited = true;
var ran = random(8);
this.gotoAndPlay(ran);
}
Symbol 694 MovieClip Frame 1
stop();
Symbol 694 MovieClip Frame 2
_root.giveSpell(4);
Symbol 695 MovieClip Frame 1
this.fairy = true;
if (_root.gotfairy) {
this._visible = false;
}
Symbol 700 MovieClip [platlev0_194] Frame 1
this.lef = 0;
this.rig = 1300;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("ssmellow");
Symbol 730 MovieClip Frame 23
_root.giveSpell(3);
Symbol 730 MovieClip Frame 51
this._parent.gotoAndStop("rest");
stop();
Symbol 731 MovieClip Frame 1
stop();
Symbol 734 MovieClip Frame 1
stop();
Symbol 738 MovieClip [platlev1_195] Frame 1
this.lef = -400;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("dungeonrelaxed");
Symbol 748 MovieClip Frame 23
_root.giveSpell(2);
Symbol 748 MovieClip Frame 51
this._parent.gotoAndStop("rest");
stop();
Symbol 749 MovieClip Frame 1
stop();
Symbol 750 MovieClip Frame 1
stop();
Symbol 751 MovieClip [platlev1_196] Frame 1
this.lef = -400;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("ssmellow");
Symbol 781 MovieClip Frame 2
_root.giveSpell(1);
Symbol 781 MovieClip Frame 12
this._parent.gotoAndStop("rest");
Symbol 787 MovieClip Frame 1
stop();
if (_root.deliveredwood) {
gotoAndStop ("happy");
}
Symbol 788 MovieClip Frame 1
stop();
Symbol 794 MovieClip Frame 13
_root.giveSpell(1, true);
Symbol 794 MovieClip Frame 41
this._parent.gotoAndStop("rest");
stop();
Symbol 795 MovieClip Frame 1
stop();
Symbol 796 MovieClip Frame 1
stop();
Symbol 797 MovieClip [platlev2_197] Frame 1
this.lef = 0;
this.rig = 1000;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("ssmellow");
Symbol 817 MovieClip Frame 20
stop();
_root.blacksmithGive();
Symbol 818 MovieClip Frame 18
this._parent.gotoAndStop("rest2");
Symbol 820 MovieClip Frame 1
stop();
if (_root.gotaxe) {
gotoAndStop ("rest2");
}
Symbol 823 MovieClip [platlev0_198] Frame 1
this.lef = 0;
this.rig = 1100;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
if (!_root.gotfairy) {
fair._visible = false;
}
_root.runMusic("ssmellow");
Symbol 824 MovieClip [platlev1_2] Frame 1
this.lef = -400;
this.rig = 1500;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 826 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 827 MovieClip [platlev1_3] Frame 1
this.lef = -400;
this.rig = 1500;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("dungeonbattle");
Symbol 833 MovieClip Frame 11
gotoAndPlay(this._currentframe + random(30));
Symbol 852 MovieClip Frame 20
stop();
Symbol 854 MovieClip Frame 1
stop();
if (!this._parent.inited) {
this._parent.web = this._parent._parent.createEmptyMovieClip("web" + _root.effcv, _root.effcv + 67781);
_root.effcv++;
_root.game.fg.swapDepths(_root.effcv + 67781);
_root.effcv++;
this._parent.xhome = this._parent._x;
this._parent.upamt = 20 + random(40);
this._parent.downamt = 20 + random(40);
if (_root.indungeon) {
this._parent.hp = 40;
this._parent.xp = 35;
} else {
this._parent.xp = 10;
this._parent.hp = 8;
}
this._parent.typ = 4;
this._parent.dam = 65;
_root.addEnem(this._parent);
this._parent.inited = true;
this._parent.nomove = true;
this._parent.home = this._parent._y;
this._parent.independent = true;
this._parent.groundimmune = true;
}
Symbol 854 MovieClip Frame 19
stop();
_root.removeBad(this._parent);
Symbol 855 MovieClip Frame 1
stop();
Symbol 856 MovieClip [platlev1_4] Frame 1
this.lef = -400;
this.rig = 1500;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("dungeonbattle");
Symbol 861 MovieClip Frame 1
stop();
Symbol 898 MovieClip Frame 1
if (!this._parent.inited) {
this._parent.troll = true;
this._parent.xp = 75;
this._parent.hp = 150;
this._parent.typ = 5;
this._parent.dam = 65;
_root.addEnem(this._parent);
this._parent.inited = true;
this._parent.nomove = true;
this._parent.independent = true;
this._parent.groundimmune = true;
}
Symbol 898 MovieClip Frame 21
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 898 MovieClip Frame 41
_root.dudeHit(this._parent, box);
Symbol 898 MovieClip Frame 42
_root.dudeHit(this._parent, box);
Symbol 898 MovieClip Frame 43
_root.dudeHit(this._parent, box);
Symbol 898 MovieClip Frame 61
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 898 MovieClip Frame 62
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 898 MovieClip Frame 63
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 898 MovieClip Frame 64
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 898 MovieClip Frame 65
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 898 MovieClip Frame 66
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 898 MovieClip Frame 67
if ((!this._parent.dead) && (this._parent.hp > 0)) {
gotoAndPlay ("rest");
}
Symbol 898 MovieClip Frame 91
stop();
_root.removeBad(this._parent);
Symbol 899 MovieClip Frame 1
stop();
Symbol 900 MovieClip [platlev1_5] Frame 1
this.lef = -400;
this.rig = 1500;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("dungeonbattle");
Symbol 902 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 918 MovieClip Frame 9
stop();
Symbol 919 MovieClip Frame 1
if (!this._parent._parent.comp.stuck) {
eyes._visible = false;
} else if (!eyes._visible) {
eyes._visible = true;
eyes.gotoAndPlay(1);
}
Symbol 930 MovieClip Frame 2
_root.playSound("splosion1");
Symbol 930 MovieClip Frame 4
_root.playSound("splosion1");
Symbol 930 MovieClip Frame 7
_root.playSound("splosion1");
Symbol 930 MovieClip Frame 10
_root.playSound("splosion1");
Symbol 930 MovieClip Frame 13
_root.playSound("splosion1");
_root.flashIt();
Symbol 930 MovieClip Frame 15
_root.playSound("splosion1");
Symbol 930 MovieClip Frame 17
_root.playSound("splosion1");
Symbol 930 MovieClip Frame 24
stop();
this.lastframe = true;
this.onEnterFrame = function () {
if (!_root.platpause) {
delete this.onEnterFrame;
_root.defeatBoss();
}
};
Symbol 930 MovieClip Frame 26
stop();
Symbol 930 MovieClip Frame 27
stop();
Symbol 930 MovieClip Frame 28
stop();
Symbol 930 MovieClip Frame 29
stop();
Symbol 930 MovieClip Frame 30
stop();
Symbol 930 MovieClip Frame 31
stop();
Symbol 930 MovieClip Frame 32
stop();
Symbol 930 MovieClip Frame 33
stop();
Symbol 930 MovieClip Frame 34
stop();
Symbol 930 MovieClip Frame 35
stop();
Symbol 936 MovieClip Frame 2
_root.playSound("gleam");
Symbol 936 MovieClip Frame 25
this.hitarea.onEnterFrame = function () {
_root.chkAwardGet(this);
};
Symbol 936 MovieClip Frame 32
stop();
Symbol 937 MovieClip Frame 1
if (!this.inited) {
this._parent.nam = "Red Knight";
this._parent.aicv = 0;
this._parent.mod = 0;
this._parent.xp = 400;
this._parent.gotaxe = true;
this._parent.hp = 850;
this._parent.maxhp = this._parent.hp;
this._parent.typ = 500;
this._parent.dam = 130;
this._parent.nomove = true;
this._parent.boss = true;
_root.addEnem(this._parent);
this.inited = true;
_root.updateHUD();
}
Symbol 937 MovieClip Frame 20
if (!this._parent.dead) {
gotoAndPlay ("rest");
}
Symbol 937 MovieClip Frame 30
if (!this._parent.dead) {
_root.dudeHit(this._parent, axe.hitarea);
_root.dudeHit(this._parent, axe.hitarea1);
_root.dudeHit(this._parent, axe.hitarea2);
_root.dudeHit(this._parent, axe.hitarea3);
_root.screenShake(10);
}
Symbol 937 MovieClip Frame 47
if (!this._parent.dead) {
_root.knight0AtkEnd(this._parent);
gotoAndPlay ("rest");
}
Symbol 937 MovieClip Frame 55
if (!this._parent.dead) {
_root.tossAxe(this._parent);
}
Symbol 937 MovieClip Frame 84
if (!this._parent.dead) {
gotoAndPlay ("rest2");
}
Symbol 937 MovieClip Frame 97
if (!this._parent.dead) {
gotoAndPlay ("walk");
}
Symbol 937 MovieClip Frame 110
if (!this._parent.dead) {
_root.retrieveAxe(this._parent);
gotoAndPlay ("rest");
}
Symbol 937 MovieClip Frame 112
_root.setNoise(0);
this._parent.gotaxe = false;
_root.updateHUD();
Symbol 937 MovieClip Frame 113
Symbol 937 MovieClip Frame 114
stop();
Symbol 937 MovieClip Frame 115
stop();
Symbol 937 MovieClip Frame 116
stop();
Symbol 937 MovieClip Frame 117
stop();
Symbol 937 MovieClip Frame 118
stop();
Symbol 937 MovieClip Frame 119
stop();
Symbol 937 MovieClip Frame 120
stop();
Symbol 937 MovieClip Frame 121
stop();
Symbol 938 MovieClip Frame 1
stop();
Symbol 940 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 942 MovieClip [platlev1_500] Frame 1
this.lef = -200;
this.rig = 1000;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("dungeonboss");
Symbol 968 MovieClip Frame 19
stop();
Symbol 972 MovieClip Frame 2
_root.playSound("splosion1");
Symbol 972 MovieClip Frame 4
_root.playSound("splosion1");
Symbol 972 MovieClip Frame 7
_root.playSound("splosion1");
Symbol 972 MovieClip Frame 10
_root.playSound("splosion1");
Symbol 972 MovieClip Frame 16
_root.playSound("splosion1");
Symbol 972 MovieClip Frame 18
_root.playSound("splosion1");
Symbol 972 MovieClip Frame 20
_root.playSound("splosion1");
_root.flashIt();
Symbol 972 MovieClip Frame 25
stop();
this.lastframe = true;
this.onEnterFrame = function () {
if (!_root.platpause) {
delete this.onEnterFrame;
_root.defeatBoss();
}
};
Symbol 972 MovieClip Frame 26
stop();
Symbol 972 MovieClip Frame 27
stop();
Symbol 972 MovieClip Frame 28
stop();
Symbol 972 MovieClip Frame 29
stop();
Symbol 972 MovieClip Frame 30
stop();
Symbol 972 MovieClip Frame 31
stop();
Symbol 972 MovieClip Frame 32
stop();
Symbol 972 MovieClip Frame 33
stop();
Symbol 972 MovieClip Frame 34
stop();
Symbol 972 MovieClip Frame 35
stop();
Symbol 973 MovieClip Frame 2
_root.playSound("gleam");
Symbol 973 MovieClip Frame 25
this.hitarea.onEnterFrame = function () {
_root.chkAwardGet(this);
};
Symbol 973 MovieClip Frame 32
stop();
Symbol 974 MovieClip Frame 1
if (!this.inited) {
this._parent.spindist = 42;
this._parent.gox = 0;
this._parent.nam = "Purple Knight";
this._parent.aicv = 0;
this._parent.mod = 0;
this._parent.xp = 400;
this._parent.hp = 725;
this._parent.maxhp = this._parent.hp;
this._parent.topdir = -1;
this._parent.typ = 501;
this._parent.dam = 130;
this._parent.nomove = true;
this._parent.boss = true;
_root.addEnem(this._parent);
this.inited = true;
_root.updateHUD();
}
Symbol 974 MovieClip Frame 20
if (!this._parent.dead) {
gotoAndPlay ("rest");
} else {
stop();
}
Symbol 974 MovieClip Frame 21
if (this._parent.dead) {
gotoAndPlay ("rest");
}
Symbol 974 MovieClip Frame 22
if (this._parent.dead) {
gotoAndPlay ("rest");
}
Symbol 974 MovieClip Frame 31
this._parent.ready = true;
Symbol 974 MovieClip Frame 32
stop();
Symbol 974 MovieClip Frame 60
if (!this._parent.dead) {
gotoAndPlay ("dizzy");
}
Symbol 974 MovieClip Frame 61
if ((!_root.platpause) && (!this._parent.dead)) {
gotoAndPlay ("dizzy");
}
Symbol 974 MovieClip Frame 62
if ((!_root.platpause) && (!this._parent.dead)) {
gotoAndPlay ("dizzy");
}
Symbol 974 MovieClip Frame 71
_root.dudeHit(this._parent, box);
Symbol 974 MovieClip Frame 72
_root.dudeHit(this._parent, box);
Symbol 974 MovieClip Frame 73
_root.dudeHit(this._parent, box);
Symbol 974 MovieClip Frame 76
if (this._parent.dead) {
gotoAndPlay ("rest");
}
Symbol 974 MovieClip Frame 77
if (this._parent.dead) {
gotoAndPlay ("rest");
}
Symbol 974 MovieClip Frame 78
if (this._parent.dead) {
gotoAndPlay ("rest");
}
Symbol 974 MovieClip Frame 80
_root.setNoise(0);
_root.updateHUD();
Symbol 975 MovieClip Frame 1
stop();
Symbol 991 MovieClip Frame 4
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 5
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 7
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 9
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 11
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 13
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 15
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 17
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 19
_root.dudeHit(this._parent._parent, box);
Symbol 991 MovieClip Frame 31
_root.endSpurt(this._parent._parent);
Symbol 992 MovieClip Frame 1
stop();
Symbol 993 MovieClip Frame 1
stop();
if (!this.inited) {
this.inited = true;
_root.addFireSpurt(this);
this.dam = 70;
}
Symbol 993 MovieClip Frame 9
_root.shootSpurt(this);
Symbol 994 MovieClip [platlev1_501] Frame 1
this.lef = -265;
this.rig = 910;
this.fric = 0.6;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("dungeonboss");
Symbol 999 MovieClip Frame 1
this.cv = 0;
this.dir = random(2);
if (this.dir == 0) {
this.dir = -1;
}
Symbol 1018 MovieClip Frame 2
_root.playSound("splosion1");
Symbol 1018 MovieClip Frame 4
_root.playSound("splosion1");
Symbol 1018 MovieClip Frame 7
_root.playSound("splosion1");
Symbol 1018 MovieClip Frame 10
_root.playSound("splosion1");
Symbol 1018 MovieClip Frame 16
_root.playSound("splosion1");
Symbol 1018 MovieClip Frame 18
_root.playSound("splosion1");
Symbol 1018 MovieClip Frame 20
_root.playSound("splosion1");
_root.flashIt();
Symbol 1018 MovieClip Frame 25
stop();
this.lastframe = true;
this.onEnterFrame = function () {
if (!_root.platpause) {
delete this.onEnterFrame;
_root.defeatBoss();
}
};
Symbol 1018 MovieClip Frame 26
stop();
Symbol 1018 MovieClip Frame 27
stop();
Symbol 1018 MovieClip Frame 28
stop();
Symbol 1018 MovieClip Frame 29
stop();
Symbol 1018 MovieClip Frame 30
stop();
Symbol 1018 MovieClip Frame 31
stop();
Symbol 1018 MovieClip Frame 32
stop();
Symbol 1018 MovieClip Frame 33
stop();
Symbol 1018 MovieClip Frame 34
stop();
Symbol 1018 MovieClip Frame 35
stop();
Symbol 1019 MovieClip Frame 2
_root.playSound("gleam");
Symbol 1019 MovieClip Frame 25
this.hitarea.onEnterFrame = function () {
_root.chkAwardGet(this);
};
Symbol 1019 MovieClip Frame 32
stop();
Symbol 1020 MovieClip Frame 1
if (!this.inited) {
this._parent.dir = -1;
this._parent.nam = "Green Knight";
this._parent.aicv = 0;
this._parent.mod = 0;
this._parent.xp = 400;
this._parent.hp = 1100;
this._parent.maxhp = this._parent.hp;
this._parent.typ = 502;
this._parent.dam = 130;
this._parent.nomove = true;
this._parent.boss = true;
_root.addEnem(this._parent);
this.inited = true;
_root.updateHUD();
}
Symbol 1020 MovieClip Frame 20
if (!this._parent.dead) {
gotoAndPlay ("rest");
}
Symbol 1020 MovieClip Frame 35
if (!this._parent.dead) {
gotoAndPlay ("walk");
}
Symbol 1020 MovieClip Frame 41
_root.dudeHit(this._parent, box);
Symbol 1020 MovieClip Frame 42
_root.dudeHit(this._parent, box);
Symbol 1020 MovieClip Frame 43
_root.dudeHit(this._parent, box);
Symbol 1020 MovieClip Frame 47
if (!this._parent.dead) {
this._parent.attacking = false;
gotoAndPlay ("rest");
}
Symbol 1020 MovieClip Frame 75
_root.setNoise(0);
_root.updateHUD();
Symbol 1021 MovieClip Frame 1
stop();
Symbol 1022 MovieClip [platlev1_502] Frame 1
this.lef = -400;
this.rig = 1500;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("dungeonboss");
Symbol 1024 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1025 MovieClip [platlev2_0] Frame 1
this.lef = -200;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 1026 MovieClip [platlev2_1] Frame 1
this.lef = -200;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 1027 MovieClip [platlev2_2] Frame 1
this.lef = -200;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 1031 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1071 MovieClip Frame 40
_root.addBossBall();
Symbol 1089 MovieClip Frame 1
_root.grabBall();
Symbol 1089 MovieClip Frame 4
_root.playSound("swing" + random(3));
Symbol 1089 MovieClip Frame 7
_root.ballBomb();
_root.dudeHit(this._parent._parent, block1);
_root.dudeHit(this._parent._parent, block2);
Symbol 1102 MovieClip Frame 3
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 4
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 6
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 8
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 10
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 12
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 18
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 20
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 21
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 23
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 25
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 27
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 29
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 35
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 37
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 38
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 40
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 42
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 44
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 46
_root.playSound("splosion1");
Symbol 1102 MovieClip Frame 52
_root.playSound("lasersplode");
_root.flashIt();
Symbol 1102 MovieClip Frame 70
stop();
this.lastframe = true;
this.onEnterFrame = function () {
if (!_root.platpause) {
delete this.onEnterFrame;
_root.defeatBoss();
}
};
Symbol 1102 MovieClip Frame 71
stop();
Symbol 1102 MovieClip Frame 72
stop();
Symbol 1102 MovieClip Frame 73
stop();
Symbol 1102 MovieClip Frame 74
stop();
Symbol 1102 MovieClip Frame 75
stop();
Symbol 1102 MovieClip Frame 76
stop();
Symbol 1102 MovieClip Frame 77
stop();
Symbol 1102 MovieClip Frame 78
stop();
Symbol 1102 MovieClip Frame 79
stop();
Symbol 1102 MovieClip Frame 80
stop();
Symbol 1102 MovieClip Frame 81
stop();
Symbol 1102 MovieClip Frame 82
stop();
Symbol 1102 MovieClip Frame 83
stop();
Symbol 1102 MovieClip Frame 84
stop();
Symbol 1102 MovieClip Frame 85
stop();
Symbol 1102 MovieClip Frame 86
stop();
Symbol 1102 MovieClip Frame 87
stop();
Symbol 1102 MovieClip Frame 88
stop();
Symbol 1102 MovieClip Frame 89
stop();
Symbol 1102 MovieClip Frame 90
stop();
Symbol 1102 MovieClip Frame 91
stop();
Symbol 1102 MovieClip Frame 92
stop();
Symbol 1102 MovieClip Frame 93
stop();
Symbol 1102 MovieClip Frame 94
stop();
Symbol 1102 MovieClip Frame 95
stop();
Symbol 1102 MovieClip Frame 96
stop();
Symbol 1102 MovieClip Frame 97
stop();
Symbol 1102 MovieClip Frame 98
stop();
Symbol 1102 MovieClip Frame 99
stop();
Symbol 1102 MovieClip Frame 100
stop();
Symbol 1102 MovieClip Frame 101
stop();
Symbol 1102 MovieClip Frame 102
stop();
Symbol 1102 MovieClip Frame 103
stop();
Symbol 1102 MovieClip Frame 104
stop();
Symbol 1102 MovieClip Frame 105
stop();
Symbol 1102 MovieClip Frame 106
stop();
Symbol 1102 MovieClip Frame 107
stop();
Symbol 1102 MovieClip Frame 108
stop();
Symbol 1102 MovieClip Frame 109
stop();
Symbol 1102 MovieClip Frame 110
stop();
Symbol 1102 MovieClip Frame 111
stop();
Symbol 1102 MovieClip Frame 112
stop();
Symbol 1102 MovieClip Frame 113
stop();
Symbol 1102 MovieClip Frame 114
stop();
Symbol 1102 MovieClip Frame 115
stop();
Symbol 1102 MovieClip Frame 116
stop();
Symbol 1102 MovieClip Frame 117
stop();
Symbol 1102 MovieClip Frame 118
stop();
Symbol 1102 MovieClip Frame 119
stop();
Symbol 1102 MovieClip Frame 120
stop();
Symbol 1102 MovieClip Frame 121
stop();
Symbol 1102 MovieClip Frame 122
stop();
Symbol 1102 MovieClip Frame 123
stop();
Symbol 1102 MovieClip Frame 124
stop();
Symbol 1102 MovieClip Frame 125
stop();
Symbol 1102 MovieClip Frame 126
stop();
Symbol 1102 MovieClip Frame 127
stop();
Symbol 1102 MovieClip Frame 128
stop();
Symbol 1106 MovieClip Frame 2
_root.playSound("gleam");
Symbol 1106 MovieClip Frame 37
stop();
this.hitarea.onEnterFrame = function () {
_root.chkAwardGet(this);
};
Symbol 1107 MovieClip Frame 1
stop();
if (!this.inited) {
this.lastframe = true;
this._parent.nam = "CANYON BEAST";
this._parent.aicv = 0;
this._parent.mod = 0;
this._parent.numballs = 0;
this._parent.xp = 200;
this._parent.hp = 150;
this._parent.maxhp = this._parent.hp;
this._parent.typ = 99;
this._parent.dam = 50;
this._parent.nomove = true;
this._parent.boss = true;
_root.addEnem(this._parent);
this.inited = true;
_root.updateHUD();
}
Symbol 1107 MovieClip Frame 4
stop();
_root.playLoudSound("raaar");
_root.setNoise(0);
Symbol 1108 MovieClip Frame 1
stop();
Symbol 1109 MovieClip [platlev2_99] Frame 1
this.lef = -600;
this.rig = 1300;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
var i = 0;
while (i < 3) {
var tar = eval ("boss.ball" + i);
tar._visible = false;
i++;
}
_root.runMusic("otherbosses");
Symbol 1111 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1121 MovieClip Frame 1
this.lastframe = false;
Symbol 1121 MovieClip Frame 10
_root.dragonBall(aimer);
Symbol 1121 MovieClip Frame 18
_root.dragonBall(aimer);
Symbol 1121 MovieClip Frame 25
_root.dragonBall(aimer);
Symbol 1121 MovieClip Frame 110
stop();
this.lastframe = true;
_root.dragonBallStop();
Symbol 1122 MovieClip Frame 1
stop();
Symbol 1135 MovieClip Frame 4
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 5
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 7
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 9
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 11
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 13
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 21
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 22
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 24
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 26
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 28
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 30
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 38
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 39
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 41
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 43
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 45
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 47
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 54
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 56
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 58
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 60
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 62
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 64
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 66
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 68
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 70
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 72
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 74
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 76
_root.playSound("splosion1");
Symbol 1135 MovieClip Frame 83
stop();
this.lastframe = true;
this.onEnterFrame = function () {
if (!_root.platpause) {
delete this.onEnterFrame;
_root.defeatBoss();
}
};
Symbol 1135 MovieClip Frame 84
stop();
Symbol 1135 MovieClip Frame 85
stop();
Symbol 1135 MovieClip Frame 86
stop();
Symbol 1135 MovieClip Frame 87
stop();
Symbol 1135 MovieClip Frame 88
stop();
Symbol 1135 MovieClip Frame 89
stop();
Symbol 1135 MovieClip Frame 90
stop();
Symbol 1135 MovieClip Frame 91
stop();
Symbol 1135 MovieClip Frame 92
stop();
Symbol 1135 MovieClip Frame 93
stop();
Symbol 1135 MovieClip Frame 94
stop();
Symbol 1135 MovieClip Frame 95
stop();
Symbol 1135 MovieClip Frame 96
stop();
Symbol 1135 MovieClip Frame 97
stop();
Symbol 1135 MovieClip Frame 98
stop();
Symbol 1135 MovieClip Frame 99
stop();
Symbol 1135 MovieClip Frame 100
stop();
Symbol 1135 MovieClip Frame 101
stop();
Symbol 1135 MovieClip Frame 102
stop();
Symbol 1135 MovieClip Frame 103
stop();
Symbol 1135 MovieClip Frame 104
stop();
Symbol 1135 MovieClip Frame 105
stop();
Symbol 1135 MovieClip Frame 106
stop();
Symbol 1135 MovieClip Frame 107
stop();
Symbol 1135 MovieClip Frame 108
stop();
Symbol 1135 MovieClip Frame 109
stop();
Symbol 1135 MovieClip Frame 110
stop();
Symbol 1135 MovieClip Frame 111
stop();
Symbol 1135 MovieClip Frame 112
stop();
Symbol 1138 MovieClip Frame 2
_root.playSound("gleam");
Symbol 1138 MovieClip Frame 37
stop();
this.hitarea.onEnterFrame = function () {
_root.chkAwardGet(this);
};
Symbol 1138 MovieClip Frame 38
stop();
Symbol 1138 MovieClip Frame 39
stop();
Symbol 1138 MovieClip Frame 40
stop();
Symbol 1138 MovieClip Frame 41
stop();
Symbol 1138 MovieClip Frame 42
stop();
Symbol 1138 MovieClip Frame 43
stop();
Symbol 1138 MovieClip Frame 44
stop();
Symbol 1138 MovieClip Frame 45
stop();
Symbol 1138 MovieClip Frame 46
stop();
Symbol 1138 MovieClip Frame 47
stop();
Symbol 1138 MovieClip Frame 48
stop();
Symbol 1138 MovieClip Frame 49
stop();
Symbol 1138 MovieClip Frame 50
stop();
Symbol 1138 MovieClip Frame 51
stop();
Symbol 1138 MovieClip Frame 52
stop();
Symbol 1138 MovieClip Frame 53
stop();
Symbol 1138 MovieClip Frame 54
stop();
Symbol 1138 MovieClip Frame 55
stop();
Symbol 1138 MovieClip Frame 56
stop();
Symbol 1138 MovieClip Frame 57
stop();
Symbol 1138 MovieClip Frame 58
stop();
Symbol 1138 MovieClip Frame 59
stop();
Symbol 1138 MovieClip Frame 60
stop();
Symbol 1138 MovieClip Frame 61
stop();
Symbol 1138 MovieClip Frame 62
stop();
Symbol 1138 MovieClip Frame 63
stop();
Symbol 1138 MovieClip Frame 64
stop();
Symbol 1138 MovieClip Frame 65
stop();
Symbol 1139 MovieClip Frame 1
this.lastframe = false;
if (!this.inited) {
this._parent._x = 110;
this._parent.nam = "ISLAND BEAST";
this._parent.aicv = 0;
this._parent.xp = 200;
this._parent.hp = 350;
this._parent.maxhp = this._parent.hp;
this._parent.typ = 98;
this._parent.dam = 70;
this._parent.boss = true;
_root.addEnem(this._parent);
this.inited = true;
this._parent.groundimmune = true;
this._parent.nomove = true;
_root.updateHUD();
}
Symbol 1139 MovieClip Frame 15
stop();
this.lastframe = true;
_root.dragonUp();
Symbol 1139 MovieClip Frame 16
this.lastframe = false;
Symbol 1139 MovieClip Frame 40
_root.dragonDown();
this.lastframe = true;
stop();
Symbol 1139 MovieClip Frame 41
this.lastframe = true;
_root.playLoudSound("raaar");
_root.setNoise(0);
Symbol 1139 MovieClip Frame 42
this.lastframe = true;
stop();
Symbol 1139 MovieClip Frame 43
stop();
Symbol 1140 MovieClip Frame 1
stop();
Symbol 1142 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1143 MovieClip [platlev2_98] Frame 1
this.lef = -600;
this.rig = 1300;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
var i = 0;
while (i < 3) {
var tar = eval ("boss.ball" + i);
tar._visible = false;
i++;
}
_root.runMusic("otherbosses");
Symbol 1144 MovieClip [platlev3_0] Frame 1
this.lef = -200;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 1147 MovieClip [platlev3_1] Frame 1
this.lef = -200;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 1148 MovieClip [platlev3_2] Frame 1
this.lef = -200;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("owbattle");
Symbol 1157 MovieClip [platlev3_3] Frame 1
this.lef = -200;
this.rig = 2100;
this.fric = 0.7;
this.grav = 3.5;
flasher._alpha = 0;
if (_root.rightbridge) {
dude._x = 2050;
}
this._x = (-dude._x) + 320;
_root.runMusic("owbattle");
Symbol 1178 MovieClip Frame 1
function freshMe() {
_root.showSword(swordholder);
magholder.updateMe();
this.curxp = "XP: " + _root.xp;
this.atk = _root.attackprogression[_root.cursword];
this.mg = _root.magicprogression[_root.curmag];
this.am = _root.armorprogression[_root.curarmor];
this.tim = 0;
vals = new Array();
vals[3] = this.atk;
vals[2] = this.mg;
vals[1] = this.am;
var _local3 = 0;
n = 0;
while (n < vals.length) {
if (vals[n] > _local3) {
_local3 = vals[n];
}
n++;
}
if (_root.xp < _local3) {
vals[0] = 0;
} else {
vals[0] = 99999 /* 0x01869F */;
}
this.locs = new Array(385, 308, 229, 151);
j = 0;
while (j < vals.length) {
danum = vals[j];
if (danum <= _root.nextxp) {
this.curloc = j;
this.exempt = j;
}
j++;
}
this.upup = false;
this.dup = false;
this.aup = false;
switchBar(this.curloc);
cul = new Color(col);
cul.setRGB(_root.armorarray[_root.curarmor]);
col.cacheAsBitmap = true;
col.setMask(masker);
col._alpha = 100;
this.arm = "LEVEL - " + _root.curarmor;
this.mag = "LEVEL - " + _root.curmag;
this.att = "LEVEL - " + _root.cursword;
}
function switchBar(num) {
arr._y = this.locs[num];
}
function runSelect() {
if (curloc == 1) {
if (_root.curarmor < 8) {
_root.curhp = _root.maxhp;
var _local3 = _root.armorprogression;
_root.xp = _root.xp - _local3[_root.curarmor];
_root.curarmor++;
}
}
if (curloc == 2) {
if (_root.curmag < 8) {
_root.magamt = _root.maxmag;
var _local3 = _root.magicprogression;
_root.xp = _root.xp - _local3[_root.curmag];
_root.curmag++;
}
}
if (curloc == 3) {
if (_root.cursword < 8) {
var _local3 = _root.attackprogression;
_root.xp = _root.xp - _local3[_root.cursword];
_root.cursword++;
}
}
if (curloc == 0) {
_root.nextpointer++;
if (_root.nextpointer == 0) {
if (_root.armorprogression[_root.curarmor] == 99999) {
_root.nextpointer = 1;
if (_root.magicprogression[_root.curmag] == 99999) {
_root.nextpointer = 2;
}
}
}
if (_root.nextpointer == 1) {
if (_root.magicprogression[_root.curmag] == 99999) {
_root.nextpointer = 2;
if (_root.attackprogression[_root.cursword] == 99999) {
_root.nextpointer = 0;
}
}
}
if (_root.nextpointer == 2) {
if (_root.attackprogression[_root.cursword] == 99999) {
_root.nextpointer = 0;
if (_root.armorprogression[_root.curarmor] == 99999) {
_root.nextpointer = 1;
}
}
}
if (_root.nextpointer > 2) {
_root.nextpointer = 0;
}
} else {
var _local2 = 99999 /* 0x01869F */;
if (_root.attackprogression[_root.cursword] < _local2) {
_root.nextpointer = 2;
_local2 = _root.attackprogression[_root.cursword];
}
if (_root.magicprogression[_root.curmag] < _local2) {
_root.nextpointer = 1;
_local2 = _root.magicprogression[_root.curmag];
}
if (_root.armorprogression[_root.curarmor] < _local2) {
_root.nextpointer = 0;
_local2 = _root.armorprogression[_root.curarmor];
}
}
_root.getNextThing();
_root.game.dude.guts.freshMe();
var _local2 = 999999 /* 0x0F423F */;
if (_root.attackprogression[_root.cursword] < _local2) {
_local2 = _root.attackprogression[_root.cursword];
}
if (_root.magicprogression[_root.curmag] < _local2) {
_local2 = _root.magicprogression[_root.curmag];
}
if (_root.armorprogression[_root.curarmor] < _local2) {
_local2 = _root.armorprogression[_root.curarmor];
}
if ((_root.xp < _local2) || (curloc == 0)) {
if (curloc == 0) {
_root.playLoudSound("nevermind");
} else {
var _local4 = random(10);
_root.playLoudSound("exclaim" + _local4);
}
_root.endLevelup();
} else {
var _local4 = random(10);
_root.playLoudSound("exclaim" + _local4);
freshMe();
}
}
if (!this.inited) {
freshMe();
this.inited = true;
}
this.onEnterFrame = function () {
if (this.tim > 8) {
if (!Key.isDown(38)) {
this.upup = true;
}
if (Key.isDown(38) && (this.upup)) {
this.upup = false;
foundit = false;
while (!foundit) {
this.curloc++;
if (this.curloc >= this.locs.length) {
this.curloc = 0;
}
if (vals[curloc] <= _root.xp) {
foundit = true;
}
}
switchBar(this.curloc);
}
if (!Key.isDown(40)) {
this.dup = true;
}
if (Key.isDown(40) && (this.dup)) {
this.dup = false;
foundit = false;
while (!foundit) {
this.curloc--;
if (this.curloc < 0) {
this.curloc = this.locs.length - 1;
}
if (vals[curloc] <= _root.xp) {
foundit = true;
}
}
switchBar(this.curloc);
}
if (!Key.isDown(65)) {
this.aup = true;
}
if (Key.isDown(65) && (this.aup)) {
this.aup = false;
runSelect();
}
} else {
this.tim++;
}
};
Symbol 1179 MovieClip [levelup] Frame 2
_root.setNoise(10);
Symbol 1179 MovieClip [levelup] Frame 6
_root.playLoudSound("levelup1");
Symbol 1179 MovieClip [levelup] Frame 23
stop();
Symbol 1185 MovieClip [fireballburst] Frame 6
stop();
this.unloadMovie();
this.removeMovieClip();
Symbol 1194 MovieClip [magchooser] Frame 12
stop();
this.rdy = true;
Symbol 1217 MovieClip [boss0] Frame 40
gotoAndPlay (1);
Symbol 1223 MovieClip [boss1] Frame 40
gotoAndPlay (1);
Symbol 1227 MovieClip [boss2] Frame 1
if (!this.inited) {
this.inited = true;
this._xscale = 85;
this._yscale = this._xscale;
}
Symbol 1227 MovieClip [boss2] Frame 40
gotoAndPlay (1);
Symbol 1235 MovieClip [dungeon0] Frame 1
this._xscale = 70;
this._yscale = this._xscale;
Symbol 1238 MovieClip [footprint] Frame 25
stop();
this.unloadMovie();
this.removeMovieClip();
Symbol 1247 MovieClip [groundpoof] Frame 17
stop();
this.unloadMovie();
this.removeMovieClip();
Symbol 1259 MovieClip Frame 1
Symbol 1265 MovieClip Frame 1
_root.colorMe(this);
Symbol 1272 MovieClip Frame 1
Symbol 1279 MovieClip Frame 1
_root.colorMe(this);
Symbol 1287 MovieClip Frame 1
_root.colorMe(this);
Symbol 1290 MovieClip Frame 3
_root.mappy.checkAxeHit(hitarea);
Symbol 1290 MovieClip Frame 7
_root.mappy.endMapAtk();
Symbol 1291 MovieClip Frame 3
_root.mappy.checkAxeHit(hitarea);
Symbol 1291 MovieClip Frame 7
_root.mappy.endMapAtk();
Symbol 1292 MovieClip Frame 3
_root.mappy.checkAxeHit(hitarea);
Symbol 1292 MovieClip Frame 7
_root.mappy.endMapAtk();
Symbol 1293 MovieClip Frame 1
stop();
Symbol 1301 MovieClip [map_enemy0] Frame 1
this.temp = 0;
Symbol 1308 MovieClip [map_enemy1] Frame 1
this.temp = 1;
Symbol 1315 MovieClip [map_enemy2] Frame 1
this.temp = 2;
Symbol 1317 MovieClip [map_enemy3] Frame 1
this.temp = 1;
Symbol 1319 MovieClip [map_enemy4] Frame 1
this.temp = 1;
Symbol 1321 MovieClip [map_enemy5] Frame 1
this.temp = 1;
Symbol 1342 MovieClip [treesplode] Frame 24
stop();
this.unloadMovie();
this.removeMovieClip();
Symbol 1347 MovieClip [watersplash] Frame 9
stop();
this.unloadMovie();
this.removeMovieClip();
Symbol 1386 MovieClip [plat_heart] Frame 7
stop();
Symbol 1397 MovieClip Frame 17
_root.giveSpell(0);
Symbol 1397 MovieClip Frame 45
this._parent.gotoAndStop("rest");
stop();
Symbol 1398 MovieClip Frame 1
stop();
Symbol 1399 MovieClip Frame 1
stop();
Symbol 1400 MovieClip [platlev0_199] Frame 1
this.lef = 0;
this.rig = 1200;
this.fric = 0.7;
this.grav = 4;
flasher._alpha = 0;
_root.runMusic("ssmellow");
Symbol 1459 MovieClip Frame 1
stop();
Symbol 1472 Button
on (press) {
getURL ("http://www.armorgames.com", "_blank");
}
Symbol 1475 MovieClip Frame 1
_root.stop();
gotoAndPlay (2);
Symbol 1475 MovieClip Frame 185
_root.gotoAndStop("main");
Symbol 1516 MovieClip Frame 1
stop();
Instance of Symbol 161 MovieClip [Score Board (NewgroundsAPI)] in Symbol 1535 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
board_name = "Chibi Knight Speedruns";
period = "Today";
}
Symbol 1538 MovieClip Frame 1
this.onPress = function () {
};
Symbol 1547 MovieClip Frame 1
this._visible = false;
but_yes.onPress = function () {
_root.clearDat();
this._parent._visible = false;
};
but_no.onPress = function () {
this._parent._visible = false;
};
Symbol 1556 MovieClip Frame 1
but_start.onPress = function () {
_root.goTime();
};
Symbol 1561 MovieClip Frame 1
hi._visible = false;
but_high.onPress = function () {
hi._visible = true;
hi.bg.onPress = function () {
this._parent._visible = false;
};
};
but_walk.onPress = function () {
getURL ("http://armorgames.com/guide/chibi-knight-video-guide", "_blank");
};
but_ag.onPress = function () {
getURL ("http://www.armorgames.com", "_blank");
};
but_moregames.onPress = function () {
getURL ("http://www.armorgames.com", "_blank");
};
but_bomtoons.onPress = function () {
getURL ("http://www.bomtoons.com", "_blank");
};
but_music.onPress = function () {
getURL ("http://www.reverbnation.com/brianholmes", "_blank");
};
duo.gotoAndPlay(1200);
Symbol 1561 MovieClip Frame 1334
gotoAndPlay ("repeat");
Symbol 1563 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1566 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1568 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1570 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1572 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1574 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1576 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1578 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1580 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1582 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1584 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1586 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1591 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1595 MovieClip Frame 1
this._parent.addMe(this);
this.tree = true;
this.woodvalue = 5;
stop();
this.cacheAsBitmap = true;
Symbol 1598 MovieClip Frame 1
stop();
this.woodvalue = 1;
this._parent.addMe(this);
this.tree = true;
this.cacheAsBitmap = true;
Symbol 1606 MovieClip Frame 50
stop();
this._parent.revealed = true;
Symbol 1608 MovieClip Frame 1
this._parent.addMe(this);
this.tree = true;
this.secret = true;
this.woodvalue = 0;
stop();
this.cacheAsBitmap = true;
Symbol 1625 MovieClip Frame 1
stop();
Symbol 1627 MovieClip Frame 1
stop();
Symbol 1629 MovieClip Frame 1
stop();
Symbol 1631 MovieClip Frame 1
stop();
Symbol 1633 MovieClip Frame 1
stop();
Symbol 1645 MovieClip Frame 1
stop();
if (_root.dooropen) {
gotoAndStop ("opened");
}
Symbol 1645 MovieClip Frame 2
_root.setNoise(0);
Symbol 1645 MovieClip Frame 3
_root.playSound("swing0");
Symbol 1645 MovieClip Frame 17
_root.playSound("splosion1");
Symbol 1645 MovieClip Frame 19
_root.playSound("splosion1");
Symbol 1645 MovieClip Frame 21
_root.playSound("splosion1");
Symbol 1645 MovieClip Frame 23
_root.playSound("splosion1");
Symbol 1645 MovieClip Frame 28
_root.playSound("ding");
_root.playSound("lasersplode");
Symbol 1645 MovieClip Frame 29
_root.hudd.flasher.gotoAndPlay(2);
_root.dooropen = true;
_root.hudd.updateMe();
_root.freshSave();
Symbol 1645 MovieClip Frame 64
stop();
_root.setNoise(_root.bgnoise);
this._parent.endMapAtk();
this._parent.cutscene = false;
Symbol 1651 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1655 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1657 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1659 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1664 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1666 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1668 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1673 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1675 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 1678 MovieClip Frame 1
stop();
this.cacheAsBitmap = true;
Symbol 1690 MovieClip Frame 1
stop();
Symbol 1693 MovieClip Frame 1
stop();
Symbol 1697 MovieClip Frame 1
stop();
Symbol 1699 MovieClip Frame 1
Symbol 1704 MovieClip Frame 15
stop();
this.unloadMovie();
this.removeMovieClip();
Symbol 1705 MovieClip Frame 1
stop();
Symbol 1705 MovieClip Frame 2
stop();
Symbol 1724 MovieClip Frame 1
this._alpha = 0;
Symbol 1727 MovieClip Frame 1
function addEnem2() {
var _local2 = new Array();
var _local3 = random(3);
_local2.k = "map_enemy" + _local3;
_local2.typ = _local3;
_root.enarray2.push(_local2);
}
function outsideEnems() {
var _local5 = 0;
while (_local5 < _root.enarray.length) {
var _local4 = _root.enarray[_local5];
if (_local4.typ > 199) {
_local4.dead = false;
}
if ((!_local4.dead) || (_local4.typ > 10)) {
var _local3 = this.attachMovie(_local4.link, "e" + _local5, _local5);
if (_local4.typ <= 10) {
var _local9 = dude._x - _local4.x;
var _local8 = dude._y - _local4.y;
var _local13 = Math.sqrt((_local9 * _local9) + (_local8 * _local8));
moveit = false;
if (_local13 < 250) {
var moveit = true;
}
}
_local3._x = _local4.x;
_local3._y = _local4.y;
if (moveit) {
var _local6 = random(2);
if (_local6 == 0) {
_local6 = -1;
}
_local3._x = dude._x + (150 * _local6);
_local3._y = dude._y + (150 * _local6);
}
var _local7 = new Array("0xFF4B5A", "0xFF7C18", "0xFDD73E", "0x79A439", "0x4498BB", "0x8858B8");
var _local12 = new Array("0x76010D", "0x8F3901", "0x765F01", "0x384B1B", "0x204757", "0x472C65");
var _local10 = random(_local7.length);
var _local14 = new Color(_local3.fill);
_local14.setRGB(_local7[_local10]);
var _local11 = new Color(_local3.stroke);
_local11.setRGB(_local12[_local10]);
_local3.typ = _local4.typ;
_local3.id = _local5;
_local3.aicv = random(30);
_local3.dir = random(4);
_local3.sp = 4;
enemies.push(_local3);
swaps.push(_local3);
if (((_local4.typ > 10) && (_local4.dead)) && (_local4.typ != 97)) {
_local3.gotoAndStop("dead");
_local3.dead = true;
}
}
_local5++;
}
}
function clearStuff() {
var _local3 = 0;
while (_local3 < enemies.length) {
var _local1 = enemies[_local3];
if (_local1 != dude) {
_local1.unloadMovie();
_local1.removeMovieClip();
}
_local3++;
}
_local3 = 0;
while (_local3 < swaps.length) {
var _local2 = swaps[_local3];
if (_local2 != dude) {
_local2.unloadMovie();
_local2.removeMovieClip();
}
_local3++;
}
}
function tranIt() {
_root.pausy = false;
clearStuff();
if (_root.indungeon && (dungeon)) {
_root.runMusic("oworld");
if (_root.gotfairy && (!_root.fairyaccomplished)) {
fairy._visible = true;
}
dungeon = false;
_root.indungeon = false;
dude._visible = true;
dude.attacking = false;
dude.guts.gotoAndStop("rest_" + dude.dir);
gotoAndStop (1);
} else {
_root.runMusic("dungeonow");
dude._visible = true;
dude.attacking = false;
fairy._visible = false;
_root.pastdungeon = false;
runDungeon(_root.dest);
}
}
function runDungeon(dest) {
dude._visible = true;
delete this.onEnterFrame;
_root.hudd.flasher.gotoAndPlay(2);
startDung(dest);
}
function startDung(dest) {
clearStuff();
dungeon = true;
_root.pausy = false;
cutscene = false;
enemies = new Array();
swaps = new Array();
swaps.push(doors);
var _local5 = 0;
while (_local5 < 4) {
var _local4 = this["key" + _local5];
swaps.push(_local4);
_local5++;
}
_local5 = 0;
while (_local5 < 3) {
var _local4 = this["g" + _local5];
swaps.push(_local4);
_local5++;
}
dude.attacking = false;
dude.moving = false;
atkup = false;
dude.guts.gotoAndStop("rest_" + dude.dir);
controltar = dude;
var _local13 = true;
var _local3 = 0;
while (_local3 < 3) {
var _local9 = this.doors.bigdoor["g" + _local3];
if (_root.gems[_local3]) {
_local9._visible = true;
this["g" + _local3].gotoAndStop(2);
} else {
_local9._visible = false;
_local13 = false;
}
_local3++;
}
if (_local13) {
block3.unloadMovie();
block3.removeMovieClip();
doors.bigdoor._visible = false;
}
_root.enarray2 = new Array();
_local3 = 0;
while (_local3 < 24) {
addEnem2();
_local3++;
}
_local3 = 0;
while (_local3 < 4) {
if (_root.dungeonkeys[_local3]) {
this["key" + _local3]._visible = false;
}
if (_root.dungeondoors[_local3]) {
var _local7 = this.doors["door" + _local3];
var _local10 = this["block" + _local3];
_local10.unloadMovie();
_local10.removeMovieClip();
_local7.opened = true;
_local7.gotoAndStop(2);
}
_local3++;
}
_local3 = 0;
while (_local3 < 24) {
var _local4 = this["s" + _local3];
_root.spawns[_local3][0] = _local4._x;
_root.spawns[_local3][1] = _local4._y;
_local4._visible = false;
_local3++;
}
_local3 = 0;
while (_local3 < _root.spawns.length) {
var _local8 = _root.spawns[_local3][0] - dude._x;
var _local6 = _root.spawns[_local3][1] - dude._y;
var _local12 = Math.sqrt((_local8 * _local8) + (_local6 * _local6));
if (!_root.spawns[_local3][2]) {
if ((_local12 > 350) || (!_root.indungeon)) {
var _local11 = random(3) + 3;
var _local14 = this.attachMovie("map_enemy" + _local11, "dungen" + _local3, effcv + 99111);
effcv++;
_local14._x = _root.spawns[_local3][0];
_local14._y = _root.spawns[_local3][1];
_local14.typ = _local11;
_local14.id = _local3;
_local14.aicv = random(30);
_local14.dir = random(4);
_local14.sp = 4;
_local14.comp = _root.spawns[_local3];
enemies.push(_local14);
swaps.push(_local14);
}
}
_local3++;
}
var _local14 = this.attachMovie("wizard3", "wiz", effcv);
effcv++;
_local14._x = 1221;
_local14._y = 1600;
_local14.typ = 195;
enemies.push(_local14);
swaps.push(_local14);
swaps.push(dude);
_root.indungeon = true;
this.onEnterFrame = function () {
enterF();
if (!_root.pausy) {
chkKeys();
if ((dude._y < -1800) && (!_root.pastdungeon)) {
dude.guts.gotoAndStop("rest_" + dude.dir);
dude.attacking = false;
_root.hudd.mapfade.gotoAndPlay(2);
_root.pastdungeon = true;
_root.pausy = true;
dude._x = -1440;
dude._y = 240;
_root.mapp = new Array(-1440, 240);
}
}
};
}
function chkKeys() {
var _local3 = 0;
while (_local3 < 4) {
var _local4 = this["key" + _local3];
if (_root.dungeonkeys[_local3]) {
this["key" + _local3]._visible = false;
}
if (_local4._visible) {
if (_local4.hitarea.hitTest(dude)) {
_root.playLoudSound("ding");
_root.dungeonkeys[_local3] = true;
_local4._visible = false;
_root.keycount++;
_root.hudd.updateMe();
_root.freshSave();
}
}
var _local6 = this.doors["door" + _local3];
if ((_local6.hitTest(dude) && (!_local6.opened)) && (_root.keycount > 0)) {
_root.playLoudSound("lasersplode");
_root.playLoudSound("gethit");
var _local5 = this["block" + _local3];
_root.dungeondoors[_local3] = true;
_local5.unloadMovie();
_local5.removeMovieClip();
_local6.opened = true;
_local6.gotoAndStop(2);
_root.keycount--;
_root.hudd.updateMe();
_root.freshSave();
if (_local5 == this.block2) {
_root.hudd.savemessage.gotoAndPlay(2);
}
}
_local3++;
}
_local3 = 0;
while (_local3 < 3) {
var _local6 = this["g" + _local3];
if (_local6.hitarea.hitTest(dude)) {
if (_local3 == 0) {
var _local7 = 500;
}
if (_local3 == 1) {
var _local7 = 501;
}
if (_local3 == 2) {
var _local7 = 502;
}
_root.mapp[0] = 1620;
_root.mapp[1] = -700;
daterrain = 1;
_root.startPlat(daterrain, _local7, _local6);
}
_local3++;
}
}
function swapEm() {
var _local2 = 0;
while (_local2 < swaps.length) {
var _local3 = swaps[_local2];
if ((_local3._x == undefined) && (_local3 != dude)) {
swaps.splice(_local2, 1);
}
if (_local3.secret) {
if (_local3.hitarea.hitTest(dude) && (_local3.revealed)) {
_root.startPlat(1, 196, _local3);
}
}
_local2++;
}
var _local4 = new Array();
_local2 = 0;
while (_local2 < swaps.length) {
var _local3 = swaps[_local2];
_local4.push({nam:_local3, yval:_local3._y});
_local2++;
}
var _local7 = _local4.sortOn("yval", Array.NUMERIC);
_local2 = 0;
while (_local2 < _local7.length) {
_local4[_local2].nam.swapDepths(_local2);
_local2++;
}
bigdoor.swapDepths(_local7.length + 1);
}
function checkAxeHit(hitarea) {
var _local10 = 0;
while (_local10 < swaps.length) {
var _local4 = swaps[_local10];
if (_local4.tree && (!_local4.chopped)) {
if (_local4.hitTest(hitarea)) {
var _local7 = 0;
while (_local7 < 7) {
var _local3 = this.attachMovie("leaf", "leaf" + effcv, effcv + 9911);
effcv++;
_local3.dir = random(2);
_local3._xscale = 50;
if (_local3.dir == 0) {
_local3._xscale = -50;
}
_local3._yscale = 50;
_local3.maxtime = random(20) + 40;
_local3.cv = 0;
_local3._x = (_local4._x + random(100)) - 50;
_local3._y = _local4._y - random(100);
_local3.gotoAndPlay(random(15));
_local3.onEnterFrame = function () {
this.cv++;
this._y = this._y + 1;
if (this.cv >= this.maxtime) {
delete this.onEnterFrame;
this.unloadMovie();
this.removeMovieClip();
}
};
_local7++;
}
_root.woodcount = _root.woodcount + _local4.woodvalue;
_root.hudd.updateMe();
_root.treechops[_local4.num] = true;
_local4.chopped = true;
_local4.gotoAndStop(2);
var _local6 = this.attachMovie("treesplode", "ts" + effcv, effcv + 9211);
effcv++;
_local6.s = random(20) + 60;
var _local11 = random(2);
if (_local11 == 0) {
_local11 = -1;
}
_local6._xscale = _local6.s * _local11;
_local6._yscale = _local6.s;
_local6._x = _local4._x;
_local6._y = _local4._y;
var _local9 = true;
var _local5 = 0;
while (_local5 < swaps.length) {
var _local8 = swaps[_local5];
if (_local8.tree && (!_local8.chopped)) {
_local9 = false;
}
_local5++;
}
if (_local9) {
_root.runMedal("Slash-n'-burn");
}
}
}
_local10++;
}
_root.freshSave();
}
function addMe(who) {
swaps.push(who);
who.num = curtree;
curtree++;
if (_root.treechops[who.num]) {
who.chopped = true;
who.gotoAndStop(2);
}
}
function centerOn(who) {
if (!_root.pausy) {
goalx = 320 - who._x;
goaly = 240 - who._y;
distx = goalx - this._x;
disty = goaly - this._y;
this._x = this._x + (distx / 1);
this._y = this._y + (disty / 1);
}
}
function moveEnem(who) {
if (who.dir == 0) {
who._y = who._y - who.sp;
}
if (who.dir == 1) {
who._x = who._x + who.sp;
}
if (who.dir == 2) {
who._y = who._y + who.sp;
}
if (who.dir == 3) {
who._x = who._x - who.sp;
}
who.aicv++;
if (who.aicv >= 30) {
who.aicv = random(15);
who.dir = random(4);
}
restrain(who);
}
function showMsg(msg) {
if (!msgup) {
msgup = true;
_root.playLoudSound("get");
}
var _local3 = this._parent.attachMovie("msgbox", "msgbox", 433998);
_local3.msg.text = msg;
}
function endMapAtk() {
dude.attacking = false;
dude.guts.gotoAndStop("rest_" + dude.dir);
}
function controls(who) {
var needmsg = false;
var i = 0;
while (i < 5) {
var tim = eval ("helper" + i);
if (tim.hitTest(who)) {
if (this._parent.msgbox._x == undefined) {
showMsg(tim.msg);
tim.gotoAndStop("talk");
}
needmsg = true;
} else {
tim.gotoAndStop(1);
}
i++;
}
var i = 0;
while (i < reads.length) {
var tim = eval ("r" + i);
if (tim.hitTest(who)) {
if (this._parent.msgbox._x == undefined) {
var m = reads[i];
showMsg(m);
}
needmsg = true;
}
i++;
}
if (!needmsg) {
msgup = false;
this._parent.msgbox.unloadMovie();
this._parent.msgbox.removeMovieClip();
}
if (!who.attacking) {
if (who.hitTest(bridge.hitarea)) {
_root.onbridge = true;
_root.runTran();
_root.startPlat(3, 3, bridge);
}
var i = 0;
while (i < enemies.length) {
tin = enemies[i];
if ((((_root.enarray[tin.id].link == "wizard0") || (_root.enarray[tin.id].link == "wizard1")) || (_root.enarray[tin.id].link == "wizard2")) || (_root.enarray[tin.id].link == "wizard4")) {
tin.dead = false;
_root.enarray[tin.id].dead = false;
}
if (who.hitarea.hitTest(tin.hitarea)) {
if (!tin.dead) {
if (tin.typ < 10) {
if ((((_root.enarray[tin.id].link != "wizard0") && (_root.enarray[tin.id].link != "wizard1")) && (_root.enarray[tin.id].link != "wizard2")) && (_root.enarray[tin.id].link != "wizard4")) {
_root.enarray[tin.id].dead = true;
} else {
_root.enarray[tin.id].dead = false;
tin.dead = false;
}
tin.comp[2] = true;
} else {
if ((tin.typ == 99) || (tin.typ == 98)) {
_root.whichboss = _root.enarray[tin.id];
if (tin.typ == 99) {
who._x = 1000;
who._y = 1090;
}
if (tin.typ == 98) {
who._x = 15;
who._y = -1435;
}
}
if (tin.typ == 97) {
who._x = -1450;
who._y = -180;
}
}
_root.mapp[0] = who._x;
_root.mapp[1] = who._y;
_root.runTran();
var daterrain = 0;
if (_root.indungeon) {
daterrain = 1;
}
if (terr1.hitTest(who.virtx, who.virty, true)) {
daterrain = 1;
}
if (terr2.hitTest(who.virtx, who.virty, true)) {
daterrain = 2;
}
if (terr3.hitTest(who.virtx, who.virty, true)) {
daterrain = 3;
}
_root.startPlat(daterrain, tin.typ, tin);
}
}
if (tin.typ < 10) {
moveEnem(tin);
}
i++;
}
}
if (_root.gotaxe) {
if (!Key.isDown(_root.atk)) {
atkup = true;
}
if (Key.isDown(_root.atk) && (atkup)) {
atkup = false;
_root.playLoudSound("gethit");
if (!who.attacking) {
who.attacking = true;
who.guts.gotoAndStop("axe_" + who.dir);
}
}
}
who.moving = false;
if (!who.attacking) {
if (((Key.isDown(U) && (!Key.isDown(R))) && (!Key.isDown(L))) && (!Key.isDown(D))) {
who.moving = true;
who._y = who._y - speed;
who.dir = 0;
}
if (((Key.isDown(D) && (!Key.isDown(R))) && (!Key.isDown(L))) && (!Key.isDown(U))) {
who.moving = true;
who._y = who._y + speed;
who.dir = 2;
}
if (((Key.isDown(R) && (!Key.isDown(U))) && (!Key.isDown(D))) && (!Key.isDown(L))) {
who.moving = true;
who._x = who._x + speed;
who.dir = 1;
who._xscale = 100;
}
if (((Key.isDown(L) && (!Key.isDown(U))) && (!Key.isDown(D))) && (!Key.isDown(R))) {
who.moving = true;
who._x = who._x - speed;
who.dir = 1;
who._xscale = -100;
}
if ((Key.isDown(L) && (Key.isDown(D))) && (!Key.isDown(R))) {
who.dir = 2;
who._x = who._x - speed;
who._y = who._y + speed;
who.moving = true;
}
if ((Key.isDown(R) && (Key.isDown(D))) && (!Key.isDown(L))) {
who.dir = 2;
who._x = who._x + speed;
who._y = who._y + speed;
who.moving = true;
}
if ((Key.isDown(L) && (Key.isDown(U))) && (!Key.isDown(R))) {
who.dir = 0;
who._x = who._x - speed;
who._y = who._y - speed;
who.moving = true;
}
if ((Key.isDown(R) && (Key.isDown(U))) && (!Key.isDown(L))) {
who.dir = 0;
who._x = who._x + speed;
who._y = who._y - speed;
who.moving = true;
}
}
if ((!who.moving) && (!who.attacking)) {
who.guts.gotoAndStop("rest_" + who.dir);
} else {
if (!who.attacking) {
who.guts.gotoAndStop("move_" + who.dir);
makePrint(who);
}
if ((dungeon && (_root.indungeon)) && (!_root.pastdungeon)) {
if (exit.hitTest(dude)) {
dude.guts.gotoAndStop("rest_" + dude.dir);
dude.attacking = false;
_root.hudd.mapfade.gotoAndPlay(2);
_root.pausy = true;
}
}
}
restrain(who);
}
function makePrint(who) {
who.printcv++;
if (who.printcv >= 5) {
if (!bg.hitTest(who.virtx, who.virty, true)) {
if ((who._x > -950) || (dungeon)) {
var _local4 = this.attachMovie("groundpoof", "gp" + effcv, effcv + 999911122);
_local4._x = who._x;
_local4._y = who._y;
_local4._xscale = 70;
_local4._yscale = _local4._xscale;
effcv++;
swaps.push(_local4);
}
who.printcv = 0;
var _local3 = farbg.attachMovie("footprint", "print" + effcv, effcv);
effcv++;
_local3._x = who._x;
_local3._y = who._y - 2;
_local3.cacheAsBitmap = true;
if (who.dir == 1) {
if (who.foot == 0) {
_local3._y = _local3._y - 2;
} else {
_local3._y = _local3._y + 7;
}
_local3._xscale = who._xscale;
}
if (who.dir == 0) {
_local3._rotation = -90;
if (who.foot == 0) {
_local3._x = _local3._x - 15;
} else {
_local3._x = _local3._x + 15;
}
}
if (who.dir == 2) {
_local3._rotation = 90;
if (who.foot == 0) {
_local3._x = _local3._x - 15;
} else {
_local3._x = _local3._x + 15;
}
}
who.foot++;
if (who.foot == 2) {
who.foot = 0;
}
} else if (bridge1.hitTest(who.virtx, who.virty, true)) {
var _local4 = farbg.attachMovie("watersplash", "gp" + effcv, effcv + 999911122);
_local4._x = who._x;
_local4._y = who._y - 10;
_local4._xscale = 100;
_local4._yscale = _local4._xscale;
effcv++;
swaps.push(_local4);
who.printcv = 0;
}
}
}
function restrain(who) {
who.virtx = this._x + who._x;
who.virty = this._y + who._y;
who.lef = who.virtx - (who._width / 2);
who.rig = who.virtx + (who._width / 2);
who.topp = who.virty - (who._height / 2);
who.bott = who.virty + (who._height / 2);
var _local4 = false;
if (bridge1.hitTest(who.virtx, who.topp, true) && (_root.gotboots)) {
_local4 = true;
}
if (bridge2.hitTest(who.virtx, who.topp, true) && (_root.dooropen)) {
_local4 = true;
}
while (((((bg.hitTest(who.virtx, who.topp, true) && (!_local4)) || (block0.hitTest(who.virtx, who.topp, true))) || (block1.hitTest(who.virtx, who.topp, true))) || (block2.hitTest(who.virtx, who.topp, true))) || (block3.hitTest(who.virtx, who.topp, true))) {
who._y = who._y + 1;
who.virty = who.virty + 1;
who.topp = who.topp + 1;
who.bott = who.bott - 1;
if (bridge1.hitTest(who.virtx, who.topp, true) && (_root.gotboots)) {
_local4 = true;
}
if (bridge2.hitTest(who.virtx, who.topp, true) && (_root.dooropen)) {
_local4 = true;
}
}
_local4 = false;
if (bridge1.hitTest(who.virtx, who.bott, true) && (_root.gotboots)) {
_local4 = true;
}
if (bridge2.hitTest(who.virtx, who.bott, true) && (_root.dooropen)) {
_local4 = true;
}
while (((((bg.hitTest(who.virtx, who.bott, true) && (!_local4)) || (block0.hitTest(who.virtx, who.bott, true))) || (block1.hitTest(who.virtx, who.bott, true))) || (block2.hitTest(who.virtx, who.bott, true))) || (block3.hitTest(who.virtx, who.bott, true))) {
who._y = who._y - 1;
who.virty = who.virty - 1;
who.topp = who.topp - 1;
who.bott = who.bott - 1;
if (bridge1.hitTest(who.virtx, who.bott, true) && (_root.gotboots)) {
_local4 = true;
}
if (bridge2.hitTest(who.virtx, who.bott, true) && (_root.dooropen)) {
_local4 = true;
}
}
_local4 = false;
if (bridge1.hitTest(who.lef, who.virty, true) && (_root.gotboots)) {
_local4 = true;
}
if (bridge2.hitTest(who.lef, who.virty, true) && (_root.dooropen)) {
_local4 = true;
}
while (((((bg.hitTest(who.lef, who.virty, true) && (!_local4)) || (block0.hitTest(who.lef, who.virty, true))) || (block1.hitTest(who.lef, who.virty, true))) || (block2.hitTest(who.lef, who.virty, true))) || (block3.hitTest(who.lef, who.virty, true))) {
who._x = who._x + 1;
who.virtx = who.virtx + 1;
who.lef = who.lef + 1;
who.rig = who.rig + 1;
if (bridge1.hitTest(who.lef, who.virty, true) && (_root.gotboots)) {
_local4 = true;
}
if (bridge2.hitTest(who.lef, who.virty, true) && (_root.dooropen)) {
_local4 = true;
}
}
_local4 = false;
if (bridge1.hitTest(who.rig, who.virty, true) && (_root.gotboots)) {
_local4 = true;
}
if (bridge2.hitTest(who.rig, who.virty, true) && (_root.dooropen)) {
_local4 = true;
}
while (((((bg.hitTest(who.rig, who.virty, true) && (!_local4)) || (block0.hitTest(who.rig, who.virty, true))) || (block1.hitTest(who.rig, who.virty, true))) || (block2.hitTest(who.rig, who.virty, true))) || (block3.hitTest(who.rig, who.virty, true))) {
who._x = who._x - 1;
who.virtx = who.virtx - 1;
who.lef = who.lef - 1;
who.rig = who.rig - 1;
if (bridge1.hitTest(who.rig, who.virty, true) && (_root.gotboots)) {
_local4 = true;
}
if (bridge2.hitTest(who.rig, who.virty, true) && (_root.dooropen)) {
_local4 = true;
}
}
}
function chkDoorHit() {
if (bigdoor.hitarea.hitTest(dude)) {
who = dude;
who.guts.gotoAndStop("rest_" + who.dir);
cutscene = true;
_root.dooropen = true;
bigdoor.gotoAndPlay(2);
}
}
function fairyEmitter(who) {
fem++;
if (fem >= 5) {
fem = 0;
var _local4 = 0;
while (_local4 < 10) {
var _local3 = this.attachMovie("sparkle", "sparkle" + effcv, effcv + 77781818);
effcv++;
_local3._xscale = 400 + random(200);
_local3._yscale = _local3._xscale;
_local3._x = (who._x + random(40)) - 20;
_local3._y = (who._y + random(40)) - 20;
_local3._rotation = random(360);
_local3.xvel = random(10) - 5;
_local3.yvel = random(10) - 5;
_local3.cv = 0;
_local3.onEnterFrame = function () {
if (!_root.pausy) {
this._x = this._x + this.xvel;
this.xvel = this.xvel * 0.9;
this._y = this._y + this.yvel;
this.yvel = this.yvel * 0.9;
this.cv++;
this._rotation = this._rotation + 45;
if (this.cv >= 2) {
this._alpha = this._alpha - 1;
if (this._alpha <= 0) {
delete this.onEnterFrame;
this.unloadMovie();
this.removeMovieClip();
}
}
}
};
_local4++;
}
}
}
function enterF() {
_root.chkPause();
if ((!_root.pausy) && (!cutscene)) {
if (_root.gemtranny < 0) {
controls(controltar);
centerOn(dude);
} else {
if (!gemvisible) {
this.doors.bigdoor._visible = true;
var _local9 = this.doors.bigdoor["g" + _root.gemtranny];
_local9._visible = false;
gemvisible = true;
this.g = this.attachMovie("gem" + _root.gemtranny, "gem", 666881 + effcv);
effcv++;
g.cv = 0;
g._xscale = 20;
g._yscale = g._xscale;
var _local8 = this["g" + _root.gemtranny];
g._x = _local8._x - 15;
g._y = _local8._y - 50;
g.tar = this["gemtarget" + _root.gemtranny];
var _local12 = g.tar._x - g._x;
var _local11 = g.tar._y - g._y;
g.angle = Math.atan2(_local11, _local12);
g.speed = 0;
g.comp = _local9;
}
if (g.tar.hitTest(g)) {
if (!g.comp._visible) {
g.speed = 0;
_root.playLoudSound("ding");
_root.playLoudSound("gethit");
g.comp._visible = true;
var _local5 = true;
var _local3 = 0;
while (_local3 < _root.gems.length) {
if (!_root.gems[_local3]) {
_local5 = false;
}
_local3++;
}
if (_local5) {
this.doors.bigdoor._visible = false;
_root.playLoudSound("lasersplode");
_root.playLoudSound("gethit");
}
var _local6 = this.attachMovie("treesplode", "tsplode" + effcv, effcv + 88111);
effcv++;
_local6._xscale = 50;
_local6._yscale = _local6._xscale;
_local6._x = g.tar._x;
_local6._y = g.tar._y + 30;
}
g._alpha = 0;
g.cv++;
if (g.cv >= 35) {
g.comp._visible = true;
goalx = 320 - dude._x;
goaly = 240 - dude._y;
distx = goalx - this._x;
disty = goaly - this._y;
var _local10 = Math.sqrt((distx * distx) + (disty * disty));
if (_local10 > 0.5) {
this._x = this._x + (distx / 8);
this._y = this._y + (disty / 8);
} else {
centerOn(dude);
}
}
if (g.cv >= 64) {
_root.gemtranny = -1;
g.unloadMovie();
g.removeMovieClip();
}
} else {
g.comp._visible = false;
centerOn(g);
g._x = g._x + (g.speed * Math.cos(g.angle));
g._y = g._y + (g.speed * Math.sin(g.angle));
g.speed = g.speed + 0.4;
}
}
if (_root.gotkey && (!_root.dooropen)) {
chkDoorHit();
}
if ((_root.gotfairy && (!_root.fairyaccomplished)) && (!_root.indungeon)) {
fairyEmitter(fairy);
if (fairydir == 0) {
var _local8 = dude;
} else {
var _local8 = fairytar;
}
var distx = (_local8._x - fairy._x);
var disty = (_local8._y - fairy._y);
var _local4 = 40;
var _local7 = 8.5;
if (distx > (-_local4)) {
fairy._x = fairy._x + _local7;
}
if (distx < _local4) {
fairy._x = fairy._x - _local7;
}
if (disty > (-_local4)) {
fairy._y = fairy._y + _local7;
}
if (disty < _local4) {
fairy._y = fairy._y - _local7;
}
if (((((disty > (-_local4)) && (disty < _local4)) && (distx > (-_local4))) && (distx < _local4)) && (!fairy.stick)) {
fairy.stick = true;
fairy.cv = 0;
}
if (fairy.stick) {
fairy.cv++;
if (fairy.cv >= 30) {
fairy.stick = false;
fairy.cv = 0;
if (fairydir == 0) {
fairydir = 1;
} else {
fairydir = 0;
}
}
}
}
}
swapEm();
}
_root.runMusic("oworld");
stop();
U = _root.U;
D = _root.D;
L = _root.L;
R = _root.R;
this._quality = _root.qualset;
dude.moving = false;
gemtarget._alpha = 0;
framecount = 0;
enemies = new Array();
swaps = new Array();
delete this.onEnterFrame;
controltar = dude;
if ((!_root.gotfairy) || (_root.fairyaccomplished)) {
fairy._visible = false;
} else {
fairy._x = dude._x;
fairy._y = dude._y - 300;
fairydir = 0;
fem = 0;
fairy.swapDepths(99911111);
}
var reads = new Array();
reads[0] = "ISN'T THIS A LONG HALLWAY?";
reads[1] = "THREE GUARDIANS PROTECT THE WAY TO THE LAVA BEAST. THEIR QUEST IS TO TEST AND PROVE THE CHOSEN ONE.";
reads[2] = "SECOND FLOOR: ARE YOU SURE YOU GOT ALL THE KEYS ON FLOOR ONE?";
reads[3] = "DUNGEON OF THE THREE KNIGHTS: ABANDON ALL HOPE ALL YE WHO ENTER HERE.";
reads[4] = "ONLY A WORTHY KNIGHT WILL DEFEAT ALL THREE DUNGEON GUARDIANS.";
reads[5] = "THE FINAL DOOR CANNOT BE OPENED WITH KEYS...";
reads[6] = "EACH DUNGEON FLOOR HAS A LOCKED DOOR. FIND KEYS TO PASS THEM.";
reads[7] = "A POWERFUL WIZARD HIDES IN THIS DUNGEON.";
reads[8] = "FLOOR THREE: PREPARE FOR THE ULTIMATE SHOWDOWN OF ULTIMATE DESTINY.";
reads[9] = "3 KNIGHT DUNGEON: TO PASS THE PROTECTORS, PATTERN-PERCEPTION PROVES PURPOSEFUL";
reads[10] = "DOORS REMAIN UNLOCKED EVEN AFTER YOUR DEATH.";
reads[11] = "DIZZINESS IS THE PURPLE KNIGHT'S WEAKNESS";
reads[12] = "DEFEAT EACH GUARDIAN TO ADD A GEM TO THE FINAL GATE.";
reads[13] = "THE AXE IS THE RED KNIGHT'S SOURCE OF POWER. DODGE HIS AXE THROW, ATTACK HIM WHILE HE IS WEAK.";
reads[14] = "THE GREEN KNIGHT IS INVULNERABLE TO ANYTHING EXCEPT ROCK. AIM WELL YOUR STRIKES!";
reads[15] = "THIS IS ONE OF THOSE DECOY MAZE HALLWAYS...SORRY EVERY GAME HAS ONE.";
speed = 10;
effcv = 0;
curtree = 0;
this.swaps = new Array();
swaps.push(dude);
swaps.push(coverer);
dude.printcv = 0;
dude.foot = 0;
dude.dir = 2;
this.enemies = new Array();
terr1._alpha = 0;
terr2._alpha = 0;
terr3._alpha = 0;
terr4._alpha = 0;
var msgs = new Array();
if (!_root.gotboots) {
msgs[0] = "The ship has sailed for safer port. It's rumored that MAGIC BOOTS can walk on water.";
}
if (_root.gotboots) {
msgs[0] = "Those boots will help you cross, but the ISLAND BEAST will destroy you!";
}
if (_root.gotkey) {
msgs[0] = "The town blacksmith built a ship to escape the beasts. Sometimes I see it pass North of the island.";
}
if (!_root.gotboots) {
msgs[1] = "Danger is ahead! The CANYON BEAST devours all who enter its lair!";
}
if (_root.gotboots) {
msgs[1] = "Hooray, the canyon beast is dead!";
}
if (!_root.gotkey) {
msgs[2] = "The SKULL KEY opens this path. Legend says the KEY is guarded by the ISLAND BEAST.";
}
if (_root.gotkey) {
msgs[2] = "Pass three knight tower before facing the DEMON BEAST. Only one worthy and prepared may pass.";
}
msgs[3] = "Save our land from the 3 giant beasts! You're our only hope!";
msgs[4] = "A powerful wizard went into hiding somewhere in this forest ...";
var i = 0;
while (i < 5) {
var tar = eval ("helper" + i);
swaps.push(tar);
tar.msg = msgs[i];
i++;
}
outsideEnems();
_root.whichboss = 0;
gemvisible = false;
gemtarget0._alpha = 0;
gemtarget1._alpha = 0;
gemtarget2._alpha = 0;
this.onEnterFrame = function () {
enterF();
if (!_root.pausy) {
_root.datime++;
}
};
Symbol 1727 MovieClip Frame 2
tranIt();
_root.pastdungeon = false;
Symbol 1743 MovieClip Frame 1
stop();
Symbol 1747 MovieClip Frame 1
stop();
Symbol 1747 MovieClip Frame 2
_root.mappy.dude.guts.gotoAndStop("rest_" + _root.mappy.dude.dir);
Symbol 1747 MovieClip Frame 3
_root.mappy.dude.guts.gotoAndStop("rest_" + _root.mappy.dude.dir);
Symbol 1747 MovieClip Frame 4
_root.mappy.dude.guts.gotoAndStop("rest_" + _root.mappy.dude.dir);
Symbol 1747 MovieClip Frame 25
function centerIt() {
who = _root.mappy.dude;
goalx = 320 - who._x;
goaly = 240 - who._y;
distx = goalx - _root.mappy._x;
disty = goaly - _root.mappy._y;
_root.mappy._x = _root.mappy._x + (distx / 1);
_root.mappy._y = _root.mappy._y + (disty / 1);
}
who = _root.mappy.dude;
goalx = 320 - who._x;
goaly = 240 - who._y;
distx = goalx - _root.mappy._x;
disty = goaly - _root.mappy._y;
_root.mappy._x = _root.mappy._x + (distx / 1);
_root.mappy._y = _root.mappy._y + (disty / 1);
if (!_root.pastdungeon) {
if (!_root.indungeon) {
_root.mappy.gotoAndStop(2);
} else {
_root.mappy.dude.swapDepths(240);
_root.mappy.tranIt();
}
} else if (_root.indungeon) {
_root.mappy.gotoAndStop(1);
_root.mappy.dude.dir = 0;
_root.pausy = false;
_root.pastdungeon = true;
_root.indungeon = false;
_root.mappy.dungeon = false;
_root.mappy.dude._visible = true;
_root.mappy.dude.attacking = false;
_root.mappy.dude.guts.gotoAndStop("rest_" + _root.mappy.dude.dir);
_root.mappy.clearStuff();
_root.mappy.dude._x = -1440;
_root.mappy.dude._y = 240;
_root.mapp = new Array(-1440, 240);
_root.mappy.dude.swapDepths(240);
} else {
_root.pastdungeon = false;
_root.mapp = new Array(1650, -1500);
_root.mappy.dude._x = 1650;
_root.mappy.dude._y = -1500;
_root.mappy.dude._visible = true;
_root.mappy.dude.attacking = false;
_root.mappy.dude.dir = 2;
_root.mappy.dude.guts.gotoAndStop("rest_" + dude.dir);
centerIt();
_root.mappy.gotoAndStop(2);
}
Symbol 1751 MovieClip Frame 1
stop();
Symbol 1752 MovieClip Frame 1
function updateMe() {
bg._visible = false;
if (!_root.deliveredwood) {
this.wood.text = "= " + _root.woodcount;
if (_root.woodcount > 0) {
bg._visible = true;
}
} else {
this.wood.text = "";
this.woodike._visible = false;
}
if (_root.keycount <= 0) {
keyicon._visible = false;
keys.text = "";
} else {
keyicon._visible = true;
bg._visible = true;
keys.text = "=" + _root.keycount;
}
if (!_root.gotboots) {
boots._visible = false;
key._visible = false;
} else {
bg._visible = true;
}
if ((!_root.gotkey) || (_root.dooropen)) {
key._visible = false;
} else {
bg._visible = true;
key._visible = true;
}
if (!_root.gotaxe) {
woodike._visible = false;
axe._visible = false;
this.wood.text = "";
} else {
if (!_root.deliveredwood) {
this.wood.text = "= " + _root.woodcount;
woodike._visible = true;
} else {
woodike._visible = false;
this.wood.text = "";
}
axe._visible = true;
bg._visible = true;
}
}
updateMe();
Symbol 1882 MovieClip Frame 1
function moveStuff() {
fg0._x = fg0._x - (rate * 1.5);
fg1._x = fg1._x - (rate * 1.5);
if (fg0._x < (-fg0._width)) {
fg0._x = fg1._x + fg1._width;
}
if (fg1._x < (-fg1._width)) {
fg1._x = fg0._x + fg0._width;
}
ground0._x = ground0._x - rate;
ground1._x = ground1._x - rate;
if (ground0._x < (-ground0._width)) {
ground0._x = (ground1._x + ground1._width) - 1;
}
if (ground1._x < (-ground1._width)) {
ground1._x = (ground0._x + ground0._width) - 1;
}
bg0._x = bg0._x - (rate * 0.3);
bg1._x = bg1._x - (rate * 0.3);
if (bg0._x < (-bg0._width)) {
bg0._x = (bg1._x + bg1._width) - 1;
}
if (bg1._x < (-bg1._width)) {
bg1._x = (bg0._x + bg0._width) - 1;
}
bd0._x = bd0._x - rate;
bd1._x = bd1._x - rate;
if (bd0._x < (-bd0._width)) {
bd0._x = (bd1._x + bd1._width) - 1;
}
if (bd1._x < (-bd1._width)) {
bd1._x = (bd0._x + bd0._width) - 1;
}
p0._x = p0._x - rate;
p1._x = p1._x - rate;
if (p0._x < (-p0._width)) {
p0._x = (p1._x + p1._width) - 1;
}
if (p1._x < (-p1._width)) {
p1._x = (p0._x + p0._width) - 1;
}
}
function setCol(who, fil, str) {
var _local2 = new Color(who.fill);
var _local1 = new Color(who.str);
_local2.setRGB(fil);
_local1.setRGB(str);
}
function makeConfetti() {
var _local3 = 0;
while (_local3 < 15) {
var _local2 = this.attachMovie("confetti", "piece" + count, count);
count++;
_local2._x = random(640);
_local2._y = -5 - random(120);
_local2.yvel = 0;
_local2._rotation = random(360);
_local2.xvel = random(10) - 5;
_local2.spin = random(2);
if (_local2.spin == 0) {
_local2.spin = -1;
}
_local2._xscale = 115 + random(50);
setCol(_local2, cols[random(cols.length)], cols[random(cols.length)]);
_local2.onEnterFrame = function () {
this._x = this._x + this.xvel;
this._y = this._y + this.yvel;
this.yvel = this.yvel + 0.2;
this._xscale = this._xscale + (this.spin * 3);
if (this._y > 560) {
delete this.onEnterFrame;
this.unloadMovie();
this.removeMovieClip();
}
};
_local3++;
}
}
rate = 4;
dude.guts.gotoAndPlay("walk");
showSword(dude.guts.sword);
var cols = new Array("0xFF0000", "0xFFFF00", "0xFF00FF", "0x00FF00", "0xFFFFFF", "0x00FFFF");
count = 0;
cv = 0;
this.onEnterFrame = function () {
moveStuff();
cv++;
if ((cv >= 10) && (!this.noconfetti)) {
cv = 0;
makeConfetti();
}
};
Symbol 1882 MovieClip Frame 1757
noconfetti = true;
Symbol 1882 MovieClip Frame 1808
if (!_root.nospeed) {
tim.text = _root.datime;
} else {
tim.text = "[ Must be completed in one run (without quitting) for highscores! ]";
but_submit._visible = false;
}
arm.text = _root.curarmor;
mag.text = _root.curmag;
sword.text = _root.cursword;
deaths.text = _root.so.data.numdeaths;
var swords = new Array("Peasant", "Sword Training Wheels", "Sword Apprentice", "Quick Sword", "Lightning Sword", "Mega-Sword", "Ultra-Sword", "Sword Expert", "Master Swordsman");
var mags = new Array("Peasant", "Tome Reader", "Magician's Apprentice", "Magic Seeker", "Magic Man", "Low Wizard", "Mid-Wizard", "High Wizard", "Master Magician");
var arms = new Array("Peasant", "Defenseless", "Tin Man", "Copper Plated", "Chain-Mail Man", "Plate-Mail Man", "Defense Apprentice", "Defense Journeyman", "Master Defender");
var highest = 0;
var hipoint = arms;
if (_root.curarmor > highest) {
highest = _root.curarmor;
hipoint = arms;
}
if (_root.curmag > highest) {
highest = _root.curmag;
hipoint = mags;
}
if (_root.cursword > highest) {
highest = _root.cursword;
hipoint = swords;
}
rank.text = hipoint[highest];
if (((_root.curarmor == 8) && (_root.curmag == 8)) && (_root.cursword == 8)) {
rank.text = "Ultimate Master of Ultimate Destiny";
}
but_main.onPress = function () {
_root.gotoAndStop("main");
};
but_submit.onPress = function () {
var _local2 = "Chibi Knight Speedruns";
var _local3 = _root.datime;
com.newgrounds.API.postScore(_local2, _local3);
gotoAndStop ("submitted");
};
Symbol 1882 MovieClip Frame 1868
stop();
Symbol 1882 MovieClip Frame 1869
tim.text = _root.datime;
Instance of Symbol 161 MovieClip [Score Board (NewgroundsAPI)] in Symbol 1882 MovieClip Frame 1869
//component parameters
onClipEvent (construct) {
board_name = "Chibi Knight Speedruns";
period = "Today";
}