Frame 1
_global.root = this;
kv_v = {c:416, a:0, da:["distralytics.com", "distralytics.co.uk"]};
kv_v.i = 0;
while (kv_v.i < kv_v.da.length) {
System.security.allowDomain(kv_v.da[kv_v.i], (kv_v.c + ".c.") + kv_v.da[kv_v.i], "*." + kv_v.da[kv_v.i]);
kv_v.i++;
}
kv_v.lc = function () {
var _local1 = ((("http://" + kv_v.c) + ".c.") + kv_v.da[kv_v.a % kv_v.da.length]) + kv_v.lurl;
System.security.allowDomain(_local1);
kv_v.l_mcl.loadClip(_local1, kv_v.t_mc);
};
kv_v.d = (_root.ori_dom ? (_root.ori_dom) : (((_root._url.split("/")[0].indexOf("http") == -1) ? "Local" : (_root._url.split("/")[2].split("?")[0]))));
kv_v.fpv = getVersion().split(" ")[1].split(",")[0];
kv_v.lurl = "/control/tracking/tracker.swf?r=" + Math.floor(Math.random() * 10000);
kv_v.t_mc = createEmptyMovieClip("kv_tracker", -16734);
kv_v.l_mcl = new MovieClipLoader();
kv_v.mcl_l = {onLoadError:function () {
kv_v.a++;
kv_v.lc();
}, onLoadStart:function (m) {
System.security.allowDomain(m._url);
}};
kv_v.l_mcl.addListener(kv_v.mcl_l);
kv_v.lc();
_global.mcClickId = 699;
_global.FB_gid = 1;
_global.FB_score = 0;
tinymania_btn.onMouseDown = function () {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
_root.kvClick(699);
}
};
Frame 3
function getSo() {
var _local1 = SharedObject.getLocal("highscores", "/");
if (!_local1.data.highscores) {
_local1.data.highscores = defaultHighscores;
_local1.data.flush();
}
return(_local1);
}
function getHighscores() {
var _local2 = getSo();
var _local1 = [].concat(_local2.data.highscores);
_local1.sortOn(["score", "datetime", "name"], [Array.DESCENDING | Array.NUMERIC, Array.NUMERIC, Array.CASEINSENSITIVE]);
return(_local1);
}
function submitHighscore(name, score, other) {
var _local1 = getSo();
_local1.data.highscores.push({name:name, score:score, datetime:new Date(), other:other});
_local1.flush();
}
defaultHighscores = [];
defaultHighscores[0] = {name:"Ayrton", score:10000, datetime:0};
defaultHighscores[1] = {name:"Gilles", score:9000, datetime:0};
defaultHighscores[2] = {name:"Keke", score:8000, datetime:0};
defaultHighscores[3] = {name:"Nelson", score:7000, datetime:0};
defaultHighscores[4] = {name:"Emerson", score:6000, datetime:0};
defaultHighscores[5] = {name:"Nigel", score:5000, datetime:0};
defaultHighscores[6] = {name:"Michael", score:4000, datetime:0};
defaultHighscores[7] = {name:"Jackie", score:3000, datetime:0};
defaultHighscores[8] = {name:"Lewis", score:2000, datetime:0};
defaultHighscores[9] = {name:"Kimi", score:1000, datetime:0};
stop();
Frame 4
_global.game = game;
stop();
Frame 5
gotoAndStop ("start");
Symbol 20 MovieClip Frame 100
gotoAndPlay (1);
Instance of Symbol 13 MovieClip in Symbol 21 MovieClip Frame 1
onClipEvent (load) {
this._visible = 0;
}
Symbol 21 MovieClip Frame 10
function onEnterFrame() {
var _local2 = _root.getBytesLoaded() / _root.getBytesTotal();
if (getTimer() >= (startTime + 100)) {
animDone = true;
}
if ((Math.ceil(bar._width) >= width) && (animDone)) {
trace("loaded!");
stopSparks = true;
delete onEnterFrame;
gotoAndPlay ("out");
} else {
setProgress(_local2);
}
}
function fadeOut() {
setProgress(progress);
this._alpha = this._alpha - 5;
if (this._alpha <= -50) {
this._visible = false;
_parent.play();
}
}
function makeSpark() {
}
function sparkControl() {
if (!stopSparks) {
this._y = this._y + this.grav;
this._x = this._x + this.wind;
this.grav = this.grav * gravity;
this._alpha = this._alpha - this.grav;
this._rotation = this._rotation + this.spin;
if (this._alpha <= 0) {
this.removeMovieClip();
}
} else {
this.removeMovieClip();
}
}
function setProgress(p) {
bar._width = ((bar._width * 2) + (p * width)) / 3;
if (progress != 1) {
makeSpark();
}
}
width = 200;
i = 0;
gravity = 1.3;
animDone = true;
startTime = getTimer();
if (this._name == "loader_mc") {
myName = _global.language.loadingAssets;
} else {
myName = _global.language.initLevel;
}
setProgress(0);
Symbol 21 MovieClip Frame 22
stop();
Symbol 21 MovieClip Frame 28
_parent.play();
Symbol 37 Button
on (release) {
getURL ("http://www.tinymania.com", "_blank");
_root.kvClick(_global.mcClickId);
}
Symbol 43 Button
on (release) {
_parent.gotoAndStop("playGame");
_parent.game.gameOn = true;
}
Symbol 51 MovieClip Frame 1
if (!master) {
_global.soundBodge = this;
master = {};
_global.sndman = new SoundManager(_root.createEmptyMovieClip("snd_mc", _root.getNextHighestDepth()));
_global.master = master;
yesSound = _global.sndman.newSound("yesSound");
yesSound.onSoundComplete = function () {
this.remove();
};
yes1Sound = _global.sndman.newSound("yes1Sound");
yes1Sound.onSoundComplete = function () {
this.remove();
};
yes2Sound = _global.sndman.newSound("yes2Sound");
yes2Sound.onSoundComplete = function () {
this.remove();
};
yes3Sound = _global.sndman.newSound("yes3Sound");
yes3Sound.onSoundComplete = function () {
this.remove();
};
noSound = _global.sndman.newSound("noSound");
noSound.onSoundComplete = function () {
this.remove();
};
timeupSound = _global.sndman.newSound("timeupSound");
timeupSound.onSoundComplete = function () {
this.remove();
};
clickSound = _global.sndman.newSound("clickSound");
clickSound.onSoundComplete = function () {
this.remove();
};
lostSound = _global.sndman.newSound("lostSound");
lostSound.onSoundComplete = function () {
this.remove();
};
wonSound = _global.sndman.newSound("wonSound");
wonSound.onSoundComplete = function () {
this.remove();
};
master.playSound = function (s) {
trace((("playing " + s) + "Sound ") + this[s + "Sound"]);
_global.sndman.playAndRemove(s + "Sound");
};
}
stop();
Symbol 55 Button
on (release) {
getURL ("http://www.tinymania.com", "_blank");
_root.kvClick(_global.mcClickId);
}
Symbol 62 MovieClip [carSmoke] Frame 1
_rotation = (Math.random() * 360);
Symbol 62 MovieClip [carSmoke] Frame 6
this.removeMovieClip();
stop();
Symbol 85 MovieClip Frame 1
stop();
Symbol 107 MovieClip Frame 1
stop();
_visible = false;
Symbol 113 MovieClip Frame 1
stop();
Symbol 113 MovieClip Frame 6
gotoAndStop (1);
Symbol 166 MovieClip Frame 1
stop();
visible = false;
Symbol 171 MovieClip Frame 1
gameWorld.hitWallAnimPlayed();
Symbol 171 MovieClip Frame 4
stop();
Symbol 172 MovieClip Frame 1
stop();
Symbol 172 MovieClip Frame 5
gotoAndStop ("off");
Symbol 188 MovieClip Frame 1
stop();
Symbol 201 MovieClip Frame 1
trackName.text = _global.game.trackNames[_global.game.level - 1] + "!";
stop();
Symbol 207 MovieClip Frame 1
_global.game.pauseOn = true;
Symbol 207 MovieClip Frame 37
_global.game.pauseOn = false;
stop();
Symbol 207 MovieClip Frame 38
if (_global.game.level > 17) {
gotoAndPlay ("completed");
}
_global.game.pauseOn = true;
Symbol 207 MovieClip Frame 57
_global.game.nextTrack();
gotoAndPlay (1);
Symbol 207 MovieClip Frame 58
_global.game.pauseOn = true;
Symbol 207 MovieClip Frame 82
_global.game.nextTrack();
gotoAndPlay (1);
Symbol 207 MovieClip Frame 83
_global.game.pauseOn = true;
Symbol 207 MovieClip Frame 107
_global.game.completedGame();
stop();
Symbol 218 MovieClip Frame 1
function init() {
if (!runOnce) {
_global.gameWorld = this;
upperStartY = car.upper.gfx._y;
lowerStartY = car.lower.gfx._y;
global_coord = {x:0, y:0};
this.localToGlobal(global_coord);
trace((global_coord.x + ", ") + global_coord.y);
runOnce = true;
controller.onEnterFrame = mainloop;
normalCarSpeed = 8;
nextLapSection = 1;
turboCarSpeed = 2;
carSpeed = normalCarSpeed;
lap = 1;
updateLap(0);
clockValue = 37;
timeInit();
timePerlap = 50;
scorePerLap = 5;
scorePerHit = -1;
score = 0;
updateScore(0);
finalScore = 0;
zeroVelocity = 0;
grassResistance = 50;
resistance = 0;
vecX = 0;
vecY = 0;
oldVecX = 0;
oldVecY = 0;
level = 1;
trackNames = ["Australia", "Malaysia", "Bahrain", "Spain", "Turkey", "Monaco", "Canada", "France", "Britain", "Germany", "Hungary", "Europe", "Belgium", "Italy", "Singapore", "Japan", "China", "Brazil"];
spinOut = 0;
skidness = 1.75;
velocity = 0;
showCheckPoints = false;
if (!showCheckpoints) {
i = 1;
while (i <= 4) {
track["lapper" + i]._visible = false;
i++;
}
}
gotoAndStop(_global.startVariant);
gameOn = false;
}
}
function updateScore(s) {
score = score + s;
if (score < 0) {
score = 0;
}
displayScore = "SCORE " + score;
}
function timeInit() {
timeTotal = 600;
}
function timeControl() {
timeTotal = timeTotal - 1;
displayTime();
}
function displayTime() {
timeLeft = Math.ceil(timeTotal / 25);
if (timeLeft < 0) {
endGame();
} else if (String(timeLeft).length != 2) {
timeString = "0:0" + timeLeft;
} else {
timeString = "0:" + timeLeft;
}
timeDisplayTxt.text = timeString;
}
function hitWallAnimPlayed() {
master.playSound("no");
updateScore(scorePerHit);
}
function endGame() {
gameOver = true;
trace((("game over! level=" + ((level - 1) / 18)) + " timeLeft=") + timeLeft);
trace("end bonus = " + timeLeft);
updateScore(timeLeft);
_global.root.score = (_global.FB_score = (finalScore = Math.floor(score)));
master.playSound("timeup");
_parent.endGameBlackOut(_parent.score, "timeup");
}
function completedGame() {
gameOver = true;
trace((("game over! level=" + ((level - 1) / 18)) + " timeLeft=") + timeLeft);
trace((("complete! " + score) + " timeLeft = ") + (timeLeft * 10));
trace("completed bonus = " + timeLeft);
updateScore(timeLeft);
_global.root.score = (_global.FB_score = (finalScore = Math.floor(score)));
_parent.endGameBlackOut(_parent.score, "welldone");
}
function carMovement() {
if (carSpeed < normalCarSpeed) {
carSpeed = carSpeed + 0.25;
}
if (spinOut) {
cursor_x = car._x - (vecX * 3);
cursor_y = car._y - (vecY * 3);
} else {
cursor_x = _xmouse;
cursor_y = _ymouse;
}
oldCarX = car._x;
oldCarY = car._y;
newCarX = (cursor_x + (car._x * (carSpeed + resistance))) / ((carSpeed + 1) + resistance);
newCarY = (cursor_y + (car._y * (carSpeed + resistance))) / ((carSpeed + 1) + resistance);
hitWall = false;
if (track.solid.hitTest(global_coord.x + newCarX, global_coord.y + newCarY, true)) {
hitWall = true;
updateScore(-1);
newCarX = oldCarX;
newCarY = oldCarY;
car.hitWall.gotoAndPlay("hit");
}
if (!track.road.hitTest(global_coord.x + newCarX, global_coord.y + newCarY, true)) {
updateScore(-1);
resistance = grassResistance;
car.lower.gfx.hitWall.gotoAndPlay("hit");
} else {
resistance = 0;
}
if (track.clockPickup.hitTest(global_coord.x + carGlobal.x, global_coord.y + carGlobal.y, true)) {
timeTotal = timeTotal + clockValue;
track.clockPickup.gotoAndStop("off");
}
if (track.oilPickup.hitTest(global_coord.x + carGlobal.x, global_coord.y + carGlobal.y, true) && (!spinOut)) {
spinOut = 25;
}
if (!spinOut) {
oldVecX = vecX;
oldVecY = vecY;
vecX = oldCarX - newCarX;
vecY = oldCarY - newCarY;
if (isPointBehindCar(carGlobal.x, carGlobal.y, car.lower._rotation, cursor_x, cursor_y)) {
velocity = ((velocity * 2) + zeroVelocity) / 3;
} else {
velocity = ((velocity * 3) + Math.sqrt((vecX * vecX) + (vecY * vecY))) / 4;
}
car.upper.gfx._y = upperStartY + (velocity * skidness);
car.lower.gfx._y = lowerStartY + (velocity * skidness);
} else {
velocity = ((velocity * 2) + zeroVelocity) / 3;
car.upper.gfx._y = upperStartY;
car.lower.gfx._y = lowerStartY;
}
if ((!hitWall) && (!spinOut)) {
car.hitWall._rotation = (car.upper._rotation = (car.lower._rotation = (Math.atan2(vecY, vecX) * 57.2957795130823) - 90));
} else if (spinOut) {
car.upper._rotation = (car.lower._rotation = car.lower._rotation + 50);
makeTyreSmoke();
spinOut--;
}
car._x = newCarX;
car._y = newCarY;
carGlobal = {x:0, y:0};
car.lower.gfx.localToGlobal(carGlobal);
smokeness = 0.5;
vecRatio = Math.floor((vecX / vecY) * smokeness);
oldVecRatio = Math.floor((oldVecX / oldVecY) * smokeness);
if (vecRatio != oldVecRatio) {
makeTyreSmoke();
}
}
function makeTyreSmoke() {
smokeHolder.attachMovie("carSmoke", "smoke" + smokeHolder.getNextHighestDepth(), smokeHolder.getNextHighestDepth(), {_x:carGlobal.x, _y:carGlobal.y});
}
function lapDetection() {
if (track["lapper" + nextLapSection].hitTest(global_coord.x + carGlobal.x, global_coord.y + carGlobal.y, false)) {
track["lapper" + nextLapSection]._visible = false;
nextLapSection = nextLapSection + 1;
if (nextLapSection > 4) {
timeTotal = timeTotal + timePerlap;
updateScore(500);
displayTime();
completedMessage.gotoAndPlay("nextTrack");
}
}
}
function nextTrack() {
updateLap(1);
nextLapSection = 1;
level++;
track.road.gotoAndStop(level);
track.solid.gotoAndStop(level);
track.clockPickup.gotoAndStop(1);
upperLevel.gotoAndStop(level);
track.gotoAndStop(level);
if (track.solid.hitTest(global_coord.x + newCarX, global_coord.y + newCarY, true)) {
car._x = track.start._x;
car._y = track.start._y;
}
if (showCheckpoints) {
i = 1;
while (i <= 4) {
track["lapper" + i]._visible = true;
i++;
}
}
}
function mainloop() {
if ((!gameOver) && (!pauseOn)) {
timeControl();
carMovement();
lapDetection();
}
}
function updateLap(l) {
master.playSound("click");
lap = lap + l;
displayLap = lap;
}
function isPointBehindCar(carX, carY, carAng, px, py) {
carAng = carAng * (Math.PI/180);
var _local3 = carX + Math.cos(carAng);
var _local2 = carY + Math.sin(carAng);
var _local7 = px - carX;
var _local5 = py - carY;
var _local6 = _local3 - px;
var _local4 = _local2 - py;
val = (_local7 * _local4) < (_local5 * _local6);
return(val);
}
init();
stop();
Symbol 224 Button
on (release) {
_global.root.gotoAndStop("start");
}
Symbol 242 Button
on (release) {
play();
}
Symbol 257 Button
on (release) {
play();
}
Symbol 269 MovieClip Frame 1
function isFacebook() {
if (_root.fb_sig_user && (_root.fb_sig_session_key)) {
return(true);
}
return(false);
}
function getScoreString() {
var _local4 = "";
var _local3 = zerofill(_global.FB_gid, 10) + _global.FB_score;
var _local2 = 0;
while (_local2 < _local3.length) {
_local4 = _local4 + (String((Number(_local3.charAt(_local2)) + Number(k.charAt(_local2 % k.length))) % 10) + String(Math.floor(Math.random() * 10)));
_local2++;
}
return(_local4);
}
function zerofill(n, l) {
var _local1 = n.toString();
while (_local1.length < l) {
_local1 = "0" + _local1;
}
return(_local1);
}
function FB_submit() {
getURL ((appURL + "?s=") + getScoreString(), "_blank");
}
function FB_autoSubmit(successCBFunc, errorCBFunc) {
var _local3 = new LoadVars();
_local3.s = getScoreString();
_local3.fb_sig_user = _root.fb_sig_user;
_local3.fb_sig_session_key = _root.fb_sig_session_key;
_local3.onLoad = function (success) {
if (success) {
if (this.result == "ok") {
successCBFunc();
} else {
errorCBFunc();
for (var _local2 in this) {
trace((_local2 + ": ") + this[_local2]);
}
}
} else {
errorCBFunc();
}
};
_local3.sendAndLoad(callbackURL, _local3, "GET");
}
function successCallBack() {
gotoAndStop ("autoSavingDone");
}
function errorCallBack() {
gotoAndStop ("autoSavingError");
}
appURL = "http://apps.facebook.com/tinymania/";
callbackURL = "http://www.tinymania.com/apps/facebook/ss.php";
k = "0948574731928943801";
_global.FB_autoSubmit = FB_autoSubmit;
_global.isFacebook = isFacebook;
_global.FB_submit = FB_submit;
if (isFacebook()) {
gotoAndPlay ("autoSaving");
} else {
submit_btn.onRelease = FB_submit;
stop();
}
Instance of Symbol 247 MovieClip in Symbol 269 MovieClip Frame 1
onClipEvent (load) {
function doTheThing() {
if (_global.FB_score_formatted) {
scoreDisplay.text = (scoreDisplayShadow.text = _global.FB_score_formatted);
} else {
scoreDisplay.text = (scoreDisplayShadow.text = _global.FB_score);
}
}
doTheThing();
}
onClipEvent (enterFrame) {
doTheThing();
}
Instance of Symbol 249 MovieClip in Symbol 269 MovieClip Frame 2
onClipEvent (load) {
useHandCursor = false;
onRollOver = function () {
};
}
Symbol 269 MovieClip Frame 7
stop();
Symbol 269 MovieClip Frame 12
gotoAndStop ("submitScore");
Instance of Symbol 247 MovieClip in Symbol 269 MovieClip Frame 16
onClipEvent (enterFrame) {
if (_global.FB_score_formatted) {
scoreDisplay.text = (scoreDisplayShadow.text = _global.FB_score_formatted);
} else {
scoreDisplay.text = (scoreDisplayShadow.text = _global.FB_score);
}
}
Symbol 269 MovieClip Frame 27
stop();
_global.FB_autoSubmit(successCallBack, errorCallBack);
Symbol 269 MovieClip Frame 30
stop();
Symbol 269 MovieClip Frame 43
stop();
Symbol 270 MovieClip Frame 1
function loseText() {
scoreDisplay.text = ((("You completed " + _global.game.level) + " tracks and scored ") + _global.game.finalScore) + "!";
scoreDisplayShadow.text = scoreDisplay.text;
}
function winText() {
scoreDisplay.text = ((("You finished the season with " + _global.game.timeLeft) + " seconds to spare! You scored ") + _global.game.finalScore) + "!";
scoreDisplayShadow.text = scoreDisplay.text;
}
stop();
Symbol 270 MovieClip Frame 3
loseText();
Symbol 270 MovieClip Frame 11
loseText();
Symbol 270 MovieClip Frame 19
loseText();
Symbol 270 MovieClip Frame 29
loseText();
Symbol 270 MovieClip Frame 37
loseText();
Symbol 270 MovieClip Frame 46
loseText();
Symbol 270 MovieClip Frame 54
stop();
Symbol 270 MovieClip Frame 62
winText();
Symbol 270 MovieClip Frame 70
winText();
Symbol 270 MovieClip Frame 79
winText();
Symbol 270 MovieClip Frame 87
winText();
Symbol 270 MovieClip Frame 97
stop();
Symbol 273 MovieClip Frame 1
function endGameBlackOut(s, m) {
scorePercentage = s;
if (!playOnce) {
playOnce = true;
playWhat = "start";
if (m) {
endGameMessage.gotoAndStop(m);
} else {
endGameMessage.gotoAndStop("blank");
playWhat = "skip";
}
gotoAndPlay(playWhat);
}
}
_parent.endGameBlackOut = endGameBlackOut;
stop();
Symbol 273 MovieClip Frame 2
_global.FB_score_formatted = _global.game.finalScore;
Symbol 273 MovieClip Frame 15
stop();
Symbol 273 MovieClip Frame 25
master.endGame(scorePercentage);
_parent.gotoAndStop("reset");
stop();