Frame 1
function levelUp() {
level++;
if (numOfObstacles < maxObstacles) {
numOfObstacles++;
}
levelPointBonus = level * 500;
setupBoard();
activateHotspots();
gameInPlay = true;
}
function clearScreen() {
removeMovieClip("Board");
removeMovieClip("Interface");
}
function moveTile(tileNum) {
gameInPlay = false;
var _local5 = boardClips[tileNum];
Board["Tile" + _local5]._x = (whatColumn(emptySpace) * tileWidth) - tileWidth;
Board["Tile" + _local5]._y = (whatRow(emptySpace) * tileHeight) - tileHeight;
var _local7 = boardClips[emptySpace];
Board["Tile" + _local7]._x = (whatColumn(tileNum) * tileWidth) - tileWidth;
Board["Tile" + _local7]._y = (whatRow(tileNum) * tileHeight) - tileHeight;
if (Board["Tile" + _local5].myID == 2) {
if (carModel == 3) {
SFX.gotoAndPlay("SlideGus");
} else {
SFX.gotoAndPlay("SlideCar");
}
} else if (Board["Tile" + _local5].myID == 1) {
if (carModel == 3) {
SFX.gotoAndPlay("SlideRocks");
} else {
SFX.gotoAndPlay("SlideRoadblock");
}
} else {
SFX.gotoAndPlay("SlideBlank");
}
boardClips.splice(tileNum, 1, _local7);
boardClips.splice(emptySpace, 1, _local5);
emptySpace = tileNum;
var _local4 = false;
var _local1 = Board["Tile" + carTile];
var _local3 = 1;
while (_local3 <= (boardHeight * boardWidth)) {
var _local2 = Board["Tile" + boardClips[_local3]];
if (_local2.myID == 1) {
if (checkTiles(_local3, 2)) {
_local4 = true;
_local2.Tile.gotoAndStop(2);
_local1.Anim.gotoAndStop("Crash");
_local1.Tile.gotoAndStop(2);
stopAllSounds();
if (carModel < 3) {
SFX.gotoAndPlay("CarCrash");
} else {
SFX.gotoAndPlay("GusCrash");
}
Board.attachMovie("crash", "Crash", 1000);
if (_local2._x > _local1._x) {
Board.Crash._x = _local2._x;
} else if (_local2._x < _local1._x) {
Board.Crash._x = _local1._x;
} else {
Board.Crash._x = _local1._x + (tileWidth / 2);
}
if (_local2._y > _local1._y) {
Board.Crash._y = _local2._y;
} else if (_local2._y < _local1._y) {
Board.Crash._y = _local1._y;
} else {
Board.Crash._y = _local1._y + (tileHeight / 2);
}
Board.gotoAndPlay("Crash");
gotoAndPlay ("GameOver");
}
}
_local3++;
}
if (!_local4) {
if (boardClips[finishTile] == carTile) {
_local1.Anim.gotoAndPlay("DriveOut");
Board.TileFinish.Anim.play();
addTime(levelSecsBonus);
score = score + levelPointBonus;
Interface.secsBonusText = ("+ " + levelSecsBonus) + " SECONDS";
Interface.pointBonusText = ("+ " + levelPointBonus) + " POINTS";
Interface.gotoAndPlay("WinLevel");
} else {
activateHotspots();
gameInPlay = true;
}
}
}
function setupBoard() {
var _local1 = 1;
while (_local1 <= (boardHeight * boardWidth)) {
Board["Hotspot" + _local1].myID = _local1;
_local1++;
}
boardTiles = [0];
_local1 = 1;
while (_local1 <= (boardHeight * boardWidth)) {
boardTiles.push(8);
_local1++;
}
startTile = (randInt(1, boardHeight) * boardHeight) - (boardHeight - 1);
finishTile = randInt(1, boardHeight) * boardHeight;
boardTiles.splice(startTile, 1, 2);
var _local9 = whatRow(startTile);
if (_local9 == 1) {
var _local7 = 1;
} else {
var _local7 = _local9 - 1;
}
if (_local9 == boardHeight) {
var _local8 = boardHeight;
} else {
var _local8 = _local9 + 1;
}
var _local10 = whatColumn(startTile);
var _local6 = _local10;
var _local5 = _local10 + 1;
_local1 = _local7;
while (_local1 <= _local8) {
var _local2 = _local6;
while (_local2 <= _local5) {
var _local3 = whatNumber(_local2, _local1);
if (_local3 != startTile) {
boardTiles.splice(_local3, 1, 0);
}
_local2++;
}
_local1++;
}
var _local4 = [];
_local1 = 1;
while (_local1 <= ((boardHeight * boardWidth) - 1)) {
if (boardTiles[_local1] == 8) {
_local4.push(_local1);
}
_local1++;
}
shuffle(_local4);
_local1 = 1;
while (_local1 <= numOfObstacles) {
boardTiles.splice(_local4[_local1], 1, 1);
_local1++;
}
_local1 = 1;
while (_local1 < (boardTiles.length - 1)) {
if (boardTiles[_local1] == 8) {
boardTiles.splice(_local1, 1, 0);
}
_local1++;
}
boardClips = [0];
_local1 = 1;
while (_local1 <= (boardHeight * boardWidth)) {
Board.attachMovie("tiletype" + boardTiles[_local1], "Tile" + _local1, _local1 + 10);
var _local3 = Board["Tile" + _local1];
_local3._x = (whatColumn(_local1) * tileWidth) - tileWidth;
_local3._y = (whatRow(_local1) * tileHeight) - tileHeight;
_local3.myID = boardTiles[_local1];
if (_local3.myID == 1) {
_local3.gotoAndStop(carModel);
}
if (_local3.myID == 2) {
_local3.gotoAndStop(carModel);
carTile = _local1;
}
boardClips.push(_local1);
_local1++;
}
Board.attachMovie("tilestart", "TileStart", 1);
Board.TileStart._x = (whatColumn(startTile) * tileWidth) - tileWidth;
Board.TileStart._y = (whatRow(startTile) * tileHeight) - tileHeight;
Board.attachMovie("tilefinish", "TileFinish", 2);
Board.TileFinish._x = (whatColumn(finishTile) * tileWidth) - tileWidth;
Board.TileFinish._y = (whatRow(finishTile) * tileHeight) - tileHeight;
Board.TileFinish.gotoAndStop(carModel);
emptySpace = 36;
}
function activateHotspots() {
var _local1 = 1;
while (_local1 <= (boardHeight * boardWidth)) {
var _local3 = Board["Tile" + boardClips[_local1]];
var _local2 = Board["Hotspot" + _local1];
if (_local3.myID != 8) {
if (checkTiles(_local1, 8)) {
_local2.gotoAndStop("Active");
} else {
_local2.gotoAndStop("Inactive");
}
} else {
_local2.gotoAndStop("Inactive");
}
_local1++;
}
}
function checkTiles(tileNum, searchTile) {
var _local3 = [];
var _local7 = whatRow(tileNum);
var _local8 = whatColumn(tileNum);
if (_local7 != 1) {
_local3.push(tileNum - boardWidth);
}
if (_local7 != boardHeight) {
_local3.push(tileNum + boardWidth);
}
if (_local8 != 1) {
_local3.push(tileNum - 1);
}
if (_local8 != boardWidth) {
_local3.push(tileNum + 1);
}
var _local4 = false;
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = Board["Tile" + boardClips[_local3[_local1]]];
if (_local2.myID == searchTile) {
_local4 = true;
}
_local1++;
}
if (_local4) {
return(true);
}
return(false);
}
function addTime(secsAdded) {
minutesLeft = minutesLeft + Math.floor(secsAdded / 60);
secondsLeft = secondsLeft + (secsAdded % 60);
minutesLeft = minutesLeft + Math.floor(secondsLeft / 60);
secondsLeft = secondsLeft % 60;
}
function decrementTimer() {
if (secondsLeft == 0) {
if (minutesLeft == 0) {
clearInterval(timerCode);
stopAllSounds();
SFX.gotoAndPlay("TimeOut");
gotoAndPlay ("GameOver");
} else {
secondsLeft = 59;
minutesLeft--;
}
} else {
secondsLeft--;
}
}
function setTimerDigits(theMins, theSecs, theClip) {
minutesText = String(theMins);
secondsText = String(theSecs);
if (minutesText.length < 2) {
theClip.mins1 = "";
theClip.mins2 = minutesText;
} else {
theClip.mins1 = minutesText.substr(0, 1);
theClip.mins2 = minutesText.substr(1, 1);
}
if (secondsText.length < 2) {
theClip.secs1 = "0";
theClip.secs2 = secondsText;
} else {
theClip.secs1 = secondsText.substr(0, 1);
theClip.secs2 = secondsText.substr(1, 1);
}
if ((theMins <= freakOutMins) && (theSecs <= freakOutSecs)) {
theClip.gotoAndStop("FreakOut");
} else {
theClip.gotoAndStop("Normal");
}
}
function whatNumber(theColumn, theRow) {
var _local1 = ((theRow - 1) * boardWidth) + theColumn;
return(_local1);
}
function whatRow(theTile) {
var _local1 = Math.ceil(theTile / boardWidth);
return(_local1);
}
function whatColumn(theTile) {
var _local1 = theTile % boardWidth;
if (_local1 == 0) {
_local1 = boardWidth;
}
return(_local1);
}
function randInt(num0, num1) {
if (arguments.length == 1) {
return(Math.round(Math.random() * num0));
}
return(Math.round(Math.random() * Math.abs(num0 - num1)) + num0);
}
function shuffle(theArray) {
i = 0;
while (i < (theArray.length - 1)) {
var _local2 = Math.round(Math.random() * i);
var _local3 = theArray[i];
theArray[i] = theArray[_local2];
theArray[_local2] = _local3;
i++;
}
return(theArray);
}
stop();
fscommand ("allowscale", false);
funcHITBOX = function (arEvent, arAction) {
lString = ((("javascript: _hbLink ('/flash/" + arEvent.toLowerCase()) + "/") + arAction.toLowerCase()) + "','left','0,0,0,0')";
getURL (lString);
};
Frame 10
stop();
var cheatCodes = ["MORETIME", "NEWRIDE", "GUSVSBUS"];
var defaultText = "";
var codeInput = defaultText;
var activeCode = null;
CodeEntry.codeField.restrict = "A-Z 0-9";
Frame 20
stop();
Frame 30
var score = 0;
var level = 1;
var numOfObstacles = 4;
var maxObstacles = 40;
var levelPointBonus = 500;
var levelSecsBonus = 30;
var minutesLeft = 2;
var secondsLeft = 0;
var freakOutMins = 0;
var freakOutSecs = 20;
var timerUnit = 1000;
var boardWidth = 6;
var boardHeight = 6;
var tileWidth = 60;
var tileHeight = 60;
var startTile = 0;
var finishTile = 0;
var boardTiles = [];
var boardClips = [];
var emptySpace = 0;
var carTile = 0;
var carModel = 1;
if (activeCode != null) {
if (activeCode == "MORETIME") {
minutesLeft = 4;
} else if (activeCode == "NEWRIDE") {
carModel = 2;
} else if (activeCode == "GUSVSBUS") {
carModel = 3;
}
}
attachMovie("interface", "Interface", 1000);
gotoAndPlay ("Play");
Frame 40
attachMovie("board", "Board", 1);
Board._x = 146;
Board._y = 20;
setupBoard();
setTimerDigits(_root.minutesLeft, _root.secondsLeft, Interface.GameTimer);
Interface.gotoAndPlay("Begin");
activateHotspots();
Interface.onEnterFrame = function () {
if (gameInPlay) {
_root.setTimerDigits(_root.minutesLeft, _root.secondsLeft, Interface.GameTimer);
}
};
stop();
Frame 51
gameInPlay = false;
clearInterval(timerCode);
Interface.gotoAndPlay("GameOver");
stop();
Symbol 2 MovieClip [crash] Frame 7
removeMovieClip(this);
Symbol 5 MovieClip Frame 1
stop();
Symbol 11 MovieClip Frame 29
_root.SFX.gotoAndPlay("DriveIn");
Symbol 11 MovieClip Frame 30
stop();
Symbol 11 MovieClip Frame 40
stop();
Symbol 11 MovieClip Frame 50
_root.SFX.gotoAndPlay("DriveOut");
Symbol 11 MovieClip Frame 90
stop();
Symbol 15 MovieClip Frame 29
_root.SFX.gotoAndPlay("DriveIn");
Symbol 15 MovieClip Frame 30
stop();
Symbol 15 MovieClip Frame 40
stop();
Symbol 15 MovieClip Frame 50
_root.SFX.gotoAndPlay("DriveOut");
Symbol 15 MovieClip Frame 90
stop();
Symbol 25 MovieClip Frame 1
_root.SFX.gotoAndPlay("SlideGus");
Symbol 25 MovieClip Frame 30
stop();
Symbol 25 MovieClip Frame 40
stop();
Symbol 25 MovieClip Frame 50
_root.SFX.gotoAndPlay("SlideGus");
Symbol 25 MovieClip Frame 90
stop();
Symbol 26 MovieClip [tiletype2] Frame 1
stop();
Symbol 26 MovieClip [tiletype2] Frame 5
stop();
Symbol 33 MovieClip [tiletype1] Frame 1
stop();
Symbol 39 Button
on (release) {
if (_root.gameInPlay) {
_root.moveTile(this.myID);
}
}
Symbol 40 MovieClip Frame 1
Hotspot.useHandCursor = false;
stop();
Symbol 40 MovieClip Frame 11
stop();
Symbol 41 MovieClip [board] Frame 1
stop();
Symbol 41 MovieClip [board] Frame 5
_root.SFX.gotoAndPlay("Fall");
this._x = this._x - 2;
Symbol 41 MovieClip [board] Frame 6
this._x = this._x + 2;
Symbol 41 MovieClip [board] Frame 7
this._x = this._x + 2;
Symbol 41 MovieClip [board] Frame 8
this._x = this._x - 2;
Symbol 41 MovieClip [board] Frame 9
this._x = this._x - 2;
Symbol 41 MovieClip [board] Frame 10
this._x = this._x + 2;
Symbol 41 MovieClip [board] Frame 11
this._x = this._x + 2;
Symbol 41 MovieClip [board] Frame 12
this._x = this._x - 2;
Symbol 41 MovieClip [board] Frame 13
this._x = this._x - 2;
Symbol 41 MovieClip [board] Frame 14
this._x = this._x + 2;
Symbol 41 MovieClip [board] Frame 15
this._x = this._x + 2;
Symbol 41 MovieClip [board] Frame 16
this._x = this._x - 2;
Symbol 64 MovieClip Frame 1
if (!_root.gameInPlay) {
stop();
}
Symbol 65 MovieClip Frame 1
stop();
Symbol 65 MovieClip Frame 10
stop();
Symbol 83 Button
on (press) {
stopAllSounds();
_root.SFX.gotoAndPlay("Click");
_root.gotoAndStop("Title");
_root.clearScreen();
}
Symbol 84 MovieClip [interface] Frame 1
stop();
Symbol 84 MovieClip [interface] Frame 9
_root.SFX.gotoAndPlay("Ready");
Symbol 84 MovieClip [interface] Frame 44
_root.SFX.gotoAndPlay("Set");
Symbol 84 MovieClip [interface] Frame 79
_root.SFX.gotoAndPlay("Go");
_root.gameInPlay = true;
_root.timerCode = setInterval(_root.decrementTimer, _root.timerUnit);
Symbol 84 MovieClip [interface] Frame 84
_root.SFX.gotoAndPlay("StartMusic");
Symbol 84 MovieClip [interface] Frame 120
gotoAndStop (1);
Symbol 84 MovieClip [interface] Frame 129
_root.SFX.gotoAndPlay("WinLevel");
Symbol 84 MovieClip [interface] Frame 192
_root.levelUp();
gotoAndStop (1);
Symbol 84 MovieClip [interface] Frame 230
stop();
Symbol 87 MovieClip Frame 1
stop();
Symbol 87 MovieClip Frame 40
_root.SFX.gotoAndPlay("DriveOut");
Symbol 87 MovieClip Frame 60
stop();
Symbol 88 MovieClip [tilefinish] Frame 1
stop();
Symbol 97 Button
on (press) {
_root.SFX.gotoAndPlay("Click");
_root.funcHITBOX("instructions", "view_instructions");
gotoAndPlay ("HowTo");
}
Symbol 102 Button
on (press) {
_root.SFX.gotoAndPlay("Click");
gotoAndPlay ("EnterCode");
}
Symbol 125 MovieClip Frame 1
stop();
Symbol 125 MovieClip Frame 6
gotoAndStop (1);
Symbol 125 MovieClip Frame 16
gotoAndStop (1);
Symbol 125 MovieClip Frame 26
gotoAndStop (1);
Symbol 125 MovieClip Frame 36
gotoAndStop (1);
Symbol 125 MovieClip Frame 46
gotoAndStop (1);
Symbol 125 MovieClip Frame 56
gotoAndStop (1);
Symbol 125 MovieClip Frame 66
gotoAndStop (1);
Symbol 125 MovieClip Frame 76
gotoAndStop (1);
Symbol 125 MovieClip Frame 86
gotoAndStop (1);
Symbol 125 MovieClip Frame 96
gotoAndStop (1);
Symbol 125 MovieClip Frame 106
gotoAndStop (1);
Symbol 125 MovieClip Frame 116
gotoAndStop (1);
Symbol 125 MovieClip Frame 126
gotoAndStop (1);
Symbol 125 MovieClip Frame 136
gotoAndStop (1);
Symbol 125 MovieClip Frame 146
gotoAndStop (1);
Symbol 125 MovieClip Frame 156
gotoAndStop (1);
Symbol 125 MovieClip Frame 166
gotoAndStop (1);
Symbol 127 Button
on (press) {
_root.SFX.gotoAndPlay("Click");
_root.funcHITBOX("play_activity", "play_from_code");
gotoAndPlay ("Start");
}
Symbol 134 Button
on (press) {
_root.SFX.gotoAndPlay("Click");
var match = false;
var i = 0;
while (i < _root.cheatCodes.length) {
var theCode = _root.cheatCodes[i];
if (_root.codeInput == theCode) {
match = true;
break;
}
i++;
}
if (match == true) {
_root.funcHITBOX("misc", "valid_code_" + _root.codeInput);
gotoAndPlay ("Valid");
} else {
gotoAndPlay ("Invalid");
}
}
Symbol 137 MovieClip Frame 1
play();
Symbol 137 MovieClip Frame 2
Selection.setFocus("codeField");
stop();
Symbol 137 MovieClip Frame 10
_root.activeCode = _root.codeInput;
stop();
Symbol 137 MovieClip Frame 20
_root.activeCode = null;
Symbol 138 Button
on (press) {
_root.SFX.gotoAndPlay("Click");
_root.funcHITBOX("play_activity", "play_from_instructions");
gotoAndPlay ("Start");
}