Frame 1
_global.alert = function (strMsg, numFlag) {
debugSend = new LocalConnection();
debugSend.send("debugLC", "msg", strMsg, numFlag);
delete debugSend;
};
_global.traceAlert = function (strMsg) {
alert(strMsg, 0);
};
_global.query = this;
query.debugging = false;
initQuery = function () {
query.debugging = true;
queryReceive = new LocalConnection();
queryReceive.msg = function (strMsg) {
str = eval (strMsg);
alert((("your query (" + strMsg) + ") returned: ") + str, 1);
};
queryReceive.connect("queryLC");
};
var Debugger = new Object();
Debugger.keys = [false, false, false];
Debugger.debugging = false;
Debugger.openDebug = function () {
this.debugging = true;
getURL ("javascript:openDebug();");
if (!query.debugging) {
initQuery();
}
};
Debugger.onKeyDown = function () {
var _local2 = Key.getCode();
if (this.debugging == false) {
if ((this.keys[0] && (this.keys[1])) && (this.keys[2])) {
return(true);
}
if (_local2 == 17) {
this.keys[0] = true;
}
if (_local2 == 16) {
this.keys[1] = true;
}
if (_local2 == 68) {
this.keys[2] = true;
}
if ((this.keys[0] && (this.keys[1])) && (this.keys[2])) {
this.openDebug();
}
}
};
Debugger.onKeyUp = function () {
var _local2 = Key.getCode();
if (_local2 == 17) {
this.keys[0] = false;
}
if (_local2 == 16) {
this.keys[1] = false;
}
if (_local2 == 68) {
this.keys[2] = false;
}
if (((!this.keys[0]) && (!this.keys[1])) && (!this.keys[2])) {
this.debugging = false;
}
};
Key.addListener(Debugger);
_global.pRoot = this;
pRoot.path = this._url.substr(0, this._url.indexOf(".com") + 5);
alert(pRoot.path);
if (pRoot.path == "http://dev.ytv.com/") {
pDEVText.text = "This is on DEV Server";
}
if (pRoot.isExternal == 1) {
alert("OOOOOOOOOOOOOO " + pRoot.isExternal);
pRoot.amExternal = true;
pRoot.pPEXTText.text = "is External";
} else {
pRoot.amExternal = false;
alert("JJJJJJJJJJJJJJJ " + pRoot.isExternal);
pRoot.pPEXTText.text = "is " + pRoot.isExternal;
}
var pTileSize = 20;
var pObjectArray;
var pObsArray;
var pInitialized;
var pPause;
var pChances;
var pPlayer;
var pPDepthArray;
var pYArray;
var pKeyListener;
var pMapH;
var pMapW;
var pIncr = 10;
var pEIncr;
var pLevel;
var pRound;
var pScore;
var pEnemy;
var pFollow;
var pDogDecr;
var pDogAvailable;
var pDogBonus;
var pDogisBarking;
var pTilesCollected;
var pTilesToCollect;
var pDone;
var pSlowGo;
var pSlowCount;
var pScoreMod;
var pStopJoe;
var pMoDough;
var pSlowJo;
var pNewTricks;
funcHITBOX = function (arEvent, arAction) {
var _local1;
if (pRoot.amExternal) {
_local1 = (("http://www.ytv.com/gamepad/ExternalHitbox.asp?game={42fdacec-d1cc-4f84-af3b-f213a94879c8}&data=/gamepad/external/demo/" + arEvent.toLowerCase()) + "/") + arAction.toLowerCase();
var _local2 = new LoadVars();
_local2.onLoad = function (success) {
if (success) {
pRoot.funcPlayThisSound(pWoof);
}
};
_local2.load((("http://www.ytv.com/gamepad/ExternalHitbox.asp?game={42fdacec-d1cc-4f84-af3b-f213a94879c8}&data=/gamepad/external/demo/" + arEvent.toLowerCase()) + "/") + arAction.toLowerCase());
} else {
_local1 = ((("javascript: _hbLink ('/flash/" + arEvent.toLowerCase()) + "/") + arAction.toLowerCase()) + "','left','0,0,0,0')";
getURL (_local1);
}
};
funcInitVars = function () {
pIncr = 10;
pEIncr = 4;
pChances = 3;
pPause = false;
pInitialized = true;
pDogDecr = 2;
pDogAvailable = true;
pLevel = 1;
pRound = 1;
pScore = 0;
pTilesCollected = 0;
pDogBonus = 0;
pDone = false;
pScoreMod = 1;
pStopJoe = false;
pDogisBarking = false;
};
funcLevelUp = function () {
pPause = false;
pDogAvailable = true;
pDogisBarking = false;
pLevel++;
if (pLevel > 7) {
pLevel = 1;
pRound++;
}
if (pRound == 2) {
if (pEIncr == 2) {
pEIncr = 4;
} else if (pEIncr == 4) {
pEIncr = 5;
}
} else if (pRound >= 3) {
if (pEIncr == 4) {
pEIncr = 5;
}
}
pTilesCollected = 0;
pDogBonus = 0;
pDone = false;
};
funcPlayAgain = function () {
pInitialized = undefined;
pRoot.gotoAndPlay("levelin");
};
funcCheckCode = function () {
alert(pInputtext.text);
var _local2 = pInputtext.text.toLowerCase();
var _local1 = false;
switch (_local2) {
case "newtricks" :
pNewTricks = true;
pDogDecr = 1;
_local1 = true;
break;
case "slowjo" :
pSlowJo = true;
pEIncr = 2;
_local1 = true;
break;
case "modough" :
pMoDough = true;
pScoreMod = 2;
_local1 = true;
}
if (_local1) {
pRoot.funcHITBOX("misc", "valid_code_" + pInputtext.text.toLowerCase());
pRoot.gotoAndPlay("validcode");
} else {
pInputtext.text = "INVALID CODE";
}
};
funcCheckCodeImplementation = function () {
if (pNewTricks != undefined) {
pDogDecr = 1;
pNewTricks = undefined;
}
if (pSlowJo != undefined) {
pEIncr = 2;
pSlowJo = undefined;
}
if (pMoDough != undefined) {
pScoreMod = 2;
pMoDough = undefined;
}
};
funcStartLevel = function () {
funcReadMap();
funcCreateObjectArray();
funcAddObstacles();
funcAddTiles();
funcAddPlayer();
funcAddEnemy();
funcCheckCodeImplementation();
pTilesCollected = 0;
alert("pEIncr " + pEIncr);
};
funcUpdateBonusHUD = function () {
pLevelHUD.pScore.text = pScore;
pLevelHUD.pBonus.text = String(pDogBonus * 5);
pLevelHUD.pTotal.text = String(pScore + ((pDogBonus * 5) * pScoreMod));
pScore = pScore + ((pDogBonus * 5) * pScoreMod);
};
funcReadMap = function () {
switch (pLevel) {
case 1 :
pObsArray = [[1, 1, "ob0"], [18, 1, "ob0"], [1, 12, "ob0"], [18, 12, "ob0"], [7, 4, "ob2"], [11, 4, "ob2"], [7, 8, "ob2"], [11, 8, "ob2"]];
return;
case 2 :
pObsArray = [[2, 6, "ob0"], [7, 6, "ob0"], [12, 6, "ob0"], [17, 6, "ob0"], [10, 3, "ob2"], [20, 3, "ob2"], [5, 8, "ob2"], [15, 8, "ob2"]];
return;
case 3 :
pObsArray = [[0, 0, "ob0"], [0, 10, "ob0"], [19, 0, "ob0"], [19, 10, "ob0"], [5, 7, "ob0"], [16, 7, "ob0"], [8, 3, "ob3"], [12, 9, "ob3"], [0, 3, "ob1"], [4, 13, "ob1"], [14, 3, "ob1"], [18, 13, "ob1"]];
return;
case 4 :
pObsArray = [[0, 0, "ob3"], [20, 0, "ob3"], [4, 11, "ob3"], [16, 11, "ob3"], [3, 0, "ob2"], [17, 0, "ob2"], [1, 12, "ob2"], [19, 12, "ob2"], [6, 6, "ob2"], [13, 6, "ob2"], [9, 5, "ob0"], [9, 8, "ob0"]];
return;
case 5 :
pObsArray = [[7, 6, "ob0"], [13, 6, "ob0"], [10, 8, "ob0"], [0, 0, "ob2"], [4, 0, "ob2"], [8, 0, "ob2"], [12, 0, "ob2"], [16, 0, "ob2"], [20, 0, "ob2"], [2, 12, "ob2"], [6, 12, "ob2"], [10, 12, "ob2"], [14, 12, "ob2"], [18, 12, "ob2"], [2, 4, "ob1"], [17, 9, "ob1"], [2, 8, "ob1"], [17, 4, "ob1"]];
return;
case 6 :
pObsArray = [[2, 2, "ob4"], [2, 12, "ob4"], [19, 2, "ob4"], [19, 12, "ob4"], [5, 5, "ob4"], [5, 9, "ob4"], [16, 5, "ob4"], [16, 9, "ob4"], [4, 1, "ob2"], [4, 11, "ob2"], [16, 1, "ob2"], [16, 11, "ob2"], [1, 4, "ob0"], [1, 9, "ob0"], [18, 4, "ob0"], [18, 9, "ob0"], [8, 2, "ob1"], [8, 8, "ob1"], [11, 5, "ob1"], [11, 11, "ob1"]];
return;
case 7 :
pObsArray = [[1, 1, "ob4"], [1, 13, "ob4"], [2, 2, "ob4"], [2, 12, "ob4"], [20, 2, "ob4"], [20, 12, "ob4"], [3, 3, "ob4"], [3, 11, "ob4"], [19, 3, "ob4"], [19, 11, "ob4"], [7, 7, "ob4"], [15, 7, "ob4"], [4, 4, "ob2"], [4, 8, "ob2"], [17, 4, "ob2"], [17, 8, "ob2"], [6, 2, "ob0"], [6, 11, "ob0"], [14, 2, "ob0"], [14, 11, "ob0"], [10, 1, "ob3"], [10, 9, "ob3"], [12, 5, "ob3"]];
}
};
funcCreateObjectArray = function () {
pYArray = new Array();
pObjectArray = new Array();
i = 0;
while (i < 22) {
var _local3 = new Array();
var _local2 = 0;
j = 0;
while (j < 15) {
if (pYArray[j] == undefined) {
pYArray.push(_local2);
}
var _local1 = new Object();
_local1.px = i * pTileSize;
_local1.py = _local2;
_local1.pObstacle = 0;
_local2 = _local2 + pTileSize;
_local3.push(_local1);
j++;
}
pObjectArray.push(_local3);
i++;
}
};
funcAddObstacles = function () {
pPDepthArray = new Array();
var _local11 = 1050;
j = 0;
while (j < 15) {
pPDepthArray.push(_local11);
_local11 = _local11 + 100;
j++;
}
var _local12 = pObsArray.length;
alert("lLimit " + _local12);
var _local10 = 0;
var _local5;
i = 0;
while (i < _local12) {
var _local4 = pObsArray[i];
var _local2 = _local4[0];
var _local1 = _local4[1];
var _local6 = _local4[2];
var _local3 = pObjectArray[_local2][_local1];
var _local9 = pRoot.pMap;
if (!_local3.pObstacle) {
_local5 = pPDepthArray[_local1];
var _local7 = _local9.attachMovie(_local6, "ob" + _local10, _local5);
_local5++;
pPDepthArray[_local1] = _local5;
_local7._x = _local3.px;
_local7._y = _local3.py;
alert((("lx: " + _local2) + " ly: ") + _local1);
switch (_local6) {
case "ob0" :
_local3.pObstacle = 1;
pObjectArray[_local2][_local1 + 1].pObstacle = 1;
pObjectArray[_local2 + 1][_local1].pObstacle = 1;
pObjectArray[_local2 + 1][_local1 + 1].pObstacle = 1;
pObjectArray[_local2 + 2][_local1].pObstacle = 1;
pObjectArray[_local2 + 2][_local1 + 1].pObstacle = 1;
break;
case "ob1" :
_local3.pObstacle = 1;
pObjectArray[_local2][_local1 + 1].pObstacle = 1;
pObjectArray[_local2 + 1][_local1].pObstacle = 1;
pObjectArray[_local2 + 1][_local1 + 1].pObstacle = 1;
pObjectArray[_local2 + 2][_local1].pObstacle = 1;
pObjectArray[_local2 + 2][_local1 + 1].pObstacle = 1;
pObjectArray[_local2 + 3][_local1].pObstacle = 1;
pObjectArray[_local2 + 3][_local1 + 1].pObstacle = 1;
break;
case "ob2" :
_local3.pObstacle = 1;
pObjectArray[_local2][_local1 + 1].pObstacle = 1;
pObjectArray[_local2][_local1 + 2].pObstacle = 1;
pObjectArray[_local2 + 1][_local1].pObstacle = 1;
pObjectArray[_local2 + 1][_local1 + 1].pObstacle = 1;
pObjectArray[_local2 + 1][_local1 + 2].pObstacle = 1;
break;
case "ob3" :
_local3.pObstacle = 1;
pObjectArray[_local2][_local1 + 1].pObstacle = 1;
pObjectArray[_local2][_local1 + 2].pObstacle = 1;
pObjectArray[_local2][_local1 + 3].pObstacle = 1;
pObjectArray[_local2 + 1][_local1].pObstacle = 1;
pObjectArray[_local2 + 1][_local1 + 1].pObstacle = 1;
pObjectArray[_local2 + 1][_local1 + 2].pObstacle = 1;
pObjectArray[_local2 + 1][_local1 + 3].pObstacle = 1;
break;
case "ob4" :
_local3.pObstacle = 1;
}
}
_local10++;
i++;
}
var _local13 = pPDepthArray.length;
i = 0;
while (i < _local13) {
var _local8 = pPDepthArray[i];
_local8++;
pPDepthArray[i] = _local8;
i++;
}
};
funcAddTiles = function () {
pTilesToCollect = 0;
var _local4 = 0;
var _local5 = pRoot.pMap;
pMapH = 15 * pTileSize;
i = 0;
while (i < 22) {
j = 0;
while (j < 15) {
var _local2 = pObjectArray[i][j];
if (!_local2.pObstacle) {
var _local1 = _local5.attachMovie("tile", (("tileR" + j) + "C") + i, _local4);
_local1._x = _local2.px;
_local1._y = _local2.py;
_local2.pClip = _local1;
_local2.pMowed = false;
var _local3 = funcRectFromLoc(_local1._x, _local1._y, _local1);
_local2.pRect = _local3;
_local4++;
pTilesToCollect++;
}
j++;
}
i++;
}
pMapW = 440;
};
funcEnemyPath = function () {
var _local4 = Math.round(pEnemy.pClip._x / pTileSize);
var _local3 = Math.round(pEnemy.pClip._y / pTileSize);
var _local5 = [_local4, _local3];
var _local2;
var _local1;
if (pFollow == pDog) {
_local2 = 0;
_local1 = 0;
} else {
_local2 = Math.round(pFollow._x / pTileSize);
_local1 = Math.round(pFollow._y / pTileSize);
}
var _local6 = [_local2, _local1];
pEnemy.pPath = AStar(pObjectArray, _local5, _local6, "Diagonal");
};
funcMoveEnemy = function () {
if (pEnemy.pPath != undefined) {
var _local7 = pEnemy.pPath[0];
var _local10 = pEnemy.pPath[1];
var _local8 = _local7[0];
var _local5 = _local10[0];
var _local9 = _local7[1];
var _local6 = _local10[1];
var _local1;
var _local14;
var _local2;
var _local13;
var _local11;
var _local12;
var _local3 = _local5 * pTileSize;
var _local4 = _local6 * pTileSize;
if (_local8 > _local5) {
_local1 = pEnemy.pClip._x - pEIncr;
if (_local1 < _local3) {
_local1 = _local3;
}
pEnemy.pClip.gotoAndStop("E");
pEnemy.pEWDir = "E";
} else if (_local8 < _local5) {
_local1 = pEnemy.pClip._x + pEIncr;
if (_local1 > _local3) {
_local1 = _local3;
}
pEnemy.pClip.gotoAndStop("W");
pEnemy.pEWDir = "W";
} else {
_local1 = pEnemy.pClip._x;
pEnemy.pEWDir = undefined;
}
if (_local9 > _local6) {
_local2 = pEnemy.pClip._y - pEIncr;
if (_local2 < _local4) {
_local2 = _local4;
}
pEnemy.pClip.gotoAndStop("S");
pEnemy.pNSDir = "S";
} else if (_local9 < _local6) {
_local2 = pEnemy.pClip._y + pEIncr;
if (_local2 > _local4) {
_local2 = _local4;
}
pEnemy.pClip.gotoAndStop("N");
pEnemy.pNSDir = "N";
} else {
_local2 = pEnemy.pClip._y;
pEnemy.pNSDir = undefined;
}
pEnemy.pClip._x = _local1;
pEnemy.pClip._y = _local2;
trace((((pEnemy.pClip._x + " ") + _local1) + " ") + _local2);
if (pEnemy.pClip._x == _local3) {
if (pEnemy.pClip._y == _local4) {
funcEnemyPath();
}
}
funcNSfunc(pEnemy, 0);
} else {
funcEnemyPath();
}
};
funcAddPlayer = function () {
pPlayer = new Object();
var _local4 = pRoot.pMap;
var _local1 = pPDepthArray[pPDepthArray.length - 1];
var _local3 = pYArray[pYArray.length - 1];
var _local2 = _local4.attachMovie("player", "pPlayer", _local1, {_y:_local3});
pPlayer.pClip = _local2;
pPlayer.pWidth = pTileSize;
pPlayer.pDir = "E";
pPlayer.pClip.gotoAndStop(pPlayer.pDir);
pFollow = pPlayer.pClip;
pPlayer.pWEIncr = 5;
pPlayer.pNSIncr = 0;
pPlayer.pDepth = 14;
pRoot.funcAddKeyListener();
pDog.pBarking = false;
pDog.pSleeping = true;
pRoot.onEnterFrame = function () {
if (!pRoot.pPause) {
pRoot.funcUpdateHUD();
pRoot.funcCheckMowed();
pRoot.funcSwapDir();
pRoot.funcMovePlayer();
if (pDogAvailable) {
pRoot.funcDogBark();
}
pRoot.funcMoveEnemy();
pRoot.funcCheckHit();
}
};
};
funcUpdateHUD = function () {
pHUD.gotoAndStop("men" + pChances);
pHUD.pScore.text = String(pScore);
pHUD.pLevel.text = String(pLevel * pRound);
};
funcCheckHit = function () {
if (pPlayer.pClip.pClip.hitTest(pEnemy.pClip.pHitClip)) {
if (!pDone) {
funcLosePlayer();
}
}
};
funcDogBark = function () {
trace(pRoot.pPause);
if (!pRoot.pPause) {
if (Key.isDown(32)) {
if (!pDog.pBarking) {
pRoot.funcPlayThisSound(pWoof);
pDog.gotoAndPlay("bark");
pDog.pBarking = true;
pDog.pSleeping = true;
pFollow = pDog;
}
var _local1 = pDog.pMeter._currentframe + pDogDecr;
if (_local1 > pDog.pMeter._totalframes) {
_local1 = pDog.pMeter._totalframes;
pDogAvailable = false;
pDog.pSleeping = false;
pDog.pBarking = false;
pFollow = pPlayer.pClip;
pDog.gotoAndPlay("sleep");
}
pDog.pMeter.gotoAndStop(_local1);
} else {
if (pDog.pSleeping) {
pDog.pSleeping = false;
pDog.gotoAndPlay("sleep");
}
pRoot.funcStopThisSound(pWoof);
pDog.pBarking = false;
pFollow = pPlayer.pClip;
}
} else if (pDog.pBarking) {
pRoot.funcStopThisSound(pWoof);
}
};
funcLosePlayer = function () {
pRoot.onEnterFrame = null;
Key.removeListener(pKeyListener);
pChances--;
trace("pChances " + pChances);
if (pChances < 1) {
pRoot.gotoAndStop("losegame");
} else {
pRoot.gotoAndStop("loselife");
}
};
funcAddEnemy = function () {
pEnemy = new Object();
var _local3 = pRoot.pMap;
var _local1 = pPDepthArray[0] + 1;
var _local2 = _local3.attachMovie("enemy", "pEnemy", _local1, {_x:60});
pEnemy.pClip = _local2;
pEnemy.pWidth = pTileSize;
pEnemy.pEWDir = "E";
pEnemy.pNSDir = undefined;
pEnemy.pCounter = 0;
pEnemy.pCounterMax = (pTileSize / pEIncr) - 1;
alert("pEnemy.pCounterMax " + pEnemy.pCounterMax);
};
funcCheckMowed = function () {
var _local3 = Math.round(pPlayer.pClip._x / pTileSize);
var _local2 = Math.round(pPlayer.pClip._y / pTileSize);
var _local1 = pObjectArray[_local3][_local2];
var _local4 = pObjectArray[_local3][_local2].pClip;
if (!_local1.pMowed) {
if ((pPlayer.pClip._x * pTileSize) == (_local1.px * pTileSize)) {
if ((pPlayer.pClip._y * pTileSize) == (_local1.py * pTileSize)) {
pRoot.funcPlayThisSound(pRoot.pBuzz);
pPlayer.pClip.pChar.pMachine.gotoAndStop(2);
pPlayer.pClip.pChar.pSnow._visible = true;
_local4.gotoAndPlay(2);
pObjectArray[_local3][_local2].pMowed = true;
pTilesCollected++;
pScore = pScore + (10 * pScoreMod);
if (pTilesToCollect == pTilesCollected) {
alert("All done");
pDone = true;
pRoot.funcRewindThisSound(pRoot.pBuzz);
pDogBonus = 100 - Math.round(pDog.pMeter._currentframe / 100);
pRoot.onEnterFrame = null;
if (pRoot.amExternal) {
alert("pRoot.pLevel " + pRoot.pLevel);
if (pRoot.pLevel >= 2) {
pRoot.gotoAndPlay("gotoytv");
} else {
pRoot.gotoAndPlay("levelup");
}
} else {
pRoot.gotoAndPlay("levelup");
}
}
}
}
} else if ((pPlayer.pClip._x * pTileSize) == (_local1.px * pTileSize)) {
if ((pPlayer.pClip._y * pTileSize) == (_local1.py * pTileSize)) {
pRoot.funcRewindThisSound(pRoot.pBuzz);
pPlayer.pClip.pChar.pMachine.gotoAndStop(1);
pPlayer.pClip.pChar.pSnow._visible = false;
}
}
};
funcIncrSpeed = function () {
switch (pPlayer.pDir) {
case "E" :
if (pPlayer.pWEIncr < pIncr) {
pPlayer.pWEIncr++;
}
return;
case "W" :
if (pPlayer.pWEIncr > (-pIncr)) {
pPlayer.pWEIncr--;
}
return;
case "N" :
if (pPlayer.pNSIncr > (-pIncr)) {
pPlayer.pNSIncr--;
}
return;
case "S" :
if (pPlayer.pNSIncr >= pIncr) {
break;
}
pPlayer.pNSIncr++;
}
};
funcSwapDir = function () {
var _local2 = pRoot.pMap;
switch (pPlayer.pNewDir) {
case "N" :
case "S" :
if (pPlayer.pNewDir != pPlayer.pDir) {
var _local1 = Math.round(pPlayer.pClip._x / pTileSize) * pTileSize;
if (_local1 == pPlayer.pClip._x) {
pPlayer.pDir = pPlayer.pNewDir;
if (pPlayer.pDir == "S") {
pPlayer.pNSIncr = pIncr;
} else if (pPlayer.pDir == "N") {
pPlayer.pNSIncr = -pIncr;
}
pPlayer.pNewDir = undefined;
pPlayer.pClip.gotoAndStop(pPlayer.pDir);
}
}
break;
case "E" :
case "W" :
if (pPlayer.pNewDir == pPlayer.pDir) {
break;
}
var _local1 = Math.round(pPlayer.pClip._y / pTileSize) * pTileSize;
if (_local1 != pPlayer.pClip._y) {
break;
}
pPlayer.pDir = pPlayer.pNewDir;
if (pPlayer.pDir == "E") {
pPlayer.pWEIncr = pIncr;
} else if (pPlayer.pDir == "W") {
pPlayer.pWEIncr = -pIncr;
}
pPlayer.pNewDir = undefined;
pPlayer.pClip.gotoAndStop(pPlayer.pDir);
}
};
funcMovePlayer = function () {
var _local1;
var _local3 = pRoot.pMap;
switch (pPlayer.pDir) {
case "N" :
_local1 = pPlayer.pClip._y + pPlayer.pNSIncr;
if (_local1 < 0) {
_local1 = 0;
} else if (_local1 > (pMapH - pPlayer.pWidth)) {
_local1 = pMapH - pPlayer.pWidth;
}
if (!pRoot.funcTestForObs(pPlayer.pClip._x, _local1 - (pPlayer.pWidth / 2))) {
pPlayer.pClip._y = _local1;
pRoot.funcNSfunc(pPlayer, 1);
}
break;
case "S" :
_local1 = pPlayer.pClip._y + pPlayer.pNSIncr;
if (_local1 < 0) {
_local1 = 0;
} else if (_local1 > (pMapH - pPlayer.pWidth)) {
_local1 = pMapH - pPlayer.pWidth;
}
if (!pRoot.funcTestForObs(pPlayer.pClip._x, _local1 + (pPlayer.pWidth / 4))) {
pPlayer.pClip._y = _local1;
pRoot.funcNSfunc(pPlayer, 1);
}
break;
case "E" :
_local1 = pPlayer.pClip._x + pPlayer.pWEIncr;
if (_local1 < 0) {
_local1 = 0;
} else if (_local1 > (pMapW - pPlayer.pWidth)) {
_local1 = pMapW - pPlayer.pWidth;
}
var _local2 = pRoot.funcTestForObs(_local1 + (pPlayer.pWidth / 4), pPlayer.pClip._y);
if (!_local2) {
pPlayer.pClip._x = _local1;
}
break;
case "W" :
_local1 = pPlayer.pClip._x + pPlayer.pWEIncr;
if (_local1 < 0) {
_local1 = 0;
} else if (_local1 > (pMapW - pPlayer.pWidth)) {
_local1 = pMapW - pPlayer.pWidth;
}
if (pRoot.funcTestForObs(_local1 - (pPlayer.pWidth / 2), pPlayer.pClip._y)) {
break;
}
pPlayer.pClip._x = _local1;
}
};
funcRectIntersection = function (arRect1, arRect2) {
var _local3 = arRect1.intersects(arRect2);
var _local1 = arRect1.intersection(arRect2);
var _local2 = [_local3, _local1];
return(_local2);
};
funcRectFromClip = function (arClip) {
var _local2 = new flash.geom.Rectangle(arClip._x, arClip._y, arClip._width, arClip._height);
return(_local2);
};
funcRectFromLoc = function (arx, ary, arClip) {
var _local1 = new flash.geom.Rectangle(arx, ary, arClip._width, arClip._height);
return(_local1);
};
funcTestForObs = function (arx, ary) {
var _local3 = Math.round(arx / pTileSize);
var _local2 = Math.round(ary / pTileSize);
var _local1 = pObjectArray[_local3][_local2].pObstacle;
return(_local1);
};
funcAddKeyListener = function () {
Key.removeListener(pKeyListener);
pKeyListener = new Object();
pKeyListener.onKeyDown = function () {
var _local1 = Key.getCode();
switch (_local1) {
case 40 :
pPlayer.pNewDir = "S";
break;
case 38 :
pPlayer.pNewDir = "N";
break;
case 39 :
pPlayer.pNewDir = "E";
break;
case 37 :
pPlayer.pNewDir = "W";
}
};
Key.addListener(pKeyListener);
};
funcNSfunc = function (arObject, arMod) {
var _local1 = Math.round(arObject.pClip._y / pTileSize);
if (arObject.pDepth != _local1) {
arObject.pDepth = _local1;
arObject.pClip.swapDepths(pPDepthArray[_local1] + arMod);
}
};
function AStar(Grid, Start, Goal, Find) {
function AStar(Void) {
var _local1;
switch (Find) {
case "Diagonal" :
case "Euclidean" :
_local1 = DiagonalSuccessors;
break;
case "DiagonalFree" :
case "EuclideanFree" :
_local1 = DiagonalSuccessors$;
break;
default :
_local1 = function () {
};
}
return(_local1);
}
function $Grid(x, y) {
return(Grid[x][y].pObstacle === 0);
}
function Node(Parent, Point) {
return({Parent:Parent, value:Point.x + (Point.y * cols), x:Point.x, y:Point.y, f:0, g:0});
}
function Path(Find) {
var _local15 = Node(null, {x:Start[0], y:Start[1]});
var _local12 = Node(null, {x:Goal[0], y:Goal[1]});
var _local6 = new Array(limit);
var _local4 = [_local15];
var _local8 = [];
var _local11 = [];
var _local5;
var _local3;
var _local2;
var _local13;
var _local7;
var _local9;
var _local1;
var _local10;
while (_local13 = _local4.length , _local13) {
_local7 = limit;
_local9 = -1;
_local1 = 0;
while (_local1 < _local13) {
if (_local4[_local1].f < _local7) {
_local7 = _local4[_local1].f;
_local9 = _local1;
}
_local1++;
}
_local3 = _local4.splice(_local9, 1)[0];
if (_local3.value === _local12.value) {
_local2 = _local8[_local8.push(_local3) - 1];
do {
_local11.push([_local2.x, _local2.y]);
_local2 = _local2.Parent;
} while (_local2);
_local4 = [];
_local8 = _local4;
_local6 = _local8;
_local11.reverse();
} else {
_local5 = Successors(_local3.x, _local3.y, Find);
_local1 = 0;
_local10 = _local5.length;
while (_local1 < _local10) {
_local2 = Node(_local3, _local5[_local1]);
if (!_local6[_local2.value]) {
_local2.g = _local3.g + Distance(_local5[_local1], _local3);
_local2.f = _local2.g + Distance(_local5[_local1], _local12);
_local4.push(_local2);
_local6[_local2.value] = true;
}
_local1++;
}
_local8.push(_local3);
}
}
return(_local11);
}
function Successors(x, y, Find) {
var _local3 = y - 1;
var _local2 = y + 1;
var _local5 = x + 1;
var _local4 = x - 1;
var _local6 = (_local3 > -1) && ($Grid(x, _local3));
var _local9 = (_local2 < rows) && ($Grid(x, _local2));
var _local8 = (_local5 < cols) && ($Grid(_local5, y));
var _local7 = (_local4 > -1) && ($Grid(_local4, y));
var _local1 = [];
if (_local6) {
_local1.push({x:x, y:_local3});
}
if (_local8) {
_local1.push({x:_local5, y:y});
}
if (_local9) {
_local1.push({x:x, y:_local2});
}
if (_local7) {
_local1.push({x:_local4, y:y});
}
Find(_local6, _local9, _local8, _local7, _local3, _local2, _local5, _local4, _local1);
return(_local1);
}
function DiagonalSuccessors($N, $S, $E, $W, N, S, E, W, result) {
if ($N) {
if ($E && ($Grid(E, N))) {
result.push({x:E, y:N});
}
if ($W && ($Grid(W, N))) {
result.push({x:W, y:N});
}
}
if ($S) {
if ($E && ($Grid(E, S))) {
result.push({x:E, y:S});
}
if ($W && ($Grid(W, S))) {
result.push({x:W, y:S});
}
}
}
function DiagonalSuccessors$($N, $S, $E, $W, N, S, E, W, result) {
$N = N > -1;
$S = S < rows;
$E = E < cols;
$W = W > -1;
if ($E) {
if ($N && ($Grid(E, N))) {
result.push({x:E, y:N});
}
if ($S && ($Grid(E, S))) {
result.push({x:E, y:S});
}
}
if ($W) {
if ($N && ($Grid(W, N))) {
result.push({x:W, y:N});
}
if ($S && ($Grid(W, S))) {
result.push({x:W, y:S});
}
}
}
function Diagonal(Point, Goal) {
return(max(abs(Point.x - Goal.x), abs(Point.y - Goal.y)));
}
function Euclidean(Point, Goal) {
return(sqrt(pow(Point.x - Goal.x, 2) + pow(Point.y - Goal.y, 2)));
}
function Manhattan(Point, Goal) {
return(abs(Point.x - Goal.x) + abs(Point.y - Goal.y));
}
var rows = Grid[0].length;
var cols = Grid.length;
var limit = (cols * rows);
var abs = Math.abs;
var max = Math.max;
var pow = Math.pow;
var sqrt = Math.sqrt;
var Distance = ({Diagonal:Diagonal, DiagonalFree:Diagonal, Euclidean:Euclidean, EuclideanFree:Euclidean, Manhattan:Manhattan}[Find] || (Manhattan));
return(Path(AStar()));
}
var pSoundInit;
var pSoundOn;
var pWoof;
var pWoofControl;
var pBuzzControl;
var pBuzz;
var pLoopControl;
var pMusicLoop;
funcToggleSounds = function () {
if (pRoot.pSoundOn) {
pRoot.pSoundOn = false;
pRoot.pSoundBt.pSoundInd.gotoAndStop("false");
pRoot.funcRewindThisSound(pBuzz);
pRoot.pMusicLoop.setVolume(0);
pRoot.pMusicLoop.stop();
} else {
pRoot.pSoundOn = true;
pRoot.pSoundBt.pSoundInd.gotoAndStop("true");
pRoot.funcFadeUpSound();
}
};
funcInitSounds = function () {
if (pRoot.pSoundInit == undefined) {
pWoofControl = pRoot.attachMovie("~empty", "pWoofControl", pRoot.getNextHighestDepth());
pBuzzControl = pRoot.attachMovie("~empty", "pBuzzControl", pRoot.getNextHighestDepth());
pWoof = new Sound(pWoofControl);
pBuzz = new Sound(pBuzzControl);
pLoopControl = pRoot.attachMovie("~empty", "pLoopControl", pRoot.getNextHighestDepth());
pMusicLoop = new Sound(pLoopControl);
pRoot.pSoundInit = true;
pRoot.pSoundOn = true;
pWoof.setVolume(100);
pBuzz.setVolume(100);
pWoof.attachSound("woof");
pBuzz.attachSound("buzz");
pMusicLoop.attachSound("loop");
pMusicLoop.setVolume(0);
funcFadeUpSound();
}
};
funcFadeUpSound = function () {
pMusicLoop.start(0, 9999);
pRoot.pLoopControl.onEnterFrame = function () {
var _local2 = pRoot.pMusicLoop;
var _local1 = _local2.getVolume();
_local1++;
if (_local1 > 50) {
pRoot.pLoopControl.onEnterFrame = null;
} else {
pRoot.pMusicLoop.setVolume(_local1);
}
};
};
funcPlayThisSound = function (arSound, arFromStart) {
if (pRoot.pSoundOn) {
arSound.start(0, 9999);
}
};
funcStopThisSound = function (arSound) {
arSound.stop();
};
funcRewindThisSound = function (arSound) {
arSound.stop();
var _local1 = new Sound(pBuzzControl);
_local1.attachSound("buzz");
pBuzz = _local1;
};
pURLText.text = "this._url: " + pRoot.path;
stop();
Frame 2
funcTitlePlay = function () {
alert("pRoot.pTitle " + pRoot.pTitle.pSnow);
pRoot.pTitle.pMachine.gotoAndStop(2);
};
stop();
funcInitSounds();
funcTitlePlay();
Instance of Symbol 133 MovieClip "pSoundBt" in Frame 2
on (release) {
pRoot.funcToggleSounds();
}
Frame 3
stop();
Frame 6
stop();
Frame 7
stop();
Frame 9
stop();
pLinkText.html = true;
pLinkText.htmlText = "<a href='http://www.ytv.com'>go here</a>";
Frame 11
stop();
funcUpdateBonusHUD();
Frame 13
stop();
if (pInitialized != true) {
funcInitVars();
}
var lDayArray = [undefined, "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
pDay.pDay.pLevelText.text = lDayArray[pRoot.pLevel];
Frame 15
stop();
pTitle.pSnow.gotoAndPlay("player");
Frame 17
stop();
Frame 19
stop();
funcStartLevel();
Symbol 8 MovieClip [tile] Frame 1
stop();
Symbol 8 MovieClip [tile] Frame 2
stop();
Symbol 8 MovieClip [tile] Frame 3
stop();
Symbol 36 MovieClip Frame 1
stop();
Symbol 51 MovieClip Frame 6
this.gotoAndPlay("player");
Symbol 53 MovieClip [player] Frame 1
stop();
Symbol 80 MovieClip [enemy] Frame 1
stop();
Symbol 91 MovieClip Frame 1
var loaded;
var total = pRoot.getBytesTotal();
this.onEnterFrame = function () {
loaded = pRoot.getBytesLoaded();
percent = int((loaded / total) * 100);
this.totaltext.text = percent + "%";
if (loaded == total) {
pRoot.gotoAndPlay("title");
}
};
Symbol 91 MovieClip Frame 6
stop();
Symbol 97 MovieClip Frame 1
var pstart = this.pwall2._x;
Symbol 97 MovieClip Frame 2
stop();
this.onEnterFrame = function () {
this.pwall1._x = this.pwall1._x - 5;
this.pwall2._x = this.pwall2._x - 5;
if (this.pwall1._x < (-this.pwall1._width)) {
this.pwall1._x = (this.pwall2._x + this.pwall2._width) - 5;
}
if (this.pwall2._x < (-this.pwall2._width)) {
this.pwall2._x = (this.pwall1._x + this.pwall1._width) - 5;
}
};
Symbol 120 Button
on (release) {
pRoot.funcHITBOX("play_activity", "play_from_main");
pRoot.gotoAndPlay("levelin");
}
Symbol 124 Button
on (release) {
pRoot.funcHITBOX("instructions", "view_instructions");
pRoot.gotoAndPlay("instructions");
}
Symbol 128 Button
on (release) {
pRoot.gotoAndPlay("entercode");
}
Symbol 132 MovieClip Frame 1
stop();
Symbol 141 Button
on (release) {
pRoot.funcHITBOX("play_activity", "play_from_code");
pRoot.gotoAndPlay("levelin");
}
Symbol 160 MovieClip Frame 1
Symbol 160 MovieClip Frame 10
this.gotoAndPlay("sleep");
Symbol 167 Button
on (release) {
pRoot.funcCheckCode();
}
Symbol 174 Button
on (release) {
getURL ("http://www.ytv.com/gamepad/play/games/nomosnow/play.asp#top", "_parent");
}
Symbol 175 Button
on (release) {
getURL ("http://www.ytv.com/gamepad/play/default.asp", "_blank");
}
Symbol 187 Button
on (release) {
pRoot.funcLevelUp();
pRoot.gotoAndPlay("game");
}
Symbol 194 MovieClip Frame 25
stop();
pRoot.gotoAndPlay("game");
Symbol 203 Button
on (release) {
pRoot.gotoAndPlay("game");
}
Symbol 208 Button
on (release) {
pRoot.funcPlayAgain();
}
Symbol 221 MovieClip Frame 1
stop();
Symbol 228 MovieClip Frame 1
Symbol 228 MovieClip Frame 10
this.gotoAndPlay("sleep");
Symbol 228 MovieClip Frame 16
this.gotoAndPlay("bark");
Symbol 234 MovieClip Frame 1
stop();
Symbol 238 Button
on (release) {
if (!pRoot.pPause) {
pRoot.pPause = true;
} else {
pRoot.pPause = false;
}
}