Frame 1
function PositionPartnerLogo(logo) {
trace((("Updating partner logo to x:" + _global.partnerLogoX) + " y: ") + _global.partnerLogoY);
trace((("Floats: x: " + parseFloat(_global.partnerLogoX)) + " y: ") + parseFloat(_global.partnerLogoY));
logo._x = parseFloat(_global.partnerLogoX);
logo._y = parseFloat(_global.partnerLogoY);
trace(logo);
trace((("Partner Logo: " + logo._x) + ":") + logo._y);
}
function onConfigFinished() {
trace("Config loaded");
trace((_global.inPachinko ? "In " : "Not In ") + " Pachinko");
trace("Download URL is: " + _global.DownloadURL);
_root.isConfigLoaded = true;
gotoAndStop ("Splash");
}
stop();
MyConfigXML = "config.xml";
_global.partnerLogoX = 0;
_global.partnerLogoY = 0;
_global.inPachinko = false;
_global.DownloadURL = "http://www.sandlot.com";
_root.isConfigLoaded = false;
function LoadSound(soundDesc) {
var _local2 = new Sound();
_local2.attachSound(soundDesc.file);
_local2.setVolume(soundDesc.vol);
_local2.isPlaying = false;
_local2.soundName = soundDesc.file;
_local2.onSoundComplete = function () {
this.isPlaying = false;
};
return(_local2);
}
function LoadSounds() {
var _local1 = 0;
while (_local1 < SoundFileList.length) {
SoundList[SoundFileList[_local1].file] = LoadSound(SoundFileList[_local1]);
_local1++;
}
}
function SetMute(isMuted) {
_global.IsMuted = isMuted;
var _local2 = 0;
while (_local2 < SoundFileList.length) {
SoundList[SoundFileList[_local2].file].setVolume(((isMuted == true) ? 0 : (SoundFileList[_local2].vol)));
_local2++;
}
}
function PlayOneOf(soundChoice) {
var _local3 = 0;
var _local4 = Math.random() * 100;
var _local1 = 0;
while (_local1 < soundChoice.length) {
_local3 = _local3 + soundChoice[_local1].p;
if (_local4 <= _local3) {
PlaySound(soundChoice[_local1].f, false);
break;
}
_local1++;
}
}
function ToggleSound(name) {
if (SoundList[name].isPlaying == true) {
_root.StopSound(name);
} else {
_root.PlaySound(name, true);
}
}
function PlaySound(name, loop) {
_root.SoundList[name].isPlaying = true;
if ((loop != null) && (loop != undefined)) {
if (loop == true) {
_root.SoundList[name].start(0, 1000);
} else {
_root.SoundList[name].start();
}
} else {
_root.SoundList[name].start();
}
}
function StopSound(name) {
SoundList[name].isPlaying = false;
SoundList[name].stop(name);
}
function PlaySoundIfNotPlaying(name, loop) {
if (_root.SoundList[name].isPlaying == false) {
_root.PlaySound(name, loop);
}
}
var SoundFileList = new Array({file:"airblast.mp3", vol:100}, {file:"bonushearts.mp3", vol:100}, {file:"cannotdig.mp3", vol:100}, {file:"catdoor.mp3", vol:100}, {file:"catidle1.mp3", vol:100}, {file:"collect1.mp3", vol:100}, {file:"collect3.mp3", vol:100}, {file:"death1.mp3", vol:100}, {file:"death2.mp3", vol:100}, {file:"dig.mp3", vol:100}, {file:"finishlevel.mp3", vol:100}, {file:"finishlevel1.mp3", vol:100}, {file:"finishlevel2.mp3", vol:100}, {file:"flower1.mp3", vol:100}, {file:"flower2.mp3", vol:100}, {file:"floweralert.mp3", vol:100}, {file:"land.mp3", vol:100}, {file:"nodig.mp3", vol:100}, {file:"tikimanhit1.mp3", vol:100}, {file:"tikimanidle1.mp3", vol:100}, {file:"tikimanland1.mp3", vol:100}, {file:"tikimen1.mp3", vol:100}, {file:"tikimen2.mp3", vol:100}, {file:"vinegrow.mp3", vol:100}, {file:"warpout.mp3", vol:100}, {file:"wayout1.mp3", vol:100}, {file:"bomb.mp3", vol:100}, {file:"dogattack.mp3", vol:100}, {file:"dogpant.mp3", vol:100}, {file:"highlight.mp3", vol:100}, {file:"keyopen.mp3", vol:100}, {file:"mainmenu.mp3", vol:100}, {file:"select.mp3", vol:100}, {file:"superbonus.mp3", vol:100}, {file:"track1.mp3", vol:100}, {file:"tutbonk.mp3", vol:100}, {file:"umbrellawind.mp3", vol:100});
var SoundList = new Array();
this.LoadSounds();
Instance of Symbol 2096 MovieClip "Config" in Frame 1
onClipEvent (load) {
this.ConfigXML = new XML();
this.ConfigXML.ignoreWhite = true;
this.ConfigXML.onLoad = function () {
var _local3 = _root.Config.ConfigXML.firstChild.firstChild;
while (_local3) {
trace((("Found node :" + _local3.nodeName) + " val: ") + _local3.firstChild.nodeValue);
switch (_local3.nodeName) {
case "dlURL" :
_global.DownloadURL = _local3.firstChild.nodeValue;
break;
case "msnZone" :
_global.inPachinko = ((_local3.firstChild.nodeValue == "true") ? true : false);
break;
case "partnerLogoPos" :
var _local4 = _local3.firstChild.nodeValue.split(":");
_global.partnerLogoX = _local4[0];
_global.partnerLogoY = _local4[1];
trace((("Read Logo coords: x:" + _global.partnerLogoX) + " y:") + _global.partnerLogoY);
}
_local3 = _local3.nextSibling;
}
_root.onConfigFinished();
};
this.ConfigXML.load(_root.MyConfigXML);
}
Frame 6
function onMovieLoaded() {
_root.isMovieLoaded = true;
LoadFinished();
}
function onLocalizationFinished() {
_root.isLocFileLoaded = true;
LoadFinished();
}
function onTutorialFinished() {
_root.isTutorialLoaded = true;
LoadFinished();
}
function LoadFinished() {
if (((_root.isLocFileLoaded == true) && (_root.isMovieLoaded == true)) && (_root.isTutorialLoaded == true)) {
if (_global.isGameReady == false) {
_global.isGameReady = true;
_root.GameReady();
}
}
}
trace("Splash");
stop();
_root.isMovieLoaded = false;
_root.isLocFileLoaded = false;
_root.isTutorialLoaded = false;
_global.minLoadTime = 3;
_global.loadTime = getTimer();
_global.isGameReady = false;
function StartGame() {
_global.CurrentGrannyInParadiseLevel = 0;
_global.FinishedLastLevel = false;
_global.PercentOfFlowersCollected = 0;
_global.isBonusLevel = false;
_global.NumBonusHearts = 0;
_global.TotalBonusPoints = 0;
_global.DieReason = "";
_global.IsGameOver = false;
grannyGame.ResetGameData();
gotoAndStop ("StartGame");
}
function PauseTimer() {
trace("Pausing Timer");
_global.pauseStartTime = getTimer();
_global.isTimerPaused = true;
}
function RestartTimer() {
trace("Restarting Timer");
if (_global.pauseStartTime > 0) {
var _local2 = getTimer() - _global.pauseStartTime;
_global.startTime = _global.startTime + _local2;
_global.pauseStartTime = 0;
}
_global.isTimerPaused = false;
}
function SetPaused(paused) {
_global.pauseStatus = paused;
grannyGame.SetPaused(_global.pauseStatus);
if (_global.pauseStatus == true) {
_global.OldMuteState = _global.IsMuted;
_root.SetMute(true);
PauseTimer();
gotoAndStop ("Pause");
} else {
RestartTimer();
_root.SetMute(_global.OldMuteState);
Selection.setFocus(_root);
gotoAndStop ("PlayLevel");
}
}
function EndLevel() {
gotoAndStop ("PostLevel");
}
function EndGame() {
grannyGame.SetPaused(true);
grannyGame.SetVisible(false);
_root.StopSound("track1.mp3");
fscommand ("GameEnd", "<gamedata></gamedata>");
trace(["GameEnd", "<gamedata></gamedata>"]);
_global.CurrentGrannyInParadiseLevel = 0;
SubmitGameScore();
StopScoreBroadcast();
if (!_global.inPachinko) {
GotoMainMenu();
}
}
function ContinueLevel() {
trace("Continuing game!");
grannyGame.ContinueLevel();
gotoAndStop ("PlayLevel");
}
function GotoNextLevel() {
if (_global.CurrentGrannyInParadiseLevel < _global.NumLevels) {
RestartTimer();
_global.CurrentGrannyInParadiseLevel++;
_global.GameBreakNumber++;
breakdata = ("<data><breakpoint>" + _global.GameBreakNumber) + "</breakpoint></data>";
fscommand ("GameBreak", breakdata);
trace(["GameBreak", breakdata]);
if (!_global.inPachinko) {
PreLevel(true);
} else {
PreLevel(false);
}
} else {
trace("Web demo Over!!");
EndGame();
}
}
function GameReady() {
fscommand ("GameReady", "<data></data>");
trace(["GameReady", "<data></data>"]);
if (!_global.inPachinko) {
GotoMainMenu();
}
}
function GameLaunch() {
if (!_global.inPachinko) {
PreLevel(true);
}
}
function PreGameIntervalFinished() {
clearInterval(preGameIntervalID);
PlayCurrentLevel();
}
function PreLevel(doTimer) {
_root.StopSound("mainmenu.mp3");
_root.PlaySoundIfNotPlaying("track1.mp3", true);
gotoAndStop ("PreLevel");
if (doTimer) {
preGameIntervalID = setInterval(PreGameIntervalFinished, _global.PreGameWaitAmount);
}
}
function GetGameTime() {
if (_global.isTimerPaused == true) {
trace("getting game time during paused");
var _local2 = getTimer() - _global.pauseStartTime;
trace("Paused time: " + _local2);
return(Math.floor((getTimer() - (_global.startTime + _local2)) / 1000));
}
return(Math.floor((getTimer() - _global.startTime) / 1000));
}
function SubmitGameScore() {
var _local1 = grannyGame.GetCurrentScore();
trace(["ScoreSubmit", ((("<game><score>" + _local1) + "</score><time>") + GetGameTime()) + "</time></game>"]);
fscommand ("ScoreSubmit", ((("<game><score>" + _local1) + "</score><time>") + GetGameTime()) + "</time></game>");
}
function BroadcastGameScore() {
var _local1 = grannyGame.GetCurrentScore();
trace(["ScoreBroadcast", ((("<game><score>" + _local1) + "</score><time>") + GetGameTime()) + "</time></game>"]);
fscommand ("ScoreBroadcast", ((("<game><score>" + _local1) + "</score><time>") + GetGameTime()) + "</time></game>");
}
function StartScoreBroadcast() {
_global.startTime = getTimer();
_global.ScoreBroadcastIntervalID = setInterval(_root.BroadcastGameScore, 5000);
}
function StopScoreBroadcast() {
clearInterval(ScoreBroadcastIntervalID);
}
function BeginSession() {
if (_global.SessionBegan == false) {
_global.SessionBegan = true;
fscommand ("SessionReady", "<data></data>");
trace(["SessionReady", "<data></data>"]);
if (!inPachinko) {
gotoAndStop ("Load");
}
}
}
function GotoMainMenu() {
_root.StopSound("track1.mp3");
_root.PlaySoundIfNotPlaying("mainmenu.mp3", true);
gotoAndStop ("MainMenu");
}
function PlayCurrentLevel() {
grannyGame.StartLevel(_global.CurrentGrannyInParadiseLevel);
SetPaused(false);
gotoAndStop ("PlayLevel");
}
function CustomReturn() {
_global.DownloadPageLaunched = true;
}
function DownloadTrial() {
if (_global.inPachinko) {
fscommand ("CustomEvent", ("<gamedata>" + _global.DownloadURL) + "</gamedata>");
trace(["CustomEvent", ("<gamedata>" + _global.DownloadURL) + "</gamedata>"]);
_global.DownloadPageLaunched = false;
} else {
trace("Going to: " + _global.DownloadURL);
getURL (_global.DownloadURL);
}
}
function beginSessionIntervalHandler() {
_root.BeginSession();
clearInterval(beginSessionInterval);
}
_global.DownloadPageLaunched = false;
MyXML = "granny.xml";
MyTutorialXML = "tutorial.xml";
_global.startTime = getTimer();
_global.pauseStartTime = 0;
_global.totalPausedTime = 0;
_global.OldMuteState = false;
_global.IsMuted = false;
trace((_global.inPachinko ? "In " : "Not In ") + " Pachinko");
trace("Download URL is: " + _global.DownloadURL);
_global.SessionBegan = false;
_global.MenuTextLoaded = false;
Stage.scaleMode = "noScale";
var MainResizeListener = new Object();
MainResizeListener.onResize = function () {
Stage.align = "TL";
};
Stage.addListener(MainResizeListener);
_global.CurrentGrannyInParadiseLevel = 0;
_global.NumLevels = 11;
_global.FinishedLastLevel = false;
_global.PercentOfFlowersCollected = 0;
_global.isBonusLevel = false;
_global.NumBonusHearts = 0;
_global.TotalBonusPoints = 0;
_global.DieReason = "";
_global.IsGameOver = false;
_global.GameBreakNumber = 0;
var grannyGame = (new com.sandlot.GrannyInParadise.GameApp(_root.GrannyGameAnchor));
var gameAppListener = new Object();
gameAppListener.onFinishedLevel = function (flowerPercent, bonusLevel, bonusHearts, totalScore, isLastLevel) {
trace(("Level FInished ! flowers collected: " + flowerPercent) + "%");
_global.PercentOfFlowersCollected = flowerPercent;
_global.isBonusLevel = bonusLevel;
_global.NumBonusHearts = bonusHearts;
_global.TotalBonusPoints = totalScore;
_global.FinishedLastLevel = isLastLevel;
PauseTimer();
EndLevel();
};
gameAppListener.onGrannyDied = function (dieType, isGameOver) {
trace("Granny Has Died!! of type: " + dieType);
_global.DieReason = dieType;
_global.IsGameOver = isGameOver;
gotoAndStop ("GrannyDie");
};
gameAppListener.SetLevel = function (levelNum) {
_global.CurrentGrannyInParadiseLevel = levelNum;
};
grannyGame.SetGameAppListener(gameAppListener);
_global.pauseStatus = false;
var keyListener = new Object();
keyListener.onKeyDown = function () {
if (Key.isDown(String("P").charCodeAt(0))) {
if (_global.pauseStatus == true) {
SetPaused(false);
} else {
SetPaused(true);
}
}
};
focusListener = new Object();
focusListener.onSetFocus = function (oldFocus, newFocus) {
trace((("Focus Event old: " + oldFocus) + " new: ") + newFocus);
};
Selection.addListener(focusListener);
_global.isTimerPaused = false;
_global.PreGameWaitAmount = 500;
var preGameIntervalID;
_global.ScoreBroadcastIntervalID;
var beginSessionInterval;
_global.SplashScreenTime = 2000;
if (!_global.inPachinko) {
beginSessionInterval = setInterval(beginSessionIntervalHandler, _global.SplashScreenTime);
} else {
_root.BeginSession();
}
Instance of Symbol 2097 MovieClip "Tutorial" in Frame 6
onClipEvent (load) {
this.TutorialXML = new XML();
this.TutorialXML.ignoreWhite = true;
this.TutorialXML.onLoad = function () {
var _local29 = _root.Tutorial.TutorialXML.firstChild.firstChild;
_global.LevelsWithTips = new Array();
var _local12 = _local29.childNodes;
while (_local29) {
var _local10 = 0;
while (_local10 < _local12.length) {
var _local11 = new Array();
var _local8 = _local12[_local10].childNodes;
var _local6 = 0;
while (_local6 < _local8.length) {
var _local5 = {name:"", x:0, y:0, strings:"", arrows:null, soundfx:"", candig:null, canmove:null, candirtrespawn:null, enemiesmove:null, voiceover:null, tilenext:null, codenext:null, code_event:null};
_local5.name = _local8[_local6].nodeName;
for (var _local27 in _local8[_local6].attributes) {
_local5[_local27] = _local8[_local6].attributes[_local27];
}
var _local4 = _local8[_local6].childNodes;
var _local3 = 0;
while (_local3 < _local4.length) {
switch (_local4[_local3].nodeName) {
case "strings" :
break;
case "arrow" :
if (_local5.arrows == null) {
_local5.arrows = new Array();
}
var _local7 = new Object();
for (var _local27 in _local4[_local3].attributes) {
_local7[_local27] = _local4[_local3].attributes[_local27];
}
for (var _local28 in _local4[_local3].firstChild.attributes) {
_local7[_local28] = _local4[_local3].firstChild.attributes[_local28];
}
_local5.arrows.push(_local7);
break;
case "soundfx" :
break;
case "candig" :
case "canmove" :
case "candirtrespawn" :
case "enemiesmove" :
case "codenext" :
case "code_event" :
_local5[_local4[_local3].nodeName] = _local4[_local3].firstChild.nodeValue;
break;
case "voiceover" :
break;
case "tilenext" :
var _local9 = new Object();
for (var _local27 in _local4[_local3].attributes) {
_local9[_local27] = _local4[_local3].attributes[_local27];
}
_local5.tilenext = _local9;
}
_local3++;
}
_local11.push(_local5);
_local6++;
}
_global.LevelsWithTips[_local12[_local10].nodeName] = _local11;
trace("Loaded Tips for level: " + _local12[_local10].nodeName);
_local10++;
}
_local29 = _local29.nextSibling;
}
_root.grannyGame.CreateTutorialManager(_global.LevelsWithTips);
_root.onTutorialFinished();
};
this.TutorialXML.load(_root.MyTutorialXML);
}
Instance of Symbol 2093 MovieClip [Localizer] "Localizer" in Frame 6
onClipEvent (load) {
this.LocalizedXML = new XML();
this.LocalizedXML.ignoreWhite = true;
this.Localize = function (destname, varname) {
var Dest = eval (destname);
var Text = eval (("_root.Localizer." + varname) + ".text");
if (Text == null) {
Text = "";
}
Dest.text = Text;
var Formatter = new TextFormat();
var Size = eval (("_root.Localizer." + varname) + ".size");
if (Size != null) {
Formatter.size = Size;
}
var Font = eval (("_root.Localizer." + varname) + ".font");
if (Font != null) {
Formatter.font = Font;
}
Dest.setTextFormat(Formatter);
var Embed = eval (("_root.Localizer." + varname) + ".embed");
if (Embed != null) {
Dest.embedFonts = Embed;
}
Dest.autoSize = "center";
};
this.LocalizedXML.onLoad = function () {
var _local3 = _root.Localizer.LocalizedXML.firstChild.firstChild;
while (_local3) {
var _local4 = null;
var _local7 = null;
var _local6 = null;
var _local5 = null;
var _local2 = _local3.firstChild;
while (_local2) {
if (_local2.nodeName == "text") {
_local4 = _local2.firstChild.nodeValue;
} else if (_local2.nodeName == "size") {
_local7 = _local2.firstChild.nodeValue;
} else if (_local2.nodeName == "font") {
_local6 = _local2.firstChild.nodeValue;
} else if (_local2.nodeName == "embed") {
_local5 = _local2.firstChild.nodeValue;
}
_local2 = _local2.nextSibling;
}
Set("_root.Localizer." + _local3.nodeName, {text:_local4, size:_local7, font:_local6, embed:_local5});
_local3 = _local3.nextSibling;
}
_root.onLocalizationFinished();
};
this.LocalizedXML.load(_root.MyXML);
}
Frame 10
trace("Load");
stop();
_global.loadTime = getTimer();
Frame 18
stop();
_root.Localizer.Localize("_root.MainMenuMC.ui.PlayGameButton.ButtonText", "playGame");
_root.Localizer.Localize("_root.MainMenuMC.ui.PlayGameButton.ButtonTextShadow", "playGame");
_root.Localizer.Localize("_root.MainMenuMC.ui.DownloadGameButton.ButtonText", "downloadGame");
_root.Localizer.Localize("_root.MainMenuMC.ui.DownloadGameButton.ButtonTextShadow", "downloadGame");
trace("Text 1: " + _root.MainMenuMC.ui.PlayGameButton.ButtonText.text);
trace("Text 2: " + _root.MainMenuMC.ui.DownloadGameButton.ButtonText.text);
_root.MainMenuMC.ui.PlayGameButton.onGrannyButtonPress = function () {
_root.StartGame();
};
_root.MainMenuMC.ui.DownloadGameButton.onGrannyButtonPress = function () {
trace("DOWNLOAD GAME BUTTON PRESSED!");
_root.DownloadTrial();
};
Frame 28
stop();
_root.Localizer.Localize("_root.PlayMenuMC.ui.TutorialPlayButton.ButtonText", "playTutorialGame");
_root.Localizer.Localize("_root.PlayMenuMC.ui.TutorialPlayButton.ButtonTextShadow", "playTutorialGame");
_root.Localizer.Localize("_root.PlayMenuMC.ui.NoTutorialPlayButton.ButtonText", "playNoTutorialGame");
_root.Localizer.Localize("_root.PlayMenuMC.ui.NoTutorialPlayButton.ButtonTextShadow", "playNoTutorialGame");
_root.Localizer.Localize("_root.PlayMenuMC.ui.BackButton.ButtonText", "back");
_root.Localizer.Localize("_root.PlayMenuMC.ui.BackButton.ButtonTextShadow", "back");
_root.PlayMenuMC.ui.TutorialPlayButton.onGrannyButtonPress = function () {
_global.CurrentGrannyInParadiseLevel = 0;
_root.StartScoreBroadcast();
_root.PreLevel(true);
};
_root.PlayMenuMC.ui.NoTutorialPlayButton.onGrannyButtonPress = function () {
_global.CurrentGrannyInParadiseLevel = 3;
_root.StartScoreBroadcast();
_root.PreLevel(true);
};
_root.PlayMenuMC.ui.BackButton.onGrannyButtonPress = function () {
_root.GotoMainMenu();
};
Frame 38
stop();
_root.Localizer.Localize("_root.PreGameMC.ui.GameLoadText", "gameLoad");
_root.PreGameMC.ui.GameLoadTextShadow.text = _root.PreGameMC.ui.GameLoadText.text;
Frame 48
stop();
trace("Playing Game");
Frame 57
stop();
trace("Granny Died");
_root.Localizer.Localize("_root.GrannyDieMC.ui.ContinueButton.ButtonText", "continue");
_root.Localizer.Localize("_root.GrannyDieMC.ui.ContinueButton.ButtonTextShadow", "continue");
_root.Localizer.Localize("_root.GrannyDieMC.ui.GrannyFellText", "grannyfell");
_root.Localizer.Localize("_root.GrannyDieMC.ui.DieMessageText", _global.DieReason);
var spaceListener = new Object();
spaceListener.onKeyDown = function () {
if (Key.isDown(32)) {
Key.removeListener(spaceListener);
if (_global.IsGameOver == true) {
_root.EndGame();
} else {
_root.PlayCurrentLevel();
}
}
};
Key.addListener(spaceListener);
_root.GrannyDieMC.ui.ContinueButton.onGrannyButtonPress = function () {
Key.removeListener(spaceListener);
if (_global.IsGameOver == true) {
_root.EndGame();
} else {
_root.PlayCurrentLevel();
}
};
Frame 69
stop();
trace("Game Paused");
_root.Localizer.Localize("_root.PauseScreenMC.ui.RestartLevelButton.ButtonText", "restartLevel");
_root.Localizer.Localize("_root.PauseScreenMC.ui.RestartLevelButton.ButtonTextShadow", "restartLevel");
_root.Localizer.Localize("_root.PauseScreenMC.ui.EndGameButton.ButtonText", "endGame");
_root.Localizer.Localize("_root.PauseScreenMC.ui.EndGameButton.ButtonTextShadow", "endGame");
_root.Localizer.Localize("_root.PauseScreenMC.ui.ResumeGameButton.ButtonText", "resumeGame");
_root.Localizer.Localize("_root.PauseScreenMC.ui.ResumeGameButton.ButtonTextShadow", "resumeGame");
_root.Localizer.Localize("_root.PauseScreenMC.ui.DownloadTrialButton.ButtonText", "downloadGame");
_root.Localizer.Localize("_root.PauseScreenMC.ui.DownloadTrialButton.ButtonTextShadow", "downloadGame");
_root.PauseScreenMC.ui.RestartLevelButton.onGrannyButtonPress = function () {
_root.PlayCurrentLevel();
};
_root.PauseScreenMC.ui.EndGameButton.onGrannyButtonPress = function () {
_root.EndGame();
};
_root.PauseScreenMC.ui.ResumeGameButton.onGrannyButtonPress = function () {
_root.SetPaused(false);
};
_root.PauseScreenMC.ui.DownloadTrialButton.onGrannyButtonPress = function () {
_root.DownloadTrial();
};
Frame 77
function DoNextLevel() {
Key.removeListener(postLevelSpaceListener);
_root.GotoNextLevel();
}
stop();
_root.PlayOneOf(Array({f:"finishlevel.mp3", p:90}, {f:"finishlevel1.mp3", p:5}, {f:"finishlevel2.mp3", p:5}));
_root.Localizer.Localize("_root.PostLevelMC.ui.NextLevelButton.ButtonText", "nextLevel");
_root.Localizer.Localize("_root.PostLevelMC.ui.NextLevelButton.ButtonTextShadow", "nextLevel");
_root.Localizer.Localize("_root.PostLevelMC.ui.FinishedLevelText", "finishedLevel");
_root.Localizer.Localize("_root.PostLevelMC.ui.HintText", "hint");
if (_global.isBonusLevel) {
_root.Localizer.Localize("_root.PostLevelMC.ui.FlowersFoundText", "bonusHeartsCollected");
var bonusHeartsText = ((_root.PostLevelMC.ui.FlowersFoundText.text + " ") + _global.NumBonusHearts);
_root.PostLevelMC.ui.FlowersFoundText.text = bonusHeartsText;
_root.PostLevelMC.ui.FlowersFoundTextShadow.text = bonusHeartsText;
_root.Localizer.Localize("_root.PostLevelMC.ui.TotalPointsText", "totalPoints");
var finalPointsText = ((_root.PostLevelMC.ui.TotalPointsText.text + " ") + _global.TotalBonusPoints);
_root.PostLevelMC.ui.TotalPointsText.text = finalPointsText;
_root.PostLevelMC.ui.TotalPointsTextShadow.text = finalPointsText;
} else {
_root.Localizer.Localize("_root.PostLevelMC.ui.FlowersFoundText", "flowersFound");
var finalFlowerText = (((_root.PostLevelMC.ui.FlowersFoundText.text + " ") + _global.PercentOfFlowersCollected) + "%");
_root.PostLevelMC.ui.FlowersFoundText.text = finalFlowerText;
_root.PostLevelMC.ui.FlowersFoundTextShadow.text = finalFlowerText;
}
_root.PostLevelMC.ui.NextLevelButton.onGrannyButtonPress = function () {
Key.removeListener(spaceListener);
if (_global.FinishedLastLevel == true) {
_root.EndGame();
} else {
_root.DoNextLevel();
}
};
var postLevelSpaceListener = new Object();
postLevelSpaceListener.onKeyDown = function () {
if (Key.isDown(32)) {
Key.removeListener(postLevelSpaceListener);
if (_global.FinishedLastLevel == true) {
_root.EndGame();
} else {
_root.DoNextLevel();
}
}
};
Key.addListener(postLevelSpaceListener);
Frame 85
stop();
trace("End Game!");
Frame 95
gotoAndStop ("Load");
Frame 105
GotoMainMenu();
Frame 115
GotoMainMenu();
Frame 125
trace("Game Continue");
PreLevel(true);
Frame 135
_root.SetMute(true);
Frame 145
_root.SetMute(false);
Frame 155
_root.SetPaused(true);
Frame 165
_root.SetPaused(false);
Frame 175
_root.CustomReturn();
Symbol 1038 Button
on (release) {
trace("Menu button pressed! Pause Status: " + _global.pauseStatus);
if (_global.pauseStatus == false) {
_root.SetPaused(true);
}
}
Symbol 2045 MovieClip Frame 1
trace("Loading partner LOGO");
this.loadMovie("partner-logo.jpg");
Symbol 2046 MovieClip Frame 1
Instance of Symbol 2045 MovieClip "partnerLogo" in Symbol 2046 MovieClip Frame 1
onClipEvent (load) {
_root.PositionPartnerLogo(this);
}
Symbol 2050 MovieClip [EndGameScreen] Frame 1
#initclip 42
Object.registerClass("EndGameScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
init();
Symbol 2065 Button
on (rollOver) {
_root.PlaySound("highlight.mp3");
this.ButtonText.textColor = "0xFFC84D";
this.LeftFlower._visible = true;
this.RightFlower._visible = true;
this.LeftFlower._y = this.ButtonText._y + (this.ButtonText._height / 2);
this.RightFlower._y = this.ButtonText._y + (this.ButtonText._height / 2);
LeftFlower._x = this.ButtonText._x - (LeftFlower._width / 2);
RightFlower._x = (this.ButtonText._x + this.ButtonText._width) + (RightFlower._width / 2);
}
on (rollOut) {
this.ButtonText.textColor = "0xFFFFFF";
LeftFlower._visible = false;
RightFlower._visible = false;
}
on (release) {
this.ButtonText.textColor = "0xFFFFFF";
}
on (press) {
_root.PlaySound("select.mp3");
this.onGrannyButtonPress();
this.ButtonText.textColor = "0xFF0000";
}
Symbol 2066 MovieClip Frame 1
LeftFlower._visible = false;
RightFlower._visible = false;
ButtonText.autosize = "center";
ButtonTextShadow.autosize = "center";
Symbol 2071 MovieClip [PostLevelScreen] Frame 1
#initclip 34
Object.registerClass("PostLevelScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
init();
Symbol 2074 MovieClip [PauseScreen] Frame 1
#initclip 35
Object.registerClass("PauseScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
init();
Symbol 2078 MovieClip [GrannyDieScreen] Frame 1
#initclip 36
Object.registerClass("GrannyDieScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
init();
Symbol 2082 MovieClip [PreGameScreen] Frame 1
#initclip 37
Object.registerClass("PreGameScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
init();
Symbol 2084 MovieClip [PlayMenuScreen] Frame 1
#initclip 38
Object.registerClass("PlayMenuScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
this.init();
Symbol 2086 MovieClip [MenuScreen] Frame 1
#initclip 39
Object.registerClass("MenuScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
init();
Symbol 2090 MovieClip Frame 1
stop();
Instance of Symbol 2088 MovieClip [LoadBarFill] "LoadBarFill" in Symbol 2090 MovieClip Frame 1
onClipEvent (load) {
this._xscale = 0.1;
}
Symbol 2090 MovieClip Frame 2
stop();
if (_framesloaded >= _totalframes) {
_root.onMovieLoaded();
}
Instance of Symbol 2090 MovieClip "LoadBar" in Symbol 2091 MovieClip Frame 1
on (release) {
this.gotoAndPlay("EndLoad");
}
onClipEvent (enterFrame) {
loadTimeElapsed = (getTimer() - _global.loadTime) / 1000;
if ((_framesloaded >= _totalframes) && (loadTimeElapsed >= _global.minLoadTime)) {
_root.onMovieLoaded();
} else {
loadPercentage = _framesloaded / _totalframes;
if ((loadTimeElapsed / _global.minLoadTime) < loadPercentage) {
loadPercentage = loadTimeElapsed / _global.minLoadTime;
}
this.LoadBarFill._xscale = loadPercentage * 100;
}
}
Symbol 2092 MovieClip [LoadScreen] Frame 1
#initclip 40
Object.registerClass("LoadScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
init();
Symbol 2094 MovieClip [SplashScreen] Frame 1
#initclip 41
Object.registerClass("SplashScreen", com.sandlot.GrannyInParadise.StageSizedMovieClip);
#endinitclip
init();
Symbol 2098 MovieClip [__Packages.com.sandlot.GrannyInParadise.StageSizedMovieClip] Frame 0
class com.sandlot.GrannyInParadise.StageSizedMovieClip extends MovieClip
{
var stop, _width, _height;
function StageSizedMovieClip () {
super();
}
function init() {
(stop());// not popped
if (!mInitialized) {
Stage.addListener(this);
mInitialized = true;
}
onResize();
}
function onResize() {
Stage.align = "TL";
_width = Stage.width;
_height = Stage.height;
}
var mInitialized = false;
}
Symbol 2099 MovieClip [__Packages.com.sandlot.GrannyInParadise.GameApp] Frame 0
class com.sandlot.GrannyInParadise.GameApp
{
var mParentMC, mBackgroundMC, mGameMC, mGame, mGameAppListener, mTutorialManager, mTotalGameTime, mIsPaused, mIsVisible;
function GameApp (parentMC) {
mParentMC = parentMC;
Stage.scaleMode = "noScale";
Stage.addListener(this);
Key.addListener(this);
mParentMC.gameApp = this;
mParentMC.onEnterFrame = function () {
this.gameApp.onEnterFrame();
};
mBackgroundMC = mParentMC.attachMovie("ResortBGSymbol", "BackgroundMC", 0);
mGameMC = mParentMC.createEmptyMovieClip("GameMC", 1);
mGame = new com.sandlot.GrannyInParadise.Game(mGameMC, this);
SetVisible(false);
SetPaused(true);
mGameAppListener = null;
mTutorialManager = null;
mTotalGameTime = 0;
}
function GetGameTime() {
return(mGame.GetGameTime());
}
function CreateTutorialManager(theTutorialData) {
mTutorialManager = new com.sandlot.GrannyInParadise.TutorialManager(mGame, theTutorialData);
}
function SetPaused(paused) {
mIsPaused = paused;
mGame.SetPaused(paused);
}
function SetVisible(visible) {
mIsVisible = visible;
mParentMC._visible = mIsVisible;
}
function SetGameAppListener(listener) {
mGameAppListener = listener;
}
function ResetGameData() {
mGame.ResetData();
}
function onGrannyDied(reason, lifeRemaining) {
SetPaused(true);
if (mGameAppListener != null) {
if (lifeRemaining > 0) {
mGameAppListener.onGrannyDied(reason, false);
} else {
mGameAppListener.onGrannyDied(reason, true);
}
}
}
function onLevelFinished() {
SetPaused(true);
if (mGameAppListener != null) {
if ((mGame.mCurrentLevelId + 1) < mGame.mGameFactory.GetNumLevels()) {
if (mGame.IsBonusLevel()) {
var _local2 = mGame.GetNumBonusHeartsCollected();
mGameAppListener.onFinishedLevel(0, true, _local2, _local2 * 5, false);
} else {
mGameAppListener.onFinishedLevel(mGame.GetPercentOfFlowersCollected(), false, 0, 0, false);
}
} else {
mGameAppListener.onFinishedLevel(mGame.GetPercentOfFlowersCollected(), false, 0, 0, true);
}
}
}
function onResize() {
Stage.align = "TL";
mBackgroundMC._width = Stage.width;
mBackgroundMC._height = Stage.height;
mGame.Reshape();
}
function onEnterFrame() {
if (!mIsPaused) {
mGame.Update();
if ((mTutorialManager != null) && (mTutorialManager.doesLevelHaveTutorial(mGame.mCurrentLevelId))) {
mTutorialManager.UpdateTutorial();
}
}
}
function StartNextLevel() {
StartLevel(mGame.GetNextLevel());
}
function ResetLevel() {
StartLevel(mGame.mCurrentLevelId);
}
function GetCurrentScore() {
return(mGame.mCurrentPoints);
}
function StartLevel(levelId) {
if ((mTutorialManager != null) && (mTutorialManager.doesLevelHaveTutorial(mGame.mCurrentLevelId))) {
mTutorialManager.StopTutorial();
}
if (levelId == 3) {
mGame.ResetData();
}
mGame.StopGame();
mGame.UnloadLevel();
mGame.LoadLevel(levelId);
mGame.Reshape();
mGame.StartGame();
SetVisible(true);
if ((mTutorialManager != null) && (mTutorialManager.doesLevelHaveTutorial(mGame.mCurrentLevelId))) {
mTutorialManager.StartTutorial(levelId);
}
}
function ContinueLevel() {
trace("Continuing Level!!");
mGame.ContinueGame();
SetPaused(false);
}
function onKeyDown() {
}
}
Symbol 2100 MovieClip [__Packages.com.sandlot.GrannyInParadise.Game] Frame 0
class com.sandlot.GrannyInParadise.Game
{
var mParentMC, mGameApp, mStaticTiles, mEntityTiles, mGridOverlay, mHUDOverlay, mGameFactory, mTileMap, mEntities, mRemoveEntList, mRespawnNode, mDugHoles, mCanGrannyDig, mCanGrannyMove, mCanDirtRespawn, mCanEnemiesMove, mIsLevelLoaded, mIsGameStarted, mCanSproutBonusFlower, mCurrentLevelId, mCurrentPoints, mNumBonusFlowersInLevel, mNumBonusFlowersTotal, mGrannyLife, mTotalLevelFlowers, mBonusCountDown, mNumCollectedCats, mNumCatsInLevel, mFPS, mTimer, mGameEventListener, mKeys, mPathMgr, mMeowGate, mCats, mEscapeLadderSegs, mGranny, mNumPickedUpCats, mNumBonusHeartsCollected, mNumVineSegs;
function Game (theParentMC, theGameApp) {
mParentMC = theParentMC;
mGameApp = theGameApp;
mStaticTiles = mParentMC.createEmptyMovieClip("StaticTilesMC", 0);
mEntityTiles = mParentMC.createEmptyMovieClip("EntityTilesMC", 1);
mGridOverlay = mParentMC.createEmptyMovieClip("GridOverlayMC", 2);
mHUDOverlay = mParentMC.attachMovie("HUD", "HUDOverlayMC", 3);
mGameFactory = new com.sandlot.GrannyInParadise.GameFactory(this);
mTileMap = new com.sandlot.GrannyInParadise.TileMap(15, 20, 32, mGameFactory, mStaticTiles);
mEntities = new Array();
mRemoveEntList = new Array();
mRespawnNode = null;
mDugHoles = new Array();
mCanGrannyDig = true;
mCanGrannyMove = true;
mCanDirtRespawn = true;
mCanEnemiesMove = true;
mIsLevelLoaded = false;
mIsGameStarted = false;
mCanSproutBonusFlower = false;
mCurrentLevelId = -1;
mCurrentPoints = 0;
mNumBonusFlowersInLevel = 0;
mNumBonusFlowersTotal = 0;
mGrannyLife = 0;
mTotalLevelFlowers = 0;
mBonusCountDown = _global.BONUS_COUNTDOWN;
mNumCollectedCats = (mNumCatsInLevel = 0);
_global.INTERVAL_FILLHOLE = 0;
_global.INTERVAL_HIDE_BONUS_FLOWER_PERCENT = 1;
_global.INTERVAL_GAME_EVENT = 2;
mFPS = new com.sandlot.GrannyInParadise.FPSCounter(30);
mTimer = new com.sandlot.GrannyInParadise.Timer();
mGameEventListener = null;
mGrannyLife = 5;
mKeys = new Array();
mPathMgr = new com.sandlot.GrannyInParadise.PathManager(this);
var _local3 = new com.sandlot.GrannyInParadise.PerformanceManager();
_local3.Start("game.start");
}
function GetGameTime() {
return(mTimer.GetGameTime());
}
function setGrannyCanDig(canDig) {
mCanGrannyDig = canDig;
trace("Granny CANDIG =" + mCanGrannyDig);
}
function ShowDigBG() {
var _local4 = 0;
while (_local4 < mTileMap.mMapDataRows) {
var _local3 = 0;
while (_local3 < mTileMap.mMapDataCols) {
var _local5 = (_local4 * mTileMap.mMapDataCols) + _local3;
var _local2 = mHUDOverlay.attachMovie("hole", "hole" + _local5, 2000 + _local5);
_local2._x = Math.ceil((mTileMap.GetScreenXPercent(_local3) * Stage.width) + 0.5);
_local2._y = Math.ceil((mTileMap.GetScreenYPercent(_local4) * Stage.height) + 0.5);
_local2._y = _local2._y - 2.5;
_local2.gotoAndStop(4);
_local2._alpha = 60;
_local2.bg.gotoAndStop((2 + (_local4 * mTileMap.mMapDataCols)) + _local3);
_local3++;
}
_local4++;
}
}
function setGrannyCanMove(canMove) {
mCanGrannyMove = canMove;
}
function setCanDirtRespawn(canRespawn) {
mCanDirtRespawn = canRespawn;
}
function setCanEnemiesMove(canMove) {
mCanEnemiesMove = canMove;
}
function EmitParticles(row, col, toLeft) {
var _local2 = new Object();
_local2.colors = new Array("0xFEFC5C", "0xB8AA7C", "0x7D6028", "0xFED64E", "0xDC9B24", "0xFEFB55", "0xF4BC3D", "0xFEFD6D", "0x281E14", "0x271D13", "0xFAD249", "0xB05909");
_local2.numEmits = 1;
_local2.emitInterval = 100;
_local2.ttl_lo = 20;
_local2.ttl_hi = 100;
_local2.angle = (toLeft ? 135 : 45);
_local2.spread = 45;
_local2.speed_lo = 4;
_local2.speed_hi = 6;
_local2.gravity = 0.4;
_local2.particleSize = 2;
_local2.numParticlesPerEmit = 30;
var _local3 = new com.sandlot.GrannyInParadise.entity.ParticleSystem(_local2, mTimer, this, mGameFactory.GetNextValidEntityDepth());
_local3.SetSpawnPos(row, col);
_local3.StartEmit();
mEntities.push(_local3);
}
function ResetData() {
mGrannyLife = 5;
mCurrentPoints = 0;
mNumBonusFlowersTotal = 0;
}
function SetGameEventListener(listener) {
mGameEventListener = listener;
}
function onGameEvent(name) {
if (mGameEventListener != null) {
var _local3 = new Object();
_local3.name = name;
_local3.IntervalID = setInterval(this, "onInterval", 60, _global.INTERVAL_GAME_EVENT, _local3);
}
}
function SetPaused(paused) {
mHUDOverlay.MenuButton.enabled = !paused;
}
function AddEntity(ent) {
mEntities.push(ent);
}
function IsBonusLevel() {
return(mGameFactory.IsBonusMap(mCurrentLevelId));
}
function ScorePoints(points) {
var _local2 = mCurrentPoints % 10000;
_local2 = _local2 + points;
var _local3 = int(_local2 / 10000);
mCurrentPoints = mCurrentPoints + points;
mGrannyLife = mGrannyLife + _local3;
UpdateHUD();
}
function UpdateHUD() {
mHUDOverlay.level_name.text = (("" + (mCurrentLevelId + 1)) + " - ") + mGameFactory.GetMapName(mCurrentLevelId);
mHUDOverlay.score.text = "" + mCurrentPoints;
mHUDOverlay.life.text = "" + mGrannyLife;
mHUDOverlay.flowers.text = "" + mNumBonusFlowersTotal;
if (IsBonusLevel()) {
mHUDOverlay.BonusCounterShadow.text = (mHUDOverlay.BonusCounter.text = mBonusCountDown);
} else {
mHUDOverlay.BonusCounterShadow.text = (mHUDOverlay.BonusCounter.text = "");
}
}
function onCatExitLevel(cat) {
RemoveEntity(cat);
mNumCollectedCats++;
mGameFactory.onSoundQueue(_global.CAT_EXIT);
ScorePoints(mMeowGate.CatEnterScore());
UpdateHUD();
if (mNumCollectedCats == 1) {
onGameEvent("collected_first_cat");
}
if (mNumCollectedCats == mCats.length) {
onGameEvent("collected_last_cat");
}
if (mNumCollectedCats == mNumCatsInLevel) {
trace("finished Level!!");
var _local6 = com.sandlot.GrannyInParadise.entity.ExitFlowerEntity(FindFirstEntity("exit_flower"));
if (!_local6.IsSprouted()) {
_local6.Sprout();
}
mTileMap.SetIndicesToType(_global.TILE_HIDDEN_LADDER, mEscapeLadderSegs);
var _local4 = 100;
var _local5 = 0;
var _local3 = 0;
while (_local3 < mEscapeLadderSegs.length) {
_local5 = mEscapeLadderSegs[_local3].col;
if (mEscapeLadderSegs[_local3].row < _local4) {
_local4 = mEscapeLadderSegs[_local3].row;
}
mPathMgr.ResetNode(mEscapeLadderSegs[_local3].row, mEscapeLadderSegs[_local3].col);
_local3++;
}
mPathMgr.ResetNode(_local4 - 1, _local5);
mPathMgr.DrawGraph(mGridOverlay);
mGameFactory.onSoundQueue(_global.EXIT_APPEAR);
}
}
function onGrannyExited(exit_flower) {
RemoveEntity(exit_flower);
mGameApp.onLevelFinished();
}
function onGrannyHitExitFlower(exit_flower) {
RemoveEntity(mGranny);
exit_flower.GrannyExit();
mGameFactory.onSoundQueue(_global.EXIT_LEVEL);
}
function GetPercentOfFlowersCollected() {
if (IsBonusLevel()) {
return(100);
}
return(Math.floor((mNumBonusFlowersInLevel / mTotalLevelFlowers) * 100));
}
function onVineGrown(vine) {
onGameEvent("vine_grown");
}
function onPickedUpCat(cat) {
mNumPickedUpCats++;
trace("Picked up cat!");
mGameFactory.onSoundQueue(_global.COLLECT_CAT);
if (mNumPickedUpCats == 1) {
onGameEvent("picked_up_first_cat");
}
if (mNumPickedUpCats == mCats.length) {
onGameEvent("picked_up_last_cat");
}
if (mNumPickedUpCats == (mCats.length - 1)) {
var _local4;
var _local3 = 0;
while (_local3 < mCats.length) {
if ((!mCats[_local3].IsFollowing()) && (!mCats[_local3].inMeowGate)) {
_local4 = mCats[_local3];
}
_local3++;
}
mTimer.StartTimerEvent(500, this, {type:"LastCat", cat:_local4});
}
}
function onSproutedSuperBonusFlower(superBonusFlower) {
ScorePoints(100);
onGameEvent("sprout_super_bonus_flower");
}
function onSproutedBonusFlower(bonusFlower) {
mNumBonusFlowersInLevel++;
mNumBonusFlowersTotal++;
UpdateHUD();
bonusFlower.ShowPercent(GetPercentOfFlowersCollected());
var _local3 = new Object();
_local3.bonus_flower = bonusFlower;
_local3.IntervalID = setInterval(this, "onInterval", 2000, _global.INTERVAL_HIDE_BONUS_FLOWER_PERCENT, _local3);
if (mNumBonusFlowersInLevel == mTotalLevelFlowers) {
var _local4 = com.sandlot.GrannyInParadise.entity.SuperBonusFlowerEntity(FindFirstEntity("super_bonus_flower"));
if (!_local4.IsSprouted()) {
_local4.Hint();
onGameEvent("all_flowers");
mGameFactory.onSoundQueue(_global.CAN_GROW_SUPER_BONUS);
mCanSproutBonusFlower = true;
}
}
}
function onEmitterFinished(emitter) {
RemoveEntity(emitter);
}
function EmitBonusHeart(theRow, theCol) {
var _local3 = new Object();
_local3.numEmissions = 1;
_local3.numParticlesPerEmit = 1;
_local3.timeBetweenEmissions = 0;
_local3.speed = 0.01;
_local3.angle = 90;
_local3.spread = 0;
_local3.gravity = 0;
_local3.spriteClass = "heart";
_local3.animName = "pop";
var _local4 = new com.sandlot.GrannyInParadise.entity.EmitterEntity(_local3, this, this, mGameFactory.GetNextValidEntityDepth());
_local4.SetSpawnPos(theRow, theCol);
_local4.StartEmit();
mEntities.push(_local4);
mGameFactory.onSoundQueue(_global.SPROUT_BONUS_FLOWER);
ScorePoints(5);
mNumBonusHeartsCollected++;
UpdateHUD();
}
function GetNextLevel() {
return(mGameFactory.GetNextLevel(mCurrentLevelId));
}
function GetPrevLevel() {
return(mGameFactory.GetPrevLevel(mCurrentLevelId));
}
function FindFirstEntity(className) {
var _local2 = 0;
while (_local2 < mEntities.length) {
if (mEntities[_local2].GetClassName() == className) {
return(mEntities[_local2]);
}
_local2++;
}
trace("Couldn't find class: " + className);
return(null);
}
function StopGame() {
if (!mIsGameStarted) {
return(undefined);
}
mIsGameStarted = false;
}
function ScheduleTileRespawn(theRow, theCol, theTile, respawnTime) {
mTimer.StartTimerEvent(respawnTime, this, {type:"TileRespawn", row:theRow, col:theCol, tile:theTile});
}
function ScheduleCatRespawn(ent) {
mTimer.StartTimerEvent(500, this, ent);
}
function ScheduleRespawn(ent) {
trace("Scheduling ent respawn for: " + ent.mClassName);
if (mCanEnemiesMove == true) {
mTimer.StartTimerEvent(8000, this, ent);
}
}
function onTimerEvent(event) {
if (IsBonusLevel()) {
UpdateHUD();
if (mBonusCountDown <= 0) {
mGameApp.onLevelFinished();
}
mBonusCountDown--;
} else {
var _local5 = false;
if (event.d instanceof com.sandlot.GrannyInParadise.LevelEntity) {
var _local4 = event.d;
trace("Respawning an Entity!!: " + _local4.mClassName);
mEntities.push(_local4);
if (_local4 instanceof com.sandlot.GrannyInParadise.entity.TikiManEntity) {
if (mRespawnNode != null) {
_local4.SetSpawnPos(mRespawnNode.row, mRespawnNode.col);
_local5 = true;
}
}
if (_local4 instanceof com.sandlot.GrannyInParadise.entity.DogEntity) {
com.sandlot.GrannyInParadise.entity.DogEntity(_local4).FindStalkRange();
com.sandlot.GrannyInParadise.entity.DogEntity(_local4).SetTimer(mTimer);
com.sandlot.GrannyInParadise.entity.DogEntity(_local4).StartStalking();
}
_local4.Respawn();
_local4.Spawn();
if (_local5) {
com.sandlot.GrannyInParadise.entity.ActorEntity(_local4).SetState(_global.STATE_FALLING);
}
} else if (event.d.type == "TileRespawn") {
mTileMap.ResetTile(event.d.tile, event.d.row, event.d.col);
mPathMgr.ResetNode(event.d.row, event.d.col);
RemoveEntsFromHoleByPos(event.d.row, event.d.col, true);
mPathMgr.DrawGraph(mGridOverlay);
} else if (event.d.type == "LastCat") {
trace("LAST CAT!!");
mGameFactory.onSoundQueue(_global.LAST_CAT);
event.d.cat.ShineLastCat();
if ((event.d.cat.IsFollowing() == false) && (event.d.cat.inMeowGate == false)) {
mTimer.StartTimerEvent(3000, this, {type:"LastCat", cat:event.d.cat});
}
}
mTimer.RemoveTimerEvent(event);
}
}
function GetNumBonusHeartsCollected() {
return(mNumBonusHeartsCollected);
}
function StartGame() {
if (mIsGameStarted || (!mIsLevelLoaded)) {
return(undefined);
}
mNumBonusHeartsCollected = 0;
mCanGrannyDig = true;
mCanGrannyMove = true;
mCanDirtRespawn = true;
mCanEnemiesMove = true;
mTimer.Reset();
var _local3 = 0;
while (_local3 < mEntities.length) {
mEntities[_local3].Spawn();
_local3++;
}
mIsGameStarted = true;
var _local4 = FindFirstEntity("dog");
if (_local4 != null) {
com.sandlot.GrannyInParadise.entity.DogEntity(_local4).StartStalking();
}
if (IsBonusLevel()) {
trace("A bonus map!");
mBonusCountDown = _global.BONUS_COUNTDOWN;
mTimer.StartTimerEvent(1000, this);
} else {
trace("Not a bonus Map!");
mBonusCountDown = 0;
}
}
function EmitHeart() {
var _local2 = new Object();
_local2.numEmissions = 1;
_local2.numParticlesPerEmit = 10;
_local2.timeBetweenEmissions = 0;
_local2.speed = 0.15;
_local2.angle = 90;
_local2.spread = 90;
_local2.gravity = 0.02;
_local2.spriteClass = "heart";
_local2.animName = "pop";
var _local3 = new com.sandlot.GrannyInParadise.entity.EmitterEntity(_local2, this, this, mGameFactory.GetNextValidEntityDepth());
_local3.SetSpawnPos(10, 10);
_local3.StartEmit();
mEntities.push(_local3);
}
function CanSproutSuperBonusFlower() {
return(mCanSproutBonusFlower);
}
function LoadLevel(levelID) {
if (mIsGameStarted || (mIsLevelLoaded)) {
return(undefined);
}
mGranny.Unload();
trace("Loading map: " + levelID);
mGameFactory.LoadMap(levelID);
mGranny = com.sandlot.GrannyInParadise.entity.GrannyEntity(FindFirstEntity("granny"));
var _local4 = GetEntsOfType("vine");
var _local3 = 0;
while (_local3 < _local4.length) {
com.sandlot.GrannyInParadise.entity.VineEntity(_local4[_local3]).FindVineSegments();
_local3++;
}
mCanSproutBonusFlower = false;
mNumCollectedCats = 0;
mTotalLevelFlowers = 0;
mNumBonusFlowersInLevel = 0;
var _local11 = GetEntsOfType("bonus_flower");
mTotalLevelFlowers = _local11.length;
trace(("There are " + mTotalLevelFlowers) + " bonus flowers in this level!");
mNumCatsInLevel = 0;
mEscapeLadderSegs = mTileMap.FindTilesOfType(_global.TILE_HIDDEN_LADDER);
mTileMap.SetIndicesToType(0, mEscapeLadderSegs);
mPathMgr.CreateGraph();
mPathMgr.DrawGraph(mGridOverlay);
mNumPickedUpCats = 0;
mCats = GetEntsOfTileType(_global.TILE_CAT);
mMeowGate = com.sandlot.GrannyInParadise.entity.MeowGateEntity(FindFirstEntity("meow_gate"));
mMeowGate.SetTimer(mTimer);
mNumCatsInLevel = mCats.length;
trace(("There are " + mNumCatsInLevel) + " cats in this level!");
var _local9 = FindFirstEntity("tiki_man");
if (_local9 != null) {
mGameFactory.onSoundQueue(_global.TIKI_SEE);
mRespawnNode = null;
var _local6 = mTileMap.FindTilesOfType(_global.TILE_RESPAWN);
if (_local6.length > 0) {
mRespawnNode = _local6[0];
mTileMap.ResetTile(0, mRespawnNode.row, mRespawnNode.col);
mPathMgr.ResetNode(mRespawnNode.row, mRespawnNode.col);
mPathMgr.DrawGraph(mGridOverlay);
}
}
var _local5 = FindFirstEntity("dog");
if (_local5 != null) {
trace("Found dog... locating stock range");
com.sandlot.GrannyInParadise.entity.DogEntity(_local5).FindStalkRange();
com.sandlot.GrannyInParadise.entity.DogEntity(_local5).SetTimer(mTimer);
com.sandlot.GrannyInParadise.entity.DogEntity(_local5).StartStalking();
}
mCurrentLevelId = levelID;
mIsLevelLoaded = true;
UpdateHUD();
PushToBottom(mMeowGate.GetMainMovieClip());
var _local10 = FindFirstEntity("super_bonus_flower");
PushToBottom(_local10.GetMainMovieClip());
trace("LOOKING FOR VINE SEGMENTS");
var _local7 = GetEntsOfTileType(_global.TILE_VINE);
trace(("There were: " + _local7.length) + " vines in this level");
mNumVineSegs = _local7.length;
}
function UnloadLevel() {
if (mIsGameStarted || (!mIsLevelLoaded)) {
return(undefined);
}
mGranny = null;
var _local2 = 0;
while (_local2 < mEntities.length) {
mEntities[_local2].Unload();
delete mEntities[_local2];
_local2++;
}
mEntities = new Array();
if (mDugHoles.length > 0) {
trace(("HOLES STILL THERE There are still : " + mDugHoles.length) + " dug holes on the map!!");
}
mDugHoles = new Array();
mTileMap.ClearMap();
mIsLevelLoaded = false;
}
function onFellInHole(ent) {
onGameEvent("ent_in_hole");
}
function onInterval(type, obj) {
if (mGameApp.mIsPaused) {
return(undefined);
}
switch (type) {
case _global.INTERVAL_GAME_EVENT :
mGameEventListener.onGameEvent(obj.name);
clearInterval(obj.IntervalID);
break;
case _global.INTERVAL_HIDE_BONUS_FLOWER_PERCENT :
obj.bonus_flower.HidePercent();
clearInterval(obj.IntervalID);
}
}
function PushToBottom(mc) {
if (mc.getDepth() > mGranny.GetMainMovieClip().getDepth()) {
mc.swapDepths(mGranny.GetMainMovieClip());
}
var _local2 = 0;
while (_local2 < mCats.length) {
if (mc.getDepth() > mCats[_local2].GetMainMovieClip().getDepth()) {
mc.swapDepths(mCats[_local2].GetMainMovieClip());
}
_local2++;
}
}
function ContinueGame() {
trace("CONTINUING GAME!!");
mGrannyLife--;
FillAllHoles();
mGranny.Respawn();
mGranny.Spawn();
mCats = GetEntsOfTileType(_global.TILE_CAT);
var _local3 = 0;
while (_local3 < mCats.length) {
mCats[_local3].Respawn();
mCats[_local3].Spawn();
_local3++;
}
var _local4 = FindFirstEntity("tiki_man");
if (_local4 != null) {
_local4.Respawn();
_local4.Spawn();
}
var _local5 = FindFirstEntity("dog");
if (_local5 != null) {
_local5.Respawn();
_local5.Spawn();
}
UpdateHUD();
}
function FillAllHoles() {
trace("FILLING THE HOLES");
var _local2 = 0;
while (_local2 < mDugHoles.length) {
mDugHoles[_local2].FillHole();
_local2++;
}
mDugHoles = new Array();
}
function OnVineSegmentGrown(theRow, theCol, isLastSeg) {
mPathMgr.ResetNode(theRow, theCol);
if (isLastSeg) {
mPathMgr.ResetNode(theRow - 1, theCol);
}
mPathMgr.DrawGraph(mGridOverlay);
}
function Update() {
mFPS.UpdateCount();
mTimer.UpdateTimer(mGameApp.mIsPaused);
if ((!mIsGameStarted) || (!mIsLevelLoaded)) {
return(undefined);
}
if (mCanGrannyMove) {
mGranny.MoveLeft(Key.isDown(37));
mGranny.MoveRight(Key.isDown(39));
mGranny.MoveDown(Key.isDown(40));
mGranny.MoveUp(Key.isDown(38));
} else {
mGranny.MoveLeft(false);
mGranny.MoveRight(false);
mGranny.MoveDown(false);
mGranny.MoveUp(false);
}
if (mCanGrannyDig) {
mGranny.Action(Key.isDown(32));
} else {
mGranny.Action(false);
}
var _local2 = 0;
while (_local2 < mEntities.length) {
mEntities[_local2].Update();
_local2++;
}
HandleCollisions();
RemoveEntities();
mHUDOverlay.fps.text = Math.round(mFPS.ComputeFPS());
}
function OnGrannyDie(reason) {
mGrannyLife--;
mGameApp.onGrannyDied(reason, mGrannyLife);
}
function GetEntsOfType(className) {
var _local3 = new Array();
var _local2 = 0;
while (_local2 < mEntities.length) {
if (mEntities[_local2].mClassName == className) {
_local3.push(mEntities[_local2]);
}
_local2++;
}
return(_local3);
}
function GetEntsOfTileType(tileType) {
var _local3 = new Array();
var _local2 = 0;
while (_local2 < mEntities.length) {
if (mEntities[_local2].mTileType == tileType) {
_local3.push(mEntities[_local2]);
}
_local2++;
}
return(_local3);
}
function RemoveEntsFromHoleByPos(rowPos, colPos, andBaddies) {
if (mGranny != null) {
var _local5 = mTileMap.GetPosOnTopOf(mGranny.mRowPos, mGranny.mColPos);
if ((rowPos == _local5.row) && (colPos == _local5.col)) {
trace("Granny is in hole: " + [rowPos, colPos]);
mGranny.SetPos(_local5.row - 1, _local5.col);
}
}
var _local2 = 0;
while (_local2 < mCats.length) {
var _local5 = mTileMap.GetPosOnTopOf(mCats[_local2].mRowPos, mCats[_local2].mColPos);
if ((rowPos == _local5.row) && (colPos == _local5.col)) {
trace((("Theres a " + mCats[_local2].mClassName) + " in hole: ") + [rowPos, colPos]);
mCats[_local2].SetPos(_local5.row - 1, _local5.col);
}
_local2++;
}
if (andBaddies) {
var _local6 = FindFirstEntity("tiki_man");
if (_local6 != null) {
var _local5 = mTileMap.GetPosOnTopOf(_local6.mRowPos, _local6.mColPos);
if ((rowPos == _local5.row) && (colPos == _local5.col)) {
_local6.SetPos(_local5.row - 1, _local5.col);
}
}
var _local7 = FindFirstEntity("dog");
if (_local7 != null) {
var _local5 = mTileMap.GetPosOnTopOf(_local7.mRowPos, _local7.mColPos);
if ((rowPos == _local5.row) && (colPos == _local5.col)) {
_local7.SetPos(_local5.row - 1, _local5.col);
}
}
}
}
function RemoveEntsFromHole(hole) {
RemoveEntsFromHoleByPos(hole.mRowPos, hole.mColPos, false);
}
function FillingHole(hole) {
RemoveEntsFromHole(hole);
var _local2 = 0;
while (_local2 < mDugHoles.length) {
if (mDugHoles[_local2] === hole) {
mDugHoles.splice(_local2, 1);
break;
}
_local2++;
}
}
function FindEntIndex(ent) {
var _local2 = 0;
while (_local2 < mEntities.length) {
if (ent === mEntities[_local2]) {
return(_local2);
}
_local2++;
}
return(-1);
}
function RemoveEntities() {
var _local2 = 0;
while (_local2 < mRemoveEntList.length) {
var _local3 = FindEntIndex(mRemoveEntList[_local2]);
if (_local3 != -1) {
mEntities[_local3].Show(false);
mEntities.splice(_local3, 1);
}
_local2++;
}
delete mRemoveEntList;
mRemoveEntList = new Array();
}
function Respawn(theEnt) {
if ((theEnt.mClassName == "water_can") && (mNumVineSegs <= 0)) {
trace("Cancelling respawn of water_can: " + mNumVineSegs);
return(undefined);
}
theEnt.Respawn();
mEntities.push(theEnt);
}
function RemoveEntity(theEnt) {
if (theEnt == mGranny) {
mGranny = null;
}
if (theEnt instanceof com.sandlot.GrannyInParadise.entity.FollowerEntity) {
com.sandlot.GrannyInParadise.entity.FollowerEntity(theEnt).ResetPath();
}
mRemoveEntList.push(theEnt);
}
function HandleCollisions() {
if (mGranny != null) {
var _local2 = 0;
while (_local2 < mEntities.length) {
if ((mGranny != mEntities[_local2]) && (mGranny.CollidesWith(mEntities[_local2]))) {
mGranny.OnCollision(mEntities[_local2]);
}
_local2++;
}
}
var _local2 = 0;
while (_local2 < mCats.length) {
if (mCats[_local2].CollidesWith(mMeowGate)) {
mCats[_local2].OnCollision(mMeowGate);
}
_local2++;
}
}
function PositionHUD() {
mHUDOverlay._xscale = mGameFactory.currScaleFactorX * 100;
mHUDOverlay._yscale = mGameFactory.currScaleFactorY * 100;
mHUDOverlay._x = 0;
mHUDOverlay._y = 0;
}
function Reshape() {
mGameFactory.UpdateScale();
mTileMap.Reshape();
var _local2 = 0;
while (_local2 < mEntities.length) {
mEntities[_local2].Reshape();
_local2++;
}
PositionHUD();
}
}
Symbol 2101 MovieClip [__Packages.com.sandlot.GrannyInParadise.GameFactory] Frame 0
class com.sandlot.GrannyInParadise.GameFactory
{
var mGame, mCatColors, mBonusFlowerColors, virtualScreenWidth, virtualScreenHeight, currScaleFactorX, currScaleFactorY, mMapData, nextValidEntityDepth, mAnims, mAnimData, mTiles;
function GameFactory (theGame) {
_global.LoadedTileMCCount = 0;
mGame = theGame;
LoadConstants();
mCatColors = new Array("orange", "brown", "grey", "black");
mBonusFlowerColors = new Array("pink", "blue", "yellow");
virtualScreenWidth = 640;
virtualScreenHeight = 480;
UpdateScale();
LoadTiles();
LoadMapData();
LoadAnimData();
LoadAnims();
UnloadAnimData();
LoadSoundEvents();
}
function StopSound(event) {
if (!(event === _global.UMBRELLA_WIND)) {
} else {
_root.StopSound("umbrellawind.mp3");
}
}
function onSoundQueue(event) {
switch (event) {
case _global.BONUS_HEARTS :
_root.PlaySound("bonushearts.mp3", false);
break;
case _global.SPROUT_BONUS_FLOWER :
_root.PlayOneOf(Array({f:"flower1.mp3", p:50}, {f:"flower2.mp3", p:50}));
break;
case _global.COLLECT_CAT :
_root.PlayOneOf(Array({f:"collect1.mp3", p:20}, {f:"collect3.mp3", p:20}, {f:"catidle1.mp3", p:60}));
break;
case _global.LAST_CAT :
_root.PlaySound("catidle1.mp3", false);
break;
case _global.CAT_EXIT :
_root.PlaySound("catdoor.mp3", false);
break;
case _global.CAN_GROW_SUPER_BONUS :
_root.PlaySound("floweralert.mp3", false);
break;
case _global.GRANNY_LAND :
_root.PlaySound("land.mp3", false);
break;
case _global.EXIT_LEVEL :
_root.PlaySound("warpout.mp3", false);
break;
case _global.EXIT_APPEAR :
_root.PlaySound("wayout1.mp3", false);
break;
case _global.DIGGING :
_root.PlaySound("dig.mp3", false);
break;
case _global.DIG_FAIL :
_root.PlaySound("cannotdig.mp3", false);
break;
case _global.TIKI_MAN_LAND :
_root.PlaySound("tikimanland1.mp3", false);
break;
case _global.BOMB :
_root.PlaySound("bomb.mp3", false);
break;
case _global.GRANNY_DIE :
_root.PlayOneOf(Array({f:"death1.mp3", p:50}, {f:"death2.mp3", p:50}));
break;
case _global.DOG_PANT :
_root.PlaySound("dogpant.mp3", false);
break;
case _global.DOG_ATTACK :
_root.PlaySound("dogattack.mp3", false);
break;
case _global.KEY_OPEN :
_root.PlaySound("keyopen.mp3", false);
break;
case _global.TIKI_HIT :
_root.PlaySound("tikimanhit1.mp3", false);
break;
case _global.TIKI_SEE :
_root.PlayOneOf(Array({f:"tikimen1.mp3", p:50}, {f:"tikimen2.mp3", p:50}));
break;
case _global.TUTORIAL :
_root.PlaySound("tutbonk.mp3", false);
break;
case _global.UMBRELLA_WIND :
_root.ToggleSound("umbrellawind.mp3");
break;
case _global.VINE_GROW :
_root.PlaySound("vinegrow.mp3", false);
break;
case _global.SUPER_BONUS_SPROUT :
_root.PlaySound("superbonus.mp3", false);
}
}
function LoadSoundEvents() {
_global.BONUS_HEARTS = 0;
_global.SPROUT_BONUS_FLOWER = 1;
_global.COLLECT_CAT = 2;
_global.CAT_EXIT = 3;
_global.CAN_GROW_SUPER_BONUS = 4;
_global.GRANNY_LAND = 5;
_global.EXIT_LEVEL = 6;
_global.EXIT_APPEAR = 7;
_global.DIGGING = 8;
_global.DIG_FAIL = 9;
_global.TIKI_MAN_LAND = 10;
_global.BOMB = 11;
_global.GRANNY_DIE = 12;
_global.DOG_PANT = 13;
_global.DOG_ATTACK = 14;
_global.KEY_OPEN = 15;
_global.TIKI_HIT = 16;
_global.TIKI_SEE = 17;
_global.TUTORIAL = 18;
_global.UMBRELLA_WIND = 19;
_global.VINE_GROW = 20;
_global.SUPER_BONUS_SPROUT = 21;
_global.LAST_CAT = 22;
}
function LoadConstants() {
_global.HOLE_FILL_TIME = 8000;
_global.BONUS_COUNTDOWN = 45;
_global.DIR_NONE = 0;
_global.DIR_LEFT = 1;
_global.DIR_RIGHT = 2;
_global.DIR_UP = 4;
_global.DIR_DOWN = 8;
_global.DIR_UP_LEFT = 5;
_global.DIR_UP_RIGHT = 6;
_global.DIR_DOWN_LEFT = 9;
_global.DIR_DOWN_RIGHT = 16;
_global.THRUST_LEFT = 0;
_global.THRUST_RIGHT = 1;
_global.THRUST_UP = 2;
_global.THRUST_DOWN = 3;
_global.GetDirectionName = function (dir) {
switch (dir) {
case _global.DIR_NONE :
return("NONE");
case _global.DIR_LEFT :
return("LEFT");
case _global.DIR_RIGHT :
return("RIGHT");
case _global.DIR_UP :
return("UP");
case _global.DIR_DOWN :
return("DOWN");
case _global.DIR_UP_LEFT :
return("UP-LEFT");
case _global.DIR_UP_RIGHT :
return("UP-RIGHT");
case _global.DIR_DOWN_LEFT :
return("DOWN-LEFT");
case _global.DIR_DOWN_RIGHT :
return("DOWN-RIGHT");
}
return("invalid_dir :" + dir);
};
_global.getDirection = function (dirRow, dirCol) {
if ((dirRow > 0) && (dirCol > 0)) {
return(_global.DIR_UP_LEFT);
}
if ((dirRow > 0) && (dirCol < 0)) {
return(_global.DIR_UP_RIGHT);
}
if ((dirRow < 0) && (dirCol > 0)) {
return(_global.DIR_DOWN_LEFT);
}
if ((dirRow < 0) && (dirCol < 0)) {
return(_global.DIR_DOWN_RIGHT);
}
if ((dirRow > 0) && (dirCol == 0)) {
return(_global.DIR_UP);
}
if ((dirRow < 0) && (dirCol == 0)) {
return(_global.DIR_DOWN);
}
if ((dirRow == 0) && (dirCol > 0)) {
return(_global.DIR_LEFT);
}
if ((dirRow == 0) && (dirCol < 0)) {
return(_global.DIR_RIGHT);
}
return(_global.DIR_NONE);
};
_global.isGoingUp = function (dir) {
return((dir & _global.DIR_UP) != 0);
};
_global.isGoingDown = function (dir) {
return((dir & _global.DIR_DOWN) != 0);
};
_global.isGoingLeft = function (dir) {
return((dir & _global.DIR_LEFT) != 0);
};
_global.isGoingRight = function (dir) {
return((dir & _global.DIR_RIGHT) != 0);
};
_global.Distance = function (row1, col1, row2, col2) {
var _local1 = row2 - row1;
var _local2 = col2 - col1;
return(Math.sqrt((_local1 * _local1) + (_local2 * _local2)));
};
_global.STATE_NONE = 0;
_global.STATE_WALKING = 1;
_global.STATE_STANDING = 2;
_global.STATE_CLIMBING = 4;
_global.STATE_CLIMBING_STOPPED = 8;
_global.STATE_FALLING = 16;
_global.STATE_IDLE = 32;
_global.STATE_SPAWN = 64;
_global.STATE_LANDING = 256;
_global.STATE_LADDER_SIDE = 512;
_global.STATE_DIGGING = 1024;
_global.STATE_OUT_DOOR = 2048;
_global.STATE_OPEN_UMBRELLA = 4096;
_global.STATE_UMBRELLA_FLOAT = 8192;
_global.STATE_THROW_KEY = 16384;
_global.STATE_PLACE_BOMB = 32768;
_global.STATE_FILLING_HOLE = 65536;
_global.STATE_HAND_OVER_HAND = 131072 /* 0x020000 */;
_global.STATE_HAND_OVER_HAND_HANG = 262144 /* 0x040000 */;
_global.STATE_ITEM_POOF = 524288 /* 0x080000 */;
_global.STATE_ATTACK = 1048576 /* 0x100000 */;
_global.STATE_DYING = 2097152 /* 0x200000 */;
_global.STATE_DEAD = 4194304 /* 0x400000 */;
_global.StateNames = new Array();
_global.StateNames[_global.STATE_NONE.toString(10)] = "STATE_NONE";
_global.StateNames[_global.STATE_WALKING.toString(10)] = "STATE_WALKING";
_global.StateNames[_global.STATE_STANDING.toString(10)] = "STATE_STANDING";
_global.StateNames[_global.STATE_CLIMBING.toString(10)] = "STATE_CLIMBING";
_global.StateNames[_global.STATE_CLIMBING_STOPPED.toString(10)] = "STATE_CLIMBING_STOPPED";
_global.StateNames[_global.STATE_FALLING.toString(10)] = "STATE_FALLING";
_global.StateNames[_global.STATE_IDLE.toString(10)] = "STATE_IDLE";
_global.StateNames[_global.STATE_SPAWN.toString(10)] = "STATE_SPAWN";
_global.StateNames[_global.STATE_LANDING.toString(10)] = "STATE_LANDING";
_global.StateNames[_global.STATE_LADDER_SIDE.toString(10)] = "STATE_LADDER_SIDE";
_global.StateNames[_global.STATE_DIGGING.toString(10)] = "STATE_DIGGING";
_global.StateNames[_global.STATE_OUT_DOOR.toString(10)] = "STATE_OUT_DOOR";
_global.StateNames[_global.STATE_OPEN_UMBRELLA.toString(10)] = "STATE_OPEN_UMBRELLA";
_global.StateNames[_global.STATE_UMBRELLA_FLOAT.toString(10)] = "STATE_UMBRELLA_FLOAT";
_global.StateNames[_global.STATE_THROW_KEY.toString(10)] = "STATE_THROW_KEY";
_global.StateNames[_global.STATE_PLACE_BOMB.toString(10)] = "STATE_PLACE_BOMB";
_global.StateNames[_global.STATE_FILLING_HOLE.toString(10)] = "STATE_FILLING_HOLE";
_global.StateNames[_global.STATE_HAND_OVER_HAND.toString(10)] = "STATE_HAND_OVER_HAND";
_global.StateNames[_global.STATE_HAND_OVER_HAND_HANG.toString(10)] = "STATE_HAND_OVER_HAND_HANG";
_global.StateNames[_global.STATE_ITEM_POOF.toString(10)] = "STATE_ITEM_POOF";
}
function GetRandomBonusFlowerColor() {
return(mBonusFlowerColors[int(Math.random() * 3)]);
}
function GetRandomCatColor() {
return(mCatColors[int(Math.random() * 4)]);
}
function UpdateScale() {
currScaleFactorX = Stage.width / virtualScreenWidth;
currScaleFactorY = Stage.height / virtualScreenHeight;
}
function GetNumMaps() {
return(mMapData.length);
}
function GetMapName(mapId) {
if ((mapId >= 0) && (mapId < mMapData.length)) {
return(mMapData[mapId].name);
}
return("");
}
function LoadMap(mapId) {
trace((("Loading map: " + mapId) + " ") + mMapData[mapId].name);
var _local6 = 0;
nextValidEntityDepth = 0;
mGame.mTileMap.ClearMap();
var _local4 = mMapData[mapId].data.split(" ");
var _local3 = 0;
while (_local3 < _local4.length) {
if (isStaticTile(int(_local4[_local3]))) {
mGame.mTileMap.SetMapData(_local4[_local3], int(_local3 / 20), int(_local3 % 20));
_local6++;
} else if (isHiddenTile(_local4[_local3])) {
mGame.mTileMap.SetMapData(_local4[_local3], int(_local3 / 20), int(_local3 % 20));
} else if (isEntityTile(_local4[_local3])) {
var _local5 = CreateEntity(_local4[_local3], nextValidEntityDepth++);
_local5.SetSpawnPos(int(_local3 / 20), int(_local3 % 20));
mGame.mEntities.push(_local5);
if (_local5.mClassName == "vine") {
mGame.mTileMap.SetMapData(_global.TILE_VINE_SEGMENT, int(_local3 / 20), int(_local3 % 20));
}
}
_local3++;
}
trace(("-----Placed: " + _local6) + " Tiles-----");
mGame.mTileMap.GenerateMap();
trace("----Reshaping Map-----");
mGame.mTileMap.Reshape();
}
function GetNextValidEntityDepth() {
return(nextValidEntityDepth++);
}
function GetNumLevels() {
return(mMapData.length);
}
function LoadMapData() {
mMapData = new Array({name:"Tutorial 1", isBonus:false, data:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 18 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 3 0 0 0 0 0 0 0 0 9 0 0 9 0 0 15 0 0 0 0 3 18 0 18 0 0 18 0 3 1 1 1 1 1 1 1 1 4 0 0 1 1 1 1 1 3 1 3 3 0 1 1 0 0 0 0 0 4 0 0 0 0 0 0 0 3 0 3 3 0 0 2 8 0 0 0 0 4 9 0 0 0 0 16 0 3 2 3 3 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 0 0 0 0 0 0 0 2 2 2 2 0 0 0 0 0 0 0 3 3 0 0 9 0 0 0 9 0 0 0 0 0 0 0 1 21 0 0 3 1 1 1 1 1 1 1 1 3 0 9 0 0 0 9 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 3 0 0 9 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0"}, {name:"Tutorial 2", isBonus:false, data:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 15 1 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 1 4 1 1 0 2 2 0 0 0 0 1 1 0 0 0 9 0 9 0 9 4 0 0 0 0 0 2 2 2 1 0 0 0 0 1 1 1 1 1 1 3 0 0 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 4 1 1 0 9 0 0 0 0 18 0 18 0 18 0 16 0 11 3 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"}, {name:"Tutorial 3", isBonus:false, data:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 27 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 27 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 27 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 27 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 27 0 9 0 18 9 0 0 0 0 0 0 0 9 18 0 0 9 0 0 27 18 1 1 1 1 1 1 3 0 0 0 1 1 1 27 1 1 0 0 27 1 0 0 0 0 0 0 3 9 0 18 0 0 0 27 0 0 0 0 27 0 0 0 0 0 0 1 1 1 27 1 1 0 0 27 0 0 0 0 19 0 0 0 0 0 0 0 0 0 27 0 0 0 0 27 0 0 21 1 1 1 18 0 8 0 0 22 0 18 19 0 0 16 0 19 18 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"}, {name:"Let's get started!", isBonus:false, data:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 1 1 1 1 1 1 1 3 0 0 0 0 0 0 0 18 0 9 0 3 0 0 0 0 0 0 0 3 15 0 0 0 0 0 1 1 1 1 1 1 1 3 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 3 0 0 9 0 18 0 0 0 0 0 0 0 0 0 0 0 3 1 1 1 1 1 1 1 1 1 0 0 0 0 0 18 0 9 0 0 3 18 0 0 0 0 0 0 0 0 0 0 0 3 1 1 1 1 1 1 1 1 3 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 18 0 0 3 0 9 0 0 0 0 0 0 0 0 3 0 0 0 0 1 1 1 1 1 1 1 1 1 1 3 0 0 0 0 1 0 18 0 0 0 0 0 0 0 0 0 0 0 0 3 0 9 0 18 1 1 1 0 0 0 9 21 0 8 16 18 0 9 0 3 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2"}, {name:"Strawberry Shortcake", isBonus:true, data:"0 5 5 5 5 5 5 5 28 8 28 28 5 5 5 5 5 5 5 0 3 28 28 28 0 0 0 0 1 1 1 1 0 0 0 0 28 28 28 3 3 1 1 1 0 0 28 28 0 0 0 28 28 28 0 0 1 1 1 3 3 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 3 3 28 28 28 28 0 0 0 28 28 28 28 0 0 0 28 28 28 28 3 3 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 3 3 28 28 28 0 28 28 28 28 0 0 28 28 28 28 0 28 28 28 3 3 1 1 1 0 1 1 1 1 0 0 1 1 1 1 0 1 1 1 3 3 0 28 28 28 28 0 0 0 0 0 0 0 0 28 28 28 28 0 3 3 0 1 1 1 1 0 28 28 28 28 28 28 0 1 1 1 1 0 3 3 28 28 0 0 0 0 1 1 1 1 1 1 0 0 0 0 28 28 3 1 1 1 3 0 0 0 0 0 0 0 0 0 0 0 0 3 1 1 1 0 0 0 1 3 28 28 28 28 28 28 28 28 28 28 3 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0"}, {name:"This may be trouble", isBonus:false, data:"0 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 18 0 0 0 0 0 0 0 0 9 18 11 15 0 9 0 0 3 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 3 0 0 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 1 1 1 1 1 0 0 0 0 0 0 9 0 0 0 0 0 3 0 18 21 1 0 9 0 0 0 0 0 0 0 1 1 3 0 0 0 3 1 1 1 0 1 1 1 0 0 0 0 0 0 18 0 3 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 3 0 0 0 0 0 18 0 0 0 0 9 0 0 1 1 0 1 0 0 3 18 9 0 3 1 1 1 3 3 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 3 3 0 0 18 9 0 16 0 0 8 0 0 0 18 0 0 9 0 0 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2"}, {name:"Umbrella Gliding", isBonus:false, data:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 0 9 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 3 1 1 0 0 0 0 0 0 0 0 9 0 15 18 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 3 0 0 0 0 18 0 25 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 1 3 1 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 1 3 1 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 3 0 0 0 0 9 18 9 18 9 0 9 21 0 3 0 0 0 0 0 3 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 18 9 0 0 8 18 0 0 9 18 0 0 0 16 18 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"}, {name:"Float to the Cats", isBonus:false, data:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 25 9 0 0 18 11 0 9 0 0 0 4 1 1 1 0 0 0 0 3 1 1 1 1 1 1 1 1 1 0 0 4 0 0 0 0 0 0 0 3 0 0 0 0 9 0 0 0 0 0 0 4 9 0 0 9 18 0 0 3 0 0 3 1 1 1 1 0 0 0 1 1 1 4 1 1 1 0 0 1 1 1 3 0 0 0 0 0 0 18 9 0 0 4 0 0 0 0 0 0 0 0 1 1 1 3 0 0 1 1 1 1 1 1 3 0 0 0 0 0 0 18 0 12 0 3 9 0 0 0 0 9 0 1 3 18 0 0 0 9 0 1 1 0 18 1 1 1 4 1 1 1 1 0 3 1 1 0 1 1 0 0 0 0 1 1 0 0 4 0 0 0 0 0 3 1 16 8 0 0 18 0 9 0 0 0 9 0 4 18 0 21 0 0 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 2 2 2 2 2 2 2 1 1 1 1 1 1 2 2 2 2 2 2"}, {name:"Better use the key", isBonus:false, data:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 0 1 3 1 1 0 0 0 18 0 9 0 0 0 0 0 18 2 2 1 2 12 3 0 0 1 1 1 1 1 1 1 1 0 26 9 2 2 0 0 9 0 1 1 3 0 0 0 0 0 0 0 0 0 1 1 2 0 2 1 2 0 0 0 3 0 18 0 9 0 0 0 0 0 0 18 1 1 18 9 0 0 0 1 1 1 1 1 1 1 1 1 3 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 15 17 0 0 0 0 0 21 9 0 18 0 1 1 3 0 3 0 0 1 1 1 4 0 1 1 1 1 1 1 1 1 0 18 3 9 3 0 0 9 18 0 4 0 0 0 0 0 0 0 0 0 0 1 1 1 3 0 1 1 1 1 3 0 9 0 8 0 16 0 0 0 0 0 0 0 3 18 2 2 2 1 1 1 1 1 1 1 1 1 3 9 18 3 1 1 2 2 0 0 0 2 2 2 2 2 2 1 1 1 1 1 1 1 1 2 2 0"}, {name:"Grab Bomb, press Space Bar", isBonus:false, data:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 18 0 0 0 0 0 0 0 0 0 18 0 0 0 0 0 0 18 0 60 60 60 60 60 60 60 3 60 60 60 60 60 60 60 60 60 60 60 60 2 2 2 2 2 2 0 3 0 2 2 2 2 2 2 2 2 2 2 2 2 0 0 2 0 2 0 3 0 2 0 0 0 0 2 0 2 0 0 2 2 15 9 2 9 2 18 3 9 2 18 9 0 18 2 9 2 21 9 2 60 60 60 60 3 60 60 60 60 60 60 60 60 60 60 3 60 60 60 60 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 0 0 2 3 0 0 0 0 2 0 0 0 0 0 3 2 0 0 2 2 9 18 2 3 0 18 9 18 2 57 0 8 18 0 3 2 9 16 2 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60"}, {name:"What does this do?", isBonus:false, data:"0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 9 0 2 15 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 60 60 60 60 60 4 0 0 0 18 0 0 21 0 9 18 0 0 0 3 0 0 0 0 0 4 0 0 1 1 1 1 1 60 1 1 1 3 18 3 0 18 57 0 0 4 0 11 0 0 18 9 0 0 0 0 0 3 1 3 0 1 1 3 1 1 1 60 1 1 1 1 3 0 0 0 0 3 0 3 9 0 0 3 0 0 0 0 0 18 9 0 3 0 18 0 9 3 0 1 1 0 0 3 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 18 3 0 9 0 10 0 0 0 18 0 0 0 0 1 0 0 0 0 0 1 60 60 1 1 1 1 1 1 1 1 1 3 0 0 0 9 60 9 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 18 60 60 60 60 0 0 18 0 8 0 18 0 16 0 0 9 0 3 18 60 60 0 0 60 60 60 1 1 1 1 1 1 1 1 1 1 60 60 60 60 0 0 0 0 60 1 1 1 1 1 1 1 1 1 1 1 1 60 0 0 0 0"});
}
function IsBonusMap(mapId) {
return(mMapData[mapId].isBonus);
}
function GetNextLevel(currentLevelID) {
return(int(int(currentLevelID + 1) % mMapData.length));
}
function GetPrevLevel(currentLevelID) {
if (currentLevelID <= 0) {
return(mMapData.length - 1);
}
return(int(int(currentLevelID - 1) % mMapData.length));
}
function isAnimValid(animClass, animName) {
if ((mAnims[animClass] == null) || (mAnims[animClass] == undefined)) {
return(false);
}
if ((mAnims[animClass][animName] == null) || (mAnims[animClass][animName] == undefined)) {
return(false);
}
return(true);
}
function GetAnim(animClass, animName) {
return(mAnims[animClass][animName]);
}
function LoadAnims() {
mAnims = new Array();
for (var _local10 in mAnimData) {
mAnims[_local10] = new Array();
for (var _local9 in mAnimData[_local10]) {
var _local3 = mAnimData[_local10][_local9].split(" ");
var _local6 = new Array(_local3.length);
var _local5 = new Array(_local3.length);
var _local2 = 0;
while (_local2 < _local3.length) {
var _local4 = _local3[_local2].split(":");
_local6[_local2] = int(int(_local4[0]) + 1);
_local5[_local2] = int(_local4[1]);
_local2++;
}
mAnims[_local10][_local9] = {frames:_local6, delays:_local5};
}
}
}
function GetAnimsForClass(animClass) {
var _local2 = new Array();
for (var _local3 in mAnims[animClass]) {
_local2.push(_local3);
}
return(_local2);
}
function UnloadAnimData() {
for (var _local3 in mAnimData) {
for (var _local2 in mAnimData[_local3]) {
delete mAnimData[_local3][_local2];
}
delete mAnimData[_local3];
}
delete mAnimData;
mAnimData = null;
}
function LoadTiles() {
mTiles = new Array(60);
var _local3 = 0;
while (_local3 < mTiles.length) {
mTiles[_local3] = null;
_local3++;
}
mTiles[0] = {id:0, type:"none", symbol:"none"};
mTiles[1] = {id:1, type:"static", symbol:"dirt", stopsMove:true, isHandOverHandable:false, isBlowupable:true, isClimbable:false, isDiggable:true};
mTiles[2] = {id:2, type:"static", symbol:"rock", stopsMove:true, isHandOverHandable:false, isBlowupable:true, isClimbable:false, isDiggable:false};
mTiles[60] = {id:60, type:"static", symbol:"super_rock", stopsMove:true, isHandOverHandable:false, isBlowupable:false, isClimbable:false, isDiggable:false};
mTiles[3] = {id:3, type:"static", symbol:"ladder", stopsMove:false, isHandOverHandable:false, isBlowupable:false, isClimbable:true, climbType:"ladder", isDiggable:false};
mTiles[4] = {id:4, type:"static", symbol:"escape_ladder", stopsMove:false, isHandOverHandable:false, isBlowupable:false, isClimbable:true, climbType:"ladder", isDiggable:false};
mTiles[5] = {id:5, type:"static", symbol:"ceil_vine", stopsMove:false, isHandOverHandable:true, isBlowupable:false, isClimbable:false, climbType:"ladder", isDiggable:false};
mTiles[8] = {id:8, type:"actor", className:"granny"};
mTiles[9] = {id:9, type:"actor", className:"cat"};
mTiles[10] = {id:10, type:"actor", className:"dog"};
mTiles[11] = {id:11, type:"actor", className:"tiki_man"};
mTiles[12] = {id:12, type:"hidden", className:"enemy_respawn", stopsMove:false, isHandOverHandable:false, isBlowupable:false, isClimbable:false, isDiggable:false};
mTiles[15] = {id:15, type:"actor", className:"exit_flower"};
mTiles[16] = {id:16, type:"actor", className:"meow_gate"};
mTiles[56] = {id:56, type:"hidden", className:"lock_tile", stopsMove:true, isHandOverHandable:false, isBlowupable:false, isClimbable:false, isDiggable:false};
mTiles[55] = {id:55, type:"hidden", className:"hole_filler", stopsMove:true, isHandOverHandable:false, isBlowupable:false, isClimbable:false, isDiggable:false};
mTiles[17] = {id:17, type:"actor", className:"lock"};
mTiles[18] = {id:18, type:"actor", className:"bonus_flower"};
mTiles[19] = {id:19, type:"actor", className:"vine"};
mTiles[27] = {id:27, type:"hidden", className:"vine_segment", stopsMove:false, isHandOverHandable:false, isBlowupable:false, isClimbable:true, climbType:"ladder", isDiggable:false};
mTiles[28] = {id:28, type:"actor", className:"heart"};
mTiles[21] = {id:21, type:"actor", className:"super_bonus_flower"};
mTiles[22] = {id:21, type:"actor", className:"water_can"};
mTiles[25] = {id:21, type:"actor", className:"umbrella"};
mTiles[26] = {id:21, type:"actor", className:"key"};
mTiles[57] = {id:21, type:"actor", className:"bomb"};
_global.TILE_HIDDEN_LADDER = 4;
_global.TILE_CAT = 9;
_global.TILE_TIKIMAN = 11;
_global.TILE_VINE_SEGMENT = 27;
_global.LOCKED_TILE = 56;
_global.HOLE_FILLER = 55;
_global.DIRT_TILE = 1;
_global.TILE_VINE = 19;
_global.TILE_RESPAWN = 12;
}
function doesTileStopMovement(tileType) {
if (!isTileTypeValid(tileType)) {
return(false);
}
if ((!isStaticTile(tileType)) && (!isHiddenTile(tileType))) {
return(false);
}
return(mTiles[tileType].stopsMove);
}
function isTileDiggable(tileType) {
if (!isTileTypeValid(tileType)) {
return(false);
}
if ((!isStaticTile(tileType)) && (!isHiddenTile(tileType))) {
return(false);
}
return(mTiles[tileType].isDiggable);
}
function isTileHandOverHandable(tileType) {
if (!isTileTypeValid(tileType)) {
return(false);
}
if ((!isStaticTile(tileType)) && (!isHiddenTile(tileType))) {
return(false);
}
return(mTiles[tileType].isHandOverHandable);
}
function isTileClimbable(tileType) {
if (!isTileTypeValid(tileType)) {
return(false);
}
if ((!isStaticTile(tileType)) && (!isHiddenTile(tileType))) {
return(false);
}
return(mTiles[tileType].isClimbable);
}
function isTileBlowupable(tileType) {
if (!isTileTypeValid(tileType)) {
return(false);
}
if ((!isStaticTile(tileType)) && (!isHiddenTile(tileType))) {
return(false);
}
return(mTiles[tileType].isBlowupable);
}
function getClimbType(tileType) {
if (!isTileClimbable(tileType)) {
return("");
}
return(mTiles[tileType].climbType);
}
function GetTileTypeName(tileType) {
if (!isTileTypeValid(tileType)) {
return("invalid");
}
if (isStaticTile(tileType) || (isHiddenTile(tileType))) {
return(mTiles[tileType].symbol);
}
if (isEntityTile(tileType)) {
return(mTiles[tileType].className);
}
}
function GetNumTileTypes() {
return(mTiles.length - 1);
}
function isEntityTile(tileType) {
if (!isTileTypeValid(tileType)) {
return(false);
}
return(mTiles[tileType].type == "actor");
}
function isStaticTile(tileType) {
if (!isTileTypeValid(tileType)) {
return(false);
}
return(mTiles[tileType].type == "static");
}
function isHiddenTile(tileType) {
if (!isTileTypeValid(tileType)) {
return(false);
}
return(mTiles[tileType].type == "hidden");
}
function isTileTypeValid(tileType) {
if (tileType < 0) {
return(false);
}
if (tileType >= mTiles.length) {
return(false);
}
return(mTiles[tileType] != null);
}
function CreateEntity(theTileTypeId, theDepth) {
if (!isEntityTile(theTileTypeId)) {
return(null);
}
if (mTiles[theTileTypeId].className == "granny") {
return(new com.sandlot.GrannyInParadise.entity.GrannyEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "cat") {
return(new com.sandlot.GrannyInParadise.entity.CatEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "bonus_flower") {
return(new com.sandlot.GrannyInParadise.entity.BonusFlowerEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "super_bonus_flower") {
return(new com.sandlot.GrannyInParadise.entity.SuperBonusFlowerEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "exit_flower") {
return(new com.sandlot.GrannyInParadise.entity.ExitFlowerEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "meow_gate") {
return(new com.sandlot.GrannyInParadise.entity.MeowGateEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "vine") {
return(new com.sandlot.GrannyInParadise.entity.VineEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "water_can") {
return(new com.sandlot.GrannyInParadise.entity.PickupEntity("water_can", mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "umbrella") {
return(new com.sandlot.GrannyInParadise.entity.PickupEntity("umbrella", mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "key") {
return(new com.sandlot.GrannyInParadise.entity.PickupEntity("key", mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "bomb") {
return(new com.sandlot.GrannyInParadise.entity.PickupEntity("bomb", mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "heart") {
return(new com.sandlot.GrannyInParadise.entity.PickupEntity("heart", mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "lock") {
return(new com.sandlot.GrannyInParadise.entity.LockEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "tiki_man") {
return(new com.sandlot.GrannyInParadise.entity.TikiManEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
if (mTiles[theTileTypeId].className == "dog") {
return(new com.sandlot.GrannyInParadise.entity.DogEntity(mTiles[theTileTypeId].id, mGame, theDepth));
}
return(null);
}
function CreateTile(theTileTypeId, theFrameId, theParentMC, theDepth) {
if (!isStaticTile(theTileTypeId)) {
return(null);
}
var _local3 = mTiles[theTileTypeId].symbol;
if (_local3 == "none") {
return(null);
}
if (theFrameId == 0) {
return(null);
}
if (_local3 == "dirt") {
var _local9 = ((theParentMC._name + "dirt") + theFrameId) + theDepth;
var _local4 = theParentMC.attachMovie("dirt", _local9, theDepth);
_local4.gotoAndStop(theFrameId);
_local4.hole.gotoAndStop(1);
_local4.isDirt = true;
_global.LoadedTileMCCount++;
return(_local4);
}
var _local8 = _local3 + theFrameId;
var _local9 = (theParentMC._name + _local8) + theDepth;
var _local4 = theParentMC.attachMovie(_local8, _local9, theDepth);
_local4.isDirt = false;
_global.LoadedTileMCCount++;
return(_local4);
}
function LoadAnimData() {
mAnimData = new Array();
LoadGrannyAnimData();
LoadCatAnimData();
LoadMeowGateAnimData();
LoadBonusFlowerAnimData();
LoadSuperBonusFlowerAnimData();
LoadExitFlowerAnimData();
LoadPowerupAnimData();
LoadVineAnimData();
LoadLockAnimData();
LoadTikiManAnimData();
LoadDogAnimData();
mAnimData.dirt_chunk = new Array();
mAnimData.dirt_chunk.chunk1 = "0:75 0:75";
mAnimData.dirt_chunk.chunk2 = "1:75 1:75";
mAnimData.dirt_chunk.chunk3 = "2:75 2:75";
mAnimData.dirt_chunk.chunk4 = "3:75 3:75";
mAnimData.rock_chunk = new Array();
mAnimData.rock_chunk.chunk1 = "0:75 0:75";
mAnimData.rock_chunk.chunk2 = "1:75 1:75";
mAnimData.rock_chunk.chunk3 = "2:75 2:75";
mAnimData.rock_chunk.chunk4 = "3:75 3:75";
mAnimData.last_cat = new Array();
mAnimData.last_cat.shine = "0:1 0:20 0:1";
}
function LoadLockAnimData() {
mAnimData.lock = new Array();
mAnimData.lock.locked = "0:20";
mAnimData.lock.unlock = "1:3 2:3 4:3 5:3 6:3 7:2 8:2 9:1 10:1 11:1";
}
function LoadVineAnimData() {
mAnimData.vine = new Array();
mAnimData.vine.idle = "0:10 1:10 2:10";
mAnimData.vine.watering = "0:3 1:3 2:3";
mAnimData.vine.grow_mid = "3:2 4:2 5:2 6:2 7:2 8:2 9:2 10:2";
mAnimData.vine.grow_top = "16:2 17:2 18:2 19:2 20:2 21:2 22:2 23:2";
}
function LoadPowerupAnimData() {
mAnimData.water_can = new Array();
mAnimData.umbrella = new Array();
mAnimData.key = new Array();
mAnimData.bomb = new Array();
mAnimData.heart = new Array();
mAnimData.heart.pop = "0:2 1:2 0:2 1:2 0:2 1:2 2:1 3:1 4:1 5:1 6:1 7:1";
mAnimData.heart.idle = "0:4";
mAnimData.water_can.idle = "0:4 1:4 2:4 3:4 4:4 5:4 6:4 7:4 8:4 9:4 10:4 11:4 12:4 13:4 14:4";
mAnimData.umbrella.idle = "0:4 1:4 2:4 3:4 4:4 5:4 6:4 7:4 8:4 9:4 10:4 11:4 12:4 13:4 14:4";
mAnimData.key.idle = "0:4 1:4 2:4 3:4 4:4 5:4 6:4 7:4 8:4 9:4 10:4 11:4 12:4 13:4 14:4";
mAnimData.key.hold = "0:20";
mAnimData.bomb.idle = "0:4 1:4 2:4 3:4 4:4 5:4 6:4 7:4 8:4 9:4 10:4 11:4 12:4 13:4 14:4";
mAnimData.bomb.tick_idle = "16:2 17:2 18:2 19:2 20:2 16:2 17:2 18:2 19:2 20:2 16:2 17:2 18:2 19:2 20:2 16:2 17:2 18:2 19:2 20:2 16:2 17:2 18:2 19:2 20:2";
}
function LoadSuperBonusFlowerAnimData() {
mAnimData.super_bonus_flower = new Array();
mAnimData.super_bonus_flower.seed = "0:20";
mAnimData.super_bonus_flower.hint = "11:1 12:1 15:1 16:2 15:1 13:2 11:1";
mAnimData.super_bonus_flower.grow = "1:3 2:4 3:4 4:4 5:4 6:4 7:4";
mAnimData.super_bonus_flower.idle = "9:7 10:7";
}
function LoadExitFlowerAnimData() {
mAnimData.exit_flower = new Array();
mAnimData.exit_flower.seed = "0:10";
mAnimData.exit_flower.grow = "1:3 2:3 4:3 5:3 6:3 7:3";
mAnimData.exit_flower.idle = "8:4 9:4 10:4 11:4";
mAnimData.exit_flower.exit = "12:3 13:3 14:3 15:3 16:3 17:3 18:3 19:3 7:3 6:3 5:3 4:3 2:3 1:3 0:20";
}
function LoadCatAnimData() {
mAnimData.cat_orange = new Array();
mAnimData.cat_grey = new Array();
mAnimData.cat_black = new Array();
mAnimData.cat_brown = new Array();
mAnimData.cat_orange.idle = (mAnimData.cat_grey.idle = (mAnimData.cat_black.idle = (mAnimData.cat_brown.idle = "0:3 1:3 2:3 1:3")));
mAnimData.cat_orange.idle_alt = (mAnimData.cat_grey.idle_alt = (mAnimData.cat_black.idle_alt = (mAnimData.cat_brown.idle_alt = "3:3 4:3 5:3 6:3 7:3 8:3 9:3 10:3 11:3 3:3 4:3 5:3 6:3 7:3 8:3 9:3 10:3 11:3 12:3 13:3 14:3 15:3 16:3 17:3 18:3 13:3 14:3 15:3 16:3 17:3 18:3 13:3 14:3 15:3 16:3 17:3 18:3 13:3")));
mAnimData.cat_orange.walk = (mAnimData.cat_grey.walk = (mAnimData.cat_black.walk = (mAnimData.cat_brown.walk = "24:2 25:2 26:2 27:2")));
mAnimData.cat_orange.stand = (mAnimData.cat_grey.stand = (mAnimData.cat_black.stand = (mAnimData.cat_brown.stand = "24:2")));
mAnimData.cat_orange.spawn_in = (mAnimData.cat_grey.spawn_in = (mAnimData.cat_black.spawn_in = (mAnimData.cat_brown.spawn_in = "34:9 33:3 32:3 31:3")));
mAnimData.cat_orange.spawn_out = (mAnimData.cat_grey.spawn_out = (mAnimData.cat_black.spawn_out = (mAnimData.cat_brown.spawn_out = "31:9 32:3 33:3 34:3")));
mAnimData.cat_orange.out_door = (mAnimData.cat_grey.out_door = (mAnimData.cat_black.out_door = (mAnimData.cat_brown.out_door = "28:3 29:3 30:3")));
mAnimData.cat_orange.fall = (mAnimData.cat_grey.fall = (mAnimData.cat_black.fall = (mAnimData.cat_brown.fall = "22:2 23:2")));
mAnimData.cat_orange.land = (mAnimData.cat_grey.land = (mAnimData.cat_black.land = (mAnimData.cat_brown.land = "24:4")));
mAnimData.cat_orange.up_ladder = (mAnimData.cat_grey.up_ladder = (mAnimData.cat_black.up_ladder = (mAnimData.cat_brown.up_ladder = "19:3 20:3 21:3")));
mAnimData.cat_orange.stop_climb_up = (mAnimData.cat_grey.stop_climb_up = (mAnimData.cat_black.stop_climb_up = (mAnimData.cat_brown.stop_climb_up = "20:3")));
mAnimData.cat_orange.down_ladder = (mAnimData.cat_grey.down_ladder = (mAnimData.cat_black.down_ladder = (mAnimData.cat_brown.down_ladder = "35:3 36:3 37:3")));
mAnimData.cat_orange.stop_climb_down = (mAnimData.cat_grey.stop_climb_down = (mAnimData.cat_black.stop_climb_down = (mAnimData.cat_brown.stop_climb_down = "36:3")));
mAnimData.cat_orange.ladder_side = (mAnimData.cat_grey.ladder_side = (mAnimData.cat_black.ladder_side = (mAnimData.cat_brown.ladder_side = "24:2 25:2 26:2 27:2")));
}
function LoadMeowGateAnimData() {
mAnimData.meow_gate = new Array();
mAnimData.meow_gate.idle = "0:5 1:5 2:5 3:5 4:5";
}
function LoadBonusFlowerAnimData() {
mAnimData.bonus_flower = new Array();
mAnimData.bonus_flower.seed = "0:10";
mAnimData.bonus_flower.grow = "1:3 2:3";
mAnimData.bonus_flower.blue = "3:10";
mAnimData.bonus_flower.pink = "4:10";
mAnimData.bonus_flower.yellow = "5:10";
mAnimData.bonus_flower.blue_die = "8:3 11:3";
mAnimData.bonus_flower.pink_die = "9:3 11:3";
mAnimData.bonus_flower.yellow_die = "10:3 11:3";
}
function LoadGrannyAnimData() {
mAnimData.granny = new Array();
mAnimData.granny.walk = "0:4 1:3 2:4 1:3";
mAnimData.granny.stand = "1:2";
mAnimData.granny.idle = "112:120 113:3 114:3 115:20 117:6 116:20 117:8 118:20 117:8 116:20 117:6 118:20 117:20 115:4 114:4 113:4";
mAnimData.granny.up_ladder = "5:4 6:2 7:4 6:2";
mAnimData.granny.stop_climb_up = "8:2";
mAnimData.granny.stop_climb_down = "10:2";
mAnimData.granny.up_vine = "7:4 8:2 9:4 8:2";
mAnimData.granny.down_ladder = "10:4 11:3";
mAnimData.granny.down_vine = "12:4 13:3";
mAnimData.granny.ladder_side = "124:2 125:2 126:2 127:2 128:2";
mAnimData.granny.bars_walk = "17:6 18:5 19:6 18:5";
mAnimData.granny.bars_idle = "20:5";
mAnimData.granny.bars_stand = "20:5";
mAnimData.granny.fall = "23:3 61:3 24:3";
mAnimData.granny.land = "25:2 26:10 27:3";
mAnimData.granny.dig = "28:2 29:3 30:3 1:2";
mAnimData.granny.pickup = "31:3 32:5";
mAnimData.granny.umbrella_idle = "41:4";
mAnimData.granny.umbrella_walk = "39:2 37:2 40:2";
mAnimData.granny.umbrella_stand = "37:2";
mAnimData.granny.umbrella_float = "41:4";
mAnimData.granny.umbrella_unfold = "134:5 135:3 136:5";
mAnimData.granny.umbrella_float = "137:7 138:3";
mAnimData.granny.key_idle = "41:4";
mAnimData.granny.key_walk = "41:4 42:4 43:2";
mAnimData.granny.key_stand = "41:4";
mAnimData.granny.key_throw = "44:10";
mAnimData.granny.die = "147:3 148:3 159:3 150:3 153:15 151:5 152:5 151:4 152:4 151:3 152:3 153:20";
mAnimData.granny.dead = "153:4";
mAnimData.granny.spawn_in = "80:2 81:2 83:2 84:2 85:2 86:2 87:20";
mAnimData.granny.water_can_walk = "88:4 89:3 90:4 89:3";
mAnimData.granny.water_can_stand = "89:2";
mAnimData.granny.water_can_idle = "91:4";
mAnimData.granny.bomb_walk = "103:4 104:3 105:4";
mAnimData.granny.bomb_stand = "106:4";
mAnimData.granny.bomb_idle = "106:4";
mAnimData.granny.bomb_placing = "107:4 108:3";
mAnimData.granny.item_disappear = "144:3 145:3 146:3";
mAnimData.granny.skid = "3:2 4:3";
mAnimData.granny.dead_warpout = "71:2 72:2 73:2 74:2 75:2 76:2 77:2 78:2 79:10";
mAnimData.granny.umbrella_up_ladder = "129:4 130:2 131:4 130:2";
mAnimData.granny.umbrella_down_ladder = "132:4 133:3";
mAnimData.granny.umbrella_stop_climb_up = "129:2";
mAnimData.granny.umbrella_stop_climb_down = "132:2";
mAnimData.granny.water_can_up_ladder = "119:4 120:2 121:4 120:2";
mAnimData.granny.water_can_down_ladder = "122:4 123:3";
mAnimData.granny.water_can_stop_climb_up = "119:2";
mAnimData.granny.water_can_stop_climb_down = "122:2";
mAnimData.granny.key_up_ladder = "144:4 145:2 146:4 145:2";
mAnimData.granny.key_down_ladder = "147:4 148:3";
mAnimData.granny.bomb_up_ladder = "139:4 140:2 141:4 140:2";
mAnimData.granny.bomb_down_ladder = "142:4 143:3";
mAnimData.granny.bomb_stop_climb_up = "139:2";
mAnimData.granny.bomb_stop_climb_down = "142:2";
}
function LoadDogAnimData() {
mAnimData.dog = new Array();
mAnimData.dog.idle = "9:3 10:3 9:3 10:3 9:3 10:3 9:3 10:3";
mAnimData.dog.walk = "0:3 1:3 2:3";
mAnimData.dog.stand = "0:3";
mAnimData.dog.run = "3:2 4:2 5:2 6:2";
mAnimData.dog.squished = "10:3 11:3";
mAnimData.dog.spawn_in = "14:3 15:3 16:3 17:3 9:4 10:4 9:3 10:3";
mAnimData.dog.attack = "3:3 5:4";
mAnimData.dog.land = "14:3 15:3 16:3 17:3 18:3";
mAnimData.dog.fall = "12:3 13:3";
mAnimData.dog.hold = "13:3";
mAnimData.dog.die = "18:3 19:30 20:3 21:3 22:3";
}
function LoadTikiManAnimData() {
mAnimData.tiki_man = new Array();
mAnimData.tiki_man.walk = "0:2 1:2 2:2 3:2 4:2 5:2 6:2 7:2 8:2";
mAnimData.tiki_man.stand = "0:2";
mAnimData.tiki_man.idle = "41:4 42:4 43:4 44:8 45:4 46:4 45:4 46:4 45:4 44:4 43:4 42:4 41:4";
mAnimData.tiki_man.up_ladder = "9:4 10:2 11:4 10:2";
mAnimData.tiki_man.stop_climb_up = "9:4";
mAnimData.tiki_man.down_ladder = "75:3 76:3";
mAnimData.tiki_man.stop_climb_down = "75:4";
mAnimData.tiki_man.down_vine = "120:1";
mAnimData.tiki_man.land = "70:3 71:3 72:3 73:3 74:3";
mAnimData.tiki_man.top_ladder = "120:1";
mAnimData.tiki_man.die = "12:3 13:3 14:3 15:3 16:2 17:2 18:2 19:2 20:2 21:2 22:2 21:2 22:2 23:20";
mAnimData.tiki_man.spawn_in = "24:4 25:4 26:4 27:4 28:4 29:4 30:5 31:5 32:7 33:7";
mAnimData.tiki_man.hold = "34:3";
mAnimData.tiki_man.shove = "52:6 53:3 54:3 55:3 53:3 55:3 56:4";
mAnimData.tiki_man.kick = "57:3 58:4 59:4 60:2 61:2 62:3 57:3";
mAnimData.tiki_man.fall = "64:3 65:3 66:3 67:3 68:3 69:3";
mAnimData.tiki_man.ladder_side = "77:3 78:3 79:3 80:3 81:3";
}
}
Symbol 2102 MovieClip [__Packages.com.sandlot.GrannyInParadise.SpriteListener] Frame 0
class com.sandlot.GrannyInParadise.SpriteListener
{
function SpriteListener () {
}
function onAnimStopped(theSprite, animName) {
}
}
Symbol 2103 MovieClip [__Packages.com.sandlot.GrannyInParadise.Sprite] Frame 0
class com.sandlot.GrannyInParadise.Sprite
{
var mParentMC, mSpriteClass, mListener, mGameFactory, mMC, mXPercent, mYPercent, mIsShowing, mFrame, mAnim, mAnimName, mDelay, mIters, mIsStopped, mFlipped, mLoop;
function Sprite (spriteClass, gameFactory, parentMC, depth, listener) {
mParentMC = parentMC;
mSpriteClass = spriteClass;
mListener = listener;
mGameFactory = gameFactory;
mMC = parentMC.attachMovie(mSpriteClass, mSpriteClass + depth, depth);
mXPercent = (mYPercent = 0);
Reset();
}
function Show(showing) {
mIsShowing = showing;
mMC._visible = mIsShowing;
}
function GetSpriteClass() {
return(mSpriteClass);
}
function Reset() {
StopAnim();
mFrame = 0;
mAnim = null;
mAnimName = "";
mDelay = 0;
mIters = 0;
mIsStopped = true;
mFlipped = false;
mIsShowing = true;
Reshape();
}
function StepAnim() {
if (((mAnim == null) || (mIsStopped)) || (!mIsShowing)) {
return(undefined);
}
if ((!mLoop) && (mIters <= 0)) {
StopAnim();
mListener.onAnimStopped(this, mAnimName);
return(undefined);
}
if (mDelay <= 0) {
mFrame = int((mFrame + 1) % mAnim.frames.length);
mDelay = mAnim.delays[mFrame];
} else {
mDelay--;
}
SetFrame();
if ((!mLoop) && (mFrame == (mAnim.frames.length - 1))) {
mIters--;
}
}
function Unload() {
Reset();
mMC.removeMovieClip();
}
function StopAnim() {
mMC.frames.stop();
mIsStopped = true;
}
function SetFrame() {
mMC.frames.gotoAndStop(mAnim.frames[mFrame]);
}
function Reshape() {
mMC._xscale = mGameFactory.currScaleFactorX * 100;
mMC._yscale = mGameFactory.currScaleFactorY * 100;
if ((mFlipped && (mMC.frames._xscale >= 0)) || ((!mFlipped) && (mMC.frames._xscale < 0))) {
mMC.frames._xscale = -mMC.frames._xscale;
}
mMC._x = Math.ceil((mXPercent * Stage.width) + 0.05);
mMC._y = Math.ceil((mYPercent * Stage.height) + 0.05);
}
function SetPosition(xPos, yPos) {
mXPercent = xPos;
mYPercent = yPos;
mMC._x = Math.ceil((mXPercent * Stage.width) + 0.5);
mMC._y = Math.ceil((mYPercent * Stage.height) + 0.5);
}
function Play(animName, startFrame, iters, loop, flipped) {
if (!mGameFactory.isAnimValid(mSpriteClass, animName)) {
trace((("Invalid anim: " + animName) + " on class: ") + mSpriteClass);
return(undefined);
}
Reset();
mFlipped = flipped;
mAnimName = animName;
mAnim = mGameFactory.GetAnim(mSpriteClass, mAnimName);
mFrame = startFrame;
mDelay = mAnim.delays[mFrame];
mIters = iters;
mLoop = loop;
SetFrame();
mIsStopped = false;
if ((mFlipped && (mMC.frames._xscale >= 0)) || ((!mFlipped) && (mMC.frames._xscale < 0))) {
mMC.frames._xscale = -mMC.frames._xscale;
}
}
}
Symbol 2104 MovieClip [__Packages.com.sandlot.GrannyInParadise.LevelEntity] Frame 0
class com.sandlot.GrannyInParadise.LevelEntity extends com.sandlot.GrannyInParadise.SpriteListener
{
var mMessageId, mGame, mClassName, mSprite, mTileType, mSpawnCol, mSpawnRow, mLastColPos, mLastRowPos, mRowPos, mColPos, mDir, mLastState, mState, mIsCollidable;
function LevelEntity (spriteClass, tileType, theGame, depth) {
super();
mMessageId = depth;
mGame = theGame;
mClassName = spriteClass;
mSprite = new com.sandlot.GrannyInParadise.Sprite(spriteClass, mGame.mGameFactory, mGame.mEntityTiles, depth, this);
mTileType = tileType;
mSpawnCol = (mSpawnRow = (mLastColPos = (mLastRowPos = (mRowPos = (mColPos = 0)))));
mDir = _global.DIR_RIGHT;
mLastState = (mState = _global.STATE_NONE);
mIsCollidable = true;
}
function SetDepth(depth) {
mSprite.mMC.swapDepths(depth);
}
function GetMainMovieClip() {
return(mSprite.mMC);
}
function SetCollidable(collidable) {
mIsCollidable = collidable;
}
function IsCollidable() {
return(mIsCollidable);
}
function CollidesWithPoint(row, col) {
var _local2 = (mRowPos + 0.5) - (row + 0.5);
var _local3 = (mColPos + 0.5) - (col + 0.5);
var _local4 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
return(_local4 <= 0.5);
}
function CollidesWith(ent) {
return(CollidesWithPoint(ent.mRowPos, ent.mColPos));
}
function OnCollision(ent) {
}
function setGoingLeft(go) {
mDir = (go ? (mDir | _global.DIR_LEFT) : (mDir & (~_global.DIR_LEFT)));
if (_global.isGoingRight(mDir) && (_global.isGoingLeft(mDir))) {
setGoingRight(false);
}
}
function setGoingRight(go) {
mDir = (go ? (mDir | _global.DIR_RIGHT) : (mDir & (~_global.DIR_RIGHT)));
if (_global.isGoingRight(mDir) && (_global.isGoingLeft(mDir))) {
setGoingLeft(false);
}
}
function setGoingUp(go) {
mDir = (go ? (mDir | _global.DIR_UP) : (mDir & (~_global.DIR_UP)));
if (_global.isGoingUp(mDir) && (_global.isGoingDown(mDir))) {
setGoingDown(false);
}
}
function setGoingDown(go) {
mDir = (go ? (mDir | _global.DIR_DOWN) : (mDir & (~_global.DIR_DOWN)));
if (_global.isGoingUp(mDir) && (_global.isGoingDown(mDir))) {
setGoingUp(false);
}
}
function resetDir() {
mDir = _global.DIR_NONE;
}
function onAnimStopped(theSprite, animName) {
}
function GetClassName() {
return(mClassName);
}
function Reshape() {
mSprite.Reshape();
}
function Update() {
UpdateState(mState);
mSprite.StepAnim();
var _local3 = (mGame.mTileMap.GetScreenXPercent(mColPos) + mSprite.mXPercent) / 2;
var _local2 = (mGame.mTileMap.GetScreenYPercent(mRowPos) + mSprite.mYPercent) / 2;
mSprite.SetPosition(_local3, _local2);
}
function EnterState(state) {
}
function ExitState(state) {
}
function UpdateState(state) {
}
function UpdateSpritePosition() {
mSprite.SetPosition(mGame.mTileMap.GetScreenXPercent(mColPos), mGame.mTileMap.GetScreenYPercent(mRowPos));
}
function SetState(newState) {
if (newState == mState) {
return(undefined);
}
ExitState(mState);
mLastState = mState;
mState = newState;
EnterState(mState);
}
function Move(rowDelta, colDelta) {
return(SetPos(mRowPos + rowDelta, mColPos + colDelta));
}
function ResetPos() {
mRowPos = mLastRowPos;
mColPos = mLastColPos;
}
function SetPos(row, col) {
if (!mGame.mTileMap.inMapDataBounds(row, col)) {
trace(((((("Couldn't place Entity: " + mSprite.GetSpriteClass()) + " at: ") + row) + " col ") + col) + " Out of bounds!");
return(false);
}
mLastColPos = mColPos;
mLastRowPos = mRowPos;
mRowPos = row;
mColPos = col;
return(true);
}
function Show(showing) {
mSprite.Show(showing);
}
function Unload() {
mSprite.Unload();
delete mSprite;
mSprite = null;
}
function SetSpawnPos(spawnRow, spawnCol) {
mSpawnRow = spawnRow;
mSpawnCol = spawnCol;
SetPos(spawnRow, spawnCol);
UpdateSpritePosition();
}
function Respawn() {
SetPos(mSpawnRow, mSpawnCol);
UpdateSpritePosition();
Show(true);
}
function Spawn() {
}
}
Symbol 2105 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.ActorEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.ActorEntity extends com.sandlot.GrannyInParadise.LevelEntity
{
var mWalkSpeed, mClimbSpeed, mFallSpeed, mMoveRow, mMoveCol, mClimbingOn, mThrusts, mPathColor, mPathAlpha, mPathPosMC, mGame, mClassName, SetState, setGoingUp, setGoingDown, mDir, mRowPos, mColPos, mState, Move, ResetPos, setGoingRight, setGoingLeft, mSprite;
function ActorEntity (spriteClass, tileType, theGame, theDepth) {
super(spriteClass, tileType, theGame, theDepth);
mWalkSpeed = 0.1;
mClimbSpeed = 0.08;
mFallSpeed = 0.12;
mMoveRow = (mMoveCol = 0);
mClimbingOn = "ladder";
mThrusts = new Array(4);
var _local3 = 0;
while (_local3 < 4) {
mThrusts[_local3] = false;
_local3++;
}
mPathColor = 16711680 /* 0xFF0000 */;
mPathAlpha = 50;
mPathPosMC = mGame.mGridOverlay.createEmptyMovieClip(mClassName + theDepth, theDepth);
}
function ResetThrusts() {
var _local2 = 0;
while (_local2 < 4) {
mThrusts[_local2] = false;
_local2++;
}
}
function Spawn() {
SetState(_global.STATE_SPAWN);
}
function PlayLandSound() {
}
function SetWalkSpeed(speed) {
mWalkSpeed = speed;
}
function SetClimbSpeed(speed) {
mClimbSpeed = speed;
}
function SetFallSpeed(speed) {
mFallSpeed = speed;
}
function EnterState(state) {
switch (state) {
case _global.STATE_SPAWN :
PlaySpawnAnim();
break;
case _global.STATE_WALKING :
setGoingUp(false);
setGoingDown(false);
PlayWalkAnim();
mMoveCol = (_global.isGoingLeft(mDir) ? (-mWalkSpeed) : (mWalkSpeed));
mMoveRow = 0;
break;
case _global.STATE_CLIMBING_STOPPED :
PlayCimbStopAnim();
break;
case _global.STATE_CLIMBING :
PlayClimbAnim();
mMoveRow = (_global.isGoingUp(mDir) ? (-mClimbSpeed) : (mClimbSpeed));
break;
case _global.STATE_FALLING :
PlayFallAnim();
mMoveRow = mFallSpeed;
mMoveCol = 0;
var _local3 = mGame.mTileMap.GetPosOnTopOf(mRowPos, mColPos);
mRowPos = _local3.row;
mColPos = _local3.col;
break;
case _global.STATE_LANDING :
setGoingUp(false);
setGoingDown(false);
PlayLandAnim();
PlayLandSound();
break;
case _global.STATE_IDLE :
PlayIdleAnim();
break;
case _global.STATE_STANDING :
setGoingUp(false);
setGoingDown(false);
PlayStandAnim();
break;
case _global.STATE_LADDER_SIDE :
PlayClimbSideAnim();
break;
case _global.STATE_HAND_OVER_HAND_HANG :
PlayHandOverHandHangAnim();
mMoveCol = 0;
mMoveRow = 0;
break;
case _global.STATE_HAND_OVER_HAND :
PlayHandOverHandAnim();
setGoingUp(false);
setGoingDown(false);
mMoveCol = (_global.isGoingLeft(mDir) ? (-mWalkSpeed) : (mWalkSpeed));
mMoveRow = 0;
}
}
function UpdateState(state) {
switch (mState) {
case _global.STATE_FALLING :
if (FellOffScreen()) {
onFellOffScreen();
}
if (!FinishedFalling()) {
Move(mMoveRow, mMoveCol);
}
break;
case _global.STATE_IDLE :
case _global.STATE_STANDING :
if (StartedFalling()) {
} else if (StartedHandOverHand()) {
trace("Hand over hand from standing");
} else if (StartedWalking()) {
} else if (StartedClimbing()) {
}
if (CheckForStuckInWall()) {
ResetPos();
}
break;
case _global.STATE_HAND_OVER_HAND_HANG :
if (mThrusts[_global.THRUST_DOWN] == true) {
SetState(_global.STATE_FALLING);
} else if (StartedWalking()) {
} else if (StartedHandOverHand()) {
} else if (StartedStanding(true)) {
}
break;
case _global.STATE_HAND_OVER_HAND :
if (mThrusts[_global.THRUST_DOWN] == true) {
SetState(_global.STATE_FALLING);
} else if (StartedHandOverHand() == false) {
if (StartedStanding(true) == false) {
SetState(_global.STATE_HAND_OVER_HAND_HANG);
}
} else if (StartedWalking()) {
} else {
Move(mMoveRow, mMoveCol);
}
if (CheckForStuckInWall()) {
ResetPos();
}
break;
case _global.STATE_WALKING :
if (StartedFalling() == true) {
} else if (StartedHandOverHand()) {
trace("Hand over hand");
} else if (StartedWalking() == false) {
SetState(_global.STATE_STANDING);
} else {
Move(mMoveRow, mMoveCol);
}
if (CheckForStuckInWall()) {
ResetPos();
}
break;
case _global.STATE_CLIMBING_STOPPED :
if (StartedSideOffLadder()) {
trace("Side off ladder from stop!");
} else if (StartedWalking()) {
} else if (StartedStanding(false)) {
} else if (StartedClimbing()) {
}
break;
case _global.STATE_CLIMBING :
if (StartedFalling()) {
} else if (StartedStanding(false)) {
} else if (StartedSideOffLadder()) {
trace("Side off ladder from clibming!");
} else if (StartedClimbing() == false) {
SetState(_global.STATE_CLIMBING_STOPPED);
} else {
Move(mMoveRow, mMoveCol);
}
if (!CheckForStuckInWall()) {
break;
}
ResetPos();
}
}
function onFellOffScreen() {
trace("ACTOR FELL OFF THE SCREEN!");
}
function ExitState(state) {
switch (state) {
case _global.STATE_WALKING :
case _global.STATE_CLIMBING :
mMoveCol = 0;
mMoveRow = 0;
}
super.ExitState(state);
}
function onAnimStopped(theSprite, animName) {
switch (mState) {
case _global.STATE_WALKING :
SetState(_global.STATE_STANDING);
break;
case _global.STATE_STANDING :
PlayStandAnim();
break;
case _global.STATE_HAND_OVER_HAND :
SetState(_global.STATE_HAND_OVER_HAND_HANG);
break;
case _global.STATE_HAND_OVER_HAND_HANG :
PlayHandOverHandHangAnim();
break;
case _global.STATE_CLIMBING :
SetState(_global.STATE_CLIMBING_STOPPED);
break;
case _global.STATE_IDLE :
PlayIdleAnim();
break;
case _global.STATE_SPAWN :
SetState(_global.STATE_IDLE);
break;
case _global.STATE_LANDING :
SetState(_global.STATE_STANDING);
break;
case _global.STATE_LADDER_SIDE :
SetState(_global.STATE_FALLING);
}
}
function Update() {
super.Update();
}
function FellOffScreen() {
if ((mRowPos + 0.5) >= (mGame.mTileMap.mMapDataRows - 1)) {
return(true);
}
return(false);
}
function MoveUp(doMove) {
mThrusts[_global.THRUST_UP] = doMove;
if (doMove) {
mThrusts[_global.THRUST_DOWN] = false;
mThrusts[_global.THRUST_RIGHT] = false;
mThrusts[_global.THRUST_LEFT] = false;
}
}
function MoveDown(doMove) {
mThrusts[_global.THRUST_DOWN] = doMove;
if (doMove) {
mThrusts[_global.THRUST_UP] = false;
mThrusts[_global.THRUST_RIGHT] = false;
mThrusts[_global.THRUST_LEFT] = false;
}
}
function MoveLeft(doMove) {
mThrusts[_global.THRUST_LEFT] = doMove;
if (doMove) {
mThrusts[_global.THRUST_DOWN] = false;
mThrusts[_global.THRUST_RIGHT] = false;
mThrusts[_global.THRUST_RIGHT] = false;
}
}
function MoveRight(doMove) {
mThrusts[_global.THRUST_RIGHT] = doMove;
if (doMove) {
mThrusts[_global.THRUST_DOWN] = false;
mThrusts[_global.THRUST_UP] = false;
mThrusts[_global.THRUST_LEFT] = false;
}
}
function StartedSideOffLadder() {
var _local3 = 0;
if (mThrusts[_global.THRUST_RIGHT] == true) {
if (HasEdge("LR", false) == false) {
return(false);
}
setGoingRight(true);
_local3 = 1;
} else if (mThrusts[_global.THRUST_LEFT] == true) {
if (HasEdge("LL", false) == false) {
return(false);
}
setGoingLeft(true);
_local3 = -1;
} else {
return(false);
}
mRowPos = mGame.mPathMgr.SnapRow(mRowPos);
mColPos = mGame.mPathMgr.SnapCol(mColPos) + _local3;
SetState(_global.STATE_LADDER_SIDE);
return(true);
}
function FinishedFalling() {
if (HasEdge("S", false) == true) {
mRowPos = mGame.mPathMgr.SnapRow(mRowPos);
mColPos = mGame.mPathMgr.SnapCol(mColPos);
SetState(_global.STATE_LANDING);
return(true);
}
return(false);
}
function StartedFalling() {
if ((HasEdge("F", false) == false) && (HasEdge("HF", false) == false)) {
return(false);
}
mColPos = mGame.mPathMgr.SnapCol(mColPos);
SetState(_global.STATE_FALLING);
return(true);
}
function StartedClimbing() {
if (mThrusts[_global.THRUST_UP] == true) {
if (HasEdge("U", true) == false) {
return(false);
}
setGoingUp(true);
} else if (mThrusts[_global.THRUST_DOWN] == true) {
if (HasEdge("D", true) == false) {
return(false);
}
setGoingDown(true);
} else {
return(false);
}
mColPos = mGame.mPathMgr.SnapCol(mColPos);
SetState(_global.STATE_CLIMBING);
return(true);
}
function StartedHandOverHand() {
if (mThrusts[_global.THRUST_RIGHT] == true) {
setGoingRight(true);
if (HasEdge("HR", true) == false) {
return(false);
}
} else if (mThrusts[_global.THRUST_LEFT] == true) {
setGoingLeft(true);
if (HasEdge("HL", true) == false) {
return(false);
}
} else {
return(false);
}
mRowPos = mGame.mPathMgr.SnapRow(mRowPos);
SetState(_global.STATE_HAND_OVER_HAND);
return(true);
}
function StartedStanding(fromHandOverHand) {
var _local3;
if (fromHandOverHand == true) {
trace("Forcing leftrightok");
_local3 = true;
} else {
_local3 = (mThrusts[_global.THRUST_RIGHT] == false) && (mThrusts[_global.THRUST_LEFT] == false);
}
if ((((mThrusts[_global.THRUST_DOWN] == false) && (_local3 == true)) && (HasEdge("D", false) == true)) && (HasEdge("U", false) == false)) {
mRowPos = mGame.mPathMgr.SnapRow(mRowPos);
mColPos = mGame.mPathMgr.SnapRow(mColPos);
SetState(_global.STATE_STANDING);
return(true);
}
if (((mThrusts[_global.THRUST_DOWN] == true) && (HasEdge("D", true) == false)) && ((HasEdge("L", false) == true) || (HasEdge("R", false) == true))) {
mRowPos = mGame.mPathMgr.SnapRow(mRowPos);
mColPos = mGame.mPathMgr.SnapRow(mColPos);
SetState(_global.STATE_STANDING);
return(true);
}
return(false);
}
function CheckForStuckInWall() {
var _local3 = mGame.mPathMgr.SnapRow(mRowPos);
var _local4 = mGame.mPathMgr.SnapRow(mColPos);
var _local5 = mGame.mTileMap.Collides(_global.DIR_NONE, _local3, _local4);
if (mGame.mGameFactory.doesTileStopMovement(_local5.type)) {
trace(mClassName + " ACTOR STUCK IN WALL!!!");
return(true);
}
return(false);
}
function StartedWalking() {
var _local5 = mDir;
if (mThrusts[_global.THRUST_RIGHT] == true) {
setGoingRight(true);
if ((HasEdge("R", true) == false) && (HasEdge("LR", true) == false)) {
return(false);
}
} else if (mThrusts[_global.THRUST_LEFT] == true) {
setGoingLeft(true);
if ((HasEdge("L", true) == false) && (HasEdge("LL", true) == false)) {
return(false);
}
} else {
return(false);
}
mRowPos = mGame.mPathMgr.SnapRow(mRowPos);
mMoveCol = (_global.isGoingLeft(mDir) ? (-mWalkSpeed) : (mWalkSpeed));
var _local3 = mSprite.mFrame;
var _local4 = mSprite.mDelay;
PlayWalkAnim();
mSprite.mFrame = _local3;
mSprite.mDelay = _local4;
mSprite.SetFrame();
SetState(_global.STATE_WALKING);
return(true);
}
function GetThrustModifiedCol() {
if (mThrusts[_global.THRUST_LEFT] == true) {
if (mGame.mPathMgr.NodeHasEdgeOfType(mRowPos, Math.min(mColPos + 0.5, mGame.mTileMap.mMapDataCols - 1), "L")) {
return(Math.min(mColPos + 0.5, mGame.mTileMap.mMapDataCols - 1));
}
} else if (mThrusts[_global.THRUST_RIGHT] == true) {
if (mGame.mPathMgr.NodeHasEdgeOfType(mRowPos, Math.max(mColPos - 0.5, 0), "R")) {
return(Math.max(mColPos - 0.5, 0));
}
}
return(mColPos);
}
function GetThrustModifiedRow() {
if (mThrusts[_global.THRUST_UP] == true) {
if (mGame.mPathMgr.NodeHasEdgeOfType(mRowPos, mColPos, "U") && (mGame.mPathMgr.NodeHasEdgeOfType(mRowPos, mColPos, "D"))) {
return(Math.min(mRowPos + 0.5, mGame.mTileMap.mMapDataRows - 1));
}
} else if (mThrusts[_global.THRUST_DOWN] == true) {
if (mGame.mPathMgr.NodeHasEdgeOfType(mRowPos, mColPos, "U")) {
return(Math.max(mRowPos - 0.5, 0));
}
}
return(mRowPos);
}
function UpdatePathPosition() {
mGame.mPathMgr.HighlightPathNode(mPathPosMC, GetThrustModifiedRow(), GetThrustModifiedCol(), mPathColor, mPathAlpha);
}
function NeighborHasEdge(neighbor, label, thrustMod) {
if (thrustMod == true) {
return(mGame.mPathMgr.NeighborHasEdgeOfType(mRowPos, mColPos, neighbor, label));
}
return(mGame.mPathMgr.NeighborHasEdgeOfType(mRowPos, mColPos, neighbor, label));
}
function HasEdge(label, thrustMod) {
if (thrustMod == true) {
return(mGame.mPathMgr.NodeHasEdgeOfType(GetThrustModifiedRow(), GetThrustModifiedCol(), label));
}
return(mGame.mPathMgr.NodeHasEdgeOfType(mRowPos, mColPos, label));
}
function PlaySpawnAnim() {
mSprite.Play("spawn_in", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayHandOverHandHangAnim() {
mSprite.Play("bars_stand", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayHandOverHandAnim() {
mSprite.Play("bars_walk", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayWalkAnim() {
mSprite.Play("walk", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayIdleAnim() {
mSprite.Play("idle", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayStandAnim() {
mSprite.Play("stand", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayClimbAnim() {
mSprite.Play((_global.isGoingUp(mDir) ? "up_" : "down_") + mClimbingOn, 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayClimbSideAnim() {
mSprite.Play("ladder_side", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayCimbStopAnim() {
mSprite.Play("stop_climb" + (_global.isGoingUp(mDir) ? "_up" : "_down"), 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayFallAnim() {
mSprite.Play("fall", 0, 1, true, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayLandAnim() {
mSprite.Play("land", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
}
Symbol 2106 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.GrannyEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.GrannyEntity extends com.sandlot.GrannyInParadise.entity.ActorEntity
{
var mDoAction, mLastDoAction, mDigCount, mPowerup, mWalkSpeed, mClimbSpeed, mFallSpeed, mUmbrellaFloatSpeed, mUmbrellaFallSpeed, mLockEnt, mPowerupCounter, mPowerupSprite, mDeadReason, mCurrentHole, mGame, GetMainMovieClip, SetState, ResetPos, mSprite, mColPos, mRowPos, mDir, mMoveRow, mState, mLastState, StartedHandOverHand, StartedWalking, StartedClimbing, FinishedFalling, mThrusts, Move, CheckForStuckInWall, HasEdge, mCollisions, mClimbingOn;
function GrannyEntity (tileType, theGame, theDepth) {
super("granny", tileType, theGame, theDepth);
mDoAction = false;
mLastDoAction = false;
mDigCount = 0;
mPowerup = null;
mWalkSpeed = 0.15;
mClimbSpeed = 0.1;
mFallSpeed = 0.12;
mUmbrellaFloatSpeed = 0.1;
mUmbrellaFallSpeed = 0.06;
mLockEnt = null;
mPowerupCounter = null;
mPowerupSprite = null;
mDeadReason = "";
mCurrentHole = null;
}
function PlayLandSound() {
mGame.mGameFactory.onSoundQueue(_global.GRANNY_LAND);
}
function onFellOffScreen() {
trace("Granny FELL OFF THE SCREEN!");
mGame.OnGrannyDie("falldie");
}
function Unload() {
super.Unload();
if (mPowerupCounter != null) {
mPowerupCounter.Stop();
}
}
function StartCounter() {
mPowerupCounter = new com.sandlot.GrannyInParadise.Counter(GetMainMovieClip(), 30, 1000, this);
}
function onCounterFinished(counter) {
trace("Counter finished");
counter.Stop();
if (mPowerup != null) {
if (mPowerup.mClassName == "key") {
mPowerupSprite.Unload();
}
if (mPowerup.mClassName == "umbrella") {
mGame.mGameFactory.StopSound(_global.UMBRELLA_WIND);
}
mPowerupCounter = null;
mGame.Respawn(mPowerup);
mPowerup = null;
SetState(_global.STATE_ITEM_POOF);
mGame.onGameEvent("item_timeout");
}
}
function Pickup(pickup) {
if (mPowerup != null) {
mPowerupCounter.Stop();
mGame.Respawn(mPowerup);
mPowerup = null;
}
if (pickup instanceof com.sandlot.GrannyInParadise.entity.PickupEntity) {
mPowerup = com.sandlot.GrannyInParadise.entity.PickupEntity(pickup);
mGame.RemoveEntity(pickup);
StartCounter();
trace(("Granny has the " + pickup.mClassName) + " !!");
mGame.onGameEvent("picked_up_item");
}
}
function OnCollision(ent) {
switch (ent.mClassName) {
case "water_can" :
Pickup(ent);
trace("Granny has the water can!!");
break;
case "umbrella" :
Pickup(ent);
trace("Granny has the umbrella !!");
break;
case "lock" :
trace("Granny Hit the LOCK!!");
if ((mPowerup != null) && (mPowerup.mClassName == "key")) {
mLockEnt = com.sandlot.GrannyInParadise.entity.LockEntity(ent);
SetState(_global.STATE_THROW_KEY);
} else {
ResetPos();
}
break;
case "key" :
Pickup(ent);
mPowerupSprite = new com.sandlot.GrannyInParadise.Sprite("key", mSprite.mGameFactory, mSprite.mParentMC, mSprite.mGameFactory.GetNextValidEntityDepth(), this);
mPowerupSprite.Play("hold", 0, 1, true, false);
mPowerupSprite.SetPosition(mGame.mTileMap.GetScreenXPercent(mColPos), mGame.mTileMap.GetScreenYPercent(mRowPos - 0.5));
break;
case "bomb" :
Pickup(ent);
break;
case "heart" :
mGame.EmitBonusHeart(ent.mRowPos, ent.mColPos);
mGame.RemoveEntity(ent);
break;
case "bonus_flower" :
if (!com.sandlot.GrannyInParadise.entity.BonusFlowerEntity(ent).IsSprouted()) {
com.sandlot.GrannyInParadise.entity.BonusFlowerEntity(ent).Sprout();
mGame.onSproutedBonusFlower(com.sandlot.GrannyInParadise.entity.BonusFlowerEntity(ent));
}
break;
case "super_bonus_flower" :
if (mGame.CanSproutSuperBonusFlower() && (!com.sandlot.GrannyInParadise.entity.SuperBonusFlowerEntity(ent).IsSprouted())) {
com.sandlot.GrannyInParadise.entity.SuperBonusFlowerEntity(ent).Sprout();
mGame.onSproutedSuperBonusFlower(com.sandlot.GrannyInParadise.entity.SuperBonusFlowerEntity(ent));
}
break;
case "vine" :
if (((mPowerup != null) && (mPowerup.mClassName == "water_can")) && (!com.sandlot.GrannyInParadise.entity.VineEntity(ent).IsWatered())) {
mGame.mNumVineSegs--;
mGame.Respawn(mPowerup);
mPowerup = null;
if (mPowerupCounter != null) {
mPowerupCounter.Stop();
}
com.sandlot.GrannyInParadise.entity.VineEntity(ent).Water();
mGame.onVineGrown(com.sandlot.GrannyInParadise.entity.VineEntity(ent));
}
break;
case "cat_orange" :
case "cat_black" :
case "cat_grey" :
case "cat_brown" :
if ((!com.sandlot.GrannyInParadise.entity.CatEntity(ent).IsFollowing()) && (!com.sandlot.GrannyInParadise.entity.CatEntity(ent).inMeowGate)) {
com.sandlot.GrannyInParadise.entity.CatEntity(ent).StartFollowing(this);
mGame.onPickedUpCat(com.sandlot.GrannyInParadise.entity.CatEntity(ent));
}
break;
case "exit_flower" :
if (com.sandlot.GrannyInParadise.entity.ExitFlowerEntity(ent).IsSprouted()) {
mGame.onGrannyHitExitFlower(com.sandlot.GrannyInParadise.entity.ExitFlowerEntity(ent));
}
break;
case "dog" :
var _local5 = com.sandlot.GrannyInParadise.entity.DogEntity(ent);
if ((!_local5.IsAttackingGranny()) && (!_local5.IsInHole())) {
_local5.AttackGranny();
mDeadReason = "dogdie";
trace("Doggie got granny ");
SetState(_global.STATE_DYING);
}
break;
case "tiki_man" :
var _local4 = com.sandlot.GrannyInParadise.entity.TikiManEntity(ent);
if (!((!_local4.IsAttackingGranny()) && (!_local4.IsInHole()))) {
break;
}
_local4.AttackGranny();
mDeadReason = "tikidie";
trace("Tikiman got granny ");
SetState(_global.STATE_DYING);
}
}
function EnterState(state) {
super.EnterState(state);
switch (state) {
case _global.STATE_DYING :
mGame.mGameFactory.onSoundQueue(_global.GRANNY_DIE);
mSprite.Play("die", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
AbortDigging();
if ((mPowerup != null) && (mPowerup.mClassName == "umbrella")) {
mGame.mGameFactory.StopSound(_global.UMBRELLA_WIND);
}
break;
case _global.STATE_DEAD :
mSprite.Play("dead", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
break;
case _global.STATE_DIG_FAIL :
mSprite.Play("dig", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
mGame.mGameFactory.onSoundQueue(_global.DIG_FAIL);
break;
case _global.STATE_DIGGING :
mSprite.Play("dig", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
mDigCount = 1;
mGame.mGameFactory.onSoundQueue(_global.DIGGING);
if (_global.isGoingLeft(mDir)) {
mGame.EmitParticles(mRowPos + 1, mColPos - 1, _global.isGoingLeft(mDir));
} else {
mGame.EmitParticles(mRowPos + 1, mColPos + 1, _global.isGoingLeft(mDir));
}
break;
case _global.STATE_ITEM_POOF :
mSprite.Play("item_disappear", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
break;
case _global.STATE_OPEN_UMBRELLA :
mSprite.Play("umbrella_unfold", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
break;
case _global.STATE_UMBRELLA_FLOAT :
trace("FLOATING");
mSprite.Play("umbrella_float", 0, 0, true, (_global.isGoingLeft(mDir) ? false : true));
mMoveRow = mUmbrellaFallSpeed;
var _local4 = mGame.mTileMap.GetPosOnTopOf(mRowPos, mColPos);
mRowPos = _local4.row;
mColPos = _local4.col;
mGame.mGameFactory.onSoundQueue(_global.UMBRELLA_WIND);
break;
case _global.STATE_THROW_KEY :
mSprite.Play("key_throw", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
mPowerupSprite.Unload();
mPowerupSprite = null;
mPowerupCounter.Stop();
mGame.mGameFactory.onSoundQueue(_global.KEY_OPEN);
break;
case _global.STATE_PLACE_BOMB :
mSprite.Play("bomb_placing", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
}
function onAnimStopped(theSprite, animName) {
super.onAnimStopped(theSprite, animName);
switch (mState) {
case _global.STATE_DEAD :
mGame.OnGrannyDie(mDeadReason);
break;
case _global.STATE_DYING :
SetState(_global.STATE_DEAD);
break;
case _global.STATE_DIG_FAIL :
case _global.STATE_ITEM_POOF :
SetState(mLastState);
break;
case _global.STATE_DIGGING :
if (mDigCount < 3) {
mSprite.Play("dig", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
if (_global.isGoingLeft(mDir)) {
mGame.EmitParticles((mRowPos + 1) + (mDigCount * 0.33), mColPos - 1, _global.isGoingLeft(mDir));
} else {
mGame.EmitParticles((mRowPos + 1) + (mDigCount * 0.33), mColPos + 1, _global.isGoingLeft(mDir));
}
mDigCount++;
mCurrentHole.DigStep();
} else {
mCurrentHole.FinishedDigging();
mCurrentHole = null;
SetState(_global.STATE_STANDING);
}
break;
case _global.STATE_OPEN_UMBRELLA :
trace("STARTING TO FLOAT!!");
SetState(_global.STATE_UMBRELLA_FLOAT);
break;
case _global.STATE_THROW_KEY :
mPowerup = null;
SetState(_global.STATE_STANDING);
if (mLockEnt != null) {
mLockEnt.Unlock();
}
break;
case _global.STATE_PLACE_BOMB :
SetState(_global.STATE_STANDING);
var _local5 = mGame.mTileMap.GetPosOnTopOf(mRowPos, mColPos);
var _local4 = new com.sandlot.GrannyInParadise.entity.BombEntity(mPowerup, mGame, mGame.mGameFactory.GetNextValidEntityDepth());
_local4.SetSpawnPos(_local5.row, _local5.col);
_local4.Spawn();
mPowerupCounter.Stop();
mGame.AddEntity(_local4);
mPowerup = null;
}
}
function Update() {
super.Update();
if (mPowerupSprite != null) {
mPowerupSprite.SetPosition(mGame.mTileMap.GetScreenXPercent(mColPos), mGame.mTileMap.GetScreenYPercent(mRowPos - 0.5));
}
}
function UpdateState(state) {
super.UpdateState(state);
switch (mState) {
case _global.STATE_DIGGING :
if (StartedHandOverHand()) {
AbortDigging();
} else if (StartedWalking()) {
AbortDigging();
} else if (StartedClimbing()) {
AbortDigging();
}
break;
case _global.STATE_IDLE :
case _global.STATE_STANDING :
if (StartedBombing()) {
} else if (StartedDigging()) {
}
break;
case _global.STATE_FALLING :
if (StartedFloating()) {
}
break;
case _global.STATE_WALKING :
if (StartedFloating()) {
}
break;
case _global.STATE_UMBRELLA_FLOAT :
if ((mPowerup != null) && (mPowerup.mClassName == "umbrella")) {
if (FinishedFalling()) {
trace("FINISHED FLOATING!!!!");
mGame.mGameFactory.onSoundQueue(_global.UMBRELLA_WIND);
break;
}
if (mThrusts[_global.THRUST_LEFT] == true) {
var _local4 = Move(mMoveRow, -mUmbrellaFloatSpeed);
if (CheckForStuckInWall()) {
ResetPos();
Move(mMoveRow, 0);
trace("MOVE IS NOT OK");
} else if (_local4 == false) {
Move(mMoveRow, 0);
}
} else if (mThrusts[_global.THRUST_RIGHT] == true) {
var _local4 = Move(mMoveRow, mUmbrellaFloatSpeed);
if (CheckForStuckInWall()) {
ResetPos();
Move(mMoveRow, 0);
} else if (_local4 == false) {
Move(mMoveRow, 0);
}
} else {
Move(mMoveRow, 0);
}
} else {
mGame.mGameFactory.onSoundQueue(_global.UMBRELLA_WIND);
SetState(_global.STATE_FALLING);
}
}
}
function StartedBombing() {
if ((((mDoAction == true) && (mPowerup != null)) && (mPowerup.mClassName == "bomb")) && (CanBomb())) {
SetState(_global.STATE_PLACE_BOMB);
return(true);
}
return(false);
}
function StartedFloating() {
if ((mPowerup != null) && (mPowerup.mClassName == "umbrella")) {
if (HasEdge("F", false) == false) {
return(false);
}
mColPos = mGame.mPathMgr.SnapCol(mColPos);
SetState(_global.STATE_UMBRELLA_FLOAT);
return(true);
}
return(false);
}
function StartedDigging() {
if ((mDoAction == true) && (_global.isGoingLeft(mDir) == true)) {
if (HasEdge("DL", false) == false) {
SetState(_global.STATE_DIG_FAIL);
return(true);
}
} else if ((mDoAction == true) && (_global.isGoingRight(mDir) == true)) {
if (HasEdge("DR", false) == false) {
SetState(_global.STATE_DIG_FAIL);
return(true);
}
} else {
return(false);
}
if (mCurrentHole == null) {
var _local3;
if (_global.isGoingLeft(mDir)) {
_local3 = mGame.mTileMap.GetPosBelowToLeft(mRowPos, mColPos);
}
if (_global.isGoingRight(mDir)) {
_local3 = mGame.mTileMap.GetPosBelowToRight(mRowPos, mColPos);
}
mCurrentHole = new com.sandlot.GrannyInParadise.entity.HoleEntity(_local3.row, _local3.col, mGame);
mCurrentHole.StartDigging();
} else {
return(false);
}
SetState(_global.STATE_DIGGING);
return(true);
}
function CanDig(dir) {
switch (mState) {
case _global.STATE_DYING :
case _global.STATE_DEAD :
case _global.STATE_OPEN_UMBRELLA :
case _global.STATE_UMBRELLA_FLOAT :
return(false);
}
if (((_global.isGoingLeft(dir) && (mCollisions[_global.DIR_LEFT] == null)) && (mCollisions[_global.DIR_DOWN_LEFT] != null)) && (mGame.mGameFactory.isTileDiggable(mCollisions[_global.DIR_DOWN_LEFT].type))) {
return(true);
}
if (((_global.isGoingRight(dir) && (mCollisions[_global.DIR_RIGHT] == null)) && (mCollisions[_global.DIR_DOWN_RIGHT] != null)) && (mGame.mGameFactory.isTileDiggable(mCollisions[_global.DIR_DOWN_RIGHT].type))) {
return(true);
}
return(false);
}
function CanBomb() {
switch (mState) {
case _global.STATE_WALKING :
case _global.STATE_STANDING :
return(true);
}
return(false);
}
function AbortDigging() {
if (mCurrentHole != null) {
mCurrentHole.AbortDigging();
mCurrentHole = null;
}
}
function Action(doAction) {
mLastDoAction = mDoAction;
mDoAction = doAction;
if (!mDoAction) {
return(undefined);
}
}
function PlayClimbAnim() {
if ((mPowerup == null) || (mPowerup.mClassName == "key")) {
super.PlayClimbAnim();
return(undefined);
}
mSprite.Play((mPowerup.mClassName + "_") + ((_global.isGoingUp(mDir) ? "up_" : "down_") + mClimbingOn), 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayCimbStopAnim() {
if ((mPowerup == null) || (mPowerup.mClassName == "key")) {
super.PlayCimbStopAnim();
return(undefined);
}
mSprite.Play((mPowerup.mClassName + "_stop_climb") + (_global.isGoingUp(mDir) ? "_up" : "_down"), 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayStandAnim() {
if (mPowerup == null) {
super.PlayStandAnim();
return(undefined);
}
mSprite.Play(mPowerup.mClassName + "_stand", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
function PlayWalkAnim() {
if (mPowerup == null) {
super.PlayWalkAnim();
return(undefined);
}
mSprite.Play(mPowerup.mClassName + "_walk", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
}
Symbol 2107 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.LockEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.LockEntity extends com.sandlot.GrannyInParadise.LevelEntity
{
var mIsLocked, mSprite, mGame;
function LockEntity (tileType, theGame, theDepth) {
super("lock", tileType, theGame, theDepth);
mIsLocked = true;
}
function Unlock() {
mSprite.Play("unlock", 0, 1, false, false);
}
function onAnimStopped(theSprite, animName) {
if (animName == "unlock") {
mGame.RemoveEntity(this);
}
}
function Spawn() {
mSprite.Play("locked", 0, 0, true, false);
}
}
Symbol 2108 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.PickupEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.PickupEntity extends com.sandlot.GrannyInParadise.LevelEntity
{
var mSprite;
function PickupEntity (pickupName, tileType, theGame, theDepth) {
super(pickupName, tileType, theGame, theDepth);
trace("Created Pickup: " + pickupName);
}
function Spawn() {
mSprite.Play("idle", 0, 0, true, false);
}
}
Symbol 2109 MovieClip [__Packages.com.sandlot.GrannyInParadise.Counter] Frame 0
class com.sandlot.GrannyInParadise.Counter
{
var mParentMC, mListener, mText, mCurrent, mFormat, mIntervalID;
function Counter (parentMC, startVal, interval, listener) {
mParentMC = parentMC;
mListener = listener;
mParentMC.createTextField("counter", 1, 0, (-mParentMC._height) / 2, mParentMC._width, mParentMC._height);
mText = mParentMC.counter;
mCurrent = startVal;
mFormat = new TextFormat();
mFormat.color = 16777215 /* 0xFFFFFF */;
mFormat.bold = true;
mFormat.font = "Microsoft Sans Serif";
mFormat.size = 12;
mFormat.align = "center";
mText.maxChars = 4;
UpdateCounter();
mIntervalID = setInterval(this, "onInterval", interval);
}
function UpdateCounter() {
mText.text = "" + mCurrent;
mText.setTextFormat(mFormat);
}
function Stop() {
mText.removeTextField();
clearInterval(mIntervalID);
}
function onInterval() {
mCurrent--;
if (mCurrent < 0) {
mCurrent = 0;
mListener.onCounterFinished(this);
} else {
UpdateCounter();
}
}
}
Symbol 2110 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.HoleEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.HoleEntity
{
var mGame, mRowPos, mColPos, mTimer, mTopLeft, mTopRight, mBotLeft, mBotRight, mHoleFiller, mDigFrame, mHoleMC;
function HoleEntity (theRow, theCol, theGame) {
mGame = theGame;
mRowPos = theRow;
mColPos = theCol;
mTimer = mGame.mTimer;
trace("Looking for corners");
mTopLeft = GetDirtTile(theRow, theCol);
mTopRight = GetDirtTile(theRow, theCol + 1);
mBotLeft = GetDirtTile(theRow + 1, theCol);
mBotRight = GetDirtTile(theRow + 1, theCol + 1);
mHoleFiller = null;
mDigFrame = 0;
}
function GetDirtTile(theRow, theCol) {
var _local3 = mGame.mTileMap.GetCorner(theRow, theCol);
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local3[_local2].isDirt == true) {
trace("Found dirt tile");
return(_local3[_local2]);
}
_local2++;
}
return(null);
}
function StartDigging() {
var _local2 = mGame.mGameFactory.GetNextValidEntityDepth();
mHoleMC = mGame.mStaticTiles.attachMovie("hole", "hole" + _local2, 2000 + _local2);
mHoleMC._x = Math.ceil((mGame.mTileMap.GetScreenXPercent(mColPos) * Stage.width) + 0.5);
mHoleMC._y = Math.ceil((mGame.mTileMap.GetScreenYPercent(mRowPos) * Stage.height) + 0.5);
mHoleMC._y = mHoleMC._y - 2.5;
trace((((((("Pos x: " + mHoleMC._x) + " y: ") + mHoleMC._y) + " col: ") + mColPos) + " row: ") + mRowPos);
mHoleMC.gotoAndStop(1);
mDigFrame = (2 + (mRowPos * mGame.mTileMap.mMapDataCols)) + mColPos;
trace("Digging at frame: " + mDigFrame);
mHoleMC.bg.gotoAndStop(mDigFrame);
trace("Started Digging");
}
function AbortDigging() {
trace("Digging Aborted!");
if (mHoleMC != null) {
mHoleMC.removeMovieClip();
mHoleMC = null;
}
}
function DigStep() {
mHoleMC.gotoAndStop(mHoleMC._currentframe + 1);
mHoleMC.bg.gotoAndStop(mDigFrame);
trace(" Digging");
}
function FillHole() {
if (mHoleFiller != null) {
mHoleFiller.OnHoleFilledUp();
mGame.RemoveEntity(mHoleFiller);
}
if (mHoleMC != null) {
mHoleMC.removeMovieClip();
mHoleMC = null;
}
mGame.mTileMap.ResetTile(_global.DIRT_TILE, mRowPos, mColPos);
mGame.mPathMgr.ResetNode(mRowPos - 1, mColPos);
mGame.mPathMgr.ChangeLabel(mRowPos - 1, mColPos, "HF", "F");
mGame.mPathMgr.DrawGraph(mGame.mGridOverlay);
mGame.FillingHole(this);
}
function FinishedDigging() {
trace("Finished Digging");
mGame.mTileMap.ResetTile(0, mRowPos, mColPos);
mGame.mPathMgr.ResetNode(mRowPos - 1, mColPos);
mTimer.StartTimerEvent(_global.HOLE_FILL_TIME, this);
mGame.mPathMgr.ChangeLabel(mRowPos - 1, mColPos, "F", "HF");
mGame.mPathMgr.DrawGraph(mGame.mGridOverlay);
mGame.mDugHoles.push(this);
mGame.onGameEvent("dug_tile");
if (mHoleMC != null) {
mHoleMC.removeMovieClip();
mHoleMC = null;
}
}
function onEntFellInHole(ent) {
mHoleFiller = ent;
trace("Hole Filled with ENT");
mGame.RemoveEntsFromHole(this);
mGame.mTileMap.SetMapData(_global.HOLE_FILLER, mRowPos, mColPos);
mGame.mPathMgr.ResetNode(mRowPos - 1, mColPos);
mGame.mPathMgr.DrawGraph(mGame.mGridOverlay);
mGame.onGameEvent("enemy_fell_in_hole");
}
function onTimerEvent(event) {
if (mGame.mCanDirtRespawn) {
FillHole();
mTimer.RemoveTimerEvent(event);
}
}
}
Symbol 2111 MovieClip [__Packages.com.sandlot.GrannyInParadise.Timer] Frame 0
class com.sandlot.GrannyInParadise.Timer
{
var mCurrentGameTime, mLastUpdateTime, mCurrentUpdateTime, mTimerEvents, mEventsToRemove;
function Timer () {
Reset();
}
function GetGameTime() {
return(mCurrentGameTime);
}
function Reset() {
mLastUpdateTime = getTimer();
mCurrentUpdateTime = getTimer();
mCurrentGameTime = 0;
mTimerEvents = new Array();
mEventsToRemove = new Array();
}
function StartTimerEvent(theInterval, theListener, eventData) {
mTimerEvents.push({start:mCurrentGameTime, interval:theInterval, listener:theListener, d:eventData});
}
function UpdateTimerEvents() {
var _local4 = 0;
while (_local4 < mTimerEvents.length) {
var _local3 = mTimerEvents[_local4];
if ((mCurrentGameTime - _local3.start) > _local3.interval) {
_local3.listener.onTimerEvent(_local3);
_local3.start = mCurrentGameTime;
}
_local4++;
}
_local4 = 0;
while (_local4 < mEventsToRemove.length) {
var _local2 = 0;
while (_local2 < mTimerEvents.length) {
if (mEventsToRemove[_local4] == mTimerEvents[_local2]) {
mTimerEvents.splice(_local2, 1);
break;
}
_local2++;
}
_local4++;
}
mEventsToRemove = new Array();
}
function RemoveTimerEvent(theEvent) {
mEventsToRemove.push(theEvent);
}
function UpdateTimer(gameIsPaused) {
mCurrentUpdateTime = getTimer();
if (!gameIsPaused) {
var _local2 = mCurrentUpdateTime - mLastUpdateTime;
mCurrentGameTime = mCurrentGameTime + _local2;
UpdateTimerEvents();
}
mLastUpdateTime = mCurrentUpdateTime;
}
}
Symbol 2112 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.FollowerEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.FollowerEntity extends com.sandlot.GrannyInParadise.entity.ActorEntity
{
var mFollowTarget, mIsFollowing, mDiffDir, mColDiffNorm, mRowDiffNorm, mRowDiff, mColDiff, mDiffLen, mFollowPath, mPathMC, mGame, mCurrentPath, mCurrentPathNode, mCanSideOffLadder, mCurrentStalkDir, mRowPos, mColPos, mLastFollowTargRow, mLastFollowTargCol, MoveUp, MoveDown, MoveLeft, MoveRight, mState, HasEdge, mDir;
function FollowerEntity (spriteClass, tileType, theGame, theDepth) {
super(spriteClass, tileType, theGame, theDepth);
mFollowTarget = null;
mIsFollowing = false;
mDiffDir = (mColDiffNorm = (mRowDiffNorm = (mRowDiff = (mColDiff = (mDiffLen = 0)))));
mFollowPath = false;
mPathMC = mGame.mGridOverlay.createEmptyMovieClip("Path" + theDepth, theDepth);
mCurrentPath = null;
mCurrentPathNode = null;
mCanSideOffLadder = false;
mCurrentStalkDir = _global.DIR_LEFT;
}
function Unload() {
super.Unload();
ResetPath();
}
function IsFollowing() {
return(mIsFollowing);
}
function ResetPath() {
mCurrentPath = null;
mPathMC.clear();
}
function ClampedRow() {
return(Math.round(mRowPos));
}
function ClampedCol() {
return(Math.round(mColPos));
}
function FollowPath() {
if (((mCurrentPath == null) || (mCurrentPath.length <= 0)) || (_global.Distance(mLastFollowTargRow, mLastFollowTargCol, mFollowTarget.mRowPos, mFollowTarget.mColPos) > 5)) {
mCurrentPathNode = null;
mLastFollowTargRow = mFollowTarget.mRowPos;
mLastFollowTargCol = mFollowTarget.mColPos;
mCurrentPath = mGame.mPathMgr.GetPath(ClampedRow(), ClampedCol(), int(mFollowTarget.mRowPos), int(mFollowTarget.mColPos), mCanSideOffLadder);
if ((mCurrentPath == null) || (mCurrentPath == undefined)) {
mCurrentPath = null;
return(false);
}
var _local4 = "";
var _local3 = 0;
while (_local3 < mCurrentPath.length) {
_local4 = (_local4 + "->") + mCurrentPath[_local3].child_type;
_local3++;
}
mCurrentPathNode = mCurrentPath.shift();
if ((mCurrentPathNode == null) || (mCurrentPathNode == undefined)) {
return(false);
}
}
switch (mCurrentPathNode.child_type) {
case "U" :
MoveUp(true);
break;
case "D" :
MoveDown(true);
break;
case "LL" :
case "L" :
MoveLeft(true);
break;
case "LR" :
case "R" :
MoveRight(true);
}
if ((ClampedRow() == mCurrentPathNode.row) && (ClampedCol() == mCurrentPathNode.col)) {
if (mCurrentPath.length > 0) {
mCurrentPathNode = mCurrentPath.shift();
if ((mCurrentPathNode == null) || (mCurrentPathNode == undefined)) {
return(false);
}
var _local4 = "";
var _local3 = 0;
while (_local3 < mCurrentPath.length) {
_local4 = (_local4 + "->") + mCurrentPath[_local3].child_type;
_local3++;
}
}
}
return(true);
}
function Stalk() {
if ((mState == _global.STATE_CLIMBING) || (mState == _global.STATE_CLIMBING_STOPPED)) {
MoveDown(true);
ResetPath();
return(true);
}
if ((mCurrentStalkDir == _global.DIR_LEFT) && (HasEdge("L", false) == true)) {
MoveLeft(true);
ResetPath();
return(true);
}
if ((mCurrentStalkDir == _global.DIR_RIGHT) && (HasEdge("R", false) == true)) {
MoveRight(true);
ResetPath();
return(true);
}
if (mCurrentStalkDir == _global.DIR_RIGHT) {
mCurrentStalkDir = _global.DIR_LEFT;
} else {
mCurrentStalkDir = _global.DIR_RIGHT;
}
return(true);
}
function DeadReckon() {
GetTargetDirection();
switch (mDiffDir) {
case _global.DIR_UP_LEFT :
if (HasEdge("U", true) == true) {
MoveUp(true);
ResetPath();
return(true);
}
if (HasEdge("L", true) == true) {
MoveLeft(true);
ResetPath();
return(true);
}
break;
case _global.DIR_UP_RIGHT :
if (HasEdge("U", true) == true) {
MoveUp(true);
ResetPath();
return(true);
}
if (HasEdge("R", true) == true) {
MoveRight(true);
ResetPath();
return(true);
}
break;
case _global.DIR_DOWN_LEFT :
if (HasEdge("D", true) == true) {
MoveUp(true);
ResetPath();
return(true);
}
if (HasEdge("L", true) == true) {
MoveLeft(true);
ResetPath();
return(true);
}
break;
case _global.DIR_DOWN_RIGHT :
if (HasEdge("D", true) == true) {
MoveUp(true);
ResetPath();
return(true);
}
if (HasEdge("R", true) == true) {
MoveRight(true);
ResetPath();
return(true);
}
break;
case _global.DIR_UP :
if (HasEdge("U", true) == true) {
MoveUp(true);
ResetPath();
return(true);
}
break;
case _global.DIR_DOWN :
if (HasEdge("D", true) == true) {
MoveDown(true);
ResetPath();
return(true);
}
break;
case _global.DIR_LEFT :
if (HasEdge("L", true) == true) {
MoveLeft(true);
ResetPath();
return(true);
}
break;
case _global.DIR_RIGHT :
if (HasEdge("R", true) != true) {
break;
}
MoveRight(true);
ResetPath();
return(true);
}
return(false);
}
function StupidFollow() {
GetTargetDirection();
switch (mDiffDir) {
case _global.DIR_UP :
if (mRowDiff > (0.1 + (Math.random() * 0.2))) {
MoveUp(true);
}
ResetPath();
return(true);
case _global.DIR_DOWN :
if (mRowDiff < (-(0.1 + (Math.random() * 0.2)))) {
MoveDown(true);
}
ResetPath();
return(true);
case _global.DIR_LEFT :
if (mColDiff > (0.1 + (Math.random() * 0.2))) {
MoveLeft(true);
}
ResetPath();
return(true);
case _global.DIR_RIGHT :
if (mColDiff < (-(0.1 + (Math.random() * 0.2)))) {
MoveRight(true);
}
ResetPath();
return(true);
}
return(false);
}
function StartFollowing(ent) {
mFollowTarget = ent;
mIsFollowing = true;
mLastFollowTargRow = ent.mRowPos;
mLastFollowTargCol = ent.mRowPos;
MoveRight(true);
}
function StopFollowing() {
mFollowTarget = null;
mIsFollowing = false;
}
function GetTargetDistance() {
mRowDiff = (mRowPos + 0.5) - (mFollowTarget.mRowPos + 0.5);
mColDiff = (mColPos + 0.5) - (mFollowTarget.mColPos + 0.5);
return(Math.sqrt((mRowDiff * mRowDiff) + (mColDiff * mColDiff)));
}
function GetTargetDirection() {
mRowDiff = (mRowPos + 0.5) - (mFollowTarget.mRowPos + 0.5);
mColDiff = (mColPos + 0.5) - (mFollowTarget.mColPos + 0.5);
mDiffLen = Math.sqrt((mRowDiff * mRowDiff) + (mColDiff * mColDiff));
mRowDiffNorm = mRowDiff / mDiffLen;
mColDiffNorm = mColDiff / mDiffLen;
mDiffDir = _global.getDirection(mRowDiff, mColDiff);
return(mDiffDir);
}
function ContinueInCurrentHorzDir() {
if (_global.isGoingLeft(mDir)) {
MoveLeft(true);
} else {
MoveRight(true);
}
}
function Update() {
super.Update();
if (mFollowTarget != null) {
var _local3 = false;
var _local5 = false;
var _local6 = false;
_local3 = StupidFollow();
var _local4 = "";
if (!_local3) {
_local5 = FollowPath();
} else {
_local4 = "Stupid Follow";
}
if ((!_local3) && (!_local5)) {
ContinueInCurrentHorzDir();
_local6 = true;
_local4 = "Continuing on in Dir: " + mDir;
AltTrackMethod();
} else {
_local4 = "Following Path";
}
}
}
function AltTrackMethod() {
return(DeadReckon());
}
}
Symbol 2113 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.HoleFillerEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.HoleFillerEntity extends com.sandlot.GrannyInParadise.entity.FollowerEntity
{
var mHole, mSprite, mState, mRowPos, mColPos, mClassName, mGame, SetState;
function HoleFillerEntity (spriteClass, tileType, theGame, theDepth) {
super(spriteClass, tileType, theGame, theDepth);
mHole = null;
}
function PlayFillHoleAnim() {
mSprite.Play("hold", 0, 0, true, false);
}
function IsInHole() {
return(mHole != null);
}
function EnterState(state) {
if (!(mState === _global.STATE_FILLING_HOLE)) {
} else if (mHole != null) {
trace((("row: " + mHole.mRowPos) + " col: ") + mHole.mColPos);
PlayFillHoleAnim();
mRowPos = mHole.mRowPos;
mColPos = mHole.mColPos;
trace((((((((("IN HOLE: [" + mRowPos) + ",") + mColPos) + "] : ") + "[") + mHole.mRowPos) + ",") + mHole.mColPos) + "]");
} else {
trace("Hole object is NULL!");
}
super.EnterState(state);
}
function OnHoleFilledUp() {
trace("Respawing: " + mClassName);
mHole = null;
mGame.ScheduleRespawn(this);
}
function OnFellInHole() {
}
function CheckIfInHole() {
var _local4 = mGame.mTileMap.GetPosOnTopOf(mRowPos, mColPos);
var _local3 = 0;
while (_local3 < mGame.mDugHoles.length) {
if ((mGame.mDugHoles[_local3].mRowPos == _local4.row) && (mGame.mDugHoles[_local3].mColPos == _local4.col)) {
trace(mClassName + " is in a HOLE");
mHole = mGame.mDugHoles[_local3];
SetState(_global.STATE_FILLING_HOLE);
mGame.onFellInHole(this);
OnFellInHole();
mHole.onEntFellInHole(this);
}
_local3++;
}
}
function UpdateState(state) {
switch (mState) {
case _global.STATE_WALKING :
case _global.STATE_FALLING :
if (mHole != null) {
break;
}
CheckIfInHole();
}
super.UpdateState(state);
}
}
Symbol 2114 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.FlowerEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.FlowerEntity extends com.sandlot.GrannyInParadise.LevelEntity
{
var mIsSprouted, mSprite;
function FlowerEntity (className, tileType, theGame, theDepth) {
super(className, tileType, theGame, theDepth);
mIsSprouted = false;
}
function PlayIdleAnim() {
mSprite.Play("idle", 0, 0, true, false);
}
function onAnimStopped(theSprite, animName) {
if (animName == "grow") {
PlayIdleAnim();
}
}
function IsSprouted() {
return(mIsSprouted);
}
function Sprout() {
mSprite.Play("grow", 0, 1, false, false);
mIsSprouted = true;
}
function Spawn() {
mSprite.Play("seed", 0, 0, true, false);
}
}
Symbol 2115 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.BonusFlowerEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.BonusFlowerEntity extends com.sandlot.GrannyInParadise.entity.FlowerEntity
{
var mSprite, mFlowerColor, GetMainMovieClip, mGame, mIsSprouted, mRowPos, mColPos;
function BonusFlowerEntity (tileType, theGame, theDepth) {
super("bonus_flower", tileType, theGame, theDepth);
}
function PlayIdleAnim() {
mSprite.Play(mFlowerColor, 0, 0, true, false);
}
function ShowPercent(percent) {
var _local2 = GetMainMovieClip();
_local2.createTextField("percent_txt", 2, 0, _local2._height, _local2._width * 2, _local2._height);
var _local3 = new TextFormat();
_local3.color = 16777215 /* 0xFFFFFF */;
_local3.bold = true;
_local3.font = "Microsoft Sans Serif";
_local3.size = 12;
_local2.percent_txt.maxChars = 4;
_local2.percent_txt.text = percent + "%";
_local2.percent_txt.setTextFormat(_local3);
_local2.createTextField("percent_txt_shadow", 1, 1.75, _local2.percent_txt._y + 1.75, _local2._width * 2, _local2._height);
var _local4 = new TextFormat();
_local4.color = 0;
_local4.bold = true;
_local4.font = "Microsoft Sans Serif";
_local4.size = 12;
_local2.percent_txt_shadow.maxChars = 4;
_local2.percent_txt_shadow.text = percent + "%";
_local2.percent_txt_shadow.setTextFormat(_local4);
}
function HidePercent() {
var _local2 = GetMainMovieClip();
if (_local2.percent_txt != undefined) {
_local2.percent_txt.removeTextField();
_local2.percent_txt_shadow.removeTextField();
}
}
function Sprout() {
mFlowerColor = mGame.mGameFactory.GetRandomBonusFlowerColor();
if (!mIsSprouted) {
mGame.EmitBonusHeart(mRowPos, mColPos);
}
super.Sprout();
}
}
Symbol 2116 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.SuperBonusFlowerEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.SuperBonusFlowerEntity extends com.sandlot.GrannyInParadise.entity.FlowerEntity
{
var mEmitCount, mSprite, mGame, mRowPos, mColPos;
function SuperBonusFlowerEntity (tileType, theGame, theDepth) {
super("super_bonus_flower", tileType, theGame, theDepth);
mEmitCount = 0;
}
function Hint() {
mSprite.Play("hint", 0, 0, true, false);
}
function Sprout() {
mGame.mGameFactory.onSoundQueue(_global.SUPER_BONUS_SPROUT);
super.Sprout();
}
function onAnimStopped(theSprite, animName) {
super.onAnimStopped(theSprite, animName);
if (animName == "grow") {
EmitHearts();
}
}
function onEmitterFinished(emitter) {
mGame.RemoveEntity(emitter);
if (mEmitCount < 2) {
mEmitCount++;
EmitHearts();
}
}
function EmitHearts() {
var _local3 = new Object();
mGame.mGameFactory.onSoundQueue(_global.BONUS_HEARTS);
_local3.numEmissions = 1;
_local3.numParticlesPerEmit = 5;
_local3.timeBetweenEmissions = 0;
_local3.speed = 0.15;
_local3.angle = 90;
_local3.spread = 180;
_local3.gravity = 0.01;
_local3.spriteClass = "heart";
_local3.animName = "pop";
var _local4 = new com.sandlot.GrannyInParadise.entity.EmitterEntity(_local3, this, mGame, mGame.mGameFactory.GetNextValidEntityDepth());
_local4.SetSpawnPos(mRowPos, mColPos);
_local4.StartEmit();
mGame.mEntities.push(_local4);
}
}
Symbol 2117 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.EmitterEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.EmitterEntity extends com.sandlot.GrannyInParadise.LevelEntity
{
var mListener, mSprites, mNumEmissions, mParticlesPerEmission, mTimeBetweenEmissions, mSpeed, mAngle, mSpread, mGravity, mSpriteClass, mAnimName, mEmissionsSoFar, mGame, mColPos, mRowPos;
function EmitterEntity (emitterDesc, listener, theGame, depth) {
super("emitter_sprite", -1, theGame, depth);
mListener = listener;
mSprites = new Array();
mNumEmissions = emitterDesc.numEmissions;
mParticlesPerEmission = emitterDesc.numParticlesPerEmit;
mTimeBetweenEmissions = emitterDesc.timeBetweenEmissions;
mSpeed = emitterDesc.speed;
mAngle = emitterDesc.angle;
mSpread = emitterDesc.spread;
mGravity = emitterDesc.gravity;
mSpriteClass = emitterDesc.spriteClass;
mAnimName = emitterDesc.animName;
mEmissionsSoFar = 0;
}
function Unload() {
super.Unload();
var _local3 = 0;
while (_local3 < mSprites.length) {
mSprites[_local3].spr.Unload();
_local3++;
}
}
function Update() {
var _local2 = 0;
while (_local2 < mSprites.length) {
mSprites[_local2].spr.SetPosition(mGame.mTileMap.GetScreenXPercent(mSprites[_local2].col), mGame.mTileMap.GetScreenYPercent(mSprites[_local2].row));
mSprites[_local2].col = mSprites[_local2].col + mSprites[_local2].colDir;
mSprites[_local2].row = mSprites[_local2].row + mSprites[_local2].rowDir;
mSprites[_local2].rowDir = mSprites[_local2].rowDir + mGravity;
mSprites[_local2].spr.StepAnim();
_local2++;
}
}
function StartEmit() {
Emit();
}
function onAnimStopped(theSprite, animName) {
var _local2 = 0;
while (_local2 < mSprites.length) {
if (mSprites[_local2].spr == theSprite) {
mSprites.splice(_local2, 1);
theSprite.Unload();
if ((mSprites.length <= 0) && (mEmissionsSoFar >= mNumEmissions)) {
mListener.onEmitterFinished(this);
}
return(undefined);
}
_local2++;
}
}
function Emit() {
if (mEmissionsSoFar >= mNumEmissions) {
return(undefined);
}
mEmissionsSoFar++;
var _local4 = 0;
while (_local4 < mParticlesPerEmission) {
var _local2 = new com.sandlot.GrannyInParadise.Sprite(mSpriteClass, mGame.mGameFactory, mGame.mEntityTiles, mGame.mGameFactory.GetNextValidEntityDepth(), this);
_local2.SetPosition(mGame.mTileMap.GetScreenXPercent(mColPos), mGame.mTileMap.GetScreenYPercent(mRowPos));
_local2.Play(mAnimName, 0, 1, false, false);
var _local3 = (mAngle - (mSpread / 2)) + (Math.random() * mSpread);
var _local6 = (-mSpeed) * Math.sin((Math.PI/180) * _local3);
var _local5 = mSpeed * Math.cos((Math.PI/180) * _local3);
mSprites.push({spr:_local2, row:mRowPos, col:mColPos, rowDir:_local6, colDir:_local5});
_local4++;
}
}
}
Symbol 2118 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.VineEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.VineEntity extends com.sandlot.GrannyInParadise.LevelEntity
{
var mSegments, mSegmentSprites, mIsWatered, mWaterCanSprite, mSprite, mGame, mRowPos, mColPos, mWaterCanDistance, mWaterCanAngle;
function VineEntity (tileType, theGame, theDepth) {
super("vine", tileType, theGame, theDepth);
mSegments = new Array();
mSegmentSprites = new Array();
mIsWatered = false;
mWaterCanSprite = null;
}
function Spawn() {
mSprite.Play("idle", 0, 0, true, false);
}
function onAnimStopped(theSprite, animName) {
if (animName == "grow_top") {
GrowNextSegment();
}
}
function IsWatered() {
return(mIsWatered);
}
function StartWatercanAnim() {
var _local4 = mGame.mGranny.mRowPos;
var _local5 = mGame.mGranny.mColPos - 0.5;
var _local3 = mRowPos - _local4;
var _local2 = mColPos - _local5;
mWaterCanSprite = new com.sandlot.GrannyInParadise.Sprite("water_can", mSprite.mGameFactory, mSprite.mParentMC, mSprite.mGameFactory.GetNextValidEntityDepth(), this);
mWaterCanDistance = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
var _local7 = _local3 / mWaterCanDistance;
var _local6 = _local2 / mWaterCanDistance;
mWaterCanAngle = Math.atan2(_local7, _local6);
trace((("distance: " + mWaterCanDistance) + " angle: ") + mWaterCanAngle);
mWaterCanSprite.SetPosition(mGame.mTileMap.GetScreenXPercent(_local5), mGame.mTileMap.GetScreenYPercent(_local4));
mWaterCanSprite.Play("idle", 0, 0, true, false);
}
function UpdateWaterCanAnim() {
if (mWaterCanSprite == null) {
return(undefined);
}
mWaterCanAngle = mWaterCanAngle + 0.3;
mWaterCanDistance = mWaterCanDistance - 0.03;
mWaterCanSprite.SetPosition(mGame.mTileMap.GetScreenXPercent(mColPos - (Math.cos(mWaterCanAngle) * mWaterCanDistance)), mGame.mTileMap.GetScreenYPercent(mRowPos + (Math.sin(mWaterCanAngle) * mWaterCanDistance)));
mWaterCanSprite.StepAnim();
if (mWaterCanDistance < 0) {
mWaterCanSprite.Unload();
mWaterCanSprite = null;
}
}
function Water() {
mIsWatered = true;
mGame.mGameFactory.onSoundQueue(_global.VINE_GROW);
GrowNextSegment();
StartWatercanAnim();
}
function Unload() {
super.Unload();
var _local3 = 0;
while (_local3 < mSegmentSprites.length) {
mSegmentSprites[_local3].spr.Unload();
delete mSegmentSprites[_local3];
_local3++;
}
delete mSegmentSprites;
}
function Reshape() {
super.Reshape();
var _local3 = 0;
while (_local3 < mSegmentSprites.length) {
mSegmentSprites[_local3].spr.Reshape();
_local3++;
}
}
function Update() {
super.Update();
var _local3 = 0;
while (_local3 < mSegmentSprites.length) {
mSegmentSprites[_local3].spr.StepAnim();
mSegmentSprites[_local3].spr.SetPosition(mGame.mTileMap.GetScreenXPercent(mSegmentSprites[_local3].pos.col), mGame.mTileMap.GetScreenYPercent(mSegmentSprites[_local3].pos.row));
_local3++;
}
UpdateWaterCanAnim();
}
function GrowNextSegment() {
if (mSegments.length <= 0) {
return(undefined);
}
var _local3 = mSegments.shift();
var _local4 = new com.sandlot.GrannyInParadise.Sprite("vine", mSprite.mGameFactory, mSprite.mParentMC, mSprite.mGameFactory.GetNextValidEntityDepth(), this);
mGame.PushToBottom(_local4.mMC);
_local4.Play("grow_top", 0, 1, false, false);
_local4.SetPosition(mGame.mTileMap.GetScreenXPercent(_local3.col), mGame.mTileMap.GetScreenYPercent(_local3.row));
mGame.mTileMap.SetMapData(_global.TILE_VINE_SEGMENT, _local3.row, _local3.col);
mSegmentSprites.push({pos:_local3, spr:_local4});
mGame.OnVineSegmentGrown(_local3.row, _local3.col, ((mSegments.length == 0) ? true : false));
}
function FindVineSegments() {
var _local3 = mRowPos;
var _local4 = mColPos;
while (mGame.mTileMap.GetMapData(_local3, _local4) == _global.TILE_VINE_SEGMENT) {
mSegments.push({row:_local3, col:_local4});
mGame.mTileMap.SetMapData(0, _local3, _local4);
_local3--;
}
}
}
Symbol 2119 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.CatEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.CatEntity extends com.sandlot.GrannyInParadise.entity.FollowerEntity
{
var mWalkSpeed, mClimbSpeed, mFallSpeed, inMeowGate, mCanSideOffLadder, mShineSprite, Stalk, SetState, MoveLeft, MoveRight, mGame, StopFollowing, ResetPath, mSprite, mDir, mClassName, mRowPos, mColPos, mFollowTarget, GetTargetDirection, mDiffDir, mState, HasEdge;
function CatEntity (tileType, theGame, theDepth) {
super("cat_" + theGame.mGameFactory.GetRandomCatColor(), tileType, theGame, theDepth);
var _local3 = Math.random() * 0.05;
mWalkSpeed = 0.06 + _local3;
mClimbSpeed = 0.05 + _local3;
mFallSpeed = 0.12;
inMeowGate = false;
mCanSideOffLadder = false;
mShineSprite = null;
}
function ShineLastCat() {
}
function AltTrackMethod() {
return(Stalk());
}
function StartFollowing(ent) {
SetState(_global.STATE_STANDING);
super.StartFollowing(ent);
}
function Update() {
super.Update();
if (mShineSprite != null) {
mShineSprite.StepAnim();
}
}
function onFellOffScreen() {
SetState(_global.STATE_NONE);
MoveLeft(false);
MoveRight(false);
mGame.RemoveEntity(this);
StopFollowing();
ResetPath();
mGame.ScheduleCatRespawn(this);
}
function Spawn() {
mSprite.Play("idle", 0, 1, true, false);
}
function EnterState(state) {
super.EnterState(state);
if (!(state === _global.STATE_OUT_DOOR)) {
} else {
StopFollowing();
mSprite.Play("out_door", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
}
function onAnimStopped(theSprite, animName) {
super.onAnimStopped(theSprite, animName);
if (animName == "out_door") {
trace(mClassName + " Has exited");
mGame.onCatExitLevel(this);
}
}
function OnCollision(ent) {
if (!(ent.mClassName === "meow_gate")) {
} else {
SetState(_global.STATE_OUT_DOOR);
mRowPos = ent.mRowPos;
mColPos = ent.mColPos;
inMeowGate = true;
mFollowTarget = null;
}
}
function StupidFollow() {
GetTargetDirection();
switch (mDiffDir) {
case _global.DIR_LEFT :
if (((mState == _global.STATE_WALKING) && (HasEdge("L", false) == false)) && (HasEdge("F", true) == false)) {
SetState(_global.STATE_IDLE);
ResetPath();
return(true);
}
break;
case _global.DIR_RIGHT :
if (!(((mState == _global.STATE_WALKING) && (HasEdge("R", false) == false)) && (HasEdge("F", true) == false))) {
break;
}
SetState(_global.STATE_IDLE);
ResetPath();
return(true);
}
return(super.StupidFollow());
}
function UpdateState(state) {
super.UpdateState(state);
}
}
Symbol 2120 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.ExitFlowerEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.ExitFlowerEntity extends com.sandlot.GrannyInParadise.entity.FlowerEntity
{
var PlayIdleAnim, mGame, mSprite;
function ExitFlowerEntity (tileType, theGame, theDepth) {
super("exit_flower", tileType, theGame, theDepth);
}
function onAnimStopped(theSprite, animName) {
trace("Anim finished " + animName);
super.onAnimStopped(theSprite, animName);
if (animName == "grow") {
PlayIdleAnim();
} else if (animName == "exit") {
trace("Granny Exited");
mGame.onGrannyExited(this);
}
}
function GrannyExit() {
trace("Playing Exit Animation");
mSprite.Play("exit", 0, 1, false, false);
}
}
Symbol 2121 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.DogEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.DogEntity extends com.sandlot.GrannyInParadise.entity.HoleFillerEntity
{
var mChaseSpeed, mWalkSpeed, mStalkSpeed, mClimbSpeed, mFallSpeed, mStalkDir, mChasing, isAttackingGranny, isStalking, mTimer, mHole, SetState, ResetThrusts, mSprite, mDir, mGame, mRowPos, mColPos, mLeftStalkRange, mRightStalkRange, MoveLeft, MoveRight, mState;
function DogEntity (tileType, theGame, theDepth) {
super("dog", tileType, theGame, theDepth);
trace("Created DOGGY");
mChaseSpeed = 0.08;
mWalkSpeed = (mStalkSpeed = 0.025);
mClimbSpeed = 0.025;
mFallSpeed = 0.12;
mStalkDir = _global.DIR_LEFT;
mChasing = false;
isAttackingGranny = false;
isStalking = false;
mTimer = null;
}
function SetTimer(timer) {
mTimer = timer;
}
function Respawn() {
isAttackingGranny = false;
super.Respawn();
}
function onTimerEvent(event) {
if (mHole != null) {
mTimer.RemoveTimerEvent(event);
return(undefined);
}
if (mChasing) {
mTimer.RemoveTimerEvent(event);
return(undefined);
}
if (isStalking == true) {
isStalking = false;
SetState(_global.STATE_IDLE);
ResetThrusts();
mTimer.RemoveTimerEvent(event);
}
}
function StartStalking() {
isStalking = true;
mChasing = false;
SetState(_global.STATE_WALKING);
if (mTimer != null) {
mTimer.StartTimerEvent(6000, this);
} else {
trace("timer not working");
}
}
function IsAttackingGranny() {
return(isAttackingGranny);
}
function PlayWalkAnim() {
if (mChasing == true) {
mSprite.Play("run", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
} else {
mSprite.Play("walk", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
}
function FindStalkRange() {
var _local3 = mGame.mTileMap.GetPosBelow(mRowPos, mColPos);
while (mGame.mGameFactory.doesTileStopMovement(mGame.mTileMap.GetMapData(_local3.row, _local3.col))) {
_local3 = mGame.mTileMap.GetPosToLeft(_local3.row, _local3.col);
}
mLeftStalkRange = _local3.col + 1;
var _local2 = mGame.mTileMap.GetPosBelow(mRowPos, mColPos);
while (mGame.mGameFactory.doesTileStopMovement(mGame.mTileMap.GetMapData(_local2.row, _local2.col))) {
_local2 = mGame.mTileMap.GetPosToRight(_local2.row, _local2.col);
}
mRightStalkRange = _local2.col - 1;
trace((("right : " + mRightStalkRange) + " left: ") + mLeftStalkRange);
}
function SwitchStalkDir() {
if (mStalkDir == _global.DIR_LEFT) {
mStalkDir = _global.DIR_RIGHT;
} else {
mStalkDir = _global.DIR_LEFT;
}
}
function Stalk() {
mWalkSpeed = mStalkSpeed;
if (mChasing) {
StartStalking();
}
mChasing = false;
if ((mStalkDir == _global.DIR_LEFT) && (mGame.mPathMgr.NodeHasEdgeOfType(mRowPos, mColPos - 1, "F") == false)) {
MoveLeft(true);
} else if ((mStalkDir == _global.DIR_RIGHT) && (mGame.mPathMgr.NodeHasEdgeOfType(mRowPos, mColPos + 1, "F") == false)) {
MoveRight(true);
} else {
SwitchStalkDir();
}
}
function Chase() {
mWalkSpeed = mChaseSpeed;
if (mChasing == false) {
mGame.mGameFactory.onSoundQueue(_global.DOG_ATTACK);
}
mChasing = true;
var _local3 = mColPos - mGame.mGranny.mColPos;
var _local4 = _local3 / Math.abs(_local3);
if (_local4 > 0) {
MoveLeft(true);
} else if (_local4 < 0) {
MoveRight(true);
}
}
function EnterState(state) {
super.EnterState(state);
switch (state) {
case _global.STATE_ATTACK :
mSprite.Play("attack", 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
break;
case _global.STATE_LANDING :
StartStalking();
break;
case _global.STATE_IDLE :
mGame.mGameFactory.onSoundQueue(_global.DOG_PANT);
}
}
function AttackGranny() {
trace("DOG ATTACKING GRANNY!");
isAttackingGranny = true;
SetState(_global.STATE_ATTACK);
}
function onAnimStopped(theSprite, animName) {
super.onAnimStopped(theSprite, animName);
switch (mState) {
case _global.STATE_IDLE :
StartStalking();
break;
case _global.STATE_ATTACK :
SetState(_global.STATE_IDLE);
}
}
function OnFellInHole() {
isStalking = false;
mChasing = false;
super.OnFellInHole();
}
function Update() {
if ((mState != _global.STATE_FILLING_HOLE) && (mState != _global.STATE_FALLING)) {
if (((mHole == null) && (isStalking)) && (!isAttackingGranny)) {
if ((mGame.mGranny != null) && (Math.round(mGame.mGranny.mRowPos) == Math.round(mRowPos))) {
Chase();
} else {
Stalk();
}
}
}
super.Update();
}
}
Symbol 2122 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.TikiManEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.TikiManEntity extends com.sandlot.GrannyInParadise.entity.HoleFillerEntity
{
var mWalkSpeed, mClimbSpeed, mFallSpeed, isAttackingGranny, mCanSideOffLadder, Stalk, mGame, mSprite, mDir, ResetPath, mFollowTarget, mState, SetState;
function TikiManEntity (tileType, theGame, theDepth) {
super("tiki_man", tileType, theGame, theDepth);
mWalkSpeed = 0.09;
mClimbSpeed = 0.09;
mFallSpeed = 0.12;
isAttackingGranny = false;
mCanSideOffLadder = true;
}
function AltTrackMethod() {
return(Stalk());
}
function Respawn() {
isAttackingGranny = false;
super.Respawn();
}
function EnterState(state) {
super.EnterState(state);
if (!(state === _global.STATE_ATTACK)) {
} else {
var _local4 = (((Math.random() * 100) < 5) ? true : false);
mGame.mGameFactory.onSoundQueue(_global.TIKI_HIT);
mSprite.Play((_local4 ? "shove" : "kick"), 0, 1, false, (_global.isGoingLeft(mDir) ? false : true));
}
}
function IsAttackingGranny() {
return(isAttackingGranny);
}
function OnFellInHole() {
super.OnFellInHole();
ResetPath();
mFollowTarget = null;
}
function onAnimStopped(theSprite, animName) {
super.onAnimStopped(theSprite, animName);
if (!(mState === _global.STATE_ATTACK)) {
} else {
SetState(_global.STATE_IDLE);
}
}
function AttackGranny() {
trace("TIKIMAN ATTACKING GRANNY!");
isAttackingGranny = true;
mFollowTarget = null;
SetState(_global.STATE_ATTACK);
}
function PlayLandSound() {
mGame.mGameFactory.onSoundQueue(_global.TIKI_MAN_LAND);
}
function Update() {
if ((((mState != _global.STATE_FILLING_HOLE) && (mFollowTarget == null)) && (mGame.mCanEnemiesMove)) && (!isAttackingGranny)) {
trace("Setting follow target");
mFollowTarget = mGame.mGranny;
}
if (!mGame.mCanEnemiesMove) {
mFollowTarget = null;
}
super.Update();
}
}
Symbol 2123 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.BombEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.BombEntity extends com.sandlot.GrannyInParadise.LevelEntity
{
var mCounter, mBombPickup, GetMainMovieClip, mGame, mRowPos, mColPos, mSprite;
function BombEntity (thePickup, theGame, theDepth) {
super("bomb", -1, theGame, theDepth);
trace("Created bomb");
mCounter = null;
mBombPickup = thePickup;
}
function StartCounter() {
mCounter = new com.sandlot.GrannyInParadise.Counter(GetMainMovieClip(), 5, 1000, this);
}
function onCounterFinished(counter) {
trace("BOOM!!");
counter.Stop();
mCounter = null;
Explode();
}
function Unload() {
super.Unload();
if (mCounter != null) {
mCounter.Stop();
}
}
function Explode() {
var _local4 = new Array();
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_RIGHT, mRowPos, mColPos));
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_LEFT, mRowPos, mColPos));
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_UP, mRowPos, mColPos));
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_DOWN, mRowPos, mColPos));
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_NONE, mRowPos, mColPos));
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_UP_LEFT, mRowPos, mColPos));
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_UP_RIGHT, mRowPos, mColPos));
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_DOWN_LEFT, mRowPos, mColPos));
_local4.push(mGame.mTileMap.GetRelativePosInDir(_global.DIR_DOWN_RIGHT, mRowPos, mColPos));
var _local3 = 0;
while (_local3 < _local4.length) {
var _local5 = mGame.mTileMap.GetMapData(_local4[_local3].row, _local4[_local3].col);
if (mGame.mGameFactory.isTileBlowupable(_local5)) {
mGame.mTileMap.ResetTile(0, _local4[_local3].row, _local4[_local3].col);
mGame.mPathMgr.ResetNode(_local4[_local3].row, _local4[_local3].col);
if (mGame.mGameFactory.isTileDiggable(_local5)) {
mGame.ScheduleTileRespawn(_local4[_local3].row, _local4[_local3].col, _global.DIRT_TILE, _global.HOLE_FILL_TIME);
EmitChunks(_local4[_local3].row, _local4[_local3].col, "dirt_chunk");
} else {
EmitChunks(_local4[_local3].row, _local4[_local3].col, "rock_chunk");
}
}
_local3++;
}
mGame.mPathMgr.DrawGraph(mGame.mGridOverlay);
mGame.Respawn(mBombPickup);
mGame.RemoveEntity(this);
mGame.mGameFactory.onSoundQueue(_global.BOMB);
}
function onAnimStopped(theSprite, animName) {
}
function Spawn() {
trace("Spawning bomb");
StartCounter();
mSprite.Play("tick_idle", 0, 0, true, false);
}
function onEmitterFinished(emitter) {
trace("Emitter finished");
mGame.RemoveEntity(emitter);
}
function EmitChunks(row, col, chunkType) {
var _local2 = new Object();
trace((("Emitting chunks: " + [row, col]) + " type: ") + chunkType);
_local2.numEmissions = 1;
_local2.numParticlesPerEmit = 5;
_local2.timeBetweenEmissions = 0;
_local2.speed = 0.15;
_local2.angle = 90;
_local2.spread = 180;
_local2.gravity = 0.01;
_local2.spriteClass = chunkType;
_local2.animName = "chunk1";
var _local3 = new com.sandlot.GrannyInParadise.entity.EmitterEntity(_local2, this, mGame, mGame.mGameFactory.GetNextValidEntityDepth());
_local3.SetSpawnPos(row, col);
_local3.StartEmit();
mGame.mEntities.push(_local3);
}
}
Symbol 2124 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.MeowGateEntity] Frame 0
class com.sandlot.GrannyInParadise.entity.MeowGateEntity extends com.sandlot.GrannyInParadise.LevelEntity
{
var mScoreSoFar, mScoreMcs, mScoreMcsDrop, mScoreAlpha, mTimerEventActive, mTimer, mSprite, GetMainMovieClip;
function MeowGateEntity (tileType, theGame, theDepth) {
super("meow_gate", tileType, theGame, theDepth);
mScoreSoFar = new Array();
mScoreMcs = new Array();
mScoreMcsDrop = new Array();
mScoreAlpha = 100;
mTimerEventActive = false;
}
function SetTimer(timer) {
mTimer = timer;
}
function Spawn() {
mSprite.Play("idle", 0, 0, true, false);
}
function onTimerEvent(event) {
mScoreAlpha = mScoreAlpha - 2;
if (mScoreAlpha > 0) {
var _local2 = 0;
while (_local2 < mScoreMcs.length) {
mScoreMcs[_local2]._alpha = mScoreAlpha;
mScoreMcsDrop[_local2]._alpha = mScoreAlpha;
_local2++;
}
} else {
ClearScoreList();
mTimer.RemoveTimerEvent(event);
mTimerEventActive = false;
}
}
function ClearScoreList() {
var _local2 = 0;
while (_local2 < mScoreMcs.length) {
if ((mScoreMcs[_local2] != null) && (mScoreMcs[_local2] != undefined)) {
mScoreMcs[_local2].removeTextField();
mScoreMcsDrop[_local2].removeTextField();
}
_local2++;
}
mScoreMcs = new Array();
mScoreSoFar = new Array();
mScoreMcsDrop = new Array();
}
function CreateScoreTextField(score, xPos, yPos, height, color, depth, prefix) {
var _local2 = GetMainMovieClip();
var _local3 = (prefix + "Score_") + score.toString(10);
_local2.createTextField(_local3, depth, xPos, yPos, _local2._width, height);
var _local4 = new TextFormat();
_local4.color = color;
_local4.bold = true;
_local4.font = "Microsoft Sans Serif";
_local4.size = 16;
_local4.align = "center";
_local2[_local3].embedFonts = true;
_local2[_local3].text = score.toString(10);
_local2[_local3].autoSize = "center";
_local2[_local3].setTextFormat(_local4);
return(_local2[_local3]);
}
function RefreshScoreMcs() {
var _local2 = 0;
while (_local2 < mScoreMcs.length) {
if ((mScoreMcs[_local2] != null) && (mScoreMcs[_local2] != undefined)) {
mScoreMcs[_local2].removeTextField();
mScoreMcsDrop[_local2].removeTextField();
}
_local2++;
}
mScoreMcs = new Array();
mScoreMcsDrop = new Array();
var _local5 = GetMainMovieClip();
var _local4 = 24;
var _local3 = -10;
_local2 = 0;
while (_local2 < mScoreSoFar.length) {
mScoreMcsDrop[_local2] = CreateScoreTextField(mScoreSoFar[_local2], 1, _local3 + 1, _local4, 7829367, int(mScoreSoFar[_local2]), "drop");
mScoreMcs[_local2] = CreateScoreTextField(mScoreSoFar[_local2], 0, _local3, _local4, 16777215, int(mScoreSoFar[_local2] + 10001), "main");
_local3 = _local3 - (mScoreMcs[_local2]._height * 0.75);
_local2++;
}
mScoreAlpha = 100;
if (mTimerEventActive == false) {
mTimer.StartTimerEvent(30, this);
mTimerEventActive = true;
}
}
function CatEnterScore() {
var _local2 = (mScoreSoFar.length + 1) * 10;
mScoreSoFar.unshift(_local2);
RefreshScoreMcs();
return(_local2);
}
}
Symbol 2125 MovieClip [__Packages.com.sandlot.GrannyInParadise.TileMap] Frame 0
class com.sandlot.GrannyInParadise.TileMap
{
var mGameFactory, mParentMC, mMapDataRows, mMapDataCols, mMapDataSize, mMapData, mCornerMCRows, mCornerMCCols, mCornerMCSize, mCornerMC, mTileDim, mActualMapWidth, mActualMapHeight, mLastValidDepth;
function TileMap (iNumRows, iNumCols, theTileDim, gameFactory, theParentMC) {
mGameFactory = gameFactory;
mParentMC = theParentMC;
mMapDataRows = iNumRows;
mMapDataCols = iNumCols;
mMapDataSize = mMapDataRows * mMapDataCols;
mMapData = new Array(mMapDataSize);
var _local2 = 0;
while (_local2 < mMapDataSize) {
mMapData[_local2] = 0;
_local2++;
}
mCornerMCRows = mMapDataRows + 1;
mCornerMCCols = mMapDataCols + 1;
mCornerMCSize = mCornerMCRows * mCornerMCCols;
mCornerMC = new Array(mCornerMCSize);
_local2 = 0;
while (_local2 < mCornerMCSize) {
mCornerMC[_local2] = null;
_local2++;
}
mTileDim = theTileDim;
mActualMapWidth = mMapDataCols * mTileDim;
mActualMapHeight = mMapDataRows * mTileDim;
mLastValidDepth = 0;
}
function GetMapDataRows() {
return(mMapDataRows);
}
function GetMapDataCols() {
return(mMapDataCols);
}
function GetMapCollisions(theRow, theCol) {
var _local4 = new Array(10);
var _local3 = 0;
while (_local3 < 10) {
_local4[_local3] = null;
_local3++;
}
_local4[_global.DIR_RIGHT] = Collides(_global.DIR_RIGHT, theRow, theCol);
_local4[_global.DIR_LEFT] = Collides(_global.DIR_LEFT, theRow, theCol);
_local4[_global.DIR_UP] = Collides(_global.DIR_UP, theRow, theCol);
_local4[_global.DIR_DOWN] = Collides(_global.DIR_DOWN, theRow, theCol);
_local4[_global.DIR_NONE] = Collides(_global.DIR_NONE, theRow, theCol);
_local4[_global.DIR_UP_LEFT] = Collides(_global.DIR_UP_LEFT, theRow, theCol);
_local4[_global.DIR_UP_RIGHT] = Collides(_global.DIR_UP_RIGHT, theRow, theCol);
_local4[_global.DIR_DOWN_LEFT] = Collides(_global.DIR_DOWN_LEFT, theRow, theCol);
_local4[_global.DIR_DOWN_RIGHT] = Collides(_global.DIR_DOWN_RIGHT, theRow, theCol);
return(_local4);
}
function GetPercentOnTile(theDir, theRow, theCol) {
var _local2 = GetRelativePosInDir(theDir, theRow, theCol);
var _local3 = 1;
var _local4 = 1;
var _local5 = Math.abs(Math.max(theCol, _local2.col) - Math.min(theCol + _local3, _local2.col + _local3)) / _local3;
var _local8 = Math.abs(Math.max(theRow, _local2.row) - Math.min(theRow + _local4, _local2.row + _local4)) / _local4;
return({rowP:_local8, colP:_local5});
}
function GetPosAbove(theRow, theCol) {
return({row:Math.max(0, Math.round(theRow) - 1), col:Math.round(theCol)});
}
function GetPosBelow(theRow, theCol) {
return({row:Math.min(mMapDataRows, Math.round(theRow) + 1), col:Math.round(theCol)});
}
function GetPosToLeft(theRow, theCol) {
return({row:Math.round(theRow), col:Math.max(0, Math.round(theCol) - 1)});
}
function GetPosToRight(theRow, theCol) {
return({row:Math.round(theRow), col:Math.min(mMapDataCols, Math.round(theCol) + 1)});
}
function GetPosOnTopOf(theRow, theCol) {
return({row:Math.round(theRow), col:Math.round(theCol)});
}
function GetPosBelowToLeft(theRow, theCol) {
return({row:Math.min(mMapDataRows, Math.round(theRow) + 1), col:Math.max(0, Math.round(theCol) - 1)});
}
function GetPosBelowToRight(theRow, theCol) {
return({row:Math.min(mMapDataRows, Math.round(theRow) + 1), col:Math.min(mMapDataCols, Math.round(theCol) + 1)});
}
function GetPosAboveToLeft(theRow, theCol) {
return({row:Math.max(0, Math.round(theRow) - 1), col:Math.max(0, Math.round(theCol) - 1)});
}
function GetPosAboveToRight(theRow, theCol) {
return({row:Math.max(0, Math.round(theRow) - 1), col:Math.min(mMapDataCols, Math.round(theCol) + 1)});
}
function GetRelativePosInDir(theDir, theRow, theCol) {
switch (theDir) {
case _global.DIR_LEFT :
return(GetPosToLeft(theRow, theCol));
case _global.DIR_RIGHT :
return(GetPosToRight(theRow, theCol));
case _global.DIR_UP :
return(GetPosAbove(theRow, theCol));
case _global.DIR_DOWN :
return(GetPosBelow(theRow, theCol));
case _global.DIR_UP_LEFT :
return(GetPosAboveToLeft(theRow, theCol));
case _global.DIR_UP_RIGHT :
return(GetPosAboveToRight(theRow, theCol));
case _global.DIR_DOWN_LEFT :
return(GetPosBelowToLeft(theRow, theCol));
case _global.DIR_DOWN_RIGHT :
return(GetPosBelowToRight(theRow, theCol));
}
return(GetPosOnTopOf(theRow, theCol));
}
function Collides(theDir, theRow, theCol) {
var _local2 = GetRelativePosInDir(theDir, theRow, theCol);
var _local3 = GetMapData(_local2.row, _local2.col);
if (_local3 > 0) {
return({dir:theDir, row:_local2.row, col:_local2.col, type:_local3});
}
return(null);
}
function FindTilesOfType(type) {
var _local6 = new Array();
var _local3 = 0;
while (_local3 < mMapDataRows) {
var _local2 = 0;
while (_local2 < mMapDataCols) {
if (GetMapData(_local3, _local2) == type) {
_local6.push({row:_local3, col:_local2});
}
_local2++;
}
_local3++;
}
return(_local6);
}
function SetIndicesToType(type, indices) {
var _local2 = 0;
while (_local2 < indices.length) {
ResetTile(type, indices[_local2].row, indices[_local2].col);
_local2++;
}
}
function ClearMap() {
var _local3 = 0;
while (_local3 < mMapDataSize) {
mMapData[_local3] = 0;
_local3++;
}
_local3 = 0;
while (_local3 < mCornerMCSize) {
if (mCornerMC[_local3] != null) {
var _local4 = mCornerMC[_local3];
var _local2 = 0;
while (_local2 < _local4.length) {
_local4[_local2].removeMovieClip();
_local2++;
}
delete mCornerMC[_local3];
}
mCornerMC[_local3] = null;
_local3++;
}
mLastValidDepth = 0;
}
function GenerateMap() {
var _local2 = 0;
mLastValidDepth = GenerateCornerTiles(_local2);
}
function ResetTile(theTileType, theRow, theCol) {
var _local16 = GetMapData(theRow, theCol);
SetMapData(theTileType, theRow, theCol);
var _local9 = GetPosAboveToLeft(theRow, theCol);
var _local14 = GetPosBelowToRight(theRow, theCol);
var _local12 = _local14.row - _local9.row;
var _local11 = _local14.col - _local9.col;
var _local5;
var _local10 = mLastValidDepth;
var _local4 = _local9.row;
while (_local4 <= (_local9.row + _local12)) {
var _local3 = _local9.col;
while (_local3 <= (_local9.col + _local11)) {
RemoveCornerMCs(_local4, _local3);
_local5 = GetStaticCornerTileTypes(_local4, _local3);
var _local2 = 0;
while (_local2 < _local5.length) {
var _local6 = GetCornerId(_local5[_local2], _local4, _local3);
var _local8 = _local10++;
var _local7 = mGameFactory.CreateTile(_local5[_local2], _local6, mParentMC, _local8);
SetCornerMC(_local7, _local4, _local3);
_local2++;
}
_local3++;
}
_local4++;
}
mLastValidDepth = _local10;
Reshape();
return(_local16);
}
function GenerateCornerTiles(startingDepth) {
var _local9 = startingDepth;
var _local5;
var _local10 = 0;
var _local6 = 0;
while (_local6 < mCornerMCRows) {
var _local3 = 0;
while (_local3 < mCornerMCCols) {
_local5 = GetStaticCornerTileTypes(_local6, _local3);
if (_local5.length > 0) {
var _local2 = 0;
while (_local2 < _local5.length) {
var _local7 = GetCornerId(_local5[_local2], _local6, _local3);
var _local8 = _local9++;
var _local4 = mGameFactory.CreateTile(_local5[_local2], _local7, mParentMC, _local8);
if ((_local4 == null) || (_local4 == undefined)) {
} else {
_local10++;
SetCornerMC(_local4, _local6, _local3);
}
_local2++;
}
}
_local3++;
}
_local6++;
}
return(_local9);
}
function Reshape() {
var _local9 = mGameFactory.currScaleFactorX;
var _local8 = mGameFactory.currScaleFactorY;
var _local6 = mTileDim * _local9;
var _local7 = mTileDim * _local8;
var _local5 = 0;
while (_local5 < mCornerMCRows) {
var _local4 = 0;
while (_local4 < mCornerMCCols) {
var _local3 = GetCorner(_local5, _local4);
if (_local3 == null) {
} else {
var _local2 = 0;
while (_local2 < _local3.length) {
_local3[_local2]._x = Math.ceil((_local4 * _local6) + 0.5);
_local3[_local2]._y = Math.ceil((_local5 * _local7) + 0.5);
_local3[_local2]._width = Math.ceil(_local6 + 0.5);
_local3[_local2]._height = Math.ceil(_local7 + 0.5);
_local2++;
}
}
_local4++;
}
_local5++;
}
}
function DrawGrid(mc) {
trace("Generating Grid");
var _local12 = mGameFactory.currScaleFactorX;
var _local11 = mGameFactory.currScaleFactorY;
var _local7 = mTileDim * _local12;
var _local8 = mTileDim * _local11;
var _local10 = 0;
var _local9 = new TextFormat();
_local9.color = 16711680 /* 0xFF0000 */;
_local9.align = "center";
_local9.size = 10;
var _local4 = 0;
while (_local4 < mMapDataRows) {
var _local2 = 0;
while (_local2 < mMapDataCols) {
var _local6 = (_local4 * mMapDataCols) + _local2;
var _local3 = "grid" + _local6;
mc.createTextField(_local3, _local10++, Math.ceil((_local2 * _local7) + 0.5), Math.ceil((_local4 * _local8) + 0.5), Math.ceil(_local7 + 0.5), Math.ceil(_local8 + 0.5));
mc[_local3].text = (("" + _local4) + ":") + _local2;
mc[_local3].setTextFormat(_local9);
_local2++;
}
_local4++;
}
}
function GetScreenXPercent(colCoord) {
return((colCoord * mTileDim) / mGameFactory.virtualScreenWidth);
}
function GetScreenYPercent(rowCoord) {
return((rowCoord * mTileDim) / mGameFactory.virtualScreenHeight);
}
function inMapDataBounds(row, col) {
if ((((row >= 0) && (row < (mMapDataRows - 0.9))) && (col >= 0)) && (col < (mMapDataCols - 0.9))) {
return(true);
}
trace((("Map rows: " + mMapDataRows) + " cols: ") + mMapDataCols);
return(false);
}
function GetStaticCornerTileTypes(theRow, theCol) {
var _local3 = new Array();
var _local2;
_local2 = GetMapData(theRow - 1, theCol - 1);
if (mGameFactory.isStaticTile(_local2)) {
_local3.push(_local2);
}
_local2 = GetMapData(theRow - 1, theCol);
if (mGameFactory.isStaticTile(_local2)) {
_local3.push(_local2);
}
_local2 = GetMapData(theRow, theCol - 1);
if (mGameFactory.isStaticTile(_local2)) {
_local3.push(_local2);
}
_local2 = GetMapData(theRow, theCol);
if (mGameFactory.isStaticTile(_local2)) {
_local3.push(_local2);
}
return(_local3);
}
function GetCornerId(theType, theRow, theCol) {
var _local2 = 0;
if (GetMapData(theRow - 1, theCol - 1) == theType) {
_local2 = _local2 | 8;
}
if (GetMapData(theRow - 1, theCol) == theType) {
_local2 = _local2 | 4;
}
if (GetMapData(theRow, theCol - 1) == theType) {
_local2 = _local2 | 2;
}
if (GetMapData(theRow, theCol) == theType) {
_local2 = _local2 | 1;
}
return(int(_local2));
}
function GetMapData(theRow, theCol) {
if ((((theRow >= 0) && (theRow < mMapDataRows)) && (theCol >= 0)) && (theCol < mMapDataCols)) {
return(mMapData[(theRow * mMapDataCols) + theCol]);
}
return(-1);
}
function SetMapData(theTileType, theRow, theCol) {
if ((((theRow >= 0) && (theRow < mMapDataRows)) && (theCol >= 0)) && (theCol < mMapDataCols)) {
mMapData[(theRow * mMapDataCols) + theCol] = theTileType;
}
}
function GetCorner(theRow, theCol) {
if ((((theRow >= 0) && (theRow < mCornerMCRows)) && (theCol >= 0)) && (theCol < mCornerMCCols)) {
return(mCornerMC[(theRow * mCornerMCCols) + theCol]);
}
return(null);
}
function RemoveCornerMCs(theRow, theCol) {
if ((((theRow >= 0) && (theRow < mCornerMCRows)) && (theCol >= 0)) && (theCol < mCornerMCCols)) {
var _local4 = (theRow * mCornerMCCols) + theCol;
var _local3 = mCornerMC[_local4];
if (_local3 == null) {
return(undefined);
}
var _local2 = 0;
while (_local2 < _local3.length) {
_local3[_local2].removeMovieClip();
_local2++;
}
delete mCornerMC[_local4];
}
}
function SetCornerMC(theMC, theRow, theCol) {
if (theMC == null) {
return(undefined);
}
if ((((theRow >= 0) && (theRow < mCornerMCRows)) && (theCol >= 0)) && (theCol < mCornerMCCols)) {
var _local2 = (theRow * mCornerMCCols) + theCol;
if (mCornerMC[_local2] == null) {
mCornerMC[_local2] = new Array();
}
mCornerMC[_local2].push(theMC);
}
}
}
Symbol 2126 MovieClip [__Packages.com.sandlot.GrannyInParadise.FPSCounter] Frame 0
class com.sandlot.GrannyInParadise.FPSCounter
{
var mMaxSamples, mFrameDeltaSamples, mLastFrameTime;
function FPSCounter (maxSamples) {
mMaxSamples = maxSamples;
mFrameDeltaSamples = new Array();
mLastFrameTime = 0;
}
function ComputeFPS() {
if (mFrameDeltaSamples.length <= 0) {
return(0);
}
var _local3 = 0;
var _local2 = 0;
while (_local2 < mFrameDeltaSamples.length) {
_local3 = _local3 + mFrameDeltaSamples[_local2];
_local2++;
}
_local3 = _local3 / mFrameDeltaSamples.length;
return(1000 / _local3);
}
function UpdateCount() {
var _local2 = getTimer();
var _local3 = _local2 - mLastFrameTime;
mLastFrameTime = _local2;
while (mFrameDeltaSamples.length >= mMaxSamples) {
mFrameDeltaSamples.shift();
}
mFrameDeltaSamples.push(_local3);
}
}
Symbol 2127 MovieClip [__Packages.com.sandlot.GrannyInParadise.PathManager] Frame 0
class com.sandlot.GrannyInParadise.PathManager
{
var mGame, mNumRows, mNumCols, mVertices, mEdges, mPaths;
function PathManager (theGame) {
mGame = theGame;
mNumRows = mGame.mTileMap.mMapDataRows;
mNumCols = mGame.mTileMap.mMapDataCols;
ResetGraph();
}
function ResetGraph() {
mVertices = new Array();
mEdges = new Array();
mPaths = new Array();
}
function GetIndex(row, col) {
return((row * mNumCols) + col);
}
function GetPos(index) {
return({row:int(index / mNumCols), col:int(index % mNumCols)});
}
function CanWalkOffLadder(collisions, dir) {
if (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_NONE].type) && (collisions[dir] == null)) {
return(true);
}
return(false);
}
function CanHandOverHandInDir(collisions, dir) {
if (mGame.mGameFactory.isTileHandOverHandable(collisions[_global.DIR_NONE].type) || (mGame.mGameFactory.isTileHandOverHandable(collisions[dir].type))) {
return(true);
}
return(false);
}
function CanWalkInDir(collisions, dir) {
if ((((collisions[_global.DIR_NONE] == null) || (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_NONE].type) && (mGame.mGameFactory.doesTileStopMovement(collisions[_global.DIR_DOWN].type) || (mGame.mGameFactory.doesTileStopMovement(collisions[((dir == _global.DIR_LEFT) ? (_global.DIR_DOWN_LEFT) : (_global.DIR_DOWN_RIGHT))].type))))) && (collisions[_global.DIR_DOWN] != null)) && ((collisions[dir] == null) || (mGame.mGameFactory.isTileClimbable(collisions[dir].type)))) {
return(true);
}
return(false);
}
function CanFall(collisions) {
if (((!CanClimbDown()) && ((collisions[_global.DIR_NONE] == null) || (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_NONE].type)))) && (collisions[_global.DIR_DOWN] == null)) {
return(true);
}
}
function CanClimbUp(collisions) {
if ((mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_NONE].type) && ((collisions[_global.DIR_UP] == null) || (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_UP].type)))) && (collisions[_global.DIR_DOWN] != null)) {
return(true);
}
return(false);
}
function CanDigInDir(collisions, dir) {
var _local4 = ((dir == _global.DIR_LEFT) ? (_global.DIR_DOWN_LEFT) : (_global.DIR_DOWN_RIGHT));
if ((((((collisions[dir] == null) || (mGame.mGameFactory.isTileClimbable(collisions[dir].type))) && (collisions[_local4] != null)) && ((collisions[_global.DIR_NONE] == null) || (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_NONE].type)))) && (collisions[_global.DIR_DOWN] != null)) && (mGame.mGameFactory.isTileDiggable(collisions[_local4].type))) {
return(true);
}
return(false);
}
function CanClimbDown(collisions) {
if ((((collisions[_global.DIR_NONE] == null) || (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_NONE].type))) && (collisions[_global.DIR_DOWN] != null)) && (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_DOWN].type))) {
return(true);
}
return(false);
}
function CanStand(collisions) {
if (((collisions[_global.DIR_NONE] == null) || (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_NONE].type))) && ((collisions[_global.DIR_DOWN] != null) || (mGame.mGameFactory.isTileClimbable(collisions[_global.DIR_DOWN].type)))) {
return(true);
}
return(false);
}
function AddVertex(theRow, theCol) {
var _local2 = GetIndex(theRow, theCol).toString(10);
if ((mVertices[_local2] == null) || (mVertices[_local2] == undefined)) {
mVertices[_local2] = {row:theRow, col:theCol, children:null};
}
return(mVertices[_local2]);
}
function AddEdge(theSrc, theDst, theDir) {
var _local4 = GetIndex(theSrc.row, theSrc.col).toString(10);
var _local6 = GetIndex(theDst.row, theDst.col).toString(10);
if (mVertices[_local4] == null) {
AddVertex(theSrc.row, theSrc.col);
}
if (mVertices[_local6] == null) {
AddVertex(theDst.row, theDst.col);
}
if (mVertices[_local4].children == null) {
mVertices[_local4].children = new Array();
}
mVertices[_local4].children[theDir] = theDst;
var _local2 = new Object();
_local2.src = theSrc;
_local2.dst = theDst;
_local2.dir = theDir;
mEdges.push(_local2);
return(_local2);
}
function GetAllSubPaths(path) {
var _local7 = new Array();
var _local5 = 0;
while (_local5 < (path.length - 1)) {
var _local3 = _local5 + 1;
while (_local3 < path.length) {
var _local4 = new Array();
var _local2 = _local5;
while (_local2 <= _local3) {
_local4.push(CopyNode(path[_local2]));
_local2++;
}
_local7.push(_local4);
_local3++;
}
_local5++;
}
return(_local7);
}
function CopyNode(node) {
return({row:node.row, col:node.col, parent:node.parent, child_type:node.child_type});
}
function GetPath(srcRow, srcCol, dstRow, dstCol, canLadderOff) {
var _local5 = new Array();
for (var _local11 in mVertices) {
mVertices[_local11].parent = null;
mVertices[_local11].child_type = null;
}
var _local17 = GetIndex(srcRow, srcCol).toString(10);
var _local15 = mVertices[_local17];
if ((_local15 == null) || (_local15 == undefined)) {
return(null);
}
_local15.parent = -1;
_local5.unshift(_local15);
while (_local5.length > 0) {
var _local2 = _local5.pop();
if ((_local2.row == dstRow) && (_local2.col == dstCol)) {
var _local4 = new Array();
var _local3 = {row:_local2.row, col:_local2.col, parent:_local2.parent, child_type:_local2.child_type};
while (_local3.parent != -1) {
_local4.unshift(_local3);
_local3 = {row:_local3.parent.row, col:_local3.parent.col, parent:_local3.parent.parent, child_type:_local3.parent.child_type};
}
return(_local4);
}
if (_local2.children == null) {
continue;
}
var _local10 = mVertices[_local11];
for (var _local13 in _local2.children) {
if (((!canLadderOff) && (_local13 == "LL")) || (_local13 == "LR")) {
continue;
}
if ((((_local13 == "DL") || (_local13 == "DR")) || (_local13 == "S")) || (_local13 == "HF")) {
continue;
}
if (_local2.children[_local13].parent == null) {
_local2.children[_local13].parent = _local2;
_local2.children[_local13].child_type = _local13;
_local5.unshift(_local2.children[_local13]);
}
}
}
return(null);
}
function SnapRow(theRow) {
var _local3 = int(theRow);
var _local2 = int(theRow) + 1;
return(((Math.abs(_local3 - theRow) < Math.abs(_local2 - theRow)) ? (_local3) : (_local2)));
}
function intersect(tileA, tileB) {
if (tileA > (tileB + 1)) {
return(0);
}
if (tileB > (tileA + 1)) {
return(0);
}
var _local4 = Math.max(tileA, tileB);
var _local3 = Math.min(tileA + 1, tileB + 1);
if (_local4 > _local3) {
return(0);
}
return((_local3 - _local4) / 1);
}
function SnapCol(theCol) {
var _local2 = int(theCol);
var _local4 = int(theCol) + 1;
var _local6 = intersect(theCol, _local2);
var _local5 = intersect(theCol, _local4);
return(((_local6 > _local5) ? (_local2) : (_local4)));
}
function HighlightPathNode(mc, theRow, theCol, color, alpha) {
mc.clear();
var _local6 = mGame.mGameFactory.currScaleFactorX;
var _local5 = mGame.mGameFactory.currScaleFactorY;
var _local2 = mGame.mTileMap.mTileDim * _local6;
var _local3 = mGame.mTileMap.mTileDim * _local5;
FillRect2(mc, SnapCol(theCol) * _local2, SnapRow(theRow) * _local3, _local2, _local3, color, alpha);
mc.lineStyle(2, 0);
FillRect(mc, (theCol + 0.5) * _local2, (theRow + 0.5) * _local3, 4, 65280);
}
function NeighborHasEdgeOfType(theRow, theCol, theNeighbor, theLabel) {
trace(((" Checking neighbor: " + theNeighbor) + " for child: ") + theLabel);
theRow = SnapRow(theRow);
theCol = SnapCol(theCol);
var _local6 = GetIndex(theRow, theCol).toString(10);
var _local2 = mVertices[_local6];
if ((_local2 == null) || (_local2 == undefined)) {
trace("Couldn't find parent node");
return(false);
}
for (var _local3 in _local2.children) {
trace("Found child: " + _local3);
}
var _local4 = _local2.children[theNeighbor];
if ((_local4 == null) || (_local4 == undefined)) {
trace("Couldn't find neighbor node");
return(false);
}
var _local5 = _local4.children[theLabel];
if ((_local5 == null) || (_local5 == undefined)) {
trace("Couldn't find child node");
return(false);
}
return(true);
}
function NodeHasEdgeOfType(theRow, theCol, theLabel) {
theRow = SnapRow(theRow);
theCol = SnapCol(theCol);
var _local4 = GetIndex(theRow, theCol).toString(10);
var _local2 = mVertices[_local4];
if ((_local2 == null) || (_local2 == undefined)) {
return(false);
}
var _local3 = _local2.children[theLabel];
if ((_local3 == null) || (_local3 == undefined)) {
return(false);
}
return(true);
}
function KillChildrenOf(theRow, theCol) {
var _local4 = GetIndex(theRow, theCol).toString(10);
var _local2 = mVertices[_local4];
if ((_local2 == null) || (_local2 == undefined)) {
return(undefined);
}
for (var _local3 in _local2.children) {
delete _local2.children[_local3];
}
}
function ChangeLabel(theRow, theCol, oldLabel, newLabel) {
var _local2 = GetIndex(theRow, theCol).toString(10);
if ((mVertices[_local2] == null) || (mVertices[_local2] == undefined)) {
trace((("Couldn't change node child: " + oldLabel) + " to : ") + newLabel);
trace("Vertex doesn't exist");
return(undefined);
}
var _local4 = mVertices[_local2].children[oldLabel];
if ((_local4 == null) || (_local4 == undefined)) {
trace((((((("Couldn't change node child: " + theRow) + ",") + theCol) + " : ") + oldLabel) + " to : ") + newLabel);
trace("Child doesn't exist");
return(undefined);
}
mVertices[_local2].children[oldLabel] = null;
mVertices[_local2].children[newLabel] = _local4;
trace((((((("Changed label of: " + theRow) + ",") + theCol) + " for child: ") + oldLabel) + " to : ") + newLabel);
}
function ResetNode(theRow, theCol) {
trace((("RESETTING: " + theRow) + ": ") + theCol);
KillChildrenOf(theRow - 1, theCol - 1);
KillChildrenOf(theRow - 1, theCol);
KillChildrenOf(theRow, theCol + 1);
KillChildrenOf(theRow, theCol - 1);
KillChildrenOf(theRow, theCol);
KillChildrenOf(theRow, theCol + 1);
KillChildrenOf(theRow + 1, theCol - 1);
KillChildrenOf(theRow + 1, theCol);
KillChildrenOf(theRow + 1, theCol + 1);
CreateNode(theRow - 1, theCol - 1);
CreateNode(theRow - 1, theCol);
CreateNode(theRow, theCol + 1);
CreateNode(theRow, theCol - 1);
CreateNode(theRow, theCol);
CreateNode(theRow, theCol + 1);
CreateNode(theRow + 1, theCol - 1);
CreateNode(theRow + 1, theCol);
CreateNode(theRow + 1, theCol + 1);
}
function CreateNode(theRow, theCol) {
var _local7 = GetIndex(theRow, theCol);
var _local6 = mGame.mTileMap.GetMapCollisions(theRow, theCol);
if ((theCol > 0) && (CanWalkInDir(_local6, _global.DIR_LEFT))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow, theCol - 1), "L");
}
if ((theCol < (mNumCols - 1)) && (CanWalkInDir(_local6, _global.DIR_RIGHT))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow, theCol + 1), "R");
}
if ((theCol > 0) && (CanHandOverHandInDir(_local6, _global.DIR_LEFT))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow, theCol - 1), "HL");
}
if ((theCol < (mNumCols - 1)) && (CanHandOverHandInDir(_local6, _global.DIR_RIGHT))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow, theCol + 1), "HR");
}
if ((theRow > 0) && (CanClimbUp(_local6))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow - 1, theCol), "U");
}
if ((theRow < (mNumRows - 1)) && (CanClimbDown(_local6))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow + 1, theCol), "D");
}
if (CanFall(_local6)) {
var _local5 = theRow + 1;
while (mGame.mTileMap.GetMapData(_local5, theCol) == 0) {
_local5++;
}
_local5--;
AddEdge(AddVertex(theRow, theCol), AddVertex(_local5, theCol), "F");
}
if ((theCol > 0) && (CanWalkOffLadder(_local6, _global.DIR_LEFT))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow, theCol - 1), "LL");
}
if ((theCol < (mNumCols - 1)) && (CanWalkOffLadder(_local6, _global.DIR_RIGHT))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow, theCol + 1), "LR");
}
if ((theCol > 0) && (CanDigInDir(_local6, _global.DIR_LEFT))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow, theCol - 1), "DL");
}
if ((theCol < (mNumCols - 1)) && (CanDigInDir(_local6, _global.DIR_RIGHT))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow, theCol + 1), "DR");
}
if ((theRow > 0) && (CanStand(_local6))) {
AddEdge(AddVertex(theRow, theCol), AddVertex(theRow + 1, theCol), "S");
}
}
function CreateGraph() {
ResetGraph();
var _local3 = 0;
while (_local3 < mNumRows) {
var _local2 = 0;
while (_local2 < mNumCols) {
CreateNode(_local3, _local2);
_local2++;
}
_local3++;
}
}
function DrawPath(mc, startRow, startCol, path) {
mc.clear();
var _local8 = mGame.mGameFactory.currScaleFactorX;
var _local7 = mGame.mGameFactory.currScaleFactorY;
var _local5 = mGame.mTileMap.mTileDim * _local8;
var _local6 = mGame.mTileMap.mTileDim * _local7;
mc.lineStyle(8, 16711935);
mc.moveTo((startCol + 0.5) * _local5, (startRow + 0.5) * _local6);
var _local2 = 0;
while (_local2 < path.length) {
mc.lineTo((path[_local2].col + 0.5) * _local5, (path[_local2].row + 0.5) * _local6);
_local2++;
}
}
function DrawGraph(mc) {
return(undefined);
if ("DrawGraph" != null) {
var _local11 = "DrawGraph";
if (mVertices[_local11].children == null) {
// unexpected jump
}
var _local5 = mVertices[_local11];
for (var _local10 in mVertices[_local11].children) {
if (mVertices[_local11].children[_local10] == null) {
continue;
}
var _local7 = mVertices[_local11].children[_local10];
var _local3 = 0;
var _local4 = 0;
var _local2 = 16777215 /* 0xFFFFFF */;
switch (_local10) {
case "L" :
_local3 = 3;
_local2 = 16711680 /* 0xFF0000 */;
break;
case "LL" :
_local3 = 3;
_local2 = 16711680 /* 0xFF0000 */;
break;
case "HL" :
_local3 = 3;
_local2 = 16777215 /* 0xFFFFFF */;
break;
case "DL" :
_local3 = 9;
_local2 = 4456448 /* 0x440000 */;
break;
case "R" :
_local3 = -3;
_local2 = 65280;
break;
case "LR" :
_local3 = -3;
_local2 = 65280;
break;
case "HR" :
_local3 = -3;
_local2 = 0;
break;
case "DR" :
_local3 = -9;
_local2 = 68;
break;
case "U" :
_local4 = -3;
_local2 = 255;
break;
case "D" :
_local4 = 3;
_local2 = 16776960 /* 0xFFFF00 */;
break;
case "F" :
_local4 = 3;
_local2 = 16711935 /* 0xFF00FF */;
break;
case "HF" :
_local4 = 3;
_local2 = 16777215 /* 0xFFFFFF */;
break;
case "S" :
_local4 = 3;
_local2 = 65280;
}
mc.lineStyle(2, _local2);
mc.moveTo(((_local5.col + 0.5) * _local8) + _local4, ((_local5.row + 0.5) * _local9) + _local3);
mc.lineTo(((_local7.col + 0.5) * _local8) + _local4, ((_local7.row + 0.5) * _local9) + _local3);
FillRect(mc, ((_local5.col + 0.5) * _local8) + _local4, ((_local5.row + 0.5) * _local9) + _local3, 4, _local2);
}
// unexpected jump
}
}
function FillRect2(mc, x, y, width, height, rgb, alpha) {
var _local8 = width / 2;
var _local7 = height / 2;
mc.beginFill(rgb, alpha);
mc.moveTo(x, y);
mc.lineTo(x + width, y);
mc.lineTo(x + width, y + height);
mc.lineTo(x, y + height);
mc.lineTo(x, y);
mc.endFill(rgb, alpha);
}
function FillRect(mc, x, y, size, rgb) {
var _local1 = size / 2;
mc.moveTo(x - _local1, y - _local1);
mc.lineTo(x + _local1, y - _local1);
mc.lineTo(x + _local1, y + _local1);
mc.lineTo(x - _local1, y + _local1);
mc.lineTo(x - _local1, y - _local1);
}
}
Symbol 2128 MovieClip [__Packages.com.sandlot.GrannyInParadise.entity.ParticleSystem] Frame 0
class com.sandlot.GrannyInParadise.entity.ParticleSystem extends com.sandlot.GrannyInParadise.LevelEntity
{
var mSystemMC, mGame, mParticles, mSystemDesc, mTimer, mEmissions, mRemove, mStarted, mColPos, mRowPos;
function ParticleSystem (systemDesc, timer, theGame, depth) {
super("emitter_sprite", -1, theGame, depth);
mSystemMC = mGame.mHUDOverlay.createEmptyMovieClip("ParticleSystem" + depth, depth);
mParticles = new Array();
mSystemDesc = systemDesc;
mTimer = timer;
mEmissions = 0;
mRemove = new Array();
mStarted = false;
}
function onTimerEvent(event) {
if (!mStarted) {
mStarted = true;
}
if (mEmissions < mSystemDesc.numEmits) {
Emit();
} else {
mTimer.RemoveTimerEvent(event);
}
}
function StartEmit() {
mTimer.StartTimerEvent(mSystemDesc.emitInterval, this);
}
function Unload() {
super.Unload();
mSystemMC.removeMovieClip();
}
function Update() {
if (!mStarted) {
return(undefined);
}
mSystemMC.clear();
var _local2 = 0;
while (_local2 < mParticles.length) {
mParticles[_local2].x = mParticles[_local2].x + mParticles[_local2].vx;
mParticles[_local2].y = mParticles[_local2].y + mParticles[_local2].vy;
mParticles[_local2].vy = mParticles[_local2].vy + mSystemDesc.gravity;
mSystemMC.lineStyle();
mSystemMC.beginFill(mParticles[_local2].color, 100 * (mParticles[_local2].age / mParticles[_local2].lifespan));
mSystemMC.moveTo(mParticles[_local2].x, mParticles[_local2].y);
mSystemMC.lineTo(mParticles[_local2].x + mSystemDesc.particleSize, mParticles[_local2].y);
mSystemMC.lineTo(mParticles[_local2].x + mSystemDesc.particleSize, mParticles[_local2].y + mSystemDesc.particleSize);
mSystemMC.lineTo(mParticles[_local2].x, mParticles[_local2].y + mSystemDesc.particleSize);
mSystemMC.lineTo(mParticles[_local2].x, mParticles[_local2].y);
mSystemMC.endFill();
if (mParticles[_local2].age <= 0) {
mRemove.push(_local2);
} else {
mParticles[_local2].age--;
}
_local2++;
}
_local2 = 0;
while (_local2 < mRemove.length) {
mParticles.splice(mRemove[_local2], 1);
_local2++;
}
if (mParticles.length <= 0) {
mSystemMC.clear();
mGame.RemoveEntity(this);
}
}
function Emit() {
var _local5 = 0;
while (_local5 < mSystemDesc.numParticlesPerEmit) {
var _local2 = new Object();
_local2.x = ((mColPos * 32) - (mSystemDesc.particleSize / 2)) + (Math.random() * 32);
_local2.y = (mRowPos * 32) - (mSystemDesc.particleSize / 2);
var _local7 = Math.floor(Math.random() * mSystemDesc.colors.length);
_local2.color = mSystemDesc.colors[_local7];
var _local3 = (mSystemDesc.angle - (mSystemDesc.spread / 2)) + (Math.random() * mSystemDesc.spread);
var _local4 = mSystemDesc.speed_lo + (Math.random() * (mSystemDesc.speed_hi - mSystemDesc.speed_lo));
var _local9 = _local4 * Math.cos((Math.PI/180) * _local3);
var _local8 = (-_local4) * Math.sin((Math.PI/180) * _local3);
var _local6 = mSystemDesc.ttl_lo + (Math.random() * (mSystemDesc.ttl_hi - mSystemDesc.ttl_lo));
_local2.age = _local6;
_local2.lifespan = _local6;
_local2.vx = _local9;
_local2.vy = _local8;
mParticles.push(_local2);
_local5++;
}
mEmissions++;
}
}
Symbol 2129 MovieClip [__Packages.com.sandlot.GrannyInParadise.PerformanceManager] Frame 0
class com.sandlot.GrannyInParadise.PerformanceManager
{
var mRootNode;
function PerformanceManager () {
mRootNode = new Object();
mRootNode.name = "root";
mRootNode.children = new Array();
}
function Start(section_path) {
var _local3 = section_path.split(".");
var _local4 = mRootNode;
var _local5 = "root";
var _local2 = 0;
while (_local2 < _local3.length) {
_local5 = (_local5 + ".") + _local3[_local2];
if ((_local4.children[_local3[_local2]] == null) || (_local4.children[_local3[_local2]] == undefined)) {
_local4.children[_local3[_local2]] = new Object();
_local4.children[_local3[_local2]].name = _local3[_local2];
_local4.children[_local3[_local2]].path = _local5;
_local4.children[_local3[_local2]].children = new Array();
}
_local4 = _local4.children[_local3[_local2]];
_local2++;
}
trace("Drilled to node: " + _local4.path);
}
function Stop(section_path) {
}
}
Symbol 2130 MovieClip [__Packages.com.sandlot.GrannyInParadise.TutorialManager] Frame 0
class com.sandlot.GrannyInParadise.TutorialManager
{
var mTutorialData, mGame, mArrowMCs, mCurrentTutorial, mTipTextMC, mCurrentTipId, mCurrentTip;
function TutorialManager (theGame, theTutorialData) {
mTutorialData = theTutorialData;
mGame = theGame;
mGame.SetGameEventListener(this);
mArrowMCs = new Array();
}
function doesLevelHaveTutorial(theLevelNumber) {
return((mTutorialData[String(theLevelNumber + 1)] != undefined) && (mTutorialData[String(theLevelNumber + 1)] != null));
}
function StartTutorial(theLevelNumber) {
if (!doesLevelHaveTutorial(theLevelNumber)) {
return(undefined);
}
mCurrentTutorial = mTutorialData[String(theLevelNumber + 1)];
trace(("This tutorial has: " + mCurrentTutorial.length) + " Tips!");
mTipTextMC = mGame.mHUDOverlay.attachMovie("tip", "tip" + mCurrentTipId, 0);
LaunchTip(0);
}
function onGameEvent(name) {
trace("Game event: " + name);
if (name == "item_timeout") {
if (mCurrentTip.name == "3_2") {
LaunchNextTip("item_timeout");
}
} else if (mCurrentTip.code_event != null) {
trace((("VALID CODE EVENT IN TUTORIAL: " + mCurrentTip.code_event) + " = ") + name);
if (mCurrentTip.code_event == name) {
LaunchNextTip(mCurrentTip.codenext);
}
} else if (mCurrentTip.codenext != null) {
LaunchNextTip(mCurrentTip.codenext);
}
}
function TraceCurrentTip() {
for (var _local6 in mCurrentTip) {
switch (_local6) {
case "tilenext" :
var _local3 = mCurrentTip.tilenext;
for (var _local5 in _local3) {
trace((("[tilenext] " + _local5) + ":") + _local3[_local5]);
}
break;
case "arrows" :
if (mCurrentTip.arrows == null) {
break;
}
var _local2 = 0;
while (_local2 < mCurrentTip.arrows.length) {
for (var _local4 in mCurrentTip.arrows[_local2]) {
trace((("[arrow] " + _local4) + ":") + mCurrentTip.arrows[_local2][_local4]);
}
_local2++;
}
break;
default :
trace((_local6 + " : ") + mCurrentTip[_local6]);
}
}
}
function LaunchNextTip(nextTip) {
trace("Launching NExt tip! " + nextTip);
var _local2 = 0;
while (_local2 < mArrowMCs.length) {
mArrowMCs[_local2].removeMovieClip();
_local2++;
}
mArrowMCs = new Array();
var _local3 = 0;
_local2 = 0;
while (_local2 < mCurrentTutorial.length) {
if (mCurrentTutorial[_local2].name == nextTip) {
_local3 = _local2;
break;
}
_local2++;
}
LaunchTip(_local3);
}
function LaunchTip(theTipNumber) {
mCurrentTipId = theTipNumber;
mCurrentTip = mCurrentTutorial[theTipNumber];
trace("Finding text for tip: " + mCurrentTip.name);
_root.Localizer.Localize(mTipTextMC.frames.tip_text, mCurrentTip.name);
if (mCurrentTip.x != null) {
mTipTextMC._x = parseInt(mCurrentTip.x);
}
if (mCurrentTip.y != null) {
mTipTextMC._y = parseInt(mCurrentTip.y);
}
var _local9 = mTipTextMC.frames.tip_text.text;
trace("Found text: " + _local9);
var _local8 = _local9.split("\\n");
mTipTextMC.frames.tip_text.text = "";
var _local7 = "";
var _local4 = 0;
while (_local4 < _local8.length) {
_local7 = (_local7 + _local8[_local4]) + newline;
_local4++;
}
trace("Final Text :" + _local7);
mTipTextMC.frames.tip_text.text = _local7;
if (mCurrentTip.arrows != null) {
_local4 = 0;
while (_local4 < mCurrentTip.arrows.length) {
var _local5 = mCurrentTip.arrows[_local4];
var _local6 = mGame.mHUDOverlay.attachMovie(_local5.mc, _local5.mc + _local4, 1 + _local4);
_local6._x = _local5.x;
_local6._y = _local5.y;
mArrowMCs.push(_local6);
_local4++;
}
}
if (mCurrentTip.candig != null) {
mGame.setGrannyCanDig(((mCurrentTip.candig == "true") ? true : false));
}
if (mCurrentTip.canmove != null) {
trace("CAN Move:" + mCurrentTip.canmove);
mGame.setGrannyCanMove(((mCurrentTip.canmove == "true") ? true : false));
}
if (mCurrentTip.candirtrespawn != null) {
mGame.setCanDirtRespawn(((mCurrentTip.candirtrespawn == "true") ? true : false));
}
if (mCurrentTip.enemiesmove != null) {
mGame.setCanEnemiesMove(((mCurrentTip.enemiesmove == "true") ? true : false));
}
mGame.mGameFactory.onSoundQueue(_global.TUTORIAL);
}
function UpdateTutorial() {
if (mCurrentTip.tilenext != null) {
var _local2 = mCurrentTip.tilenext;
if (mGame.mGranny.CollidesWithPoint(int(_local2.y), int(_local2.x))) {
LaunchNextTip(_local2.next);
}
}
}
function StopTutorial() {
mTipTextMC.removeMovieClip();
var _local2 = 0;
while (_local2 < mArrowMCs.length) {
mArrowMCs[_local2].removeMovieClip();
_local2++;
}
}
}