Frame 1
com.novelgames.flashgames.common.MainDevelopment.initialize(this);
Symbol 7 MovieClip [taxi] Frame 1
#initclip 22
Object.registerClass("taxi", com.novelgames.flashgames.taxi.Taxi);
#endinitclip
Symbol 13 MovieClip [car] Frame 1
#initclip 13
Object.registerClass("car", com.novelgames.flashgames.taxi.Car);
#endinitclip
Symbol 15 MovieClip [thing] Frame 1
#initclip 14
Object.registerClass("thing", com.novelgames.flashgames.taxi.RoadObject);
#endinitclip
Symbol 17 MovieClip [flag] Frame 1
#initclip 15
Object.registerClass("flag", com.novelgames.flashgames.taxi.RoadObject);
#endinitclip
Symbol 31 MovieClip [message] Frame 1
#initclip 16
Object.registerClass("message", com.novelgames.flashgames.taxi.Message);
#endinitclip
Symbol 31 MovieClip [message] Frame 20
levelFinished();
Symbol 31 MovieClip [message] Frame 35
timeUpFinished();
Symbol 35 MovieClip [muteButton] Frame 1
#initclip 17
Object.registerClass("muteButton", com.novelgames.flashgames.common.MuteButton);
#endinitclip
Symbol 36 MovieClip [things] Frame 1
#initclip 18
Object.registerClass("things", com.novelgames.flashgames.taxi.Things);
#endinitclip
Symbol 37 MovieClip [marks] Frame 1
#initclip 19
Object.registerClass("marks", com.novelgames.flashgames.taxi.Marks);
#endinitclip
Symbol 40 MovieClip [shadow] Frame 1
#initclip 20
Object.registerClass("shadow", com.novelgames.flashgames.taxi.RoadObject);
#endinitclip
Symbol 51 MovieClip [game] Frame 1
#initclip 21
Object.registerClass("game", com.novelgames.flashgames.taxi.Game);
#endinitclip
Symbol 63 MovieClip [__Packages.com.novelgames.flashgames.common.MainDevelopment] Frame 0
class com.novelgames.flashgames.common.MainDevelopment extends MovieClip
{
var gotoAndStop, startButton, highScoresButton, moreGamesButton;
function MainDevelopment () {
super();
}
static function initialize(movieClip) {
movieClip.__proto__ = com.novelgames.flashgames.common.MainDevelopment.prototype;
movieClip.gotoTitlePage();
}
function gotoTitlePage() {
(gotoAndStop("title"));// not popped
startButton.onRelease = function () {
this._parent.gotoInstructionsPage();
};
highScoresButton.onRelease = function () {
this._parent.showHighScores();
};
moreGamesButton.onRelease = function () {
this._parent.getURL("http://www.novelgames.com", "_blank");
};
}
function gotoInstructionsPage() {
(gotoAndStop("instructions"));// not popped
startButton.onRelease = function () {
this._parent.gotoGamePage();
};
}
function gotoGamePage() {
(gotoAndStop("game"));// not popped
}
function showHighScores() {
trace("showHighScores()");
}
function showEnterHighScore(score) {
trace(("showEnterHighScore(" + score) + ")");
}
}
Symbol 64 MovieClip [__Packages.com.novelgames.flashgames.taxi.RoadObject] Frame 0
class com.novelgames.flashgames.taxi.RoadObject extends MovieClip
{
var x, y, z, _x, _y, _xscale, _yscale;
function RoadObject () {
super();
x = (y = (z = 0));
}
function setPosition(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
updatePosition();
}
function updatePosition() {
var _local2 = getXYScale(x, y, z);
_x = _local2.x;
_y = _local2.y;
_xscale = _local2.scale * 100;
_yscale = _local2.scale * 100;
}
static function getXYScale(x, y, z) {
var _local1 = new Object();
_local1.scale = (com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_HEIGHT / (((com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_HEIGHT - y) * com.novelgames.flashgames.taxi.Config.ROAD_1OVERWIDTH0) + (y * com.novelgames.flashgames.taxi.Config.ROAD_1OVERWIDTH1))) * com.novelgames.flashgames.taxi.Config.ROAD_1OVERWIDTH1;
_local1.x = ((com.novelgames.flashgames.taxi.Config.ROAD_X10 + com.novelgames.flashgames.taxi.Config.ROAD_X11) / 2) + ((((x - (com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_WIDTH / 2)) * com.novelgames.flashgames.taxi.Config.ROAD_WIDTH1) / com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_WIDTH) * _local1.scale);
_local1.y = (((((com.novelgames.flashgames.taxi.Config.ROAD_Y1 - com.novelgames.flashgames.taxi.Config.ROAD_Y0) * _local1.scale) + com.novelgames.flashgames.taxi.Config.ROAD_Y0) - (com.novelgames.flashgames.taxi.Config.ROAD_WIDTHSCALE * com.novelgames.flashgames.taxi.Config.ROAD_Y1)) / (1 - com.novelgames.flashgames.taxi.Config.ROAD_WIDTHSCALE)) - (z * _local1.scale);
return(_local1);
}
}
Symbol 65 MovieClip [__Packages.com.novelgames.flashgames.taxi.Config] Frame 0
class com.novelgames.flashgames.taxi.Config
{
function Config () {
}
static var ROAD_X00 = 290;
static var ROAD_X01 = 310;
static var ROAD_X10 = 0;
static var ROAD_X11 = 600;
static var ROAD_WIDTH0 = ROAD_X01 - ROAD_X00;
static var ROAD_WIDTH1 = ROAD_X11 - ROAD_X10;
static var ROAD_1OVERWIDTH0 = 1 / ROAD_WIDTH0;
static var ROAD_1OVERWIDTH1 = 1 / ROAD_WIDTH1;
static var ROAD_WIDTHSCALE = (ROAD_X01 - ROAD_X00) / (ROAD_X11 - ROAD_X10);
static var ROAD_Y0 = 110;
static var ROAD_Y1 = 400;
static var ROADVIRTUAL_WIDTH = 600;
static var ROADVIRTUAL_HEIGHT = 1000;
static var ROADVIRTUAL_MAXY = (ROAD_WIDTH1 * ROADVIRTUAL_HEIGHT) / (ROAD_WIDTH1 - ROAD_WIDTH0);
static var NOOFLANES = 3;
static var MARK_COLOUR = 16777215;
static var MARK_WIDTH = 10;
static var MARK_HEIGHT = 20;
static var MARK_SPACING = 20;
static var TAXI_INITIALLANE = 1;
static var TAXI_Y = ROADVIRTUAL_HEIGHT - 10;
static var TAXI_INITIALSPEED = 0;
static var TAXI_MINSPEED = 0;
static var TAXI_MAXSPEED = 300;
static var TAXI_ACCELERATION = 100;
static var TAXI_CHANGELANESPEED = 2000;
static var TAXI_JUMPHEIGHT = 150;
static var TAXI_JUMPTIME = 500;
static var TAXI_WIDTH = 150;
static var TAXI_LENGTH = 5;
static var TAXI_CRASHBOUNCE = 10;
static var TAXI_CRASHSPEEDLOST = 50;
static var CAR_COLOURS = [16711680, 65280, 255, 16750848, 10027161];
static var CAR_SPEED = 50;
static var CAR_WIDTH = 150;
static var CAR_LENGTH = 5;
static var CAR_HEIGHT = 50;
static var CAR_MINSPACING = 100;
static var CAR_MINGROUPSPACING = 400;
static var CAR_SPARKLEFT = -55;
static var CAR_SPARKRIGHT = 55;
static var CAR_SPARKSHOWTIME = 500;
static var THING_LEFTMINX = -100;
static var THING_LEFTMAXX = -50;
static var THING_RIGHTMINX = 650;
static var THING_RIGHTMAXX = 700;
static var THING_MINSPACING = 300;
static var THING_MAXSPACING = 800;
static var THING_FLAGONLEFT = false;
static var THING_FLAGONRIGHT = true;
static var THING_FLAGLEFTX = -30;
static var THING_FLAGRIGHTX = 630;
static var LEVEL_LENGTH = 5000;
static var LEVEL_INITIALTIME = 30;
static var LEVEL_MINTIME = 18;
static var LEVEL_TIMEDECREASE = 1;
static var LEVEL_INITIALGROUPSIZE = 2;
static var LEVEL_GROUPSIZEINCREASE = 1;
static var SCORE_TIME = 0.5;
static var SCORE_LEVEL = 2000;
}
Symbol 66 MovieClip [__Packages.com.novelgames.flashgames.taxi.Car] Frame 0
class com.novelgames.flashgames.taxi.Car extends com.novelgames.flashgames.taxi.RoadObject
{
var colour, sparkFront, sparkBack, y, _parent, updatePosition, intervalID;
function Car () {
super();
new Color(colour).setRGB(com.novelgames.flashgames.taxi.Config.CAR_COLOURS[Math.floor(Math.random() * com.novelgames.flashgames.taxi.Config.CAR_COLOURS.length)]);
sparkFront.gotoAndStop(1);
sparkBack.gotoAndStop(1);
}
function move(seconds) {
y = y + ((_parent._parent.taxiSpeed - com.novelgames.flashgames.taxi.Config.CAR_SPEED) * seconds);
updatePosition();
}
function showSpark(direction, atFront) {
var _local2 = (atFront ? (sparkFront) : (sparkBack));
hideSparks();
if (direction < 0) {
_local2._x = com.novelgames.flashgames.taxi.Config.CAR_SPARKLEFT;
} else if (direction > 0) {
_local2._x = com.novelgames.flashgames.taxi.Config.CAR_SPARKRIGHT;
} else {
_local2._x = 0;
}
_local2.gotoAndStop(2);
intervalID = setInterval(this, "hideSparks", com.novelgames.flashgames.taxi.Config.CAR_SPARKSHOWTIME);
}
function hideSparks() {
sparkFront.gotoAndStop(1);
sparkBack.gotoAndStop(1);
clearInterval(intervalID);
}
}
Symbol 67 MovieClip [__Packages.com.novelgames.flashgames.taxi.Message] Frame 0
class com.novelgames.flashgames.taxi.Message extends MovieClip
{
var gotoAndPlay, level, time, gotoAndStop, stop, playAgainButton, _parent;
function Message () {
super();
}
function showLevel(level, time) {
(gotoAndPlay("level"));// not popped
this.level = level;
this.time = time;
}
function showTimeUp() {
(gotoAndPlay("timeUp"));// not popped
}
function levelFinished() {
(gotoAndStop("hide"));// not popped
}
function timeUpFinished() {
(stop());// not popped
playAgainButton.onRelease = function () {
this._parent._parent._parent.gotoTitlePage();
};
_parent.showEnterHighScore();
}
}
Symbol 68 MovieClip [__Packages.com.novelgames.flashgames.common.MuteButton] Frame 0
class com.novelgames.flashgames.common.MuteButton extends MovieClip
{
var gotoAndStop;
function MuteButton () {
super();
if (com.novelgames.flashgames.common.NewSound.getIsMuteAll()) {
showOff();
} else {
showOn();
}
}
function onPress() {
if (com.novelgames.flashgames.common.NewSound.getIsMuteAll()) {
com.novelgames.flashgames.common.NewSound.unmuteAll();
showOn();
} else {
com.novelgames.flashgames.common.NewSound.muteAll();
showOff();
}
}
function showOff() {
(gotoAndStop("off"));// not popped
}
function showOn() {
(gotoAndStop("on"));// not popped
}
}
Symbol 69 MovieClip [__Packages.com.novelgames.flashgames.common.NewSound] Frame 0
class com.novelgames.flashgames.common.NewSound extends Sound
{
var attachSound, setVolume, target, symbolName;
function NewSound (target, symbolName) {
super(target);
var _local3;
attachSound(symbolName);
setVolume(volumeAll);
this.target = target;
this.symbolName = symbolName;
sounds.push(this);
_local3 = 0;
while (_local3 < sounds.length) {
if (sounds[_local3] == this) {
} else if ((sounds[_local3].target == target) && (sounds[_local3].symbolName == symbolName)) {
sounds.splice(_local3, 1);
_local3--;
}
_local3++;
}
}
static function setVolumeAll(volume) {
var _local1;
volumeAll = volume;
_local1 = 0;
while (_local1 < sounds.length) {
sounds[_local1].setVolume(volume);
_local1++;
}
}
static function muteAll() {
setVolumeAll(0);
}
static function unmuteAll() {
setVolumeAll(100);
}
static function getIsMuteAll() {
return(volumeAll == 0);
}
static var sounds = new Array();
static var volumeAll = 100;
}
Symbol 70 MovieClip [__Packages.com.novelgames.flashgames.taxi.Things] Frame 0
class com.novelgames.flashgames.taxi.Things extends MovieClip
{
var y, leftThingPositions, rightThingPositions, leftThings, rightThings, _parent, getNextHighestDepth, attachMovie;
function Things () {
super();
y = com.novelgames.flashgames.taxi.Config.TAXI_Y - com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH;
leftThingPositions = new Array();
rightThingPositions = new Array();
generateThingPositions(com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH);
generateThingPositions(0);
leftThings = new Array();
rightThings = new Array();
createThings();
}
function move(seconds) {
moveOffset(seconds * _parent.taxiSpeed);
}
function moveOffset(offset) {
var _local2;
y = y + offset;
_local2 = 0;
while (_local2 < leftThings.length) {
leftThings[_local2].y = leftThings[_local2].y + offset;
leftThings[_local2].updatePosition();
if (leftThings[_local2].y >= com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_MAXY) {
leftThings[_local2].removeMovieClip();
leftThings.splice(_local2, 1);
leftThingPositions.splice(_local2, 1);
_local2--;
}
_local2++;
}
_local2 = 0;
while (_local2 < rightThings.length) {
rightThings[_local2].y = rightThings[_local2].y + offset;
rightThings[_local2].updatePosition();
if (rightThings[_local2].y >= com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_MAXY) {
rightThings[_local2].removeMovieClip();
rightThings.splice(_local2, 1);
rightThingPositions.splice(_local2, 1);
_local2--;
}
_local2++;
}
if (y >= com.novelgames.flashgames.taxi.Config.TAXI_Y) {
y = y - com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH;
_local2 = 0;
while (_local2 < leftThingPositions.length) {
leftThingPositions[_local2] = leftThingPositions[_local2] + com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH;
_local2++;
}
_local2 = 0;
while (_local2 < rightThingPositions.length) {
rightThingPositions[_local2] = rightThingPositions[_local2] + com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH;
_local2++;
}
generateThingPositions(0);
}
createThings();
}
function generateThingPositions(y) {
var _local2;
var _local3;
var _local4;
if (com.novelgames.flashgames.taxi.Config.THING_FLAGONLEFT) {
leftThingPositions.push(y);
}
_local2 = y;
while (_local2 >= ((y - com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH) + com.novelgames.flashgames.taxi.Config.THING_MAXSPACING)) {
_local3 = _local2 - com.novelgames.flashgames.taxi.Config.THING_MAXSPACING;
_local4 = _local2 - com.novelgames.flashgames.taxi.Config.THING_MINSPACING;
_local2 = _local3 + (Math.random() * (_local4 - _local3));
leftThingPositions.push(_local2);
}
if (com.novelgames.flashgames.taxi.Config.THING_FLAGONRIGHT) {
rightThingPositions.push(y);
}
_local2 = y;
while (_local2 >= ((y - com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH) + com.novelgames.flashgames.taxi.Config.THING_MAXSPACING)) {
_local3 = _local2 - com.novelgames.flashgames.taxi.Config.THING_MAXSPACING;
_local4 = _local2 - com.novelgames.flashgames.taxi.Config.THING_MINSPACING;
_local2 = _local3 + (Math.random() * (_local4 - _local3));
rightThingPositions.push(_local2);
}
}
function createThings() {
var _local6;
var _local5;
var _local4;
var _local7;
var _local8;
var _local3;
var _local2;
_local2 = leftThings.length;
while (_local2 < leftThingPositions.length) {
if ((y + leftThingPositions[_local2]) < 0) {
break;
}
if ((leftThingPositions[_local2] % com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH) == 0) {
_local6 = com.novelgames.flashgames.taxi.Config.THING_FLAGLEFTX;
_local5 = y + leftThingPositions[_local2];
_local4 = "flag";
} else {
_local6 = com.novelgames.flashgames.taxi.Config.THING_LEFTMINX + (Math.random() * (com.novelgames.flashgames.taxi.Config.THING_LEFTMAXX - com.novelgames.flashgames.taxi.Config.THING_LEFTMINX));
_local5 = y + leftThingPositions[_local2];
_local4 = "thing";
}
_local7 = getNextHighestDepth();
_local8 = attachMovie(_local4, "thing" + _local7, _local7);
_local3 = _local8;
_local3.x = _local6;
_local3.y = _local5;
_local3.updatePosition();
leftThings.push(_local3);
_local2++;
}
_local2 = rightThings.length;
while (_local2 < rightThingPositions.length) {
if ((y + rightThingPositions[_local2]) < 0) {
break;
}
if ((rightThingPositions[_local2] % com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH) == 0) {
_local6 = com.novelgames.flashgames.taxi.Config.THING_FLAGRIGHTX;
_local5 = y + rightThingPositions[_local2];
_local4 = "flag";
} else {
_local6 = com.novelgames.flashgames.taxi.Config.THING_RIGHTMINX + (Math.random() * (com.novelgames.flashgames.taxi.Config.THING_RIGHTMAXX - com.novelgames.flashgames.taxi.Config.THING_RIGHTMINX));
_local5 = y + rightThingPositions[_local2];
_local4 = "thing";
}
_local7 = getNextHighestDepth();
_local8 = attachMovie(_local4, "thing" + _local7, _local7);
_local3 = _local8;
_local3.x = _local6;
_local3.y = _local5;
_local3.updatePosition();
rightThings.push(_local3);
_local2++;
}
}
}
Symbol 71 MovieClip [__Packages.com.novelgames.flashgames.taxi.Marks] Frame 0
class com.novelgames.flashgames.taxi.Marks extends MovieClip
{
var y, _parent, clear, beginFill, moveTo, lineTo, endFill;
function Marks () {
super();
y = 0;
updateMarks();
}
function move(seconds) {
y = (y + (_parent.taxiSpeed * seconds)) % (com.novelgames.flashgames.taxi.Config.MARK_HEIGHT + com.novelgames.flashgames.taxi.Config.MARK_SPACING);
updateMarks();
}
function setY(y) {
this.y = y % (com.novelgames.flashgames.taxi.Config.MARK_HEIGHT + com.novelgames.flashgames.taxi.Config.MARK_SPACING);
if (this.y < 0) {
this.y = this.y + (com.novelgames.flashgames.taxi.Config.MARK_HEIGHT + com.novelgames.flashgames.taxi.Config.MARK_SPACING);
}
updateMarks();
}
function updateMarks() {
var _local2;
var _local3;
var _local4;
var _local7;
var _local8;
var _local6;
var _local5;
clear();
beginFill(com.novelgames.flashgames.taxi.Config.MARK_COLOUR);
_local6 = y;
while (_local6 < com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_HEIGHT) {
_local5 = 1;
while (_local5 < com.novelgames.flashgames.taxi.Config.NOOFLANES) {
_local8 = (_local5 * com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_WIDTH) / com.novelgames.flashgames.taxi.Config.NOOFLANES;
_local2 = com.novelgames.flashgames.taxi.RoadObject.getXYScale(_local8, _local6, 0);
_local3 = com.novelgames.flashgames.taxi.RoadObject.getXYScale(_local8, Math.min(_local6 + com.novelgames.flashgames.taxi.Config.MARK_HEIGHT, com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_HEIGHT), 0);
_local4 = _local2.scale * com.novelgames.flashgames.taxi.Config.MARK_WIDTH;
_local7 = _local3.scale * com.novelgames.flashgames.taxi.Config.MARK_WIDTH;
moveTo(_local2.x - (_local4 / 2), _local2.y);
lineTo(_local2.x + (_local4 / 2), _local2.y);
lineTo(_local3.x + (_local7 / 2), _local3.y);
lineTo(_local3.x - (_local7 / 2), _local3.y);
lineTo(_local2.x - (_local4 / 2), _local2.y);
_local5++;
}
_local6 = _local6 + (com.novelgames.flashgames.taxi.Config.MARK_HEIGHT + com.novelgames.flashgames.taxi.Config.MARK_SPACING);
}
endFill();
}
}
Symbol 72 MovieClip [__Packages.com.novelgames.flashgames.taxi.Game] Frame 0
class com.novelgames.flashgames.taxi.Game extends MovieClip
{
var taxiSpeed, score, cars, soundSteer, soundJump, soundCrash, soundCheckPoint, soundGameOver, lastMoveTime, intervalID, _parent, taxi, carsHolder, taxiShadow, maxGroupSize, currentGroupSize, marks, things, checkPointY, level, levelTime, levelStartTime, distance, time, message;
function Game () {
super();
taxiSpeed = com.novelgames.flashgames.taxi.Config.TAXI_INITIALSPEED;
score = 0;
cars = new Array();
createTaxi();
startLevel(1);
soundSteer = new com.novelgames.flashgames.common.NewSound(this, "soundSteer");
soundJump = new com.novelgames.flashgames.common.NewSound(this, "soundJump");
soundCrash = new com.novelgames.flashgames.common.NewSound(this, "soundCrash");
soundCheckPoint = new com.novelgames.flashgames.common.NewSound(this, "soundCheckPoint");
soundGameOver = new com.novelgames.flashgames.common.NewSound(this, "soundGameOver");
Key.addListener(this);
lastMoveTime = getTimer();
intervalID = setInterval(this, "onTime", 1);
}
function showEnterHighScore() {
_parent.showEnterHighScore(score);
}
function onKeyDown() {
var _local2 = Key.getCode();
switch (_local2) {
case 37 :
taxi.moveLeft();
break;
case 39 :
taxi.moveRight();
break;
case 32 :
taxi.jump();
}
}
function onTime() {
generateCars();
moveThings();
updateAfterEvent();
}
function createTaxi() {
var _local2 = carsHolder.getNextHighestDepth();
var _local3 = carsHolder.attachMovie("taxi", "taxi" + _local2, _local2);
taxi = _local3;
taxi.setPosition(com.novelgames.flashgames.taxi.Util.getXFromLane(com.novelgames.flashgames.taxi.Config.TAXI_INITIALLANE), com.novelgames.flashgames.taxi.Config.TAXI_Y, 0);
taxi.setLane(com.novelgames.flashgames.taxi.Config.TAXI_INITIALLANE);
taxiShadow.__proto__ = com.novelgames.flashgames.taxi.RoadObject.prototype;
taxiShadow.setPosition(taxi.x, taxi.y, 0);
taxi.shadow = taxiShadow;
}
function generateCars() {
var _local7;
var _local3;
var _local5;
var _local6;
var _local4;
var _local2;
if ((cars.length > 0) && (cars[0].y <= com.novelgames.flashgames.taxi.Config.CAR_MINSPACING)) {
return(undefined);
}
if (((currentGroupSize >= maxGroupSize) && (cars.length > 0)) && (cars[0].y <= com.novelgames.flashgames.taxi.Config.CAR_MINGROUPSPACING)) {
return(undefined);
}
if ((cars.length == 0) || (currentGroupSize >= maxGroupSize)) {
currentGroupSize = 1;
} else {
currentGroupSize++;
}
_local7 = Math.floor(Math.random() * com.novelgames.flashgames.taxi.Config.NOOFLANES) + 1;
_local3 = new Array(com.novelgames.flashgames.taxi.Config.NOOFLANES);
_local2 = 0;
while (_local2 < _local7) {
_local3[_local2] = true;
_local2++;
}
while (_local2 < _local3.length) {
_local3[_local2] = false;
_local2++;
}
com.novelgames.flashgames.taxi.Util.shuffleArray(_local3);
_local2 = 0;
while (_local2 < _local3.length) {
if (!_local3[_local2]) {
} else {
_local5 = carsHolder.getNextHighestDepth();
_local6 = carsHolder.attachMovie("car", "car" + _local5, _local5);
_local4 = _local6;
_local4.setPosition(com.novelgames.flashgames.taxi.Util.getXFromLane(_local2), 0, 0);
cars.unshift(_local4);
}
_local2++;
}
updateCarDepths();
}
function moveThings() {
var _local4 = getTimer();
var _local3 = (_local4 - lastMoveTime) / 1000;
var _local2;
updateTaxiSpeed(_local3);
marks.move(_local3);
things.move(_local3);
taxi.move(_local3);
_local2 = 0;
while (_local2 < cars.length) {
cars[_local2].move(_local3);
if ((cars[_local2].y < 0) || (cars[_local2].y > com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_MAXY)) {
cars[_local2]._visible = false;
cars.splice(_local2, 1);
_local2--;
}
_local2++;
}
updateCheckPoint(_local3);
checkCrash(_local3);
updateTaxiDepth();
updateTime();
lastMoveTime = _local4;
}
function updateTaxiSpeed(seconds) {
if (!taxi.getCanChangeSpeed()) {
return(undefined);
}
if (Key.isDown(38)) {
taxiSpeed = taxiSpeed + (seconds * com.novelgames.flashgames.taxi.Config.TAXI_ACCELERATION);
if (taxiSpeed >= com.novelgames.flashgames.taxi.Config.TAXI_MAXSPEED) {
taxiSpeed = com.novelgames.flashgames.taxi.Config.TAXI_MAXSPEED;
}
} else if (Key.isDown(40)) {
taxiSpeed = taxiSpeed - (seconds * com.novelgames.flashgames.taxi.Config.TAXI_ACCELERATION);
if (taxiSpeed <= com.novelgames.flashgames.taxi.Config.TAXI_MINSPEED) {
taxiSpeed = com.novelgames.flashgames.taxi.Config.TAXI_MINSPEED;
}
}
}
function updateCarDepths() {
var _local2;
_local2 = 0;
while (_local2 < cars.length) {
cars[_local2].swapDepths((_local2 + 1) * (com.novelgames.flashgames.taxi.Config.NOOFLANES + 1));
_local2++;
}
updateTaxiDepth();
}
function updateTaxiDepth() {
var _local2;
_local2 = cars.length - 1;
while (_local2 >= 0) {
if (taxi.y >= cars[_local2].y) {
break;
}
_local2--;
}
if (_local2 < 0) {
taxi.swapDepths(0);
} else {
taxi.swapDepths(cars[_local2].getDepth() + 1);
}
}
function checkCrash(seconds) {
var _local2 = getCrashCar(seconds);
var _local3;
if (_local2 == null) {
return(undefined);
}
_local3 = (((_local2.y - (taxiSpeed - com.novelgames.flashgames.taxi.Config.CAR_SPEED)) < taxi.y) ? (-com.novelgames.flashgames.taxi.Config.TAXI_CRASHBOUNCE) : (com.novelgames.flashgames.taxi.Config.TAXI_CRASHBOUNCE));
offsetYs(_local3);
taxiSpeed = taxiSpeed * (1 - (com.novelgames.flashgames.taxi.Config.TAXI_CRASHSPEEDLOST / 100));
_local2.showSpark(taxi.x - _local2.x, _local3 > 0);
soundCrash.start();
}
function getCrashCar(seconds) {
var _local2;
_local2 = cars.length - 1;
while (_local2 >= 0) {
if (cars[_local2].y < (taxi.y - com.novelgames.flashgames.taxi.Config.TAXI_LENGTH)) {
return(null);
}
if (Math.abs(cars[_local2].x - taxi.x) > ((com.novelgames.flashgames.taxi.Config.TAXI_WIDTH + com.novelgames.flashgames.taxi.Config.CAR_WIDTH) / 2)) {
} else if (((cars[_local2].y - com.novelgames.flashgames.taxi.Config.CAR_LENGTH) - ((taxiSpeed - com.novelgames.flashgames.taxi.Config.CAR_SPEED) * seconds)) > taxi.y) {
} else if (taxi.z < com.novelgames.flashgames.taxi.Config.CAR_HEIGHT) {
return(cars[_local2]);
}
_local2--;
}
return(null);
}
function offsetYs(offset) {
var _local2;
_local2 = 0;
while (_local2 < cars.length) {
cars[_local2].setPosition(cars[_local2].x, cars[_local2].y + offset, 0);
_local2++;
}
marks.setY(marks.y + offset);
things.moveOffset(offset);
checkPointY = checkPointY + offset;
}
function startLevel(level) {
this.level = level;
maxGroupSize = com.novelgames.flashgames.taxi.Config.LEVEL_INITIALGROUPSIZE + ((level - 1) * com.novelgames.flashgames.taxi.Config.LEVEL_GROUPSIZEINCREASE);
checkPointY = taxi.y - com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH;
levelTime = com.novelgames.flashgames.taxi.Config.LEVEL_INITIALTIME - ((level - 1) * com.novelgames.flashgames.taxi.Config.LEVEL_TIMEDECREASE);
if (levelTime < com.novelgames.flashgames.taxi.Config.LEVEL_MINTIME) {
levelTime = com.novelgames.flashgames.taxi.Config.LEVEL_MINTIME;
}
levelStartTime = getTimer();
distance = com.novelgames.flashgames.taxi.Config.LEVEL_LENGTH;
time = levelTime;
message.__proto__ = com.novelgames.flashgames.taxi.Message.prototype;
message.showLevel(level, levelTime);
}
function updateCheckPoint(seconds) {
checkPointY = checkPointY + (taxiSpeed * seconds);
distance = Math.floor(taxi.y - checkPointY);
if (checkPointY > taxi.y) {
score = score + (com.novelgames.flashgames.taxi.Config.SCORE_LEVEL + Math.floor(((levelTime * 1000) - (getTimer() - levelStartTime)) * com.novelgames.flashgames.taxi.Config.SCORE_TIME));
startLevel(level + 1);
soundCheckPoint.start();
}
}
function updateTime() {
time = levelTime - Math.floor((getTimer() - levelStartTime) / 1000);
if (time <= 0) {
gameOver();
}
}
function gameOver() {
Key.removeListener(this);
clearInterval(intervalID);
message.showTimeUp();
soundGameOver.start();
}
}
Symbol 73 MovieClip [__Packages.com.novelgames.flashgames.taxi.Taxi] Frame 0
class com.novelgames.flashgames.taxi.Taxi extends com.novelgames.flashgames.taxi.RoadObject
{
var jumping, changingLane, currentLane, changingToLane, jumpAcceleration, jumpInitialSpeed, stop, x, changingToLaneX, gotoAndStop, updatePosition, shadow, y, jumpSpeed, z, _parent;
function Taxi () {
super();
jumping = false;
changingLane = false;
currentLane = 0;
changingToLane = 0;
jumpAcceleration = (((8 * com.novelgames.flashgames.taxi.Config.TAXI_JUMPHEIGHT) * 1000) * 1000) / (com.novelgames.flashgames.taxi.Config.TAXI_JUMPTIME * com.novelgames.flashgames.taxi.Config.TAXI_JUMPTIME);
jumpInitialSpeed = ((jumpAcceleration * com.novelgames.flashgames.taxi.Config.TAXI_JUMPTIME) / 1000) / 2;
(stop());// not popped
}
function setLane(lane) {
currentLane = lane;
}
function move(seconds) {
if (changingLane) {
if (changingToLane < currentLane) {
x = x - (com.novelgames.flashgames.taxi.Config.TAXI_CHANGELANESPEED * seconds);
if (x <= changingToLaneX) {
x = changingToLaneX;
changingLane = false;
currentLane = changingToLane;
(gotoAndStop("normal"));// not popped
}
} else {
x = x + (com.novelgames.flashgames.taxi.Config.TAXI_CHANGELANESPEED * seconds);
if (x >= changingToLaneX) {
x = changingToLaneX;
changingLane = false;
currentLane = changingToLane;
(gotoAndStop("normal"));// not popped
}
}
updatePosition();
shadow.setPosition(x, y, 0);
} else if (jumping) {
jumpSpeed = jumpSpeed - (jumpAcceleration * seconds);
z = z + (jumpSpeed * seconds);
if (z <= 0) {
z = 0;
jumping = false;
}
updatePosition();
}
}
function getCanChangeSpeed() {
return(!jumping);
}
function moveLeft() {
if (jumping) {
return(undefined);
}
if (changingLane) {
return(undefined);
}
if (currentLane <= 0) {
return(undefined);
}
changingLane = true;
changingToLane = currentLane - 1;
changingToLaneX = com.novelgames.flashgames.taxi.Util.getXFromLane(changingToLane);
(gotoAndStop("left"));// not popped
_parent._parent.soundSteer.start();
}
function moveRight() {
if (jumping) {
return(undefined);
}
if (changingLane) {
return(undefined);
}
if (currentLane >= (com.novelgames.flashgames.taxi.Config.NOOFLANES - 1)) {
return(undefined);
}
changingLane = true;
changingToLane = currentLane + 1;
changingToLaneX = com.novelgames.flashgames.taxi.Util.getXFromLane(changingToLane);
(gotoAndStop("right"));// not popped
_parent._parent.soundSteer.start();
}
function jump() {
if (jumping) {
return(undefined);
}
if (changingLane) {
return(undefined);
}
jumping = true;
jumpSpeed = jumpInitialSpeed;
_parent._parent.soundJump.start();
}
}
Symbol 74 MovieClip [__Packages.com.novelgames.flashgames.taxi.Util] Frame 0
class com.novelgames.flashgames.taxi.Util
{
function Util () {
}
static function getXFromLane(laneIndex) {
return(((com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_WIDTH / com.novelgames.flashgames.taxi.Config.NOOFLANES) / 2) + (laneIndex * (com.novelgames.flashgames.taxi.Config.ROADVIRTUAL_WIDTH / com.novelgames.flashgames.taxi.Config.NOOFLANES)));
}
static function shuffleArray(theArray) {
var _local4;
var _local2;
var _local3;
_local2 = 0;
while (_local2 < theArray.length) {
_local3 = Math.floor(Math.random() * theArray.length);
_local4 = theArray[_local2];
theArray[_local2] = theArray[_local3];
theArray[_local3] = _local4;
_local2++;
}
}
}