Frame 1
function init() {
TILESIZE = 150;
COS45 = Math.cos(rad(45));
SIN30 = Math.sin(rad(30));
COS30 = Math.cos(rad(30));
BRAKE = 0.9;
GRAVITY = 0.8;
FRICTION = 0.995;
TOPDEPTH = 10000;
score = 0;
TIMELIMIT = 60;
timeLeft = TIMELIMIT;
timeWarning = false;
KPH = 0;
initRider();
shadow = main.shadow;
meter = main.meter;
meter.swapDepths(TOPDEPTH);
poster = addPoster(3);
main.x0 = main._x;
main.y0 = main._y;
this["buildTrack" + selectedTrack]();
bg.gotoAndStop(selectedTrack);
main.lane0.swapDepths(0);
main.lane1.swapDepths(10);
main.powerUps0.swapDepths(1);
main.powerUps1.swapDepths(11);
initTricks();
var mute = false;
this.onEnterFrame = game;
stop();
}
function initRider() {
var _local1 = this;
rider = main.rider;
rider.x = 150;
rider.y = -TILESIZE;
rider.z = 0;
rider.theta = 0;
rider.phi = 0;
rider.onGround = true;
rider.inTrick = false;
rider.onRamp = false;
iso(rider);
rider.hold = function () {
var _local1 = this;
if (Key.isDown(_local1.holdKey)) {
_local1.gotoAndPlay(_local1._currentframe - 1);
var _local2 = _local1.tricks[_local1.tricks.length - 1];
_local2.hold++;
}
};
}
function initTricks() {
trickTable = new Array();
trickTable[0] = new Array();
trickTable[1] = new Array();
trickTable[0][37] = "NO HANDER";
trickTable[1][37] = "CAN CAN";
trickTable[0][39] = "TAILWHIP";
trickTable[1][39] = "SUPERMAN";
trickTable[0][40] = "LEG KICK";
trickTable[1][40] = "CLIFFHANGER";
pointTable = new Array();
pointTable[0] = new Array();
pointTable[1] = new Array();
pointTable[0][37] = 100;
pointTable[0][40] = 150;
pointTable[1][37] = 300;
pointTable[1][39] = 300;
pointTable[0][39] = 300;
pointTable[1][40] = 400;
pointTable[1][0] = 1500;
}
function rad(deg) {
return((Math.PI * deg) / 180);
}
function deg(rad) {
return((rad * 180) / Math.PI);
}
function tileIndex(x) {
return(Math.floor(x / TILESIZE));
}
function tileCoord(i) {
return(i * TILESIZE);
}
function signOf(x) {
var _local1 = x;
if (_local1 == 0) {
return(0);
}
return(Math.abs(_local1) / _local1);
}
function relAngle(angle) {
var _local1 = angle;
if (Math.abs(_local1) > 180) {
_local1 = _local1 - (signOf(_local1) * 360);
}
return(_local1);
}
function iso(clip) {
var _local1 = clip;
var _local3 = _local1.x;
var _local2 = _local1.y;
var z = _local1.z;
_local1._x = (_local3 + _local2) * COS45;
_local1._y = (((_local3 - _local2) * COS45) * SIN30) - (z * COS30);
}
function buildTrack1() {
if (trackMap1) {
terrainMap = trackMap1;
pMap = pMap1;
return(undefined);
}
trackMap1 = new Array();
trackMap1[0] = new Array();
trackMap1[1] = new Array();
terrainMap = trackMap1;
pMap1 = new Array();
pMap1[0] = new Array();
pMap1[1] = new Array();
pMap = pMap1;
addJump(0, 5, 1);
addJump(1, 5, 1);
addPowerUp(1, 6, 1.5);
addJump(0, 15, 1);
addJump(1, 15, 2);
addPowerUp(0, 16, 1.5);
addJump(0, 28, 1);
addJump(1, 27, 2);
addPowerUp(1, 28, 1.25);
addJump(0, 37, 2);
addJump(1, 37, 1);
addPowerUp(0, 39, 1.5);
addJump(0, 48, 2);
addJump(1, 48, 2);
addPowerUp(0, 49, 2);
}
function buildTrack2() {
if (trackMap2) {
terrainMap = trackMap2;
pMap = pMap2;
return(undefined);
}
trackMap2 = new Array();
trackMap2[0] = new Array();
trackMap2[1] = new Array();
terrainMap = trackMap2;
pMap2 = new Array();
pMap2[1] = new Array();
pMap2[2] = new Array();
pMap = pMap2;
addJump(0, 5, 2);
addJump(1, 5, 2);
addJump(0, 15, 2);
addJump(1, 15, 3);
addPowerUp(1, 16, 2);
addJump(0, 28, 2);
addJump(1, 27, 3);
addPowerUp(1, 29, 2);
addJump(0, 37, 3);
addJump(1, 37, 2);
addPowerUp(0, 40, 1.5);
addJump(0, 48, 3);
addJump(1, 48, 3);
addPowerUp(0, 51, 1.5);
}
function buildTrack3() {
if (trackMap3) {
terrainMap = trackMap3;
pMap = pMap3;
return(undefined);
}
trackMap3 = new Array();
trackMap3[0] = new Array();
trackMap3[1] = new Array();
terrainMap = trackMap3;
pMap3 = new Array();
pMap3[1] = new Array();
pMap3[2] = new Array();
pMap = pMap3;
addJump(0, 5, 2);
addJump(1, 5, 3);
addPowerUp(0, 7, 1.5);
addJump(0, 15, 2);
addJump(1, 15, 3);
addPowerUp(1, 17, 2);
addJump(0, 28, 3);
addJump(1, 27, 3);
addJump(0, 38, 3);
addJump(1, 38, 4);
addPowerUp(1, 40, 2);
addJump(0, 48, 4);
addJump(1, 48, 4);
addPowerUp(1, 52, 1.5);
}
function game() {
checkKeys();
runTerrain();
swingBike();
iso(rider);
updateShadow();
updateMeter();
updateKPH();
updateTimeLeft();
drawTrack();
panCamera();
}
function endRun() {
delete this.onEnterFrame;
playSound("game over");
this.gotoAndStop("end");
}
function checkKeys() {
if (rider.isCrashed) {
return(undefined);
}
gas(Key.isDown(38) - Key.isDown(40));
steer(Key.isDown(39) - Key.isDown(37));
checkTricks();
}
function panCamera() {
main.y = -rider.y;
iso(main);
main._x = main._x + main.x0;
main._y = main._y + main.y0;
if (tileIndex(rider.y) > 55) {
rider.y = -TILESIZE;
}
}
function drawTrack() {
var ahead = 6;
var behind = 2;
var _local3 = tileIndex(rider.y);
var _local2 = 0;
while (_local2 < 2) {
var ramp = terrainMap[_local2][_local3 + ahead];
if ((!ramp.clip) && (ramp.type == "ramp")) {
ramp.drawClip();
}
_local2++;
}
_local2 = 0;
while (_local2 < 2) {
var ramp = terrainMap[_local2][_local3 - behind];
if (ramp.takeoff && (ramp.type == "landing")) {
ramp.removeClip();
}
_local2++;
}
_local2 = 0;
while (_local2 < 2) {
var _local1 = pMap[_local2][_local3 + ahead];
if (_local1 && (!_local1.clip)) {
_local1.drawClip();
}
_local2++;
}
_local2 = 0;
while (_local2 < 2) {
var _local1 = pMap[_local2][_local3 - behind];
if (_local1 && (_local1.clip)) {
_local1.removeClip();
}
_local2++;
}
if (poster.y < -100) {
poster.removeMovieClip();
poster = addPoster(6);
}
var Vy = (-rider.Vy);
var ramp = getRamp();
if (rider.onRamp && (ramp.type == "ramp")) {
Vy = ramp.yRiderPrev - rider.y;
}
poster.y = poster.y + Vy;
iso(poster);
}
function clearTrack() {
var _local1 = 0;
while (_local1 < 2) {
for (var thing in terrainMap[_local1]) {
var _local2 = terrainMap[_local1][thing];
if (_local2.takeoff.clip) {
_local2.removeClip();
}
}
_local1++;
}
_local1 = 0;
while (_local1 < 2) {
for (var thing in pMap[_local1]) {
var _local3 = pMap[_local1][thing];
_local3.removeClip();
}
_local1++;
}
}
function addPoster(tile) {
var _local1 = backWall.attachMovie("poster", "poster", 1);
_local1.x = 0;
_local1.y = tileCoord(tile);
var _local2 = Math.floor(_local1._totalframes * Math.random());
_local1.gotoAndStop(_local2 + 1);
iso(_local1);
return(_local1);
}
function gas(force) {
var _local1 = force;
if (!rider.onGround) {
} else if (!_local1) {
rider.onGas = false;
} else if (_local1 < 0) {
rider.onGas = false;
rider.Vx = rider.Vx * BRAKE;
rider.Vy = rider.Vy * BRAKE;
} else {
var _local2 = Math.sqrt((rider.Vx * rider.Vx) + (rider.Vy * rider.Vy));
if (_local2 > riderStats.Vmax) {
} else {
if ((!rider.onGas) && (rider.theta == 0)) {
rider.gotoAndPlay("gas");
playSound("gas");
}
rider.onGas = true;
_local1 = _local1 * riderStats.A;
rider.Vx = rider.Vx + (_local1 * Math.cos(rider.phi));
rider.Vy = rider.Vy + (_local1 * Math.sin(rider.phi));
}
}
}
function steer(lean) {
if (!rider.onGround) {
} else if ((rider.onRamp && (getRamp().type != "table")) || (rider.Vz > 0)) {
rider.lean = 0;
applyTraction();
} else if ((!lean) && (rider.phi == rad(90))) {
applyTraction();
} else {
var _local2 = 1;
var _local3 = 5;
if ((!lean) && (rider.lean)) {
rider.lean = rider.lean - (signOf(rider.lean) * _local2);
} else {
rider.lean = rider.lean + (lean * _local2);
rider.lean = signOf(rider.lean) * Math.min(_local3, Math.abs(rider.lean));
}
var _local1 = Math.round(rider.lean);
if (_local1 >= 0) {
_local1 = "R" + _local1;
} else {
_local1 = "L" + (-_local1);
}
rider.gotoAndStop(_local1);
applyTraction();
}
}
function applyTraction() {
var _local2 = Math.cos(rider.phi);
var _local1 = Math.sin(rider.phi);
rider.phi = rad(90 - (3 * rider.lean));
var _local3 = (rider.Vy * _local2) - (rider.Vx * _local1);
rider.Vx = rider.Vx + (_local3 * _local1);
rider.Vy = rider.Vy - (_local3 * _local2);
}
function applyV(ground) {
var _local2 = ground;
var _local1 = getRamp();
checkWalls();
rider.x = rider.x + rider.Vx;
rider.y = rider.y + rider.Vy;
rider.z = rider.z + rider.Vz;
if (rider.z > _local2) {
rider.onGround = false;
} else {
if (!rider.onGround) {
checkLanding(_local1.theta);
}
if (rider.z < _local2) {
levelRider(_local1);
}
rider.z = _local2;
rider.onGround = true;
}
setRiderDepth();
}
function setRiderDepth() {
var _local1 = tileIndex(rider.x);
rider.swapDepths((10 * _local1) + 5);
}
function levelRider(ramp) {
var _local2 = ramp;
if (_local2.type == "ramp") {
} else {
var _local1 = 0;
if (_local2) {
_local1 = _local2.theta;
}
if (rider.theta == _local1) {
} else {
rider.theta = _local1;
applyVtheta(0);
}
}
}
function checkWalls() {
var _local2 = rider.x + rider.Vx;
var y = (rider.y + rider.Vy);
var left = 10;
var _local3 = (2 * TILESIZE) - 10;
if (_local2 < left) {
rider.Vx = margin;
rider.x = left;
} else if (_local2 > _local3) {
rider.x = _local3;
rider.Vx = 0;
}
var _local1 = tileIndex(_local2);
var j = tileIndex(y);
if (tileIndex(rider.x) == _local1) {
} else if (terrainMap[_local1][j] && (terrainMap[_local1][j].type != getRamp().type)) {
rider.Vx = 0;
}
}
function applyVtheta(V) {
var _local3 = 6;
rider.theta = rider.theta + V;
if (rider.theta < 0) {
rider.theta = rider.theta + (Math.PI*2);
}
if (rider.theta > (Math.PI*2)) {
rider.theta = rider.theta % (Math.PI*2);
}
if (rider.isCrashed) {
} else {
var _local2 = deg(rider.theta);
var _local1 = Math.round(_local2 / _local3);
rider.gotoAndStop("theta");
rider.gotoAndStop(rider._currentframe + _local1);
}
}
function applyFr(factor) {
if (!rider.onGround) {
return(undefined);
}
rider.Vx = rider.Vx * factor;
rider.Vy = rider.Vy * factor;
}
function applyG(force) {
if (rider.onGround) {
return(undefined);
}
rider.Vz = rider.Vz - force;
driftBike();
}
function driftBike() {
if (rider.inTrick || (rider.Vtheta > 0)) {
} else if (rider.theta > 0) {
var _local1 = (-rider.theta) / 2;
var _local2 = rad(-2);
_local1 = Math.max(_local2, _local1);
applyVtheta(_local1);
}
}
function checkLanding(theta) {
var _local1 = theta;
if (rider.inTrick) {
crash();
}
_local1 = Math.max(0, _local1);
if (rider.dTheta) {
var _local2 = relAngle(deg(rider.theta - _local1));
if (_local2 > (30 * riderStats.shocks)) {
crash();
} else if (_local2 < (-10 * riderStats.shocks)) {
crash();
}
}
scorePoints();
landRider(_local1);
}
function landRider(theta) {
rider.inTrick = false;
rider.theta = theta;
applyVtheta(0);
delete rider.Vtheta;
}
function scorePoints() {
if ((!rider.tricks) && (!rider.dTheta)) {
playSound("land");
return(undefined);
}
if (rider.isCrashed) {
delete rider.dTheta;
delete rider.tricks;
return(undefined);
}
if (rider.dTheta) {
scoreBackflip();
} else {
scoreStandard();
}
playSound("trick");
}
function scoreBackflip() {
var _local1 = Math.ceil(deg(rider.dTheta) / 360);
var terms = new Array("", "", "DOUBLE ", "TRIPLE ", "QUADRUPLE ");
var _local3 = pointTable[1][0];
var reduce = 0.75;
pointTable[1][0] = Math.ceil(_local3 * reduce);
var _local2 = "BACKFLIP";
if (terms[_local1].length) {
_local2 = (terms[_local1] + " ") + _local2;
}
trickString.points = _local3;
if (_local1 > 1) {
trickString.points = trickString.points + (" x " + _local1);
}
trickString.tricks = _local2;
var goodLanding = ((getRamp().type == "landing") && (rider.z < (TILESIZE / 2)));
if (goodLanding) {
trickString.points = trickString.points + " x 2";
trickString.tricks = trickString.tricks + " + GOOD LANDING";
}
trickString.gotoAndPlay(1);
score = score + ((_local3 * _local1) * (1 + (1 * goodLanding)));
delete rider.dTheta;
}
function scoreStandard() {
var combo = 0;
var reduce = 0.75;
var tweakBonus = 0.1;
var totalPoints = 0;
var trickNames = "";
var _local3 = 0;
while (_local3 < rider.tricks.length) {
var _local1 = rider.tricks[_local3];
var name = trickTable[_local1.i][_local1.j];
var next = rider.tricks[_local3 + 1];
if (!(name === trickTable[next.i][next.j])) {
var _local2 = pointTable[_local1.i][_local1.j];
pointTable[_local1.i][_local1.j] = Math.ceil(_local2 * reduce);
var hold = _local1.hold;
_local2 = _local2 + ((hold * tweakBonus) * _local2);
_local2 = Math.ceil(_local2);
totalPoints = totalPoints + _local2;
if (trickNames.length) {
trickNames = trickNames + " + ";
}
trickNames = trickNames + name;
combo++;
}
_local3++;
}
trickString.points = totalPoints;
if (combo > 1) {
trickString.points = trickString.points + (" x " + combo);
}
trickString.tricks = trickNames;
var goodLanding = ((getRamp().type == "landing") && (rider.z < (TILESIZE / 2)));
if (goodLanding) {
trickString.points = trickString.points + " x 2";
trickString.tricks = trickString.tricks + " + GOOD LANDING";
}
trickString.gotoAndPlay(1);
score = score + ((totalPoints * combo) * (1 + (1 * goodLanding)));
delete rider.tricks;
}
function crash() {
rider.gotoAndPlay("crash");
rider.Vx = 0;
rider.Vy = 0;
rider.Vz = 0;
rider.isCrashed = true;
playSound("crash");
}
function updateShadow() {
shadow.gotoAndStop(rider._currentframe);
shadow.x = rider.x;
shadow.y = rider.y;
var _local1 = getRamp();
if (_local1.type == "ramp") {
shadow.z = rider.z;
} else {
shadow.z = _local1.ground(rider.y - _local1.y);
}
shadow.swapDepths(rider.getDepth() - 1);
iso(shadow);
}
function updateMeter() {
meter._x = rider._x;
meter._y = rider._y;
if (Key.isDown(32)) {
if (rider.onGround || (rider.onRamp)) {
meter.level = meter.level + 4;
meter.charging = true;
} else {
meter.level = meter.level - 10;
}
} else {
if (meter.charging && (!rider.Vtheta)) {
backflip(meter.level);
}
meter.level = meter.level - 10;
meter.charging = false;
}
meter.level = Math.min(100, meter.level);
meter.level = Math.max(0, meter.level);
if (meter.level == 0) {
meter._visible = false;
} else {
meter.bar._xscale = meter.level;
meter._visible = true;
}
}
function updateTimeLeft() {
frameCount++;
var _local1 = 30;
if ((frameCount % _local1) > 0) {
} else {
frameCount = 0;
timeLeft = timeLeft - 1;
if ((timeLeft <= 15) && (!timeWarning)) {
timeWarning = true;
playSound("low time");
}
if (timeLeft == 0) {
endRun();
}
}
}
function updateKPH() {
var _local3 = rider.Vx;
var _local2 = rider.Vy;
var _local1 = rider.Vz;
if (!rider.onRamp) {
_local1 = 0;
}
var V = Math.round(1.5 * Math.sqrt(((_local3 * _local3) + (_local2 * _local2)) + (_local1 * _local1)));
var dV = (V - KPH);
if (dV) {
KPH = KPH + signOf(dV);
}
}
function runTerrain() {
var _local2 = tileIndex(rider.x);
var _local1 = tileIndex(rider.y);
var ramp = terrainMap[_local2][_local1];
rider.onRamp = ramp.run();
if (!rider.onRamp) {
applyG(GRAVITY);
applyV(0);
applyFr(FRICTION);
}
var _local3 = pMap[_local2][_local1];
_local3.run();
}
function addJump(i, j, size) {
var _local2 = j;
var _local3 = i;
newRamp(_local3, _local2, size);
var _local1 = 1;
while (_local1 < (size + 1)) {
newTable(_local3, _local2 + _local1);
_local1++;
}
newLanding(_local3, _local2 + _local1);
}
function newRamp(i, j, size) {
terrainMap[i][j] = new Ramp(i, j, size);
}
function newTable(i, j) {
terrainMap[i][j] = new Table(i, j);
}
function newLanding(i, j) {
terrainMap[i][j] = new Landing(i, j);
}
function getRamp() {
var _local2 = tileIndex(rider.x);
var _local1 = tileIndex(rider.y);
var _local3 = terrainMap[_local2][_local1];
return(_local3);
}
function Ramp(i, j, size) {
var _local1 = this;
_local1.i = i;
_local1.j = j;
_local1.type = "ramp";
_local1.gap = size;
_local1.x = tileCoord(i);
_local1.y = tileCoord(j);
_local1.radius = 140;
_local1.yFoot = TILESIZE - (COS30 * _local1.radius);
}
function Table(i, j) {
var _local1 = this;
_local1.i = i;
_local1.j = j;
_local1.type = "table";
_local1.x = tileCoord(i);
_local1.y = tileCoord(j);
_local1.theta = 0;
}
function Landing(i, j) {
var _local1 = this;
_local1.i = i;
_local1.j = j;
_local1.type = "landing";
_local1.x = tileCoord(i);
_local1.y = tileCoord(j);
_local1.ground0 = TILESIZE / 2;
_local1.slope = -0.5;
_local1.theta = rad(333.5);
}
function addPowerUp(i, j, k) {
pMap[i][j] = new PowerUp(i, j, k);
}
function PowerUp(i, j, k) {
var _local1 = this;
_local1.x = TILESIZE * (i + 0.5);
_local1.y = TILESIZE * (j + 0.5);
_local1.z = TILESIZE * k;
_local1.i = i;
_local1.j = j;
}
function checkTricks() {
if (((rider.onGround || (rider.inTrick)) || (rider.Vtheta)) || (!checkTrickHeight())) {
} else {
var _local1 = 37;
while (_local1 < 41) {
if (Key.isDown(_local1)) {
var _local2 = trickTable[1 * Key.isDown(32)][_local1];
if (_local2 == undefined) {
} else {
var _local3 = getTrickAngle();
rider.theta = rad(_local3);
rider.inTrick = true;
rider.holdKey = _local1;
if (!rider.tricks) {
rider.tricks = new Array();
}
rider.tricks.push({i:1 * Key.isDown(32), j:_local1, hold:0});
rider.gotoAndPlay(_local2 + _local3);
return;
}
}
_local1++;
}
}
}
function checkTrickHeight() {
if (rider.Vz > 0) {
return(true);
}
if ((rider.z - getRamp().ground()) > (TILESIZE / 2)) {
return(true);
}
return(false);
}
function backflip(power) {
var _local3 = getRamp();
if ((rider.onRamp && (_local3.type == "ramp")) || (((!rider.onRamp) && (rider.Vz > 1)) && (rider.z < ((TILESIZE * 3) / 4)))) {
var _local2 = riderStats.Vtheta_max;
var Vmin = 2;
var _local1 = ((power * power) * _local2) / 10000;
rider.Vtheta = rad(Vmin + _local1);
}
}
function swingBike() {
if (((!rider.Vtheta) || (rider.onGround)) || (rider.onRamp)) {
} else {
var _local2 = 0.3 * rider.Vtheta;
var forward = (0.3 * rider.Vtheta);
var _local1 = (rider.Vtheta + (_local2 * Key.isDown(40))) - (forward * Key.isDown(38));
rider.theta = rider.theta + _local1;
if (rider.theta >= rad(360)) {
rider.theta = rider.theta % rad(360);
}
rider.gotoAndStop("backflip");
var div = 29;
var _local3 = (rider.theta * div) / rad(360);
var frame = (rider._currentframe + Math.floor(_local3));
rider.gotoAndStop(frame);
rider.dTheta = rider.dTheta + _local1;
}
}
function getTrickAngle() {
var _local1 = deg(rider.theta);
_local1 = 15 * Math.round(_local1 / 24);
_local1 = Math.max(15, _local1);
_local1 = Math.min(45, _local1);
return(_local1);
}
function unlockTracks() {
var _local3 = this;
if (score > 20000) {
unlockedTracks = 3;
} else if ((score > 10000) && (unlockedTracks < 3)) {
unlockedTracks = 3;
} else if ((score > 5000) && (unlockedTracks < 2)) {
unlockedTracks = 2;
}
var _local1 = 1;
while (_local1 < 4) {
var _local2 = _local3["btn" + _local1];
_local2._visible = false;
if (_local1 > unlockedTracks) {
} else {
_local2._visible = true;
_local2.onPress = chooseTrack;
}
_local1++;
}
selectPage.gotoAndStop(unlockedTracks);
}
function initRiderStats() {
if (riderStats) {
return(undefined);
}
credits = 100;
riderStats = new Object();
riderStats.A = 0.7;
riderStats.Vmax0 = 20.8;
riderStats.Vmax1 = 26.4;
riderStats.meter1 = 1;
riderStats.Vtheta_max0 = 4.5;
riderStats.Vtheta_max1 = 12;
riderStats.meter2 = 1;
riderStats.shocks0 = 1;
riderStats.shocks1 = 1.7;
riderStats.meter3 = 1;
riderStats.Vmax = riderStats.Vmax0;
riderStats.Vtheta_max = riderStats.Vtheta_max0;
riderStats.shocks = riderStats.shocks0;
}
function initUpgrades() {
up_btn1.onPress = function () {
upgrade("Vmax", 1);
};
up_btn2.onPress = function () {
upgrade("Vtheta_max", 2);
};
up_btn3.onPress = function () {
upgrade("shocks", 3);
};
var _local1 = 1;
while (_local1 < 4) {
var _local3 = riderStats["meter" + _local1];
var _local2 = this["meter" + _local1];
_local2.gotoAndStop(_local3);
if ((_local2._currentframe == _local2._totalframes) || (credits < 100)) {
this["up_btn" + _local1]._visible = false;
}
_local1++;
}
}
function upgrade(prop, i) {
var _local2 = this["meter" + i];
var _local3 = ++riderStats["meter" + i];
var _local1 = riderStats[prop + "0"];
var stat1 = riderStats[prop + "1"];
var stat = (_local1 + (((stat1 - _local1) * (_local3 - 1)) / (_local2._totalframes - 1)));
_local2.gotoAndStop(_local3);
riderStats[prop] = stat;
credits = credits - 100;
playSound("select upgrade");
initUpgrades();
}
function chooseTrack() {
var _local1 = this._name;
var _local2 = _local1.charAt(_local1.length - 1);
selectedTrack = _local2;
gotoAndStop ("game");
playSound("select track");
}
function getBonusCredits() {
var _local1 = 0;
if (score > 20000) {
playSound("bonus credits");
_local1 = _local1 + 500;
}
if ((score > 10000) && (unlockedTracks < 3)) {
playSound("bonus credits");
_local1 = _local1 + 400;
}
if ((score > 5000) && (unlockedTracks < 2)) {
playSound("bonus credits");
_local1 = _local1 + 300;
}
return(_local1);
}
function playSound(label) {
sounds.gotoAndPlay(label);
}
function muteMusic() {
if (mute) {
music_mc.play();
mute = false;
} else {
music_mc.stop();
mute = true;
}
}
Ramp.prototype.run = function () {
var _local1 = this;
var _local3 = rider.y - _local1.y;
if (_local3 < _local1.yFoot) {
return(false);
}
if (!rider.onRamp) {
rider.Vlinear = rider.Vy;
}
var _local2 = rider.Vlinear / _local1.radius;
applyVtheta(_local2);
rider.Vlinear = rider.Vlinear - (GRAVITY * Math.sin(rider.theta));
rider.Vlinear = Math.max(1, rider.Vlinear);
_local1.yRiderPrev = rider.y;
rider.y = (_local1.y + _local1.yFoot) + (_local1.radius * Math.sin(rider.theta));
rider.z = _local1.radius - (_local1.radius * Math.cos(rider.theta));
rider.Vy = rider.Vlinear * Math.cos(rider.theta);
rider.Vz = rider.Vlinear * Math.sin(rider.theta);
return(true);
};
Ramp.prototype.drawClip = function () {
var _local1 = this;
var _local3 = main["lane" + _local1.i];
var _local2 = _local3.N++;
_local1.clip = _local3.attachMovie("jump", "jump" + _local2, TOPDEPTH - _local2);
_local1.clip.gotoAndStop(_local1.gap);
_local1.clip.x = _local1.x;
_local1.clip.y = _local1.y;
iso(_local1.clip);
var landing = terrainMap[_local1.i][(_local1.j + _local1.gap) + 1];
landing.takeoff = _local1;
};
Table.prototype.run = function () {
var _local1 = this;
if ((rider.z + rider.Vz) > _local1.ground()) {
return(false);
}
if (!rider.onRamp) {
rider.Vz = 0;
rider.z = _local1.ground();
}
applyV(_local1.ground());
applyFr(FRICTION);
return(true);
};
Table.prototype.ground = function () {
return(TILESIZE / 2);
};
Landing.prototype.run = function () {
var yLocal = (rider.y - this.y);
var _local3 = this.ground(yLocal);
if ((rider.z + rider.Vz) > _local3) {
return(false);
}
var _local2 = Math.cos(this.theta);
var _local1 = Math.sin(this.theta);
if (!rider.onRamp) {
rider.z = _local3;
rider.Vlinear = (rider.Vy * _local2) + (rider.Vz * _local1);
var Fn = ((rider.Vz * _local2) - (rider.Vy * _local1));
var factor = (1 + (Math.abs(Fn) / 25));
rider.Vlinear = rider.Vlinear / factor;
}
rider.Vlinear = rider.Vlinear - (GRAVITY * _local1);
rider.Vy = rider.Vlinear * _local2;
applyV(_local3);
applyFr(FRICTION);
return(true);
};
Landing.prototype.ground = function (y) {
var _local1 = this.ground0 + (this.slope * y);
return(_local1);
};
Landing.prototype.removeClip = function () {
var _local1 = this;
_local1.takeoff.clip.removeMovieClip();
delete _local1.takeoff.clip;
delete _local1.takeoff;
};
PowerUp.prototype.run = function () {
var _local1 = this;
var dx = (rider.x - _local1.x);
var _local3 = rider.y - _local1.y;
var _local2 = rider.z - _local1.z;
var R = Math.sqrt(((dx * dx) + (_local3 * _local3)) + (_local2 * _local2));
if (R < 40) {
credits = credits + 100;
playSound("collect coin");
_local1.removeClip();
_local1.removeObj();
}
};
PowerUp.prototype.drawClip = function () {
var _local1 = this;
_local1.clip = main["powerUps" + _local1.i].attachMovie("powerUp", "powerUp" + _local1.i, _local1.i);
_local1.clip.x = _local1.x;
_local1.clip.y = _local1.y;
_local1.clip.z = _local1.z;
var _local2 = terrainMap[_local1.i][_local1.j];
if (_local2.type == "landing") {
_local1.clip.shadow.gotoAndStop(2);
} else {
_local1.clip.shadow.gotoAndStop(1);
}
_local1.clip.shadow.z = _local2.ground(_local1.y - _local2.y) - _local1.z;
iso(_local1.clip);
iso(_local1.clip.shadow);
};
PowerUp.prototype.removeClip = function () {
this.clip.removeMovieClip();
delete this.clip;
};
PowerUp.prototype.removeObj = function () {
var _local1 = this;
pMap[_local1.i][_local1.j] = null;
};
stop();
Frame 11
unlockedTracks = Math.max(1, unlockedTracks);
initRiderStats();
unlockTracks();
initUpgrades();
stop();
Frame 16
init();
Frame 21
bonusCredits = getBonusCredits();
credits = credits + bonusCredits;
nameField.restrict = "A-Z 0-9";
stop();
Frame 25
postTimerStart = getTimer();
Frame 27
if ((getTimer() - postTimerStart) < 2500) {
gotoAndPlay ("postloop");
} else {
clearTrack();
gotoAndStop ("select");
}
Symbol 50 MovieClip Frame 3985
gotoAndPlay (4);
Symbol 65 MovieClip Frame 1
stop();
Symbol 65 MovieClip Frame 30
delete this.points;
delete this.tricks;
Symbol 92 Button
on (release) {
getURL ("http://www.cbc.ca/kids/games/", "_blank");
}
Symbol 104 Button
on (press) {
_parent.gotoAndStop("select");
}
Symbol 106 Button
on (press) {
_parent.gotoAndStop("instructions");
}
Symbol 107 MovieClip Frame 34
stop();
Symbol 114 MovieClip Frame 1
stop();
Symbol 114 MovieClip Frame 172
gotoAndStop ("off");
Symbol 114 MovieClip Frame 188
gotoAndStop ("off");
Symbol 114 MovieClip Frame 198
gotoAndStop ("off");
Symbol 114 MovieClip Frame 208
gotoAndStop ("off");
Symbol 114 MovieClip Frame 268
gotoAndStop ("off");
Symbol 114 MovieClip Frame 376
gotoAndStop ("off");
Symbol 114 MovieClip Frame 421
gotoAndStop ("off");
Symbol 114 MovieClip Frame 430
gotoAndStop ("off");
Symbol 114 MovieClip Frame 440
gotoAndStop ("off");
Symbol 114 MovieClip Frame 450
gotoAndStop ("off");
Symbol 118 Button
on (release) {
muteMusic();
}
Symbol 131 Button
on (press) {
gotoAndStop ("select");
}
Symbol 153 MovieClip Frame 1
stop();
Symbol 161 MovieClip Frame 1
stop();
Symbol 426 MovieClip Frame 1
stop();
Symbol 426 MovieClip Frame 116
stop();
Symbol 426 MovieClip Frame 128
hold();
Symbol 426 MovieClip Frame 139
inTrick = false;
stop();
Symbol 426 MovieClip Frame 151
hold();
Symbol 426 MovieClip Frame 162
inTrick = false;
stop();
Symbol 426 MovieClip Frame 174
hold();
Symbol 426 MovieClip Frame 185
inTrick = false;
stop();
Symbol 426 MovieClip Frame 198
hold();
Symbol 426 MovieClip Frame 210
inTrick = false;
stop();
Symbol 426 MovieClip Frame 223
hold();
Symbol 426 MovieClip Frame 235
inTrick = false;
stop();
Symbol 426 MovieClip Frame 249
hold();
Symbol 426 MovieClip Frame 262
inTrick = false;
stop();
Symbol 426 MovieClip Frame 275
hold();
Symbol 426 MovieClip Frame 287
inTrick = false;
stop();
Symbol 426 MovieClip Frame 300
hold();
Symbol 426 MovieClip Frame 312
inTrick = false;
stop();
Symbol 426 MovieClip Frame 326
hold();
Symbol 426 MovieClip Frame 339
inTrick = false;
stop();
Symbol 426 MovieClip Frame 345
hold();
Symbol 426 MovieClip Frame 349
inTrick = false;
stop();
Symbol 426 MovieClip Frame 355
hold();
Symbol 426 MovieClip Frame 359
inTrick = false;
stop();
Symbol 426 MovieClip Frame 366
hold();
Symbol 426 MovieClip Frame 371
inTrick = false;
stop();
Symbol 426 MovieClip Frame 381
hold();
Symbol 426 MovieClip Frame 389
inTrick = false;
stop();
Symbol 426 MovieClip Frame 398
hold();
Symbol 426 MovieClip Frame 405
inTrick = false;
stop();
Symbol 426 MovieClip Frame 415
hold();
Symbol 426 MovieClip Frame 423
inTrick = false;
stop();
Symbol 426 MovieClip Frame 435
hold();
Symbol 426 MovieClip Frame 444
inTrick = false;
stop();
Symbol 426 MovieClip Frame 456
hold();
Symbol 426 MovieClip Frame 464
inTrick = false;
stop();
Symbol 426 MovieClip Frame 476
hold();
Symbol 426 MovieClip Frame 484
inTrick = false;
stop();
Symbol 426 MovieClip Frame 543
isCrashed = false;
stop();
Instance of Symbol 431 MovieClip "meter" in Symbol 432 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 436 Button
on (release) {
clearTrack();
gotoAndStop ("select");
}
Symbol 438 Button
on (release) {
var lv = new LoadVars();
lv.gameid = 300;
lv.clientid = 1;
lv.action = "submitscore";
lv.username = playername;
lv.score = score;
lv.gamedata = bonusCredits;
lv.sendAndLoad("/kids/games/submitscore.jsp", lv, "POST");
gotoAndPlay ("postscore");
}