Frame 1
function startGame() {
gLevel = 1;
gLives = 3;
score = 0;
scorecheck = "0";
_root.score_display = scorecheck;
gIntroSound.stop();
gActionSound.attachSound("chop_sound");
gActionSound.start();
_root.gotoAndStop("play");
}
function playAgain() {
gActionSound.attachSound("chop_sound");
gActionSound.start();
_root.score_display = "0";
_root.level_display = "1";
gotoAndStop (3);
}
function init() {
gMaxLives = 3;
gCenterX = 240;
gRowHeight = 33;
gHorizUnit = 15;
gPlayer = _root.player;
gLeftEdge = 20;
gRightEdge = 500;
gStageWidth = gRightEdge - gLeftEdge;
gRecenterSpeed = 50;
gInitialPrizeY = 2;
gFallsStartX = -500;
gFallsEndX = 120;
cOPEN = 1;
cMIDDLE = 2;
cLEFT = 3;
cRIGHT = 4;
cCLOSED = 5;
cNORMAL = 10;
cDIE = 11;
cPAUSE = 12;
gRowData = new Array();
gRowData[0] = [[3, 10], [3, 60], [2, 35], [2, 80, 20]];
gRowData[1] = [[2, 40], [3, 75], [2, 80], [3, 30, 40]];
gRowData[2] = [[3, 10], [3, 70], [2, 30], [3, 80, 25]];
gRowData[3] = [[2, 50], [3, 45], [2, 35], [3, 80, 0]];
gRowData[4] = [[2, 15], [3, 80], [3, 75], [2, 40, 20]];
gRowData[5] = [[2, 50], [3, 30], [3, 40], [3, 30, 30]];
gRowData[6] = [[3, 20], [2, 70], [3, 30], [2, 50, 25]];
gNumRows = gRowData.length;
gRowSpeed = [10, 35, 50, 57, 52, 37, 12];
gLogLength = [0, 40, 72, 128];
gDieSound = new Sound();
gActionSound = new Sound();
gBearSound = new Sound();
gFallsSound = new Sound(_root.falls_sound_MC);
gFallsSound.attachSound("falls_sound");
gLogrollSound = new Sound(_root.logroll_sound_MC);
gLogrollSound.attachSound("logroll_sound");
gIntroSound = new Sound(_root.intro_sound_MC);
gIntroSound.attachSound("intro_sound");
gBackgroundSound = new Sound(_root.bg_sound_MC);
gBackgroundSound.attachSound("bg_sound");
gPrizeSpacingMin = 220;
gPrizeSpacingMax = 260;
gNumPrizes = 20;
gNumPrizeTypes = 4;
gNumBears = 2;
gBearInterval = 500;
gBearKnowsCurrent = false;
gBearThinkDepth = 3;
gDir = [[-1, 0], [0, 1], [1, 0], [0, -1]];
gFallsDelay = 45000;
}
function setUp() {
_root.level_display = gLevel;
updateLives();
setLevelDifficulty();
gPlayerX = gCenterX;
gPlayerLog = 0;
gPlayer.animation.legs.gotoAndStop(1);
gPlayer.animation.upper_body.gotoAndStop("normal");
gPlayer.pRunning = false;
gLogrollSound.stop();
_root.hands._x = -100;
gRowTimer = -1;
gMode = cNORMAL;
gRowMC = new Array();
gRowLevel = 1;
gRowLength = new Array();
var i = 0;
while (i < gNumRows) {
_root.row_MCA.attachMovie("blank", "row" + gRowLevel, gRowLevel);
var lRowMC = _root.row_MCA["row" + gRowLevel];
lRowMC._x = 0;
lRowMC._y = gRowHeight * i;
var lLogLevel = 1;
lRowMC.pLog = new Array();
var lPos = 0;
var j = 0;
while (j < gRowData[i].length) {
var lType = gRowData[i][j][0];
lPos = lPos + gRowData[i][j][1];
lRowMC.attachMovie("log", "log" + j, lLogLevel);
var lLogMC = lRowMC["log" + j];
lLogMC.id = lLogLevel;
lLogMC.pX = lPos;
lLogMC._x = lLogMC.pX;
lLogMC._y = 0;
lLogMC.gotoAndStop(lType);
lRowMC.pLog.push(lLogMC);
lPos = lPos + gLogLength[lType];
if (gRowData[i][j].length == 3) {
lPos = lPos + gRowData[i][j][2];
}
lLogLevel++;
j++;
}
gRowLength[i] = lPos;
gRowMC.push(lRowMC);
gRowLevel++;
i++;
}
gPlayer.pRow = gNumRows;
gPlayerSpeed = 0;
placePlayer();
removeCarryPrize();
setUpPrizes();
setUpBears();
setUpWaterfall();
gLevelTimer = getTimer();
}
function setLevelDifficulty() {
if (1 >= gLevel) {
gNumBears = 0;
} else if (6 >= gLevel) {
gNumBears = 1;
} else {
gNumBears = 2;
}
gBearInterval = Math.max(150, 500 - ((gLevel - 1) * 20));
if (2 >= gLevel) {
gNumPrizeTypes = 2;
} else if (4 >= gLevel) {
gNumPrizeTypes = 3;
} else if (6 >= gLevel) {
gNumPrizeTypes = 4;
} else {
gNumPrizeTypes = 5;
}
}
function startIntroSound() {
gIntroSound.start(0, 30000);
gBackgroundSound.start(0, 30000);
gFallsSound.start(0, 30000);
gFallsSound.setVolume(0);
}
function levelOver() {
gMode = cPAUSE;
gotoAndStop (8);
}
function nextLevel() {
gActionSound.attachSound("chop_sound");
gActionSound.start();
gFallsSound.setVolume(0);
gLevel++;
_root.gotoAndStop("play");
}
function submitScore() {
gActionSound.attachSound("chop_sound");
gActionSound.start();
extra = extra + ("Level " + gLevel);
stats = stats + "";
loadMovie ((((((((((((("game.swf?score=" + score) + "&scorecheck=") + scorecheck) + "&extra=") + extra) + "&stats=") + stats) + "&scoremode=") + scoremode) + "&gamename=") + gamename) + "&textname=") + textname, _root);
}
function updateLives() {
var i = 0;
while (i < gMaxLives) {
var lLife = _root["life_" + i];
if (i < gLives) {
lLife._x = 522;
} else {
lLife._x = -100;
}
i++;
}
}
function frameLoop() {
if (gMode == cNORMAL) {
updateScenery();
checkBears();
}
}
function checkBears() {
if (gBearWaiting.length >= 1) {
var r = getEntryLog();
if (r != -1) {
bearEnters(r);
}
}
var lTime = getTimer();
var i = 0;
while (i < gBear.length) {
if (getOne(gBearWaiting, gBear[i]) != -1) {
} else if ((gBear[i].pTimer + gBearInterval) < lTime) {
walkBear(gBear[i]);
gBear[i].pTimer = lTime;
}
i++;
}
}
function getEntryLog() {
var lRowSource = new Array();
var i = 0;
while (i < gNumRows) {
lRowSource.push(i);
i++;
}
var i = 0;
while (i < gBear.length) {
var lIndex = getOne(gBearWaiting, gBear[i]);
if (lIndex != -1) {
} else {
var r = gBear[i].pRow;
var lIndex = getOne(lRowSource, r);
if (lIndex != -1) {
lRowSource.splice(lIndex, 1);
}
}
i++;
}
while (0 < lRowSource.length) {
var lIndex = Math.floor(Math.random() * lRowSource.length);
var lRow = lRowSource[lIndex];
var lSpeed = screenSpeed(lRow);
if (2 >= Math.abs(lRow - gPlayer.pRow)) {
lRowSource.splice(lIndex, 1);
} else {
if ((0 < lSpeed) && (logAt(lRow, gStageWidth))) {
return(lRow);
}
if ((lSpeed < 0) && (logAt(lRow, 0))) {
return(lRow);
}
lRowSource.splice(lIndex, 1);
}
}
return(-1);
}
function screenSpeed(r) {
if ((r < 0) || ((gNumRows - 1) < r)) {
var lAbsSpeed = 0;
} else {
var lAbsSpeed = gRowSpeed[r];
}
var lRelSpeed = (lAbsSpeed - gPlayerSpeed);
return(lRelSpeed);
}
function setUpWaterfall() {
_root.waterfall._x = gFallsStartX;
gFallsStarted = false;
}
function removeBears() {
gBearWaiting = new Array();
var i = 0;
while (i < gBear.length) {
gBear[i].graphic._x = -1000;
gBearWaiting.push(gBear[i]);
i++;
}
}
function setUpBears() {
gBearLevel = 1;
gBearOver = new Array();
gBearUnder = new Array();
gBear = new Array();
gBearWaiting = new Array();
var i = 0;
while (i < gNumBears) {
_root.bear_over_MCA.attachMovie("bear", "bear" + i, gBearLevel);
_root.bear_under_MCA.attachMovie("bear", "bear" + i, gBearLevel);
var lBear = _root.bear_over_MCA["bear" + i];
gBearOver.push(lBear);
lBear._x = -1000;
var lBear = _root.bear_under_MCA["bear" + i];
gBearUnder.push(lBear);
lBear._x = -1000;
var lBear = {graphic:gBearUnder[i], id:i, pTimer:0, pRow:0};
gBear.push(lBear);
gBearWaiting.push(lBear);
gBearLevel++;
i++;
}
}
function bearEnters(r) {
var b = gBearWaiting.shift();
b.pRow = r;
var lRelSpeed = screenSpeed(r);
if (0 < lRelSpeed) {
b.graphic._xscale = 100;
b.graphic._x = gStageWidth;
} else if (lRelSpeed < 0) {
b.graphic._xscale = -100;
b.graphic._x = 0;
}
b.pTimer = getTimer();
placeBear(b);
}
function walkBear(vBear) {
gChecked = new Array();
var r = 0;
while (r < gBearThinkDepth) {
gChecked[r] = new Array();
r++;
}
gCurrentBear = vBear;
var lBestIndex = -1;
var lClosestDist = 1000;
var lShallowest = 10;
var i = 0;
while (i < 4) {
var r = (vBear.pRow + gDir[i][0]);
var x = (vBear.graphic._x + (gDir[i][1] * gHorizUnit));
var lMove = [1000, 10, r, x, gBearThinkDepth];
lMove = thinkBear(lMove);
if (!lMove) {
} else if (lMove[0] < lClosestDist) {
lBestIndex = i;
lClosestDist = lMove[0];
lShallowest = lMove[1];
} else if ((lMove[0] == lClosestDist) && (lMove[1] < lShallowest)) {
lBestIndex = i;
lShallowest = lMove[1];
}
i++;
}
if (lBestIndex != -1) {
vBear.pRow = vBear.pRow + gDir[lBestIndex][0];
var x = vBear.graphic._x;
updateBearStacking(vBear);
vBear.graphic._x = x + (gDir[lBestIndex][1] * gHorizUnit);
if (0 < gDir[lBestIndex][1]) {
vBear.graphic._xscale = -100;
} else if (gDir[lBestIndex][1] < 0) {
vBear.graphic._xscale = 100;
}
placeBear(vBear);
checkBearKill(vBear);
}
}
function updateBearStacking(vBear) {
if (gPlayer.pRow >= vBear.pRow) {
vBear.graphic = gBearUnder[vBear.id];
gBearOver[vBear.id]._x = -1000;
} else {
vBear.graphic = gBearOver[vBear.id];
gBearUnder[vBear.id]._x = -1000;
}
}
function thinkBear(vMove) {
if (0 >= vMove[4]) {
return(false);
}
var r0 = vMove[2];
var x0 = vMove[3];
var c0 = ((x0 - gCurrentBear.graphic._x) / gHorizUnit);
var lValue = gChecked[r0][c0];
if (lValue == -1) {
return(false);
}
if ((lValue != undefined) && (lValue >= vMove[4])) {
return(false);
}
if (!logAt(r0, x0)) {
gChecked[r0][c0] = -1;
return(false);
}
var lHasBear = false;
var i = 0;
while (i < gBear.length) {
if (((gBear[i] != gCurrentBear) && (gBear[i].pRow == r0)) && (gHorizUnit >= Math.abs(gBear[i].graphic._x - x0))) {
lHasBear = true;
}
i++;
}
if (lHasBear) {
gChecked[r0][c0] = -1;
return(false);
}
gChecked[r0][c0] = vMove[4];
vMove[0] = Math.abs(gPlayerX - x0) + (gHorizUnit * Math.abs(gPlayer.pRow - r0));
var i = 0;
while (i < 4) {
var r = (r0 + gDir[i][0]);
var x = (x0 + (gDir[i][1] * gHorizUnit));
var lNextMove = [vMove[0], r, x, vMove[4] - 1];
lNextMove = thinkBear(lNextMove);
if (lNextMove) {
if (lNextMove[0] < vMove[0]) {
vMove[0] = lNextMove[0];
vMove[1] = vMove[4] - 1;
} else if ((lNextMove[0] == vMove[0]) && ((vMove[4] - 1) < vMove[1])) {
vMove[1] = vMove[4] - 1;
}
}
i++;
}
return(vMove);
}
function checkBearKill(vBear) {
if (gMode == cDIE) {
return(undefined);
}
if (vBear == undefined) {
var lBearArray = gBear;
} else {
var lBearArray = [vBear];
}
var i = 0;
while (i < lBearArray.length) {
if ((lBearArray[i].pRow == gPlayer.pRow) && (Math.abs(lBearArray[i].graphic._x - gPlayerX) < 25)) {
trace("hugging shall occur!");
lBearArray[i].graphic.gotoAndPlay("hug");
gBearSound.attachSound("hug_sound");
gBearSound.start();
gPlayer._x = -100;
var lCurrentLog = logAt(gPlayer.pRow, gPlayerX);
if (lCurrentLog) {
lCurrentLog.log.gotoAndStop("nospin");
}
startDying();
return(undefined);
}
i++;
}
}
function doneHugging() {
}
function moveBear(vBear, dx) {
vBear.graphic._x = vBear.graphic._x - dx;
if ((((gRightEdge + 30) < vBear.graphic._x) && (dx < 0)) || ((vBear.graphic._x < (gLeftEdge - 30)) && (0 < dx))) {
prepareBear(vBear);
}
}
function prepareBear(vBear) {
if (getOne(gBearWaiting, vBear) == -1) {
gBearWaiting.push(vBear);
}
}
function placeBear(vBear) {
var y = (gRowHeight * vBear.pRow);
if (vBear.pRow == -1) {
y = y + 20;
}
vBear.graphic._y = y;
}
function setUpPrizes() {
for (var obj in /prize_MCA) {
_root.prize_MCA[obj].removeMovieClip();
}
gPrizeSpacing = gPrizeSpacingMin + (Math.random() * (gPrizeSpacingMax - gPrizeSpacingMin));
gPrizeLevel = 1;
gPrize = new Array();
gFarPrize = new Array();
gCarryPrize = 0;
gNearPrize = new Array();
var x = (gStageWidth - gPrizeSpacing);
do {
startNewPrize(x);
gPrizeSpacing = gPrizeSpacingMin + (Math.random() * (gPrizeSpacingMax - gPrizeSpacingMin));
x = x - gPrizeSpacing;
} while (x >= -50);
}
function placePlayer() {
var x = gPlayerX;
var y = (gRowHeight * gPlayer.pRow);
if (gPlayer.pRow == -1) {
y = y + 11;
}
gPlayer._x = x + _root.row_MCA._x;
gPlayer._y = y + _root.row_MCA._y;
}
function prizeAnimationDone() {
_root.prize_animation._x = -100;
_root.prize_animation.gotoAndStop(1);
}
function placeCarryPrize() {
if (!gCarryPrize) {
return(undefined);
}
gCarryPrize._x = gPlayer._x;
_root.hands._x = gPlayer._x;
_root.hands._y = gPlayer._y;
if (gPlayer.pRow == -1) {
gCarryPrize._y = gPlayer._y + gInitialPrizeY;
} else {
gCarryPrize._y = gPlayer._y;
}
}
function startNewPrize(x) {
_root.prize_MCA.attachMovie("prize", "prize" + gPrizeLevel, gPrizeLevel);
var lPrize = _root.prize_MCA["prize" + gPrizeLevel];
lPrize.id = gPrizeLevel;
var lType = Math.ceil(Math.random() * gNumPrizeTypes);
lPrize.gotoAndStop(lType);
lPrize.value.gotoAndStop(lType);
lPrize._x = x;
lPrize._y = gInitialPrizeY;
gPrize.push(lPrize);
gLastPrizeX = x;
gPrizeLevel++;
}
function adjustScenery(dx) {
var i = 0;
while (i < gNumRows) {
moveRow(i, dx);
i++;
}
moveShores(-dx);
var i = 0;
while (i < gBear.length) {
moveBear(gBear[i], dx);
i++;
}
}
function updateScenery() {
if (gRowTimer == -1) {
gRowTimer = getTimer();
return(undefined);
}
var lTime = getTimer();
var lDuration = (lTime - gRowTimer);
var lRecenterDist = 0;
var lToCenter = (gCenterX - gPlayerX);
if (((-1 < gPlayer.pRow) && (gPlayer.pRow < gNumRows)) && (lToCenter != 0)) {
if (0 < lToCenter) {
lSign = 1;
} else {
lSign = -1;
}
lRecenterDist = ((lSign * gRecenterSpeed) * lDuration) / 600;
var lToCenterAfter = (gCenterX - (gPlayerX + lRecenterDist));
if ((lToCenter * lToCenterAfter) < 0) {
lRecenterDist = lToCenter;
}
gPlayerX = gPlayerX + lRecenterDist;
gPlayer._x = gPlayerX + _root.row_MCA._x;
placeCarryPrize();
}
var i = 0;
while (i < gRowMC.length) {
var lAbsSpeed = gRowSpeed[i];
var lRelSpeed = (lAbsSpeed - gPlayerSpeed);
var dx = (((lRelSpeed * lDuration) / 600) - lRecenterDist);
moveRow(i, dx);
i++;
}
var i = 0;
while (i < gBear.length) {
var lAbsSpeed = gRowSpeed[gBear[i].pRow];
var lRelSpeed = (lAbsSpeed - gPlayerSpeed);
var dx = (((lRelSpeed * lDuration) / 600) - lRecenterDist);
moveBear(gBear[i], dx);
i++;
}
var dx = (((gPlayerSpeed * lDuration) / 600) + lRecenterDist);
moveShores(dx);
if (!gFallsStarted) {
if ((gLevelTimer + gFallsDelay) < lTime) {
gFallsStarted = true;
}
}
if (gFallsStarted) {
var dx = (((gPlayerSpeed * lDuration) / 600) + lRecenterDist);
_root.waterfall._x = _root.waterfall._x + dx;
var lVol = Math.floor(((100 * (_root.waterfall._x - gFallsStartX)) / (gFallsEndX - gFallsStartX)) + 0.5);
trace("volume should be " + lVol);
gFallsSound.setVolume(lVol);
if (_root.waterfall._x >= gFallsEndX) {
levelOver();
}
}
gRowTimer = lTime;
}
function moveShores(dx) {
var x = (_root.near_shore._x + dx);
var w = _root.near_shore._width;
if ((x + (w / 2)) < gRightEdge) {
x = x + (w / 2);
} else if (gLeftEdge < (x - (w / 2))) {
x = x - (w / 2);
}
_root.near_shore._x = x;
var x = (_root.far_shore._x + dx);
var w = _root.far_shore._width;
if ((x + (w / 2)) < gRightEdge) {
x = x + (w / 2);
} else if (gLeftEdge < (x - (w / 2))) {
x = x - (w / 2);
}
_root.far_shore._x = x;
gLastPrizeX = gLastPrizeX + dx;
var i = 0;
while (i < gPrize.length) {
gPrize[i]._x = gPrize[i]._x + dx;
i++;
}
if (gLastPrizeX >= gPrizeSpacing) {
startNewPrize(gLastPrizeX - gPrizeSpacing);
gPrizeSpacing = gPrizeSpacingMin + (Math.random() * (gPrizeSpacingMax - gPrizeSpacingMin));
}
var lFirstX = gPrize[0]._x;
if (gStageWidth < lFirstX) {
var lFirstMC = gPrize.shift();
lFirstMC.removeMovieClip();
}
}
function moveRow(r, dx) {
var j = 0;
while (j < gRowMC[r].pLog.length) {
var x = (gRowMC[r].pLog[j].pX - dx);
var y = (gRowHeight * r);
if ((0 < dx) && (0 >= (x + gLogLength[gRowMC[r].pLog[j]._currentFrame]))) {
x = x + gRowLength[r];
} else if ((dx < 0) && (x >= gStageWidth)) {
x = x - gRowLength[r];
}
gRowMC[r].pLog[j].pX = x;
gRowMC[r].pLog[j]._x = x;
j++;
}
}
function pressedKey() {
var lPressed = Key.getCode();
if (lPressed == 37) {
movePlayer(0, -1);
} else if (lPressed == 39) {
movePlayer(0, 1);
} else if (lPressed == 38) {
movePlayer(-1, 0);
} else if (lPressed == 40) {
movePlayer(1, 0);
}
}
function movePlayer(dr, dc) {
if (gMode != cNORMAL) {
return(undefined);
}
var rOld = gPlayer.pRow;
var cOld = gPlayer.pCol;
var r = (gPlayer.pRow + dr);
var c = (gPlayer.pCol + dc);
if ((r < -1) || (gNumRows < r)) {
return(undefined);
}
gPlayer.pRow = r;
gPlayerSpeed = gRowSpeed[gPlayer.pRow];
updateLocationEffects();
placePlayer();
if (dr != 0) {
gActionSound.attachSound("jump_sound");
gActionSound.start();
}
if (dc != 0) {
var lHorizMove = (gHorizUnit * dc);
if ((gPlayer.pRow == -1) || (gPlayer.pRow == gNumRows)) {
gPlayerX = gPlayerX + lHorizMove;
if ((gStageWidth - 20) < gPlayerX) {
gPlayerX = gStageWidth - 20;
} else if (gPlayerX < 20) {
gPlayerX = 20;
}
placePlayer();
} else {
adjustScenery(lHorizMove);
}
}
var lCurrentLog = logAt(r, gPlayerX);
if (!lCurrentLog) {
if (gPlayerLog) {
gPlayerLog.log.gotoAndStop("nospin");
gPlayerLog = 0;
}
startDrowning();
} else if (lCurrentLog != gPlayerLog) {
gPlayerLog.log.gotoAndStop("nospin");
gPlayerLog = lCurrentLog;
gPlayerLog.log.gotoAndPlay("spin");
}
placeCarryPrize();
if ((gPlayer.pRow == -1) && (!gCarryPrize)) {
var i = gPrize.length;
while (i >= 0) {
if (Math.abs(gPrize[i]._x - gPlayerX) < 20) {
gActionSound.attachSound("pick_up_sound");
gActionSound.start();
gCarryPrize = _root.carry_prize;
gCarryPrize.gotoAndStop(gPrize[i]._currentFrame);
gCarryPrize.value.gotoAndStop("hide");
gPrize[i].removeMovieClip();
gPrize.splice(i, 1);
placeCarryPrize();
gPlayer.animation.upper_body.gotoAndStop("holding");
_root.hands._x = gPlayer._x;
_root.hands._y = gPlayer._y;
}
i--;
}
} else if (gPlayer.pRow == gNumRows) {
if (gCarryPrize) {
var lValue = (100 * gCarryPrize._currentFrame);
updateScore(lValue);
gActionSound.attachSound("put_down_sound");
gActionSound.start();
_root.prize_animation._x = gPlayer._x;
_root.prize_animation._y = gPlayer._y;
_root.prize_animation.value.gotoAndStop(gCarryPrize._currentFrame);
_root.prize_animation.gotoAndPlay(1);
gCarryPrize._x = -100;
gCarryPrize = 0;
gPlayer.animation.upper_body.gotoAndStop("normal");
_root.hands._x = -100;
}
}
checkBearKill();
}
function startDying() {
gMode = cDIE;
removeCarryPrize();
gLogrollSound.stop();
}
function removeCarryPrize() {
if (gCarryPrize) {
gCarryPrize._x = -100;
gCarryPrize = 0;
_root.hands._x = -100;
}
}
function startDrowning() {
gDieSound.attachSound("drown_sound");
gDieSound.start();
gPlayer.gotoAndPlay("drown");
startDying();
}
function doneDying(vBear) {
vBear.gotoAndStop("normal");
trace((("bear graphic " + vBear._name) + " is now at frame ") + vBear._currentFrame);
gLives--;
if (gLives >= 0) {
gMode = cNORMAL;
gPlayer.gotoAndStop("normal");
gPlayer.animation.upper_body.gotoAndStop("normal");
gPlayer.pRow = gNumRows;
gPlayerSpeed = 0;
gPlayerX = gCenterX;
updateLocationEffects();
placePlayer();
removeBears();
updateLives();
} else {
gFallsSound.setVolume(0);
gBackgroundSound.stop();
gotoAndStop (11);
}
}
function logAt(r, x) {
if ((r == -1) || (r == gNumRows)) {
return(true);
}
var lRowMC = gRowMC[r];
var i = 0;
while (i < gRowMC[r].pLog.length) {
var lLog = gRowMC[r].pLog[i];
var lLeftEdge = (lLog._x + 5);
var lRightEdge = ((lLog._x + gLogLength[lLog._currentFrame]) - 5);
if ((lLeftEdge < x) && (x < lRightEdge)) {
return(lLog);
}
i++;
}
return(false);
}
function updateLocationEffects() {
if ((gPlayer.pRow < 0) || ((gNumRows - 1) < gPlayer.pRow)) {
if (gPlayer.pRunning) {
gPlayer.pRunning = false;
gPlayer.animation.legs.gotoAndStop(1);
gLogrollSound.stop();
}
if (gPlayer.pBalancing) {
gPlayer.pBalancing = false;
gPlayer.animation.upper_body.gotoAndStop(1);
}
} else {
if (!gPlayer.pRunning) {
gPlayer.pRunning = true;
gPlayer.animation.legs.play();
gLogrollSound.start(0, 30000);
}
if ((!gPlayer.pBalancing) && (!gCarryPrize)) {
gPlayer.pBalancing = true;
trace("starting upper body animation");
gPlayer.animation.upper_body.play();
}
}
}
function offBoard() {
if ((vRow < -1) || (gNumRows < vRow)) {
return(true);
}
if ((vCol < 0) || ((gNumCols - 1) < vCol)) {
return(true);
}
return(false);
}
function updateScore(vChange) {
score = score + vChange;
scorecheck = String(Number(scorecheck) + vChange);
if (score < 0) {
score = 0;
scorecheck = "0";
}
_root.score_display = scorecheck;
}
function getOne(array, x) {
var i = 0;
while (i < array.length) {
if (x == array[i]) {
return(i);
}
i++;
}
return(-1);
}
init();
stop();
Instance of Symbol 87 MovieClip in Frame 1
onClipEvent (load) {
totalFileSize = _root.getBytesTotal();
startTime = getTimer();
startBytes = _root.getBytesLoaded();
this._xscale = 0;
}
onClipEvent (enterFrame) {
bytesLoaded = _root.getBytesLoaded();
amountLoaded = bytesLoaded / totalFileSize;
percentLoaded = int(100 * amountLoaded);
this._xscale = percentLoaded;
timeSoFar = getTimer() - startTime;
speed = bytesLoaded / timeSoFar;
bytesLeft = totalFileSize - bytesLoaded;
timeLeft = (bytesLeft / 1000) * (speed / 1000);
speed = int(10 * speed) / 10;
_root.timeMessage = int(timeLeft) + " seconds remaining";
if (amountLoaded >= 1) {
_root.gotoAndStop("startgame");
}
}
Frame 3
startIntroSound();
Frame 5
setUp();
Instance of Symbol 79 MovieClip [blank] "controller" in Frame 5
onClipEvent (keyDown) {
_root.pressedKey();
updateAfterEvent();
}
onClipEvent (enterFrame) {
_root.frameLoop();
}
Symbol 22 MovieClip Frame 1
stop();
Symbol 22 MovieClip Frame 12
gotoAndPlay (3);
Symbol 34 MovieClip Frame 1
stop();
Symbol 34 MovieClip Frame 12
gotoAndPlay (3);
Symbol 47 MovieClip Frame 1
stop();
Symbol 47 MovieClip Frame 12
gotoAndPlay (3);
Symbol 49 MovieClip [log] Frame 1
stop();
Symbol 65 MovieClip [prize] Frame 1
stop();
Symbol 78 MovieClip [bear] Frame 1
stop();
Symbol 78 MovieClip [bear] Frame 49
trace("Hey, I'm at frame " + this._currentFrame);
_root.doneDying(this);
Symbol 80 MovieClip [prize] Frame 1
stop();
Symbol 103 MovieClip Frame 12
gotoAndPlay (1);
Symbol 114 MovieClip Frame 1
stop();
Symbol 114 MovieClip Frame 32
_root.doneDying();
stop();
Symbol 121 Button
on (release) {
_root.startGame();
}
Symbol 125 MovieClip Frame 1
pTimer = getTimer();
Symbol 125 MovieClip Frame 2
pTimer = getTimer() - pTimer;
var lRate = Math.floor((1000 / pTimer) + 0.5);
display = lRate;
Symbol 136 MovieClip Frame 10
_root.prizeAnimationDone();
Symbol 145 MovieClip Frame 15
gotoAndPlay (1);
Symbol 152 Button
on (release) {
_root.nextLevel();
}
Symbol 157 Button
on (release) {
_root.submitScore();
}
Symbol 160 Button
on (release) {
_root.playAgain();
}