Frame 1
function checkLoad() {
var _local3 = Math.round(this.getBytesLoaded()) || 0;
var _local4 = Math.round(this.getBytesTotal()) || 0;
var _local2 = Math.round((_local3 / _local4) * 100) || 0;
if (_local2 < 100) {
loader.gotoAndStop(_local2);
prevBytesLoaded = _local3;
} else {
delete this.onEnterFrame;
loader.gotoAndPlay("exit");
}
}
stop();
this.onEnterFrame = checkLoad;
Frame 9
function init() {
PROJECT_CLIP.init();
}
stop();
var PROJECT_CLIP = project;
if (this == _root) {
init();
}
Symbol 7 MovieClip Frame 1
stop();
Symbol 14 MovieClip [tomatoSplat] Frame 1
stop();
Symbol 14 MovieClip [tomatoSplat] Frame 7
play();
Symbol 14 MovieClip [tomatoSplat] Frame 19
stop();
Symbol 15 MovieClip Frame 1
stop();
Symbol 15 MovieClip Frame 2
stop();
Symbol 30 MovieClip [loader] Frame 1
stop();
loadingColor.setMask(loadMasker);
gotoAndStop ("idle");
Symbol 30 MovieClip [loader] Frame 123
_parent.gotoAndPlay("game");
stop();
Symbol 717 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();
}
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 718 MovieClip [__Packages.nick.spiderwick.Engine] Frame 0
class nick.spiderwick.Engine extends MovieClip
{
var interval, sound, viewport_mc, __viewport, activeWorld, __score, __lives, __books, state, hud_mc, __isMuted, __updateUI, __bookOpening, pause_mc, popInHead_mc, isMouseDown, iris_mc, screen_mc, gotoAndStop, gameIntro, __viewScoreSection, highscore_mc, mouse, transition_mc, key, mute_mc, menu_mc, help_mc, quit_mc;
function Engine () {
super();
}
function init() {
super.init();
interval = new smashing.IntervalEngine(this, "update");
interval.startFast();
nick.highscores.HighscoreEngine.init();
sound = new smashing.sound.SoundEngine();
sound.generateSounds(viewport_mc, 10);
sound.createGroup("music");
sound.createSound("music", "idleMusicloop.wav", "music");
sound.createGroup("ingame_music");
sound.createSound("ingame_music", "showdown_loop.wav", "ingame_music");
sound.createSound("mansionHit", "PULLBACK 1 L.wav");
sound.createSound("mansionDie", "game_over_mod.wav");
sound.createSound("beam", "BIG WAND L.wav");
sound.createSound("start", "Game_Start.mp3");
sound.createSound("mascot", "Game_Mascot_Appears.mp3");
sound.createSound("end_1", "End_1.mp3");
sound.createSound("end_2", "End_2.mp3");
sound.createSound("end_3", "End_3.mp3");
nick.spiderwick.GameState.init();
smashing.keithm.Viewport.init(viewport_mc, 1, nick.spiderwick.GameState.getInstance());
__viewport = smashing.keithm.Viewport.getInstance();
__viewport.createGroup({name:"enemy", index:0, slots:100});
__viewport.createGroup({name:"mansion", index:1, slots:1});
__viewport.createGroup({name:"pickup", index:2, slots:5});
__viewport.createGroup({name:"projectile", index:3, slots:200});
__viewport.createGroup({name:"player", index:4, slots:1});
__viewport.reset();
activeWorld = new nick.spiderwick.World();
activeWorld.init(this);
__initMouse();
__initKey();
reset();
playMusic();
goTitle();
}
function get score() {
return(__score);
}
function get lives() {
return(__lives);
}
function get books() {
return(__books);
}
function get levels() {
return(activeWorld.__get__levelNum());
}
function state_intro() {
state = "intro";
}
function state_game() {
state = "g";
hud_mc.menu_btn._visible = true;
}
function state_menu() {
state = "m";
}
function state_quit() {
state = "q";
}
function hideMenu() {
hud_mc.menu_btn._visible = true;
}
function reset() {
__lives = __STARTLIVES;
__books = __STARTBOOKS;
__score = 0;
__isMuted = false;
__updateUI = true;
__easterEggTriggered = false;
__bookOpening = false;
__damageWarningLevel = 0;
__easterEggShown = false;
__easterEggTriggered = false;
}
function startGame() {
reset();
goGameplay();
startLevel();
}
function startLevel() {
__viewport.newView();
activeWorld.generate();
pause();
activeWorld.start();
}
function showMovieRelease() {
return(nick.highscores.HighscoreEngine.__get__showMovieRelease());
}
function endLevel() {
pause();
goNextLevel();
}
function stopGame() {
__viewport.newView();
pause();
}
function winGame() {
}
function silence() {
stopSound("beam");
stopMusic();
}
function gameOver() {
pause();
activeWorld.onQuit();
playIris(this, "gameOverDelayed");
}
function gameOverDelayed() {
__viewport.newView();
goGameOver();
}
function togglePause() {
if (isPaused) {
unpause();
pause_mc.gotoAndStop("off");
} else {
pause();
pause_mc.gotoAndStop("on");
}
}
function pause() {
isFirstPaused = true;
isPaused = true;
}
function unpause() {
isFirstUnpaused = true;
isPaused = false;
}
function healSparkle() {
hud_mc.health_mc.sparkle_mc.gotoAndPlay("on");
}
function scoreSparkle() {
hud_mc.score_mc.sparkle_mc.gotoAndPlay("on");
}
function showDamageWarning(damageLevel) {
__damageWarningLevel = damageLevel;
popInHead_mc.gotoAndPlay("popin" + damageWarningLabel());
}
function exitDamageWarning() {
popInHead_mc.gotoAndPlay("outro" + damageWarningLabel());
}
function damageWarningLabel() {
var _local2 = ["mal", "bro"];
return(_local2[__damageWarningLevel]);
}
function update(el) {
if (el > 0.2) {
el = 0.2;
}
if (!isPaused) {
if (isFirstUnpaused) {
isFirstUnpaused = false;
playMusic();
}
if (isMouseDown) {
activeWorld.playerFire();
}
activeWorld.update(el);
if (__updateUI) {
updateUI();
__updateUI = false;
}
} else if (isFirstPaused) {
isFirstPaused = false;
playMusic();
}
updateAfterEvent();
}
function addScore(t_score) {
__score = __score + t_score;
__updateUI = true;
}
function addBook(value) {
__books = __books + value;
}
function requestUpdateUI() {
__updateUI = true;
}
function playIris(middlePath, middleFunc, endPath, endFunc) {
iris_mc.middlePath = middlePath;
iris_mc.middleFunc = middleFunc;
iris_mc.endPath = endPath;
iris_mc.endFunc = endFunc;
iris_mc.gotoAndPlay("start");
}
function delayedHelp() {
startGame();
goHelp();
}
function clickPlay() {
screen_mc.gotoAndStop(2);
if (!__hasPlayedIntro) {
playIris(this, "goGameIntro", this);
} else {
playIris(this, "startGame", this, "unpause");
}
}
function goGameIntro() {
stopAllMusic();
__hasPlayedIntro = true;
gotoAndStop("game");
state_intro();
hud_mc._visible = false;
gameIntro.gotoAndPlay("intro");
smashing.utils.PlayHeadNotifier.notifyStop(gameIntro, mx.utils.Delegate.create(this, clickSkipIntro));
}
function clickSkipIntro() {
playIris(this, "introToGame", this);
}
function introToGame() {
gameIntro.gotoAndStop("off");
hud_mc._visible = true;
startGame();
unpause();
}
function clickPlayAgain() {
screen_mc.gotoAndStop(2);
playIris(this, "startGame", this, "unpause");
}
function clickMenu() {
goMenu();
}
function clickBook() {
if (__books <= 0) {
return(undefined);
}
if (__bookOpening) {
return(undefined);
}
addBook(-1);
__bookOpening = true;
openBook();
}
function clickHelp() {
screen_mc.gotoAndStop(2);
playIris(this, "goGameplay", this, "delayedHelp");
}
function onHelpClose() {
__helpActivated = false;
if (!__hasPlayedIntro) {
playIris(this, "goGameIntro", this);
} else {
unpause();
state_game();
}
}
function onMenuClose(action) {
if (action == "resume") {
unpause();
state_game();
} else if (action == "quitcheck") {
goQuitCheck();
} else if (action == "quit") {
gameOver();
} else if (action == "help") {
goHelp();
} else if (action == "menureturn") {
goMenu();
}
}
function clickViewScore(section) {
__viewScoreSection = section;
gotoAndStop("highscores");
if (section == "title") {
highscore_mc.btn_submit._visible = false;
} else {
highscore_mc.btn_submit._visible = nick.highscores.HighscoreEngine.isLoggedIn;
}
nick.highscores.HighscoreEngine.viewScores(highscore_mc);
}
function clickSubmitScore() {
gotoAndStop("highscores");
highscore_mc.btn_submit._visible = false;
nick.highscores.HighscoreEngine.sendAndViewScore(highscore_mc, finalScore);
}
function closeHighScoreView() {
if (__viewScoreSection == "title") {
goTitle();
} else {
goGameOver();
}
}
function get accuracy() {
var _local2 = Math.ceil((activeWorld.shotsHit / activeWorld.shotsFired) * 100);
if (_local2 > 100) {
_local2 = 100;
}
if (isNaN(_local2) || (_local2 == undefined)) {
_local2 = 0;
}
return(_local2);
}
function get finalScore() {
return(score + finalBonus);
}
function get finalBonus() {
if (accuracy == NaN) {
return(0);
}
return(accuracy * activeWorld.shotsHit);
}
function __initMouse() {
mouse = {};
mouse.owner = this;
mouse.onMouseUp = function () {
this.owner.mouse_up();
};
mouse.onMouseDown = function () {
this.owner.mouse_down();
};
Mouse.addListener(mouse);
}
function mouse_up() {
isMouseDown = false;
}
function mouse_down() {
if (isPaused) {
return(undefined);
}
isMouseDown = true;
}
function runLevelTransition(t_levelNum) {
activeWorld.suspendSpawning();
transition_mc.levelNum = t_levelNum;
transition_mc.gotoAndPlay("play");
}
function completeLevelTransition() {
activeWorld.reinstateSpawning();
if (activeWorld.__get__levelNum() == 1) {
playSound("start");
}
}
function __initKey() {
key = {};
key.owner = this;
key.onKeyDown = mx.utils.Delegate.create(this, key_down);
Key.addListener(key);
}
function key_down() {
if (Key.getCode() == 80) {
togglePause();
} else if (Key.getCode() == 77) {
toggleMute();
} else if (Key.getCode() == 81) {
} else if (Key.getCode() == 32) {
clickBook();
}
if (__helpActivated) {
if (Key.getCode() == 84) {
showEasterEggHint();
}
} else if (Key.getCode() == 32) {
clickBook();
} else if (Key.isDown(70) && (Key.isDown(71))) {
triggerEasterEgg();
}
}
function playSound(t_name, t_loops) {
if (t_loops == undefined) {
sound.playSound(t_name);
} else {
sound.playSound(t_name, t_loops);
}
}
function stopSound(t_name) {
sound.stopSound(t_name);
}
function playMusic() {
if (!__isMuted) {
stopAllMusic();
if (isPaused) {
sound.playSound("music", 0);
} else {
sound.playSound("ingame_music", 0);
}
}
}
function stopMusic() {
if (isPaused) {
sound.stopSound("ingame_music");
} else {
sound.stopSound("music");
}
}
function stopAllMusic() {
sound.stopSound("music");
sound.stopSound("ingame_music");
}
function toggleMute() {
if (__isMuted) {
__isMuted = false;
playMusic();
mute_mc.gotoAndStop("on");
} else {
__isMuted = true;
stopAllMusic();
mute_mc.gotoAndStop("off");
}
menu_mc.popup_mc.music_on_btn._visible = __isMuted;
menu_mc.popup_mc.music_off_btn._visible = !__isMuted;
}
function getIsMute() {
return(__isMuted);
}
function parseMainXML() {
}
function goTitle() {
pause();
gotoAndStop("title");
state_menu();
}
function goStartLevel(t_levelName) {
pause();
gotoAndStop("startLevel");
state_menu();
}
function goHelp() {
__helpActivated = true;
pause();
help_mc.gotoAndPlay("intro");
state_menu();
hud_mc.menu_btn._visible = false;
}
function goQuitCheck() {
state_quit();
quit_mc.gotoAndPlay("intro");
}
function goMenu() {
if (state == "m") {
return(undefined);
}
pause();
menu_mc.gotoAndPlay("intro");
state_menu();
hud_mc.menu_btn._visible = false;
}
function openBook() {
if (state == "m") {
return(undefined);
}
hud_mc.bookanim_mc.gotoAndPlay("open");
activeWorld.playerBook();
smashing.utils.PlayHeadNotifier.notifyEOF(hud_mc.bookanim_mc, mx.utils.Delegate.create(this, openBookFinished));
}
function openBookFinished() {
__bookOpening = false;
hud_mc.bookanim_mc.gotoAndStop("off");
__updateUI = true;
}
function showEasterEggHint() {
if (!__helpActivated) {
return(undefined);
}
if (__easterEggShown) {
return(undefined);
}
if (help_mc._currentFrame < 42) {
return(undefined);
}
__easterEggShown = true;
help_mc.easterEggUpper.gotoAndPlay("show");
help_mc.easterEggLower.gotoAndPlay("show");
}
function closeEasterEggHint() {
if (!__helpActivated) {
return(undefined);
}
if (!__easterEggShown) {
return(undefined);
}
help_mc.easterEggLower.clueAnim.gotoAndPlay("off");
help_mc.easterEggUpper.gotoAndPlay("showout");
help_mc.easterEggLower.gotoAndPlay("showout");
smashing.utils.PlayHeadNotifier.notifyStop(help_mc.easterEggLower, mx.utils.Delegate.create(this, closeEasterEggHintDone));
}
function triggerEasterEgg() {
if (__easterEggTriggered) {
return(undefined);
}
__easterEggTriggered = true;
addBook(1);
hud_mc.books_mc.booknum_mc.gotoAndPlay("extrabomb");
hud_mc.books_mc.booknum_mc.bookNumGlow.txt_booknum.text = books;
hud_mc.easterEggUpper.gotoAndPlay("show");
hud_mc.easterEggLower.gotoAndPlay("show");
updateUI();
}
function closeEasterEggHintDone() {
__easterEggShown = false;
}
function goGameplay() {
gotoAndStop("game");
state_game();
updateUI();
}
function goGameOver() {
pause();
state_menu();
gotoAndStop("lose");
screen_mc.art_mc.scores_mc.txt_score.text = score;
screen_mc.art_mc.scores_mc.txt_hits.text = activeWorld.shotsHit;
screen_mc.art_mc.scores_mc.txt_acc.text = String(accuracy) + "%";
screen_mc.art_mc.scores_mc.txt_bonus.text = finalBonus;
screen_mc.art_mc.scores_mc.txt_total.text = finalScore;
screen_mc.art_mc.scores_mc.txt_level.text = levels;
screen_mc.end_txt.gotoAndStop(getEndTextFrame());
if (nick.highscores.HighscoreEngine.__get__isLoggedIn() != true) {
screen_mc.btn_submit._visible = false;
}
}
function getEndTextFrame() {
if (finalScore <= 25000) {
playSound("end_1");
return(1);
}
if (finalScore <= 45000) {
playSound("end_2");
return(5);
}
playSound("end_3");
return(10);
}
function goGameWin() {
pause();
state_menu();
gotoAndStop("win");
}
function goNextLevel() {
pause();
state_menu();
gotoAndStop("nextLevel");
}
function updateUI() {
if (activeWorld.__get__healthPercent() == 0) {
hud_mc.health_mc.gotoAndStop(1);
} else {
hud_mc.health_mc.gotoAndStop(activeWorld.__get__healthPercent() * 100);
}
hud_mc.score_mc.txt_score.text = score;
hud_mc.books_mc.booknum_mc.bookNumDisplay.txt_booknum.text = books;
}
var isPaused = true;
var isFirstPaused = true;
var isFirstUnpaused = true;
var __STARTLIVES = 3;
var __STARTBOOKS = 3;
var __HIGHSCORE_SEND_URL = "http://www.smashingideas.com/cgi-bin/doctorCompactor/submit_score.cgi";
var __HIGHSCORE_RECEIVE_URL = "http://www.smashingideas.com/cgi-bin/doctorCompactor/get_scores.cgi";
var __hasPlayedIntro = false;
var __helpActivated = false;
var __easterEggShown = false;
var __easterEggTriggered = false;
var __damageWarningLevel = 0;
}
Symbol 719 MovieClip [__Packages.smashing.IntervalEngine] Frame 0
class smashing.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", 10);
}
function reset(Void) {
if (_i != undefined) {
clearInterval(_i);
}
_ft = 0;
_last_update = getTimer() * 0.001;
_lel = _MAX_FRAMETIME / 2;
}
function _flex_step(Void) {
_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) {
_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.IntervalEngine.prototype._MIN_FPS;
var _lel = 0.2;
var _FPS = 0;
}
Symbol 720 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;
}
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) {
return(undefined);
}
_local4 = __drawElement(_local3);
if (_local4 != undefined) {
_local3.onDraw(_local4, getInstance());
// unexpected jump
}
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 721 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() {
}
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) {
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) {
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 722 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);
}
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;
}
}
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);
}
}
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);
}
function get isMuted() {
return(__flag_muted);
}
var __DEFAULTMCNAME = "soundEngine_MC";
var __DEFAULTGROUPNAME = "sound";
}
Symbol 723 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 724 MovieClip [__Packages.nick.spiderwick.World] Frame 0
class nick.spiderwick.World
{
var engine, __enemyCount, __isGameOver, __fireTimer, __showLevelDropdown, __mediumDamageShown, __highDamageShown, __levelNum, et, __isSpawning, __hasPickup, __mansion, __pickupTimer, __player, __camera, __updateProjectiles, loop, a_entitys, bloop, a_projectiles, proj, obj, shotsHit, __mushroomRing, __hasBullGoblin, __hasMoleTroll, __hasEaster, shotsFired, playerInvincible, __player_HP, a_enemyTimeline, __et_currentMax, __LEVELUP_ET_MAX_CHANGE, __ET_MAX_MINCAP, __et_currentMin, __LEVELUP_ET_MIN_CHANGE, __ET_MIN_MINCAP, __levelupCounter, __hasShoutedThisLevel, __START_ET_MAX, __START_ET_MIN;
function World () {
}
function init(t_engine) {
engine = t_engine;
}
function get kills() {
return(__enemyCount);
}
function stateGameOver() {
__isGameOver = true;
__fireTimer = 99;
engine.hideMenu();
suspendSpawning();
}
function start() {
__showLevelDropdown = true;
__mediumDamageShown = false;
__highDamageShown = false;
}
function update(el) {
if (__showLevelDropdown && (el > 0)) {
engine.runLevelTransition(__levelNum);
__showLevelDropdown = false;
}
et = et - el;
if ((et <= 0) && (__isSpawning)) {
spawnEnemy();
if ((!__hasPickup) && (Math.random() < 0.3)) {
spawnPickup();
}
}
if (__isGameOver) {
if (__mansion.mc._currentFrame < 5) {
engine.gameOver();
}
} else {
__fireTimer = __fireTimer - el;
__pickupTimer = __pickupTimer - el;
}
if (!__isGameOver) {
__player.updateMoveAndRender(__camera, el);
}
__updateProjectiles = true;
loop = a_entitys.length;
if (loop == 0) {
bloop = a_projectiles.length;
while (bloop--) {
proj = a_projectiles[bloop];
proj.updateMoveAndRender(__camera, el);
if (proj.doRemove) {
a_projectiles.splice(bloop, 1);
}
}
} else {
while (loop--) {
obj = a_entitys[loop];
if (!__isGameOver) {
obj.updateMoveAndRender(__camera, el);
}
bloop = a_projectiles.length;
while (bloop--) {
proj = a_projectiles[bloop];
if (__updateProjectiles) {
proj.updateMoveAndRender(__camera, el);
}
if (obj.isAlive && (proj.isAlive)) {
if (proj.runHD_entity_radius(obj, el)) {
shotsHit++;
proj.hitReact();
if (obj.TYPE == "pickup") {
if (proj.canHitPickup) {
obj.hitReact(proj);
applyPickup(obj.PICKUP_EFFECT);
}
} else {
obj.hitReact(proj);
}
} else if (obj.TYPE == "pickup") {
if (__pickupTimer <= 0) {
obj.hitReact();
}
}
}
if (__updateProjectiles) {
if (proj.doRemove) {
a_projectiles.splice(bloop, 1);
}
}
}
__updateProjectiles = false;
if (obj.isAlive) {
if ((obj.TYPE == "enemy") && (obj.isAlive)) {
if (__mansion.runHD_entity_box(obj, el)) {
obj.hitReact(__mansion);
mansionDamage();
} else if (__mushroomRing.runHD(obj, el)) {
if (!obj.isClawing) {
obj.hitReact(__mushroomRing);
}
} else if (obj.isClawing) {
obj.endClaw();
}
}
}
if (obj.doRemove) {
if (obj.TYPE == "pickup") {
__hasPickup = false;
} else if (obj.CHARACTER == "bullgoblin") {
__hasBullGoblin = false;
} else if (obj.CHARACTER == "moletroll") {
__hasMoleTroll = false;
} else if (obj.CHARACTER == "redcap") {
__hasEaster = false;
}
a_entitys.splice(loop, 1);
}
}
}
}
function applyPickup(effect) {
if (effect == "score") {
addScore(200);
engine.scoreSparkle();
} else if (effect == "health") {
__mushroomRing.repair();
} else if (effect == "powerup") {
powerUp();
}
}
function onQuit() {
__player.powerDown();
}
function powerUp() {
__player.powerUp();
}
function playerBook() {
if (__player.__get__canUseBook()) {
__player.useBook();
var _local2 = new nick.spiderwick.ents.BookBomb({owner:this, camera:__camera});
_local2.spawn();
a_projectiles.push(_local2);
}
}
function useBookDone() {
__player.useBookDone();
}
function playerFire() {
if (((__fireTimer <= 0) && (!__player.getIsAnimating())) && (!__isGameOver)) {
shotsFired++;
__player.fire();
__fireTimer = __FIRE_RATE;
}
}
function playerRelease() {
}
function pauseAnimations() {
var _local2 = a_entitys.length;
while (_local2--) {
a_entitys[_local2].pauseAnimations();
}
}
function unpauseAnimations() {
var _local2 = a_entitys.length;
while (_local2--) {
a_entitys[_local2].unpauseAnimations();
}
}
function mansionDamage() {
if (__isGameOver) {
return(undefined);
}
if (!playerInvincible) {
__player_HP--;
}
if (((!__mediumDamageShown) && (healthPercent >= 0.4)) && (healthPercent < 0.8)) {
__mediumDamageShown = true;
engine.showDamageWarning(0);
} else if ((!__highDamageShown) && (healthPercent < 0.4)) {
__highDamageShown = true;
engine.showDamageWarning(1);
}
if (__player_HP == 0) {
__mansion.damage();
engine.playSound("mansionDie");
stateGameOver();
pauseAnimations();
} else {
__mansion.damage();
engine.playSound("mansionHit");
}
engine.requestUpdateUI();
}
function mushroomRingDamage() {
}
function addScore(val) {
engine.addScore(val);
}
function dumpEnemyTimeline() {
var _local2 = 0;
while (_local2 < a_enemyTimeline.length) {
_local2++;
}
}
function levelUp() {
__levelNum++;
__et_currentMax = __et_currentMax - __LEVELUP_ET_MAX_CHANGE;
if (__et_currentMax < __ET_MAX_MINCAP) {
__et_currentMax = __ET_MAX_MINCAP;
}
__et_currentMin = __et_currentMin - __LEVELUP_ET_MIN_CHANGE;
if (__et_currentMin < __ET_MIN_MINCAP) {
__et_currentMin = __ET_MIN_MINCAP;
}
newEnemyTimeline();
}
function createProjectile(t_angle) {
if (t_angle == undefined) {
t_angle = 0;
}
if (t_angle < 0) {
t_angle = t_angle + 360;
}
var _local5 = new smashing.Point3D(_xmouse - __player.x, _ymouse - __player.y, 0);
var _local4 = {x:__player.x, y:__player.y};
var _local3 = new nick.spiderwick.ents.Projectile({owner:this, x:_local4.x, y:_local4.y, fireVector:_local5.normalize(), camera:__camera, damageType:(__player.hasTomato ? (nick.spiderwick.ents.Projectile.BLAST_DAMAGE) : (nick.spiderwick.ents.Projectile.HIT_DAMAGE))});
_local3.spawn();
a_projectiles.push(_local3);
}
function spawnEnemy() {
if (a_enemyTimeline.length == 0) {
levelUp();
engine.runLevelTransition(__levelNum);
return(undefined);
}
et = __et_currentMin + (Math.random() * (__et_currentMax - __et_currentMin));
var _local2;
var _local4 = true;
var _local3 = 3;
while (_local4 && (_local3 > 0)) {
_local2 = a_enemyTimeline.pop();
if ((((_local2.type == "bullgoblin") && (__hasBullGoblin)) || ((_local2.type == "moletroll") && (__hasMoleTroll))) || ((_local2.type == "redcap") && (__hasEaster))) {
a_enemyTimeline.unshift(_local2);
} else {
_local4 = false;
}
_local3--;
}
if (_local3 == 0) {
dumpEnemyTimeline();
return(undefined);
}
var _local5;
switch (_local2.type) {
case "goblin" :
_local5 = new nick.spiderwick.ents.Goblin({angle:_local2.angle, owner:this, camera:__camera});
break;
case "speargoblin" :
_local5 = new nick.spiderwick.ents.SpearGoblin({angle:_local2.angle, owner:this, camera:__camera});
break;
case "bullgoblin" :
_local5 = new nick.spiderwick.ents.BullGoblin({angle:_local2.angle, owner:this, camera:__camera});
__hasBullGoblin = true;
break;
case "redcap" :
_local5 = new nick.spiderwick.ents.Redcap({angle:_local2.angle, owner:this, camera:__camera});
__hasEaster = true;
break;
case "moletroll" :
_local5 = new nick.spiderwick.ents.MoleTroll({angle:_local2.angle, owner:this, camera:__camera});
__hasMoleTroll = true;
break;
}
a_entitys.push(_local5);
}
function spawnPickup() {
var _local7 = ((Math.random() > 0.5) ? 1 : -1);
var _local3 = Math.round(300 + ((_local7 * Math.random()) * 280));
var _local2 = Math.round(120 + ((_local7 * Math.random()) * 100));
var _local5 = _local3 - 300;
var _local4 = _local2 - 400;
var _local14 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
var _local8 = Math.random();
var _local9 = [0.9, 0.8, 0.8, 0.7, 0.7, 0.6, 0.5];
var _local10 = _local9[__levelNum] || 0.5;
var _local6 = false;
if (__mushroomRing.__get__health() < 100) {
if (Math.random() <= _local10) {
_local6 = true;
__hasPickup = true;
a_entitys.push(new nick.spiderwick.ents.PickupMushroom({x:_local3, y:_local2, owner:this, camera:__camera}));
}
}
if (!_local6) {
if (((!__player.hasTomato) && (__levelNum >= 3)) && (_local8 < 0.2)) {
__hasPickup = true;
a_entitys.push(new nick.spiderwick.ents.PickupTomato({x:_local3, y:_local2, owner:this, camera:__camera}));
} else {
__hasPickup = true;
a_entitys.push(new nick.spiderwick.ents.PickupGoldenAcorn({x:_local3, y:_local2, owner:this, camera:__camera}));
}
}
if (__hasPickup) {
__pickupTimer = 6;
}
}
function suspendSpawning() {
__isSpawning = false;
}
function reinstateSpawning() {
__isSpawning = true;
}
function generate() {
__isSpawning = true;
__isGameOver = false;
__enemyCount = 0;
__levelupCounter = 0;
__levelNum = 1;
__hasPickup = false;
__hasShoutedThisLevel = false;
shotsFired = 0;
shotsHit = 0;
__player_HP = __PLAYER_MAXHP;
__camera = new nick.spiderwick.GameCamera({dimensions:nick.spiderwick.GameState.getInstance()});
__player = new nick.spiderwick.ents.Player({x:nick.spiderwick.GameState.getInstance().playerStart.x, y:nick.spiderwick.GameState.getInstance().playerStart.y, owner:this, camera:__camera});
__mansion = new nick.spiderwick.ents.Mansion({owner:this, camera:__camera});
__mansion.render(__camera, 0);
__mushroomRing = new nick.spiderwick.ents.MushroomRing({owner:this, camera:__camera});
__mushroomRing.render(__camera);
a_entitys = [];
a_projectiles = [];
newEnemyTimeline();
__START_ET_MAX = 2.2;
__LEVELUP_ET_MAX_CHANGE = 0.2;
__ET_MAX_MINCAP = 1.2;
__START_ET_MIN = 0.4;
__LEVELUP_ET_MIN_CHANGE = 0.025;
__ET_MIN_MINCAP = 0.2;
__et_currentMax = __START_ET_MAX;
__et_currentMin = __START_ET_MIN;
__fireTimer = 0;
__pickupTimer = 0;
et = __et_currentMax;
__hasBullGoblin = false;
__hasMoleTroll = false;
__hasEaster = false;
}
function newEnemyTimeline() {
a_enemyTimeline = [];
var _local3;
var _local4;
var _local2;
var _local9 = 3;
var _local12 = 5;
var _local10 = 6;
if (__levelNum >= _local9) {
_local3 = 1 + (__levelNum - _local9);
if (_local3 > 5) {
_local3 = 5;
}
if (__levelNum >= _local10) {
_local2 = 1 + Math.floor((__levelNum - _local10) / 2);
if (_local2 > 3) {
_local2 = 3;
}
if (__levelNum >= _local12) {
_local4 = 1;
}
}
}
var _local5 = (__levelNum - 1) * 0.2;
if (_local5 > 0.8) {
_local5 = 0.8;
}
var _local6 = __ENEMYS_DEAD_FOR_LEVELUP + __levelNum;
if (__levelNum > 10) {
var _local11 = __levelNum * 0.1;
_local6 = Math.round(_local6 * _local11);
}
if (_local6 > 60) {
_local6 = 60;
}
var _local7;
while ((_local6--) > 0) {
_local7 = Math.random() * -180;
if ((((_local3 > 0) || (_local2 > 0)) || (_local4 > 0)) && (Math.random() > 0.5)) {
if ((_local2 > 0) && (Math.random() < 0.33)) {
a_enemyTimeline.push({type:"moletroll", angle:_local7});
_local2--;
} else if ((_local4 > 0) && (Math.random() < 0.5)) {
a_enemyTimeline.push({type:"redcap", angle:_local7});
_local4--;
} else if ((_local3 > 0) && (Math.random() < 0.5)) {
a_enemyTimeline.push({type:"bullgoblin", angle:_local7});
_local3--;
} else if (Math.random() < _local5) {
a_enemyTimeline.push({type:"speargoblin", angle:_local7});
} else {
a_enemyTimeline.push({type:"goblin", angle:_local7});
}
} else if (Math.random() < _local5) {
a_enemyTimeline.push({type:"speargoblin", angle:_local7});
} else {
a_enemyTimeline.push({type:"goblin", angle:_local7});
}
}
}
function get levelNum() {
return(__levelNum);
}
function get healthPercent() {
return(__player_HP / __PLAYER_MAXHP);
}
var __FIRE_RATE = 0.44;
var __PLAYER_MAXHP = 5;
var __ENEMYS_DEAD_FOR_LEVELUP = 10;
}
Symbol 725 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) {
}
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);
}
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) {
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 726 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 727 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 728 MovieClip [__Packages.nick.spiderwick.ents.Entity] Frame 0
class nick.spiderwick.ents.Entity extends smashing.keithm.Renderable
{
var startSpin, startVelocity, owner, startGravity, doRemove, spawn, velocity, gravityVector, rotation, spin, isSpinning, __animation, kill, requestErase, isAlive, hdWidth, hdReg, nextX, hdHeight, nextY, mc, x, y, nextZ, z, __isAnimating, DRAWTYPE, specialDepth;
function Entity (t_data) {
super(t_data);
}
function init(t_data) {
if (t_data.spin != undefined) {
startSpin = t_data.spin;
} else {
startSpin = 0;
}
if (t_data.vel != undefined) {
startVelocity = t_data.vel;
} else {
startVelocity = new smashing.Point3D(0, 0, 0);
}
if (owner.gravity != undefined) {
startGravity = owner.gravity;
} else {
startGravity = new smashing.Point3D(0, 0, 0);
}
doRemove = false;
super.init(t_data);
spawn(t_data.camera);
}
function reset() {
velocity = startVelocity.copy();
gravityVector = startGravity.copy();
rotation = 0;
spin = startSpin;
if (startSpin == 0) {
isSpinning = false;
} else {
isSpinning = true;
}
super.reset();
__animation = __IDLE_ANIMATION;
}
function startDie() {
kill();
animate(__DEATH_ANIMATION);
if (__USES_VELOCITY) {
velocity.x = (velocity.y = 0);
}
}
function endDie() {
requestErase();
}
function onErase() {
super.onErase();
doRemove = true;
}
function updateDraw(camera) {
if (doRemove || (!isAlive)) {
return(undefined);
}
super.updateDraw(camera);
}
function runHD(t_target, dt) {
if (!(isAlive && (t_target.isAlive))) {
return(false);
}
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 hitReact(t_source) {
}
function onDraw(t_newmc) {
super.onDraw(t_newmc);
animateLoop(__IDLE_ANIMATION);
if (__ROTATE_TO_MOVEMENT) {
mc._rotation = calcAngle(velocity.x, velocity.y, -90);
}
}
function calcAngle(dx, dy, angleOffset) {
if (angleOffset == undefined) {
angleOffset = 0;
}
var _local3 = dx;
var _local2 = dy;
var _local1;
if (_local3 >= 0) {
if (_local2 >= 0) {
_local1 = 0;
} else {
_local1 = 360;
}
} else {
_local1 = 180;
}
_local1 = _local1 + ((Math.atan(_local2 / _local3) * 57.2957795130823) + angleOffset);
return(_local1);
}
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 render(camera, dt) {
super.render(camera, 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));
} else {
x = nextX;
y = nextY;
z = nextZ;
}
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));
} else {
x = nextX;
y = nextY;
z = nextZ;
}
render(camera, dt);
}
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 freezeAnimation() {
mc.anim.stop();
}
function unfreezeAnimation() {
if (__isAnimating) {
mc.anim.play();
} else {
animate();
}
}
function replaceVelocity(t_vector) {
velocity = t_vector.copy();
}
function inputVelocity(t_vector) {
velocity.x = velocity.x + t_vector.x;
velocity.y = velocity.y + t_vector.y;
velocity.z = velocity.z + t_vector.z;
}
function addVelocity(t_vector, dt, maxVelocity, xMult, yMult, zMult) {
if (maxVelocity == undefined) {
maxVelocity = __MAX_VELOCITY;
}
zMult = 1;
yMult = zMult;
xMult = yMult;
if ((Math.abs(velocity.x) < maxVelocity) || ((velocity.x * t_vector.x) < 0)) {
velocity.x = velocity.x + ((t_vector.x * dt) * xMult);
}
if ((Math.abs(velocity.y) < maxVelocity) || ((velocity.y * t_vector.y) < 0)) {
velocity.y = velocity.y + ((t_vector.y * dt) * yMult);
}
if ((Math.abs(velocity.z) < maxVelocity) || ((velocity.z * t_vector.z) < 0)) {
velocity.z = velocity.z + ((t_vector.z * dt) * zMult);
}
}
function magnitudeToVector(t_magnitude, t_angle) {
var _local2;
var _local1;
var _local3 = t_angle * (Math.PI/180);
_local2 = t_magnitude * Math.cos(_local3);
_local2 = Math.round(_local2 * 100) / 100;
_local1 = t_magnitude * Math.sin(_local3);
_local1 = Math.round(_local1 * 100) / 100;
return(new smashing.Point3D(_local2, _local1, 0));
}
function getDrawType() {
return(((HAS_SPECIAL_DEPTH == true) ? ((DRAWTYPE + "_") + specialDepth) : (DRAWTYPE)));
}
function getIsAnimating() {
return(__isAnimating);
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
var HAS_SPECIAL_DEPTH = false;
var __IDLE_ANIMATION = "idle";
var __DEATH_ANIMATION = "die";
var __MAX_VELOCITY = 300;
var __USES_VELOCITY = false;
var __ROTATE_TO_MOVEMENT = false;
}
Symbol 729 MovieClip [__Packages.nick.spiderwick.GameCamera] Frame 0
class nick.spiderwick.GameCamera extends smashing.keithm.BaseCamera
{
var __dimensions, x, y, __bound_top, __bound_bottom;
function GameCamera (t_data) {
super(t_data);
__dimensions = nick.spiderwick.GameState.getInstance();
x = __dimensions.sc.x;
y = __dimensions.sc.y;
}
function update(dt, player) {
var _local3 = player.nextX - x;
var _local2 = player.nextY - y;
if (_local2 > __SCROLL_TETHER_V) {
y = y + (__SCROLL_RATE * dt);
} else if (_local2 < (-__SCROLL_TETHER_V)) {
y = y - (__SCROLL_RATE * dt);
}
if (y < __bound_top) {
y = __bound_top;
} else if (y > __bound_bottom) {
y = __bound_bottom;
}
}
var __ENFORCE_BOUNDS = true;
var __SCROLL_TETHER_V = 25;
var __SCROLL_RATE = 180;
}
Symbol 730 MovieClip [__Packages.nick.spiderwick.GameState] Frame 0
class nick.spiderwick.GameState
{
static var __instance;
function GameState () {
}
static function init() {
__instance = new nick.spiderwick.GameState();
}
static function getInstance() {
return(__instance);
}
function get screenWidth() {
return(__SCREENWIDTH);
}
function get screenHeight() {
return(__SCREENHEIGHT);
}
function get sc() {
return(__sc);
}
var __SCREENWIDTH = Stage.width;
var __SCREENHEIGHT = Stage.height;
var __sc = {x:Stage.width / 2, y:Stage.height / 2};
var playerStart = {x:310, y:340};
}
Symbol 731 MovieClip [__Packages.nick.spiderwick.ents.Player] Frame 0
class nick.spiderwick.ents.Player extends nick.spiderwick.ents.Entity
{
var __canUseBook, __isFiring, __xAngleCalc, x, __yAngleCalc, y, __angle, calcAngle, __isAnimating, mc, owner, __tomatoTimer, updateAnim, render, animate, hdReg;
function Player (t_data) {
super(t_data);
}
function init(t_data) {
super.init(t_data);
__canUseBook = true;
__isFiring = false;
}
function updateMoveAndRender(camera, el) {
__xAngleCalc = x - _xmouse;
__yAngleCalc = y - _ymouse;
__angle = calcAngle(__xAngleCalc, __yAngleCalc);
if (__isAnimating) {
if (__isFiring) {
if (mc.anim._currentFrame >= __THROW_FRAME) {
owner.createProjectile(__angle);
__isFiring = false;
}
}
}
if (hasTomato) {
__tomatoTimer = __tomatoTimer - el;
if (__tomatoTimer <= 0) {
powerDown();
}
}
var _local3 = mc._rotation;
if (__angle > 270) {
__angle = 0;
} else if (__angle > 180) {
__angle = 180;
}
mc._rotation = __angle;
updateAnim();
render(camera, el);
}
function fire() {
if (__isAnimating) {
return(undefined);
}
if (hasTomato) {
animate("throwTomato");
} else {
animate("throw");
}
__isFiring = true;
}
function useBook() {
if (!__canUseBook) {
return(undefined);
}
__canUseBook = false;
}
function useBookDone() {
__canUseBook = true;
}
function get canUseBook() {
return(__canUseBook);
}
function powerUp() {
if (hasTomato) {
__tomatoTimer = __TOMATO_DURATION;
return(undefined);
}
hasTomato = true;
__tomatoTimer = __TOMATO_DURATION;
}
function powerDown() {
if (!hasTomato) {
return(undefined);
}
hasTomato = false;
__isAnimating = false;
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
var TYPE = "player";
var DRAWTYPE = "player";
var __DEF_ASSET = "jared_main";
var __DEF_WIDTH = 20;
var __DEF_HEIGHT = 20;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var __THROW_FRAME = 11;
var hasTomato = false;
var __TOMATO_DURATION = 10;
var CUSTOMDRAW = true;
}
Symbol 732 MovieClip [__Packages.nick.spiderwick.ents.Mansion] Frame 0
class nick.spiderwick.ents.Mansion extends nick.spiderwick.ents.Entity
{
var mc, hdReg;
function Mansion (t_data) {
super(t_data);
}
function init(t_data) {
t_data.x = 186;
t_data.y = 284;
super.init(t_data);
}
function damage() {
mc.gotoAndPlay("hit");
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 100;
hdReg.y = 30;
}
var __DEF_WIDTH = 130;
var __DEF_HEIGHT = 50;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var TYPE = "mansion";
var DRAWTYPE = "mansion";
var __DEF_ASSET = "mansion";
var __USES_VELOCITY = false;
}
Symbol 733 MovieClip [__Packages.nick.spiderwick.ents.MushroomRing] Frame 0
class nick.spiderwick.ents.MushroomRing extends nick.spiderwick.ents.Entity
{
static var __segmentList, __damageSegmentList, __segmentRepairTrigger, __healSegmentNotifier;
var __healSegment, __repairDone, mc, __isHealing, __isAnimating, __IDLE_ANIMATION, hdReg, isAlive;
function MushroomRing (t_data) {
super(t_data);
}
function init(t_data) {
t_data.x = 63;
t_data.y = 202;
super.init(t_data);
__segmentList = new Array();
__damageSegmentList = new Array();
__healSegment = mx.utils.Delegate.create(this, healSegment);
__repairDone = mx.utils.Delegate.create(this, repairDone);
}
function initSegmentRepairMap() {
__segmentRepairTrigger = new Array();
var _local3 = [13, 17, 22, 25, 30, 34, 38, 44, 48, 52, 59, 64, 68];
var _local2 = 0;
while (_local2 < _local3.length) {
__segmentRepairTrigger[_local3[_local2]] = mc["segment" + _local2];
_local2++;
}
}
function damage() {
mc.gotoAndPlay("hit");
}
static function registerSegment(segment) {
__segmentList.push(segment);
}
static function registerDamagedSegment(segment) {
__damageSegmentList.push(segment);
}
function get health() {
return(Math.round((100 * (__segmentList.length - __damageSegmentList.length)) / __segmentList.length));
}
function repair() {
if (__isHealing) {
return(undefined);
}
__isHealing = true;
__isAnimating = true;
__damageSegmentList = [];
if (__segmentRepairTrigger == undefined) {
initSegmentRepairMap();
}
mc.gotoAndPlay("repair");
__healSegmentNotifier = smashing.utils.PlayHeadNotifier.notifyEnterFrame(mc, __healSegment);
smashing.utils.PlayHeadNotifier.notifyEOF(mc, __repairDone);
}
function healSegment(event) {
var _local1 = event.frameNum;
if (__segmentRepairTrigger[_local1] != undefined) {
var _local2 = nick.spiderwick.ents.MushroomSegment(__segmentRepairTrigger[_local1]);
_local2.repair();
}
}
function repairDone() {
__isAnimating = false;
__isHealing = false;
__healSegmentNotifier.stop();
mc.gotoAndStop(__IDLE_ANIMATION);
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 100;
hdReg.y = 30;
}
function runHD(t_target, dt) {
if (!(isAlive && (t_target.isAlive))) {
return(false);
}
var _local3 = 0;
while (_local3 < __segmentList.length) {
var _local2 = nick.spiderwick.ents.MushroomSegment(__segmentList[_local3]);
if (_local2.canClaw() && (_local2.runHD(t_target))) {
if (!__isHealing) {
_local2.claw(dt);
}
t_target.clawTarget = _local2;
return(true);
}
_local3++;
}
if (t_target.isClawing) {
t_target.clawTarget.unclaw();
}
return(false);
}
var __DEF_WIDTH = 130;
var __DEF_HEIGHT = 50;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = false;
var TYPE = "mushroomRing";
var DRAWTYPE = "mushroomRing";
var __DEF_ASSET = "mushroomRing";
var __USES_VELOCITY = false;
}
Symbol 734 MovieClip [__Packages.smashing.utils.PlayHeadNotifier] Frame 0
class smashing.utils.PlayHeadNotifier
{
var _timeline, _targetMC, _notifyType, _notifyExtraInfo, _callback, _callbackParam, _prevFrame;
function PlayHeadNotifier (notifyParams) {
if (notifyParams != undefined) {
init(notifyParams);
}
}
static function notifyStop(mc, fn) {
return(new smashing.utils.PlayHeadNotifier({timeline:mc.createEmptyMovieClip("@playhead", mc.getNextHighestDepth()), target:mc, notifyType:STOP, callback:fn}));
}
static function notifyEnterFrame(mc, fn) {
return(new smashing.utils.PlayHeadNotifier({timeline:mc.createEmptyMovieClip("@playhead", mc.getNextHighestDepth()), target:mc, notifyType:FRAME, callback:fn, notifyExtraInfo:{notifyOnFrameNum:1}}));
}
static function notifyEOF(mc, fn) {
return(new smashing.utils.PlayHeadNotifier({timeline:mc.createEmptyMovieClip("@playhead", mc.getNextHighestDepth()), target:mc, notifyType:EOF, callback:fn, notifyExtraInfo:{notifyOnFrameNum:1}}));
}
function init(notifyParams) {
_timeline = notifyParams.timeline;
_targetMC = notifyParams.target;
_notifyType = notifyParams.notifyType || (EOF);
_notifyExtraInfo = notifyParams.notifyExtraInfo;
_callback = notifyParams.callback;
_callbackParam = notifyParams.callbackParam;
_prevFrame = 1;
if ((_notifyType != undefined) && (_callback != undefined)) {
start();
}
}
function start() {
if (_timeline == undefined) {
_global.MovieClip.addListener(this);
} else {
var _local3 = this;
_timeline.onEnterFrame = mx.utils.Delegate.create(_local3, _local3.checkFrame);
}
isRunning = true;
_prevFrame--;
}
function stop() {
_global.MovieClip.removeListener(this);
_timeline.onEnterFrame = null;
delete _timeline.onEnterFrame;
isRunning = false;
}
function restart() {
_global.MovieClip.addListener(this);
var _local3 = this;
_timeline.onEnterFrame = mx.utils.Delegate.create(_local3, _local3.checkFrame);
isRunning = true;
}
function onEnterFrame() {
checkFrame();
}
function checkFrame() {
if (_notifyType & FRAME) {
if (_notifyExtraInfo != undefined) {
if (_notifyExtraInfo.notifyOnFrameNum > 0) {
if (_targetMC._currentframe >= _notifyExtraInfo.notifyOnFrameNum) {
_callback({type:FRAME, target:_targetMC, frameNum:_targetMC._currentframe});
}
}
}
}
if (_notifyType & STOP) {
if (_targetMC._currentframe == _prevFrame) {
stop();
_callback({type:STOP, target:_targetMC});
}
_prevFrame = _targetMC._currentframe;
}
if (_notifyType & LOOP) {
if (_targetMC._currentframe < _prevFrame) {
stop();
_callback({type:LOOP, target:_targetMC});
}
_prevFrame = _targetMC._currentframe;
}
if (_notifyType & EOF) {
if (_targetMC._currentframe >= _targetMC._totalframes) {
stop();
if (_callbackParam != undefined) {
var _local2 = _callbackParam;
if (_local2.type == undefined) {
_local2.type = EOF;
}
if (_local2.target == undefined) {
_local2.target = _targetMC;
}
_callback(_local2);
} else {
_callback({type:EOF, target:_targetMC});
}
}
}
}
var isRunning = false;
static var EOF = 1;
static var FRAME = 2;
static var STOP = 4;
static var LOOP = 8;
}
Symbol 735 MovieClip [__Packages.nick.spiderwick.ents.Clawable] Frame 0
interface nick.spiderwick.ents.Clawable
{
}
Symbol 736 MovieClip [__Packages.nick.spiderwick.ents.MushroomSegment] Frame 0
class nick.spiderwick.ents.MushroomSegment extends MovieClip implements nick.spiderwick.ents.Clawable
{
var _clawTimer, gotoAndStop, gotoAndPlay, hitArea;
function MushroomSegment (t_data) {
super();
_clawTimer = 0;
}
function onLoad(t_data) {
nick.spiderwick.ents.MushroomRing.registerSegment(this);
}
function claw(dt) {
if (_canClaw) {
_clawCount++;
_clawTimer = _clawTimer + dt;
if (_clawTimer < _health) {
gotoAndStop("digging");
} else {
_canClaw = false;
gotoAndStop("disappear");
nick.spiderwick.ents.MushroomRing.registerDamagedSegment(this);
}
}
}
function repair() {
gotoAndPlay("repair");
smashing.utils.PlayHeadNotifier.notifyStop(this, mx.utils.Delegate.create(this, repairDone));
_clawTimer = 0;
_canClaw = true;
}
function repairDone() {
gotoAndStop("idle");
}
function canClaw() {
return(_canClaw);
}
function unclaw() {
if (_canClaw) {
_clawCount--;
if (_clawCount < 0) {
_clawCount = 0;
}
gotoAndStop("idle");
}
}
function runHD(t_target, dt) {
return(hitArea.hitTest(t_target.mc.hitArea));
}
var _canClaw = true;
var _health = 2;
var _clawCount = 0;
}
Symbol 737 MovieClip [__Packages.nick.spiderwick.ents.Projectile] Frame 0
class nick.spiderwick.ents.Projectile extends nick.spiderwick.ents.Entity
{
var __damageType, startVelocity, velocity, __spin, mc, startX, x, startY, y, __hitAngle, __FORCE_INITAL_DRAW, isAlive, kill, requestErase, calcAngle, hdReg;
function Projectile (t_data) {
super(t_data);
}
function init(t_data) {
super.init(t_data);
__damageType = t_data.damageType;
if (isBlastDamage) {
__USE_DIMENSIONS_AS_HD = true;
}
startVelocity = (velocity = new smashing.Point3D(t_data.fireVector.x * __FLY_SPEED, t_data.fireVector.y * __FLY_SPEED, 0));
__spin = Math.random() * 180;
}
function updateMoveAndRender(camera, el) {
if (isBlastDamage && (isBlasting)) {
return(undefined);
}
super.updateMoveAndRender(camera, el);
__spin = __spin + (__SPIN_RATE * el);
mc._rotation = __spin;
if (isBlastDamage) {
var _local4 = x - startX;
var _local3 = y - startY;
var _local5 = Math.sqrt((_local4 * _local4) + (_local3 * _local3));
if (_local5 >= 175) {
__hitAngle = Math.atan(_local3 / _local4) * 57.2957795130823;
hitReact();
}
}
}
function spawn() {
if (isBlastDamage) {
__FORCE_INITAL_DRAW = true;
}
super.spawn();
mc.object.gotoAndStop(__damageType);
}
function hitReact() {
if (!isAlive) {
return(undefined);
}
if (isBlasting) {
return(undefined);
}
velocity = new smashing.Point3D(0, 0, 0);
mc.gotoAndStop("hit");
mc.object.gotoAndStop(__damageType);
if (isHitDamage) {
kill();
requestErase();
} else {
isBlasting = true;
mc.object.splat.gotoAndPlay("reveal");
mc._x = x;
mc._y = y;
mc._rotation = calcAngle(x - startX, y - startY, 90);
smashing.utils.PlayHeadNotifier.notifyStop(mc.object.splat, mx.utils.Delegate.create(this, blastDamageDone));
}
}
function blastDamageDone() {
mc.object.splat.gotoAndStop("off");
kill();
isBlasting = false;
requestErase();
}
function get canHitPickup() {
return(true);
}
function runHD_entity_radius(t_target, dt) {
if (isBlastDamage) {
if (t_target.TYPE == "pickup") {
return(mc.object.splat.hitTest(t_target.mc));
}
return(mc.object.splat.hitTest(t_target.mc.hitArea));
}
return(super.runHD_entity_radius(t_target, dt));
}
function get isHitDamage() {
return(__damageType == HIT_DAMAGE);
}
function get isBlastDamage() {
return(__damageType == BLAST_DAMAGE);
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
var TYPE = "projectile";
var DRAWTYPE = "projectile";
var __DEF_ASSET = "proj_player";
var __DEF_WIDTH = 8;
var __DEF_HEIGHT = 8;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var __FLY_SPEED = 440;
var __MAX_VELOCITY = 800;
var __USES_VELOCITY = true;
var __SPIN_RATE = 80;
var isBlasting = false;
var BLAST_RADIUS = 50;
static var BLAST_DAMAGE = "blast";
static var HIT_DAMAGE = "hit";
}
Symbol 738 MovieClip [__Packages.nick.spiderwick.ents.BookBomb] Frame 0
class nick.spiderwick.ents.BookBomb extends nick.spiderwick.ents.Entity
{
var _blastTime, mc, radius, __FORCE_INITAL_DRAW, kill, requestErase, owner, hdReg;
function BookBomb (t_data) {
super(t_data);
}
function init(t_data) {
t_data.x = 260;
t_data.y = 400;
super.init(t_data);
}
function updateMoveAndRender(camera, el) {
super.updateMoveAndRender(camera, el);
_blastTime = _blastTime + el;
var _local3 = Math.round(mc.explosion._totalframes * (_blastTime / _totalBlastTime));
mc.explosion.gotoAndStop(_local3);
if (_local3 < 20) {
radius = 0;
} else {
radius = Math.round((450 * (_local3 - 20)) / (mc.explosion._totalframes - 20));
}
}
function get canHitPickup() {
return(false);
}
function spawn() {
__FORCE_INITAL_DRAW = true;
isBlasting = true;
_blastTime = 0;
radius = 0;
super.spawn();
mc.gotoAndStop("explode");
smashing.utils.PlayHeadNotifier.notifyEOF(mc.explosion, mx.utils.Delegate.create(this, blastDamageDone));
}
function hitReact() {
}
function blastDamageDone() {
kill();
isBlasting = false;
requestErase();
owner.useBookDone();
}
function runHD_entity_radius(t_target, dt) {
return(super.runHD_entity_radius(t_target, dt));
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = 0;
}
var TYPE = "projectile";
var DRAWTYPE = "projectile";
var __DEF_ASSET = "bookBomb";
var __DEF_WIDTH = 20;
var __DEF_HEIGHT = 20;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var __USES_VELOCITY = false;
var isBlasting = false;
var _totalBlastTime = 1.33333333333333;
}
Symbol 739 MovieClip [__Packages.nick.spiderwick.ents.Enemy] Frame 0
class nick.spiderwick.ents.Enemy extends nick.spiderwick.ents.Entity
{
var __startPoint, startX, x, nextX, startY, y, nextY, __moveAngle, calcAngle, velocity, __health, magnitudeToVector, isDrawn, owner, endDie, animate, __clawTarget, __IDLE_ANIMATION, mc, hdReg;
function Enemy (t_data) {
super(t_data);
}
function init(t_data) {
super.init(t_data);
var _local3 = nick.spiderwick.GameState.getInstance();
__startPoint = new smashing.Point3D(_local3.__get__sc().x, _local3.__get__sc().y, 0);
setSpawnPoint(t_data);
startX = (x = (nextX = __startPoint.x));
startY = (y = (nextY = __startPoint.y));
var _local5 = __startPoint.x - _local3.playerStart.x;
var _local4 = __startPoint.y - _local3.playerStart.y;
__moveAngle = calcAngle(_local5, _local4, 180);
velocity = getMoveVelocity();
__health = __START_HEALTH;
}
function setSpawnPoint(t_data) {
var _local3 = 310;
if (((t_data.angle > 50) && (t_data.angle < 130)) || ((t_data.angle > 230) && (t_data.angle < 310))) {
_local3 = 260;
}
var _local4 = magnitudeToVector(_local3, t_data.angle);
__startPoint.addPointMe(_local4);
}
function hitReact(t_target) {
if (!isDrawn) {
return(undefined);
}
if (t_target.TYPE == "player") {
startDie();
} else if (t_target.TYPE == "projectile") {
__health--;
takeDamage();
if (__health <= 0) {
owner.addScore(__SCORE_VALUE);
startDie();
}
} else if (t_target.TYPE == "mansion") {
endDie();
} else if (t_target.TYPE == "mushroomRing") {
startClaw();
}
}
function startDie() {
disableClawing();
super.startDie();
}
function startClaw() {
__isClawing = true;
animate(__CLAW_ANIMATION);
stopMove();
}
function disableClawing() {
if (isClawing) {
endClaw();
}
}
function get isClawing() {
return(__isClawing);
}
function get clawTarget() {
return(__clawTarget);
}
function set clawTarget(target) {
__clawTarget = target;
//return(clawTarget);
}
function endClaw() {
clawTarget.unclaw();
clawTarget = (null);
animate(__IDLE_ANIMATION);
resumeMove();
__isClawing = false;
}
function pauseAnimations() {
mc.anim.stop();
}
function unpauseAnimations() {
mc.anim.play();
}
function getMoveVelocity() {
return(magnitudeToVector(__MOVE_RATE, __moveAngle));
}
function resumeMove() {
velocity = getMoveVelocity();
}
function stopMove() {
if (__USES_VELOCITY) {
velocity.x = (velocity.y = 0);
}
}
function takeDamage() {
}
function setHDRegistration() {
hdReg = {};
hdReg.x = 0;
hdReg.y = -17;
}
var CHARACTER = "goblin";
var TYPE = "enemy";
var DRAWTYPE = "enemy";
var __DEF_ASSET = "";
var CUSTOMDRAW = true;
var __DEF_WIDTH = 40;
var __DEF_HEIGHT = 30;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var __USES_VELOCITY = true;
var __ROTATE_TO_MOVEMENT = true;
var __MOVE_RATE = 100;
var __START_HEALTH = 1;
var __SCORE_VALUE = 100;
var __CLAW_ANIMATION = "claw";
var __isClawing = false;
}
Symbol 740 MovieClip [__Packages.nick.spiderwick.ents.Goblin] Frame 0
class nick.spiderwick.ents.Goblin extends nick.spiderwick.ents.Enemy
{
function Goblin (t_data) {
super(t_data);
}
var __DEF_ASSET = "goblin_main";
var __MOVE_RATE = 45;
var __START_HEALTH = 1;
}
Symbol 741 MovieClip [__Packages.nick.spiderwick.ents.SpearGoblin] Frame 0
class nick.spiderwick.ents.SpearGoblin extends nick.spiderwick.ents.Enemy
{
function SpearGoblin (t_data) {
super(t_data);
}
var __DEF_ASSET = "speargoblin_main";
var __MOVE_RATE = 70;
var __START_HEALTH = 1;
}
Symbol 742 MovieClip [__Packages.nick.spiderwick.ents.BullGoblin] Frame 0
class nick.spiderwick.ents.BullGoblin extends nick.spiderwick.ents.Enemy
{
function BullGoblin (t_data) {
super(t_data);
}
var CHARACTER = "bullgoblin";
var __DEF_ASSET = "bullgoblin_main";
var __MOVE_RATE = 105;
var __START_HEALTH = 1;
var __SCORE_VALUE = 200;
}
Symbol 743 MovieClip [__Packages.nick.spiderwick.ents.Redcap] Frame 0
class nick.spiderwick.ents.Redcap extends nick.spiderwick.ents.Enemy
{
var mc;
function Redcap (t_data) {
super(t_data);
}
function takeDamage() {
mc.gotoAndStop("hit");
}
var CHARACTER = "redcap";
var __DEF_ASSET = "Redcap_main";
var __MOVE_RATE = 80;
var __START_HEALTH = 2;
var __SCORE_VALUE = 500;
}
Symbol 744 MovieClip [__Packages.nick.spiderwick.ents.MoleTroll] Frame 0
class nick.spiderwick.ents.MoleTroll extends nick.spiderwick.ents.Enemy
{
var __hasSurfaced, __surfacingInProgress, animate, magnitudeToVector, __startPoint, __isAnimating, calcAngle, velocity, mc, __IDLE_ANIMATION;
function MoleTroll (t_data) {
super(t_data);
__hasSurfaced = false;
__surfacingInProgress = false;
}
function takeDamage() {
animate("hit");
}
function hitReact(t_target) {
if (__surfacingInProgress) {
enterDone();
}
super.hitReact(t_target);
}
function setSpawnPoint(t_data) {
var _local4 = nick.spiderwick.GameState.getInstance();
var _local3 = 160;
var _local2 = magnitudeToVector(_local3, t_data.angle);
__startPoint.addPointMe(_local2);
if (__startPoint.y < 100) {
__startPoint.y = 100 + Math.floor(Math.random() * 30);
} else if (__startPoint.y > 130) {
__startPoint.y = 130 - Math.floor(Math.random() * 30);
}
}
function updateMoveAndRender(camera, dt) {
if (!__hasSurfaced) {
__isAnimating = false;
__hasSurfaced = true;
__surfacingInProgress = true;
mc._rotation = calcAngle(velocity.x, velocity.y, -90);
animate("enter");
super.updateMoveAndRender(camera, dt);
smashing.utils.PlayHeadNotifier.notifyEOF(mc.anim, mx.utils.Delegate.create(this, enterDone));
} else if (!__surfacingInProgress) {
super.updateMoveAndRender(camera, dt);
}
}
function enterDone() {
animate(__IDLE_ANIMATION);
__hasSurfaced = true;
__surfacingInProgress = false;
}
var CHARACTER = "moletroll";
var __DEF_ASSET = "moletroll_main";
var __MOVE_RATE = 25;
var __START_HEALTH = 4;
var __SCORE_VALUE = 300;
var __DEF_WIDTH = 55;
var __DEF_HEIGHT = 30;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var __FORCE_INITAL_DRAW = true;
}
Symbol 745 MovieClip [__Packages.nick.spiderwick.ents.Pickup] Frame 0
class nick.spiderwick.ents.Pickup extends nick.spiderwick.ents.Entity
{
var startDie, animate;
function Pickup (t_data) {
super(t_data);
}
function hitReact(t_target) {
if (t_target == undefined) {
__DEATH_ANIMATION = "fadeout";
}
startDie();
}
function startDisappear() {
animate("fadeout");
}
var TYPE = "pickup";
var DRAWTYPE = "pickup";
var PICKUP_EFFECT = "none";
var __DEF_ASSET = "pickup";
var __USES_VELOCITY = false;
var __DEF_WIDTH = 30;
var __DEF_HEIGHT = 40;
var __USE_ACTUAL_DIMENSIONS = false;
var __USE_DIMENSIONS_AS_HD = true;
var __IDLE_ANIMATION = "popin";
var __DEATH_ANIMATION = "pickup";
var CUSTOMDRAW = true;
}
Symbol 746 MovieClip [__Packages.nick.spiderwick.ents.PickupMushroom] Frame 0
class nick.spiderwick.ents.PickupMushroom extends nick.spiderwick.ents.Pickup
{
function PickupMushroom (t_data) {
super(t_data);
}
var __DEF_ASSET = "pickup_mushroom";
var PICKUP_EFFECT = "health";
}
Symbol 747 MovieClip [__Packages.nick.spiderwick.ents.PickupTomato] Frame 0
class nick.spiderwick.ents.PickupTomato extends nick.spiderwick.ents.Pickup
{
function PickupTomato (t_data) {
super(t_data);
}
var __DEF_ASSET = "pickup_tomato";
var PICKUP_EFFECT = "powerup";
}
Symbol 748 MovieClip [__Packages.nick.spiderwick.ents.PickupGoldenAcorn] Frame 0
class nick.spiderwick.ents.PickupGoldenAcorn extends nick.spiderwick.ents.Pickup
{
function PickupGoldenAcorn (t_data) {
super(t_data);
}
function endDie() {
super.endDie();
}
var __DEF_ASSET = "pickup_goldenacorn";
var PICKUP_EFFECT = "score";
}
Symbol 749 MovieClip [__Packages.nick.highscores.HighscoreEngine] Frame 0
class nick.highscores.HighscoreEngine
{
static var __userName, __loadState, __xml, __userPath, __scorePath, __game_id, __showMovieRelease, __user_vars, __userScore, __highscoreMC, __scores, __functionToRunAfterLoad, __stateVerificationInterval, __score_vars;
function HighscoreEngine () {
}
static function init() {
__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("/"));
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;
__showMovieRelease = __xml.firstChild.childNodes[3].firstChild.nodeValue;
log("Xml loaded : ");
log("User : " + __userPath);
log("score: " + __scorePath);
log("gameID: " + __game_id);
log("show movie release: " + __showMovieRelease);
} 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;
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;
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 get showMovieRelease() {
return(__showMovieRelease);
}
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();
}
static var __USE_XML = true;
static var __XML_FILE_URL = "config.xml";
static var __SCORE_CALL = "onHighscores";
}
Symbol 49 MovieClip Frame 1
stop();
Symbol 49 MovieClip Frame 6
play();
Symbol 49 MovieClip Frame 50
stop();
Symbol 49 MovieClip Frame 51
stop();
Symbol 57 MovieClip Frame 1
stop();
Symbol 57 MovieClip Frame 6
play();
Symbol 57 MovieClip Frame 50
stop();
Symbol 57 MovieClip Frame 51
stop();
Symbol 63 MovieClip Frame 1
stop();
Symbol 63 MovieClip Frame 6
play();
Symbol 63 MovieClip Frame 50
stop();
Symbol 63 MovieClip Frame 51
stop();
Symbol 64 MovieClip Frame 1
stop();
Instance of Symbol 49 MovieClip in Symbol 64 MovieClip Frame 1
on (press) {
_parent._parent.clickPlay();
}
Instance of Symbol 57 MovieClip in Symbol 64 MovieClip Frame 1
on (press) {
_parent._parent.clickViewScore("title");
}
Instance of Symbol 63 MovieClip in Symbol 64 MovieClip Frame 1
on (press) {
_parent._parent.clickHelp();
}
Symbol 76 MovieClip [mansion] Frame 1
stop();
Symbol 76 MovieClip [mansion] Frame 9
play();
Symbol 77 MovieClip Frame 1
this._visible = false;
this._parent.hitArea = this;
Symbol 86 MovieClip [mushroomSegment] Frame 1
#initclip 36
Object.registerClass("mushroomSegment", nick.spiderwick.ents.MushroomSegment);
#endinitclip
stop();
Symbol 86 MovieClip [mushroomSegment] Frame 10
stop();
Symbol 86 MovieClip [mushroomSegment] Frame 22
play();
Symbol 86 MovieClip [mushroomSegment] Frame 26
stop();
Symbol 86 MovieClip [mushroomSegment] Frame 35
stop();
Symbol 86 MovieClip [mushroomSegment] Frame 48
stop();
Symbol 105 MovieClip Frame 23
stop();
Symbol 106 MovieClip [mushroomRing] Frame 1
stop();
Symbol 106 MovieClip [mushroomRing] Frame 9
img.setMask(imgMask);
img.cacheAsBitmap = true;
imgMask.cacheAsBitmap = true;
imgMask.blendMode = "alpha";
play();
Symbol 126 MovieClip Frame 1
stop();
Symbol 139 MovieClip Frame 1
stop();
Symbol 139 MovieClip Frame 8
play();
Symbol 139 MovieClip Frame 19
this.gotoAndStop("regular");
Symbol 146 MovieClip Frame 1
stop();
Symbol 146 MovieClip Frame 5
play();
Symbol 146 MovieClip Frame 55
stop();
Symbol 154 MovieClip Frame 1
stop();
Symbol 226 MovieClip Frame 1
stop();
Symbol 227 MovieClip Frame 10
stop();
Symbol 228 MovieClip Frame 1
stop();
Symbol 252 MovieClip Frame 10
stop();
Symbol 253 MovieClip Frame 1
stop();
Symbol 260 MovieClip Frame 10
stop();
Symbol 261 MovieClip Frame 1
stop();
Symbol 275 MovieClip Frame 1
stop();
Symbol 298 MovieClip Frame 1
stop();
Symbol 298 MovieClip Frame 6
play();
Symbol 298 MovieClip Frame 13
stop();
Symbol 298 MovieClip Frame 14
stop();
Instance of Symbol 298 MovieClip in Symbol 302 MovieClip Frame 1
on (release) {
_parent._parent._parent._parent._parent.closeEasterEggHint();
}
Symbol 304 MovieClip Frame 13
stop();
Symbol 304 MovieClip Frame 14
play();
Symbol 304 MovieClip Frame 26
stop();
Symbol 305 MovieClip Frame 1
stop();
Symbol 305 MovieClip Frame 2
play();
Symbol 305 MovieClip Frame 22
stop();
Symbol 305 MovieClip Frame 23
play();
Symbol 305 MovieClip Frame 38
stop();
Symbol 312 MovieClip Frame 1
stop();
Symbol 312 MovieClip Frame 2
play();
Symbol 312 MovieClip Frame 31
stop();
Symbol 312 MovieClip Frame 32
play();
Symbol 312 MovieClip Frame 40
stop();
Symbol 313 MovieClip Frame 2
stop();
Symbol 313 MovieClip Frame 5
btn.useHandCursor = false;
Instance of Symbol 154 MovieClip in Symbol 313 MovieClip Frame 7
on (release) {
_parent.gotoAndPlay("outro");
}
Instance of Symbol 228 MovieClip in Symbol 313 MovieClip Frame 27
on (rollOver) {
}
Instance of Symbol 253 MovieClip in Symbol 313 MovieClip Frame 29
on (rollOver) {
}
Instance of Symbol 261 MovieClip in Symbol 313 MovieClip Frame 31
on (rollOver) {
}
Symbol 313 MovieClip Frame 45
stop();
Symbol 313 MovieClip Frame 46
_parent.onHelpClose();
Symbol 321 MovieClip Frame 2
stop();
Symbol 321 MovieClip Frame 28
if (middlePath != undefined) {
middlePath[middleFunc]();
}
Symbol 321 MovieClip Frame 46
if (endPath != undefined) {
endPath[endFunc]();
}
Symbol 333 MovieClip Frame 2
stop();
Symbol 333 MovieClip Frame 5
txt.art.txt_level.text = levelNum;
play();
Symbol 333 MovieClip Frame 44
_parent.completeLevelTransition();
Symbol 338 MovieClip Frame 1
stop();
Symbol 348 MovieClip Frame 1
stop();
Symbol 349 MovieClip Frame 1
stop();
Symbol 352 MovieClip Frame 1
stop();
Symbol 353 MovieClip Frame 1
stop();
Symbol 356 MovieClip Frame 1
stop();
Symbol 357 MovieClip Frame 1
stop();
Symbol 360 MovieClip Frame 1
stop();
Symbol 363 MovieClip Frame 1
stop();
Instance of Symbol 349 MovieClip in Symbol 364 MovieClip Frame 1
on (release) {
_parent._parent.action = "resume";
_parent._parent.gotoAndPlay("outro");
}
Instance of Symbol 353 MovieClip in Symbol 364 MovieClip Frame 1
on (release) {
_parent._parent.action = "help";
_parent._parent.gotoAndPlay("outro");
}
Instance of Symbol 357 MovieClip in Symbol 364 MovieClip Frame 1
on (release) {
_parent._parent.action = "quitcheck";
_parent._parent.gotoAndPlay("outro");
}
Instance of Symbol 360 MovieClip "music_on_btn" in Symbol 364 MovieClip Frame 1
on (release) {
_parent._parent._parent.toggleMute();
}
Instance of Symbol 363 MovieClip "music_off_btn" in Symbol 364 MovieClip Frame 1
on (release) {
_parent._parent._parent.toggleMute();
}
Symbol 366 MovieClip Frame 2
stop();
Symbol 366 MovieClip Frame 5
btn.useHandCursor = false;
this.popup_mc.music_off_btn._visible = !_parent.getIsMute();
this.popup_mc.music_on_btn._visible = _parent.getIsMute();
Symbol 366 MovieClip Frame 12
stop();
Symbol 366 MovieClip Frame 22
_parent.onMenuClose(action);
Symbol 372 MovieClip Frame 1
stop();
Symbol 373 MovieClip Frame 1
stop();
Symbol 376 MovieClip Frame 1
stop();
Instance of Symbol 373 MovieClip in Symbol 377 MovieClip Frame 1
on (release) {
_parent._parent.action = "quit";
_parent._parent.gotoAndPlay("outro");
}
Instance of Symbol 376 MovieClip in Symbol 377 MovieClip Frame 1
on (release) {
_parent._parent.action = "menureturn";
_parent._parent.gotoAndPlay("outro");
}
Symbol 378 MovieClip Frame 2
stop();
Symbol 378 MovieClip Frame 5
btn.useHandCursor = false;
Symbol 378 MovieClip Frame 12
stop();
if (_parent.getIsMute()) {
this.popup_mc.mute_btn.gotoAndStop("off");
}
Symbol 378 MovieClip Frame 22
_parent.onMenuClose(action);
Symbol 394 MovieClip Frame 163
_parent._parent.exitDamageWarning();
stop();
Symbol 398 MovieClip Frame 1
stop();
Symbol 398 MovieClip Frame 5
play();
Symbol 398 MovieClip Frame 24
stop();
Symbol 398 MovieClip Frame 30
play();
Symbol 398 MovieClip Frame 36
this.gotoAndStop("off");
Symbol 398 MovieClip Frame 37
play();
Symbol 398 MovieClip Frame 55
stop();
Symbol 398 MovieClip Frame 61
play();
Symbol 398 MovieClip Frame 67
this.gotoAndStop("off");
Symbol 407 MovieClip Frame 1
stop();
Symbol 438 MovieClip Frame 1
stop();
Symbol 438 MovieClip Frame 5
play();
Instance of Symbol 407 MovieClip in Symbol 438 MovieClip Frame 19
on (release) {
this.enabled = false;
_parent.stop();
_parent._parent.clickSkipIntro();
}
Symbol 438 MovieClip Frame 301
stop();
Symbol 444 MovieClip Frame 1
stop();
Symbol 444 MovieClip Frame 2
play();
Symbol 444 MovieClip Frame 38
play();
Symbol 444 MovieClip Frame 45
_parent.easterEggUpper.gotoAndPlay("showout");
Symbol 444 MovieClip Frame 50
stop();
Symbol 446 MovieClip Frame 1
stop();
Symbol 446 MovieClip Frame 100
stop();
Symbol 449 MovieClip Frame 1
stop();
Instance of Symbol 449 MovieClip "menu_btn" in Symbol 450 MovieClip Frame 1
on (press) {
_parent._parent.clickMenu();
}
Symbol 459 MovieClip Frame 1
stop();
Symbol 459 MovieClip Frame 6
play();
Symbol 459 MovieClip Frame 50
stop();
Symbol 459 MovieClip Frame 51
stop();
Symbol 469 MovieClip Frame 1
stop();
Symbol 483 MovieClip Frame 1
Symbol 496 MovieClip Frame 1
stop();
Symbol 496 MovieClip Frame 6
play();
Symbol 496 MovieClip Frame 50
stop();
Symbol 496 MovieClip Frame 51
stop();
Symbol 498 MovieClip Frame 1
stop();
Symbol 498 MovieClip Frame 6
play();
Symbol 498 MovieClip Frame 50
stop();
Symbol 498 MovieClip Frame 51
stop();
Symbol 504 MovieClip Frame 1
stop();
Symbol 504 MovieClip Frame 2
stop();
Symbol 504 MovieClip Frame 3
stop();
Symbol 505 MovieClip Frame 1
var frameLabel = _parent._parent._parent.showMovieRelease();
if ((frameLabel == undefined) || (frameLabel == "")) {
frameLabel = "hideDate";
}
releaseInfo.gotoAndStop(frameLabel);
Symbol 506 MovieClip Frame 1
var frameLabel = _parent._parent.showMovieRelease();
if (frameLabel == "hide") {
stop();
}
Symbol 506 MovieClip Frame 68
stop();
Symbol 507 MovieClip Frame 1
this.play();
Instance of Symbol 459 MovieClip "btn_submit" in Symbol 507 MovieClip Frame 1
on (release) {
_parent._parent.clickSubmitScore();
}
Instance of Symbol 496 MovieClip in Symbol 507 MovieClip Frame 21
on (release) {
_parent._parent.clickPlayAgain();
}
Instance of Symbol 498 MovieClip in Symbol 507 MovieClip Frame 23
on (release) {
_parent._parent.clickViewScore("gameover");
}
Symbol 507 MovieClip Frame 26
stop();
Symbol 533 MovieClip Frame 1
stop();
Symbol 533 MovieClip Frame 5
stop();
Symbol 533 MovieClip Frame 10
stop();
Symbol 536 MovieClip Frame 1
stop();
Symbol 536 MovieClip Frame 5
stop();
Symbol 536 MovieClip Frame 10
stop();
Symbol 540 MovieClip [_nick_highscore_board] Frame 1
#initclip 34
Object.registerClass("_nick_highscore_board", nick.highscores.HighscoreTable);
#endinitclip
btn.useHandCursor = false;
Instance of Symbol 459 MovieClip "btn_submit" in Symbol 540 MovieClip [_nick_highscore_board] Frame 1
on (release) {
_parent._parent.clickSubmitScore();
}
Symbol 540 MovieClip [_nick_highscore_board] Frame 7
stop();
Instance of Symbol 298 MovieClip "quit_btn" in Symbol 540 MovieClip [_nick_highscore_board] Frame 7
on (release) {
_parent._parent.closeHighScoreView();
}
Symbol 540 MovieClip [_nick_highscore_board] Frame 11
stop();
Symbol 540 MovieClip [_nick_highscore_board] Frame 16
play();
Instance of Symbol 533 MovieClip "btn_next" in Symbol 540 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 536 MovieClip "btn_back" in Symbol 540 MovieClip [_nick_highscore_board] Frame 16
on (release) {
_parent.prevPage();
}
on (rollOver) {
gotoAndStop ("over");
}
on (rollOut, dragOut) {
gotoAndStop ("off");
}
on (press) {
gotoAndStop ("down");
}
Instance of Symbol 49 MovieClip "play_btn" in Symbol 540 MovieClip [_nick_highscore_board] Frame 16
on (release) {
_parent.gotoAndPlay("exit");
}
Symbol 540 MovieClip [_nick_highscore_board] Frame 21
stop();
Symbol 540 MovieClip [_nick_highscore_board] Frame 22
play();
Symbol 540 MovieClip [_nick_highscore_board] Frame 27
_parent.clickPlayAgain();
stop();
Symbol 581 MovieClip Frame 16
stop();
Symbol 618 MovieClip Frame 16
stop();
Symbol 621 MovieClip Frame 10
_parent.gotoAndStop("idle");
Symbol 624 MovieClip Frame 10
stop();
Symbol 646 MovieClip Frame 1
play();
Symbol 646 MovieClip Frame 30
stop();
Symbol 651 MovieClip Frame 8
_parent.gotoAndStop("idle");
Symbol 659 MovieClip Frame 7
stop();
Symbol 664 MovieClip Frame 9
stop();
Symbol 670 MovieClip Frame 1
stop();
var numSound = 3;
var index = (1 + Math.floor(Math.random() * numSound));
this.gotoAndPlay("hit" + index);
Symbol 670 MovieClip Frame 2
Symbol 670 MovieClip Frame 11
stop();
Symbol 670 MovieClip Frame 22
stop();
Symbol 670 MovieClip Frame 31
stop();
Symbol 673 MovieClip Frame 9
stop();
Symbol 677 MovieClip Frame 11
stop();
Symbol 678 MovieClip Frame 24
stop();
Symbol 682 MovieClip Frame 14
stop();
Symbol 683 MovieClip Frame 7
stop();
Symbol 686 MovieClip Frame 7
stop();
Symbol 689 MovieClip Frame 7
stop();
Symbol 692 MovieClip Frame 9
stop();
Symbol 694 MovieClip Frame 9
stop();
Symbol 695 MovieClip Frame 6
stop();
Symbol 709 MovieClip Frame 1
stop();
Symbol 709 MovieClip Frame 2
play();
Symbol 709 MovieClip Frame 19
stop();
Symbol 714 MovieClip Frame 39
stop();
Symbol 715 MovieClip [bookBomb] Frame 1
stop();
Symbol 715 MovieClip [bookBomb] Frame 2
stop();
Symbol 716 MovieClip [Project] Frame 1
#initclip 35
Object.registerClass("Project", nick.spiderwick.Engine);
#endinitclip
stop();