Combined Code
frame 1 {
if ((_framesloaded / _totalframes) * 100 > 90) {
preloader._visible = false;
} else {
preloader._visible = true;
}
}
movieClip 3 {
frame 1 {
bLoaded = _parent.getBytesLoaded();
bTotal = _parent.getBytesTotal();
factor = Math.ceil((bLoaded / bTotal) * 100);
if (factor < fcomp) {
_parent.stop();
percentloaded = Math.ceil((bTotal - bLoaded) * 9 / bTotal);
} else {
_parent.play();
}
}
frame 1 {
percentage.text = percentloaded;
percentage.textColor = color3;
percentage.textFont = fText;
}
frame 1 {
function drawProCircle(r, x, y, p, line, fill, trans) {
lineStyle(1, line);
beginFill(fill, trans);
moveTo(x + r, y);
var angle = 1;
while (angle <= p) {
var endx = r * Math.cos(angle * Math.PI / 180);
var endy = r * Math.sin(angle * Math.PI / 180);
var cx = endx;
var cy = endy;
this.curveTo(cx + x, cy + y, endx + x, endy + y);
angle += 1;
}
this.lineTo(x, y);
this.lineTo(x + r, y);
}
this.clear();
p = Math.ceil((bLoaded / bTotal) * 9 * 360);
p1 = int(p / 360);
if (p > 360) {
p -= p1 * 360;
}
drawProCircle(r, 0, 0, p, color1, color2, 100);
drawProCircle(r / 2, 0, 0, p, color4, color5, 100);
}
frame 2 {
gotoAndPlay(1);
}
}
instance preloader of movieClip 3 {
onClipEvent (initialize) {
r = 100;
color1 = 16777215;
color2 = 10066329;
color4 = 16777215;
color5 = 13421772;
color3 = 0;
fcomp = 100;
}
}
frame 2 {
function initialize() {
lives = 5;
cash = 0;
cashDisplay = 0;
gameState = 'stop';
progress_bar_mc.gotoAndPlay(1);
}
function updateObstacle(obstacleTargetName) {
if (gameState == 'play') {
obstacleTargetName.play();
}
if (gameState == 'stop') {
obstacleTargetName.stop();
}
}
function testForCollision(xMin, xMax) {
if (car_mc._x >= xMin & car_mc._x <= xMax) {
car_mc._y -= 6;
sound_mc.gotoAndPlay('crash');
lives -= 1;
if (lives == 0) {
gotoAndPlay(88);
}
}
}
function testForCashCollision(xMin, xMax) {
if (car_mc._x >= xMin & car_mc._x <= xMax) {
car_mc._y -= 6;
sound_mc.gotoAndPlay('cash_register');
cash += 10000;
num = (String(cash)).split('.');
commanum = '';
if (num.length == 2) {
commanum = '.' + num[1];
}
if (length(num[0]) > 3) {
commanum = (String(num[0])).substr(length(num[0]) - 3, 3) + commanum;
digit = length(num[0]) - 6;
while (digit >= 0) {
commanum = (String(num[0])).substr(digit, 3) + ',' + commanum;
digit -= 3;
}
if (digit > -3) {
commanum = (String(num[0])).substr(0, digit + 3) + ',' + commanum;
}
} else {
commanum = num[0] + commanum;
}
cashDisplay = commanum;
}
}
}
frame 2 {
initialize();
stop();
this.onMouseUp = function () {
gotoAndPlay(10);
};
}
movieClip 8 {
}
movieClip 17 {
}
movieClip 18 {
instance of movieClip 8 {
onClipEvent (load) {
this._alpha = 0;
act = '1';
}
onClipEvent (enterFrame) {
if (act == '1') {
this._alpha += 7;
if (this._alpha > 60 + tr) {
tr = random(40);
act = '2';
}
}
if (act == '2') {
this._alpha -= 5;
if (this._alpha < tr) {
tr = random(40);
act = '1';
}
}
}
}
}
movieClip 26 {
frame 1 {
stop();
}
frame 24 {
gotoAndPlay(1);
}
frame 39 {
gotoAndPlay(1);
}
frame 79 {
gotoAndPlay(1);
}
frame 80 {
gotoAndPlay(1);
}
frame 141 {
gotoAndPlay(1);
}
}
frame 10 {
stop();
this.onMouseUp = function () {
gotoAndPlay(20);
};
}
movieClip 31 {
}
movieClip 35 {
}
movieClip 42 {
frame 28 {
gotoAndPlay(17);
}
}
frame 20 {
this.onMouseUp = function () {};
}
movieClip 45 {
}
instance of movieClip 45 {
onClipEvent (enterFrame) {
if (_x > -221) {
_x = _x - 0.5;
} else {
_x = 675;
}
}
}
instance of movieClip 45 {
onClipEvent (enterFrame) {
if (_x > -221) {
_x = _x - 0.5;
} else {
_x = 675;
}
}
}
movieClip 48 {
}
movieClip 55 {
frame 1 {
stop();
}
instance landscape_mc of movieClip 48 {
onClipEvent (load) {
startX = this._x;
}
onClipEvent (enterFrame) {
leftKey = 37;
rightKey = 39;
scrollIncrement = 2;
scrollLimit = 18;
if (_parent.gameState == 'play') {
if (Key.isDown(leftKey)) {
if (this._x < startX + scrollLimit) {
this._x += scrollIncrement;
}
}
if (Key.isDown(rightKey)) {
if (this._x > startX - scrollLimit) {
this._x -= scrollIncrement;
}
}
}
}
}
frame 20 {
stop();
}
frame 37 {
stop();
}
frame 54 {
stop();
}
}
instance landscape_mc of movieClip 55 {
onClipEvent (load) {
startX = this._x;
}
onClipEvent (enterFrame) {
leftKey = 37;
rightKey = 39;
scrollIncrement = 2;
scrollLimit = 18;
if (_parent.gameState == 'play') {
if (Key.isDown(leftKey)) {
if (this._x < startX + scrollLimit) {
this._x += scrollIncrement;
}
}
if (Key.isDown(rightKey)) {
if (this._x > startX - scrollLimit) {
this._x -= scrollIncrement;
}
}
}
}
}
movieClip 62 {
frame 1 {
stop();
}
}
instance road_mc of movieClip 62 {
onClipEvent (enterFrame) {
if (_parent.gameState == 'play') {
nextFrame();
play();
}
if (_parent.gameState == 'stop') {
stop();
}
}
}
movieClip 67 {
}
movieClip 70 {
}
movieClip 74 {
}
movieClip 79 {
}
movieClip 81 {
}
movieClip 82 {
}
movieClip 83 {
frame 1 {
x_value = _x;
x_target = x_value;
acc = 10;
b = 1.45;
}
instance car_body_mc of movieClip 82 {
onClipEvent (load) {
y = _y;
}
onClipEvent (enterFrame) {
if (_parent._parent.gameState == 'play') {
_y = y + random(2) - 1;
}
}
}
frame 2 {
vx = (Number(vx) + Number((x_target - x_value) * 1 / acc)) / b;
x_value = Number(x_value) + Number(vx);
_x = x_value;
}
frame 3 {
gotoAndPlay(2);
}
}
instance car_mc of movieClip 83 {
onClipEvent (enterFrame) {
if (_parent.gameState == 'play') {
car_body_mc.brakelights._alpha = 0;
}
if (_parent.gameState == 'stop') {
car_body_mc.brakelights._alpha = 100;
}
}
}
movieClip 91 {
frame 720 {
_parent.landscape_mc.gotoAndPlay('stage_02');
}
frame 745 {
_parent.stage_completed_mc.gotoAndPlay('stage_1_completed');
}
frame 1440 {
_parent.landscape_mc.gotoAndPlay('stage_03');
}
frame 1467 {
_parent.stage_completed_mc.gotoAndPlay('stage_2_completed');
}
frame 2160 {
_parent.landscape_mc.gotoAndPlay('stage_04');
}
frame 2185 {
_parent.stage_completed_mc.gotoAndPlay('stage_3_completed');
}
frame 2880 {
_parent.gotoAndPlay('congratulations');
stop();
}
}
instance progress_bar_mc of movieClip 91 {
onClipEvent (enterFrame) {
if (_parent.gameState == 'play') {
nextFrame();
play();
}
if (_parent.gameState == 'stop') {
stop();
}
}
}
movieClip 99 {
}
movieClip 103 {
}
movieClip 106 {
}
movieClip 109 {
}
frame 74 {
stopAllSounds();
gotoAndPlay(75);
}
frame 75 {
gameState = 'play';
sound_mc.gotoAndPlay('screech');
smoke_mc.gotoAndPlay('puff');
stop();
}
movieClip 113 {
}
instance car_mc of movieClip 83 {
onClipEvent (load) {
origY = _y;
}
onClipEvent (enterFrame) {
if (Key.isDown(37) and x_target > 80) {
x_target -= 50;
if (_parent.sound_mc._currentFrame == 1) {
_parent.sound_mc.gotoAndPlay('screech');
}
car_body_mc.signal_left._alpha = 100;
} else {
car_body_mc.signal_left._alpha = 0;
}
if (Key.isDown(39) and x_target < 350) {
x_target += 50;
if (_parent.sound_mc._currentFrame == 1) {
_parent.sound_mc.gotoAndPlay('screech');
}
car_body_mc.signal_right._alpha = 100;
} else {
car_body_mc.signal_right._alpha = 0;
}
if (Key.isDown(37)) {
dir = 0.5;
}
if (Key.isDown(39)) {
dir = -0.5;
}
if (_parent.gameState == 'play') {
car_body_mc.brakelights._alpha = 0;
}
if (_parent.gameState == 'stop') {
car_body_mc.brakelights._alpha = 100;
}
}
}
movieClip 153 {
frame 1 {
stop();
}
frame 25 {
gotoAndPlay(1);
}
frame 49 {
gotoAndPlay(1);
}
frame 73 {
gotoAndPlay(1);
}
}
frame 88 {
sound_mc.gotoAndPlay('crash');
gameState = 'stop';
}
frame 115 {
stop();
}
movieClip 159 {
}
instance of movieClip 159 {
onClipEvent (keyUp) {
_parent.initialize();
_parent.gotoAndPlay('countdown');
}
onClipEvent (mouseUp) {
_parent.initialize();
_parent.gotoAndPlay('countdown');
}
}
frame 116 {
sound_mc.gotoAndPlay('congratulations');
gameState = 'stop';
}
frame 145 {
stop();
}