Frame 2
Frame 3
if (_framesloaded < _totalframes) {
gotoAndPlay(_currentframe - 1);
} else {
gotoAndStop ("checkURL");
}
Frame 11
var s = c.substring(2, 100);
var urlTest = Math.abs(int(s));
if (urlTest > 0) {
this.createEmptyMovieClip("mcGoToTotebo", this.getNextHighestDepth());
mcGoToTotebo.loadMovie("http://www.totebo.com/swf/gotototebo.swf");
getURL ("http://www.totebo.com/monkey-kick-off.php", "_top");
gotoAndStop ("goToTotebo");
} else {
gotoAndStop ("checkPlug");
}
Frame 22
stop();
Frame 36
mcCounter.hit();
var strPlayerVersion = System.capabilities.version;
strPlayerVersion = strPlayerVersion.split(",")[0];
var i = 0;
while (i < strPlayerVersion.length) {
if (strPlayerVersion.charAt(i) == " ") {
var intPlayerVersion = int(strPlayerVersion.slice(i + 1, strPlayerVersion.length));
break;
}
i++;
}
trace("intPlayerVersion: " + intPlayerVersion);
if (intPlayerVersion >= 8) {
gotoAndStop ("assets");
} else {
gotoAndStop ("wrongPlug");
}
Frame 65
function scramble(str) {
var _local6 = "pqrstuEFUBCV24WX90z.15IJKefgAD-cdvwx3GHRSTyYZabLMNOPQ678hjklmnoi";
var _local4 = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz|-";
var _local7 = new String();
var _local2 = 0;
while (_local2 < str.length) {
var _local1 = 0;
while (_local1 < _local4.length) {
if (str.charAt(_local2) == _local4.charAt(_local1)) {
var _local3 = _local6.charAt(_local1);
break;
}
_local1++;
}
_local7 = _local7 + _local3;
_local2++;
}
return(_local7);
}
function unScramble(str) {
var _local4 = "pqrstuEFUBCV24WX90z.15IJKefgAD-cdvwx3GHRSTyYZabLMNOPQ678hjklmnoi";
var _local6 = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz|-";
var _local7 = new String();
var _local2 = 0;
while (_local2 < str.length) {
var _local1 = 0;
while (_local1 < _local4.length) {
if (str.charAt(_local2) == _local4.charAt(_local1)) {
var _local3 = _local6.charAt(_local1);
break;
}
_local1++;
}
_local7 = _local7 + _local3;
_local2++;
}
return(_local7);
}
gotoAndStop ("game");
Frame 73
_root.playingGame = true;
_root.replay = false;
_root.localReplay = false;
mcStage.mcLevel.readChallenge();
mcPanel.mcShare.gotoAndStop(1);
stop();
Frame 81
function selectAll(txt) {
Selection.setFocus(txt);
Selection.setSelection(500, 0);
clearInterval(ivSelectAll);
}
function changeName() {
var _local1 = unScramble(challengeData);
var _local4 = _local1.indexOf(monkeyName);
var _local3 = _local1.split("|");
_local3[8] = txtName.text;
_local1 = _local3.join("|");
bestKickURLScrambled = scramble(_local1);
txtChallengeURL.text = challengeURL + bestKickURLScrambled;
var _local2 = SharedObject.getLocal("ToteboMonkeyKick");
_local2.data.challengeData = bestKickURLScrambled;
var monkeyName = txtName.text;
_local2.data.monkeyName = monkeyName;
trace("Saved personal best: " + _local1);
}
this.onMouseUp = function () {
if (((((_xmouse >= txtChallengeURL._x) && (_xmouse <= (txtChallengeURL._x + txtChallengeURL._width))) && (_ymouse >= txtChallengeURL._y)) && (_ymouse <= (txtChallengeURL._y + txtChallengeURL._height))) or selectAllNow) {
ivSelectAll = setInterval(selectAll, 50, txtChallengeURL);
}
selectAllNow = false;
};
this.onMouseDown = function () {
if ((((_xmouse >= txtChallengeURL._x) && (_xmouse <= (txtChallengeURL._x + txtChallengeURL._width))) && (_ymouse >= txtChallengeURL._y)) && (_ymouse <= (txtChallengeURL._y + txtChallengeURL._height))) {
selectAllNow = true;
}
};
_root.playingGame = false;
_root.replay = true;
txtName.text = monkeyName;
txtName.onChanged = function () {
changeName();
};
trace("monkeyName: " + monkeyName);
if (txtName.text == "Monkey") {
txtYourName.text = "Your Monkey name (change it!):";
} else {
txtYourName.text = "Your Monkey name:";
}
mcStage.mcLevel.restart();
changeName();
stop();
Frame 90
_root.playingGame = false;
txtChallenger.text = _root.challengerName + " has challenged you";
mcPanel.mcChallenge.gotoAndStop(2);
_root.replay = true;
_root.localReplay = false;
mcStage.mcLevel.readChallenge();
stop();
Frame 102
_root.playingGame = false;
var bestKickURL = unScramble(challengeData);
var arrBestKickURL = bestKickURL.split("|");
score = arrBestKickURL[7];
var soPersonalBest = SharedObject.getLocal("ToteboMonkeyKick");
soPersonalBest.data.canSave = false;
mcPanel.mcShare.gotoAndStop(1);
Frame 111
_root.playingGame = false;
mcPanel.mcShare.btnClear._visible = false;
mcPanel.mcShare.gotoAndStop(1);
stop();
Symbol 11 MovieClip Frame 1
stop();
Symbol 17 Button
on (rollOver) {
play();
}
on (rollOut, releaseOutside) {
gotoAndPlay ("out");
}
on (release) {
getURL ("http://www.totebo.com", "_blank");
}
Symbol 19 Button
on (rollOut, releaseOutside) {
play();
}
on (release) {
getURL ("http://www.totebo.com", "_blank");
}
Symbol 20 MovieClip Frame 1
stop();
Symbol 20 MovieClip Frame 7
stop();
Symbol 29 Button
on (press, release, dragOut) {
getURL ("http://www.totebo.com/monkey-kick-off.php", "_top");
getURL ("http://www.totebo.com/monkey-kick-off.php", "_blank");
}
Symbol 38 Button
on (release) {
getURL ("http://www.miniclip.com/games/en/requirements.php", "_blank");
}
Symbol 48 Button
on (release) {
_root.replay = true;
_root.localReplay = false;
_parent._parent.mcStage.mcLevel.readChallenge();
_parent._parent.gotoAndStop("challenge");
_parent.mcShare.gotoAndStop(1);
}
Symbol 57 Button
on (release) {
_parent._parent._parent.mcStage.mcLevel.restart();
}
Symbol 60 MovieClip Frame 1
stop();
Symbol 65 Button
on (release) {
_root.replay = false;
_parent._parent.mcStage.mcLevel.reset();
_parent._parent.gotoAndStop("game");
gotoAndStop (1);
}
Symbol 66 MovieClip Frame 1
stop();
Symbol 70 Button
on (release) {
_root.replay = true;
_root.localReplay = true;
_parent._parent.mcStage.mcLevel.readChallenge();
_parent._parent.gotoAndStop("share");
_parent.gotoAndStop("share");
_parent.mcChallenge.gotoAndStop(1);
gotoAndStop (2);
}
Symbol 75 Button
on (release) {
_parent._parent.gotoAndStop("clearScore");
}
Symbol 78 Button
on (release) {
_root.replay = false;
_parent._parent.mcStage.mcLevel.reset();
_parent._parent.gotoAndStop("game");
_root.challengerBest = 0;
gotoAndStop (1);
}
Symbol 79 MovieClip Frame 1
stop();
Symbol 80 MovieClip Frame 1
if (_parent.personalBest > 0) {
txtPersonalBest.text = _parent.personalBest;
}
stop();
Symbol 83 MovieClip [fps] Frame 1
function calcFPS() {
numFrames++;
var _local3 = getTimer();
var _local2 = (_local3 - startTime) / 1000;
var _local1 = Math.round(numFrames / _local2);
fpsField.text = _local1;
}
var startTime = getTimer();
var numFrames = 0;
this.onEnterFrame = calcFPS;
Symbol 89 MovieClip [mcBall] Frame 1
stop();
Symbol 110 MovieClip Frame 1
stop();
Symbol 110 MovieClip Frame 32
gotoAndStop ("idle");
Symbol 110 MovieClip Frame 53
gotoAndStop ("idle");
Symbol 110 MovieClip Frame 84
gotoAndStop ("idle");
Symbol 110 MovieClip Frame 136
gotoAndStop ("idle");
Symbol 110 MovieClip Frame 190
gotoAndStop ("idle");
Symbol 110 MovieClip Frame 223
gotoAndStop ("idle");
Symbol 110 MovieClip Frame 266
gotoAndStop ("idle");
Symbol 113 MovieClip Frame 1
if (!init) {
gotoAndPlay(random(_totalframes) + 1);
init = true;
}
Symbol 140 MovieClip [mcBgTile] Frame 1
var makakCounter = 0;
var i = 0;
while (i < 10) {
if (random(_totalframes * 5) > _currentframe) {
this["mcTinyMakak" + i]._visible = false;
makakCounter++;
}
i++;
}
stop();
Symbol 149 MovieClip Frame 1
stop();
Symbol 160 MovieClip Frame 2
stop();
Symbol 160 MovieClip Frame 8
stop();
Symbol 164 MovieClip Frame 4
stop();
Symbol 164 MovieClip Frame 8
stop();
Symbol 165 MovieClip Frame 1
mcEyes.gotoAndPlay("idle");
mcMouth.gotoAndPlay("idle");
Symbol 165 MovieClip Frame 2
stop();
Symbol 165 MovieClip Frame 5
mcEyes.gotoAndPlay("up");
mcMouth.gotoAndPlay("o");
Symbol 165 MovieClip Frame 6
stop();
Symbol 165 MovieClip Frame 11
mcEyes.gotoAndPlay("idle");
mcMouth.gotoAndPlay("idle");
Symbol 165 MovieClip Frame 12
stop();
Symbol 174 MovieClip Frame 1
stop();
Symbol 174 MovieClip Frame 11
gotoAndStop (1);
Symbol 188 MovieClip Frame 6
stop();
Symbol 189 MovieClip [mcMonkey] Frame 1
stop();
Symbol 189 MovieClip [mcMonkey] Frame 10
play();
Symbol 189 MovieClip [mcMonkey] Frame 23
_parent.beingKickedTheBall = false;
Symbol 189 MovieClip [mcMonkey] Frame 41
inKick = true;
gotoAndPlay ("inKick");
Symbol 189 MovieClip [mcMonkey] Frame 42
mcBody.play();
mcHead.play();
play();
Symbol 189 MovieClip [mcMonkey] Frame 44
if (inKick) {
inKick = false;
_parent.keepyUps();
}
Symbol 189 MovieClip [mcMonkey] Frame 52
stop();
Symbol 189 MovieClip [mcMonkey] Frame 62
stop();
Symbol 189 MovieClip [mcMonkey] Frame 81
_parent.kick();
Symbol 189 MovieClip [mcMonkey] Frame 86
gotoAndStop ("idle");
Symbol 214 MovieClip Frame 1
stop();
Symbol 215 MovieClip [mcBounceStuff] Frame 8
stop();
Symbol 234 MovieClip Frame 1
stop();
Symbol 235 MovieClip Frame 1
function restart() {
_parent._parent.mcPanel.mcShare.btnClear._visible = true;
this.attachMovie("mcMonkey", "mcMonkey", 7);
mcMonkey._width = 122;
mcMonkey._height = 168;
mcMonkey._x = 160;
mcMonkey._y = 380;
_parent.tileMoveCounter = 0;
_parent.mcLeveltempX = 0;
_parent.mcLeveltempY = 0;
_parent.bgTileToMove = 1;
this.attachMovie("mcBgTile", "mcBg1", 1);
this.attachMovie("mcBgTile", "mcBg2", 2);
this.attachMovie("mcBgTile", "mcBg3", 3);
mcBg1.cacheAsBitmap();
mcBg2.cacheAsBitmap();
mcBg3.cacheAsBitmap();
mcBg1._x = 0;
mcBg2._x = 640;
mcBg3._x = 1280;
mcBg1.gotoAndStop(1);
mcBg2.gotoAndStop(1);
mcBg3.gotoAndStop(1);
_parent.window.x = 0;
this.scrollRect = window;
groundLevel = mcMonkey._y + 40;
this.attachMovie("mcBall", "mcBall", 6);
mcBall._x = 700;
mcBall._y = groundLevel;
this.attachMovie("mcBallShadow", "mcBallShadow", 5);
mcBallShadow._y = mcBall._y;
if (!_root.replay) {
_parent.mcRerun._visible = false;
} else {
_parent.mcRerun._visible = true;
}
_parent.mcBg.gotoAndStop(1);
ballStill = true;
kicking = false;
preparing = true;
beingKickedTheBall = true;
rollSpeed = 60;
clickTracker = 0;
isRolling = false;
kickComplete = false;
groundFriction = 1.08;
_x = 0;
_y = 0;
this.attachMovie("mcInstructions", "mcInstructions", 4);
mcInstructions._x = mcMonkey._x;
mcInstructions._y = mcMonkey._y;
_parent._parent.mcPanel.mcChallenge.mcChallenger.gotoAndStop(1);
if ((int(_root.challengerBest) > 0) && (!_root.replay)) {
this.attachMovie("mcBall", "mcChallengerBall", 9);
trace(_root.challengerBest);
mcChallengerBall._x = int(_root.challengerBest * 10);
mcChallengerBall._y = groundLevel;
mcChallengerBall.gotoAndStop(2);
this.attachMovie("mcBallShadow", "mcChallengerBalllShadow", 8);
mcChallengerBallShadow._x = mcChallengerBall._x;
mcChallengerBallShadow._y = mcChallengerBall._y;
}
_parent.mcCurrentMonkeyMeters._visible = false;
_root.mcSoundHandler.restartSounds();
var _local4 = SharedObject.getLocal("ToteboMonkeyKick");
if (_local4.data.canSave == true) {
_parent._parent.mcHighscore.gotoAndStop(1);
} else {
_parent._parent.mcHighscore.gotoAndStop(2);
}
}
function getAngle(x1, y1, x2, y2) {
var _local1 = Math.atan2(y2 - y1, x2 - x1);
var _local2 = Math.round((_local1 * 180) / Math.PI);
return(-_local2);
}
function swingLeg() {
var swingAngle = kick(true);
this.createEmptyMovieClip("mcSwingLeg", getNextHighestDepth());
mcSwingLeg.onEnterFrame = function () {
var _local2 = swingAngle - mcMonkey.mcKickLeg._rotation;
var _local3 = _local2 / 8;
mcMonkey.mcKickLeg._rotation = mcMonkey.mcKickLeg._rotation + _local3;
if (Math.abs(_local2) < 2) {
this.removeMovieClip();
}
};
}
function changeBallTrajectory(x, y, angle, velocity) {
x = int(x);
y = int(y);
angle = int(angle);
velocity = int(velocity);
if ((!_root.replay) && (!preparing)) {
_root.frameCounter = 0;
var _local5 = {x:x, y:y, a:angle, v:velocity};
if (keepyUpping) {
_parent._parent.mcSoundHandler.sndKick.start(0, 0);
_parent._parent.mcSoundHandler.sndKick.setVolume(velocity);
arrKick[0] = _local5;
kickComplete = false;
_root.createEmptyMovieClip("mcFrameCounter", _root.getNextHighestDepth());
_root.mcFrameCounter.onEnterFrame = function () {
_root.frameCounterTemp = _root.frameCounter;
_root.frameCounter++;
};
} else if (!kickComplete) {
_root.mcSoundHandler.sndWind.start(0, 9999);
arrKick[1] = _local5;
arrKick[2] = _root.frameCounterTemp;
trace("Frames: " + arrKick[2]);
_root.mcFrameCounter.removeMovieClip();
kickComplete = true;
}
}
mcBall.speed = 10;
mcBall.startX = x;
mcBall.startY = y;
mcBall.angle1 = angle;
mcBall.vel1 = velocity;
mcBall.mytime = 0;
mcBall.h1 = 0;
mcBall.delta = 0.1;
mcBall.r1 = 0;
mcBall.angle1 = Math.min(90, mcBall.angle1);
mcBall.delta1 = ((velocity / 10) * mcBall.delta) * Math.cos((mcBall.angle1 * Math.PI) / 180);
mcBall.v1 = mcBall.vel1 * Math.sin((mcBall.angle1 * Math.PI) / 180);
ballStill = false;
}
function readChallenge() {
if (_root.localReplay) {
trace("Local replay.");
var _local4 = _parent._parent.unScramble(_parent._parent.challengeData);
} else {
trace("Challenge replay.");
var _local4 = _parent._parent.unScramble(_root.c);
}
var _local3 = _local4.split("|");
_root.frameToKickTheBall = int(_local3[0]);
_root.kick_y = _local3[1];
_root.kick_angle = _local3[2];
_root.kick_velocity = _local3[3];
_root.keep_y = _local3[4];
_root.keep_angle = _local3[5];
_root.keep_velocity = int(_local3[6]);
_root.challengerBest = _local3[7];
_root.challengerName = _local3[8];
var _local5 = (((((((int(_local3[0]) + int(_local3[1])) + int(_local3[2])) + int(_local3[3])) + int(_local3[4])) + int(_local3[5])) + int(_local3[6])) + int(_local3[7])) + int(_local3[8]);
if ((_local5 == int(_local3[9])) && (_local3[7] < 8425)) {
if (_root.localReplay) {
_parent._parent.mcPanel.mcShare._visible = true;
} else {
_parent._parent.mcPanel.mcChallenge._visible = true;
_parent._parent.mcPanel.mcChallenge.txtChallenger = ("Watch " + _root.challengerName) + "'s Best Kick";
_parent._parent.mcPanel.mcChallenge.txtPersonalBest.text = _root.challengerBest;
if ((!_root.hasSeenChallenge) && (_root.challengerBest > 0)) {
_root.localReplay = false;
_root.replay = true;
_root.hasSeenChallenge = true;
_root.gotoAndStop("challenge");
}
}
} else {
_parent._parent.mcPanel.mcChallenge._visible = false;
}
if (int(_root.challengerBest) == 0) {
_parent._parent.mcPanel.mcChallenge._visible = false;
}
}
function moveBall() {
var _local3 = int(mcBall._x / 10);
if (_root.replay) {
if (_root.frameCounter >= _root.frameToKickTheBall) {
_root.mcFrameCounter.removeMovieClip();
if (!kicking) {
kicking = true;
ballStill = false;
changeBallTrajectory(mcMonkey._x, _root.kick_y, _root.kick_angle, _root.kick_velocity);
mcMonkey.gotoAndStop("kick");
var _local9 = -kick(true);
mcMonkey.mcKickLeg.gotoAndStop(6);
mcMonkey.mcKickLeg._rotation = _local9;
}
}
_parent.mcCurrentMonkeyMeters._visible = false;
} else if ((_local3 > 20) && (int(_root.challengerBest) > 0)) {
if (_root.challengerBest > _local3) {
_parent._parent.mcPanel.mcChallenge.mcChallenger.gotoAndStop(2);
var _local6 = _root.challengerBest - _local3;
_parent._parent.mcPanel.mcChallenge.mcChallenger.txtChallenger.text = ((_root.challengerName + "'s Ball is ") + _local6) + "m ahead";
} else {
_parent._parent.mcPanel.mcChallenge.mcChallenger.gotoAndStop(3);
var _local8 = _local3 - _root.challengerBest;
_parent._parent.mcPanel.mcChallenge.mcChallenger.txtChallenger.text = ((("Passed " + _root.challengerName) + "'s Ball by ") + _local8) + "m!";
}
_parent.mcCurrentMonkeyMeters._visible = false;
} else if ((_local3 > 20) && (int(_root.challengerBest) == 0)) {
if (_local3 > int(_parent._parent.personalBest)) {
_parent.mcCurrentMonkeyMeters.gotoAndStop(2);
} else {
_parent.mcCurrentMonkeyMeters.gotoAndStop(1);
}
_parent.mcCurrentMonkeyMeters._visible = true;
_parent.mcCurrentMonkeyMeters.txtMeters.text = _local3 + " Monkey Meters";
}
vol = (mcBall._x - mcBallTempX) / 4;
_root.mcSoundHandler.sndWind.setVolume(vol);
var _local4 = mcBall.mytime;
var _local7 = (4.9 * _local4) * _local4;
var _local11 = mcBall.mytime;
var _local5 = 25 * mcBall.mytime;
mcBallTempX = mcBall._x;
mcBallTempY = mcBall._y;
mcBall._x = mcBall.startX + (_local5 * mcBall.delta1);
mcBall._y = mcBall.startY - (0.2 * ((mcBall.v1 * _local4) - _local7));
var _local10 = (mcBall._x - mcBallTempX) - ((mcBall._y - mcBallTempY) / 2);
mcBall._rotation = mcBall._rotation + _local10;
mcBall.mytime = mcBall.mytime + (mcBall.delta * mcBall.speed);
}
function keepyUps() {
preparing = false;
keepyUpping = true;
var _local4 = mcBall._y - mcBallTempY;
var _local5 = (mcBall._y + _local4) + 20;
if (mcBall._y > mcMonkey._y) {
var _local3 = random(68) + 48;
if (random(500) == 0) {
var _local2 = int(random(10));
trace("Randomized velocity again: " + _local2);
_local3 = _local3 + _local2;
}
if (_root.replay) {
changeBallTrajectory(mcMonkey._x, mcMonkey._y, _root.keep_angle, _root.keep_velocity);
_root.frameCounter = 2;
_root.createEmptyMovieClip("mcFrameCounter", _root.getNextHighestDepth());
_root.mcFrameCounter.onEnterFrame = function () {
_root.frameCounter++;
};
} else {
changeBallTrajectory(mcMonkey._x, mcMonkey._y, 90, _local3);
}
} else if ((_local5 > mcMonkey._y) && (!alreadyKicked)) {
alreadyKicked = true;
if (random(2)) {
mcMonkey.gotoAndPlay("keepy1");
} else {
mcMonkey.gotoAndPlay("keepy2");
}
} else if (mcBall._y < 360) {
alreadyKicked = false;
}
}
function kick(test) {
if (!test) {
trace("---");
}
var _local11 = mcMonkey._y - mcBall._y;
var _local4 = _local11;
var _local6 = mcBall._y - mcBallTempY;
var _local12 = groundLevel - mcBall._y;
var _local8 = _local12 / 2.3;
var _local3 = (_local6 * 35) + _local8;
if (_local4 < 0) {
trace("Corrected velocity (ground kick).");
_local3 = _local3 - (_local3 / 8);
}
if (_local3 <= 12) {
if (!test) {
trace("Corrected velocity (less than 12).");
}
_local3 = 100 + _local6;
}
if (_local4 > 65) {
if (!test) {
trace("Correncted velocity and angle (angle too steep).");
}
_local4 = random(20) + 60;
_local3 = 100 + _local6;
}
if (test) {
return(_local4);
}
if (!_root.replay) {
var _local7 = _local3 / 10;
var _local10 = int(random(_local7) / 2);
var _local9 = int((random(_local7) - (_local7 / 2)) / 6);
_local3 = _local3 + _local10;
_local4 = _local4 + _local9;
trace("Randomized velocity by: " + _local10);
trace("Randomized angle by: " + _local9);
}
if (!test) {
trace("Ball boost: " + _local8);
}
if (!test) {
trace("Kick velocity: " + _local3);
}
if (!test) {
trace("Kick angle: " + _local4);
}
_parent._parent.mcSoundHandler.sndKickOff.start(0, 0);
_parent._parent.mcSoundHandler.sndKickOff.setVolume(_local3 / 5);
mcMonkey.mcKickLeg._rotation = -_local4;
keepyUpping = false;
changeBallTrajectory(mcBall._x, mcBall._y, _local4, _local3, true);
}
function hitGroundCheck() {
if (mcBall._x == mcMonkey._x) {
if ((mcBall._y > groundLevel) && (mcBall.vel1 > 10)) {
var _local4 = mcBall.vel1 / 2;
mcBall._y = groundLevel;
changeBallTrajectory(mcMonkey._x, mcBall._y, 90, _local4);
} else if (mcBall.vel1 <= 10) {
trace("Missed kick. Restarting.");
ballStill = true;
quickKickUp = true;
restart();
}
} else if (mcBall._y > groundLevel) {
var _local4 = mcBall.vel1 / groundFriction;
if (_local4 > 7) {
var _local6 = Math.abs(getAngle(mcBallTempX, mcBallTempY, mcBall._x, mcBall._y));
mcBall._y = groundLevel;
var _local7 = mcBallTempX - mcBall._x;
var _local11 = _local7;
var _local12 = mcBallTempY - mcBall._y;
if ((_local6 < 5) or (_local4 < rollSpeed)) {
_local6 = 0;
}
if ((_local4 > 350) or (Math.abs(_local7) > 200)) {
this.attachMovie("mcBounceStuff", "mcBounceStuff", 11);
mcBounceStuff._x = mcBall._x;
mcBounceStuff._y = groundLevel + 20;
var _local8 = _local4 / 3;
mcBounceStuff._xscale = _local8;
mcBounceStuff._yscale = _local8;
mcBounceStuff.mc1.gotoAndStop(_root.surfaceFrame);
mcBounceStuff.mc2.gotoAndStop(_root.surfaceFrame);
mcBounceStuff.mc3.gotoAndStop(_root.surfaceFrame);
mcBounceStuff.mc4.gotoAndStop(_root.surfaceFrame);
}
changeBallTrajectory(mcBall._x - _local7, mcBall._y, _local6, _local4);
} else if (!ballStill) {
mcBall._y = groundLevel;
ballStill = true;
trace("Ball has stopped: " + mcBall._x);
trace("---");
_parent._parent.mcPanel.mcChallenge.mcChallenger.btnRetry._visible = false;
_parent.mcCurrentMonkeyMeters._visible = false;
_parent.monkeyMeters = int(mcBall._x / 10);
_parent.mcResult.gotoAndPlay(2);
_parent.mcResult.distance = _parent.monkeyMeters;
if (!_root.replay) {
if (_parent.monkeyMeters > 4000) {
_root.mcSoundHandler.sndVillageFanfare.start(0, 0);
} else if (_parent.monkeyMeters > 3000) {
_root.mcSoundHandler.sndMonkey4.start(0, 0);
} else if (_parent.monkeyMeters > 2000) {
_root.mcSoundHandler.sndMonkey3.start(0, 0);
} else if (_parent.monkeyMeters > 1000) {
_root.mcSoundHandler.sndMonkey2.start(0, 0);
} else if (_parent.monkeyMeters > 0) {
_root.mcSoundHandler.sndMonkey1.start(0, 0);
}
}
var _local5 = "move" + int((_parent.monkeyMeters / 1000) + 1);
mcBg1.mcMakak.gotoAndPlay(_local5);
mcBg2.mcMakak.gotoAndPlay(_local5);
mcBg3.mcMakak.gotoAndPlay(_local5);
if ((_parent._parent.personalBest < _parent.monkeyMeters) && (!_root.replay)) {
_parent._parent.mcStage.mcResult.mcNewPersonalBest.gotoAndStop(2);
var _local10 = SharedObject.getLocal("ToteboMonkeyKick");
_local10.data.canSave = true;
setBestKick();
}
}
if ((_local4 < rollSpeed) && (!isRolling)) {
trace("Ball is rolling.");
mcBall._y = groundLevel;
isRolling = true;
} else if (!isRolling) {
if (Math.abs(_local12) > 0) {
var _local9 = _local4 - Math.abs(_local11 * 3);
_root.mcSoundHandler.hitGround(_local9);
}
}
}
}
function setBestKick() {
_parent._parent.personalBest = _parent.monkeyMeters;
_parent._parent.mcPanel.txtPersonalBest.text = _parent._parent.personalBest;
var _local4 = SharedObject.getLocal("ToteboMonkeyKick");
_parent._parent.challengeData = "";
for (i in arrKick) {
if (i < 2) {
_parent._parent.challengeData = _parent._parent.challengeData + (((((arrKick[i].y + "|") + arrKick[i].a) + "|") + arrKick[i].v) + "|");
} else {
_parent._parent.challengeData = _parent._parent.challengeData + (arrKick[i] + "|");
}
}
_parent._parent.challengeData = _parent._parent.challengeData + (((_parent.monkeyMeters + "|") + _parent._parent.monkeyName) + "|");
var _local2 = _parent._parent.challengeData.split("|");
var _local5 = (((((((int(_local2[0]) + int(_local2[1])) + int(_local2[2])) + int(_local2[3])) + int(_local2[4])) + int(_local2[5])) + int(_local2[6])) + int(_local2[7])) + int(_local2[8]);
_parent._parent.challengeData = _parent._parent.challengeData + _local5;
var _local3 = _parent._parent.scramble(_parent._parent.challengeData);
trace("String to be saved and scrambled: " + _parent._parent.challengeData);
trace("String saved and scrambled: " + _local3);
_parent._parent.challengeData = _local3;
_local4.data.monkeyMeters = _parent._parent.personalBest;
_local4.data.monkeyName = _parent._parent.monkeyName;
_local4.data.challengeData = _local3;
_parent._parent.mcPanel.mcShare._visible = true;
}
if (_root.c.length > 0) {
readChallenge();
} else {
_parent._parent.mcPanel.mcChallenge._visible = false;
}
restart();
this.onMouseDown = function () {
var _local3 = ((((_parent._parent.mcPanel.mcChallenge.hitTest(_root._xmouse, _root._ymouse, true) && (_parent._parent.mcPanel.mcChallenge._visible)) or (_parent._parent.mcPanel.mcShare.hitTest(_root._xmouse, _root._ymouse, true) && (_parent._parent.mcPanel.mcShare._visible))) or _parent._parent.mcAToteboGame.hitTest(_root._xmouse, _root._ymouse, true)) or _parent._parent.mcSoundOnOrOff.hitTest(_root._xmouse, _root._ymouse, true)) or _parent._parent.mcHighscore.hitTest(_root._xmouse, _root._ymouse, true);
if (((!preparing) && (!_root.replay)) && (!_local3)) {
if (!kicking) {
kicking = true;
ballStill = false;
mcMonkey.gotoAndPlay("kick");
swingLeg();
}
}
};
var keyListener = new Object();
keyListener.onKeyDown = function () {
if ((!preparing) && (!_root.replay)) {
if (!kicking) {
kicking = true;
ballStill = false;
mcMonkey.gotoAndPlay("kick");
swingLeg();
}
}
};
Key.addListener(keyListener);
arrKick = new Array();
Symbol 242 MovieClip Frame 1
stop();
Symbol 242 MovieClip Frame 2
stop();
Instance of Symbol 174 MovieClip in Symbol 242 MovieClip Frame 2
onClipEvent (load) {
gotoAndStop (12);
}
Symbol 243 MovieClip Frame 1
stop();
Symbol 243 MovieClip Frame 2
txtDistance.text = distance;
Symbol 243 MovieClip Frame 81
_parent._parent.mcStage.mcLevel.restart();
Symbol 247 Button
on (release) {
_parent.mcLevel.restart();
}
Symbol 251 MovieClip Frame 1
stop();
Symbol 252 MovieClip Frame 1
function moveLevel() {
var _local4 = 320;
if (mcLevel.mcBall._x > _local4) {
var _local3 = -window.x;
var _local11 = (-mcLevel.mcBall._x) + _local4;
var _local6 = _local11 - _local3;
var _local7 = _local6 / 2;
var _local9 = _local3 + _local7;
mcLeveltempX = _local3;
window.x = -_local9;
mcLevel.scrollRect = window;
}
tileMoveCounter = tileMoveCounter + ((-window.x) - mcLeveltempX);
if (!_root.replay) {
var _local10 = mcLevel.mcBall._x / 10000;
_parent.mcSoundHandler.chooseBgSound(_local10);
}
if (tileMoveCounter <= -640) {
if (bgTileToMove > 3) {
bgTileToMove = 1;
}
var _local5 = int((window.x + 1920) / 10000) + 1;
_root.surfaceFrame = _local5;
mcLevel["mcBg" + bgTileToMove].gotoAndStop(_local5);
mcLevel["mcBg" + bgTileToMove]._x = mcLevel["mcBg" + bgTileToMove]._x + 1920;
bgTileToMove++;
tileMoveCounter = tileMoveCounter + 640;
}
var _local8 = int(window.x / 1000) + 1;
mcBg.gotoAndStop(_local8);
}
_parent.challengeURL = "http://totebo.com/mko.php?c=";
var soPersonalBest = SharedObject.getLocal("ToteboMonkeyKick");
if (int(soPersonalBest.data.monkeyMeters) > 0) {
trace("Valid cookie found for local challenge:");
_parent.personalBest = soPersonalBest.data.monkeyMeters;
_parent.monkeyName = soPersonalBest.data.monkeyName;
_parent.challengeData = soPersonalBest.data.challengeData;
trace(" Challenge data: " + _parent.unScramble(_parent.challengeData));
_parent.mcPanel.mcShare._visible = true;
} else {
trace("No valid cookie found for local challenge.");
_parent.personalBest = 0;
_parent.monkeyName = "Monkey";
_parent.challengeData = "";
_parent.mcPanel.mcShare._visible = false;
}
_parent.mcPanel.txtPersonalBest.text = _parent.personalBest;
createEmptyMovieClip("mcGameLoop", getNextHighestDepth());
mcGameLoop.onEnterFrame = function () {
if (!mcLevel.preparing) {
if (!mcLevel.ballStill) {
mcLevel.moveBall();
}
if (!mcLevel.kicking) {
mcLevel.keepyUps();
} else {
moveLevel();
mcLevel.hitGroundCheck();
}
} else if (mcLevel.beingKickedTheBall) {
var _local1 = (mcLevel.mcMonkey._x - mcLevel.mcBall._x) - 30;
var _local4 = _local1 / 5;
mcLevel.mcBall._x = mcLevel.mcBall._x + _local4;
mcLevel.mcBall._rotation = -_local1;
if ((_local1 > -500) && (_local1 < -450)) {
mcLevel.mcMonkey.gotoAndPlay("startKeepyUps");
}
}
var _local3 = mcLevel.getAngle(mcLevel.mcBall._x, mcLevel.mcBall._y, mcLevel.mcMonkey._x + mcLevel.mcMonkey.mcHead._x, mcLevel.mcMonkey._y + mcLevel.mcMonkey.mcHead._y);
_local3 = (-_local3) + 160;
mcLevel.mcMonkey.mcHead._rotation = _local3;
mcLevel.mcMonkey.mcHead._x = mcLevel.mcMonkey.mcBody._x;
mcLevel.mcMonkey.mcHead._y = mcLevel.mcMonkey.mcBody._y;
mcLevel.mcBallShadow._x = mcLevel.mcBall._x;
var _local2 = 60 + (mcLevel.mcBall._y / 10);
if (_local2 > 30) {
mcLevel.mcBallShadow._xscale = _local2;
mcLevel.mcBallShadow._alpha = _local2;
}
};
window = new flash.geom.Rectangle(0, 0, 640, 480);
stop();
Symbol 256 MovieClip Frame 1
function soundOff() {
sndGlobal.setVolume(0);
}
function soundOn() {
sndGlobal.setVolume(100);
}
function soundIsOn() {
var _local1;
if (sndGlobal.getVolume() == 0) {
_local1 = false;
} else {
_local1 = true;
}
return(_local1);
}
function chooseBgSound(soundLevel) {
if (int(soundLevel) == 0) {
location = "forest";
} else if (int(soundLevel) == 1) {
sndAtmosphereForest.stop("Atmosphere Forest.wav");
location = "desert";
} else if (int(soundLevel) == 2) {
sndAtmosphereDesert.stop("Atmosphere Desert.wav");
location = "space";
} else if (int(soundLevel) == 3) {
sndAtmosphereSpace.stop("Atmosphere Space.wav");
location = "jungle";
} else if (int(soundLevel) > 3) {
sndAtmosphereJungle.stop("Atmosphere Jungle.wav");
location = "village";
}
soundLevel = soundLevel + 0.5;
var _local4 = soundLevel - int(soundLevel);
var _local2 = int(_local4 * 100);
var _local3 = int(100 - (_local2 * 1.7));
if ((soundLevel > 1) && (soundLevel < 2)) {
if (!initForest) {
sndAtmosphereDesert.start(0, 9999);
sndAtmosphereDesert.setVolume(0);
initForest = true;
}
sndAtmosphereForest.setVolume(_local3);
sndAtmosphereDesert.setVolume(_local2);
sndAtmosphereForest.setPan(100 - _local3);
sndAtmosphereDesert.setPan(100 - _local2);
} else if ((soundLevel > 2) && (soundLevel < 3)) {
if (!initDesert) {
sndAtmosphereDesert.setVolume(100);
sndAtmosphereSpace.start(0, 9999);
sndAtmosphereSpace.setVolume(0);
initDesert = true;
}
sndAtmosphereDesert.setVolume(_local3);
sndAtmosphereSpace.setVolume(_local2);
sndAtmosphereDesert.setPan(100 - _local3);
sndAtmosphereSpace.setPan(100 - _local2);
} else if ((soundLevel > 3) && (soundLevel < 4)) {
if (!initSpace) {
sndAtmosphereSpace.setVolume(100);
sndAtmosphereJungle.start(0, 9999);
sndAtmosphereJungle.setVolume(0);
initSpace = true;
}
sndAtmosphereSpace.setVolume(_local3);
sndAtmosphereJungle.setVolume(_local2);
sndAtmosphereSpace.setPan(100 - _local3);
sndAtmosphereJungle.setPan(100 - _local2);
} else if ((soundLevel > 4) && (soundLevel < 5)) {
if (!initJungle) {
sndAtmosphereJungle.setVolume(100);
sndAtmosphereVillage.start(0, 9999);
sndAtmosphereVillage.setVolume(0);
initJungle = true;
}
sndAtmosphereJungle.setVolume(_local3);
sndAtmosphereVillage.setVolume(_local2);
sndAtmosphereJungle.setPan(100 - _local3);
sndAtmosphereVillage.setPan(100 - _local2);
} else if (soundLevel > 5) {
sndAtmosphereVillage.setVolume(100);
}
}
function restartSounds() {
initForest = false;
initDesert = false;
initSpace = false;
initJungle = false;
initVillage = false;
sndAtmosphereDesert.stop("Atmosphere Desert.wav");
sndAtmosphereJungle.stop("Atmosphere Jungle.wav");
sndAtmosphereSpace.stop("Atmosphere Space.wav");
sndAtmosphereVillage.stop("Atmosphere Village.wav");
sndWind.stop("Wind.wav");
trace(location);
if ((location != "forest") && (_root.playingGame)) {
trace("*** START SOUND ***");
sndAtmosphereForest.start(0, 9999);
}
sndAtmosphereForest.setVolume(100);
sndAtmosphereForest.setPan(0);
if (soundIsOn()) {
sndAtmosphereForest.setVolume(100);
}
}
function hitGround(vol) {
if (!_root.replay) {
if (location == "forest") {
sndBounceGrass.start(0, 0);
sndBounceGrass.setVolume(vol);
} else if (location == "desert") {
sndBounceDesert.start(0, 0);
sndBounceDesert.setVolume(vol);
} else if (location == "space") {
sndBounceConcrete.start(0, 0);
sndBounceConcrete.setVolume(vol);
} else if (location == "jungle") {
sndBounceGrass.start(0, 0);
sndBounceGrass.setVolume(vol);
} else if (location == "village") {
sndBounceDesert.start(0, 0);
sndBounceDesert.setVolume(vol);
}
}
}
var sndGlobal = new Sound();
sndGlobal.setVolume(100);
this.createEmptyMovieClip("mcSounds", this.getNextHighestDepth());
mcSounds.createEmptyMovieClip("mcSndForest", mcSounds.getNextHighestDepth());
var sndAtmosphereForest = new Sound(mcSounds.mcSndForest);
sndAtmosphereForest.attachSound("Atmosphere Forest.wav");
mcSounds.createEmptyMovieClip("mcSndDesert", mcSounds.getNextHighestDepth());
var sndAtmosphereDesert = new Sound(mcSounds.mcSndDesert);
sndAtmosphereDesert.attachSound("Atmosphere Desert.wav");
mcSounds.createEmptyMovieClip("mcSndSpace", mcSounds.getNextHighestDepth());
var sndAtmosphereSpace = new Sound(mcSounds.mcSndSpace);
sndAtmosphereSpace.attachSound("Atmosphere Space.wav");
mcSounds.createEmptyMovieClip("mcSndJungle", mcSounds.getNextHighestDepth());
var sndAtmosphereJungle = new Sound(mcSounds.mcSndJungle);
sndAtmosphereJungle.attachSound("Atmosphere Jungle.wav");
mcSounds.createEmptyMovieClip("mcSndVillage", mcSounds.getNextHighestDepth());
var sndAtmosphereVillage = new Sound(mcSounds.mcSndVillage);
sndAtmosphereVillage.attachSound("Atmosphere Village.wav");
mcSounds.createEmptyMovieClip("mcSndBounceConcrete", mcSounds.getNextHighestDepth());
var sndBounceConcrete = new Sound(mcSounds.mcSndBounceConcrete);
sndBounceConcrete.attachSound("Bounce Concrete.wav");
mcSounds.createEmptyMovieClip("mcSndBounceDesert", mcSounds.getNextHighestDepth());
var sndBounceDesert = new Sound(mcSounds.mcSndBounceDesert);
sndBounceDesert.attachSound("Bounce Desert.wav");
mcSounds.createEmptyMovieClip("mcSndBounceGrass", mcSounds.getNextHighestDepth());
var sndBounceGrass = new Sound(mcSounds.mcSndBounceGrass);
sndBounceGrass.attachSound("Bounce Grass.wav");
mcSounds.createEmptyMovieClip("mcSndKickOff", mcSounds.getNextHighestDepth());
var sndKickOff = new Sound(mcSounds.mcSndKickOff);
sndKickOff.attachSound("Kick Off.wav");
mcSounds.createEmptyMovieClip("mcSndKick", mcSounds.getNextHighestDepth());
var sndKick = new Sound(mcSounds.mcSndKick);
sndKick.attachSound("Kick.wav");
mcSounds.createEmptyMovieClip("sndMonkey1", mcSounds.getNextHighestDepth());
var sndMonkey1 = new Sound(mcSounds.sndMonkey1);
sndMonkey1.attachSound("sndMonkey1");
mcSounds.createEmptyMovieClip("sndMonkey2", mcSounds.getNextHighestDepth());
var sndMonkey2 = new Sound(mcSounds.sndMonkey2);
sndMonkey2.attachSound("sndMonkey2");
mcSounds.createEmptyMovieClip("sndMonkey3", mcSounds.getNextHighestDepth());
var sndMonkey3 = new Sound(mcSounds.sndMonkey3);
sndMonkey3.attachSound("sndMonkey3");
mcSounds.createEmptyMovieClip("sndMonkey4", mcSounds.getNextHighestDepth());
var sndMonkey4 = new Sound(mcSounds.sndMonkey4);
sndMonkey4.attachSound("sndMonkey4");
mcSounds.createEmptyMovieClip("mcSndVillageFanfare", mcSounds.getNextHighestDepth());
var sndVillageFanfare = new Sound(mcSounds.mcSndVillageFanfare);
sndVillageFanfare.attachSound("Village Fanfare.wav");
mcSounds.createEmptyMovieClip("mcSndWind", mcSounds.getNextHighestDepth());
var sndWind = new Sound(mcSounds.mcSndWind);
sndWind.attachSound("Wind.wav");
restartSounds();
stop();
Symbol 260 Button
on (release) {
_parent.mcSoundHandler.soundOff();
gotoAndStop (2);
}
Symbol 264 Button
on (release) {
_parent.mcSoundHandler.soundOn();
gotoAndStop (1);
}
Symbol 265 MovieClip Frame 1
stop();
Symbol 287 Button
on (release) {
var soPersonalBest = SharedObject.getLocal("ToteboMonkeyKick");
soPersonalBest.clear();
gotoAndStop ("game");
}
Symbol 293 Button
on (release) {
gotoAndStop ("game");
}