Frame 1
protect = 0;
function collectKeys() {
k1 = (k2 = (kUp = (kDown = (kLeft = (kRight = (kSpace = false))))));
if (Key.isDown(38)) {
kUp = true;
}
if (Key.isDown(40)) {
kDown = true;
}
if (Key.isDown(39)) {
kRight = true;
}
if (Key.isDown(37)) {
kLeft = true;
}
if (Key.isDown(32)) {
kSpace = true;
}
if (Key.isDown(90) || (Key.isDown(122))) {
k1 = true;
}
if (Key.isDown(88) || (Key.isDown(120))) {
k2 = true;
}
}
function quit(_frame) {
music.stop();
_root.gotoAndPlay("charSelect");
}
function toggleMusic() {
if (musicFlag) {
music.stop();
} else {
music.start(0, 999);
}
musicFlag = musicFlag == false;
}
function keyActions() {
var character = 1;
var jumpAmt = (Math.round(Math.abs(speed) / 10) + 10);
if (state == "crash") {
slowDown(1);
} else if (state == "ground") {
if (k1 && (k2)) {
doMove("seatSpin");
slowDown(6);
} else if (kSpace) {
putInAir(jumpAmt);
if (landRotation != 0) {
if ((tileNum == 2) || (tileNum == 3)) {
speed = Math.round(speed * 0.8);
} else if ((tileNum == 6) || (tileNum == 7)) {
if (20 >= Math.abs(landRotation)) {
speed = Math.round(speed * 0.8);
} else if (((speed < 0) && (tileNum == 7)) || ((0 < speed) && (tileNum == 6))) {
speed = 0;
}
}
}
} else if (kRight) {
if ((biker._currentframe != 20) && (((0 < biker._xscale) && (speedLimit >= speed)) || (speed < 0))) {
speedUp(1);
} else if ((speed == 0) && (biker._xscale < 0)) {
putInAir(jumpAmt);
doMove("spin");
} else {
slowDown(6);
}
} else if (kLeft) {
if ((biker._currentframe != 20) && (((biker._xscale < 0) && (speed >= (-1 * speedLimit))) || (0 < speed))) {
speedUp(-1);
} else if ((speed == 0) && (0 < biker._xscale)) {
putInAir(jumpAmt);
doMove("spin");
} else {
slowDown(6);
}
} else {
slowDown(6);
}
} else if ((state == "air") && (biker._currentframe < 300)) {
slowDown(24);
if (k1 && (k2)) {
doMove("seatSpin", "Seat Spin", 10);
} else if (k1) {
if (kUp) {
doMove("noHander");
} else if (kDown) {
doMove("tomahawk");
} else if (bikerDirection(1)) {
keyHoldCheck(1, 1);
doMove("peacock");
} else if (bikerDirection(-1)) {
keyHoldCheck(1, -1);
doMove("noFooter");
}
} else if (k2 && (status.life._currentframe == 1)) {
if (kUp) {
doMove(("_" add character) add "_trick1");
} else if (kDown) {
doMove(("_" add character) add "_trick2");
} else if (bikerDirection(1)) {
keyHoldCheck(2, 1);
doMove(("_" add character) add "_trick3");
} else if (bikerDirection(-1)) {
keyHoldCheck(2, -1);
doMove(("_" add character) add "_trick4");
}
} else if (kUp) {
doMove("spin");
} else if (kDown) {
doMove("barSpin");
}
var _keyHold = "";
if ((k1 && (keyHold[0] == 1)) || (k2 && (keyHold[0] == 2))) {
_keyHold = keyHold[1];
}
if (kRight && (_keyHold != "right")) {
rotation = rotation + spinFactor;
biker._rotation = biker._rotation + spinFactor;
} else if (kLeft && (_keyHold != "left")) {
rotation = rotation - spinFactor;
biker._rotation = biker._rotation - spinFactor;
}
}
return(true);
}
function bikerDirection(_dir) {
if (0 < _dir) {
if (kRight && (0 < biker._xscale)) {
return(true);
}
if (kLeft && (biker._xscale < 0)) {
return(true);
}
return(false);
}
if (kLeft && (0 < biker._xscale)) {
return(true);
}
if (kRight && (biker._xscale < 0)) {
return(true);
}
return(false);
}
function keyHoldCheck(_key, _dir) {
var _keyHold = "";
if (biker._currentframe != 15) {
return(undefined);
}
if (0 < _dir) {
if (0 < biker._xscale) {
_keyHold = "right";
} else {
_keyHold = "left";
}
} else if (biker._xscale < 0) {
_keyHold = "right";
} else {
_keyHold = "left";
}
keyHold = new Array(_key, _keyHold);
}
Frame 2
function slowDown(_when) {
var test = ((landRotation != 0) && ((state != "crash") || ((tileNum != 8) && (tileNum != 9))));
if (((((frameCounter % 2) == 0) && (state != "air")) && (overSomething == false)) && (test)) {
if ((landRotation < 0) && (Math.abs(speed) < speedLimit)) {
speed--;
return(undefined);
}
if ((0 < landRotation) && (speed < speedLimit)) {
speed++;
return(undefined);
}
}
if (((frameCounter % _when) == 0) && (!test)) {
if (0 < speed) {
speed--;
} else if (speed < 0) {
speed++;
}
}
}
function speedUp(_amt) {
if (((((Math.abs(speed) < 20) && ((frameCounter % 4) == 0)) || ((Math.abs(speed) >= 20) && ((frameCounter % 2) == 0))) || ((0 < speed) && (_amt < 0))) || ((speed < 0) && (0 < _amt))) {
if ((landRotation != 0) && (speed == 0)) {
speed = speed + (landRotation / Math.abs(landRotation));
} else if ((!(((_amt < 0) && (0 < landRotation)) || ((0 < _amt) && (landRotation < 0)))) || (overSomething)) {
if (((speed + _amt) >= (-1 * speedLimit)) && (speedLimit >= (speed + _amt))) {
speed = speed + _amt;
}
}
}
}
function putInAir(_air) {
if (state == "crash") {
biker.gotoAndStop("flail");
biker.player.gotoAndPlay(1);
} else if (biker._currentframe != 20) {
biker.gotoAndStop("fast");
}
air = _air;
state = "air";
if (0 < _air) {
landSound.start();
}
spinFactor = (Math.floor(Math.abs(speed) / 10) + 1) * 5;
if (15 < spinFactor) {
spinFactor = 15;
}
}
function handleAir() {
land = getLand();
if (((overSomething == true) && (state != "air")) && (biker._y < land)) {
putInAir(0);
overSomething = false;
}
if (state == "air") {
air = air - 1;
if (0 >= air) {
halfPipeLaunch = false;
}
if ((land < ((biker._y - moveY) - air)) && (halfPipeLaunch == false)) {
if (biker._currentframe >= 300) {
state = "crash";
if (Math.abs(biker._rotation - landRotation) >= 90) {
goCrash(3, false, 0);
} else if (biker._currentframe == 300) {
if (landRotation != 0) {
biker.gotoAndStop("crash2");
} else {
biker.gotoAndStop("crash1");
}
affectLife(-2);
} else if (biker._currentframe == 330) {
biker.player.gotoAndPlay("crash");
affectLife(-2);
}
} else {
state = "ground";
if (Math.abs(biker._rotation - landRotation) >= 90) {
goCrash(3, false, 0);
} else if ((30 < Math.abs(biker._rotation - landRotation)) || ((biker._currentframe != 15) && (biker._currentframe != 20))) {
goCrash(2, false, 0);
}
if (state == "ground") {
landSound.start();
var _rot = Math.round(Math.abs(rotation) / 180);
if (0 < _rot) {
addTrick(multiple(_rot / 2) add "Flip", _rot * 100);
}
if ((biker._currentframe != 20) && ((((0 < speed) && (0 < biker._xscale)) || ((speed < 0) && (biker._xscale < 0))) || ((speed == 0) && (landRotation == 0)))) {
newMessage(message);
}
}
}
if (landRotation != 0) {
speed = speed + Math.round(air * (landRotation / -90));
if ((tileNum == 6) || (tileNum == 7)) {
halfPipeAmt = Math.round((landRotation * CONVERSION) * -70);
}
}
rotation = (air = (spinFactor = 0));
halfPipeLaunch = false;
bankHop = (hop = "");
} else {
moveY = moveY + air;
}
}
if (state != "air") {
biker._rotation = landRotation;
moveY = biker._y - land;
}
}
function getLand() {
var _land = (eval ("tile" add tile)._y - 30);
landRotation = 0;
onBuilding = false;
if (tileNum == 8) {
_land = _land + (tileOffset * 0.2);
landRotation = 10;
} else if (tileNum == 9) {
_land = _land - (tileOffset * 0.2);
landRotation = -10;
}
clouds._y = _land - 1200;
if (state == "air") {
overSomething = false;
}
var _buildLand = Math.round((eval ("tile" add tile)._y + eval ("tile" add tile).building._y) - 30);
var _busyCheck = (((((biker._currentframe == 15) || (biker._currentframe == 20)) || (biker._currentframe >= 300)) || (state != "air")) && (30 >= Math.abs(biker._rotation)));
if (((_busyCheck && (30 >= Math.abs(biker._rotation))) && (_buildLand >= biker._y)) && (eval ("tile" add tile).building._currentframe != 1)) {
_land = _buildLand;
overSomething = (onBuilding = true);
landRotation = 0;
} else if ((((tileNum == 6) || (tileNum == 7)) && (tileOffset >= 15)) && (185 >= tileOffset)) {
_land = _land - getHalfPipeLand();
} else if ((((tileNum == 6) && (185 < tileOffset)) && (level[eval ("tile" add tile).number + 1] == 7)) || (((tileNum == 7) && (tileOffset < 15)) && (level[eval ("tile" add tile).number - 1] == 6))) {
overSomething = true;
_land = _land - 100;
} else if (((tileNum == 4) && (tileOffset >= 50)) && (150 >= tileOffset)) {
_land = _land - 70;
overSomething = true;
} else if (((tileNum == 5) && (tileOffset >= 65)) && (135 >= tileOffset)) {
_land = _land - 40;
overSomething = true;
} else if ((tileNum == 3) && (75 < tileOffset)) {
_land = _land - ((200 - tileOffset) * 0.2);
landRotation = 10;
} else if ((tileNum == 2) && (tileOffset < 125)) {
_land = _land - (tileOffset * 0.2);
landRotation = -10;
}
return(_land);
}
function getHalfPipeLand() {
var xValue = (tileOffset - 40);
if (tileNum == 6) {
if (70 < xValue) {
overSomething = true;
if (halfPipeLaunch == true) {
return(70);
}
return(100);
}
if (0 >= xValue) {
return(0);
}
landRotation = Math.round((-1 * Math.asin(xValue / 70)) / CONVERSION);
return(70 - Math.round(Math.sqrt(4900 - Math.pow(xValue, 2))));
}
if (tileNum == 7) {
if (xValue < 50) {
overSomething = true;
if (halfPipeLaunch == true) {
return(70);
}
return(100);
}
if (xValue >= 120) {
return(0);
}
xValue = 120 - xValue;
landRotation = Math.round(Math.asin(xValue / 70) / CONVERSION);
if (xValue == 0) {
return(0);
}
return(70 - Math.round(Math.sqrt(4900 - Math.pow(xValue, 2))));
}
}
Frame 3
function getMoveX() {
var enterFlag = false;
var futureTileNum = 0;
if ((state != "air") && (overSomething == false)) {
moveX = speed;
if (thruPoint(40, 1) && (tileNum == 6)) {
halfPipeAmt = (tileOffset - 40) + speed;
enterFlag = true;
} else if (thruPoint(160, -1) && (tileNum == 7)) {
halfPipeAmt = (tileOffset - 160) + speed;
enterFlag = true;
} else if ((level[eval ("tile" add tileLoop(1, tile)).number] == 6) && (thruPoint(240, 1))) {
futureTileNum = 6;
halfPipeAmt = (tileOffset + speed) - 240;
enterFlag = true;
} else if ((level[eval ("tile" add tileLoop(-1, tile)).number] == 7) && (thruPoint(-40, -1))) {
futureTileNum = 7;
halfPipeAmt = (tileOffset - -40) + speed;
enterFlag = true;
}
}
if (((state != "air") && (overSomething == false)) && (((((tileNum == 6) && (tileOffset >= 40)) && (110 >= tileOffset)) || (((tileNum == 7) && (tileOffset >= 90)) && (160 >= tileOffset))) || (enterFlag == true))) {
if (speed == 0) {
moveX = 0;
return(undefined);
}
if (enterFlag == false) {
halfPipeAmt = halfPipeAmt + speed;
}
var angle = ((halfPipeAmt / CONVERSION) / 70);
if (-90 >= angle) {
moveX = 90 - tileOffset;
putInAir(Math.abs(speed));
biker._rotation = 90;
if (kLeft && (-10 >= speed)) {
speed = -10;
rotation = 90;
} else {
speed = 0;
}
halfPipeLaunch = true;
return(undefined);
}
if (angle >= 90) {
moveX = 110 - tileOffset;
putInAir(Math.abs(speed));
biker._rotation = -90;
if (kRight && (speed >= 10)) {
speed = 10;
rotation = -90;
} else {
speed = 0;
}
halfPipeLaunch = true;
return(undefined);
}
var xVal = (Math.round((Math.sin(angle * CONVERSION) * 70) * 10) / 10);
if (futureTileNum == 6) {
moveX = (240 + xVal) - tileOffset;
} else if (futureTileNum == 7) {
moveX = (-40 + xVal) - tileOffset;
} else if (tileNum == 6) {
moveX = (40 + xVal) - tileOffset;
} else {
moveX = (160 + xVal) - tileOffset;
}
moveX = roundTenthsToFive(moveX);
if (((moveX / Math.abs(moveX)) != (speed / Math.abs(speed))) && (moveX != 0)) {
moveX = 0;
}
if ((tileNum == 6) && (110 < (moveX + tileOffset))) {
moveX = 110 - tileOffset;
} else if ((tileNum == 7) && ((moveX + tileOffset) < 90)) {
moveX = 90 - tileOffset;
}
} else {
moveX = speed;
halfPipeAmt = 0;
}
}
function roundTenthsToFive(_initial) {
if (_initial == 0) {
return(0);
}
var tenths = Math.abs((_initial * 10) % 10);
var roundedTenths;
var initialWhole;
var finalAbsolute;
if ((tenths >= 0) && (2 >= tenths)) {
roundedTenths = 0;
} else if ((2 < tenths) && (7 >= tenths)) {
roundedTenths = 0.5;
} else if ((7 < tenths) && (tenths < 10)) {
roundedTenths = 1;
}
if (0 < _initial) {
initialWhole = Math.floor(_initial);
} else {
initialWhole = Math.ceil(_initial);
}
finalAbsolute = Math.abs(initialWhole) + roundedTenths;
if (finalAbsolute == undefined) {
trace("Bogus roundTenthsToFive return value");
}
return(finalAbsolute * (_initial / Math.abs(_initial)));
}
Frame 4
function moveVert(_amt) {
var endLoop = 4;
bg._y = bg._y + (_amt / 4);
if (bg._y >= 0) {
background.gotoAndStop(1);
} else if (-80 >= bg._y) {
background.gotoAndStop(2);
}
var i = 0;
while (i < endLoop) {
eval ("tile" + i)._y = eval ("tile" + i)._y + _amt;
i++;
}
}
function moveHor(_amt) {
var leftBound = 0;
var leftBoundNumber;
var rightBound;
var rightBoundNumber;
var leftTile;
var rightTile;
var tileAmount;
var xAdjust;
var yAdjust;
leftBoundNumber = -20;
rightBoundNumber = level.length + 19;
rightBound = 199;
tileAmount = 4;
xAdjust = 1;
yAdjust = 1;
leftTile = (rightTile = tile);
if ((leftBoundNumber >= eval ("tile" add leftTile).number) && ((_amt + tileOffset) < leftBound)) {
_amt = -tileOffset;
speed = 0;
} else if ((eval ("tile" add rightTile).number >= rightBoundNumber) && (rightBound < (_amt + tileOffset))) {
_amt = rightBound - tileOffset;
speed = 0;
}
leftBound = -260;
rightBound = 0;
if (rightBound < (eval ("tile" add firstTile)._x - _amt)) {
drawTile(tileLoop(-1, firstTile, tileAmount), eval ("tile" + tileLoop(-1, firstTile, tileAmount)).number - tileAmount, -1);
eval ("tile" add tileLoop(-1, firstTile, tileAmount))._x = eval ("tile" add firstTile)._x - (200 / xAdjust);
eval ("tile" add tileLoop(-1, firstTile, tileAmount))._y = eval ("tile" add firstTile)._y;
firstTile = tileLoop(-1, firstTile, tileAmount);
if (level[eval ("tile" add firstTile).number] == 8) {
eval ("tile" add firstTile)._y = eval ("tile" add firstTile)._y - (40 / yAdjust);
} else if (level[eval ("tile" add firstTile).number] == 9) {
eval ("tile" add firstTile)._y = eval ("tile" add firstTile)._y + (40 / yAdjust);
}
} else if (leftBound >= (eval ("tile" add firstTile)._x - _amt)) {
firstTile = tileLoop(1, firstTile, tileAmount);
drawTile(tileLoop(-1, firstTile, tileAmount), eval ("tile" + tileLoop(-1, firstTile, tileAmount)).number + tileAmount, 1);
eval ("tile" + tileLoop(-1, firstTile, tileAmount))._x = eval ("tile" + tileLoop(-1, firstTile, tileAmount))._x + ((200 / xAdjust) * tileAmount);
eval ("tile" + tileLoop(-1, firstTile, tileAmount))._y = eval ("tile" + tileLoop(-2, firstTile, tileAmount))._y;
if (level[eval ("tile" add tileLoop(-2, firstTile, tileAmount)).number] == 8) {
eval ("tile" add tileLoop(-1, firstTile, tileAmount))._y = eval ("tile" add tileLoop(-1, firstTile, tileAmount))._y + (40 / yAdjust);
} else if (level[eval ("tile" add tileLoop(-2, firstTile, tileAmount)).number] == 9) {
eval ("tile" add tileLoop(-1, firstTile, tileAmount))._y = eval ("tile" add tileLoop(-1, firstTile, tileAmount))._y - (40 / yAdjust);
}
}
eval ("tile" add firstTile)._x = eval ("tile" add firstTile)._x - _amt;
var looper = 1;
while (looper < tileAmount) {
eval ("tile" add tileLoop(looper, firstTile, tileAmount))._x = eval ("tile" add firstTile)._x + ((200 / xAdjust) * looper);
looper++;
}
setTileOffset(_amt);
var pos = (bg._x - (_amt / 10));
var width = (bg._width / 2);
if (pos < (-width)) {
bg._x = pos + width;
} else if (0 < pos) {
bg._x = pos - width;
} else {
bg._x = pos;
}
pos = clouds._x - _amt;
width = clouds._width / 2;
if (pos < (-width)) {
clouds._x = pos + width;
} else if (0 < pos) {
clouds._x = pos - width;
} else {
clouds._x = pos;
}
}
function setTileOffset(_move) {
var xAdjust = 1;
var tileAmount = 4;
tileOffset = tileOffset + _move;
var flag = true;
while (flag) {
flag = false;
if (tileOffset >= (200 / xAdjust)) {
tile = tileLoop(1, tile, tileAmount);
tileOffset = tileOffset - (200 / xAdjust);
flag = true;
} else if (tileOffset < 0) {
tile = tileLoop(-1, tile, tileAmount);
tileOffset = tileOffset + (200 / xAdjust);
flag = true;
}
}
tileNum = level[eval ("tile" add tile).number];
}
function tileLoop(_num, _from, _howMany) {
if (_howMany == undefined) {
_howMany = 4;
}
_num = _num + _from;
if ((_howMany - 1) < _num) {
_num = _num - _howMany;
} else if (_num < 0) {
_num = _num + _howMany;
}
return(_num);
}
Frame 5
function drawTile(_number, _index, _position) {
var frame;
var tileAmount = 4;
if (((level.length - 1) < _index) || (_index < 0)) {
frame = 1;
} else {
frame = level[_index];
}
if ((frame == 6) && (level[_index + 1] == 7)) {
frame = 10;
} else if ((frame == 7) && (level[_index - 1] == 6)) {
frame = 11;
}
eval ("tile" add _number).gotoAndStop(frame);
eval ("tile" add _number).number = _index;
frame = buildFrame(_index);
eval (("tile" add _number) add ".building").gotoAndStop(frame);
if (frame == "none") {
eval ("tile" add _number).building._y = 0;
} else {
eval ("tile" add _number).building._y = -180 - (build[_index] * 20);
}
if (level[_index] == 8) {
eval ("tile" add _number).building._y = eval ("tile" add _number).building._y + 40;
}
var _color = 0;
if (_index == 0) {
_position = 0;
}
if (0 < _position) {
_color = eval ("tile" add tileLoop(-1, _number, tileAmount)).color;
if ((frame == "left") || (frame == "single")) {
_color = tileLoop(1, _color, 4);
}
} else if (_position < 0) {
_color = eval ("tile" add tileLoop(1, _number, tileAmount)).color;
var nextBuildFrame = eval ("tile" add tileLoop(1, _number, tileAmount)).building._currentframe;
if ((nextBuildFrame == 2) || (nextBuildFrame == 5)) {
_color = tileLoop(-1, _color, 4);
}
}
eval ("tile" add _number).color = _color;
if (frame != "none") {
eval ("tile" add _number).building.b.gotoAndStop(_color + 1);
}
eval ("tile" add _number).door._y = 20;
if ((((((level[_index] != 4) && (level[_index] != 5)) && ((_index % 4) == 0)) && (frame != "none")) && ((_color != 3) || (frame == "single"))) && ((build[_index] != 1) || (level[_index] != 9))) {
if ((level[_index] == 9) || ((build[_index] >= 3) && (level[_index] != 8))) {
eval (("tile" add _number) add ".door")._y = eval (("tile" add _number) add ".door")._y - 40;
}
eval ("tile" add _number).door.gotoAndStop(3);
} else {
eval ("tile" add _number).door.gotoAndStop(1);
}
}
function buildFrame(_index) {
var frame;
var left_b;
var right_b;
if ((((build.length - 1) < _index) || (_index < 0)) || (build[_index] == 0)) {
frame = "none";
} else {
left_b = build[_index - 1];
if (left_b != 0) {
if (level[_index] == 8) {
left_b = left_b + 2;
}
if (level[_index - 1] == 9) {
left_b = left_b - 2;
}
}
right_b = build[_index + 1];
if (right_b != 0) {
if (level[_index + 1] == 8) {
right_b = right_b - 2;
}
if (level[_index] == 9) {
right_b = right_b + 2;
}
}
if ((right_b == build[_index]) && (left_b == build[_index])) {
frame = "middle";
} else if (right_b == build[_index]) {
frame = "left";
} else if (left_b == build[_index]) {
frame = "right";
} else {
frame = "single";
}
}
return(frame);
}
function goCrash(_num, _wall, _xPos) {
var _crash = 0;
if (_wall == true) {
if ((state == "ground") && (Math.abs(speed) >= 20)) {
state = "crash";
biker.gotoAndStop("crash" add _num);
_crash = -1;
} else if (((state == "air") && (Math.abs(speed) >= 15)) && (biker._currentframe < 300)) {
biker.gotoAndStop("wallcrash");
_crash = -1;
}
moveX = _xpos - tileOffset;
((speed < 0) ? ((moveX = moveX + 1)) : ((moveX = moveX - 1)));
air = (speed = 0);
} else {
state = "crash";
biker.gotoAndStop("crash" add _num);
_crash = -2;
}
if (_crash < 0) {
message = new Array();
trickScore = 0;
affectLife(_crash);
}
}
function peddle() {
if (biker._currentframe != 20) {
if (state == "ground") {
if (Math.abs(speed) >= 20) {
biker.gotoAndStop("fast");
} else if ((((0 < Math.abs(speed)) || (landRotation != 0)) || (kRight)) || (kLeft)) {
biker.gotoAndStop("slow");
} else {
biker.gotoAndStop("stopped");
}
if (((0 < biker._xscale) && (kRight)) || (kLeft && (biker._xscale < 0))) {
biker.ani.play();
} else {
biker.ani.stop();
}
} else {
biker.ani.stop();
}
}
}
function doMove(_move, _trickName, _score) {
if ((biker._currentframe == 15) || ((_move == "seatSpin") && (state == "ground"))) {
biker.gotoAndStop(_move);
if (_trickName != undefined) {
addTrick(_trickName, _score);
}
}
}
Frame 6
function handleObstacles() {
var _bankHop = bankHop;
var groundLand = (eval ("tile" add tile)._y - 30);
var nextLand = (eval ("tile" add tileLoop(1, tile))._y - 30);
var prevLand = (eval ("tile" add tileLoop(-1, tile))._y - 30);
var nextBuildLand = (nextLand + eval ("tile" add tileLoop(1, tile)).building._y);
var prevBuildLand = (prevLand + eval ("tile" add tileLoop(-1, tile)).building._y);
var nextBuild = eval ("tile" add tileLoop(1, tile)).building._currentframe;
var prevBuild = eval ("tile" add tileLoop(-1, tile)).building._currentframe;
if (state == "air") {
if ((thruPoint(0, -1) && ((eval ("tile" add tile).building._currentframe == 2) || (eval ("tile" add tile).building._currentframe == 5))) || (thruPoint(200, 1) && ((eval ("tile" add tile).building._currentframe == 4) || (eval ("tile" add tile).building._currentframe == 5)))) {
checkHop("");
}
if ((thruPoint(200, 1) && ((nextBuild == 2) || (nextBuild == 5))) && (biker._y < nextBuildLand)) {
checkHop("left");
} else if ((thruPoint(0, -1) && ((prevBuild == 4) || (prevBuild == 5))) && (biker._y < prevBuildLand)) {
checkHop("right");
}
}
if (onBuilding) {
return(undefined);
}
var landAllowance = 10;
if (tileNum == 2) {
if (thruPoint(125, -1)) {
if ((groundLand - 25) < biker._y) {
goCrash(1, true, 125);
} else {
_bankHop = "";
}
} else if (thruPoint(125, 1) && (biker._currentframe < 300)) {
_bankHop = "left";
}
} else if (tileNum == 3) {
if (thruPoint(75, 1)) {
if ((land - 25) < biker._y) {
goCrash(1, true, 75);
} else {
_bankHop = "";
}
} else if (thruPoint(75, -1) && (biker._currentframe < 300)) {
_bankHop = "right";
}
} else if (tileNum == 4) {
if ((groundLand - 65) < biker._y) {
if (thruPoint(50, 1)) {
goCrash(1, true, 50);
} else if (thruPoint(150, -1)) {
goCrash(1, true, 150);
}
} else if (thruPoint(50, 1) || (thruPoint(150, -1))) {
checkHop("mailbox");
} else if (thruPoint(50, -1) || (thruPoint(150, 1))) {
checkHop("");
}
} else if (tileNum == 5) {
if ((groundLand - 35) < biker._y) {
if (thruPoint(65, 1)) {
goCrash(1, true, 65);
} else if (thruPoint(135, -1)) {
goCrash(1, true, 135);
}
} else if (thruPoint(65, 1) || (thruPoint(135, -1))) {
checkHop("hydrant");
} else if (thruPoint(65, -1) || (thruPoint(135, 1))) {
checkHop("");
}
} else if ((tileNum == 6) && ((groundLand - 100) < biker._y)) {
if ((thruPoint(110, 1) && (halfPipeLaunch == false)) && (state == "air")) {
goCrash(2, true, 110);
} else if (thruPoint(185, -1) && (((groundLand - 100) + landAllowance) < biker._y)) {
goCrash(1, true, 185);
}
} else if ((tileNum == 7) && ((groundLand - 100) < biker._y)) {
if ((thruPoint(90, -1) && (halfPipeLaunch == false)) && (state == "air")) {
goCrash(2, true, 90);
} else if (thruPoint(15, 1) && (((groundLand - 100) + landAllowance) < biker._y)) {
goCrash(1, true, 15);
}
} else if ((level[eval ("tile" add tileLoop(1, tile)).number] == 7) && (((nextLand - 100) + landAllowance) < biker._y)) {
if (thruPoint(215, 1)) {
goCrash(1, true, 215);
}
} else if ((level[eval ("tile" add tileLoop(-1, tile)).number] == 6) && (((prevLand - 100) + landAllowance) < biker._y)) {
if (thruPoint(-15, -1)) {
goCrash(1, true, -15);
}
}
if (((bankHop == "left") || (bankHop == "right")) && (_bankHop == "")) {
addTrick("Bank2Bank", 500);
}
bankHop = _bankHop;
}
function thruPoint(_point, _dir) {
if (_dir < 0) {
return((_point < tileOffset) && (_point >= (tileOffset + moveX)));
}
if (0 < _dir) {
return((tileOffset < _point) && ((tileOffset + moveX) >= _point));
}
}
function launch() {
if ((state != "air") && (overSomething == false)) {
if ((thruPoint(75, -1) && (tileNum == 3)) || (thruPoint(125, 1) && (tileNum == 2))) {
putInAir(Math.round(Math.abs(speed) / 3));
}
}
}
Frame 7
function speedToMPH(_speed) {
ret = _speed / 2;
((ret < 0) ? ((ret = Math.floor(ret))) : ((ret = Math.ceil(ret))));
return(Math.abs(ret));
}
function addTrick(_msg, _score, _times) {
var extra;
if (_times != undefined) {
extra = Math.round(_times / 8) + 1;
if (1 < extra) {
_score = _score * extra;
} else {
extra = 1;
}
} else {
extra = 1;
}
var i = 0;
while (i < extra) {
message.push(_msg);
i++;
}
trickScore = trickScore + _score;
}
function checkHop(_hop) {
if (300 < biker._currentframe) {
return(undefined);
}
if ((hop == "hydrant") && (_hop != "hydrant")) {
addTrick("Hydrant Hop", 100);
} else if ((hop == "mailbox") && (_hop != "mailbox")) {
addTrick("Postal Hop", 500);
} else if (((hop == "left") && (_hop != "left")) || ((hop == "right") && (_hop != "right"))) {
addTrick("Building Hop", 2000);
}
hop = _hop;
}
function affectLife(_amt) {
if ((status.life._currentframe - _amt) < 1) {
status.life.gotoAndStop(1);
} else if (5 < (status.life._currentframe - _amt)) {
status.life.gotoAndStop(5);
} else {
status.life.gotoAndStop(status.life._currentframe - _amt);
}
}
function multiple(_amt) {
var _local1 = 0.5;
switch (_amt) {
case _local1 :
return("Half ");
case 1 :
return("");
case 2 :
return("Double ");
case 3 :
return("Triple ");
case 4 :
return("Quad ");
case 5 :
return("Quint ");
}
return((_amt * 180) add " ");
}
function newMessage(_msg) {
if (message.length != 0) {
var i = 0;
while (i < (message.length - 1)) {
var j = (i + 1);
while (j < message.length) {
if (message[j] != message[i]) {
break;
}
j++;
}
if (i < (j - 1)) {
message.splice(i, j - i, ((j - i) add "x ") add message[i]);
}
i++;
}
var _msg;
var _bonus = ((message.length - 1) * 1000);
if (trickScore < _bonus) {
_bonus = Math.floor(trickScore / 1000) * 1000;
}
_msg = (message.join(" + ") add newline) add trickScore;
if (0 < _bonus) {
_msg = _msg + (" + " add _bonus);
}
_msg = _msg + " points";
trickScore = trickScore + _bonus;
if (trickScore >= 20000) {
status.trickCombos.gotoAndPlay("highscore");
_msg = _msg + "!!!";
} else {
status.trickCombos.gotoAndPlay(2);
}
status.trickCombos.message = _msg;
if (status.timeDisplay._currentframe == 1) {
score = score + trickScore;
if (((100000 < score) && (secrets[5 + levelNumber] == 0)) && (levelNumber != 0)) {
if (maxLevel < 5) {
status.unlockLevel.gotoAndPlay(2);
} else {
status.unlock.gotoAndPlay(2);
}
secrets[5 + levelNumber] = 1;
}
}
trickScore = 0;
message = new Array();
affectLife(1);
}
}
Frame 8
function init(_mode) {
level = new Array(6, 7, 1, 1, 1, 8, 8, 1, 1, 1, 1, 2, 5, 3, 1, 1, 1, 8, 8, 1, 1, 1, 1, 6, 7);
build = new Array(5, 5, 5, 5, 5, 0, 0, 7, 7, 7, 0, 5, 5, 5, 0, 2, 2, 4, 6, 0, 7, 7, 7, 7, 7);
gameMode = "platform";
air = (speed = (spinFactor = (moveX = (moveY = 0))));
state = "ground";
firstTile = 0;
frameCounter = 0;
overSomething = (onBuilding = false);
landRotation = 0;
halfPipeLaunch = false;
halfPipeAmt = 0;
rotation = (trickScore = (score = 0));
bankHop = (hop = "");
keyHold = new Array(0, "");
minutes = 3;
seconds = 0;
tileOffset = 70;
tile = 1;
speedLimit = 35;
message = new Array();
status.life.gotoAndStop(3);
repaint(true);
if (musicFlag) {
music.start(0, 999);
}
}
function repaint(_firstTime) {
var tileAmount = 4;
var draw_y = 0;
var thisTile = 0;
var yAdjust = 1;
var xAdjust = 1;
var xStart = 0;
var yStart = 230;
while (true) {
if (((level[thisTile + tile] == 1) || (level[thisTile + tile] == 8)) || (level[thisTile + tile] == 9)) {
break;
}
thisTile = thisTile + 1;
}
var i = 0;
while (i < tileAmount) {
if (_firstTime) {
eval ("tile" + i).pill = new Array();
drawTile(i, thisTile + i, i);
eval ("tile" add i)._x = xStart + ((i * 200) / xAdjust);
} else {
drawTile(tileLoop(i, firstTile, tileAmount), eval ("tile" + tileLoop(i, firstTile, tileAmount)).number, 1);
}
eval ("tile" add tileLoop(i, firstTile, tileAmount))._y = yStart - ((40 / yAdjust) * draw_y);
if (level[eval ("tile" add tileLoop(thisTile + i, firstTile, tileAmount)).number] == 8) {
draw_y--;
} else if (level[eval ("tile" add tileLoop(thisTile + i, firstTile, tileAmount)).number] == 9) {
draw_y++;
}
i++;
}
}
maxCharacter = 1;
REGULAR_TRICK = 10;
SPECIAL_TRICK = 100;
CONVERSION = 0.017453;
MAX_COPIES = 500;
MAX_SPEED = 50;
landSound = new Sound();
landSound.attachSound("scuff");
landSound.setVolume(50);
music = new Sound();
music.attachSound("song");
music.setVolume(40);
musicFlag = true;
kM_hold = false;
Frame 12
if (_framesloaded != _totalframes) {
gotoAndPlay(_currentframe - 1);
} else if ((((substring(_root._url, 12, 13)) != "entropicorder") && ((substring(_root._url, 12, 10)) != "newgrounds")) && (_root.protect)) {
gotoAndStop (27);
} else {
stop();
}
Frame 20
init();
gotoAndPlay(_currentframe + 1);
Frame 21
collectKeys();
if (keyActions()) {
if (((state == "ground") && (biker._currentframe != 20)) && (((speed == 0) || ((0 < speed) && (0 < biker._xscale))) || ((speed < 0) && (biker._xscale < 0)))) {
newMessage(message);
}
moveY = (moveX = 0);
getMoveX();
launch();
handleObstacles();
moveHor(moveX);
peddle();
handleAir();
moveVert(moveY);
if (frameCounter < 24) {
frameCounter++;
} else {
frameCounter = 1;
if (0 < seconds) {
seconds--;
} else if (0 < minutes) {
seconds = 59;
minutes--;
}
}
if (((((minutes == 0) && (seconds == 0)) && (status.timeDisplay._currentframe == 1)) && (state != "air")) && (message.length == 0)) {
status.timeDisplay.gotoAndPlay(2);
}
status.speed = speedtoMPH(speed);
status.time = (minutes add ":") add ((seconds < 10) ? ("0" add seconds) : (seconds));
}
Frame 22
gotoAndPlay(_currentframe - 1);
Frame 26
gotoAndStop(_currentframe + 1);
Frame 27
stop();
Frame 28
gotoAndStop(_currentframe - 1);
Symbol 26 Button
on (release) {
option = "play";
bar.play();
}
Symbol 28 Button
on (release) {
if (_currentframe != 10) {
gotoAndStop (10);
option = "SELECT PLAYER";
bar.play();
}
}
Symbol 30 Button
on (release) {
if (_currentframe != 5) {
gotoAndStop (5);
option = "SELECT COURSE";
bar.play();
}
}
Symbol 32 Button
on (release) {
getURL ("http://www.sikids.com/games/bmx/", "_blank");
}
Symbol 34 Button
on (release) {
if (_currentframe != 15) {
gotoAndStop (15);
option = "HELP";
bar.play();
}
}
Symbol 40 MovieClip Frame 1
if (_parent.option == "") {
stop();
}
Symbol 40 MovieClip Frame 2
option = _parent.option;
if ((option == "play") || (option == "editor")) {
_root.gotoAndPlay(option);
}
Symbol 40 MovieClip Frame 6
if ((_parent.option != "") && (_parent.option == option)) {
stop();
}
Symbol 63 Button
on (release) {
if (selectHead._currentframe == 13) {
selectHead.gotoAndStop(1);
} else {
selectHead.nextFrame();
}
if (_root.maxCharacter < selectHead._currentframe) {
gotoAndStop (2);
} else {
gotoAndStop (1);
}
}
Symbol 69 Button
on (release) {
if (selectHead._currentframe == 1) {
selectHead.gotoAndStop(13);
} else {
selectHead.prevFrame();
}
if (_root.maxCharacter < selectHead._currentframe) {
gotoAndStop (2);
} else {
gotoAndStop (1);
}
}
Symbol 87 MovieClip Frame 1
stop();
Symbol 91 MovieClip Frame 1
stop();
Symbol 101 MovieClip Frame 1
option = "";
stop();
Symbol 101 MovieClip Frame 10
selector.selectHead.gotoAndStop(1);
Symbol 104 MovieClip Frame 1
stop();
Symbol 122 MovieClip Frame 1
stop();
Symbol 134 MovieClip Frame 1
stop();
Symbol 138 MovieClip Frame 1
stop();
Symbol 139 MovieClip Frame 1
stop();
Symbol 143 MovieClip Frame 1
stop();
Symbol 154 MovieClip Frame 1
stop();
Symbol 162 MovieClip Frame 1
Symbol 164 MovieClip Frame 1
Symbol 176 MovieClip Frame 1
Symbol 185 MovieClip Frame 1
_root.addTrick("Seat Spin", _parent._parent.REGULAR_TRICK);
Symbol 185 MovieClip Frame 12
if (!(_parent._parent.k1 && (_parent._parent.k2))) {
gotoAndPlay (11);
}
Symbol 185 MovieClip Frame 23
_parent.gotoAndStop("fast");
Symbol 186 MovieClip Frame 1
counter = 0;
Symbol 186 MovieClip Frame 6
if (_parent._parent.kUp && (_parent._parent.k1)) {
gotoAndPlay(_currentframe - 1);
counter++;
}
Symbol 186 MovieClip Frame 11
_root.addTrick("No Hander", _parent._parent.REGULAR_TRICK * (_totalframes - 1), counter);
_parent.gotoAndStop("fast");
Symbol 187 MovieClip Frame 1
counter = 0;
Symbol 187 MovieClip Frame 6
if (_parent._parent.bikerDirection(-1) && (_parent._parent.k1)) {
gotoAndPlay (5);
counter++;
}
Symbol 187 MovieClip Frame 11
_root.addTrick("Superman", _root.REGULAR_TRICK * (_totalframes - 1), counter);
_parent.gotoAndStop("fast");
Symbol 188 MovieClip Frame 1
counter = 0;
Symbol 188 MovieClip Frame 6
if (_parent._parent.kDown && (_parent._parent.k1)) {
gotoAndPlay (5);
counter++;
}
Symbol 188 MovieClip Frame 9
_root.addTrick("Tomahawk", _root.REGULAR_TRICK * (_totalframes - 1), counter);
_parent.gotoAndStop("fast");
Symbol 192 MovieClip Frame 1
if (_parent._xscale < 0) {
gotoAndPlay (7);
}
Symbol 192 MovieClip Frame 6
_parent._xscale = _parent._xscale * -1;
if (_parent._parent.kUp) {
play();
counter = counter + 5;
} else {
_root.addTrick("Spin", _root.REGULAR_TRICK, counter);
_parent.gotoAndStop("fast");
}
Symbol 192 MovieClip Frame 12
call(6);
Symbol 193 MovieClip Frame 1
counter = 0;
Symbol 193 MovieClip Frame 8
if (_parent._parent.bikerDirection(1) && (_parent._parent.k1)) {
gotoAndPlay (7);
counter++;
}
Symbol 193 MovieClip Frame 14
_root.addTrick("Peacock", _root.REGULAR_TRICK * (_totalframes - 1), counter);
_parent.gotoAndStop("fast");
Symbol 195 MovieClip Frame 1
counter = 0;
Symbol 195 MovieClip Frame 15
if (_parent._parent.kDown) {
gotoAndPlay (5);
counter = counter + 10;
}
Symbol 195 MovieClip Frame 20
_root.addTrick("Bar Spin", _root.REGULAR_TRICK * (_totalframes - 1), counter);
_parent.gotoAndStop("fast");
Symbol 196 MovieClip Frame 22
_root.addTrick("Flipster", _root.SPECIAL_TRICK * (_totalframes - 1));
_parent.gotoAndStop("fast");
Symbol 197 MovieClip Frame 44
_root.addTrick("Black Hole", _root.SPECIAL_TRICK * (_totalframes - 1));
_parent.gotoAndStop("fast");
Symbol 199 MovieClip Frame 1
counter = 0;
Symbol 199 MovieClip Frame 28
if (_parent._parent.bikerDirection(1) && (_parent._parent.k2)) {
counter = counter + 8;
gotoAndPlay (20);
}
Symbol 199 MovieClip Frame 34
_root.addTrick("Drill Bit", _root.SPECIAL_TRICK * (_totalframes - 1), counter);
_parent.gotoAndStop("fast");
Symbol 201 MovieClip Frame 21
_parent._xscale = _parent._xscale * -1;
Symbol 201 MovieClip Frame 25
_root.addTrick("Big Spin", _root.SPECIAL_TRICK * (_totalframes - 1));
_parent.gotoAndStop("fast");
Symbol 205 MovieClip Frame 1
wait = 10;
Symbol 205 MovieClip Frame 29
if (((0 < Math.abs(_root.speed)) || (0 < (--wait))) || (((_root.landRotation != 0) && (_root.tileNum != 8)) && (_root.tileNum != 9))) {
gotoAndPlay(_currentframe - 1);
}
Symbol 205 MovieClip Frame 99
_parent._xscale = _parent._xscale * -1;
_parent.gotoAndStop(1);
Symbol 211 MovieClip Frame 1
wait = 15;
Symbol 211 MovieClip Frame 26
if (((0 < Math.abs(_root.speed)) || (0 < (--wait))) || (((_root.landRotation != 0) && (_root.tileNum != 8)) && (_root.tileNum != 9))) {
gotoAndPlay(_currentframe - 1);
}
Symbol 211 MovieClip Frame 54
_parent.gotoAndStop(1);
Symbol 212 MovieClip Frame 1
wait = 30;
Symbol 212 MovieClip Frame 20
if (((0 < Math.abs(_root.speed)) || (0 < (--wait))) || (((_root.landRotation != 0) && (_root.tileNum != 8)) && (_root.tileNum != 9))) {
gotoAndPlay(_currentframe - 1);
}
Symbol 212 MovieClip Frame 49
tellTarget ("..") {
gotoAndStop (1);
};
Symbol 213 MovieClip Frame 13
gotoAndPlay (1);
Symbol 213 MovieClip Frame 14
wait = 20;
Symbol 213 MovieClip Frame 23
if ((((0 < Math.abs(_root.speed)) || (0 < (--wait))) || (((_root.landRotation != 0) && (_root.tileNum != 8)) && (_root.tileNum != 9))) || (_root.state == "air")) {
gotoAndPlay(_currentframe - 1);
}
Symbol 213 MovieClip Frame 52
_parent.gotoAndStop(1);
Symbol 214 MovieClip Frame 1
stop();
_parent.state = "ground";
_parent.keyHold = new Array(0, "");
Symbol 214 MovieClip Frame 15
_parent.keyHold = new Array(0, "");
Symbol 214 MovieClip Frame 54
player.counter = 0;
Symbol 225 MovieClip Frame 1
stop();
Symbol 225 MovieClip Frame 44
stop();
Symbol 225 MovieClip Frame 45
play();
Symbol 236 MovieClip Frame 1
stop();
Symbol 248 MovieClip Frame 1
stop();
Symbol 248 MovieClip Frame 121
gotoAndPlay (2);
Symbol 254 Button
on (press) {
_root.quit("charselect");
}
Symbol 259 Button
on (press) {
_root.toggleMusic();
}
Symbol 260 MovieClip Frame 18
stop();
Symbol 263 Button
on (release) {
getURL ("http://www.sikids.com/", "_blank");
}