Frame 1
function doLoading() {
var _local1 = getBytesLoaded() / getBytesTotal();
if (_local1 == 1) {
clearInterval(loader);
gotoAndStop ("game");
}
}
var loader = setInterval(doLoading, 5);
stop();
Frame 5
function init() {
PROJECT_CLIP.init();
}
var PROJECT_CLIP = project;
init();
Symbol 27 Button
on (release) {
smashing.keithm.Messenger.sendMessage("ui", "goScreenRemote", {screen:"splash"});
}
Symbol 52 MovieClip Frame 1
stop();
Symbol 57 MovieClip Frame 1
stop();
Symbol 57 MovieClip Frame 5
stop();
Symbol 57 MovieClip Frame 10
stop();
Symbol 61 MovieClip Frame 1
stop();
Symbol 64 MovieClip Frame 1
stop();
Symbol 64 MovieClip Frame 5
stop();
Symbol 64 MovieClip Frame 10
stop();
Symbol 72 MovieClip Frame 1
stop();
Symbol 77 Button
on (release) {
smashing.keithm.Messenger.sendMessage("engine", "startGame");
}
Symbol 79 MovieClip [_nick_highscore_board] Frame 1
#initclip 51
Object.registerClass("_nick_highscore_board", nick.highscores.HighscoreTable);
#endinitclip
Symbol 79 MovieClip [_nick_highscore_board] Frame 7
stop();
Symbol 79 MovieClip [_nick_highscore_board] Frame 11
stop();
Symbol 79 MovieClip [_nick_highscore_board] Frame 16
stop();
Instance of Symbol 57 MovieClip "btn_next" in Symbol 79 MovieClip [_nick_highscore_board] Frame 16
on (release) {
_parent.nextPage();
}
on (rollOver) {
gotoAndStop ("over");
}
on (rollOut, dragOut) {
gotoAndStop ("off");
}
on (press) {
gotoAndStop ("down");
}
Instance of Symbol 64 MovieClip "btn_back" in Symbol 79 MovieClip [_nick_highscore_board] Frame 16
on (release) {
_parent.prevPage();
}
on (rollOver) {
gotoAndStop ("over");
}
on (rollOut, dragOut) {
gotoAndStop ("off");
}
on (press) {
gotoAndStop ("down");
}
Symbol 79 MovieClip [_nick_highscore_board] Frame 22
play();
Symbol 79 MovieClip [_nick_highscore_board] Frame 28
stop();
Symbol 166 MovieClip Frame 1
stop();
Symbol 179 MovieClip Frame 10
stop();
Symbol 192 Button
on (release) {
stop();
iris_out.gotoAndPlay(2);
btn_skip._visible = false;
}
Symbol 198 MovieClip Frame 1
stop();
Symbol 198 MovieClip Frame 2
stopAllSounds();
play();
Symbol 198 MovieClip Frame 11
smashing.keithm.Messenger.sendMessage("engine", "startGame");
stop();
Symbol 243 MovieClip Frame 1
stop();
Symbol 244 MovieClip Frame 1
stop();
Symbol 338 MovieClip Frame 1
stop();
Symbol 366 MovieClip Frame 1
stop();
Symbol 371 MovieClip Frame 1
stop();
Symbol 388 MovieClip Frame 1
stop();
Symbol 410 MovieClip Frame 1
stop();
Symbol 413 MovieClip Frame 1
stop();
Symbol 413 MovieClip Frame 5
stop();
Symbol 413 MovieClip Frame 10
stop();
Instance of Symbol 413 MovieClip "btn_next" in Symbol 414 MovieClip Frame 304
on (release) {
trace(_parent);
trace(_parent._parent);
trace(_parent._parent._parent);
_parent._parent.iris_out.gotoAndPlay(2);
_parent.nextFrame();
}
on (rollOver) {
gotoAndStop ("over");
}
on (rollOut, dragOut) {
gotoAndStop ("off");
}
on (press) {
gotoAndStop ("down");
}
Symbol 414 MovieClip Frame 356
stop();
Symbol 415 MovieClip Frame 833
stop();
Symbol 421 MovieClip Frame 71
stop();
Symbol 435 MovieClip Frame 1
stop();
Symbol 442 MovieClip Frame 1
error_mc._visible = false;
Symbol 445 MovieClip Frame 1
btn_invis.useHandCursor = false;
Symbol 445 MovieClip Frame 6
stop();
Symbol 445 MovieClip Frame 21
stop();
Symbol 465 MovieClip Frame 1
stop();
Symbol 469 MovieClip Frame 1
stop();
Symbol 477 MovieClip Frame 1
stop();
Symbol 489 MovieClip Frame 1
btn_invis.useHandCursor = false;
Symbol 489 MovieClip Frame 6
stop();
Symbol 489 MovieClip Frame 21
stop();
Symbol 518 MovieClip Frame 1
stop();
Symbol 535 MovieClip Frame 1
stop();
Symbol 544 MovieClip Frame 1
stop();
Symbol 552 MovieClip Frame 1
stop();
Symbol 552 MovieClip Frame 50
stop();
Symbol 565 MovieClip Frame 1
stop();
Symbol 565 MovieClip Frame 2
play();
Symbol 571 MovieClip Frame 1
stop();
Symbol 571 MovieClip Frame 2
play();
Symbol 580 MovieClip Frame 1
btn_invis.useHandCursor = false;
Symbol 583 MovieClip Frame 9
stop();
Symbol 584 MovieClip Frame 1
stop();
Symbol 584 MovieClip Frame 10
stop();
Symbol 586 MovieClip Frame 10
stop();
Symbol 587 MovieClip Frame 1
stop();
Symbol 612 MovieClip Frame 25
stop();
Symbol 613 MovieClip Frame 36
stop();
Symbol 679 MovieClip Frame 1
stop();
Symbol 696 MovieClip Frame 36
stop();
Symbol 700 MovieClip Frame 1
stop();
Symbol 709 MovieClip [Project] Frame 1
#initclip 50
Object.registerClass("Project", nick.yugopoMaze.Engine);
#endinitclip
Symbol 711 Button
on (keyPress "<Left>") {
return(undefined);
}
on (keyPress "<Right>") {
return(undefined);
}
on (keyPress "<Up>") {
return(undefined);
}
on (keyPress "<Down>") {
return(undefined);
}
Symbol 1037 MovieClip [__Packages.smashing.keithm.Messenger] Frame 0
class smashing.keithm.Messenger
{
static var __addresses;
function Messenger () {
}
static function registerAddress(id, obj) {
if (__addresses == undefined) {
__addresses = {};
}
__addresses[id] = obj;
}
static function removeAddress(id) {
__addresses[id] = "";
}
static function sendMessage(id, message, args) {
if ((__addresses[id] != "") && (__addresses[id] != undefined)) {
__addresses[id].onMessageReceived(message, args);
return(undefined);
}
trace("[Messenger] Error locating message recipient " + id);
}
}
Symbol 1038 MovieClip [__Packages.smashing.keithm.BaseEngine] Frame 0
class smashing.keithm.BaseEngine extends MovieClip
{
var __gameStartTime, __interval, isPaused, mouse, key;
function BaseEngine () {
super();
}
function init() {
__gameStartTime = getTimer();
__initInterval();
__initSounds();
__initGameState();
__initUI();
__initViewport();
__initMouse();
__initKey();
smashing.keithm.Messenger.registerAddress("engine", this);
}
function __initInterval() {
__interval = new smashing.keithm.IntervalEngine(this, "update");
__interval.startFast();
}
function __initSounds() {
}
function __initGameState() {
}
function __initUI() {
}
function __initViewport() {
}
function update(dt) {
}
function pause() {
isPaused = true;
}
function unpause() {
isPaused = false;
}
function onQuit() {
stopAllSounds();
destroy();
}
function destroy() {
__interval.clear();
__clearMouse();
__clearKey();
}
function __initMouse() {
mouse = {};
mouse.owner = this;
Mouse.addListener(mouse);
}
function __clearMouse() {
Mouse.removeListener(mouse);
}
function mouse_up() {
}
function mouse_down() {
}
function __initKey() {
key = {};
key.owner = this;
Key.addListener(key);
}
function __clearKey() {
Key.removeListener(key);
}
function key_down() {
}
function key_up() {
}
function onMessageReceived(message, args) {
this[message](args);
}
}
Symbol 1039 MovieClip [__Packages.smashing.keithm.IntervalEngine] Frame 0
class smashing.keithm.IntervalEngine
{
var _uo, _uf, _update_interval, _last_update, _i, _ft, _el;
function IntervalEngine (update_object, update_function) {
_uo = update_object;
_uf = update_function;
}
function startFlat(FPS) {
_FPS = FPS;
_update_interval = 1 / FPS;
_last_update = getTimer() * 0.001;
_i = setInterval(this, "_flat_step", 0);
}
function startFlex() {
_last_update = getTimer() * 0.001;
_i = setInterval(this, "_flex_step", 0);
}
function startFast() {
_last_update = getTimer();
_i = setInterval(this, "_fast_step", 0);
}
function pause(Void) {
_is_paused = true;
}
function unpause(Void) {
_is_paused = false;
}
function reset(Void) {
if (_i != undefined) {
clearInterval(_i);
}
_ft = 0;
_last_update = getTimer() * 0.001;
_lel = _MAX_FRAMETIME / 2;
pause();
}
function _flex_step(Void) {
if (_is_paused) {
_last_update = getTimer() * 0.001;
return(undefined);
}
_el = Math.min(_MAX_FRAMETIME, (-_last_update) + ((_last_update = getTimer() * 0.001)));
_lel = _lel - Math.max(-_MAX_TIMEDIFF, Math.min(_MAX_TIMEDIFF, _lel - _el));
_uo[_uf](_lel);
}
function _flat_step(Void) {
if (_is_paused) {
return(undefined);
}
_ft = _ft + ((-_last_update) + ((_last_update = getTimer() * 0.001)));
if (_ft < _update_interval) {
return(undefined);
}
_uo[_uf](_ft);
_ft = 0;
}
function _fast_step(Void) {
_el = (-_last_update) + ((_last_update = getTimer()));
_uo[_uf](_el * 0.001);
}
function clear() {
clearInterval(_i);
}
var _MAX_TIMEDIFF = 0.005;
var _MIN_FPS = 5;
var _MAX_FRAMETIME = 1 / smashing.keithm.IntervalEngine.prototype._MIN_FPS;
var _lel = 0.2;
var _FPS = 0;
var _is_paused = false;
}
Symbol 1040 MovieClip [__Packages.nick.yugopoMaze.Engine] Frame 0
class nick.yugopoMaze.Engine extends smashing.keithm.BaseEngine
{
var activeWorld, pause, __UI, __interval, __sounds, viewport_mc, __state, isPaused, unpause, gotoAndStop, mouse, mouseHD_mc, _xmouse, _ymouse, key, __gameStartTime;
function Engine () {
super();
}
function init() {
super.init();
activeWorld = new nick.yugopoMaze.World();
activeWorld.init(this);
nick.highscores.HighscoreEngine.init();
pause();
__UI.goScreen("splash");
}
function __initInterval() {
__interval = new smashing.keithm.IntervalEngine(this, "update");
__interval.startFast();
}
function __initSounds() {
nick.yugopoMaze.Sounds.init();
__sounds = nick.yugopoMaze.Sounds.getInstance();
__sounds.generateSounds(viewport_mc);
}
function __initGameState() {
nick.yugopoMaze.GameState.init();
__state = nick.yugopoMaze.GameState.getInstance();
__state.hasWendysCode = false;
}
function __initUI() {
nick.yugopoMaze.ui.UI.init();
__UI = nick.yugopoMaze.ui.UI.getInstance();
__UI.linkEngine(this);
__UI.reset();
}
function __initViewport() {
smashing.keithm.Viewport.init(viewport_mc, 2, nick.yugopoMaze.GameState.getInstance());
var _local2 = smashing.keithm.Viewport.getInstance();
_local2.setScrollport(1);
_local2.createGroup({name:"bg", index:0, slots:20, scrollport:true});
_local2.createGroup({name:"edge", index:1, slots:20, scrollport:true});
_local2.createGroup({name:"patch", index:2, slots:20});
_local2.createGroup({name:"map", index:3, slots:1, scrollport:true});
_local2.createGroup({name:"pickup", index:4, slots:100});
_local2.createGroup({name:"effect", index:5, slots:100, sortAxis:"", reverse:false});
_local2.createGroup({name:"dynamic", index:6, slots:100, sortAxis:"y", ascending:true});
_local2.reset();
}
function viewHighscore() {
__UI.goScreen("viewHighscore");
}
function sendHighscore() {
__UI.goScreen("sendHighscore");
}
function update(dt) {
if (!isPaused) {
activeWorld.update(dt);
}
__UI.update(dt);
__state.hasChanged = false;
updateAfterEvent();
}
function startGame() {
__state.reset();
startLevel();
}
function startLevel() {
__UI.goScreen("gameplay");
trace("Start Music!");
__state.resetLevel();
__sounds.playMusic();
activeWorld.generate(new nick.yugopoMaze.levels.LevelRandom());
smashing.keithm.Viewport.getInstance().newView();
activeWorld.start();
unpause();
}
function endLevel(success) {
pause();
__state.addTimeScore();
__state.levelNum++;
__UI.goScreen("levelTrans");
__sounds.stopMusic();
}
function endGame() {
pause();
clear();
__sounds.stopMusic();
__UI.goScreen("splash");
}
function clear() {
activeWorld.clear();
smashing.keithm.Viewport.getInstance().newView();
}
function toggleMusic() {
__sounds.toggleMusic();
smashing.keithm.Messenger.sendMessage("screen", "updateMuteButton", {isMuted:__sounds.muteMusic});
}
function submitWendysCode(t_data) {
if (t_data.code.toLowerCase() == __WENDYS_CODE.toLowerCase()) {
__state.hasWendysCode = true;
__UI.goScreen("intro");
return(undefined);
}
smashing.keithm.Messenger.sendMessage("screen", "showError");
}
function showWendys() {
pause();
__UI.goScreen("wendys");
}
function showHelp() {
pause();
__UI.goScreen("help");
}
function hideHelp() {
unpause();
__UI.returnToPreviousScreen();
}
function winGame() {
trace("Win Game");
pause();
(gotoAndStop("end"));// not popped
}
function gameOver() {
pause();
smashing.keithm.Messenger.sendMessage("ui", "goScreenRemote", {screen:"gameover"});
}
function __initMouse() {
}
function __clearMouse() {
Mouse.removeListener(mouse);
}
function mouse_up() {
if (!isPaused) {
if (mouseHD_mc.hitTest(_xmouse, _ymouse)) {
activeWorld.setTargetPoint(_xmouse, _ymouse);
}
}
}
function __initKey() {
key = {};
key.owner = this;
key.onKeyDown = function () {
this.owner.key_down();
};
key.onKeyUp = function () {
this.owner.key_up();
};
Key.addListener(key);
}
function __clearKey() {
Key.removeListener(key);
}
function key_down() {
if (Key.getCode() == 32) {
activeWorld.usePowerup();
} else if ((Key.getCode() > 36) && (Key.getCode() < 41)) {
activeWorld.onMoveKeyPress(Key.getCode());
}
}
function key_up() {
var _local2 = Key.getCode();
if (_local2 == 32) {
} else if ((_local2 > 36) && (_local2 < 41)) {
activeWorld.onMoveKeyRelease(_local2);
}
}
function get gameStartTime() {
return(__gameStartTime);
}
var __STARTLEVEL = 0;
var __WENDYS_CODE = "pappy";
}
Symbol 1041 MovieClip [__Packages.nick.yugopoMaze.World] Frame 0
class nick.yugopoMaze.World
{
var engine, __state, __targetPoint, __pickupsCollected, __isSpaceDown, __entitys, __effects, __player, __camera, __mapArt, loop, __scenery, __grid, __drawnTiles, loopb, __maxZaps, __totalZaps, __pickupsTotal;
function World () {
}
function init(t_engine) {
engine = t_engine;
__state = nick.yugopoMaze.GameState.getInstance();
smashing.keithm.Messenger.registerAddress("world", this);
}
function start() {
__targetPoint = null;
__pickupsCollected = 0;
__isSpaceDown = false;
}
function clear() {
__entitys = [];
__effects = [];
}
function update(dt) {
if (dt > 0.2) {
dt = 0.2;
}
__player.update(dt);
if (__player.hasChangedCells()) {
runGridHD(dt, __player);
}
__camera.update(dt, __player);
__mapArt.render(__camera, dt);
loop = __entitys.length;
var _local2;
while (loop--) {
_local2 = __entitys[loop];
if (_local2.doUpdate) {
_local2.update(dt);
if (_local2.isDrawn && (_local2.isAlive)) {
if (__player.runHD(_local2, dt)) {
_local2.hitReact(__player);
__player.hitReact(_local2);
}
}
if (_local2.doRemove) {
__entitys.splice(loop, 1);
} else {
_local2.render(__camera, dt);
}
}
}
__player.moveAndRender(__camera, dt);
if (__targetPoint != null) {
__targetPoint.render(__camera, dt);
}
loop = __scenery.length;
while (loop--) {
__scenery[loop].updateMoveAndRender(__camera, dt);
}
loop = __effects.length;
while (loop--) {
_local2 = __effects[loop];
if (!_local2.isAlive) {
__effects.splice(loop, 1);
}
_local2.updateMoveAndRender(__camera, dt);
}
__state.updateTime(dt);
}
function drawTargetPoint(t_x, t_y) {
if (__targetPoint != null) {
clearTargetPoint();
}
__targetPoint = new nick.yugopoMaze.ents.Effect({x:t_x, y:t_y, asset:"moveTarget_mc", owner:this, camera:__camera});
__targetPoint.spawn();
}
function clearTargetPoint() {
__targetPoint.requestErase();
__targetPoint = null;
}
function setTargetPoint(t_x, t_y) {
__player.setTargetPoint(__camera.left + t_x, __camera.top + t_y);
}
function runGridHD(el, entity) {
if ((entity.nextCellY() == 0) || (entity.nextCellY() == (__grid[0].length - 1))) {
entity.onGridCollision(el);
return(undefined);
}
if (!__grid[entity.nextCellX()][entity.nextCellY()].canPass(entity)) {
entity.onGridCollision(el);
}
}
function generate(ldata) {
ldata.loadData();
__camera = new nick.yugopoMaze.GameCamera({x:ldata.camera.x, y:ldata.camera.y, dimensions:nick.yugopoMaze.GameState.getInstance()});
__camera.setBounds(0, ldata.grid_width * nick.yugopoMaze.GameState.getInstance().CELL_WIDTH, 0, ldata.grid_height * nick.yugopoMaze.GameState.getInstance().CELL_HEIGHT);
ldata.player.owner = this;
ldata.player.camera = __camera;
__player = new nick.yugopoMaze.ents.Player(ldata.player);
__drawnTiles = [];
__grid = [];
loop = ldata.grid_width;
while (loop--) {
__grid[loop] = [];
loopb = ldata.grid_height;
while (loopb--) {
__grid[loop][loopb] = new nick.yugopoMaze.cells.Cell({x:loop, y:loopb, owner:this});
}
}
var _local2 = ldata.walls.length;
while (_local2--) {
ldata.walls[_local2].owner = this;
__grid[ldata.walls[_local2].x][ldata.walls[_local2].y] = new nick.yugopoMaze.cells.Wall(ldata.walls[_local2]);
}
__mapArt = new nick.yugopoMaze.cells.MapArt({grid:__grid, x:0, y:0, owner:this, camera:__camera});
__entitys = [];
__maxZaps = 3 + Math.floor(__state.levelNum * 0.3);
__totalZaps = 0;
generatePickupsAndSpecials();
_local2 = ldata.aliens.length;
while (_local2--) {
ldata.aliens[_local2].owner = this;
ldata.aliens[_local2].camera = __camera;
__entitys.push(new nick.yugopoMaze.ents.Alien(ldata.aliens[_local2]));
}
__scenery = [];
_local2 = ldata.scenery.length;
while (_local2--) {
ldata.scenery[_local2].owner = this;
ldata.scenery[_local2].camera = __camera;
if (ldata.scenery[_local2].type == "ground") {
__scenery.push(new nick.yugopoMaze.ents.Scenery(ldata.scenery[_local2]));
} else if (ldata.scenery[_local2].type == "edge") {
__scenery.push(new nick.yugopoMaze.ents.Scenery_Edge(ldata.scenery[_local2]));
} else {
__scenery.push(new nick.yugopoMaze.ents.Scenery_Patch(ldata.scenery[_local2]));
}
}
__effects = [];
}
function onMoveKeyPress(code) {
__player.onMoveKeyPress(code);
}
function onMoveKeyRelease(code) {
__player.onMoveKeyRelease(code);
}
function generatePickupsAndSpecials() {
var _local4 = [];
var _local3 = [];
var _local10 = [];
var _local5 = [];
var _local11 = [];
var _local2;
loop = __grid.length;
while (loop--) {
loopb = __grid[loop].length;
while (loopb--) {
_local2 = 0;
if (__grid[loop][loopb - 1].TYPE == "wall") {
_local2++;
}
if (__grid[loop][loopb + 1].TYPE == "wall") {
_local2++;
}
if ((__grid[loop - 1][loopb].TYPE == "wall") || ((loop - 1) == -1)) {
_local2++;
}
if ((__grid[loop + 1][loopb].TYPE == "wall") || ((loop + 1) == __grid.length)) {
_local2++;
}
if (__grid[loop][loopb].TYPE == "wall") {
if (((_local2 == 3) && (loopb != 0)) && (loopb != 19)) {
_local11.push(__grid[loop][loopb]);
}
if (_local2 == 4) {
_local5.push(__grid[loop][loopb]);
}
} else if (_local2 == 2) {
if (((__grid[loop - 1][loopb].TYPE == "wall") && (__grid[loop + 1][loopb].TYPE == "wall")) || ((__grid[loop][loopb - 1].TYPE == "wall") && (__grid[loop][loopb + 1].TYPE == "wall"))) {
_local10.push(__grid[loop][loopb]);
} else {
_local3.push(__grid[loop][loopb]);
}
} else if ((_local2 == 3) && (loopb < (nick.yugopoMaze.GameState.getInstance().MAP_HEIGHT - 1))) {
_local4.push(__grid[loop][loopb]);
}
}
}
__pickupsTotal = 0;
var _local7 = false;
var _local8 = false;
var _local9 = (nick.yugopoMaze.GameState.getInstance().hasWendysCode ? false : true);
var _local6 = ((Math.random() > 0.5) ? true : false);
if (((__state.hasBear && (__state.hasChoco)) && (__state.hasFlower)) == false) {
_local6 = false;
}
loop = _local4.length;
while (loop--) {
if (!_local7) {
generateExit(_local4[loop]);
_local7 = true;
} else if (!_local8) {
generateKey(_local4[loop]);
_local8 = true;
} else if (!_local9) {
generateWendys(_local4[loop]);
_local9 = true;
} else if (!_local6) {
generatePowerup(_local4[loop]);
_local6 = true;
} else {
generatePickup(_local4[loop]);
}
}
loop = _local3.length;
while (loop--) {
if (!_local7) {
generateExit(_local3[loop]);
_local7 = true;
} else if (!_local8) {
generateKey(_local3[loop]);
_local8 = true;
} else if (!_local9) {
generateWendys(_local3[loop]);
_local9 = true;
} else if (!_local6) {
generatePowerup(_local3[loop]);
_local6 = true;
} else {
generatePickup(_local3[loop], true);
}
}
loop = _local10.length;
while (loop--) {
generatePickupOrZapTile(_local10[loop]);
}
generateSpaceWindows(_local11);
loop = _local5.length;
while (loop--) {
_local5[loop].assetID = _local5[loop].assetID + "_closed";
}
_local5 = [];
_local3 = [];
_local4 = [];
}
function generatePickup(tile, force) {
if (((force == true) || (Math.random() <= __PICKUP_ODDS)) && (__pickupsTotal <= (__state.levelNum * 3))) {
__pickupsTotal++;
__entitys.push(new nick.yugopoMaze.ents.Pickup({x:tile.x, y:tile.y, owner:this, camera:__camera}));
return(true);
}
return(false);
}
function generatePickupOrZapTile(tile) {
if (!generatePickup(tile)) {
if (((tile.y < 19) && (__totalZaps < __maxZaps)) && (Math.random() <= __ZAP_ODDS)) {
if ((Math.ceil(__state.levelNum / 5) % 2) == 1) {
__entitys.push(new nick.yugopoMaze.ents.ZapTile({x:tile.x, y:tile.y, owner:this, camera:__camera}));
} else {
__entitys.push(new nick.yugopoMaze.ents.TrapTile({x:tile.x, y:tile.y, owner:this, camera:__camera}));
}
__totalZaps++;
}
}
}
function generatePowerup(tile) {
__entitys.push(new nick.yugopoMaze.ents.Powerup({x:tile.x, y:tile.y, owner:this, camera:__camera}));
}
function generateKey(tile) {
__entitys.push(new nick.yugopoMaze.ents.BlastKey({x:tile.x, y:tile.y, owner:this, camera:__camera}));
}
function generateWendys(tile) {
__entitys.push(new nick.yugopoMaze.ents.WendysPickup({x:tile.x, y:tile.y, owner:this, camera:__camera}));
}
function generateExit(tile) {
__entitys.push(new nick.yugopoMaze.ents.Exit({x:tile.x, y:tile.y, owner:this, camera:__camera}));
}
function generateSpaceWindows(fringeWalls) {
var _local5 = 1 + ((Math.random() > 0.22) ? 1 : 0);
var _local6 = 10;
var _local7;
var _local2;
var _local4;
var _local3 = [];
while ((_local5 > 0) && (_local6 > 0)) {
_local7 = Math.floor(Math.random() * (fringeWalls.length - 1));
_local2 = fringeWalls[_local7];
_local4 = __grid[_local2.x - 1][_local2.y];
if ((((!testSpaceWindowUsedSpaces(_local3, _local2.x - 1, _local2.y)) && (!testSpaceWindowUsedSpaces(_local3, _local2.x, _local2.y))) && (!testSpaceWindowUsedSpaces(_local3, _local2.x - 1, _local2.y + 1))) && (!testSpaceWindowUsedSpaces(_local3, _local2.x, _local2.y + 1))) {
if (((_local4.TYPE == "wall") && (__grid[_local2.x][_local2.y + 1].TYPE == "wall")) && (__grid[_local2.x - 1][_local2.y + 1].TYPE == "wall")) {
_local3.push({x:_local2.x, y:_local2.y});
_local3.push({x:_local2.x - 1, y:_local2.y});
_local3.push({x:_local2.x - 1, y:_local2.y + 1});
_local3.push({x:_local2.x, y:_local2.y + 1});
_local5--;
__entitys.push(new nick.yugopoMaze.ents.SpaceWindow({x:_local4.x, y:_local4.y, owner:this, camera:__camera}));
}
}
_local6--;
}
}
function testSpaceWindowUsedSpaces(array, x, y) {
var _local1 = array.length;
while (_local1--) {
if ((array[_local1].x == x) && (array[_local1].y == y)) {
return(true);
}
}
return(false);
}
function addScore(val) {
__state.addScore(val);
}
function collectPickup() {
__pickupsCollected++;
}
function hasCollectedPickups() {
if (__pickupsTotal == 0) {
return(true);
}
return((((__pickupsCollected / __pickupsTotal) == 1) ? true : false));
}
function getPickupsRemaining() {
return(__pickupsTotal - __pickupsCollected);
}
function clickPowerup(t_data) {
trace("CLICK! " + t_data.type);
usePowerup(t_data.type);
}
function usePowerup(t_type) {
if (!__player.canUsePowerup()) {
return(undefined);
}
if (t_type != undefined) {
if (__state.hasPowerup(t_type)) {
__player.usePowerup(t_type);
__state.usePowerup(t_type);
}
} else if (__state.hasFlower) {
__player.usePowerup("flower");
__state.usePowerup("flower");
} else if (__state.hasChoco) {
__player.usePowerup("chocolate");
__state.usePowerup("chocolate");
} else if (__state.hasBear) {
__player.usePowerup("teddybear");
__state.usePowerup("teddybear");
}
}
function onWendysPickup() {
var _local2 = Math.random();
if (_local2 < 0.39) {
smashing.keithm.Messenger.sendMessage("screen", "showWendysEffect", {effect:"speed"});
onWendysSpeed();
} else if (_local2 < 0.79) {
smashing.keithm.Messenger.sendMessage("screen", "showWendysEffect", {effect:"ghost"});
onWendysGhost();
} else {
smashing.keithm.Messenger.sendMessage("screen", "showWendysEffect", {effect:"nuke"});
onWendysNuke();
}
}
function onWendysSpeed() {
trace("SPEED");
__player.applyWendysSpeed();
}
function onWendysGhost() {
trace("GHOST!");
__player.applyWendysGhost();
}
function onWendysNuke() {
trace("NUKE!");
var _local3 = __entitys.length;
var _local2;
while (_local3--) {
_local2 = __entitys[_local3];
if ((_local2.TYPE == "alien") && (_local2.isDrawn)) {
_local2.startDie();
}
}
}
function onMessageReceived(message, args) {
this[message](args);
}
var __PICKUP_ODDS = 0.2;
var __ZAP_ODDS = 0.2;
}
Symbol 1042 MovieClip [__Packages.smashing.keithm.BaseCamera] Frame 0
class smashing.keithm.BaseCamera
{
var __dimensions, x, y, z, fl, farClip, __bound_left, __bound_right, __bound_top, __bound_bottom, left, right, top, bottom;
function BaseCamera (t_data) {
__dimensions = t_data.dimensions;
x = (y = (z = 0));
if (t_data.x != undefined) {
x = t_data.x;
}
if (t_data.y != undefined) {
y = t_data.y;
}
if (t_data.z != undefined) {
z = t_data.z;
}
fl = fl_DEF;
farClip = __DEF_CLIP;
refreshEdges();
}
function update(dt) {
}
function setBounds(left, right, top, bottom) {
__bound_left = left + __dimensions.HALF_WIDTH;
__bound_right = right - __dimensions.HALF_WIDTH;
__bound_top = top + __dimensions.HALF_HEIGHT;
__bound_bottom = bottom - __dimensions.HALF_HEIGHT;
}
function enforceBounds() {
if (x < __bound_left) {
x = __bound_left;
} else if (x > __bound_right) {
x = __bound_right;
}
if (y < __bound_top) {
y = __bound_top;
} else if (y > __bound_bottom) {
y = __bound_bottom;
}
}
function refreshEdges() {
left = x - __dimensions.HALF_WIDTH;
right = x + __dimensions.HALF_WIDTH;
top = y - __dimensions.HALF_HEIGHT;
bottom = y + __dimensions.HALF_HEIGHT;
}
function get sc() {
return(__dimensions.sc);
}
function screenWidth() {
return(__dimensions.SCREEN_WIDTH);
}
function screenHeight() {
return(__dimensions.SCREEN_WIDTH);
}
function halfWidth() {
return(__dimensions.HALF_WIDTH);
}
function halfHeight() {
return(__dimensions.HALF_HEIGHT);
}
function toString() {
return((((("Camera : focus : " + x) + " , ") + y) + " , ") + z);
}
var __DEF_CLIP = 100000;
var fl_DEF = 1000;
var __EDGE_PADDING = 50;
}
Symbol 1043 MovieClip [__Packages.nick.yugopoMaze.GameCamera] Frame 0
class nick.yugopoMaze.GameCamera extends smashing.keithm.BaseCamera
{
var x, __dimensions, y, refreshEdges, has_moved, enforceBounds;
function GameCamera (t_data) {
super(t_data);
x = x * __dimensions.CELL_WIDTH;
y = y * __dimensions.CELL_HEIGHT;
refreshEdges();
has_moved = true;
}
function update(el, player) {
has_moved = false;
var _local4 = player.nextX - x;
var _local3 = player.nextY - y;
if (_local4 > __SCROLL_TETHER_H) {
x = player.nextX - __SCROLL_TETHER_H;
has_moved = true;
} else if (_local4 < (-__SCROLL_TETHER_H)) {
x = player.nextX + __SCROLL_TETHER_H;
has_moved = true;
}
if (_local3 > __SCROLL_TETHER_BOTTOM) {
y = player.nextY - __SCROLL_TETHER_BOTTOM;
has_moved = true;
} else if (_local3 < (-__SCROLL_TETHER_TOP)) {
y = player.nextY + __SCROLL_TETHER_TOP;
has_moved = true;
}
refreshEdges();
enforceBounds();
}
function getCellsOnscreen() {
return({left:Math.floor((x - __dimensions.sc.x) / __dimensions.CELL_WIDTH), right:Math.ceil((x + __dimensions.sc.x) / __dimensions.CELL_WIDTH), top:Math.floor((y - __dimensions.sc.y) / __dimensions.CELL_HEIGHT), bottom:Math.floor((y + __dimensions.sc.y) / __dimensions.CELL_HEIGHT)});
}
var __ENFORCE_BOUNDS = true;
var __SCROLL_TETHER_H = 80;
var __SCROLL_TETHER_BOTTOM = 25;
var __SCROLL_TETHER_TOP = 25;
}
Symbol 1044 MovieClip [__Packages.nick.yugopoMaze.GameState] Frame 0
class nick.yugopoMaze.GameState
{
static var __instance;
var score, lives, levelNum, hasFlower, hasBear, hasChoco, hasChanged, timeRemaining, totalTime, hasKey, __pauseTimer, __ringsPlayed;
function GameState () {
}
static function init() {
__instance = new nick.yugopoMaze.GameState();
}
static function getInstance() {
return(__instance);
}
function reset() {
score = 0;
lives = 3;
levelNum = 1;
hasFlower = true;
hasBear = (hasChoco = false);
hasChanged = true;
}
function resetLevel() {
timeRemaining = (totalTime = __BASE_TIME - (levelNum * 5));
if (timeRemaining < __MIN_TIME) {
timeRemaining = (totalTime = __MIN_TIME);
}
hasKey = false;
__pauseTimer = false;
__ringsPlayed = 0;
hasChanged = true;
}
function pauseTimer() {
__pauseTimer = true;
}
function updateTime(dt) {
if (__pauseTimer) {
return(undefined);
}
timeRemaining = timeRemaining - dt;
if (timeRemaining <= 0) {
smashing.keithm.Messenger.sendMessage("engine", "gameOver");
nick.yugopoMaze.Sounds.getInstance().p("alarm");
} else if (timeRemaining < 15) {
if (__ringsPlayed == 0) {
nick.yugopoMaze.Sounds.getInstance().p("alarm");
__ringsPlayed++;
} else if ((timeRemaining < 10) && (__ringsPlayed == 1)) {
nick.yugopoMaze.Sounds.getInstance().p("alarm");
__ringsPlayed++;
} else if ((timeRemaining < 5) && (__ringsPlayed == 2)) {
nick.yugopoMaze.Sounds.getInstance().p("alarm");
__ringsPlayed++;
}
}
}
function getTimeRatio() {
return(timeRemaining / totalTime);
}
function loseLife() {
lives--;
if (lives <= 0) {
smashing.keithm.Messenger.sendMessage("engine", "gameOver");
}
hasChanged = true;
}
function addScore(val) {
score = score + val;
hasChanged = true;
}
function addTimeScore() {
addScore(Math.floor(timeRemaining * 2));
}
function addPowerup(type) {
if (type == "teddybear") {
hasBear = true;
} else if (type == "flower") {
hasFlower = true;
} else {
hasChoco = true;
}
hasChanged = true;
}
function hasPowerup(type) {
if ((type == "teddybear") && (hasBear)) {
return(true);
}
if ((type == "flower") && (hasFlower)) {
return(true);
}
if ((type == "chocolate") && (hasChoco)) {
return(true);
}
}
function usePowerup(type) {
if (type == "teddybear") {
hasBear = false;
} else if (type == "flower") {
hasFlower = false;
} else {
hasChoco = false;
}
hasChanged = true;
}
function get screenWidth() {
return(SCREEN_WIDTH);
}
function get screenHeight() {
return(SCREEN_HEIGHT);
}
function get halfWidth() {
return(HALF_WIDTH);
}
function get halfHeight() {
return(HALF_HEIGHT);
}
var __BASE_TIME = 110;
var __MIN_TIME = 35;
var SCREEN_WIDTH = Stage.width;
var SCREEN_HEIGHT = Stage.height;
var HALF_WIDTH = Stage.width / 2;
var HALF_HEIGHT = Stage.height / 2;
var CELL_WIDTH = 58;
var CELL_HEIGHT = 58;
var CELL_WIDTH_HALF = nick.yugopoMaze.GameState.prototype.CELL_WIDTH / 2;
var CELL_HEIGHT_HALF = nick.yugopoMaze.GameState.prototype.CELL_HEIGHT / 2;
var MAP_WIDTH = 15;
var MAP_HEIGHT = 20;
var sc = {x:Stage.width / 2, y:Stage.height / 2};
}
Symbol 1045 MovieClip [__Packages.smashing.sound.SoundEngine] Frame 0
class smashing.sound.SoundEngine
{
var __mc, o_sounds, o_groups, __a_soundQueue, __flag_muted, __flag_overwrite, __groupCount, __callbackPath, __callbackFunc;
function SoundEngine () {
}
function generateSounds(t_path, t_depth, t_overwrite) {
__mc = t_path.createEmptyMovieClip(__DEFAULTMCNAME, t_depth);
o_sounds = {};
o_groups = {};
__a_soundQueue = [];
__flag_muted = false;
if (t_overwrite == undefined) {
t_overwrite = false;
}
__flag_overwrite = t_overwrite;
__groupCount = 0;
createGroup(__DEFAULTGROUPNAME);
trace("-- Init Sound Engine -- ");
}
function setCallback(path, func) {
__callbackPath = path;
__callbackFunc = func;
}
function createGroup(t_name) {
__groupCount++;
var _local2 = __mc.createEmptyMovieClip(t_name, __groupCount);
_local2.soundObject = new Sound(_local2);
o_groups[t_name] = _local2;
}
function createSound(t_name, t_assetID, t_groupName, doCallback) {
var _local4;
if (((t_groupName == undefined) || (t_groupName == "")) || (t_groupName == null)) {
_local4 = o_groups[__DEFAULTGROUPNAME];
} else {
_local4 = o_groups[t_groupName];
}
if (_local4 != undefined) {
var _local2 = {};
_local2.soundEffect = new Sound(_local4);
_local2.soundEffect.attachSound(t_assetID);
if (doCallback == undefined) {
doCallback = false;
}
_local2.doCallback = doCallback;
o_sounds[t_name] = _local2;
} else {
trace(("Error Locating Group " + t_groupName) + " for create Sound");
}
}
function playSound(t_soundName, t_loops, t_queued) {
if (__flag_muted) {
return(undefined);
}
var _local2 = o_sounds[t_soundName];
if (_local2 != undefined) {
if (t_loops == undefined) {
t_loops = 1;
} else if (t_loops == 0) {
t_loops = 100000 /* 0x0186A0 */;
}
if (__flag_overwrite) {
_local2.soundEffect.stop();
}
if (t_queued == true) {
__a_soundQueue[0].doCallback = _local2.doCallback;
_local2.soundEffect.onSoundComplete = mx.utils.Delegate.create(this, onQueuedSoundComplete);
} else if (_local2.doCallback) {
_local2.soundEffect.owner = this;
_local2.soundEffect.myName = t_soundName;
_local2.soundEffect.onSoundComplete = function () {
this.owner.onCallbackSoundComplete(this.myName);
};
}
_local2.soundEffect.start(0, t_loops);
} else {
trace(("Error - sound " + t_soundName) + " not found");
}
}
function stopSound(t_soundName) {
o_sounds[t_soundName].soundEffect.stop();
}
function stopAll() {
clearQueue();
stopAllSounds();
}
function changeVolume(t_vol, t_groupName) {
if (t_groupName == undefined) {
t_groupName = __DEFAULTGROUPNAME;
}
o_groups[t_groupName].soundObject.setVolume(t_vol);
}
function toggleSound() {
if (__flag_muted) {
soundOn();
} else {
soundOff();
}
return(!__flag_muted);
}
function soundOff() {
__flag_muted = true;
}
function soundOn() {
__flag_muted = false;
}
function callbackSound(t_soundName, t_loops, path, func) {
playSound(t_soundName, t_loops, false);
var _local2 = o_sounds[t_soundName];
_local2.soundEffect.cbpath = path;
_local2.soundEffect.cbfunc = func;
_local2.soundEffect.onSoundComplete = function () {
this.onSoundComplete = null;
this.cbpath[func]();
};
}
function onCallbackSoundComplete(name) {
__callbackPath[__callbackFunc](name);
}
function queueSound(t_soundName) {
__a_soundQueue.push({soundName:t_soundName, isPlaying:false, doCallback:false});
__playQueue();
}
function __playQueue() {
if (__a_soundQueue.length == 0) {
return(undefined);
}
if (!__a_soundQueue[0].isPlaying) {
playSound(__a_soundQueue[0].soundName, 1, true);
__a_soundQueue[0].isPlaying = true;
}
}
function onQueuedSoundComplete() {
if (__a_soundQueue[0].doCallback) {
onCallbackSoundComplete(__a_soundQueue[0].soundName);
}
__a_soundQueue.splice(0, 1);
__playQueue();
}
function clearQueue() {
__a_soundQueue = [__a_soundQueue[0]];
}
function get queueLength() {
return(__a_soundQueue.length);
}
function get isQueuePlaying() {
if (__a_soundQueue.length == 0) {
return(false);
}
return(true);
}
var __DEFAULTMCNAME = "soundEngine_MC";
var __DEFAULTGROUPNAME = "sound";
}
Symbol 1046 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 1047 MovieClip [__Packages.nick.yugopoMaze.Sounds] Frame 0
class nick.yugopoMaze.Sounds extends smashing.sound.SoundEngine
{
static var __instance;
var createGroup, createSound, changeVolume, __currentMusic, muteSound, queueSound, callbackSound, muteMusic, stopSound, __get__isQueuePlaying;
function Sounds () {
super();
}
static function init() {
__instance = new nick.yugopoMaze.Sounds();
}
static function getInstance() {
return(__instance);
}
function generateSounds(path) {
super.generateSounds(path, __DEPTH, __DO_OVERWRITE);
createGroup("music");
createSound("music", "game_music.mp3", "music");
changeVolume(60, "music");
createSound("pickup_nickel", "nickel_clink.wav");
createSound("pickup_key", "transition.wav");
createSound("pickup_powerup", "weaponPickup.mp3");
createSound("pickup_teddybear", "bearSound.wav");
createSound("pickup_chocolate", "chocolate.wav");
createSound("pickup_flower", "cosmo_beautiful.wav");
createSound("powerup_off", "timeLow.mp3");
createSound("alarm", "alarm.wav");
__currentMusic = "";
}
function playSound(name, loops) {
if (muteSound == true) {
return(undefined);
}
super.playSound(name, loops);
}
function p(name) {
playSound(name, 1);
}
function q(name) {
queueSound(name);
}
function c(name, cbpath, cbfunc) {
callbackSound(name, 1, cbpath, cbfunc);
}
function playMusic(name) {
if (name == undefined) {
name = "music";
}
if (muteMusic) {
__currentMusic = name;
return(undefined);
}
if ((__currentMusic != "") && (__currentMusic != undefined)) {
stopMusic();
}
__currentMusic = name;
playSound(__currentMusic, 0);
}
function restartMusic() {
if (muteMusic) {
return(undefined);
}
if ((__currentMusic == "") || (__currentMusic == undefined)) {
return(undefined);
}
playMusic(__currentMusic);
}
function stopMusic() {
stopSound(__currentMusic);
}
function toggleMusic() {
muteMusic = !muteMusic;
if (muteMusic) {
stopMusic();
} else {
playMusic(__currentMusic);
}
}
function playOptional(t_name) {
if (!__get__isQueuePlaying()) {
queueSound(t_name);
}
}
var __DEPTH = 20;
var __DO_OVERWRITE = false;
}
Symbol 1048 MovieClip [__Packages.smashing.keithm.Renderable] Frame 0
class smashing.keithm.Renderable
{
var mc, baseWidth, baseHeight, hdWidth, hdHeight, radius, doUpdate, owner, assetID, startX, startY, startZ, depthInfluence, flipH, threedScale, isSpawned, x, nextX, y, nextY, z, nextZ, __onscreen, isDrawn, isAlive, isHidden, scale, startScale, hdReg;
function Renderable (t_data) {
mc = null;
baseWidth = __DEF_WIDTH;
baseHeight = __DEF_HEIGHT;
if (__USE_DIMENSIONS_AS_HD) {
hdWidth = baseWidth / 2;
hdHeight = baseHeight / 2;
radius = hdWidth;
} else {
hdWidth = __DEF_HD_WIDTH / 2;
hdHeight = __DEF_HD_HEIGHT / 2;
radius = hdWidth;
}
setHDRegistration();
doUpdate = __DO_UPDATE;
init(t_data);
}
function init(t_data) {
if (t_data.owner == undefined) {
trace("ERROR! NO OWNER SENT TO ELEMENT : " + TYPE);
}
owner = t_data.owner;
if (t_data.asset == undefined) {
t_data.asset = __DEF_ASSET;
}
assetID = t_data.asset;
if (t_data.x == undefined) {
t_data.x = 0;
}
startX = t_data.x;
if (t_data.y == undefined) {
t_data.y = 0;
}
startY = t_data.y;
if (t_data.z == undefined) {
t_data.z = __DEF_Z;
}
startZ = t_data.z;
if (t_data.depthInfluence == undefined) {
t_data.depthInfluence = 0;
}
depthInfluence = t_data.depthInfluence;
if (t_data.camera != undefined) {
initScale(t_data.camera);
} else if (owner.camera != undefined) {
initScale(owner.camera);
} else {
trace("ERROR! NO CAMERA SENT TO ELEMENT : " + TYPE);
}
if (t_data.flip != undefined) {
flip();
} else {
flipH = false;
}
threedScale = __3D_SCALE;
isSpawned = false;
}
function spawn(camera) {
isSpawned = true;
reset();
if (__FORCE_INITAL_DRAW) {
smashing.keithm.Viewport.getInstance().draw({element:this});
} else if (__DRAW_ON_SPAWN) {
if (camera == undefined) {
trace(("ERROR: spawn of " + assetID) + " failed because __DRAW_ON_SPAWN is true, but no camera was supplied.");
return(undefined);
}
updateDraw(camera);
}
}
function reset() {
x = (nextX = startX);
y = (nextY = startY);
z = (nextZ = startZ);
__onscreen = false;
if (((mc == undefined) || (mc == null)) || (mc == "")) {
isDrawn = false;
}
isAlive = true;
isHidden = false;
}
function onDraw(t_newmc) {
isDrawn = true;
mc = t_newmc;
if (isHidden) {
mc._visible = false;
}
if (__USE_ACTUAL_DIMENSIONS) {
baseWidth = mc._width;
baseHeight = mc._height;
setHDRegistration();
if (__USE_DIMENSIONS_AS_HD) {
hdWidth = baseWidth / 2;
hdHeight = baseHeight / 2;
radius = hdWidth;
}
}
if (flipH) {
mc._xscale = -100;
}
mc._x = -1000 - baseWidth;
mc._y = -1000 - baseHeight;
}
function update(dt) {
}
function move(dt) {
}
function moveAndRender(camera, dt) {
}
function updateMoveAndRender(camera, dt) {
}
function render(camera, dt) {
updateDraw(camera);
if (!isDrawn) {
return(undefined);
}
if (threedScale) {
if (z < camera.z) {
return(undefined);
}
var _local3 = camera.fl / (z - camera.z);
if (scale != _local3) {
scale = _local3;
mc._xscale = (mc._yscale = 100 * (1 + (scale - startScale)));
if (flipH) {
mc._xscale = mc._xscale * -1;
}
}
}
mc._x = ((x - camera.x) * scale) + camera.__get__sc().x;
mc._y = ((y - camera.y) * scale) + camera.__get__sc().y;
}
function renderDirect(camera) {
mc._x = x;
mc._y = y;
}
function initScale(camera) {
startScale = (scale = camera.fl / (startZ - camera.z));
}
function updateDraw(camera) {
__onscreen = false;
if (CUSTOMDRAW) {
__onscreen = true;
} else if (z >= camera.z) {
if (((Math.abs((x - camera.x) * scale) < (camera.__get__sc().x + baseWidth)) && (Math.abs((y - camera.y) * scale) < (camera.__get__sc().y + baseHeight))) && ((z - camera.z) < camera.farClip)) {
__onscreen = true;
}
}
if ((!isDrawn) && (__onscreen)) {
smashing.keithm.Viewport.getInstance().draw({element:this});
} else if (isDrawn && (!__onscreen)) {
requestErase();
}
}
function onErase(t_viewport) {
isDrawn = false;
mc = null;
}
function despawn() {
isAlive = false;
isSpawned = false;
}
function requestErase() {
smashing.keithm.Viewport.getInstance().erase({element:this});
}
function requestDepthSort() {
smashing.keithm.Viewport.getInstance().requestGroupDepthSort(getDrawType());
}
function requestDepthChange() {
smashing.keithm.Viewport.getInstance().requestDepthChange(this);
}
function deleteMe() {
}
function kill() {
isAlive = false;
}
function hide() {
if (isDrawn) {
mc._visible = false;
}
isHidden = true;
}
function show() {
if (isDrawn) {
mc._visible = true;
}
isHidden = false;
}
function flip() {
flipH = true;
if (isDrawn) {
mc._xscale = -100;
}
}
function unflip() {
flipH = false;
if (isDrawn) {
mc._xscale = 100;
}
}
function toggleFlip() {
if (flipH) {
unflip();
} else {
flip();
}
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
function runHD_entity_radius(t_target, dt) {
var _local4 = (nextX + hdReg.x) - (t_target.nextX + t_target.hdReg.x);
var _local3 = (nextY + hdReg.y) - (t_target.nextY + t_target.hdReg.y);
var _local5 = Math.sqrt((_local4 * _local4) + (_local3 * _local3));
if (_local5 <= (t_target.radius + radius)) {
return(true);
}
return(false);
}
function runHD_entity_box(t_target, dt) {
if (Math.abs((nextX + hdReg.x) - (t_target.nextX + t_target.hdReg.x)) < (hdWidth + t_target.hdWidth)) {
if (Math.abs((nextY + hdReg.y) - (t_target.nextY + t_target.hdReg.y)) < (hdHeight + t_target.hdHeight)) {
return(true);
}
}
return(false);
}
function runHD_entity_3D(t_target, dt) {
var _local3 = z - t_target.z;
var _local2 = (nextZ + radius) - t_target.z;
if ((_local3 * _local2) <= 0) {
return(runHD_entity_radius(t_target, dt));
}
return(false);
}
function runHD_line_sphere(t_lineStart, t_lineEnd, dt) {
var _local4 = new smashing.Point3D(t_lineStart.x, t_lineStart.y, 0);
var _local3 = new smashing.Point3D(t_lineEnd.x, t_lineEnd.y, 0);
var _local6 = _local4.x - _local3.x;
var _local7 = _local4.y - _local3.y;
var _local2 = getLineSeperation(_local3, {x:x, y:y}, _local6, _local7);
var _local5;
if (_local2.distance <= radius) {
_local5 = new smashing.Point3D(x + _local2.xSeparation, y + _local2.ySeparation);
return(true);
}
_local5.x = (_local5.y = 0);
return(false);
}
function runHD_line_sphere_complex(t_lineStart, t_lineEnd, dt) {
var _local5 = new smashing.Point3D(t_lineStart.x, t_lineStart.y, 0);
var _local7 = new smashing.Point3D(t_lineEnd.x, t_lineEnd.y, 0);
var _local8;
var _local16 = getDistBetween(_local5, {x:x, y:y});
var _local15 = getDistBetween(_local7, {x:x, y:y});
var _local11 = getDistBetween(_local5, _local7);
var _local4 = new smashing.Point3D(_local5.x, _local5.y);
var _local9 = new smashing.Point3D(_local7.x, _local7.y);
var _local12 = _local9.x - _local4.x;
var _local13 = _local9.y - _local4.y;
var _local3 = _local12 / _local11;
var _local2 = _local13 / _local11;
var _local10;
_local4.subtractScalarMe(_local3 * radius, _local2 * radius);
_local9.addScalarMe(_local3 * radius, _local2 * radius);
var _local6 = getLineSeperation(_local5, {x:x, y:y}, _local12, _local13);
_local12 = _local9.x - _local4.x;
_local13 = _local9.y - _local4.y;
var _local14 = getLineSeperation(_local4, {x:x, y:y}, _local12, _local13);
if (_local6.distance <= radius) {
if (_local15 > _local11) {
_local8 = Math.sqrt((radius * radius) - (_local14.distance * _local14.distance));
_local3 = _local3 * _local8;
_local2 = _local2 * _local8;
(x + _local14.xSeparation) + _local3;
_local10 = (y + _local14.ySeparation) + _local2;
} else {
_local8 = Math.sqrt((radius * radius) - (_local6.distance * _local6.distance));
_local3 = _local3 * _local8;
_local2 = _local2 * _local8;
(x + _local6.xSeparation) + _local3;
_local10 = (y + _local6.ySeparation) + _local2;
if (getDistBetween(_local5, _local10) >= _local11) {
_local10.copy(_local7);
}
}
return(true);
}
_local10.x = (_local10.y = 0);
return(false);
}
function getLineSeperation(p0, s, dx, dy) {
var _local1 = new Object();
var _local5 = p0.x - s.x;
var _local6 = p0.y - s.y;
var _local7 = (dx * dx) + (dy * dy);
var _local2 = (-((_local5 * dx) + (_local6 * dy))) / _local7;
_local2 = Math.min(Math.max(_local2, 0), 1);
_local1.xSeparation = _local5 + (_local2 * dx);
_local1.ySeparation = _local6 + (_local2 * dy);
_local1.distance = Math.sqrt((_local1.xSeparation * _local1.xSeparation) + (_local1.ySeparation * _local1.ySeparation));
return(_local1);
}
function getDistBetween(p0, p1) {
return(Math.sqrt((p1.x - p0.x) * (p1.x - p0.x)) + ((p1.y - p0.y) * (p1.y - p0.y)));
}
function hitReact(t_source) {
}
function getDrawType() {
return(DRAWTYPE);
}
function animate(t_frame, t_subFrame) {
mc.gotoAndStop(t_frame);
if (t_subFrame != undefined) {
mc.anim.gotoAndStop(t_subFrame);
}
}
function toString() {
return("Renderable: " + TYPE);
}
function drawHitBox() {
var _local3 = hdReg.x;
var _local4 = hdReg.y;
var _local2 = mc.createEmptyMovieClip("hitbox", 1);
_local2.beginFill(16751103, 50);
_local2.lineStyle(2, 16751103, 100);
_local2.moveTo(_local3 - hdWidth, _local4 - hdHeight);
_local2.lineTo(_local3 + hdWidth, _local4 - hdHeight);
_local2.lineTo(_local3 + hdWidth, _local4 + hdHeight);
_local2.lineTo(_local3 - hdWidth, _local4 + hdHeight);
_local2.lineTo(_local3 - hdWidth, _local4 - hdHeight);
_local2.endFill();
}
function drawReg() {
var _local2 = mc.createEmptyMovieClip("hitbox", 1);
_local2.beginFill(16751103, 50);
_local2.lineStyle(2, 16751103, 100);
_local2.moveTo(-5, -5);
_local2.lineTo(5, -5);
_local2.lineTo(5, 5);
_local2.lineTo(-5, 5);
_local2.lineTo(-5, -5);
}
var TYPE = "element";
var DRAWTYPE = "element";
var __DEF_ASSET = "";
var __DEF_Z = 1000;
var __3D_SCALE = false;
var __DEF_WIDTH = 50;
var __DEF_HEIGHT = 50;
var __USE_ACTUAL_DIMENSIONS = true;
var CUSTOMDRAW = false;
var __FORCE_INITAL_DRAW = false;
var __DRAW_ON_SPAWN = false;
var __DEF_HD_WIDTH = 25;
var __DEF_HD_HEIGHT = 25;
var __USE_DIMENSIONS_AS_HD = true;
var __DO_UPDATE = true;
}
Symbol 1049 MovieClip [__Packages.smashing.keithm.Viewport] Frame 0
class smashing.keithm.Viewport
{
static var __a_groups, __o_groups, __dimensions, __viewportPath, __viewportDepth, __useScrollport, __instance, __scrollportDepth, mc, scrollmc;
function Viewport (t_path, t_depth, dimensions) {
__a_groups = [];
__o_groups = {};
__dimensions = dimensions;
__viewportPath = t_path;
__viewportDepth = t_depth;
__useScrollport = false;
trace("-- Init Viewport --");
}
static function init(t_path, t_depth, dimensions) {
__instance = new smashing.keithm.Viewport(t_path, t_depth, dimensions);
}
static function getInstance() {
return(__instance);
}
function setScrollport(t_depth) {
__useScrollport = true;
__scrollportDepth = t_depth;
}
function reset() {
var _local6 = __a_groups.length;
var _local2;
var _local5 = [];
var _local3 = 0;
while (_local5.length < _local6) {
_local2 = __a_groups.length;
while (_local2--) {
if (__a_groups[_local2].index < __a_groups[_local3].index) {
_local3 = _local2;
}
}
_local5.push(__a_groups[_local3]);
__a_groups.splice(_local3, 1);
}
__a_groups = _local5;
var _local4 = __defaultMCDepth;
_local2 = 0;
while (_local2 < __a_groups.length) {
_local4 = __a_groups[_local2].init(_local4);
_local4++;
_local2++;
}
newView();
}
function newView() {
var _local1 = __a_groups.length;
while (_local1--) {
__a_groups[_local1].reset();
}
if (mc != undefined) {
mc.removeMovieClip();
}
mc = __viewportPath.createEmptyMovieClip("viewport" + __viewportDepth, __viewportDepth);
if (__useScrollport) {
if (scrollmc != undefined) {
scrollmc.removeMovieClip();
}
scrollmc = __viewportPath.createEmptyMovieClip("scrollport" + __scrollportDepth, __scrollportDepth);
scrollmc.scrollRect = new flash.geom.Rectangle(0, 0, __dimensions.SCREEN_WIDTH + 1, __dimensions.SCREEN_HEIGHT);
}
}
function clearGroup(t_group) {
var _local2 = __o_groups[t_group].mcs;
while (_local2.length > 0) {
__eraseAsset(_local2[0].mc, t_group);
}
}
function draw(t_data) {
var _local4;
if (t_data.element != undefined) {
var _local3 = t_data.element;
if (!_local3.isSpawned) {
trace(("WARNING: despawned entity " + _local3.assetID) + " received draw request.");
return(undefined);
}
_local4 = __drawElement(_local3);
if (_local4 != undefined) {
_local3.onDraw(_local4, getInstance());
// unexpected jump
}
trace("ERROR DRAWING ASSET " + _local3.assetID);
return(undefined);
}
if (t_data.assetID == "_empty") {
return(__drawEmpty(t_data.groupName, t_data.depth + t_data.depthInfluence));
}
return(__drawAsset(t_data.assetID, t_data.groupName, t_data.depth + t_data.depthInfluence));
}
function erase(t_data) {
if (t_data.element != undefined) {
__eraseAsset(t_data.element.mc, t_data.element.getDrawType());
t_data.element.onErase(getInstance());
} else {
__eraseAsset(t_data.mc, t_data.groupName);
}
}
function createGroup(t_data) {
__a_groups.push((__o_groups[t_data.name] = new smashing.keithm.ViewportGroup(t_data)));
}
function requestGroupDepthSort(t_group) {
__o_groups[t_group].requestDepthSort();
}
function requestDepthChange(t_element) {
__o_groups[t_element.getDrawType()].requestDepthChange(t_element);
}
function __drawElement(t_element) {
var _local5;
var _local2 = __o_groups[t_element.getDrawType()];
var _local7 = _local2.getDepth(t_element[_local2.sortAxis] + t_element.depthInfluence);
var _local3 = mc;
if (_local2.scrollport) {
_local3 = scrollmc;
}
if (t_element.assetID == "_empty") {
var _local4 = _local3.createEmptyMovieClip(t_element.getDrawType() + _local7, _local7);
} else {
var _local4 = _local3.attachMovie(t_element.assetID, t_element.assetID + _local7, _local7);
}
_local2.mcs.push({mc:_local4, depth:_local7});
_local5.initScale();
return(_local4);
}
function __drawAsset(t_asset, t_groupName, t_depth) {
var _local1 = __o_groups[t_groupName];
var _local6 = _local1.getDepth(t_depth);
var _local3 = mc;
if (_local1.scrollport) {
_local3 = scrollmc;
}
var _local2 = _local3.attachMovie(t_asset, t_asset + _local6, _local6);
_local1.mcs.push({mc:_local2, depth:_local6});
return(_local2);
}
function __drawEmpty(t_groupName, t_depth) {
var _local3 = __o_groups[t_groupName];
var _local6 = _local3.getDepth(t_depth);
var _local2 = mc;
if (_local3.scrollport) {
_local2 = scrollmc;
}
var _local1 = _local2.createEmptyMovieClip(t_groupName + _local6, _local6);
__o_groups[t_groupName].mcs.push({mc:_local1, depth:_local6});
return(_local1);
}
function __eraseAsset(t_mc, t_groupName) {
var _local2 = __o_groups[t_groupName];
var _local1 = _local2.mcs.length;
while (_local1--) {
if (_local2.mcs[_local1].mc == t_mc) {
_local2.mcs[_local1].mc.removeMovieClip();
_local2.mcs.splice(_local1, 1);
return(undefined);
}
}
}
function toString() {
return("Viewport exists");
}
static var __defaultMCDepth = 100;
}
Symbol 1050 MovieClip [__Packages.smashing.keithm.ViewportGroup] Frame 0
class smashing.keithm.ViewportGroup
{
var name, mcs, index, numSlots, sortAxis, ascending, reverse, scrollport, min, max, current, isSearching, loop;
function ViewportGroup (t_data) {
name = t_data.name;
mcs = [];
index = t_data.index;
numSlots = t_data.slots;
if (t_data.sortAxis == undefined) {
t_data.sortAxis = "";
}
sortAxis = t_data.sortAxis;
if ((sortAxis != "") && (numSlots < 10000)) {
numSlots = 10000;
}
if (t_data.ascending == undefined) {
t_data.ascending = false;
}
ascending = t_data.ascending;
if (t_data.reverse == undefined) {
t_data.reverse = false;
}
reverse = t_data.reverse;
if (t_data.scrollport == undefined) {
t_data.scrollport = false;
}
scrollport = t_data.scrollport;
}
function init(t_depth) {
min = t_depth;
max = t_depth + numSlots;
reset();
return(max);
}
function reset() {
mcs = [];
if (reverse) {
current = max;
} else {
current = min;
}
}
function requestDepthChange(t_element) {
t_element.mc.swapDepths(__getChangedDepth(t_element));
}
function requestDepthSort() {
trace("Request Depth Sort not implemented yet. Better get to work!");
}
function getDepth(t_depth) {
if (sortAxis != "") {
return(__getNewDepth(t_depth));
}
increment();
return(current);
}
function increment() {
isSearching = true;
while (isSearching) {
if (reverse) {
current--;
if (current < min) {
current = max;
}
} else {
current++;
if (current > max) {
current = min;
}
}
isSearching = false;
loop = mcs.length;
while (loop--) {
if (mcs[loop].depth == current) {
isSearching = true;
loop = 0;
}
}
}
}
function __getNewDepth(depth) {
if (depth < 0) {
trace("Error : Depth cannot be under zero");
return(undefined);
}
if (ascending) {
depth = min + Math.ceil(depth);
} else {
depth = max - Math.ceil(depth);
}
loop = mcs.length;
while (loop--) {
if (mcs[loop].depth == depth) {
if (ascending) {
depth++;
} else {
depth--;
}
loop = mcs.length;
}
}
return(depth);
}
function __getChangedDepth(t_element) {
var _local2 = Math.ceil(t_element[sortAxis]);
if (_local2 < 0) {
trace("Error : Depth cannot be under zero");
return(undefined);
}
if (ascending) {
_local2 = min + _local2;
} else {
_local2 = max - _local2;
}
var _local3 = -1;
loop = mcs.length;
while (loop--) {
if (mcs[loop].mc == t_element.mc) {
_local3 = loop;
} else if (mcs[loop].depth == _local2) {
if (ascending) {
_local2++;
} else {
_local2--;
}
loop = mcs.length;
}
}
mcs[_local3].depth = _local2;
return(_local2);
}
}
Symbol 1051 MovieClip [__Packages.smashing.Point3D] Frame 0
class smashing.Point3D
{
var x, y, z;
function Point3D (x, y, z) {
this.x = Number(x);
this.y = Number(y);
this.z = Number(z);
}
function get length() {
return(Math.sqrt(((x * x) + (y * y)) + (z * z)));
}
function set length(newLength) {
if (length != 0) {
var _local2 = newLength / length;
x = x * _local2;
y = y * _local2;
z = z * _local2;
}
//return(length);
}
function get lengthSqu() {
return(((x * x) + (y * y)) + (z * z));
}
function copy() {
return(new smashing.Point3D(x, y, z));
}
function addPoint(p) {
return(new smashing.Point3D(p.x + x, p.y + y, p.z + z));
}
function subtractPoint(p) {
return(new smashing.Point3D(x - p.x, y - p.y, z - p.z));
}
function addScalar(n) {
return(new smashing.Point3D(x + n, y + n, z + n));
}
function subtractScalar(n) {
return(new smashing.Point3D(x - n, y - n, z - n));
}
function addPointMe(p) {
x = x + p.x;
y = y + p.y;
z = z + p.z;
}
function subtractPointMe(p) {
x = x - p.x;
y = y - p.y;
z = z - p.z;
}
function addScalarMe(n) {
x = x + n;
y = y + n;
z = z + n;
}
function subtractScalarMe(n) {
x = x - n;
y = y - n;
z = z - n;
}
function multiply(n) {
var _local2 = copy();
_local2.x = _local2.x * n;
_local2.y = _local2.y * n;
_local2.z = _local2.z * n;
return(_local2);
}
function divide(n) {
var _local2 = copy();
if (n == 0) {
_local2.x = 0;
_local2.y = 0;
_local2.z = 0;
return(undefined);
}
_local2.x = _local2.x / n;
_local2.y = _local2.y / n;
_local2.z = _local2.z / n;
return(_local2);
}
function multiplyMe(n) {
x = x * n;
y = y * n;
z = z * n;
}
function divideMe(n) {
x = x / n;
y = y / n;
z = z / n;
}
function dot(p) {
return(((x * p.x) + (y * p.y)) + (z * p.z));
}
function cross(p) {
return(new smashing.Point3D((y * p.z) - (z * p.y), (z * p.x) - (x * p.z), (x * p.y) - (y * p.x)));
}
function pseudoCross() {
return(new smashing.Point3D(y, -x, z));
}
function normalize() {
if (((!x) && (!y)) && (!z)) {
return(undefined);
}
var _local2 = length;
return(new smashing.Point3D(x / _local2, y / _local2, z / _local2));
}
function normalizeMe() {
if ((!x) && (!y)) {
return(undefined);
}
var _local2 = length;
x = x / _local2;
y = y / _local2;
z = z / _local2;
}
function reverse() {
var _local2 = new smashing.Point3D(x * -1, y * -1, z * -1);
return(_local2);
}
function reverseMe() {
x = x * -1;
y = y * -1;
z = z * -1;
}
function findCosine(vOther) {
var _local3 = dot(vOther);
var _local4 = length * vOther.__get__length();
var _local2 = _local3 / _local4;
return(_local2);
}
function equals(p) {
if (((x == p.x) && (y == p.y)) && (z == p.z)) {
return(true);
}
return(false);
}
function zero() {
x = 0;
y = 0;
z = 0;
}
function distSqu(p) {
var _local4 = p.x - x;
var _local3 = p.y - y;
var _local2 = p.z - z;
return(((_local4 * _local4) + (_local3 * _local3)) + (_local2 * _local2));
}
function toString() {
var _local2 = ((((("Point3D (" + x) + ",") + y) + ",") + z) + ")";
return(_local2);
}
}
Symbol 1052 MovieClip [__Packages.nick.yugopoMaze.cells.MapArt] Frame 0
class nick.yugopoMaze.cells.MapArt extends smashing.keithm.Renderable
{
var __gridData, spawn, isDrawn, updateDraw, x, mc, y, __cell_z, __latestMC;
function MapArt (t_data) {
super(t_data);
__gridData = t_data.grid;
spawn();
}
function render(camera, dt) {
if (!isDrawn) {
updateDraw(camera);
}
mc._x = (x - camera.x) + camera.__get__sc().x;
mc._y = (y - camera.y) + camera.__get__sc().y;
}
function onDraw(newmc) {
super.onDraw(newmc);
__cell_z = 0;
var _local4 = __gridData.length;
while (_local4--) {
var _local3 = __gridData[_local4].length;
while (_local3--) {
if (__gridData[_local4][_local3].drawMe) {
__gridData[_local4][_local3].drawToMap(this);
}
}
}
mc.cacheAsBitmap = true;
}
function attachCellMovieclip(asset, x, y) {
__cell_z++;
__latestMC = mc.attachMovie(asset, (asset + "_") + __cell_z, __cell_z);
__latestMC._x = x;
__latestMC._y = y;
return(__latestMC);
}
var TYPE = "map";
var DRAWTYPE = "map";
var __DEF_ASSET = "_empty";
var __USES_VELOCITY = false;
var CUSTOMDRAW = true;
}
Symbol 1053 MovieClip [__Packages.nick.yugopoMaze.ents.Entity] Frame 0
class nick.yugopoMaze.ents.Entity extends smashing.keithm.Renderable
{
var __cellX, __cellY, startVelocity, doRemove, spawn, velocity, __animation, runHD_entity_box, nextX, x, nextY, y, nextZ, z, render, kill, requestErase, isAlive, mc, __isAnimating, DRAWTYPE, specialDepth;
function Entity (t_data) {
super(t_data);
}
function init(t_data) {
__cellX = t_data.x;
__cellY = t_data.y;
if (t_data.vel != undefined) {
startVelocity = t_data.vel;
} else {
startVelocity = new smashing.Point3D(0, 0, 0);
}
var _local4 = nick.yugopoMaze.GameState.getInstance();
t_data.x = (__cellX * _local4.CELL_WIDTH) + _local4.CELL_WIDTH_HALF;
t_data.y = (__cellY * _local4.CELL_HEIGHT) + _local4.CELL_HEIGHT_HALF;
super.init(t_data);
doRemove = false;
spawn();
}
function reset() {
velocity = startVelocity.copy();
super.reset();
__animation = __IDLE_ANIMATION;
}
function runHD(t_target, dt) {
return(runHD_entity_box(t_target, dt));
}
function hitReact(t_source) {
}
function onDraw(t_newmc) {
super.onDraw(t_newmc);
animateLoop(__IDLE_ANIMATION);
}
function cellX() {
return(__cellX);
}
function cellY() {
return(__cellY);
}
function update(dt) {
updateAnim();
if (__USES_VELOCITY) {
nextX = x + (velocity.x * dt);
nextY = y + (velocity.y * dt);
nextZ = z + (velocity.z * dt);
}
}
function move(dt) {
if (__USES_VELOCITY) {
x = x + (velocity.x * dt);
y = y + (velocity.y * dt);
z = z + (velocity.z * dt);
}
}
function moveAndRender(camera, dt) {
if (__USES_VELOCITY) {
nextX = (x = x + (velocity.x * dt));
nextY = (y = y + (velocity.y * dt));
nextZ = (z = z + (velocity.z * dt));
}
render(camera, dt);
}
function updateMoveAndRender(camera, dt) {
updateAnim();
if (__USES_VELOCITY) {
nextX = (x = x + (velocity.x * dt));
nextY = (y = y + (velocity.y * dt));
nextZ = (z = z + (velocity.z * dt));
}
render(camera, dt);
}
function onErase() {
super.onErase();
}
function takeDamage(power) {
startDie();
}
function startDie() {
kill();
animate(__DEATH_ANIMATION);
if (__USES_VELOCITY) {
velocity.x = (velocity.y = 0);
}
}
function endDie() {
requestErase();
}
function updateDraw(camera) {
if (doRemove || (!isAlive)) {
return(undefined);
}
super.updateDraw(camera);
}
function animate(frame) {
if (frame != undefined) {
__animation = frame;
}
mc.gotoAndStop(__animation);
if (__animation == __IDLE_ANIMATION) {
__isAnimating = false;
} else {
__isAnimating = true;
}
}
function animateLoop(frame) {
if (frame != undefined) {
__animation = frame;
}
mc.gotoAndStop(__animation);
__isAnimating = false;
}
function updateAnim() {
if (__isAnimating) {
if (mc.anim._currentFrame == mc.anim._totalFrames) {
if (__animation == __DEATH_ANIMATION) {
endDie();
} else {
animateLoop(__IDLE_ANIMATION);
}
}
}
}
function getDrawType() {
return(((HAS_SPECIAL_DEPTH == true) ? ((DRAWTYPE + "_") + specialDepth) : (DRAWTYPE)));
}
function getIsAnimating() {
return(__isAnimating);
}
function isPathing() {
return(false);
}
var __3D_SCALE = false;
var __USE_GRAVITY = true;
var __DO_UPDATE = true;
var HAS_SPECIAL_DEPTH = false;
var __MAX_VELOCITY = 300;
var __USES_VELOCITY = true;
var __IDLE_ANIMATION = "idle";
var __DEATH_ANIMATION = "die";
}
Symbol 1054 MovieClip [__Packages.nick.yugopoMaze.ents.MoveableEntity] Frame 0
class nick.yugopoMaze.ents.MoveableEntity extends nick.yugopoMaze.ents.Entity
{
var __nextCellX, __cellX, __nextCellY, __cellY, __hasChangedCells, __cell_width, __cell_height, __is_pathing, __pathing_dir, __pathing_progress, __targetX, __targetY, __originX, __originY, nextX, nextY, prevY, y, requestDepthChange, __pathing_length, x, velocity;
function MoveableEntity (t_data) {
super(t_data);
}
function init(t_data) {
super.init(t_data);
__nextCellX = __cellX;
__nextCellY = __cellY;
__hasChangedCells = false;
__cell_width = nick.yugopoMaze.GameState.getInstance().CELL_WIDTH;
__cell_height = nick.yugopoMaze.GameState.getInstance().CELL_HEIGHT;
__is_pathing = false;
__pathing_dir = "";
__pathing_progress = 0;
__targetX = (__targetY = (__originX = (__originY = -1)));
}
function update(el) {
super.update(el);
__nextCellX = Math.floor(nextX / __cell_width);
__nextCellY = Math.floor(nextY / __cell_height);
if ((__cellX != __nextCellX) || (__cellY != __nextCellY)) {
__hasChangedCells = true;
} else {
__hasChangedCells = false;
}
}
function move(el) {
if (__hasChangedCells) {
__cellX = __nextCellX;
__cellY = __nextCellY;
}
super.move(el);
}
function moveAndRender(camera, el) {
if (__hasChangedCells) {
__cellX = __nextCellX;
__cellY = __nextCellY;
}
prevY = y;
super.moveAndRender(camera, el);
requestDepthChange();
if (__is_pathing) {
if (__pathing_dir == "x") {
__pathing_progress = 1 - (Math.abs(x - __targetX) / __pathing_length);
} else {
__pathing_progress = 1 - (Math.abs(y - __targetY) / __pathing_length);
}
}
}
function onGridCollision() {
__pathing_collision();
if (__cellX != __nextCellX) {
velocity.x = 0;
__nextCellX = __cellX;
}
if (__cellY != __nextCellY) {
velocity.y = 0;
__nextCellY = __cellY;
}
return(true);
}
function __pathing_start(targetx, targety) {
__originX = x;
__originY = y;
__targetX = targetx;
__targetY = targety;
if (__originX == __targetX) {
__pathing_dir = "y";
__pathing_length = Math.abs(__originY - __targetY);
} else {
__pathing_dir = "x";
__pathing_length = Math.abs(__originX - __targetX);
}
__pathing_progress = 0;
__is_pathing = true;
}
function __pathing_run() {
if (__pathing_dir == "x") {
if (__targetX < (x - __PATHING_THRESHOLD)) {
velocity.x = -__MOVE_RATE;
} else if (__targetX > (x + __PATHING_THRESHOLD)) {
velocity.x = __MOVE_RATE;
} else {
__pathing_stop();
}
} else if (__targetY < (y - __PATHING_THRESHOLD)) {
velocity.y = -__MOVE_RATE;
} else if (__targetY > (y + __PATHING_THRESHOLD)) {
velocity.y = __MOVE_RATE;
} else {
__pathing_stop();
}
}
function __pathing_collision() {
if (__pathing_dir == "x") {
__targetX = __originX;
} else {
__targetY = __originY;
}
}
function __pathing_stop() {
velocity.x = (velocity.y = 0);
__targetX = (__targetY = (__originX = (__originY = -1)));
__is_pathing = false;
__pathing_dir = "";
}
function hasChangedCells() {
return(__hasChangedCells);
}
function nextCellX() {
return(__nextCellX);
}
function nextCellY() {
return(__nextCellY);
}
function isPathing() {
return(__is_pathing);
}
var __MOVE_RATE = 110;
var __PATHING_THRESHOLD = 5;
}
Symbol 1055 MovieClip [__Packages.nick.yugopoMaze.ents.Player] Frame 0
class nick.yugopoMaze.ents.Player extends nick.yugopoMaze.ents.MoveableEntity
{
var __event, __direction, __hasMovedTimer, __hasKey, __moveCode, __wendysTimer, __walkRate, __prevAnimation, __animation, __prevDirection, velocity, __hasPowerup, __powerupTimer, __hasPowerupLowAlarmPlayed, __isSpeeded, __moveable, __is_pathing, __isAnimating, mc, __powerupType, isAlive, x, nextX, y, nextY, __isInvincible, __isGhosted, owner, kill, __USES_VELOCITY, requestDepthChange, __nextCellX, __cellX, __nextCellY, __cellY, __targetX, __targetY, __targetCellX, __cell_width, __targetCellY, __cell_height, __pathing_dir, __collisionCellX, __collisionCellY, hdReg;
function Player (t_data) {
super(t_data);
}
function init(t_data) {
super.init(t_data);
__event = "";
__direction = "right";
__pathing_stop();
__hasMovedTimer = __HAS_MOVED_TIMER;
__hasKey = false;
__moveCode = 0;
__wendysTimer = 0;
__walkRate = __WALK_RATE;
}
function updateDraw(camera) {
super.updateDraw(camera);
}
function onMoveKeyPress(code) {
__moveCode = code;
}
function onMoveKeyRelease(code) {
if (__moveCode == code) {
__moveCode = 0;
}
}
function update(dt) {
__prevAnimation = __animation;
__prevDirection = __direction;
velocity.x = 0;
velocity.y = 0;
if (__hasPowerup) {
__powerupTimer = __powerupTimer - dt;
if ((__powerupTimer <= 1) && (!__hasPowerupLowAlarmPlayed)) {
nick.yugopoMaze.Sounds.getInstance().p("powerup_off");
__hasPowerupLowAlarmPlayed = true;
} else if (__powerupTimer <= 0) {
finishPowerup();
animate();
}
}
if (__wendysTimer > 0) {
__wendysTimer = __wendysTimer - dt;
if (__wendysTimer <= 0) {
if (__isSpeeded) {
resolveWendysSpeed();
} else {
resolveWendysGhost();
}
}
}
if (__moveable) {
__animation = "walk";
if (__moveCode == 37) {
velocity.x = -__walkRate;
__direction = "left";
} else if (__moveCode == 39) {
velocity.x = __walkRate;
__direction = "right";
} else if (__moveCode == 38) {
velocity.y = -__walkRate;
__direction = "up";
} else if (__moveCode == 40) {
velocity.y = __walkRate;
__direction = "down";
} else {
__animation = "stand";
}
}
if (__is_pathing) {
if ((velocity.x == 0) && (velocity.y == 0)) {
__pathing_run();
} else {
__pathing_stop();
}
}
if (__event != "") {
runEvent();
}
if (((!__isAnimating) && (__animation != __prevAnimation)) || (__direction != __prevDirection)) {
animate();
}
super.update(dt);
}
function animate(frame) {
if (frame != undefined) {
__animation = frame;
}
if (__animation == "walk") {
mc.gotoAndStop(((__animation + "_") + __direction) + (__hasPowerup ? "_item" : ""));
if (__hasPowerup) {
mc.a.torso_mc.item.gotoAndStop(__powerupType);
}
__isAnimating = false;
} else if (__animation == "stand") {
mc.gotoAndStop((__animation + "_") + __direction);
if (!__hasPowerup) {
mc.a.item._visible = false;
} else {
mc.a.item._visible = true;
mc.a.item.gotoAndStop(__powerupType);
}
__isAnimating = false;
} else {
mc.gotoAndStop(__animation);
__isAnimating = true;
}
}
function animateLoop(frame) {
animate(frame);
}
function updateAnim() {
if (__isAnimating) {
if (mc.a._currentFrame == mc.a._totalFrames) {
if (!isAlive) {
endDie();
} else if (__animation == "blast") {
smashing.keithm.Messenger.sendMessage("engine", "endLevel");
} else {
animate(__IDLE_ANIMATION);
}
}
}
}
function block(entity) {
if (nextX != x) {
velocity.x = 0;
}
if (nextY != y) {
velocity.y = 0;
}
if (__is_pathing) {
__pathing_stop();
}
}
function reset() {
finishPowerup();
unfreeze();
__isInvincible = false;
super.reset();
}
function freeze() {
__moveable = false;
}
function unfreeze() {
__moveable = true;
}
function runHD(t_target, dt) {
if (!isAlive) {
return(false);
}
return(super.runHD(t_target, dt));
}
function freezeAnimation() {
animate("stand");
}
function hitReact(obj) {
if (obj.TYPE == "alien") {
if (__hasPowerup || (__isInvincible)) {
return(undefined);
}
startDie("die");
} else if (obj.TYPE == "zaptile") {
if ((!obj.isZapping()) || (__isGhosted)) {
return(undefined);
}
startDie("zap");
} else if (obj.TYPE == "traptile") {
if ((!obj.isZapping()) || (__isGhosted)) {
return(undefined);
}
x = (nextX = obj.x);
y = (nextY = obj.y);
startDie("fall");
} else if (obj.TYPE == "key") {
__hasKey = true;
smashing.keithm.Messenger.sendMessage("screen", "chargeKey");
} else if (obj.TYPE == "exit") {
if (!__moveable) {
return(undefined);
}
if (owner.hasCollectedPickups() == false) {
smashing.keithm.Messenger.sendMessage("screen", "showInsufficientPickups", {needed:owner.getPickupsRemaining()});
return(undefined);
}
if (!__hasKey) {
smashing.keithm.Messenger.sendMessage("screen", "showMissingKey");
return(undefined);
}
resolveWendysSpeed();
resolveWendysGhost();
setTargetPoint(obj.x, obj.y);
__event = "exit";
__isInvincible = true;
freeze();
}
}
function startDie(anim) {
freeze();
kill();
animate(anim);
if (__USES_VELOCITY) {
velocity.x = (velocity.y = 0);
}
}
function endDie() {
nick.yugopoMaze.GameState.getInstance().loseLife();
if (nick.yugopoMaze.GameState.getInstance().lives > 0) {
reset();
requestDepthChange();
}
}
function usePowerup(t_type) {
__powerupType = t_type;
__hasPowerup = true;
__powerupTimer = __POWERUP_TIMER_MAX;
nick.yugopoMaze.Sounds.getInstance().p("pickup_" + t_type);
animate();
}
function finishPowerup() {
__hasPowerup = false;
__hasPowerupLowAlarmPlayed = false;
__powerupType = "";
}
function isUsingPowerup() {
return(__hasPowerup);
}
function canUsePowerup() {
return(!(((__hasPowerup || (__isInvincible)) || (__hasPowerup)) || (!__moveable)));
}
function applyWendysSpeed() {
__isSpeeded = true;
__wendysTimer = 9;
__walkRate = __SPEEDWALK_RATE;
}
function applyWendysGhost() {
__isGhosted = true;
__isInvincible = true;
__wendysTimer = 7;
mc._alpha = 60;
}
function resolveWendysSpeed() {
if (!__isSpeeded) {
return(undefined);
}
__isSpeeded = false;
__walkRate = __WALK_RATE;
__wendysTimer = 0;
}
function resolveWendysGhost() {
if (!__isGhosted) {
return(undefined);
}
__isGhosted = false;
__isInvincible = false;
__wendysTimer = 0;
mc._alpha = 100;
}
function runEvent() {
if (__event == "exit") {
if (!__is_pathing) {
__event = "";
animate("blast");
nick.yugopoMaze.GameState.getInstance().pauseTimer();
}
}
}
function onGridCollision(el) {
if (__is_pathing) {
__pathing_collision();
}
if (__cellX != __nextCellX) {
velocity.x = 0;
__nextCellX = __cellX;
}
if (__cellY != __nextCellY) {
velocity.y = 0;
__nextCellY = __cellY;
}
super.update(el);
return(true);
}
function setTargetPoint(t_x, t_y) {
__targetX = t_x;
__targetY = t_y;
__targetCellX = Math.floor(__targetX / __cell_width);
__targetCellY = Math.floor(__targetY / __cell_height);
__pathing_chooseDirection();
__hasMovedTimer = 0;
}
function __pathing_chooseDirection() {
var _local3 = __targetX - x;
var _local2 = __targetY - y;
__is_pathing = true;
if (Math.abs(_local3) > (Math.abs(_local2) + __PATHING_THRESHOLD)) {
__pathing_dir = "x";
} else if (Math.abs(_local3) < (Math.abs(_local2) - __PATHING_THRESHOLD)) {
__pathing_dir = "y";
} else {
__pathing_stop();
}
}
function __pathing_run() {
__animation = "walk";
if (__pathing_dir == "x") {
if (__targetX < (x - __PATHING_THRESHOLD)) {
velocity.x = -__walkRate;
__direction = "left";
} else if (__targetX > (x + __PATHING_THRESHOLD)) {
velocity.x = __walkRate;
__direction = "right";
} else {
__pathing_chooseDirection();
}
} else if (__targetY < (y - __PATHING_THRESHOLD)) {
velocity.y = -__walkRate;
__direction = "up";
} else if (__targetY > (y + __PATHING_THRESHOLD)) {
velocity.y = __walkRate;
__direction = "down";
} else {
__pathing_chooseDirection();
}
}
function __pathing_collision() {
if (__pathing_dir == "x") {
if (__collisionCellX == __cellX) {
__pathing_stop();
} else {
__collisionCellX = __cellX;
__pathing_dir = "y";
}
} else if (__collisionCellY == __cellY) {
__pathing_stop();
} else {
__collisionCellY = __cellY;
__pathing_dir = "x";
}
}
function __pathing_stop() {
owner.clearTargetPoint();
__targetCellX = (__targetCellY = (__collisionCellX = (__collisionCellY = (__targetX = (__targetY = -1)))));
__is_pathing = false;
__pathing_dir = "";
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
function direction() {
return(__direction);
}
function isFrozen() {
return(!__moveable);
}
var TYPE = "player";
var DRAWTYPE = "dynamic";
var __DEF_ASSET = "timmy_main";
var __DEF_WIDTH = 40;
var __DEF_HEIGHT = 60;
var __USE_ACTUAL_DIMENSIONS = true;
var __DEF_HD_WIDTH = 20;
var __DEF_HD_HEIGHT = 10;
var __USE_DIMENSIONS_AS_HD = false;
var __WALK_RATE = 185;
var __SPEEDWALK_RATE = 320;
var __IDLE_ANIMATION = "stand";
var __POWERUP_TIMER_MAX = 9;
var __PATHING_THRESHOLD = 5;
var __HAS_MOVED_TIMER = 15;
}
Symbol 1056 MovieClip [__Packages.nick.yugopoMaze.ents.Effect] Frame 0
class nick.yugopoMaze.ents.Effect extends smashing.keithm.Renderable
{
var isDrawn, mc, kill;
function Effect (t_data) {
super(t_data);
}
function updateMoveAndRender(camera, dt) {
if (isDrawn && (mc._currentFrame == mc._totalFrames)) {
requestErase();
return(undefined);
}
super.updateMoveAndRender(camera, dt);
}
function requestErase() {
kill();
super.requestErase();
}
var TYPE = "effect";
var DRAWTYPE = "effect";
var __USE_GRAVITY = true;
var __3D_SCALE = true;
var __DO_UPDATE = true;
}
Symbol 1057 MovieClip [__Packages.nick.yugopoMaze.levels.LevelData] Frame 0
class nick.yugopoMaze.levels.LevelData
{
var walls, aliens, scenery, __noFillSpaces, __loop, grid_height, __bloop, __nloop, grid_width, __fillWall, __latest_noFillSpaces, __alienProbabilty;
function LevelData () {
}
function loadData(t_data) {
walls = [];
aliens = [];
scenery = [];
}
function getRandomCell(min, max) {
return(Math.floor(min + (Math.random() * (max - min))));
}
function placeWalls(nodes) {
var _local6 = "wall1_mc";
var _local7 = Math.ceil(nick.yugopoMaze.GameState.getInstance().levelNum / 5);
if ((_local7 % 4) == 0) {
_local6 = "wall4_mc";
} else if ((_local7 % 3) == 0) {
_local6 = "wall3_mc";
} else if ((_local7 % 2) == 0) {
_local6 = "wall2_mc";
}
__noFillSpaces = 0;
__loop = grid_height;
while (__loop--) {
trace(("Fill Row Y : " + __loop) + " -------");
__bloop = 0;
nodes[__loop].sortOn("leftX", Array.NUMERIC);
__nloop = 0;
while (__nloop < nodes[__loop].length) {
trace(nodes[__loop][__nloop]);
__nloop++;
}
while (__bloop < grid_width) {
__fillWall = true;
if (__loop > 0) {
__nloop = 0;
while (__nloop < nodes[__loop].length) {
if (__bloop == nodes[__loop][__nloop].leftX) {
__latest_noFillSpaces = nodes[__loop][__nloop].getNoFillSpaces();
if (__noFillSpaces < __latest_noFillSpaces) {
__noFillSpaces = __latest_noFillSpaces;
}
}
__nloop++;
}
}
if (__noFillSpaces > 0) {
__fillWall = false;
__noFillSpaces--;
}
if (__fillWall) {
walls.push({type:_local6, x:__bloop, y:__loop});
}
__bloop++;
}
}
}
function placeAliens(nodes) {
var _local5 = [];
var _local4;
var _local2;
var _local3;
__alienProbabilty = __ALIEN_PROBABILIY_BASE;
__loop = nodes.length;
while (__loop--) {
__nloop = nodes[__loop].length;
while (__nloop--) {
_local3 = nodes[__loop][__nloop];
if (_local3.nodeType == "room") {
if (Math.random() <= __alienProbabilty) {
__alienProbabilty = __alienProbabilty - __ALIEN_PROBABILTY_DECAY;
_local2 = Math.floor(Math.random() * (_local3.roomHeight - 1));
if (_local2 > (_local3.roomHeight - 1)) {
_local2 = _local3.roomHeight - 1;
}
_local2 = _local3.y - _local2;
_local4 = true;
__bloop = _local5.length;
while (__bloop--) {
if (_local5[__bloop] == _local2) {
_local4 = false;
__bloop = 0;
}
}
if ((_local2 <= 1) || (_local2 >= 18)) {
_local4 = false;
}
if (_local4 == true) {
aliens.push({x:_local3.x, y:_local2, pathWidth:_local3.roomWidth, pathHeight:_local3.roomHeight - (_local3.y - _local2), pathAnchor:_local3.roomAnchor});
_local5.push(_local2);
}
}
}
}
}
}
var __ALIEN_PROBABILIY_BASE = 0.85;
var __ALIEN_PROBABILTY_DECAY = 0.08;
}
Symbol 1058 MovieClip [__Packages.nick.yugopoMaze.Node] Frame 0
class nick.yugopoMaze.Node
{
var x, leftX, rightX, y, nodeType, nodeClass, roomWidth, roomHeight, roomAnchor, doSpawn, __roomProbability, __deadEndProbability;
function Node (t_data) {
x = (leftX = (rightX = t_data.x));
y = t_data.y;
nodeType = t_data.nodeType;
nodeClass = t_data.nodeClass;
roomWidth = (roomHeight = (roomAnchor = 0));
if (t_data.doSpawn == undefined) {
doSpawn = true;
} else {
doSpawn = t_data.doSpawn;
}
if (t_data.roomProbability == undefined) {
__roomProbability = __DEF_ROOM_PROBABILITY;
} else {
__roomProbability = t_data.roomProbability;
}
if (t_data.deadProbability == undefined) {
__deadEndProbability = 0;
} else {
__deadEndProbability = t_data.deadProbability;
}
if (nodeType == "room") {
roomWidth = Math.floor(2 + (Math.random() * 7));
roomHeight = Math.round(1 + Math.random());
if (Math.random() < 0.1) {
roomHeight = 3;
}
roomAnchor = Math.floor(Math.random() * roomWidth);
if (roomAnchor > (roomWidth - 1)) {
roomAnchor = roomWidth - 1;
}
if ((x + ((roomWidth - 1) - roomAnchor)) > (nick.yugopoMaze.GameState.getInstance().MAP_WIDTH - 1)) {
roomAnchor = roomAnchor + ((x + ((roomWidth - 1) - roomAnchor)) - (nick.yugopoMaze.GameState.getInstance().MAP_WIDTH - 1));
}
if ((x - roomAnchor) < 0) {
roomAnchor = roomAnchor + (x - roomAnchor);
}
if (roomHeight > 1) {
doSpawn = false;
}
leftX = x - roomAnchor;
rightX = x + ((roomWidth - 1) - roomAnchor);
} else if (nodeType == "pillar") {
roomWidth = t_data.roomWidth;
}
}
function getNoFillSpaces() {
if ((nodeType == "room") || (nodeType == "pillar")) {
return(roomWidth);
}
return(1);
}
function generateSupportNode(isAllowedToEnd) {
if (!doSpawn) {
return(undefined);
}
if ((Math.random() < __deadEndProbability) && (isAllowedToEnd)) {
return(undefined);
}
__deadEndProbability = __deadEndProbability + __INC_DEAD_PROBABILITY;
return(new nick.yugopoMaze.Node({x:leftX, y:y - 1, nodeClass:"support", nodeType:getNextRowType(), roomProbability:__roomProbability, deadProbability:__deadEndProbability}));
}
function generateCornerNodes() {
var _local2 = [];
_local2.push(new nick.yugopoMaze.Node({x:rightX, y:y, nodeClass:"support", nodeType:"corner", doSpawn:((roomHeight > 1) ? false : true)}));
if (roomHeight > 2) {
_local2.push(new nick.yugopoMaze.Node({x:leftX, y:y - 1, nodeClass:"support", nodeType:"pillar", roomWidth:roomWidth, doSpawn:false}));
_local2.push(new nick.yugopoMaze.Node({x:rightX, y:y - 1, nodeClass:"support", nodeType:"corner", doSpawn:false}));
}
if (roomHeight > 1) {
_local2.push(new nick.yugopoMaze.Node({x:leftX, y:y - (roomHeight - 1), nodeClass:"support", nodeType:"pillar", roomWidth:roomWidth, doSpawn:((roomAnchor == 0) ? false : true), deadProbability:__deadEndProbability - __INC_DEAD_PROBABILITY}));
_local2.push(new nick.yugopoMaze.Node({x:rightX, y:y - (roomHeight - 1), nodeClass:"support", nodeType:"corner"}));
}
return(_local2);
}
function getNextRowType() {
if (nodeClass == "root") {
if (Math.random() < 0.95) {
return("room");
}
return("tunnel");
}
if (nodeClass == "support") {
if (Math.random() < __roomProbability) {
return("room");
}
return("tunnel");
}
}
function toString() {
return(((((((("Node : " + x) + " , ") + y) + ", type: ") + nodeType) + " , leftx: ") + leftX) + ((nodeType == "room") ? ((((((", ( w: " + roomWidth) + " , h: ") + roomHeight) + " a: ") + roomAnchor) + " )") : ""));
}
var __INC_DEAD_PROBABILITY = 0.035;
var __DEF_ROOM_PROBABILITY = 0.2;
}
Symbol 1059 MovieClip [__Packages.nick.yugopoMaze.cells.Cell] Frame 0
class nick.yugopoMaze.cells.Cell
{
var __cellX, __cellY, assetID, owner, drawMe, mc;
function Cell (t_data) {
__cellX = t_data.x;
__cellY = t_data.y;
assetID = t_data.asset;
owner = t_data.owner;
drawMe = DRAW_DEF;
}
function canPass(entity) {
return(true);
}
function drawToMap(map) {
if (!drawMe) {
return(undefined);
}
var _local2 = nick.yugopoMaze.GameState.getInstance();
var _local4 = (__cellX * _local2.CELL_WIDTH) + _local2.CELL_WIDTH_HALF;
var _local3 = (__cellY * _local2.CELL_HEIGHT) + _local2.CELL_HEIGHT_HALF;
mc = map.attachCellMovieclip(assetID, _local4, _local3);
}
function get x() {
return(__cellX);
}
function get y() {
return(__cellY);
}
function toString() {
return((("Cell " + __cellX) + " , ") + __cellY);
}
var TYPE = "cell";
var DRAWTYPE = "cell";
var DRAW_DEF = false;
var __USES_VELOCITY = false;
}
Symbol 1060 MovieClip [__Packages.nick.yugopoMaze.cells.Wall] Frame 0
class nick.yugopoMaze.cells.Wall extends nick.yugopoMaze.cells.Cell
{
var assetID, drawMe, __cellY, __cellX;
function Wall (t_data) {
super(t_data);
if (t_data.type != "invis") {
assetID = t_data.type;
} else {
drawMe = false;
}
}
function canPass(entity) {
return(false);
}
function toString() {
return((("Wall " + __cellX) + " , ") + __cellY);
}
var TYPE = "wall";
var DRAW_DEF = true;
var __DEF_ASSET = "wall1_mc";
var __DEF_WIDTH = 58;
var __DEF_HEIGHT = 58;
var __USE_ACTUAL_DIMENSIONS = true;
}
Symbol 1061 MovieClip [__Packages.nick.yugopoMaze.ents.Alien] Frame 0
class nick.yugopoMaze.ents.Alien extends nick.yugopoMaze.ents.Entity
{
var startY, __cellY, __pathWidth, __pathHeight, __pathAnchor, __pathLeftX, startX, __pathRightX, __pathCenterX, __pathTopY, __pathBottomY, __crossOnRight, __doCrossMiddle, __headedRight, __movingX, __headedUp, flip, __moveRate, spawn, __isAnimating, nextX, x, unflip, nextY, y, requestDepthChange, owner, startDie, animate, doRemove, hdReg;
function Alien (t_data) {
super(t_data);
}
function init(t_data) {
super.init(t_data);
var _local3 = nick.yugopoMaze.GameState.getInstance();
startY = (__cellY * _local3.CELL_HEIGHT) + (_local3.CELL_HEIGHT * 0.75);
__pathWidth = (t_data.pathWidth - 1) * _local3.CELL_WIDTH;
__pathHeight = (t_data.pathHeight - 1) * _local3.CELL_HEIGHT;
__pathAnchor = t_data.pathAnchor * _local3.CELL_WIDTH;
__pathLeftX = startX - __pathAnchor;
__pathRightX = __pathLeftX + __pathWidth;
__pathCenterX = __pathLeftX + (__pathWidth / 2);
__pathTopY = startY - __pathHeight;
__pathBottomY = startY;
if (__pathTopY < _local3.CELL_HEIGHT) {
__pathTopY = _local3.CELL_HEIGHT + (_local3.CELL_HEIGHT * 0.75);
}
__crossOnRight = true;
if (__pathHeight > 0) {
__doCrossMiddle = ((Math.random() < 0.45) ? true : false);
} else {
__doCrossMiddle = false;
}
__headedRight = ((Math.random() > 0.5) ? true : false);
__movingX = (__headedUp = true);
if (!__headedRight) {
flip();
}
__moveRate = __MOVE_RATE_BASE + (__MOVE_RATE_MULT * _local3.levelNum);
if (__moveRate > __MOVE_RATE_MAX) {
__moveRate = __MOVE_RATE_MAX;
}
spawn();
}
function update(dt) {
if (!__isAnimating) {
if (__movingX) {
if (__headedRight) {
nextX = x + (__moveRate * dt);
if (nextX > __pathRightX) {
nextX = __pathRightX;
__headedRight = false;
flip();
toggleMovingAxis();
} else if ((__doCrossMiddle && (__crossOnRight)) && (nextX > __pathCenterX)) {
nextX = __pathCenterX;
__crossOnRight = false;
toggleMovingAxis();
}
} else {
nextX = x - (__moveRate * dt);
if (nextX < __pathLeftX) {
nextX = __pathLeftX;
__headedRight = true;
unflip();
toggleMovingAxis();
} else if ((__doCrossMiddle && (!__crossOnRight)) && (nextX < __pathCenterX)) {
nextX = __pathCenterX;
__crossOnRight = true;
toggleMovingAxis();
}
}
} else if (__headedUp) {
nextY = y - (__moveRate * dt);
if (nextY < __pathTopY) {
nextY = __pathTopY;
__headedUp = false;
toggleMovingAxis();
}
} else {
nextY = y + (__moveRate * dt);
if (nextY > __pathBottomY) {
nextY = __pathBottomY;
__headedUp = true;
toggleMovingAxis();
}
}
}
super.update();
}
function toggleMovingAxis() {
if ((__pathHeight > 0) && (__movingX == true)) {
__movingX = false;
} else {
__movingX = true;
requestDepthChange();
}
}
function render(cam, dt) {
x = nextX;
y = nextY;
super.render(cam, dt);
}
function hitReact(obj) {
if (obj.isUsingPowerup()) {
owner.addScore(value);
startDie();
} else {
animate("catch");
}
}
function endDie() {
super.endDie();
doRemove = true;
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = -15;
}
var TYPE = "alien";
var DRAWTYPE = "dynamic";
var __DEF_WIDTH = 50;
var __DEF_HEIGHT = 90;
var __USE_ACTUAL_DIMENSIONS = true;
var __DEF_HD_WIDTH = 40;
var __DEF_HD_HEIGHT = 49;
var __USE_DIMENSIONS_AS_HD = false;
var __DEF_ASSET = "alien_main";
var __MOVE_RATE_MULT = 5;
var __MOVE_RATE_BASE = 60;
var __MOVE_RATE_MAX = 130;
var value = 100;
var __USES_VELOCITY = false;
}
Symbol 1062 MovieClip [__Packages.nick.yugopoMaze.ents.Scenery] Frame 0
class nick.yugopoMaze.ents.Scenery extends nick.yugopoMaze.ents.Entity
{
var x, startX, __cellX, y, startY, __cellY, mc;
function Scenery (t_data) {
super(t_data);
var _local3 = nick.yugopoMaze.GameState.getInstance();
x = (startX = __cellX * _local3.CELL_WIDTH);
y = (startY = __cellY * _local3.CELL_HEIGHT);
}
function onDraw(newmc) {
super.onDraw(newmc);
mc.cacheAsBitmap = true;
}
var TYPE = "scenery";
var DRAWTYPE = "bg";
var __DEF_ASSET = "ground_mc";
var __DEF_WIDTH = 600;
var __DEF_HEIGHT = 400;
var __USE_ACTUAL_DIMENSIONS = false;
}
Symbol 1063 MovieClip [__Packages.nick.yugopoMaze.ents.Scenery_Edge] Frame 0
class nick.yugopoMaze.ents.Scenery_Edge extends nick.yugopoMaze.ents.Scenery
{
function Scenery_Edge (t_data) {
super(t_data);
}
var TYPE = "edge";
var DRAWTYPE = "edge";
var __DEF_WIDTH = 600;
var __DEF_HEIGHT = 350;
var __USE_ACTUAL_DIMENSIONS = true;
}
Symbol 1064 MovieClip [__Packages.nick.yugopoMaze.ents.Scenery_Patch] Frame 0
class nick.yugopoMaze.ents.Scenery_Patch extends nick.yugopoMaze.ents.Scenery
{
var assetID, depthInfluence;
function Scenery_Patch (t_data) {
super(t_data);
assetID = t_data.asset + "_patch_mc";
depthInfluence = 1;
}
var TYPE = "patch";
var DRAWTYPE = "patch";
var __DEF_WIDTH = 500;
var __DEF_HEIGHT = 300;
var __USE_ACTUAL_DIMENSIONS = true;
var __DEF_ASSET = "grassy_patch_mc";
}
Symbol 1065 MovieClip [__Packages.nick.yugopoMaze.ents.Pickup] Frame 0
class nick.yugopoMaze.ents.Pickup extends nick.yugopoMaze.ents.Entity
{
var isAlive, owner, startDie, doRemove, hdReg, mc, __cellY, __cellX;
function Pickup (t_data) {
super(t_data);
}
function hitReact(t_target) {
if (!isAlive) {
return(undefined);
}
owner.addScore(value);
owner.collectPickup();
startDie();
nick.yugopoMaze.Sounds.getInstance().p("pickup_nickel");
}
function endDie() {
super.endDie();
doRemove = true;
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
function onDraw(newmc) {
super.onDraw(newmc);
mc.cacheAsBitmap = true;
}
function toString() {
return((("Pickup " + __cellX) + " , ") + __cellY);
}
var TYPE = "pickup";
var DRAWTYPE = "pickup";
var __DEF_ASSET = "coin_main";
var __DEF_WIDTH = 20;
var __DEF_HEIGHT = 30;
var __USE_ACTUAL_DIMENSIONS = true;
var __DEF_HD_WIDTH = 40;
var __DEF_HD_HEIGHT = 50;
var __USE_DIMENSIONS_AS_HD = false;
var __USES_VELOCITY = false;
var __DEATH_ANIMATION = "pickup";
var value = 50;
}
Symbol 1066 MovieClip [__Packages.nick.yugopoMaze.ents.ZapTile] Frame 0
class nick.yugopoMaze.ents.ZapTile extends nick.yugopoMaze.ents.Entity
{
var __isZapping, __zapTimer, mc, hdReg;
function ZapTile (t_data) {
super(t_data);
}
function init(t_data) {
super.init(t_data);
__isZapping = false;
__zapTimer = Math.random() * __ZAP_TIMER_MAX;
}
function update(dt) {
__zapTimer = __zapTimer - dt;
if (__zapTimer < 0) {
__isZapping = !__isZapping;
if (__isZapping) {
__zapTimer = __ZAP_TIMER_MAX / 2;
} else {
__zapTimer = __ZAP_TIMER_MAX;
}
animate();
}
}
function animate() {
if (__isZapping) {
mc.gotoAndStop("active");
} else {
mc.gotoAndStop("idle");
}
}
function animateLoop() {
animate();
}
function isZapping() {
return(__isZapping);
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
var TYPE = "zaptile";
var DRAWTYPE = "patch";
var __DEF_WIDTH = 58;
var __DEF_HEIGHT = 58;
var __USE_ACTUAL_DIMENSIONS = false;
var __DEF_HD_WIDTH = 40;
var __DEF_HD_HEIGHT = 50;
var __USE_DIMENSIONS_AS_HD = false;
var __DEF_ASSET = "laser_tile";
var __USES_VELOCITY = false;
var __ZAP_TIMER_MAX = 2.5;
}
Symbol 1067 MovieClip [__Packages.nick.yugopoMaze.ents.TrapTile] Frame 0
class nick.yugopoMaze.ents.TrapTile extends nick.yugopoMaze.ents.ZapTile
{
var __isZapping, mc;
function TrapTile (t_data) {
super(t_data);
}
function animate() {
if (__isZapping) {
mc.gotoAndStop("active");
} else {
mc.gotoAndStop("shut");
}
}
var TYPE = "traptile";
var __DEF_ASSET = "trap_tile";
}
Symbol 1068 MovieClip [__Packages.nick.yugopoMaze.ents.Powerup] Frame 0
class nick.yugopoMaze.ents.Powerup extends nick.yugopoMaze.ents.Pickup
{
var powerupType, assetID, isAlive, owner, startDie, doRemove, hdReg, mc, __cellY, __cellX;
function Powerup (t_data) {
super(t_data);
var _local3 = Math.random() * 3;
if (_local3 <= 1) {
powerupType = "flower";
} else if (_local3 <= 2) {
powerupType = "teddybear";
} else {
powerupType = "chocolate";
}
assetID = powerupType + "_main";
}
function hitReact(t_target) {
if (!isAlive) {
return(undefined);
}
if (nick.yugopoMaze.GameState.getInstance().hasPowerup(powerupType)) {
return(undefined);
}
owner.addScore(value);
nick.yugopoMaze.Sounds.getInstance().p("pickup_powerup");
nick.yugopoMaze.GameState.getInstance().addPowerup(powerupType);
startDie();
}
function endDie() {
super.endDie();
doRemove = true;
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
function onDraw(newmc) {
super.onDraw(newmc);
mc.cacheAsBitmap = true;
}
function toString() {
return((("Pickup " + __cellX) + " , ") + __cellY);
}
var TYPE = "powerup";
var DRAWTYPE = "pickup";
var __DEF_ASSET = "flower_main";
var __DEF_WIDTH = 20;
var __DEF_HEIGHT = 30;
var __USE_ACTUAL_DIMENSIONS = true;
var __DEF_HD_WIDTH = 35;
var __DEF_HD_HEIGHT = 35;
var __USE_DIMENSIONS_AS_HD = false;
var __USES_VELOCITY = false;
var __DEATH_ANIMATION = "pickup";
var value = 0;
}
Symbol 1069 MovieClip [__Packages.nick.yugopoMaze.ents.BlastKey] Frame 0
class nick.yugopoMaze.ents.BlastKey extends nick.yugopoMaze.ents.Pickup
{
var isAlive, startDie, mc, __cellY, __cellX;
function BlastKey (t_data) {
super(t_data);
}
function hitReact(t_target) {
if (!isAlive) {
return(undefined);
}
startDie();
nick.yugopoMaze.Sounds.getInstance().p("pickup_key");
}
function onDraw(newmc) {
super.onDraw(newmc);
mc.cacheAsBitmap = false;
}
function toString() {
return((("Pickup " + __cellX) + " , ") + __cellY);
}
var TYPE = "key";
var DRAWTYPE = "pickup";
var __DEF_ASSET = "blastkey_main";
var __DEF_WIDTH = 20;
var __DEF_HEIGHT = 30;
var __USE_ACTUAL_DIMENSIONS = true;
var __DEF_HD_WIDTH = 50;
var __DEF_HD_HEIGHT = 40;
var __USE_DIMENSIONS_AS_HD = false;
var value = 0;
}
Symbol 1070 MovieClip [__Packages.nick.yugopoMaze.ents.WendysPickup] Frame 0
class nick.yugopoMaze.ents.WendysPickup extends nick.yugopoMaze.ents.Pickup
{
var isAlive, startDie, doRemove, hdReg, mc, __cellY, __cellX;
function WendysPickup (t_data) {
super(t_data);
}
function hitReact(t_target) {
if (!isAlive) {
return(undefined);
}
nick.yugopoMaze.Sounds.getInstance().p("pickup_powerup");
smashing.keithm.Messenger.sendMessage("world", "onWendysPickup");
startDie();
}
function endDie() {
super.endDie();
doRemove = true;
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
function onDraw(newmc) {
super.onDraw(newmc);
mc.cacheAsBitmap = true;
}
function toString() {
return((("Wendys " + __cellX) + " , ") + __cellY);
}
var TYPE = "wendys";
var DRAWTYPE = "pickup";
var __DEF_ASSET = "wendys_main";
var __DEF_WIDTH = 20;
var __DEF_HEIGHT = 30;
var __USE_ACTUAL_DIMENSIONS = true;
var __DEF_HD_WIDTH = 35;
var __DEF_HD_HEIGHT = 35;
var __USE_DIMENSIONS_AS_HD = false;
var __USES_VELOCITY = false;
var __DEATH_ANIMATION = "pickup";
var value = 0;
}
Symbol 1071 MovieClip [__Packages.nick.yugopoMaze.ents.Exit] Frame 0
class nick.yugopoMaze.ents.Exit extends nick.yugopoMaze.ents.Entity
{
var hdReg;
function Exit (t_data) {
super(t_data);
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
var TYPE = "exit";
var DRAWTYPE = "pickup";
var __DEF_WIDTH = 56;
var __DEF_HEIGHT = 57;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var __DEF_ASSET = "exit_tile";
var __USES_VELOCITY = false;
}
Symbol 1072 MovieClip [__Packages.nick.yugopoMaze.ents.SpaceWindow] Frame 0
class nick.yugopoMaze.ents.SpaceWindow extends nick.yugopoMaze.ents.Entity
{
var startX, __cellX, startY, mc, hdReg;
function SpaceWindow (t_data) {
super(t_data);
}
function init(t_data) {
super.init(t_data);
var _local3 = nick.yugopoMaze.GameState.getInstance();
startX = __cellX * _local3.CELL_WIDTH;
startY = __cellX * _local3.CELL_WIDTH;
}
function update(dt) {
}
function render(cam, dt) {
super.render(cam, dt);
mc.spaceTile.space_mc._x = -mc._x;
mc.spaceTile.space_mc._y = -mc._y;
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
var TYPE = "spacewindow";
var DRAWTYPE = "patch";
var __DEF_WIDTH = 116;
var __DEF_HEIGHT = 116;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var __DEF_ASSET = "spaceWindow";
var __USES_VELOCITY = false;
}
Symbol 1073 MovieClip [__Packages.nick.yugopoMaze.ui.UI] Frame 0
class nick.yugopoMaze.ui.UI
{
static var __instance;
var engine, __nextScreenID, __hasActiveScreen, __doesActiveScreenUpdate, __activeScreen, __previousScreenID, __activeScreenID;
function UI () {
}
static function init() {
__instance = new nick.yugopoMaze.ui.UI();
}
static function getInstance() {
return(__instance);
}
function linkEngine(t_engine) {
engine = t_engine;
smashing.keithm.Messenger.registerAddress("ui", this);
}
function reset() {
__nextScreenID = "";
__hasActiveScreen = false;
__doesActiveScreenUpdate = false;
}
function update(dt) {
if (__doesActiveScreenUpdate) {
__activeScreen.update(dt);
}
}
function returnToPreviousScreen() {
__nextScreenID = __previousScreenID;
__activeScreen.close();
}
function goScreen(id) {
if (__hasActiveScreen) {
__nextScreenID = id;
__activeScreen.close((((__nextScreenID == "help") || (__nextScreenID == "wendys")) ? true : false));
} else {
openScreen(id);
}
}
function openScreen(id) {
trace("Ok... open screen " + id);
if (id == undefined) {
id = __nextScreenID;
}
if (id == "") {
return(undefined);
}
__nextScreenID = "";
__previousScreenID = __activeScreenID;
__activeScreenID = id;
engine.gotoAndStop(__activeScreenID);
switch (__activeScreenID) {
case "splash" :
__activeScreen = new nick.yugopoMaze.ui.Splash(engine.screen_mc, this);
break;
case "gameplay" :
__activeScreen = new nick.yugopoMaze.ui.GamePlay(engine.screen_mc, this, ((__previousScreenID == "help") ? true : false));
break;
case "help" :
__activeScreen = new nick.yugopoMaze.ui.Help(engine.screen_mc, this, ((__previousScreenID == "splash") ? true : false));
break;
case "wendys" :
__activeScreen = new nick.yugopoMaze.ui.Wendys(engine.screen_mc, this);
break;
case "levelTrans" :
__activeScreen = new nick.yugopoMaze.ui.LevelTrans(engine.screen_mc, this);
break;
case "intro" :
__activeScreen = new nick.yugopoMaze.ui.Intro(engine.screen_mc, this);
break;
case "gameover" :
__activeScreen = new nick.yugopoMaze.ui.GameOver(engine.screen_mc, this);
break;
case "viewHighscore" :
__activeScreen = new nick.yugopoMaze.ui.Highscores(engine.screen_mc, this, true);
break;
case "sendHighscore" :
__activeScreen = new nick.yugopoMaze.ui.Highscores(engine.screen_mc, this, false);
break;
default :
trace("[UI] openScreen called with invalid id: " + __activeScreenID);
return(undefined);
}
__activeScreen.init();
__activeScreen.open();
smashing.keithm.Messenger.registerAddress("screen", __activeScreen);
__hasActiveScreen = true;
__doesActiveScreenUpdate = __activeScreen.DOES_UPDATE;
}
function onScreenClosed() {
if (__nextScreenID != "") {
openScreen(__nextScreenID);
}
}
function goScreenRemote(t_data) {
trace("GO screen : " + t_data.screen);
if (t_data.screen == undefined) {
trace("Error: Go screen remote requires data format {screen:string}");
return(undefined);
}
goScreen(t_data.screen);
}
function onMessageReceived(message, args) {
this[message](args);
}
function get currentScreenID() {
return(__activeScreenID);
}
}
Symbol 1074 MovieClip [__Packages.nick.yugopoMaze.ui.Screen] Frame 0
class nick.yugopoMaze.ui.Screen
{
var __mc, ui, __outroCallbackID, __outroCallbackPath, __isOpening, __isClosing, __isClosed;
function Screen (mc, t_ui) {
__mc = mc;
ui = t_ui;
__outroCallbackID = (__outroCallbackPath = "");
}
function update(dt) {
if (__isOpening) {
if (__mc._currentFrame >= __OPENED_FRAME) {
onOpened();
}
} else if (__isClosing) {
if (__mc._currentFrame == __mc._totalFrames) {
onClosed();
}
}
}
function init() {
__isOpening = (__isClosing = false);
__isClosed = true;
}
function open() {
__isClosed = false;
if (__HAS_INTRO) {
__isOpening = true;
__mc.gotoAndPlay(__INTRO_FRAME);
} else {
onOpened();
}
}
function onOpened() {
__isOpening = false;
__mc.gotoAndStop(__OPENED_FRAME);
}
function close(skipOutro) {
if (__isClosed) {
ui.onScreenClosed();
return(undefined);
}
if (__HAS_OUTRO && (skipOutro != true)) {
__isClosing = true;
__mc.gotoAndPlay(__OUTRO_FRAME);
} else {
onClosed();
}
}
function onClosed() {
__isClosing = false;
__isClosed = true;
if (__outroCallbackID != "") {
smashing.keithm.Messenger.sendMessage(__outroCallbackPath, __outroCallbackID);
__outroCallbackID = (__outroCallbackPath = "");
} else {
ui.onScreenClosed();
}
}
function closeThenCallback(callbackPath, callbackID) {
__outroCallbackPath = callbackPath;
__outroCallbackID = callbackID;
close();
}
function makeButton(mc) {
mc.screen = this;
}
function onMessageReceived(message, args) {
this[message](args);
}
function toString() {
return("Screen");
}
var __INTRO_FRAME = "intro";
var __OUTRO_FRAME = "outro";
var __HAS_INTRO = false;
var __HAS_OUTRO = false;
var __OPENED_FRAME = 1;
var DOES_UPDATE = true;
}
Symbol 1075 MovieClip [__Packages.nick.yugopoMaze.ui.Splash] Frame 0
class nick.yugopoMaze.ui.Splash extends nick.yugopoMaze.ui.Screen
{
var __mc;
function Splash (mc, ui) {
super(mc, ui);
}
function onOpened() {
super.onOpened();
nick.yugopoMaze.Sounds.getInstance().playMusic();
__mc.play_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("ui", "goScreenRemote", {screen:"intro"});
};
__mc.help_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "showHelp");
};
__mc.view_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "viewHighscore");
};
__mc.wendyscode_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "showWendys");
};
}
var __HAS_INTRO = false;
var __HAS_OUTRO = true;
var __OPENED_FRAME = 1;
}
Symbol 1076 MovieClip [__Packages.nick.yugopoMaze.ui.GamePlay] Frame 0
class nick.yugopoMaze.ui.GamePlay extends nick.yugopoMaze.ui.Screen
{
var __state, __fromHelpScreen, __isClosed, ui, __isClosing, __mc, onClosed, __isOpening, __OPENED_FRAME;
function GamePlay (mc, ui, fromHelpScreen) {
super(mc, ui);
__state = nick.yugopoMaze.GameState.getInstance();
__fromHelpScreen = fromHelpScreen;
}
function close(skipOutro) {
if (__isClosed) {
ui.onScreenClosed();
return(undefined);
}
if (skipOutro != true) {
__isClosing = true;
__mc.irisOut_mc.gotoAndPlay(2);
} else {
onClosed();
}
}
function onOpened() {
super.onOpened();
__mc.quit_confirm.yes_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "gameOver");
};
__mc.quit_confirm.no_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("screen", "onCancelQuit");
};
__mc.quit_confirm._visible = false;
__mc.flower_icon.onRelease = function () {
smashing.keithm.Messenger.sendMessage("world", "clickPowerup", {type:"flower"});
};
__mc.choco_icon.onRelease = function () {
smashing.keithm.Messenger.sendMessage("world", "clickPowerup", {type:"chocolate"});
};
__mc.bear_icon.onRelease = function () {
smashing.keithm.Messenger.sendMessage("world", "clickPowerup", {type:"teddybear"});
};
updateMuteButton({isMuted:nick.yugopoMaze.Sounds.getInstance().muteMusic});
__mc.menu_mc.help_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "showHelp");
};
__mc.menu_mc.quit_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("screen", "onPressQuit");
};
if (__fromHelpScreen != true) {
__mc.irisIn_mc.gotoAndPlay(2);
__mc.levelDisplay_mc.gotoAndPlay(2);
__mc.levelDisplay_mc.level_mc.txt_level.text = __state.levelNum;
}
update(0, true);
}
function updateMuteButton(args) {
if (args.isMuted) {
__mc.menu_mc.sound_btn.gotoAndStop("off");
} else {
__mc.menu_mc.sound_btn.gotoAndStop("on");
}
__mc.menu_mc.sound_btn.btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "toggleMusic");
};
}
function onPressQuit() {
__mc.quit_confirm._visible = true;
smashing.keithm.Messenger.sendMessage("engine", "pause");
}
function onCancelQuit() {
__mc.quit_confirm._visible = false;
smashing.keithm.Messenger.sendMessage("engine", "unpause");
}
function showInsufficientPickups(args) {
if (__mc.pickupDisplay_mc._currentFrame > 1) {
return(undefined);
}
__mc.pickupDisplay_mc.gotoAndPlay(2);
if (args.needed == 1) {
__mc.pickupDisplay_mc.level_mc.txt.text = ("You need " + args.needed) + " more nickel!";
} else {
__mc.pickupDisplay_mc.level_mc.txt.text = ("You need " + args.needed) + " more nickels!";
}
}
function showMissingKey() {
if (__mc.pickupDisplay_mc._currentFrame > 1) {
return(undefined);
}
__mc.pickupDisplay_mc.gotoAndPlay(2);
__mc.pickupDisplay_mc.level_mc.txt.text = "You need the Blast Key!";
}
function showWendysEffect(t_data) {
if (__mc.pickupDisplay_mc._currentFrame > 1) {
return(undefined);
}
__mc.pickupDisplay_mc.gotoAndPlay(2);
if (t_data.effect == "nuke") {
__mc.pickupDisplay_mc.level_mc.txt.text = "Poof!";
} else if (t_data.effect == "ghost") {
__mc.pickupDisplay_mc.level_mc.txt.text = "Ghosted!";
} else if (t_data.effect == "speed") {
__mc.pickupDisplay_mc.level_mc.txt.text = "Turbo!";
}
}
function update(dt, forceUpdate) {
if (__isOpening) {
if (__mc._currentFrame >= __OPENED_FRAME) {
onOpened();
}
} else if (__isClosing) {
if (__mc.irisOut_mc._currentFrame == __mc.irisOut_mc._totalFrames) {
onClosed();
}
}
__mc.timer_mc.mcBar.gotoAndStop(Math.floor((1 - __state.getTimeRatio()) * 100));
if (__state.hasChanged || (forceUpdate == true)) {
__mc.score_mc.txt_score.text = __state.score;
__mc.lives_mc.numbers_mc.gotoAndStop(__state.lives);
if (__state.hasFlower) {
__mc.flower_icon._visible = true;
} else {
__mc.flower_icon._visible = false;
}
if (__state.hasBear) {
__mc.bear_icon._visible = true;
} else {
__mc.bear_icon._visible = false;
}
if (__state.hasChoco) {
__mc.choco_icon._visible = true;
} else {
__mc.choco_icon._visible = false;
}
}
}
function chargeKey() {
__mc.key_mc.chargeBar.gotoAndPlay(2);
}
var __HAS_OUTRO = true;
var DOES_UPDATE = true;
}
Symbol 1077 MovieClip [__Packages.nick.yugopoMaze.ui.Help] Frame 0
class nick.yugopoMaze.ui.Help extends nick.yugopoMaze.ui.Screen
{
var __openedFromTitle, __mc, closeThenCallback;
function Help (mc, ui, fromTitle) {
super(mc, ui);
__openedFromTitle = fromTitle;
if (!__openedFromTitle) {
__mc.splash_fake_mc._visible = false;
}
}
function onPressPlay() {
closeThenCallback("engine", "startGame");
}
function onOpened() {
super.onOpened();
if (__openedFromTitle) {
__mc.board_mc.play_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("ui", "goScreenRemote", {screen:"intro"});
};
} else {
__mc.board_mc.play_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "hideHelp");
};
}
}
var __HAS_INTRO = true;
var __HAS_OUTRO = true;
var __OPENED_FRAME = 6;
}
Symbol 1078 MovieClip [__Packages.nick.yugopoMaze.ui.Wendys] Frame 0
class nick.yugopoMaze.ui.Wendys extends nick.yugopoMaze.ui.Screen
{
var closeThenCallback, __mc;
function Wendys (mc, ui) {
super(mc, ui);
}
function onPressPlay() {
closeThenCallback("engine", "startGame");
}
function onOpened() {
super.onOpened();
__mc.board_mc.txt_code.tabIndex = 0;
Selection.setFocus(__mc.board_mc.txt_code);
__mc.board_mc.submit_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "submitWendysCode", {code:this._parent.txt_code.text});
};
__mc.board_mc.cancel_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("ui", "goScreenRemote", {screen:"splash"});
};
}
function showError() {
__mc.board_mc.error_mc._visible = true;
__mc.board_mc.error_mc.gotoAndPlay(1);
}
function close() {
__mc.board_mc.error_mc._visible = false;
super.close();
}
var __HAS_INTRO = true;
var __HAS_OUTRO = true;
var __OPENED_FRAME = 6;
}
Symbol 1079 MovieClip [__Packages.nick.yugopoMaze.ui.LevelTrans] Frame 0
class nick.yugopoMaze.ui.LevelTrans extends nick.yugopoMaze.ui.Screen
{
function LevelTrans (mc, ui, fromTitle) {
super(mc, ui);
}
function onOpened() {
smashing.keithm.Messenger.sendMessage("engine", "startLevel");
}
var __HAS_INTRO = true;
var __HAS_OUTRO = false;
var __OPENED_FRAME = 36;
var DOES_UPDATE = true;
}
Symbol 1080 MovieClip [__Packages.nick.yugopoMaze.ui.Intro] Frame 0
class nick.yugopoMaze.ui.Intro extends nick.yugopoMaze.ui.Screen
{
function Intro (mc, ui, fromTitle) {
super(mc, ui);
nick.yugopoMaze.Sounds.getInstance().stopMusic();
}
function onOpened() {
}
var __HAS_INTRO = true;
var __HAS_OUTRO = false;
var __OPENED_FRAME = 718;
var DOES_UPDATE = true;
}
Symbol 1081 MovieClip [__Packages.nick.yugopoMaze.ui.GameOver] Frame 0
class nick.yugopoMaze.ui.GameOver extends nick.yugopoMaze.ui.Screen
{
var __mc;
function GameOver (mc, ui) {
super(mc, ui);
}
function onOpened() {
super.onOpened();
__mc.txt_score.text = (__mc.txt_scoreShadow.text = nick.yugopoMaze.GameState.getInstance().score);
__mc.play_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "startGame");
};
__mc.view_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "viewHighscore");
};
if (nick.highscores.HighscoreEngine.__get__isLoggedIn()) {
__mc.submit_btn.onRelease = function () {
smashing.keithm.Messenger.sendMessage("engine", "sendHighscore");
};
} else {
__mc.submit_btn._visible = false;
}
}
function onClosed() {
super.onClosed();
stopAllSounds();
}
var __OPENED_FRAME = 1;
}
Symbol 1082 MovieClip [__Packages.nick.highscores.HighscoreEngine] Frame 0
class nick.highscores.HighscoreEngine extends MovieClip
{
static var __userName, __loadState, __xml, __userPath, __scorePath, __game_id, __user_vars, __userScore, __highscoreMC, __scores, __functionToRunAfterLoad, __stateVerificationInterval, __score_vars;
function HighscoreEngine () {
super();
}
static function init() {
trace("Highscore Data Class Initialized **");
__userName = "null";
__loadState = "loading";
if (__USE_XML) {
loadXML();
}
}
static function loadXML() {
__xml = new XML();
__xml.ignoreWhite = true;
__xml.onLoad = function (success) {
nick.highscores.HighscoreEngine.onXMLloaded(success);
};
var _local2 = _root._url.slice(0, _root._url.lastIndexOf("/") + 1);
if (_local2 != "") {
_local2 = _local2 + "/";
}
log(("Loading XML file from " + (_local2 + __XML_FILE_URL)) + " ...");
__xml.load(_local2 + __XML_FILE_URL);
}
static function onXMLloaded(success) {
if (success) {
__userPath = __xml.firstChild.childNodes[0].firstChild.nodeValue;
__scorePath = __xml.firstChild.childNodes[1].firstChild.nodeValue;
__game_id = __xml.firstChild.childNodes[2].firstChild.nodeValue;
log("Xml loaded : ");
log("User : " + __userPath);
log("score: " + __scorePath);
log("gameID: " + __game_id);
} else {
log("XML Loading error");
}
updateUserLogin();
}
static function manualXML(userPath, scorePath, gameID) {
__userPath = userPath;
__scorePath = scorePath;
__game_id = gameID;
updateUserLogin();
}
static function updateUserLogin() {
log("Test user login...");
__user_vars = new LoadVars();
__user_vars.onLoad = function (success) {
nick.highscores.HighscoreEngine.onLogin(success);
};
__user_vars.load(__userPath);
}
static function onLogin(success) {
if (success) {
while (__user_vars.screenName.indexOf("/n") != -1) {
log("Cull login string - : " + __user_vars.screenName);
__user_vars.screenName = __user_vars.screenName.substr(0, __user_vars.screenName.length - 2);
log("Result: " + __user_vars.screenName);
}
__userName = __user_vars.screenName;
log("USER IS : " + __userName);
}
log("USER IS NOT LOGGED IN");
__loadState = "ready";
}
static function populateHighscoreBoard() {
if ((isLoggedIn && (__userScore > 0)) && (__userScore != undefined)) {
__highscoreMC.init(__scores, {name:__userName, score:__userScore});
} else {
__highscoreMC.init(__scores, {name:"", score:0});
}
}
static function runReadyTest(callback) {
if (__loadState != "ready") {
__functionToRunAfterLoad = callback;
startBoardReadyInterval();
return(false);
}
return(true);
}
static function startBoardReadyInterval() {
__stateVerificationInterval = setInterval(function () {
nick.highscores.HighscoreEngine.runBoardReadyInterval();
}, 5);
}
static function runBoardReadyInterval() {
if (__loadState == "ready") {
clearInterval(__stateVerificationInterval);
if (__functionToRunAfterLoad == "sendAndView") {
sendAndViewScore(__highscoreMC, __userScore);
} else {
viewScores(__highscoreMC);
}
} else if (__loadState == "error") {
__highscoreMC.showError();
clearInterval(__stateVerificationInterval);
}
}
static function sendAndViewScore(boardMC, score) {
__highscoreMC = boardMC;
__userScore = score;
__highscoreMC.gotoAndStop("loading");
if (runReadyTest("sendAndView") == false) {
return(undefined);
}
log("Send Score...");
if ((__userName == "null") && (__userName == undefined)) {
log(("Error: User name is : " + __userName) + ". Only logged in users may send scores.");
return(undefined);
}
__score_vars = new LoadVars();
__score_vars.onLoad = function (success) {
nick.highscores.HighscoreEngine.onHighscores(success);
};
log((((((((("Load ( " + __scorePath) + "?msg=S&game=") + __game_id) + "&name=") + __userName) + "&score=") + score) + "&limitEntries=true") + " )");
__score_vars.load(((((((__scorePath + "?msg=S&game=") + __game_id) + "&name=") + __userName) + "&score=") + score) + "&limitEntries=true");
}
static function viewScores(boardMC) {
__highscoreMC = boardMC;
__userScore = 0;
__highscoreMC.gotoAndStop("loading");
if (runReadyTest("view") == false) {
return(undefined);
}
log("View Scores...");
log(((("Load ( " + __scorePath) + "?msg=Q&game=") + __game_id) + " )");
__score_vars = new LoadVars();
__score_vars.onLoad = function (success) {
nick.highscores.HighscoreEngine.onHighscores(success);
};
__score_vars.load((__scorePath + "?msg=Q&game=") + __game_id);
}
static function onHighscores(success) {
log("Server callback recieved: ");
log("Success: " + success);
log("Returning game ID: " + __score_vars.game);
if ((!success) || (__score_vars.game != __game_id)) {
log("Highscore retrieval Failed.");
__highscoreMC.showError();
return(undefined);
}
__scores = [];
var _local1 = 0;
while (_local1 < __score_vars.count) {
__scores.push({name:__score_vars["pn" + _local1], score:__score_vars["ps" + _local1]});
_local1++;
}
populateHighscoreBoard();
}
static function set userPath(path) {
__userPath = path;
//return(userPath);
}
static function get userPath() {
return(__userPath);
}
static function set scorePath(path) {
__scorePath = path;
//return(scorePath);
}
static function get scorePath() {
return(__scorePath);
}
static function set gameID(id) {
__game_id = id;
//return(gameID);
}
static function get gameID() {
return(__game_id);
}
static function get scores() {
return(__scores);
}
static function get userName() {
return(__userName);
}
static function get isLoggedIn() {
return((((__userName == undefined) || (__userName == "null")) ? false : true));
}
static function log(message) {
var _local1 = new LocalConnection();
_local1.send("_SILCtrace", "trace", message);
_local1.close();
trace("LOG : " + message);
}
static var __USE_XML = true;
static var __XML_FILE_URL = "config.xml";
static var __SCORE_CALL = "onHighscores";
}
Symbol 1083 MovieClip [__Packages.nick.yugopoMaze.ui.Highscores] Frame 0
class nick.yugopoMaze.ui.Highscores extends nick.yugopoMaze.ui.Screen
{
var __isViewing, __mc;
function Highscores (mc, ui, isViewing) {
super(mc, ui);
__isViewing = isViewing;
}
function onOpened() {
super.onOpened();
trace((__isViewing + " ~ ") + __mc.highscore_mc);
if (__isViewing) {
nick.highscores.HighscoreEngine.viewScores(__mc.highscore_mc);
} else {
nick.highscores.HighscoreEngine.sendAndViewScore(__mc.highscore_mc, nick.yugopoMaze.GameState.getInstance().score);
}
}
var __OPENED_FRAME = 1;
}
Symbol 1084 MovieClip [__Packages.nick.yugopoMaze.levels.LevelRandom] Frame 0
class nick.yugopoMaze.levels.LevelRandom extends nick.yugopoMaze.levels.LevelData
{
var grid_width, grid_height, getRandomCell, placeWalls, placeAliens, scenery, player, camera;
function LevelRandom () {
super();
}
function loadData() {
super.loadData();
grid_width = nick.yugopoMaze.GameState.getInstance().MAP_WIDTH;
grid_height = nick.yugopoMaze.GameState.getInstance().MAP_HEIGHT;
var _local14 = grid_height;
var _local8 = 0;
var _local3 = 0;
var _local5;
var _local9;
var _local4;
var _local6 = new Array(_local14);
var _local10 = 0;
while (_local10 < _local6.length) {
_local6[_local10] = new Array();
_local10++;
}
_local14--;
var _local7 = 0;
var _local11 = new nick.yugopoMaze.Node({x:getRandomCell(Math.floor(grid_width * 0.25), Math.floor(grid_width * 0.75)), y:_local14, nodeType:"tunnel", nodeClass:"root"});
_local6[_local14].push(_local11);
while (_local14--) {
_local9 = _local6[_local14 + 1];
_local8 = _local9.length;
while (_local8--) {
_local5 = _local9[_local8].generateSupportNode(((_local7 > 2) ? true : false));
if (_local5 != undefined) {
_local6[_local14].push(_local5);
if (_local5.nodeType == "room") {
_local7 = _local7 + 2;
_local4 = _local5.generateCornerNodes();
_local3 = _local4.length;
while (_local3--) {
if (_local4[_local3].y >= 0) {
_local6[_local4[_local3].y].push(_local4[_local3]);
}
}
}
} else {
_local7--;
}
}
}
placeWalls(_local6);
placeAliens(_local6);
scenery.push({type:"ground", x:0, y:0});
scenery.push({type:"ground", x:10, y:0});
scenery.push({type:"ground", x:0, y:5});
scenery.push({type:"ground", x:10, y:5});
scenery.push({type:"ground", x:0, y:10});
scenery.push({type:"ground", x:10, y:10});
scenery.push({type:"ground", x:0, y:15});
scenery.push({type:"ground", x:10, y:15});
player = {x:_local11.x, y:grid_height - 1};
camera = {x:6, y:6};
}
}
Symbol 1085 MovieClip [__Packages.nick.highscores.HighscoreTable] Frame 0
class nick.highscores.HighscoreTable extends MovieClip
{
var gotoAndStop, __scores, __player, __page, __totalPages, playerScore_mc, pagination_txt;
function HighscoreTable () {
super();
showLoading();
}
function showLoading() {
gotoAndStop("loading");
}
function showError() {
gotoAndStop("error");
}
function showTable() {
gotoAndStop("ready");
emptyTable();
}
function init(t_scores, t_player) {
showTable();
__scores = t_scores;
__player = t_player;
__page = 1;
__totalPages = Math.ceil(__scores.length / __SCORES_PER_PAGE);
var _local2 = 0;
while (_local2 < __scores.length) {
if (__scores[_local2].name == "") {
__totalPages = Math.ceil(_local2 / __SCORES_PER_PAGE);
_local2 = __scores.length;
}
_local2++;
}
populatePlayer();
populateTable();
}
function calculatePlayerRank() {
var _local2 = 0;
while (_local2 < __scores.length) {
if (__scores[_local2].name == __player.name) {
return(String(_local2));
}
_local2++;
}
return("");
}
function populatePlayer() {
if ((((__player.name == "") || (__player.name == undefined)) || (__player.name == null)) || (__player.name == "null")) {
playerScore_mc._visible = false;
} else {
playerScore_mc._visible = true;
playerScore_mc.name.text = __player.name;
playerScore_mc.score.text = __player.score;
playerScore_mc.rank.text = calculatePlayerRank();
}
}
function populateTable() {
var c = ((__page - 1) * __SCORES_PER_PAGE);
var loop = 1;
while (loop <= __SCORES_PER_PAGE) {
if (__scores[c].name != "") {
eval ((this + ".hs_") + loop).rank.text = ((__page - 1) * 10) + loop;
eval ((this + ".hs_") + loop).name.text = __scores[c].name;
eval ((this + ".hs_") + loop).score.text = __scores[c].score;
} else {
eval ((this + ".hs_") + loop).rank.text = "";
eval ((this + ".hs_") + loop).name.text = "";
eval ((this + ".hs_") + loop).score.text = "";
}
loop++;
c++;
}
pagination_txt.text = (__page + " of ") + __totalPages;
if (__totalPages < 1) {
__totalPages = 1;
}
}
function emptyTable() {
playerScore_mc._visible = false;
var loop = 1;
while (loop <= __SCORES_PER_PAGE) {
eval ((this + ".hs_") + loop).rank.text = "";
eval ((this + ".hs_") + loop).name.text = "";
eval ((this + ".hs_") + loop).score.text = "";
loop++;
}
pagination_txt.text = "";
}
function nextPage() {
__page++;
if (__page > __totalPages) {
__page = 1;
}
populateTable();
}
function prevPage() {
__page--;
if (__page < 1) {
__page = __totalPages;
}
populateTable();
}
var __SCORES_PER_PAGE = 10;
}
Symbol 730 MovieClip [moveTarget_mc] Frame 6
stop();
Symbol 754 MovieClip Frame 1
stop();
Symbol 828 MovieClip Frame 30
stop();
Symbol 833 MovieClip Frame 33
stop();
Symbol 835 MovieClip Frame 13
stop();
Symbol 880 MovieClip Frame 68
stop();
Symbol 891 MovieClip Frame 13
stop();
Symbol 917 MovieClip Frame 1
stop();
Symbol 959 MovieClip Frame 15
if (_parent._xscale < 0) {
_parent._xscale = 100;
}
Symbol 1005 MovieClip Frame 12
stop();
Symbol 1007 MovieClip Frame 12
stop();