Frame 1
var stageWidth = 618;
var stageHeight = 368;
Frame 2
function checkProgress() {
if (getBytesTotal() > 4) {
pctLoaded = (100 * getBytesLoaded()) / getBytesTotal();
preloader_mc.loadBar_mc._xscale = pctLoaded;
if (pctLoaded == 100) {
clearInterval(checkProgress_itvl);
gotoAndPlay ("_intro");
}
}
}
preloader_mc._x = stageWidth / 2;
preloader_mc._y = stageHeight / 2;
var pctLoaded;
var checkProgress_itvl = setInterval(checkProgress, 40);
stop();
Frame 29
skip_btn.onPress = function () {
gotoAndStop ("game");
};
Frame 233
var nav = new Nav(this, this._width, this._height);
stop();
stop();
Symbol 9 MovieClip Frame 1
stop();
Symbol 9 MovieClip Frame 11
stop();
Symbol 36 MovieClip [black] Frame 1
stop();
Symbol 36 MovieClip [black] Frame 21
stop();
Symbol 41 MovieClip Frame 1
stop();
Symbol 41 MovieClip Frame 11
stop();
Symbol 44 MovieClip Frame 1
stop();
Symbol 44 MovieClip Frame 11
stop();
Symbol 47 MovieClip Frame 1
stop();
Symbol 47 MovieClip Frame 11
stop();
Symbol 48 MovieClip [blue] Frame 1
stop();
stop();
Symbol 48 MovieClip [blue] Frame 11
stop();
Symbol 63 MovieClip [blueStart] Frame 1
stop();
Symbol 63 MovieClip [blueStart] Frame 2
stop();
Symbol 63 MovieClip [blueStart] Frame 3
stop();
Symbol 77 MovieClip Frame 1
stop();
Symbol 77 MovieClip Frame 16
stop();
Symbol 91 MovieClip [coin] Frame 1
stop();
Symbol 91 MovieClip [coin] Frame 4
stop();
Symbol 221 MovieClip [__Packages.Nav] Frame 0
class Nav
{
var host, nav_mc, instrNav_mc, instr1_mc, instr2_mc, instr3_mc, instr4_mc, gameOver_mc, mulchEarned_mc, playAgain_btn, leaderBoard_mc, leaderBoard, env, playEnabled, incrAlpha_itvl, currentInstr, score, showGameOver_itvl, incr, incrGameOver_itvl, fadeGameOver_itvl, incrMulchEarned_itvl;
function Nav (host_mc, stageWidth, stageHeight) {
host = host_mc;
nav_mc = host.attachMovie("nav", "nav_mc", 998);
instrNav_mc = host.attachMovie("instrNav", "instrNav_mc", 997);
instrNav_mc._visible = false;
instrNav_mc._alpha = 0;
instr1_mc = instrNav_mc.attachMovie("instr1", "instr1_mc", 1);
instr2_mc = instrNav_mc.attachMovie("instr2", "instr2_mc", 2);
instr3_mc = instrNav_mc.attachMovie("instr3", "instr3_mc", 3);
instr4_mc = instrNav_mc.attachMovie("instr4", "instr4_mc", 4);
gameOver_mc = host.attachMovie("gameOver", "gameOver_mc", 996);
gameOver_mc._visible = false;
gameOver_mc._alpha = 0;
gameOver_mc._x = stageWidth / 2;
gameOver_mc._y = stageHeight / 2;
mulchEarned_mc = host.attachMovie("mulchEarned", "mulchEarned_mc", 995);
mulchEarned_mc._visible = false;
playAgain_btn = mulchEarned_mc.playAgain_btn;
playAgain_btn.onPress = mx.utils.Delegate.create(this, playAgain);
mulchEarned_mc.bwLink_btn.onPress = mx.utils.Delegate.create(this, navigateToBw);
leaderBoard_mc = host.createEmptyMovieClip("leaderBoard_mc", 994);
leaderBoard_mc._visible = false;
leaderBoard_mc._alpha = 0;
leaderBoard = new LeaderBoard(leaderBoard_mc);
env = new Env(host, this, stageWidth, stageHeight);
nav_mc.bwLink_btn.onPress = mx.utils.Delegate.create(this, navigateToBw);
nav_mc.playGame.onPress = mx.utils.Delegate.create(this, startGame);
nav_mc.readInstr.onPress = mx.utils.Delegate.create(this, showInstr);
instrNav_mc.back.onPress = mx.utils.Delegate.create(this, backToMain);
instrNav_mc.prevInstr.onPress = mx.utils.Delegate.create(this, prevInstr);
instrNav_mc.nextInstr.onPress = mx.utils.Delegate.create(this, nextInstr);
playEnabled = true;
}
function navigateToBw() {
getURL ("http://www.binweevils.com/", "_blank");
}
function playAgain() {
env.displ.setVis(false);
fade(mulchEarned_mc, nav_mc);
}
function showInstr() {
playEnabled = false;
setInstr(1);
fade(nav_mc, instrNav_mc);
}
function backToMain() {
fade(instrNav_mc, nav_mc);
}
function fade(old_mc, new_mc) {
new_mc._alpha = 0;
new_mc._visible = true;
clearInterval(incrAlpha_itvl);
incrAlpha_itvl = setInterval(this, "incrAlpha", 30, old_mc, new_mc);
}
function incrAlpha(old_mc, new_mc) {
if (old_mc._alpha > 0) {
old_mc._alpha = old_mc._alpha - 5;
} else if (new_mc._alpha < 100) {
new_mc._alpha = new_mc._alpha + 5;
} else {
clearInterval(incrAlpha_itvl);
old_mc._alpha = 0;
old_mc._visible = false;
new_mc._alpha = 100;
if (new_mc == nav_mc) {
playEnabled = true;
}
}
updateAfterEvent();
}
function setInstr(instrNum) {
if ((instrNum > 0) && (instrNum < 5)) {
currentInstr = instrNum;
var _local2 = 1;
while (_local2 < 5) {
instrNav_mc[("instr" + _local2) + "_mc"]._visible = false;
_local2++;
}
instrNav_mc[("instr" + instrNum) + "_mc"]._visible = true;
setPrevNextButs();
}
}
function setPrevNextButs() {
if (currentInstr < 4) {
instrNav_mc.nextInstr._visible = true;
} else {
instrNav_mc.nextInstr._visible = false;
}
if (currentInstr > 1) {
instrNav_mc.prevInstr._visible = true;
} else {
instrNav_mc.prevInstr._visible = false;
}
}
function prevInstr() {
setInstr(currentInstr - 1);
}
function nextInstr() {
setInstr(currentInstr + 1);
}
function startGame() {
if (playEnabled) {
nav_mc._visible = false;
env.init();
}
}
function gameOverSqnce(finalScore) {
score = finalScore;
showGameOver_itvl = setInterval(this, "showGameOver", 1500);
}
function sendScores($score) {
var _local1 = new String((((("gameID=" + _level0.gameID) + "&userID=") + _level0.userID) + "&score=") + $score);
loadVariablesNum ((_level0.loc + "php/battleOfTheBin/updateUserGameScore.php?") + _local1, 100, "POST");
return(Math.round((_level0.tC / _level0.aTS) * $score));
}
function showGameOver() {
clearInterval(showGameOver_itvl);
env.fadeAll();
incr = 5;
gameOver_mc._xscale = 1;
gameOver_mc._yscale = 1;
gameOver_mc._visible = true;
incrGameOver_itvl = setInterval(this, "incrGameOver", 30);
}
function incrGameOver() {
if (gameOver_mc._xscale < 99.5) {
gameOver_mc._xscale = gameOver_mc._xscale + incr;
gameOver_mc._yscale = gameOver_mc._yscale + incr;
gameOver_mc._alpha = gameOver_mc._alpha + incr;
incr = incr / 1.05;
} else {
clearInterval(incrGameOver_itvl);
gameOver_mc._xscale = 100;
gameOver_mc._yscale = 100;
gameOver_mc._alpha = 100;
incr = 0.2;
fadeGameOver_itvl = setInterval(this, "fadeGameOver", 30);
}
updateAfterEvent();
}
function fadeGameOver() {
if (gameOver_mc._alpha > 1) {
gameOver_mc._alpha = gameOver_mc._alpha - incr;
incr = incr * 1.05;
} else {
clearInterval(fadeGameOver_itvl);
gameOver_mc._alpha = 0;
gameOver_mc._visible = false;
mulchEarned_mc._visible = true;
incrMulchEarned_itvl = setInterval(this, "incrMulchEarned", 30);
}
updateAfterEvent();
}
function incrMulchEarned() {
if (mulchEarned_mc._alpha < 92) {
mulchEarned_mc._alpha = mulchEarned_mc._alpha + 8;
} else {
clearInterval(incrMulchEarned_itvl);
mulchEarned_mc._alpha = 100;
}
updateAfterEvent();
}
}
Symbol 222 MovieClip [__Packages.Env] Frame 0
class Env
{
var host, nav, g, drag, bounce, vScroll, rightBound, vBound, xMargin, yMargin, yFirst, sect1Len, bonusPause, yMax, yL, yR, xL, xR, main, displ, coins_mc, coins, fbs_mc, fbs, wallL, wallR, clouds, chuteMan, trampDummy1, trampDummy2, damping, ww, tramp2_1, tramp2Skin1, tramp2_2, tramp2Skin2, sounds, xWind, yWind, bonus, minGap, minVgap, level, windDecr_itvl, scrollIncr, easeOn_itvl, gameActive, setScrollIncr_itvl, stopWW_itvl, jump, t2, ampl2, damping2, shakeIt_itvl, keyUpPressed, keyLeftPressed, keyRightPressed, lenYL, lenXL, lenYR, lenXR, ampl, t, tramp21SHM_itvl, tramp22SHM_itvl, incrAlpha_itvl;
function Env (host_mc, nv, stageWidth, stageHeight) {
host = host_mc;
nav = nv;
g = 0.144;
drag = 0.986;
bounce = 1;
vScroll = 1500;
rightBound = stageWidth;
vBound = stageHeight;
xMargin = Math.round(rightBound / 44);
yMargin = Math.round(vBound / 30.3);
yFirst = 300;
sect1Len = 2200;
bonusPause = 37;
yMax = sect1Len;
yL = new Array();
yR = new Array();
xL = new Array();
xR = new Array();
main = host.createEmptyMovieClip("main_mc", 2);
main._y = vScroll;
displ = new Display(host, rightBound, vBound);
coins_mc = main.createEmptyMovieClip("coins_mc", 4);
coins = new Array();
fbs_mc = main.createEmptyMovieClip("fbs_mc", 6);
fbs = new Array();
wallL = main.createEmptyMovieClip("wallL_mc", 12);
wallR = main.createEmptyMovieClip("wallR_mc", 13);
clouds = new Clouds(host, this);
chuteMan = new ChuteMan(main, this, host);
trampDummy1 = main.attachMovie("tramp2", "trampDummy1", 14);
trampDummy1._x = 70;
trampDummy1._y = (yMax + (668 - yMargin)) + vBound;
trampDummy1.trampSkin_mc._yscale = 0.5;
trampDummy2 = main.attachMovie("tramp2", "trampDummy2", 15);
trampDummy2._x = rightBound - 220;
trampDummy2._y = (yMax + (668 - yMargin)) + vBound;
trampDummy2.trampSkin_mc._yscale = 0.5;
damping = 0.95;
ww = new WhirlWind(main, rightBound / 2, (vBound / 2) - 16);
tramp2_1 = main.attachMovie("tramp2", "tramp2_1_mc", 16);
tramp2_1._x = 70;
tramp2_1._y = (vBound - yMargin) - 2;
tramp2Skin1 = tramp2_1.trampSkin_mc;
tramp2Skin1._yscale = 0.5;
tramp2_2 = main.attachMovie("tramp2", "tramp2_2_mc", 17);
tramp2_2._x = rightBound - 220;
tramp2_2._y = (vBound - yMargin) - 2;
tramp2Skin2 = tramp2_2.trampSkin_mc;
tramp2Skin2._yscale = 0.5;
sounds = new Sounds(host);
var _local2 = new Object();
_local2.onKeyDown = mx.utils.Delegate.create(this, keypressed);
_local2.onKeyUp = mx.utils.Delegate.create(this, keyReleased);
Key.addListener(_local2);
}
function init() {
yMax = sect1Len;
xWind = 0;
yWind = 0;
ww.clearWW();
tramp2_1._visible = false;
tramp2_2._visible = false;
bonus = false;
minGap = 150;
minVgap = 170;
yFirst = 300;
level = 1;
displ.updateScore(0);
displ.updateLevel(level);
clearWallArays();
yL[0] = -1500;
yR[0] = -1500;
xL[0] = -200;
xR[0] = rightBound + 200;
yL[1] = yFirst;
yR[1] = yFirst;
xL[1] = 0;
xR[1] = rightBound;
vScroll = 1500;
main._y = vScroll;
main._alpha = 100;
chuteMan.init();
clouds.init();
createWalls(yFirst);
windDecr_itvl = setInterval(this, "windDecr", 150);
clouds.moveClouds(vScroll);
scrollIncr = 85;
easeOn_itvl = setInterval(this, "easeOn", 20);
}
function easeOn() {
if (vScroll > 1) {
vScroll = vScroll - scrollIncr;
scrollIncr = scrollIncr / 1.06;
} else {
clearInterval(easeOn_itvl);
vScroll = 0;
scrollIncr = null;
gameActive = true;
displ.setVis(true);
}
main._y = vScroll;
clouds.moveClouds(vScroll);
updateAfterEvent();
}
function setScrollIncr(incr) {
clearInterval(setScrollIncr_itvl);
scrollIncr = incr;
if (scrollIncr != 0) {
bonus = false;
displ.updateLevel(level);
}
}
function stopWW() {
clearInterval(stopWW_itvl);
ww.stopWind();
}
function setVscroll(yPos) {
if (scrollIncr != null) {
if (vScroll > ((-yMax) - (669.5 - yMargin))) {
vScroll = vScroll + scrollIncr;
clouds.moveClouds();
} else {
sounds.playSound("boom");
scrollIncr = 0;
vScroll = (-yMax) - (671 - yMargin);
bonus = true;
setScrollIncr_itvl = setInterval(this, "setScrollIncr", (bonusPause + 7) * 1000, -1.5);
jump = true;
vScroll = 0;
shake();
chuteMan.jump((-yMax) - (671 - yMargin));
if (level == 1) {
chuteMan.removeCat();
yMax = 4200;
trampDummy1._y = (yMax + (668 - yMargin)) + vBound;
trampDummy2._y = (yMax + (668 - yMargin)) + vBound;
tramp2_1._visible = true;
tramp2_2._visible = true;
}
tramp2Bounce(60, 1);
tramp2Bounce(60, 2);
level++;
if (minGap > 68) {
minGap = minGap - 12;
}
if (minVgap > 90) {
minVgap = minVgap - 12;
}
newSection();
ww.go();
stopWW_itvl = setInterval(this, "stopWW", bonusPause * 1000);
}
} else if (yPos != null) {
vScroll = yPos;
clouds.moveClouds(vScroll);
}
main._y = vScroll;
}
function shake() {
t2 = 0;
ampl2 = 4;
damping2 = 0.92;
shakeIt_itvl = setInterval(this, "shakeIt", 20);
}
function shakeIt() {
if (ampl2 < 0.5) {
clearInterval(shakeIt_itvl);
} else {
main._x = ampl2 * Math.sin(3 * t2);
main._y = vScroll + (ampl2 * Math.sin(2 * t2));
ampl2 = ampl2 * damping2;
t2++;
}
}
function keypressed() {
if (gameActive) {
if (Key.getCode() == 38) {
if (keyUpPressed != true) {
yWind = yWind - 0.9;
keyUpPressed = true;
}
}
if (Key.getCode() == 37) {
if (keyLeftPressed != true) {
xWind = xWind - 0.72;
keyLeftPressed = true;
}
}
if (Key.getCode() == 39) {
if (keyRightPressed != true) {
xWind = xWind + 0.7;
keyRightPressed = true;
}
}
}
}
function keyReleased() {
if (Key.getCode() == 38) {
keyUpPressed = false;
}
if (Key.getCode() == 37) {
keyLeftPressed = false;
}
if (Key.getCode() == 39) {
keyRightPressed = false;
}
}
function windDecr() {
if (xWind != 0) {
xWind = xWind / 1.25;
if (Math.abs(xWind) < 0.02) {
xWind = 0;
}
}
if (yWind != 0) {
yWind = yWind / 1.3;
if (Math.abs(yWind) < 0.1) {
yWind = 0;
}
}
}
function createWalls(currentY) {
var _local3 = currentY;
while (_local3 < yMax) {
_local3 = generateRnd(_local3 + 70, _local3 + 300);
yL.push(_local3);
xL.push(generateRnd(50, (rightBound - minGap) - 80));
}
if (xL[2] < 265) {
xL[2] = 265;
}
_local3 = currentY;
var _local7 = _local3;
while (_local3 < yMax) {
_local7 = _local3;
_local3 = generateRnd(_local3 + 70, _local3 + 300);
yR.push(_local3);
var _local6 = _local7 - minVgap;
var _local5 = _local3 + minVgap;
var _local2 = 0;
var _local4 = 0;
while (yL[_local2] < _local5) {
if (yL[_local2] > _local6) {
if (xL[_local2] > _local4) {
_local4 = xL[_local2];
}
}
_local2++;
}
if (xL[_local2] > _local4) {
_local4 = xL[_local2];
}
xR.push(generateRnd(_local4 + minGap, rightBound - 80));
}
createCavern(yMax);
lenYL = yL.length;
lenXL = xL.length;
lenYR = yR.length;
lenXR = xR.length;
drawWall(wallL, lenYL, yL, xL);
drawWall(wallR, lenYR, yR, xR);
createCoins();
createFbs();
}
function createCavern(yRef) {
yL.push(yRef + 500);
xL.push(80);
yR.push(yRef + 500);
xR.push(rightBound - 80);
yL.push(yRef + 670);
xL.push((rightBound / 2) - 17);
yR.push(yRef + 670);
xR.push((rightBound / 2) + 17);
yL.push(((yRef + 670) - (yMargin * 2)) + vBound);
xL.push(xMargin);
yR.push(((yRef + 670) - (yMargin * 2)) + vBound);
xR.push(rightBound - xMargin);
yL.push((yRef + 904) + vBound);
xL.push((rightBound / 2) - 20);
yR.push((yRef + 770) + vBound);
xR.push((rightBound / 2) + 20);
}
function tramp2Bounce(amplitude, trampID) {
ampl = amplitude;
t = 0;
if (trampID == 1) {
clearInterval(tramp21SHM_itvl);
tramp21SHM_itvl = setInterval(this, "tramp2SHM", 20, 1);
} else {
clearInterval(tramp22SHM_itvl);
tramp22SHM_itvl = setInterval(this, "tramp2SHM", 20, 2);
}
}
function tramp2SHM(trampID) {
var _local2 = this["tramp2Skin" + trampID];
_local2._yscale = (ampl / 3) * Math.sin(t);
ampl = ampl * damping;
t = t + 1.5;
if (ampl < 2) {
if (trampID == 1) {
clearInterval(tramp21SHM_itvl);
} else {
clearInterval(tramp22SHM_itvl);
}
ampl = 0;
_local2._yscale = 0.5;
}
}
function newSection() {
clearWallArays();
yL[0] = -510;
yR[0] = -510;
xL[0] = -200;
xR[0] = rightBound + 200;
createCavern(-(671 - yMargin));
yFirst = yL[4];
createWalls(yFirst);
}
function clearWallArays() {
var _local2 = 0;
while (_local2 < lenYL) {
yL.pop();
xL.pop();
_local2++;
}
_local2 = 0;
while (_local2 < lenYR) {
yR.pop();
xR.pop();
_local2++;
}
}
function drawWall(wall_mc, lenYcoords, yCoords, xCoords) {
wall_mc.clear();
wall_mc.lineStyle(3, 8947712, 100);
wall_mc.beginFill(10066176, 100);
wall_mc.moveTo(xCoords[0], yCoords[0]);
var _local1 = 1;
while (_local1 < lenYcoords) {
wall_mc.lineTo(xCoords[_local1], yCoords[_local1 - 1]);
wall_mc.lineTo(xCoords[_local1], yCoords[_local1]);
_local1++;
}
wall_mc.lineTo(xCoords[0], yCoords[_local1 - 1]);
wall_mc.lineTo(xCoords[0], yCoords[0]);
wall_mc.endFill();
}
function createCoins() {
while (coins[0] != undefined) {
coins.pop().clearCoin();
}
if (level == 1) {
var _local6 = (rightBound / 2) - 88;
var _local3 = -500;
while (_local3 < (yFirst - 150)) {
var _local2 = 0;
while (_local2 < 5) {
coins.push(new Coin(coins_mc, _local6 + (_local2 * 45), _local3));
_local2++;
}
_local3 = _local3 + 45;
}
} else {
var _local4 = Math.floor(((rightBound - (2 * xMargin)) - 26) / 35);
var _local7 = ((rightBound - (2 * xMargin)) - 26) / _local4;
var _local3 = (yFirst - vBound) - 217;
while (_local3 < (yFirst - 450)) {
var _local2 = 0;
while (_local2 <= _local4) {
if (((_local3 < ((yFirst - vBound) - 177)) || (_local2 < 1)) || (_local2 > (_local4 - 1))) {
coins.push(new Coin(coins_mc, (13 + xMargin) + (_local2 * _local7), _local3, true));
}
_local2++;
}
_local3 = _local3 + 26;
}
}
var _local5 = new Object();
var _local3 = yFirst + 80;
while (_local3 < (yMax - 10)) {
_local5 = getCoinXbounds(_local3);
coins.push(new Coin(coins_mc, generateRnd(_local5.xMin, _local5.xMax), _local3));
_local3 = _local3 + 80;
}
}
function createFbs() {
while (fbs[0] != undefined) {
fbs.pop().clearIt();
}
var _local4 = yFirst + 300;
while (_local4 < (yMax - 10)) {
var _local3 = generateRnd(1, level + 1);
var _local5 = generateRnd(1, 5);
var _local2 = 0;
while (_local2 < _local5) {
_local3 = _local3 * -1;
_local2++;
}
fbs.push(new Fb(fbs_mc, -20, rightBound + 20, _local4, _local3));
_local4 = _local4 + (800 / level);
}
}
function generateRnd(min, max) {
return(((max - min) * Math.random()) + min);
}
function getCoinXbounds(yPos) {
var _local6 = new Object();
var _local4 = new Array();
var _local3 = new Array();
var _local2;
_local2 = 1;
while (_local2 < lenYL) {
if (xL[_local2 + 1] < xL[_local2]) {
_local4[_local2] = yL[_local2] + 65;
} else {
_local4[_local2] = yL[_local2] - 14;
}
_local2++;
}
_local2 = 1;
while (_local2 < lenYR) {
if (xR[_local2 + 1] > xR[_local2]) {
_local3[_local2] = yR[_local2] + 42;
} else {
_local3[_local2] = yR[_local2] - 12;
}
_local2++;
}
_local2 = 1;
while (_local4[_local2] < yPos) {
_local2++;
}
_local6.xMin = xL[_local2] + 16;
_local2 = 1;
while (_local3[_local2] < yPos) {
_local2++;
}
_local6.xMax = xR[_local2] - 16;
return(_local6);
}
function getBoundaries(xPos, yPos, padding) {
var _local4 = new Object();
_local4.yMax = 10000;
_local4.yMin = -1000000;
_local4.xMax = rightBound;
_local4.xMin = 0;
var _local3 = 0;
while (yL[_local3] < yPos) {
_local3++;
}
_local4.xMin = xL[_local3];
var _local2;
_local2 = _local3;
while (_local2 < lenYL) {
if ((xL[_local2] < xPos) && (xL[_local2 + 1] > xPos)) {
_local4.yMax = yL[_local2];
break;
}
_local2++;
}
_local2 = _local3 - 1;
while (_local2 >= 0) {
if ((xL[_local2] > xPos) && (xL[_local2 + 1] < xPos)) {
_local4.yMin = yL[_local2];
break;
}
_local2--;
}
_local3 = 0;
while (yR[_local3] < yPos) {
_local3++;
}
_local4.xMax = xR[_local3];
_local2 = _local3;
while (_local2 < lenYR) {
if ((xR[_local2] > xPos) && (xR[_local2 + 1] < xPos)) {
if (yR[_local2] < _local4.yMax) {
_local4.yMax = yR[_local2];
break;
}
}
_local2++;
}
_local2 = _local3 - 1;
while (_local2 >= 0) {
if ((xR[_local2] < xPos) && (xR[_local2 + 1] > xPos)) {
if (yR[_local2] > _local4.yMin) {
_local4.yMin = yR[_local2];
break;
}
}
_local2--;
}
_local4.yMax = _local4.yMax - padding;
_local4.yMin = _local4.yMin + padding;
_local4.xMax = _local4.xMax - padding;
_local4.xMin = _local4.xMin + padding;
return(_local4);
}
function endGame() {
gameActive = false;
setScrollIncr(0);
nav.gameOverSqnce(chuteMan.score);
}
function fadeAll() {
incrAlpha_itvl = setInterval(this, "incrAlpha", 30);
}
function clearAll() {
chuteMan.clearAll();
clearInterval(windDecr_itvl);
clearInterval(setScrollIncr_itvl);
clearInterval(stopWW_itvl);
ww.clearWW();
}
function incrAlpha() {
if (main._alpha > 5) {
main._alpha = main._alpha - 5;
clouds.setAlpha(main._alpha);
} else {
clearInterval(incrAlpha_itvl);
main._alpha = 0;
clouds.setAlpha(0);
clearAll();
}
}
}
Symbol 223 MovieClip [__Packages.Clouds] Frame 0
class Clouds
{
var env, clouds, bgClouds, fgClouds, count, nextFGcloud, len;
function Clouds (host, e) {
env = e;
clouds = new Array();
bgClouds = host.createEmptyMovieClip("bgClouds_mc", 0);
fgClouds = host.createEmptyMovieClip("fgClouds_mc", 3);
}
function init() {
clearClouds();
setAlpha(100);
createCloud(50, 2);
createCloud(0, 3);
createCloud(-20, 5);
createCloud(0, 7);
createCloud(40, 9);
createCloud(120, 10);
createCloud(180, 12);
createCloud(200, 15);
count = 0;
nextFGcloud = 12;
}
function clearClouds() {
var _local2 = clouds.length;
while (_local2 >= 0) {
clouds.pop().remove();
_local2--;
}
}
function setAlpha(a) {
bgClouds._alpha = a;
fgClouds._alpha = a;
}
function createCloud(py, d) {
var _local3;
if (d > 20) {
_local3 = fgClouds;
} else {
_local3 = bgClouds;
}
var _local2 = Math.round((env.rightBound - 30) * Math.random()) + 30;
len = clouds.push(new Cloud(bgClouds, _local2, py, d));
count++;
if (count > nextFGcloud) {
count = 0;
len = clouds.push(new Cloud(fgClouds, _local2, py, 38));
nextFGcloud = Math.round(50 * Math.random());
}
}
function moveClouds(vScroll) {
var _local2 = 0;
while (_local2 < len) {
if (vScroll != undefined) {
clouds[_local2].track(vScroll);
} else {
var _local3 = clouds[_local2].scrollIt(env.scrollIncr);
if (_local3 != null) {
clouds.splice(_local2, 1)[0].remove();
if (_local3 < 20) {
createCloud(env.vBound + 120, _local3);
}
}
}
_local2++;
}
}
}
Symbol 224 MovieClip [__Packages.Cloud] Frame 0
class Cloud
{
var d, cloud_mc, yStart;
function Cloud (host, px, py, depth) {
d = depth;
var _local3 = Math.round((2 * Math.random()) + 1);
var _local2 = host.getNextHighestDepth();
cloud_mc = host.attachMovie("clouds" + _local3, ("cloud" + _local2) + "_mc", _local2);
cloud_mc._x = px;
cloud_mc._y = py;
yStart = py;
if (d > 20) {
cloud_mc._xscale = 5 * d;
cloud_mc._yscale = 5 * d;
alph = 25;
} else {
cloud_mc._xscale = 8 * d;
cloud_mc._yscale = 8 * d;
var alph = ((60 * d) / 16);
if (alph > 60) {
alph = 60;
}
}
cloud_mc._alpha = alph;
}
function track(vScroll) {
cloud_mc._y = ((vScroll * d) / 20) + yStart;
}
function scrollIt(scrollIncr) {
cloud_mc._y = cloud_mc._y + ((scrollIncr * d) / 20);
if (cloud_mc._y > -120) {
return(null);
}
return(d);
}
function remove() {
cloud_mc.removeMovieClip();
}
}
Symbol 225 MovieClip [__Packages.ChuteMan] Frame 0
class ChuteMan
{
var m_holder_mc, p, main, env, chuteMan, blue, chute, chuteCords, catapult, rubber, tramp, trampSkin, blueStart, black, initX, initY, cat, go, chuteBroken, deployed, fullyOpen, goingDown, started, score, dr, yPos, cyPrev, rubberDecr_itvl, render_itvl, catKey, slide_itvl, ampl, maxAmpl, damping, t, t2, ampl2, catSHM_itvl, trampSHM_itvl, incrDrg_itvl, chuteOpen_itvl, p1, offscreen;
function ChuteMan (main_mc, environment, holder_mc) {
m_holder_mc = holder_mc;
p = new Array();
main = main_mc;
env = environment;
chuteMan = main.createEmptyMovieClip("chuteMan_mc", 5);
blue = chuteMan.attachMovie("blue", "blue_mc", 2);
chute = chuteMan.attachMovie("chute", "chute_mc", 3);
chuteCords = chuteMan.attachMovie("chuteCords", "chuteCords_mc", 1);
catapult = main.attachMovie("catapult", "catapult_mc", 9);
catapult._x = 250;
catapult._y = env.yFirst - 1;
rubber = catapult.rubber_mc;
tramp = main.attachMovie("tramp", "tramp_mc", 11);
tramp._x = env.rightBound - 57;
tramp._y = env.yFirst - 2;
tramp._rotation = 35;
trampSkin = tramp.trampSkin_mc;
blueStart = main.attachMovie("blueStart", "blueStart_mc", 8);
blueStart._y = env.yFirst - 31;
black = main.attachMovie("black", "black_mc", 10);
black._y = env.yFirst - 21;
initX = 200;
initY = 264;
var _local2 = new Object();
_local2.onKeyDown = mx.utils.Delegate.create(this, keypressed);
Key.addListener(_local2);
}
function init() {
cat = true;
go = false;
chuteBroken = false;
deployed = false;
fullyOpen = false;
goingDown = false;
started = false;
score = 0;
chuteMan._visible = false;
chuteCords.cords_mc.gotoAndStop(1);
chuteCords.cords_mc._xscale = 72.3;
blue.gotoAndStop(1);
blue.armR_mc.gotoAndStop(1);
blue.armL_mc.gotoAndStop(1);
blue.legR_mc.gotoAndStop(1);
blue.legL_mc.gotoAndStop(1);
setChuteVis(false);
dr = 0;
yPos = null;
cyPrev = null;
while (p[0] != undefined) {
p.pop();
}
p.push(new Particle(chuteMan, env, initX, initY - 3, 13, 0.5, false, 0, true, this, m_holder_mc));
p.push(new Particle(chuteMan, env, initX, initY, 8, 0.5, false, 0, false, this, m_holder_mc));
p.push(new Particle(chuteMan, env, initX - 7, initY + 24, 2, 0.5, false, 0, false, this, m_holder_mc));
p.push(new Particle(chuteMan, env, initX + 7, initY + 24, 2, 0.5, false, 0, false, this, m_holder_mc));
p[0].follow(true, p[1]);
p[1].addConstr(p[2], 25);
p[1].addConstr(p[3], 25);
p[2].addConstr(p[3], 14);
rubber._xscale = 50;
trampSkin._xscale = 1.5;
blueStart._x = (catapult._x - rubber._xscale) + 13;
black._x = (catapult._x - rubber._xscale) + 22;
blueStart._visible = true;
catapult._visible = true;
tramp._visible = true;
black._visible = true;
rubberDecr_itvl = setInterval(this, "rubberDecr", 40);
}
function clearAll() {
clearInterval(render_itvl);
}
function keypressed() {
if (env.gameActive) {
if (cat) {
if (Key.getCode() == 37) {
if (catKey != 37) {
rubber._xscale = rubber._xscale + 7;
env.sounds.playContinuous("stretch");
setBlueStartX();
setBlackX();
blueStart.gotoAndStop("walk");
black.gotoAndStop("walk");
clearInterval(slide_itvl);
slide_itvl = setInterval(this, "slide", 200);
catKey = 37;
}
}
if (Key.getCode() == 39) {
if (catKey != 39) {
rubber._xscale = rubber._xscale + 7;
setBlueStartX();
setBlackX();
blueStart.gotoAndStop("walk");
black.gotoAndStop("walk");
clearInterval(slide_itvl);
slide_itvl = setInterval(this, "slide", 200);
catKey = 39;
}
}
if (Key.getCode() == 32) {
cat = false;
clearInterval(rubberDecr_itvl);
ampl = rubber._xscale;
env.sounds.playSound("releaseCat", ampl / 6);
env.sounds.playSound("swoosh", ampl / 6);
maxAmpl = ampl;
damping = 0.95;
t = 0;
t2 = 0;
ampl2 = ampl;
catSHM_itvl = setInterval(this, "catSHM", 20);
clearInterval(slide_itvl);
black.gotoAndPlay("fallBack");
}
} else if (Key.getCode() == 32) {
if (deployed) {
loseChute();
} else {
deployChute();
}
}
}
}
function rubberDecr() {
if (rubber._xscale > 50) {
rubber._xscale = rubber._xscale / 1.028;
if (rubber._xscale < 51) {
rubber._xscale = 50;
}
setBlueStartX();
setBlackX();
} else {
blueStart.gotoAndStop("stand");
black.gotoAndStop("stand");
}
}
function slide() {
clearInterval(slide_itvl);
blueStart.gotoAndStop("slide");
black.gotoAndStop("slide");
}
function setBlueStartX() {
blueStart._x = 262 - rubber._xscale;
}
function setBlackX() {
black._x = 271 - rubber._xscale;
}
function catSHM() {
rubber._xscale = ampl * Math.cos(t);
if (black._x > 52) {
black._x = black._x - (ampl * 0.04);
} else {
black._x = 52;
}
if (!go) {
if (rubber._xscale > 8) {
setBlueStartX();
} else {
go = true;
chuteMan._visible = true;
blueStart._visible = false;
goNow(maxAmpl / 1.5, -8);
}
}
ampl = ampl * damping;
t = t + 1.1;
if (ampl < 4) {
clearInterval(catSHM_itvl);
ampl = 0;
rubber._xscale = 0;
}
updateAfterEvent();
}
function goNow(vx, vy) {
var _local2 = 0;
while (_local2 < 4) {
p[_local2].update(vx, vy);
_local2++;
}
render_itvl = setInterval(this, "render", 20);
}
function trampBounce() {
clearInterval(trampSHM_itvl);
trampSHM_itvl = setInterval(this, "trampSHM", 20);
}
function trampSHM() {
trampSkin._xscale = (ampl2 / 2) * Math.sin(t2);
ampl2 = ampl2 * damping;
t2 = t2 + 1.5;
if (ampl2 < 2) {
clearInterval(trampSHM_itvl);
ampl2 = 0;
trampSkin._xscale = 1.5;
}
}
function deployChute() {
if ((!deployed) && (!chuteBroken)) {
p[0].follow(false);
p[0].addRopeConstr(p[1], 37);
incrDrg_itvl = setInterval(this, "incrDrg", 40);
chute._xscale = 10;
chuteCords._xscale = 10;
chuteCords.cords_mc._height = 0;
setChuteVis(true);
deployed = true;
chuteOpen_itvl = setInterval(this, "chuteOpen", 1000, true);
}
}
function incrDrg() {
if (dr < 0.4) {
dr = dr + 0.02;
p[0].changeRopeConstr(p[1], 22 + (dr * 60));
p[0].setDrg(0.08 + dr);
chute._xscale = dr * 250;
chuteCords._xscale = dr * 250;
} else {
clearInterval(incrDrg_itvl);
}
}
function chuteOpen(tf) {
clearInterval(chuteOpen_itvl);
fullyOpen = tf;
}
function loseChute() {
if (fullyOpen && (!chuteBroken)) {
clearInterval(incrDrg_itvl);
p[0].setDrg(0);
p[0].removeRopeConstr(p[1]);
p[0].follow(true, p[1]);
dr = 0;
setChuteVis(false);
chuteCords.cords_mc._height = 0;
chute._xscale = 0;
chuteCords._xscale = 0;
deployed = false;
chuteOpen(false);
}
}
function breakChute(slash) {
chuteBroken = true;
if (slash) {
env.sounds.playSound("slash");
}
p[0].setDrg(0);
p[0].removeRopeConstr(p[1]);
chute._visible = false;
chuteCords.cords_mc.gotoAndPlay(2);
env.endGame();
}
function setChuteVis(vis) {
chute._visible = vis;
chuteCords._visible = vis;
}
function removeCat() {
catapult._visible = false;
tramp._visible = false;
black._visible = false;
}
function jump(dist) {
for (var _local3 in p) {
p[_local3].y = p[_local3].y + dist;
p[_local3].yPrev = p[_local3].yPrev + dist;
p[_local3].getBoundaries();
}
env.jump = false;
}
function render() {
var _local8 = 0;
while (_local8 < 4) {
p[_local8].update();
_local8++;
}
var _local5 = p[0].x;
var _local3 = p[0].y;
var _local7 = p[1].x - _local5;
var _local6 = p[1].y - _local3;
var _local4 = (180 * Math.atan2(-_local7, _local6)) / Math.PI;
chute._rotation = _local4;
chute._x = _local5;
chute._y = _local3;
chuteCords._rotation = _local4;
chuteCords._x = _local5;
chuteCords._y = _local3;
var _local9 = Math.sqrt((_local7 * _local7) + (_local6 * _local6)) - 3;
if (_local9 > 55) {
_local9 = 55;
}
chuteCords.cords_mc._height = _local9;
_local5 = p[1].x;
_local3 = p[1].y;
_local7 = ((p[2].x + p[3].x) / 2) - _local5;
_local6 = ((p[2].y + p[3].y) / 2) - _local3;
_local4 = (180 * Math.atan2(-_local7, _local6)) / Math.PI;
blue._rotation = _local4;
blue.armR_mc._rotation = -_local4;
blue.armL_mc._rotation = -_local4;
blue.legR_mc._rotation = (-_local4) / 2;
blue.legL_mc._rotation = (-_local4) / 2;
blue._x = _local5;
blue._y = _local3;
if (env.gameActive) {
p1 = {x:0, y:10};
blue.localToGlobal(p1);
m_holder_mc.globalToLocal(p1);
p1.y = p1.y - env.vScroll;
var _local2;
if (started) {
_local2 = env.vScroll;
} else {
_local2 = null;
}
for (_local8 in env.coins) {
if (env.coins[_local8].hitCheck(p1.x, p1.y, _local2)) {
env.sounds.playSound("pop");
score = score + 5;
env.displ.updateScore(score);
}
}
for (_local8 in env.fbs) {
if (env.fbs[_local8].hitCheck(p1.x, p1.y, _local2)) {
env.sounds.playSound("bang");
blue.gotoAndPlay(2);
blue.armR_mc.gotoAndPlay(2);
blue.armL_mc.gotoAndPlay(2);
blue.legR_mc.gotoAndPlay(2);
blue.legL_mc.gotoAndPlay(2);
p[1].setDrg(0.4);
breakChute();
}
}
if (((_local3 <= 150) && (!fullyOpen)) && (!goingDown)) {
yPos = 150 - _local3;
if (_local3 > cyPrev) {
goingDown = true;
}
cyPrev = _local3;
} else if ((!started) && ((_local3 > 310) || (fullyOpen))) {
started = true;
env.setScrollIncr(-1.5);
yPos = null;
}
env.setVscroll(yPos);
offscreen = true;
for (_local8 in p) {
if (((p[_local8].y + env.vScroll) > -15) && ((p[_local8].y + env.vScroll) < (env.vBound + 12))) {
offscreen = false;
break;
}
}
if (offscreen) {
breakChute(true);
}
}
updateAfterEvent();
}
function drawStick(p0, p1) {
chuteMan.moveTo(p0.x, p0.y);
chuteMan.lineTo(p1.x, p1.y);
}
}
Symbol 226 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 227 MovieClip [__Packages.Particle] Frame 0
class Particle
{
var m_holder_mc, host, env, drg, isChute, chuteMan, xPrev, x, yPrev, y, pad, mass, startMass, drag, ptcl, sticks, stickLens, mins, minLens, maxs, maxLens, posConstrs, constrTypes, bounds, ww, firstCol, update_itvl, leader, following, bumpX, bumpY, p1, p2, chuteBounds;
function Particle (chuteMan_mc, environment, xPos, yPos, padding, m, vis, extraDrag, chute, cm, holder_mc) {
m_holder_mc = holder_mc;
host = chuteMan_mc;
env = environment;
if (extraDrag == undefined) {
drg = 0;
} else {
drg = extraDrag;
}
isChute = chute;
chuteMan = cm;
setX(xPos);
setY(yPos);
xPrev = x;
yPrev = y;
pad = padding;
mass = m;
startMass = mass;
drag = false;
if (!vis) {
ptcl._alpha = 0;
}
sticks = new Array();
stickLens = new Array();
mins = new Array();
minLens = new Array();
maxs = new Array();
maxLens = new Array();
posConstrs = new Array();
constrTypes = new Array();
ptcl.onPress = mx.utils.Delegate.create(this, dragMe);
ptcl.onRelease = (ptcl.onReleaseOutside = mx.utils.Delegate.create(this, releaseMe));
bounds = new Object();
bounds.yMax = 400;
bounds.yMin = -5000;
bounds.xMax = env.rightBound;
bounds.xMin = 0;
ww = new Object();
firstCol = true;
}
function go(dx, dy) {
}
function halt() {
clearInterval(update_itvl);
}
function setDrg(drgVal) {
drg = drgVal;
}
function dragMe() {
drag = true;
mass = 0;
}
function releaseMe() {
drag = false;
mass = startMass;
}
function setX(xPos) {
x = xPos;
}
function setY(yPos) {
y = yPos;
}
function setPos(xPos, yPos) {
setX(xPos);
setY(yPos);
xPrev = xPos;
yPrev = yPos;
}
function follow(followMe, leaderP) {
if (followMe) {
leader = leaderP;
}
following = followMe;
}
function update(vx, vy) {
if (!env.jump) {
if (vx == undefined) {
vx = x - xPrev;
vy = y - yPrev;
}
xPrev = x;
yPrev = y;
if (!following) {
if (drag) {
x = host._xmouse;
y = host._ymouse;
} else {
vx = vx * (env.drag - drg);
vy = vy * (env.drag - drg);
if (env.bonus) {
ww = env.ww.getWind(x, y);
} else {
ww.xw = 0;
ww.yw = 0;
}
vx = vx + ((env.xWind + ww.xw) * drg);
vy = vy + ((env.yWind + ww.yw) * drg);
vy = vy + env.g;
x = x + vx;
y = y + vy;
}
bumpX = false;
bumpY = false;
if (y >= bounds.yMax) {
if ((env.bonus && ((y - yPrev) > 0.6)) && (((x > 75) && (x < 215)) || ((x > (env.rightBound - 215)) && (x < (env.rightBound - 75))))) {
yPrev = bounds.yMax + ((y - yPrev) * 5.5);
if (yPrev > (bounds.yMax + 40)) {
yPrev = bounds.yMax + 40;
}
env.sounds.playSound("boing", yPrev - bounds.yMax);
xPrev = xPrev - (((yPrev - bounds.yMax) * 0.1) * vx);
if ((x > 75) && (x < 215)) {
env.tramp2Bounce(1.6 * (yPrev - bounds.yMax), 1);
} else {
env.tramp2Bounce(yPrev - bounds.yMax, 2);
}
} else {
bumpY = true;
yPrev = y * env.bounce;
}
y = bounds.yMax;
}
if (y <= bounds.yMin) {
bumpY = true;
yPrev = y * env.bounce;
y = bounds.yMin + 1;
}
if (((firstCol && (x >= (bounds.xMax - 31))) && (y > (env.yFirst - 75))) && (bounds.xMax == (env.rightBound - pad))) {
chuteMan.trampBounce();
xPrev = (bounds.xMax - 31) + ((x - xPrev) * 0.08);
env.sounds.playSound("boing", x - xPrev);
x = bounds.xMax - 31;
yPrev = y + (Math.abs(x - xPrev) * 4);
firstCol = false;
} else if (x >= bounds.xMax) {
bumpX = true;
xPrev = x * env.bounce;
x = bounds.xMax;
}
if (x <= bounds.xMin) {
bumpX = true;
xPrev = x * env.bounce;
x = bounds.xMin;
}
if (isChute) {
if (chuteMan.fullyOpen) {
if (!chuteMan.chuteBroken) {
if ((((y > (bounds.yMax - 27)) || (y < (bounds.yMin + 27))) || (x > (bounds.xMax - 27))) || (x < (bounds.xMin + 27))) {
p1 = {x:-19, y:1};
p2 = {x:19, y:1};
host.chute_mc.localToGlobal(p1);
m_holder_mc.globalToLocal(p1);
p1.y = p1.y - env.vScroll;
chuteBounds = env.getBoundaries(p1.x, p1.y, 6);
if (testChute(p1)) {
chuteMan.breakChute(true);
} else {
host.chute_mc.localToGlobal(p2);
m_holder_mc.globalToLocal(p2);
p2.y = p2.y - env.vScroll;
chuteBounds = env.getBoundaries(p2.x, p2.y, 6);
if (testChute(p2)) {
chuteMan.breakChute();
}
}
}
}
}
} else if (bumpX) {
var _local2 = Math.abs(vx);
if (_local2 > 1.35) {
_local2 = 2 + ((2 * _local2) * _local2);
if (_local2 > 100) {
_local2 = 100;
}
env.sounds.playSound("bump", _local2);
}
} else if (bumpY) {
var _local3 = Math.abs(vy);
if (_local3 > 1.35) {
_local3 = 2 + ((2 * _local3) * _local3);
if (_local3 > 100) {
_local3 = 100;
}
env.sounds.playSound("bump", _local3);
}
}
bounds = env.getBoundaries(x, y, pad);
} else {
x = leader.x;
y = leader.y - 3;
bounds = env.getBoundaries(x, y, pad);
}
relax();
relax();
relax();
}
}
function getBoundaries() {
bounds = env.getBoundaries(x, y, pad);
}
function testChute(p) {
if (p.x >= chuteBounds.xMax) {
return(true);
}
if (p.x <= chuteBounds.xMin) {
return(true);
}
if (p.y >= chuteBounds.yMax) {
return(true);
}
if (p.y <= chuteBounds.yMin) {
return(true);
}
return(false);
}
function relax() {
if (!env.jump) {
var _local4 = this;
var _local2;
var _local10;
var _local8;
var _local7;
var _local6;
var _local5;
var _local9;
var _local3;
for (var _local11 in sticks) {
_local2 = sticks[_local11];
_local10 = stickLens[_local11];
_local8 = _local4.mass;
_local7 = _local2.mass;
_local6 = _local4.x - _local2.x;
_local5 = _local4.y - _local2.y;
_local9 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
_local3 = (_local9 - _local10) / (_local9 * (_local8 + _local7));
_local4.x = _local4.x - ((_local6 * _local3) * _local8);
_local4.y = _local4.y - ((_local5 * _local3) * _local8);
_local2.x = _local2.x + ((_local6 * _local3) * _local7);
_local2.y = _local2.y + ((_local5 * _local3) * _local7);
}
for (var _local11 in maxs) {
_local2 = maxs[_local11];
_local10 = maxLens[_local11];
_local8 = _local4.mass;
_local7 = _local2.mass;
_local6 = _local4.x - _local2.x;
_local5 = _local4.y - _local2.y;
_local9 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
_local3 = (_local9 - _local10) / (_local9 * (_local8 + _local7));
if (_local9 > _local10) {
_local3 = (_local9 - _local10) / (_local9 * (_local8 + _local7));
_local4.x = _local4.x - ((_local6 * _local3) * _local8);
_local4.y = _local4.y - ((_local5 * _local3) * _local8);
_local2.x = _local2.x + ((_local6 * _local3) * _local7);
_local2.y = _local2.y + ((_local5 * _local3) * _local7);
}
}
}
}
function addConstr(particle, restLen) {
sticks.push(particle);
stickLens.push(restLen);
particle.sticks.push(this);
particle.stickLens.push(restLen);
var _local2 = 0;
while (_local2 < 300) {
relax();
_local2++;
}
}
function addAngConstr(particle, minDist) {
mins.push(particle);
minLens.push(minDist);
particle.mins.push(this);
particle.minLens.push(minDist);
var _local2 = 0;
while (_local2 < 300) {
relax;
_local2++;
}
}
function addRopeConstr(particle, maxDist) {
maxs.push(particle);
maxLens.push(maxDist);
particle.maxs.push(this);
particle.maxLens.push(maxDist);
var _local2 = 0;
while (_local2 < 300) {
relax;
_local2++;
}
}
function changeRopeConstr(particle, maxDist) {
maxLens[0] = maxDist;
particle.maxLens[0] = maxDist;
var _local2 = 0;
while (_local2 < 100) {
relax;
_local2++;
}
}
function removeRopeConstr(particle) {
maxs.pop();
maxLens.pop();
particle.maxs.pop();
particle.maxLens.pop();
}
function addPosConstr(type, pos) {
constrTypes.push(type);
posConstrs.push(pos);
}
}
Symbol 228 MovieClip [__Packages.WhirlWind] Frame 0
class WhirlWind
{
var host, x, y, ww_mc, strength, wwSound, wwSound2, playWwSound2_itvl, incrStrength_itvl, rotate_itvl, decrStrength_itvl;
function WhirlWind (host_mc, px, py) {
host = host_mc;
x = px;
y = py;
ww_mc = host.attachMovie("whirlwind", "ww_mc", 9999);
ww_mc._x = x;
ww_mc._y = y;
ww_mc._width = 250;
ww_mc._height = 250;
ww_mc._alpha = 0;
strength = 0;
wwSound = new Sound(ww_mc);
wwSound.attachSound("vortex.wav");
wwSound2 = new Sound(ww_mc);
wwSound2.attachSound("vortex.wav");
}
function go() {
ww_mc._visible = true;
wwSound.setVolume(0);
wwSound.start();
wwSound.onSoundComplete = mx.utils.Delegate.create(this, playWwSound);
wwSound2.setVolume(0);
playWwSound2_itvl = setInterval(this, "playWwSound2", 800);
wwSound2.onSoundComplete = mx.utils.Delegate.create(this, playWwSound2);
incrStrength_itvl = setInterval(this, "incrStrength", 50);
rotate_itvl = setInterval(this, "rotate", 30);
}
function playWwSound() {
wwSound.start();
}
function playWwSound2() {
clearInterval(playWwSound2_itvl);
wwSound2.start();
}
function incrStrength() {
if (strength < 100) {
strength = strength + 1;
ww_mc._alpha = strength / 4;
setWwVolume();
} else {
clearInterval(incrStrength_itvl);
}
}
function setWwVolume() {
var _local2 = strength - 30;
if (_local2 < 0) {
_local2 = 0;
}
wwSound.setVolume(_local2);
wwSound2.setVolume(_local2);
}
function stopWind() {
decrStrength_itvl = setInterval(this, "decrStrength", 50);
}
function decrStrength() {
if (strength > 0) {
strength = strength - 1;
ww_mc._alpha = strength / 4;
setWwVolume();
} else {
clearWW();
}
}
function clearWW() {
clearInterval(decrStrength_itvl);
clearInterval(incrStrength_itvl);
strength = 0;
ww_mc._alpha = 0;
ww_mc._visible = false;
wwSound.stop();
wwSound2.stop();
clearInterval(rotate_itvl);
}
function rotate() {
ww_mc._rotation = ww_mc._rotation - (strength / 9);
ww_mc.inner_mc._rotation = ww_mc.inner_mc._rotation - (strength / 14);
ww_mc.inner2_mc._rotation = ww_mc.inner2_mc._rotation - (strength / 8);
}
function getWind(px, py) {
var _local4 = px - x;
var _local3 = py - y;
var _local2 = Math.sqrt((_local4 * _local4) + (_local3 * _local3));
if (_local2 < 147) {
_local4 = _local4 / _local2;
_local3 = _local3 / _local2;
var _local7 = _local3;
var _local6 = -_local4;
var _local8 = _local2 / 11.5;
var _local5;
if (_local2 < 100) {
_local5 = 59 - ((_local8 * _local8) / 2);
} else {
_local5 = (390000 / (_local2 * _local2)) - 18;
}
_local5 = _local5 * (strength / 150);
_local7 = _local7 * _local5;
_local6 = _local6 * _local5;
} else {
var _local7 = 0;
var _local6 = 0;
}
var _local9 = {xw:_local7, yw:_local6};
return(_local9);
}
}
Symbol 229 MovieClip [__Packages.Display] Frame 0
class Display
{
var display_mc, newLevelInd_mc, score, level, i, incrNewLevel_itvl;
function Display (host, rightBound, vBound) {
display_mc = host.attachMovie("display", "display_mc", 1000);
setVis(false);
display_mc._x = Math.round(0.166 * rightBound);
display_mc._y = Math.round(0.0205 * vBound);
newLevelInd_mc = host.attachMovie("levelX", "levelX_mc", 1001);
newLevelInd_mc._vsible = false;
setNewLevelInd(1);
newLevelInd_mc._x = rightBound / 2;
newLevelInd_mc._y = vBound / 2;
score = display_mc.score_txt;
level = display_mc.level_txt;
}
function setNewLevelInd(num) {
newLevelInd_mc.levelNum.text = num;
newLevelInd_mc._alpha = 0;
newLevelInd_mc._xscale = 1;
newLevelInd_mc._yscale = 1;
}
function updateScore(num) {
score.text = num.toString();
}
function updateLevel(num) {
level.text = num.toString();
if (num > 1) {
newLevelInd(num);
}
}
function newLevelInd(num) {
i = 0;
setNewLevelInd(num);
newLevelInd_mc._visible = true;
incrNewLevel_itvl = setInterval(this, "incrNewLevel", 20);
}
function incrNewLevel() {
if (i <= 3.09159265358979) {
newLevelInd_mc._alpha = 80 * Math.sin(i);
newLevelInd_mc._xscale = newLevelInd_mc._xscale + 2;
newLevelInd_mc._yscale = newLevelInd_mc._yscale + 2;
i = i + 0.05;
} else {
clearInterval(incrNewLevel_itvl);
newLevelInd_mc._visible = false;
}
updateAfterEvent();
}
function setVis(vis) {
display_mc._visible = vis;
}
}
Symbol 230 MovieClip [__Packages.Sounds] Frame 0
class Sounds
{
var releaseCat, swoosh, boing, bump, bang, pop, boom, slash, ongoing;
function Sounds (host) {
var _local9 = host.createEmptyMovieClip("releaseCat_mc", 400);
releaseCat = new Sound(_local9);
releaseCat.attachSound("spring2.mp3");
releaseCat.setVolume(100);
var _local5 = host.createEmptyMovieClip("swoosh_mc", 401);
swoosh = new Sound(_local5);
swoosh.attachSound("ARROW.wav");
swoosh.setVolume(100);
var _local3 = host.createEmptyMovieClip("boing_mc", 402);
boing = new Sound(_local3);
boing.attachSound("boing5.wav");
boing.setVolume(100);
var _local10 = host.createEmptyMovieClip("bump_mc", 403);
bump = new Sound(_local10);
bump.attachSound("thud.wav");
var _local4 = host.createEmptyMovieClip("bang_mc", 404);
bang = new Sound(_local4);
bang.attachSound("explosion3.mp3");
bang.setVolume(80);
var _local8 = host.createEmptyMovieClip("pop_mc", 406);
pop = new Sound(_local8);
pop.attachSound("pop1.mp3");
pop.setVolume(7);
var _local7 = host.createEmptyMovieClip("boom_mc", 407);
boom = new Sound(_local7);
boom.attachSound("grenade.2wav.mp3");
boom.setVolume(15);
var _local6 = host.createEmptyMovieClip("slash_mc", 408);
slash = new Sound(_local6);
slash.attachSound("slash.wav");
slash.setVolume(40);
}
function playSound(soundID, vol) {
if (vol != undefined) {
this[soundID].setVolume(vol);
}
this[soundID].start();
}
function playContinuous(soundID) {
if (ongoing != soundID) {
ongoing = soundID;
this[soundID].start();
this[soundID].onSoundComplete = Proxy.create(this, playSound, soundID);
}
}
function stopSound(soundID) {
this[soundID].onSoundComplete = null;
this[soundID].stop();
}
}
Symbol 231 MovieClip [__Packages.Proxy] Frame 0
class Proxy
{
function Proxy () {
}
static function create(oTarget, fFunction) {
var aParameters = new Array();
var _local2 = 2;
while (_local2 < arguments.length) {
aParameters[_local2 - 2] = arguments[_local2];
_local2++;
}
var _local4 = function () {
var _local2 = arguments.concat(aParameters);
fFunction.apply(oTarget, _local2);
};
return(_local4);
}
}
Symbol 232 MovieClip [__Packages.Coin] Frame 0
class Coin
{
var coins_mc, x, y, ID, coin_mc, zoom_itvl, vis;
function Coin (coins, px, py, zoom) {
coins_mc = coins;
x = px;
y = py;
render(zoom);
}
function render(zoom) {
ID = coins_mc.getNextHighestDepth();
coin_mc = coins_mc.attachMovie("coin", ("coin" + ID) + "_mc", ID);
if (zoom) {
coin_mc._xscale = 0.5;
coin_mc._yscale = 0.5;
zoom_itvl = setInterval(this, "zoom", 40);
}
coin_mc._x = x;
coin_mc._y = y;
vis = true;
}
function zoom() {
coin_mc._xscale = coin_mc._xscale * 1.8;
coin_mc._yscale = coin_mc._yscale * 1.8;
if (coin_mc._xscale > 100) {
clearInterval(zoom_itvl);
coin_mc._xscale = 100;
coin_mc._yscale = 100;
}
}
function clearCoin() {
coin_mc.removeMovieClip();
}
function setVis(v) {
vis = v;
coin_mc.gotoAndPlay(2);
}
function hitCheck(px, py, vScroll) {
if (vis) {
if ((y + vScroll) < 0) {
setVis(false);
// unexpected jump
}
var _local2 = py - y;
if (Math.abs(py - y) < 22) {
var _local3 = px - x;
var _local4 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
if (_local4 < 22) {
setVis(false);
return(true);
}
return(false);
}
return(false);
}
return(false);
}
}
Symbol 233 MovieClip [__Packages.Fb] Frame 0
class Fb
{
var fb_mc, lb, rb, v, x, y, moveIt_itvl, vis;
function Fb (host, lBound, rBound, py, vx) {
var _local2 = host.getNextHighestDepth();
fb_mc = host.attachMovie("fb", ("fb" + _local2) + "_mc", _local2);
lb = lBound;
rb = rBound;
v = vx;
if (v > 0) {
x = lb;
} else {
x = rb;
}
y = py;
fb_mc._y = y;
setVis(true);
var _local3 = Math.round(23 * Math.random()) + 1;
fb_mc.gotoAndPlay(_local3);
}
function clearIt() {
clearInterval(moveIt_itvl);
fb_mc.removeMovieClip();
}
function setVis(v) {
vis = v;
fb_mc._visible = v;
}
function hitCheck(px, py, vScroll) {
if (vis) {
if ((y + vScroll) < 0) {
setVis(false);
// unexpected jump
}
x = x + v;
if (x > rb) {
x = lb;
}
if (x < lb) {
x = rb;
}
fb_mc._x = x;
var _local2 = py - y;
if (Math.abs(py - y) < 22) {
var _local3 = px - x;
var _local4 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
if (_local4 < 22) {
setVis(false);
return(true);
}
return(false);
}
return(false);
}
return(false);
}
}
Symbol 234 MovieClip [__Packages.XMLuser] Frame 0
interface XMLuser
{
}
Symbol 235 MovieClip [__Packages.LeaderBoard] Frame 0
class LeaderBoard implements XMLuser
{
var leaderBoard, loadingLB_mc, XMLobj, count, boxH, yPos, yInc, fieldCopyPurple, fieldCopyYellow, fieldCopyWhite, fieldCopyOrange, fields, XMLcontent;
function LeaderBoard (host) {
leaderBoard = host.createEmptyMovieClip("leaderBoard_mc", 99);
loadingLB_mc = host.attachMovie("loadingLB", "loadingLB_mc", 100);
loadingLB_mc._x = Stage.width / 2;
loadingLB_mc._y = Stage.height / 2;
XMLobj = new XML();
XMLobj.onLoad = mx.utils.Delegate.create(this, XMLreceived);
init();
}
function displayLoadingMsg() {
leaderBoard._visible = false;
loadingLB_mc._visible = true;
}
function XMLreceived() {
new XMLparser(XMLobj, this);
}
function init() {
count = 1;
boxH = 25;
yPos = 40;
yInc = 27;
fieldCopyPurple = new TextFormat();
fieldCopyPurple.align = "center";
fieldCopyPurple.bold = true;
fieldCopyPurple.font = "font01";
fieldCopyPurple.size = 30;
fieldCopyPurple.color = 13369497 /* 0xCC0099 */;
fieldCopyYellow = new TextFormat();
fieldCopyYellow.align = "center";
fieldCopyYellow.bold = true;
fieldCopyYellow.font = "font01";
fieldCopyYellow.size = 20;
fieldCopyYellow.color = 16777062 /* 0xFFFF66 */;
fieldCopyWhite = new TextFormat();
fieldCopyWhite.align = "center";
fieldCopyWhite.bold = true;
fieldCopyWhite.font = "font01";
fieldCopyWhite.size = 20;
fieldCopyWhite.color = 16777215 /* 0xFFFFFF */;
fieldCopyOrange = new TextFormat();
fieldCopyOrange.align = "center";
fieldCopyOrange.bold = true;
fieldCopyOrange.font = "font01";
fieldCopyOrange.size = 20;
fieldCopyOrange.color = 16737792 /* 0xFF6600 */;
fields = new Array(new Array("pos", 0, 30), new Array("player", 30, 120), new Array("score", 140, 65), new Array("date", 222, 80));
displayTable();
}
function displayTable() {
leaderBoard.createTextField("LBtitle", 100, 0, 0, 310, 30);
leaderBoard.LBtitle.text = "LEADERBOARD";
leaderBoard.LBtitle.embedFonts = true;
leaderBoard.LBtitle.setTextFormat(fieldCopyPurple);
var _local3 = 1;
while (_local3 <= 10) {
var _local2 = 0;
while (_local2 < fields.length) {
leaderBoard.createTextField(fields[_local2][0] + _local3, count, fields[_local2][1], yPos, fields[_local2][2], boxH);
leaderBoard[fields[_local2][0] + _local3].type = "dynamic";
leaderBoard[fields[_local2][0] + _local3].embedFonts = true;
count++;
_local2++;
}
yPos = yPos + yInc;
_local3++;
}
leaderBoard._x = (Stage.width / 2) - (leaderBoard._width / 2);
leaderBoard._y = ((Stage.height / 2) - (leaderBoard._height / 2)) - 10;
}
function XMLready(success, XMLcontentObj) {
if (success) {
XMLcontent = XMLcontentObj;
var _local2 = 1;
while (_local2 <= 10) {
leaderBoard["pos" + _local2].text = _local2;
leaderBoard["pos" + _local2].setTextFormat(fieldCopyOrange);
if (XMLcontent["entry" + _local2].player != undefined) {
leaderBoard["player" + _local2].text = XMLcontent["entry" + _local2].player;
}
leaderBoard["player" + _local2].setTextFormat(fieldCopyWhite);
if (XMLcontent["entry" + _local2].score != undefined) {
leaderBoard["score" + _local2].text = XMLcontent["entry" + _local2].score;
}
leaderBoard["score" + _local2].setTextFormat(fieldCopyWhite);
if (XMLcontent["entry" + _local2].date != undefined) {
leaderBoard["date" + _local2].text = XMLcontent["entry" + _local2].date;
}
leaderBoard["date" + _local2].setTextFormat(fieldCopyYellow);
_local2++;
}
loadingLB_mc._visible = false;
leaderBoard._visible = true;
} else {
trace("couldn't load XML");
}
}
}
Symbol 236 MovieClip [__Packages.XMLparser] Frame 0
class XMLparser
{
var XMLuserObj, XMLcontentObj, myXML;
function XMLparser (XMLObj, param_XMLuserObj) {
XMLuserObj = param_XMLuserObj;
XMLcontentObj = new Object();
myXML = XMLObj;
myXML.ignoreWhite = true;
parseXML();
}
function parseXML() {
var _local2 = myXML.firstChild;
for (var _local4 in _local2.childNodes) {
XMLcontentObj[_local2.childNodes[_local4].nodeName + _local2.childNodes[_local4].attributes.id] = new Object();
for (var _local3 in _local2.childNodes[_local4].childNodes) {
XMLcontentObj[_local2.childNodes[_local4].nodeName + _local2.childNodes[_local4].attributes.id][_local2.childNodes[_local4].childNodes[_local3].nodeName] = _local2.childNodes[_local4].childNodes[_local3].firstChild.nodeValue;
}
}
XMLuserObj.XMLready(true, XMLcontentObj);
}
function trimIt(str) {
while (((str.charCodeAt(0) == 9) || (str.charCodeAt(0) == 10)) || (str.charCodeAt(0) == 13)) {
str = str.substring(1, str.length);
}
while (((str.charCodeAt(str.length - 1) == 9) || (str.charCodeAt(str.length - 1) == 10)) || (str.charCodeAt(str.length - 1) == 13)) {
str = str.substring(0, str.length - 1);
}
return(str);
}
}