Frame 3
function startGame() {
_global.arena = this.attachClassMovie("Arena", game.Arena, "arena_mc", 5, [15, 40]);
}
function rankLoaded(rank) {
_global.arena.updateWorldRanking(rank);
}
function showPlayMoreGames() {
var _local2 = this.attachMovie("PlayMoreGamesBut", "playmore_but", 10);
_local2._x = 275;
_local2._y = 310;
_local2.onRollOver = function () {
this.gotoAndStop(2);
};
_local2.onRollOut = (_local2.onReleaseOutside = function () {
this.gotoAndStop(1);
});
_local2.onRelease = function () {
this.gotoAndStop(1);
getURL ("http://www.stupidfoxgames.com/", "_blank");
};
}
function deletePlayMoreGames() {
this.playmore_but.swapDepths(1);
this.playmore_but.removeMovieClip();
}
MovieClip.prototype.attachClassMovie = function (linkageID, className, instanceName, depth, argv) {
var _local2 = this.attachMovie(linkageID, instanceName, depth);
_local2.__proto__ = className.prototype;
className.apply(_local2, argv);
if (_local2.init) {
_local2.init();
}
return(_local2);
};
MovieClip.prototype.createEmptyClassMovieClip = function (className, instanceName, depth, argv) {
var _local2 = this.createEmptyMovieClip(instanceName, depth);
_local2.__proto__ = className.prototype;
className.apply(_local2, argv);
if (_local2.init) {
_local2.init();
}
return(_local2);
};
var projectName = "labyrinth";
var isPositive = true;
var defaultScore = 0;
_global.cgiPath = ("http://www.stupidfoxgames.com/cgi-bin/" + projectName) + "/";
_global.Math2 = new utils.Math2();
_global.mySO = new utils.CustomSharedObject(projectName);
_global.score = new utils.Score(_global.mySO.checkData("bestScore", true, 0), isPositive, defaultScore);
_global.worldRanking = new utils.WorldRanking(projectName, this, "rankLoaded");
startGame();
actListener = new Object();
actListener.onKeyUp = function () {
var _local1 = Key.getAscii();
};
Key.addListener(actListener);
stop();
Symbol 5 MovieClip [Player2] Frame 1
stop();
Symbol 5 MovieClip [Player2] Frame 2
stop();
Symbol 35 MovieClip Frame 1
stop();
Symbol 35 MovieClip Frame 21
gotoAndPlay ("start");
Symbol 41 MovieClip [Player] Frame 1
stop();
Symbol 41 MovieClip [Player] Frame 2
stop();
Symbol 51 MovieClip [Flag] Frame 1
stop();
Symbol 51 MovieClip [Flag] Frame 2
stop();
Symbol 51 MovieClip [Flag] Frame 17
this.removeMovieClip();
Symbol 76 MovieClip [ClickToStart] Frame 31
gotoAndPlay (1);
Symbol 76 MovieClip [ClickToStart] Frame 32
stop();
Symbol 90 MovieClip Frame 1
stop();
Symbol 90 MovieClip Frame 2
stop();
Symbol 90 MovieClip Frame 3
stop();
Symbol 90 MovieClip Frame 4
stop();
Symbol 93 MovieClip [Bonus] Frame 1
stop();
Symbol 93 MovieClip [Bonus] Frame 2
stop();
Symbol 93 MovieClip [Bonus] Frame 17
this.removeMovieClip();
Symbol 96 MovieClip [ScoreMsg] Frame 29
this.removeMovieClip();
Symbol 98 MovieClip [Message] Frame 42
this.removeMovieClip();
Symbol 101 MovieClip [PlayMoreGamesBut] Frame 1
stop();
Symbol 101 MovieClip [PlayMoreGamesBut] Frame 2
stop();
Symbol 104 MovieClip Frame 15
stop();
Symbol 143 MovieClip Frame 31
stop();
Symbol 150 MovieClip Frame 1
stop();
Symbol 150 MovieClip Frame 2
play();
Symbol 153 MovieClip Frame 1
function blink() {
eyeleft_mc.lid_mc.gotoAndPlay("blink");
eyeright_mc.lid_mc.gotoAndPlay("blink");
}
function initBlink() {
blink();
clearInterval(blinkInt);
blinkInt = setInterval(this, "blink", 4000);
}
function clearMe() {
clearInterval(blinkInt);
}
blinkInt = setInterval(this, "initBlink", 2000);
Symbol 154 MovieClip Frame 102
stop();
if (this._name == "mainlogo_mc") {
this._parent.startPreloader();
}
Symbol 162 MovieClip Frame 1
function triggerMe() {
this.gotoAndStop(2);
}
stop();
Symbol 162 MovieClip Frame 2
function triggerMe() {
}
var tween1 = (new mx.transitions.Tween(highlight_mc, "_alpha", mx.transitions.easing.None.easeIn, 100, 0, 2, true));
stop();
Symbol 165 MovieClip Frame 1
stop();
Symbol 165 MovieClip Frame 15
function fin() {
delete this.onEnterFrame;
bob = setInterval(this, "startGame", 1500);
}
this.onEnterFrame = function () {
var _local4 = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
this.preloader_mc.text_box.text = Math.ceil(_local4) + "%";
var _local5 = Math.floor(_local4 / 12.5);
var _local3 = 1;
while (_local3 <= Math.floor(_local4)) {
this.preloader_mc.shape_mc[("seg" + _local3) + "_mc"].triggerMe();
_local3++;
}
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
fin();
}
};
stop();
Symbol 166 MovieClip Frame 1
function startPreloader() {
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
playGame(false);
} else {
preloader_mc.gotoAndPlay("start");
}
}
function playGame(isStraightAway) {
clearInterval(bob);
if (isStraightAway) {
delete this.onEnterFrame;
this.onEnterFrame = function () {
this.mainlogo_mc._alpha = this.mainlogo_mc._alpha - 5;
this.shadow_mc._alpha = this.shadow_mc._alpha - 5;
this.preloader_mc._alpha = this.preloader_mc._alpha - 5;
this.bg_mc._alpha = this.bg_mc._alpha - 5;
if (this.mainlogo_mc._alpha <= 0) {
delete this.onEnterFrame;
mainlogo_mc.fox_mc.clearMe();
shadow_mc.fox_mc.clearMe();
_root.play();
}
};
} else {
bob = setInterval(this, "playGame", 3000, true);
}
}
this.onRelease = function () {
getURL ("http://www.stupidfoxgames.com/", "_blank");
};
_root.stop();
mask_mc.cacheAsBitmap = true;
shadow_mc.cacheAsBitmap = true;
shadow_mc.setMask(mask_mc);
Symbol 168 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 169 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 170 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 171 MovieClip [__Packages.mx.transitions.easing.None] Frame 0
class mx.transitions.easing.None
{
function None () {
}
static function easeNone(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeIn(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeInOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static var version = "1.1.0.52";
}
Symbol 172 MovieClip [__Packages.utils.Math2] Frame 0
class utils.Math2
{
function Math2 () {
}
function roundTo(num, dec, _type, isExactDecimals) {
num = num * Math.pow(10, dec);
num = Math[_type](num);
num = num / Math.pow(10, dec);
if (isExactDecimals) {
var _local2 = num.toString();
var _local6 = _local2.indexOf(".");
if ((_local6 == -1) && (dec > 0)) {
_local2 = _local2 + ".";
_local6 = 0;
}
var _local4 = _local2.slice(_local2.indexOf(".")).length - 1;
var _local1 = _local4;
while (_local1 < dec) {
_local2 = _local2 + "0";
_local1++;
}
return(_local2);
}
return(num);
}
function genRandomNum(lowerB, higherB) {
return(Math.floor(Math.random() * (higherB - lowerB)) + lowerB);
}
function encryptScore(ascore) {
if (ascore == undefined) {
ascore = 0;
}
var _local2 = "";
ascore = (ascore * 1000000) + 9876543210;
_local2 = ascore.toString();
var _local3 = 0;
var _local1 = 1;
while (_local1 <= _local2.length) {
_local3 = (_local3 + _local1) + int(_local2.charAt(_local1 - 1));
_local1++;
}
var _local5 = _local3.toString();
return((_local5.length.toString() + _local2) + _local5);
}
function formatTime(ms) {
var _local3 = ms % 1000;
var _local2 = Math.floor(ms / 1000);
var _local1 = _local2 % 60;
if (_local1 < 10) {
_local1 = "0" + _local1;
}
var _local4 = Math.floor(_local2 / 60);
return((((_local4 + ":") + _local1) + ":") + _local3);
}
function getMedal(time, topTime, isStr, isSolo) {
if (time == undefined) {
return((isStr ? "error" : 1));
}
time = parseFloat(time);
topTime = parseFloat(topTime);
if (topTime == 0) {
return((isStr ? "soloGold" : 6));
}
if (time == topTime) {
if (isSolo == "1") {
return((isStr ? "soloGold" : 6));
}
return((isStr ? "gold" : 5));
}
var _local5 = roundTo(topTime + (topTime / 20), 1, "round");
var _local6 = roundTo(topTime + (topTime / 10), 1, "round");
if (time <= _local5) {
return((isStr ? "silver" : 4));
}
if (time <= _local6) {
return((isStr ? "bronze" : 3));
}
return((isStr ? "none" : 2));
}
function encodeTime(num) {
var _local3 = "";
var _local5 = String(num).split("");
var _local6 = [4, 5, 2, 6, 2, 3];
var _local1 = 0;
while (_local1 < _local5.length) {
var _local2 = 0;
while (_local2 < _local6[_local1]) {
if (((_local2 % 2) == 0) || (_local5[_local1] == ".")) {
_local3 = _local3 + Math.floor(Math.random() * 10);
} else {
_local3 = _local3 + _local6[_local1];
}
_local2++;
}
if (_local5[_local1] != ".") {
var _local4 = Number(_local5[_local1]) + 4;
if (_local4 >= 10) {
_local4 = _local4 - 10;
}
_local3 = _local3 + _local4;
} else {
_local3 = _local3 + ".";
}
_local1++;
}
var _local7 = _local3.slice(0, 7);
_local3 = _local3.slice(7, _local3.length);
return((_local3 + _local7) + _local5.length);
}
}
Symbol 173 MovieClip [__Packages.utils.WorldRanking] Frame 0
class utils.WorldRanking
{
var funcRef, returnFunc;
function WorldRanking (projectName, funcRefP, returnFuncP) {
fileTitle = (projectName + "/") + fileTitle;
if (_global.score.bestScore != _global.score.defaultScore) {
retrieveRanking(_global.score.bestScore, funcRefP, returnFuncP);
}
}
function retrieveRanking(newScore, funcRefP, returnFuncP) {
funcRef = funcRefP;
returnFunc = returnFuncP;
var _local2 = new utils.LoadVars2(this, "getrank.cgi", {score:newScore}, "retrieveSuccess", "retrieveFailed");
}
function retrieveSuccess(ref) {
currentStatus = "loaded";
ranking = parseInt(ref.ranking);
if (returnFunc != undefined) {
funcRef[returnFunc](ranking);
}
}
function retrieveFailed() {
currentStatus = "error";
if (returnFunc != undefined) {
funcRef[returnFunc]("error");
}
}
var ranking = "-";
var currentStatus = "loading";
}
Symbol 174 MovieClip [__Packages.utils.LoadVars2] Frame 0
class utils.LoadVars2 extends LoadVars
{
var ref, returnSuccessFunc, returnErrorFunc, rnd, sendAndLoad, result;
function LoadVars2 (refP, cgiScr, args, returnSuccessFuncP, returnErrorFuncP, isDebug) {
super();
ref = refP;
returnSuccessFunc = returnSuccessFuncP;
returnErrorFunc = returnErrorFuncP;
var _local5 = "?";
for (var _local6 in args) {
this[_local6] = args[_local6];
_local5 = _local5 + (((_local6 + "=") + args[_local6]) + "&");
}
rnd = _global.Math2.genRandomNum(1, 9999999);
_local5 = _local5 + ("rnd=" + rnd);
if (cgiScr.slice(-3) == "php") {
var _local7 = _global.phpPath;
} else {
var _local7 = _global.cgiPath;
}
if (isDebug) {
getURL ((_local7 + cgiScr) + _local5, "_blank");
}
sendAndLoad(_local7 + cgiScr, this, "POST");
}
function onLoad(success) {
if (success && (result == "success")) {
ref[returnSuccessFunc](this);
} else {
ref[returnErrorFunc](this);
}
}
}
Symbol 175 MovieClip [__Packages.utils.CustomSharedObject] Frame 0
class utils.CustomSharedObject extends SharedObject
{
var ID, so, data;
function CustomSharedObject (nameP) {
super();
ID = nameP;
so = SharedObject.getLocal(ID);
data = so.data;
}
function checkData(propertyName, isSetting, defaultValue) {
if (so.data[propertyName] != undefined) {
return(so.data[propertyName]);
}
if (isSetting) {
so.data[propertyName] = defaultValue;
}
return(defaultValue);
}
function updateData(obj) {
for (var _local3 in obj) {
so.data[_local3] = obj[_local3];
}
so.flush();
data = so.data;
}
function deleteData(obj) {
for (var _local3 in obj) {
delete so.data[_local3];
}
so.flush();
data = so.data;
}
function clear() {
so.clear();
so.flush();
data = so.data;
}
}
Symbol 176 MovieClip [__Packages.game.Arena] Frame 0
class game.Arena extends MovieClip
{
var _x, _y, level, attachClassMovie, score, timer, line, createEmptyMovieClip, line2, holes, flags, bonuses, mask_mc, useHandCursor, math2, attachMovie, onRelease, click_mc, gameover_mc, _parent, flag, player, bonusNum1, holeAppearInt, playershad, _xmouse, _ymouse, label_dir, countdown, bonusNum2, levelcomp_mc, bestscore_mc;
function Arena (sX, sY) {
super();
_x = sX;
_y = sY;
level = attachClassMovie("Level", tcc.Level, "level_mc", 610, [-3, 374]);
score = attachClassMovie("Score", tcc.Score, "score_mc", 615, [-3, 354]);
timer = attachClassMovie("Timer", tcc.Timer, "timer_mc", 620, [-4, 327]);
line = createEmptyMovieClip("line_mc", 400);
line2 = createEmptyMovieClip("line2_mc", 401);
holes = createEmptyMovieClip("holes_mc", 105);
flags = createEmptyMovieClip("flags_mc", 200);
bonuses = createEmptyMovieClip("flags_mc", 205);
mask_mc._visible = false;
useHandCursor = false;
math2 = new utils.Math2();
var _local4 = attachMovie("HowToPlay", "click_mc", 500);
_local4._x = aWidth / 2;
_local4._y = aHeight / 2;
onRelease = function () {
this.initGame();
};
drawPlayer();
updateBestScore(_global.score.bestScore);
updateWorldRanking(_global.worldRanking.ranking);
}
function initGame() {
delete onRelease;
click_mc.removeMovieClip();
drawHoles();
}
function restartGame() {
isGameOver = false;
level.reset();
score.reset();
resetPlayer();
clearBonuses();
gameover_mc.removeMovieClip();
_parent.deletePlayMoreGames();
drawHoles();
}
function drawHoles() {
flag.shad.removeMovieClip();
flag.removeMovieClip();
var _local5 = 0;
while (_local5 < holesList.length) {
holes[("hole" + _local5) + "_mc"].removeMovieClip();
_local5++;
}
holesList = [];
var _local17 = level.startingHoles + (level.currentLevel * level.holesPerLevel);
var _local15 = player._x;
var _local14 = player._y;
var _local16 = player.dia / 2;
_local5 = 0;
while (_local5 < _local17) {
var _local11 = holes.attachMovie("Hole", ("hole" + _local5) + "_mc", holeStartDepth + _local5);
_local11.id = _local5;
var _local3 = math2.genRandomNum(minHoleWidth, maxHoleWidth);
var _local4 = false;
var _local13 = 0;
do {
_local13++;
var _local8 = math2.genRandomNum(_local3, aWidth - _local3);
var _local7 = math2.genRandomNum(_local3, aHeight - _local3);
var _local6 = false;
var _local2 = -1;
while ((!_local6) && (_local2 < (_local5 - 1))) {
_local2++;
var _local9 = holesList[_local2][0] - _local8;
var _local10 = holesList[_local2][1] - _local7;
var _local12 = Math.sqrt((_local9 * _local9) + (_local10 * _local10));
if (_local12 < ((_local3 / 2) + (holesList[_local2][2] / 2))) {
_local6 = true;
_local4 = false;
} else {
_local4 = true;
}
}
var _local9 = _local15 - _local8;
var _local10 = _local14 - _local7;
var _local12 = Math.sqrt((_local9 * _local9) + (_local10 * _local10));
if (_local12 < ((_local3 / 2) + _local16)) {
_local6 = true;
_local4 = false;
}
} while ((!_local4) && (_local5 != 0));
holesList.push([_local8, _local7, _local3]);
_local11._x = _local8;
_local11._y = _local7;
_local11._width = 0;
_local11._height = 0;
_local5++;
}
var _local18 = bonusNumList.slice();
var _local19 = math2.genRandomNum(0, _local18.length);
bonusNum1 = _local18[_local19];
startAppearHoles();
}
function startAppearHoles() {
holeAppearNum = 0;
holeAppearInt = setInterval(this, "appearHole", 40);
}
function appearHole() {
if (holeAppearNum < holesList.length) {
var _local2 = holes[("hole" + holeAppearNum) + "_mc"];
this["tween" + holeAppearNum] = new mx.transitions.Tween(_local2, "_width", mx.transitions.easing.Elastic.easeOut, 0, holesList[holeAppearNum][2], 0.5, true);
this["tween2" + holeAppearNum] = new mx.transitions.Tween(_local2, "_height", mx.transitions.easing.Elastic.easeOut, 0, holesList[holeAppearNum][2], 0.5, true);
holeAppearNum++;
} else {
clearInterval(holeAppearInt);
holeAppearInt = setInterval(this, "prepareGame", 300);
}
}
function prepareGame() {
holes.cacheAsBitmap = true;
clearInterval(holeAppearInt);
flagNum = 1;
drawFlag();
timer.reset();
var _local2 = attachMovie("ClickToStart", "click_mc", 500);
if (level.currentLevel != 1) {
_local2.gotoAndStop("end");
}
_local2.level_box.text = "level " + level.currentLevel;
_local2._x = aWidth / 2;
_local2._y = (aHeight / 2) + 50;
_local2._alpha = 0;
var _local3 = new mx.transitions.Tween(_local2, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, 0.5, true);
onRelease = function () {
this.startGame(true);
};
}
function startGame(isNewLevel) {
delete onRelease;
isLevelComplete = false;
click_mc.removeMovieClip();
if (isNewLevel) {
timer.start();
}
pInt = setInterval(this, "movePlayer", 30);
}
function drawPlayer() {
player.removeMovieClip();
player = attachMovie("Player", "player_mc", 150);
player.hitArea = player.hit_mc;
player._x = aWidth / 2;
player._y = aHeight / 2;
player.dia = 24;
playershad = attachMovie("Player", "playershad_mc", 148);
playershad._x = aWidth / 2;
playershad._y = aHeight / 2;
playershad.gotoAndStop(2);
playershad.setMask(mask_mc);
drawPlayerShadow();
}
function movePlayer() {
var _local7 = Math.round(_xmouse - (aWidth / 2)) / sensV;
var _local6 = Math.round(_ymouse - (aHeight / 2)) / sensV;
var _local12 = (label_dir = -Math.atan2(_local7, _local6));
player._x = player._x - _local7;
player._y = player._y - _local6;
var _local11 = player._x;
var _local10 = player._y;
var _local2 = player.dia / 2;
if (player.isInvincible) {
player.invincCount++;
if (player.invincCount >= invincCountMax) {
player.isInvincible = false;
player.main_mc.invinc_mc.gotoAndStop(1);
}
} else {
for (var _local3 in holesList) {
var _local4 = player._x - holesList[_local3][0];
var _local5 = player._y - holesList[_local3][1];
var _local8 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
var _local9 = _local8 - ((holesList[_local3][2] / 2) + _local2);
if (_local9 < -10) {
suckHoleID = _local3;
startSuckPlayer();
break;
}
if (_local9 < 5) {
}
}
}
for (var _local3 in bonusList) {
var _local4 = player._x - bonusList[_local3][0];
var _local5 = player._y - bonusList[_local3][1];
var _local8 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
var _local9 = _local8 - ((bonusList[_local3][2] / 2) + _local2);
if (_local9 < 0) {
getBonus(_local3);
break;
}
if (_local9 < 5) {
}
}
if (player._x < (_local2 + 3)) {
player._x = _local2 + 3;
} else if (player._x > ((aWidth - _local2) - 3)) {
player._x = (aWidth - _local2) - 3;
}
if (player._y < (_local2 + 3)) {
player._y = _local2 + 3;
} else if (player._y > ((aHeight - _local2) - 3)) {
player._y = (aHeight - _local2) - 3;
}
drawPlayerShadow();
var _local4 = player._x - flag._x;
var _local5 = player._y - flag._y;
var _local8 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
var _local9 = _local8 - ((flag.dia / 2) + _local2);
if (_local9 < 0) {
getFlag();
}
}
function drawPlayerShadow() {
var _local2 = player._x - (aWidth / 2);
var _local3 = player._y - (aHeight / 2);
var _local4 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
player.main_mc.spot_mc._x = -18 - (_local2 / 60);
player.main_mc.spot_mc._y = -18 - (_local3 / 60);
playershad._x = player._x + (_local2 / 60);
playershad._y = player._y + (_local3 / 60);
playershad._xscale = 100 + (Math.abs(_local2) / 10);
playershad._yscale = 100 + (Math.abs(_local3) / 10);
playershad.main_mc._xscale = (playershad.main_mc._yscale = 100 - _local4);
}
function startSuckPlayer() {
clearInterval(pInt);
var _local5 = new mx.transitions.Tween(player, "_x", mx.transitions.easing.Regular.easeInOut, player._x, holesList[suckHoleID][0], suckLen, true);
var _local4 = new mx.transitions.Tween(player, "_y", mx.transitions.easing.Regular.easeInOut, player._y, holesList[suckHoleID][1], suckLen, true);
var _local3 = new mx.transitions.Tween(player, "_xscale", mx.transitions.easing.Regular.easeInOut, 100, 0, suckLen, true);
var _local2 = new mx.transitions.Tween(player, "_yscale", mx.transitions.easing.Regular.easeInOut, 100, 0, suckLen, true);
var _local6 = new mx.transitions.Tween(player, "_alpha", mx.transitions.easing.Regular.easeInOut, 100, 0, suckLen, true);
playershad._alpha = 0;
_local2.ref = this;
_local2.onMotionFinished = function () {
this.ref.startResetPlayer(3);
};
}
function startResetPlayer(num) {
clearInterval(pInt);
countdown = attachMovie("Countdown", "countdown_mc", 450);
countdown.num_box.text = num;
countdown._x = aWidth / 2;
countdown._y = aHeight / 2;
var _local3 = new mx.transitions.Tween(countdown, "_xscale", mx.transitions.easing.None.easeIn, 100, 20, 1, true);
var _local2 = new mx.transitions.Tween(countdown, "_yscale", mx.transitions.easing.None.easeIn, 100, 20, 1, true);
_local2.ref = this;
_local2.num = num;
_local2.onMotionFinished = function () {
if (this.num == 1) {
this.ref.resetPlayer();
} else {
this.ref.startResetPlayer(this.num - 1);
}
};
}
function resetPlayer() {
if (!isGameOver) {
countdown.removeMovieClip();
player.isInvincible = false;
player.invincCount = 0;
player.main_mc.invinc_mc.gotoAndStop(1);
player._alpha = 100;
player._xscale = 100;
player._yscale = 100;
player._x = aWidth / 2;
player._y = aHeight / 2;
playershad._alpha = 100;
drawPlayerShadow();
onRelease = function () {
this.startGame();
};
}
}
function drawFlag() {
var _local8 = flags.attachMovie("Flag", "flags_mc", flags.getNextHighestDepth());
flag = flags.attachMovie("Flag", "flag_mc", flags.getNextHighestDepth());
flag.num_box.text = flagNum;
flag.shad = _local8;
flag.hitArea = flag.main_mc;
flag.dia = 20;
do {
var _local7 = math2.genRandomNum(flag._width / 2, aWidth - (flag._width / 2));
var _local6 = math2.genRandomNum(flag._height / 2, aHeight - (flag._height / 2));
flag._x = _local7;
flag._y = _local6;
var _local3 = false;
var _local2 = -1;
var _local4 = holesList.length;
while ((!_local3) && (_local2 < _local4)) {
_local2++;
var _local9 = holesList[_local2][0] - flag._x;
var _local10 = holesList[_local2][1] - flag._y;
var _local11 = Math.sqrt((_local9 * _local9) + (_local10 * _local10));
var _local5 = _local11 - ((flag.dia / 2) + (holesList[_local2][2] / 2));
if (_local5 < 0) {
_local3 = true;
isCheckCol = false;
} else {
isCheckCol = true;
}
}
var _local9 = player._x - flag._x;
var _local10 = player._y - flag._y;
var _local11 = Math.sqrt((_local9 * _local9) + (_local10 * _local10));
var _local5 = _local11 - ((flag.dia / 2) + (player.dia / 2));
if (_local5 < 0) {
_local3 = true;
isCheckCol = false;
}
} while (!isCheckCol);
_local8.gotoAndStop(2);
_local9 = flag._x - (aWidth / 2);
_local10 = flag._y - (aHeight / 2);
_local11 = Math.sqrt((_local9 * _local9) + (_local10 * _local10));
_local8.spot_mc._x = -13 - (_local9 / 80);
_local8.spot_mc._y = -13 - (_local10 / 80);
_local8._x = flag._x + (_local9 / 80);
_local8._y = flag._y + (_local10 / 80);
_local8._xscale = 100 + (Math.abs(_local9) / 10);
_local8._yscale = 100 + (Math.abs(_local10) / 10);
ref.setMask(mask_mc);
}
function getFlag() {
flag.shad.removeMovieClip();
flag.gotoAndPlay("explode");
if ((flagNum == bonusNum1) || (flagNum == bonusNum2)) {
drawBonus();
}
showScoreMsg(level.currentLevel * score.scorePerFlag, flag._x, flag._y);
score.addScore(level.currentLevel * score.scorePerFlag);
timer.inc(1000);
if (flagNum < 10) {
flagNum++;
drawFlag();
} else {
completeLevel();
}
}
function completeLevel() {
isLevelComplete = true;
timer.stop();
var _local4 = (_global.Math2.roundTo(timer.currentTime, -3, "round") / 10) * level.currentLevel;
score.addScore(_local4);
var _local3 = attachMovie("LevelComplete", "levelcomp_mc", 705);
_local3._x = aWidth / 2;
_local3._y = aHeight / 2;
_local3._alpha = 0;
_local3.score_box.text = _local4;
_local3.totscore_box.text = score.currentScore;
var _local5 = new mx.transitions.Tween(_local3, "_alpha", mx.transitions.easing.None.easeIn, 0, 100, 0.5, true);
clearInterval(pInt);
onRelease = function () {
this.nextLevel();
};
}
function nextLevel() {
levelcomp_mc.removeMovieClip();
level.increment();
delete onRelease;
resetPlayer();
drawHoles();
clearBonuses();
onRelease = function () {
this.startGame(true);
};
}
function doGameOver() {
isGameOver = true;
timer.stop();
countdown.removeMovieClip();
var _local3 = attachMovie("GameOver", "gameover_mc", 710);
_local3._x = aWidth / 2;
_local3._y = aHeight / 2;
_local3._alpha = 0;
_parent.showPlayMoreGames();
_local3.score_box.text = score.currentScore;
_local3.rank_box.text = "...";
_global.score.updateScore(score.currentScore);
_local3.best_box.text = _global.score.bestScore;
var _local4 = new mx.transitions.Tween(_local3, "_alpha", mx.transitions.easing.None.easeIn, 0, 100, 0.5, true);
clearInterval(pInt);
onRelease = function () {
this.restartGame();
};
}
function updateBestScore(newScore) {
bestscore_mc.best_box.filters = [];
bestscore_mc.best_box.autoSize = "right";
bestscore_mc.best_box.text = newScore;
bestscore_mc.best_mc._x = bestscore_mc.best_box._x - bestscore_mc.best_mc._width;
var _local2 = new flash.filters.GlowFilter(51, 1, 5, 5, 1, 3, false, false);
bestscore_mc.best_box.filters = [_local2];
}
function updateWorldRanking(newRank) {
gameover_mc.rank_box.text = newRank;
bestscore_mc.rank_box.filters = [];
bestscore_mc.rank_box.autoSize = "right";
bestscore_mc.rank_box.text = newRank;
bestscore_mc.rank_mc._x = bestscore_mc.rank_box._x - bestscore_mc.rank_mc._width;
var _local2 = new flash.filters.GlowFilter(51, 1, 5, 5, 1, 3, false, false);
bestscore_mc.rank_box.filters = [_local2];
}
function drawBonus() {
var _local9 = bonuses.attachMovie("Bonus", "bonuss_mc", bonuses.getNextHighestDepth());
bonus = bonuses.attachMovie("Bonus", "bonus_mc", bonuses.getNextHighestDepth());
bonus.num_box.text = flagNum;
bonus.shad = _local9;
bonus.hitArea = bonus.main_mc;
bonus.dia = 20;
do {
var _local7 = math2.genRandomNum(bonus._width / 2, aWidth - (bonus._width / 2));
var _local6 = math2.genRandomNum(bonus._height / 2, aHeight - (bonus._height / 2));
bonus._x = _local7;
bonus._y = _local6;
var _local5 = math2.genRandomNum(0, bonusColList.length);
bonus.id = _local5;
bonus.col = bonusColList[_local5];
bonus.spot_mc.ball_mc.gotoAndStop(bonus.col);
var _local3 = false;
var _local2 = -1;
var _local4 = holesList.length;
while ((!_local3) && (_local2 < _local4)) {
_local2++;
var _local10 = holesList[_local2][0] - bonus._x;
var _local11 = holesList[_local2][1] - bonus._y;
var _local12 = Math.sqrt((_local10 * _local10) + (_local11 * _local11));
var _local8 = _local12 - ((bonus.dia / 2) + (holesList[_local2][2] / 2));
if (_local8 < 0) {
_local3 = true;
isCheckCol = false;
} else {
isCheckCol = true;
}
}
_local2 = -1;
_local4 = bonusList.length;
while ((!_local3) && (_local2 < _local4)) {
_local2++;
var _local10 = bonusList[_local2][0] - bonus._x;
var _local11 = bonusList[_local2][1] - bonus._y;
var _local12 = Math.sqrt((_local10 * _local10) + (_local11 * _local11));
var _local8 = _local12 - ((bonus.dia / 2) + (bonusList[_local2][2] / 2));
if (_local8 < 0) {
_local3 = true;
isCheckCol = false;
} else {
isCheckCol = true;
}
}
var _local10 = player._x - bonus._x;
var _local11 = player._y - bonus._y;
var _local12 = Math.sqrt((_local10 * _local10) + (_local11 * _local11));
var _local8 = _local12 - ((bonus.dia / 2) + (player.dia / 2));
if (_local8 < 0) {
_local3 = true;
isCheckCol = false;
}
} while (!isCheckCol);
bonusList.push([_local7, _local6, bonus.dia, bonus, _local9]);
_local9.gotoAndStop(2);
_local10 = bonus._x - (aWidth / 2);
_local11 = bonus._y - (aHeight / 2);
_local12 = Math.sqrt((_local10 * _local10) + (_local11 * _local11));
_local9.spot_mc._x = -13 - (_local10 / 80);
_local9.spot_mc._y = -13 - (_local11 / 80);
_local9._x = bonus._x + (_local10 / 80);
_local9._y = bonus._y + (_local11 / 80);
_local9._xscale = 100 + (Math.abs(_local10) / 10);
_local9._yscale = 100 + (Math.abs(_local11) / 10);
}
function clearBonuses() {
bonuses.removeMovieClip();
bonuses = createEmptyMovieClip("flags_mc", 205);
bonusList = [];
}
function getBonus(id) {
var _local4 = bonusIdList[bonusList[id][3].id];
if (_local4 == "points") {
score.addScore(level.currentLevel * bonusPoints);
showMessage("+" + (level.currentLevel * bonusPoints));
} else if (_local4 == "time") {
timer.inc(5000);
showMessage("+5 seconds");
} else if (_local4 == "invincible") {
player.isInvincible = true;
player.invincCount = 0;
player.main_mc.invinc_mc.gotoAndPlay("start");
showMessage("invincible!");
} else if (_local4 == "holes") {
showMessage("-10 holes");
removeHoles(10);
}
bonusList[id][3].gotoAndPlay("explode");
var _local2 = 1;
while (_local2 <= 4) {
bonusList[id][3].explode_mc[("ball" + _local2) + "_mc"].gotoAndStop(bonusList[id][3].col);
_local2++;
}
bonusList[id][4].removeMovieClip();
bonusList.splice(id, 1);
}
function removeHoles(num) {
var _local2 = holesList.length;
while (_local2 >= (holesList.length - num)) {
var _local4 = new mx.transitions.Tween(holes[("hole" + _local2) + "_mc"], "_width", mx.transitions.easing.Elastic.easeIn, holes[("hole" + _local2) + "_mc"]._width, 0, 0.5, true);
var _local3 = new mx.transitions.Tween(holes[("hole" + _local2) + "_mc"], "_height", mx.transitions.easing.Elastic.easeIn, holes[("hole" + _local2) + "_mc"]._height, 0, 0.5, true);
_local2--;
}
holesList.splice(-num);
}
function showMessage(msg) {
var _local2 = attachMovie("Message", "msg_mc", 1000);
_local2._x = aWidth / 2;
_local2._y = aHeight / 2;
_local2.text_box.text = msg;
}
function showScoreMsg(msg, x, y) {
msgDepth++;
if (msgDepth > 10) {
msgDepth = 0;
}
var _local2 = attachMovie("ScoreMsg", "msg_mc", 1005 + msgDepth);
_local2._x = x;
_local2._y = y - 20;
_local2.score_mc.score_box.text = "+" + msg;
}
var aWidth = 520;
var aHeight = 320;
var holesList = [];
var holesMcList = [];
var bonusList = [];
var bonusColList = ["yellow", "blue", "red", "purple"];
var bonusIdList = ["points", "invincible", "time", "holes"];
var bonusNumList = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var bonusPoints = 1000;
var holeStartDepth = 10;
var minHoleWidth = 20;
var maxHoleWidth = 34;
var holeAppearNum = 0;
var suckHoleID = 0;
var suckCount = 0;
var flagNum = 0;
var sensV = 16;
var suckLen = 0.5;
var invincCountMax = 150;
var isLevelComplete = false;
var isGameOver = false;
var msgDepth = 0;
}
Symbol 177 MovieClip [__Packages.tcc.Level] Frame 0
class tcc.Level extends MovieClip
{
var _x, _y, gameRef, _parent, levelNum;
function Level (x, y) {
super();
_x = x;
_y = y;
gameRef = _parent;
updateLevel();
}
function increment() {
currentLevel++;
updateLevel();
}
function reset() {
currentLevel = 1;
updateLevel();
}
function updateLevel() {
levelNum = currentLevel;
}
var currentLevel = 1;
var startingHoles = 0;
var holesPerLevel = 6;
}
Symbol 178 MovieClip [__Packages.tcc.Score] Frame 0
class tcc.Score extends MovieClip
{
var _x, _y, gameRef, _parent, score_box;
function Score (x, y) {
super();
_x = x;
_y = y;
gameRef = _parent;
updateScore();
}
function addScore(inc) {
currentScore = currentScore + inc;
updateScore();
}
function reset() {
currentScore = 0;
updateScore();
}
function updateScore() {
score_box.text = currentScore;
}
function doGameOver() {
}
var currentScore = 0;
var scorePerFlag = 100;
}
Symbol 179 MovieClip [__Packages.tcc.Timer] Frame 0
class tcc.Timer extends MovieClip
{
var _x, _y, lastMS, onEnterFrame, _parent, mask_mc;
function Timer (x, y) {
super();
_x = x;
_y = y;
currentTime = maxTime;
update();
}
function start() {
currentTime = maxTime;
lastMS = getTimer();
delete onEnterFrame;
onEnterFrame = proc;
}
function proc() {
var _local2 = getTimer();
currentTime = currentTime - (_local2 - lastMS);
lastMS = _local2;
if (currentTime <= 0) {
_parent.doGameOver();
}
update();
}
function reset() {
currentTime = maxTime;
update();
}
function stop() {
delete onEnterFrame;
}
function resume() {
delete onEnterFrame;
onEnterFrame = proc;
}
function inc(inc) {
currentTime = currentTime + inc;
if (currentTime > maxTime) {
currentTime = maxTime;
}
}
function update() {
mask_mc.bar_mc._width = Math.round((currentTime / maxTime) * 452);
}
var maxTime = 30000;
var currentTime = 5000;
}
Symbol 180 MovieClip [__Packages.mx.transitions.easing.Elastic] Frame 0
class mx.transitions.easing.Elastic
{
function Elastic () {
}
static function easeIn(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / d;
if (t == 1) {
return(b + c);
}
if (!p) {
p = d * 0.3;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
t = t - 1;
return((-((a * Math.pow(2, 10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p))) + b);
}
static function easeOut(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / d;
if (t == 1) {
return(b + c);
}
if (!p) {
p = d * 0.3;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
return((((a * Math.pow(2, -10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p)) + c) + b);
}
static function easeInOut(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / (d / 2);
if (t == 2) {
return(b + c);
}
if (!p) {
p = d * 0.45;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
if (t < 1) {
t = t - 1;
return((-0.5 * ((a * Math.pow(2, 10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p))) + b);
}
t = t - 1;
return(((((a * Math.pow(2, -10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p)) * 0.5) + c) + b);
}
static var version = "1.1.0.52";
}
Symbol 181 MovieClip [__Packages.mx.transitions.easing.Regular] Frame 0
class mx.transitions.easing.Regular
{
function Regular () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((c * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = t / d;
return((((-c) * t) * (t - 2)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
static var version = "1.1.0.52";
}
Symbol 182 MovieClip [__Packages.utils.Score] Frame 0
class utils.Score
{
var defaultScore;
function Score (bestScoreP, isPositiveP, defaultScoreP) {
bestScore = bestScoreP;
defaultScore = defaultScoreP;
isPositive = isPositiveP;
}
function updateScore(newScore) {
var _local3 = false;
if (isPositive) {
if (newScore > bestScore) {
bestScore = newScore;
_local3 = true;
}
} else if (newScore < bestScore) {
bestScore = newScore;
_local3 = true;
}
_global.arena.updateWorldRanking("...");
if (_local3) {
_global.mySO.updateData({bestScore:bestScore});
_global.arena.updateBestScore(bestScore);
submitScore();
} else {
_global.worldRanking.retrieveRanking(bestScore, _global.arena, "updateWorldRanking");
}
return(_local3);
}
function setScore(newScore) {
bestScore = newScore;
}
function submitScore() {
var _local2 = new utils.LoadVars2(this, "sendscore.cgi", {score:encryptScore(bestScore)}, "submitSuccess", "submitFailed");
}
function submitSuccess(ref) {
_global.arena.updateWorldRanking(ref.ranking);
}
function submitFailed() {
}
function encryptScore(num) {
var _local2 = _global.Math2.genRandomNum(10050, 99900);
_local2 = _local2 - (_local2 % 23);
var _local3 = (num * 7) + _local2;
_local3 = String(_local2) + String(_local3);
return(_local3);
}
var isPositive = true;
var bestScore = 0;
var currentAttempts = 0;
}