Frame 1
function auto_replace(trg, coord) {
trg._x = (road_min + (general.lane_width * 0.5)) + (Math.floor(Math.random() * level_info.lanes) * general.lane_width);
switch (coord) {
case "above" :
trg._y = (-general.traffic_y_swap) + Math.round(Math.random() * 200);
break;
case "below" :
trg._y = general.traffic_y_swap - Math.round(Math.random() * 200);
}
traffic_overlap = true;
while (traffic_overlap) {
traffic_overlap = false;
for (b in all.traffic) {
auto_trg = all.traffic[b];
auto_x = Math.abs(auto_trg._x - trg._x);
auto_y = Math.abs(auto_trg._y - trg._y);
if (((auto_x <= temp_traffic_width) && (auto_y <= temp_traffic_height)) && (auto_trg != trg)) {
traffic_overlap = true;
break;
}
}
if (traffic_overlap) {
switch (coord) {
case "above" :
trg._y = trg._y - temp_traffic_height;
break;
case "below" :
trg._y = trg._y + temp_traffic_height;
}
}
}
}
function auto_swap_check(trg) {
if (end_condition && ((trg._y > 160) || (trg._y < (-general.traffic_start_y_min)))) {
trg.shad_trg.removeMovieClip();
trg.removeMovieClip();
} else {
if (trg._y > general.traffic_y_swap) {
auto_replace(trg, "above");
define_traffic(trg);
}
if (trg._y < (-general.traffic_y_swap)) {
auto_replace(trg, "below");
define_traffic(trg);
}
}
}
function check_powerup(trg) {
rnd = int(Math.random() * level_info.powerup_chance);
if ((!rnd) && (level_info.powerup_chance)) {
trg.attachMovie("powerup", "powerup", trg.getNextHighestDepth());
trg.powerup.type = powerups[Math.floor(Math.random() * powerups.length)];
trg.powerup.gotoAndStop(trg.powerup.type);
return(true);
}
return(false);
}
function lane_block(trg) {
if (trg.lane < 1) {
lane_push = 1;
} else if (trg.lane >= (level_info.lanes - 1)) {
lane_push = -1;
} else {
lane_push = ((Math.random() > 0.5) ? 1 : -1);
}
trg.lane_push = trg.lane + lane_push;
}
function define_traffic(trg) {
trg.powerup.removeMovieClip();
fuzzy = int(Math.random() * (level_info.traffic_speed_range[1] - level_info.traffic_speed_range[0]));
trg.max_speed = Number(level_info.traffic_speed_range[0]) + fuzzy;
fuzzy = int(Math.random() * (level_info.traffic_acc_range[1] - level_info.traffic_acc_range[0]));
trg.acc = Number(level_info.traffic_acc_range[0]) + fuzzy;
trg.y_speed = trg.max_speed * 0.5;
trg.lane_push = undefined;
trg.off_road = false;
trg.oil_struck = false;
trg.last_hit = false;
var _local2 = 2 + Math.floor(Math.random() * 15);
var _local3 = choose_ai(trg);
if (_local3) {
_local2 = 17;
} else if (check_powerup(trg)) {
_local2 = 50;
}
trg.gotoAndStop(_local2);
return(_local3);
}
function angle_bash(trg) {
if (trg.side_swipe || (trg.oil_struck)) {
trg.car._rotation = trg.car._rotation + (trg.pot_rot * (trg.y_speed * 0.01));
} else {
trg.rot = -trg.car._rotation;
trg.car._rotation = trg.car._rotation + ((trg.rot * (trg.y_speed * 0.02)) * (!trg.oil_struck));
}
}
function place_skid(fade, sx, sy, sh, frame) {
var _local1 = (general.player_y_position + sy) + (sh * 0.5);
if (_local1 < 400) {
skid_lev = all.road_marks.getNextHighestDepth();
skid = all.road_marks.attachMovie("skid", "skid" + skid_lev, skid_lev);
if (frame == undefined) {
frame = 1;
}
skid.gotoAndStop(frame);
skid._x = sx;
skid._y = _local1;
skid._alpha = fade * 4;
skid.onEnterFrame = skidder;
}
}
function skidder() {
if ((!freeze) && (!hold)) {
this._y = this._y + player.actual_speed;
if (this._y > 420) {
this.removeMovieClip();
}
}
}
function place_smoke(sx, sy, sh) {
smoke_lev = all.effects.getNextHighestDepth();
smoke = all.effects.attachMovie("smoke", "smoke" + smoke_lev, smoke_lev);
smoke._x = sx;
smoke._y = (general.player_y_position + sy) - (sh * 0.5);
smoke._xscale = (smoke._yscale = 125);
smoke.onEnterFrame = smoker;
}
function smoker() {
if ((!freeze) && (!hold)) {
this.play();
this._y = this._y + (player.actual_speed * 0.8);
this._xscale = (this._yscale = this._yscale + 8);
if (((this._y > 460) || (this._alpha <= 0)) || (this._currentframe == this._totalframes)) {
this.removeMovieClip();
}
} else {
this.stop();
}
}
function shadow_follow(trg) {
}
function is_plankton(trg) {
return((trg._currentframe == 5) || (trg._currentframe == 16));
}
function choose_ai(trg) {
trg.onEnterFrame = auto_logic;
if (Math.round(Math.random() * level_info.ai1_chance) == 0) {
trg.ai_mon = "ai:1";
trg.ai = "ai1";
trg.onEnterFrame = ai1_logic;
return(true);
}
trg.ai = "drone";
return(false);
}
function traffic_end_logic() {
for (a in all.traffic) {
if (all.traffic[a].ai == "ai1") {
all.traffic[a].auto_logic();
all.traffic[a].ai = "drone";
}
}
}
function ai1_logic() {
if ((!freeze) && (!hold)) {
this.mon = "ai:1";
this.old_position = {x:this._x, y:this._y, x_speed:this.x_speed, y_speed:this.actual_speed};
var _local3 = player._x - this._x;
var _local2 = player._y - this._y;
if (_local2 > 0) {
this.y_pot = ((this.max_speed * 0.5) * (!this.side_swipe)) * (!this.off_road);
}
if (_local2 < 0) {
this.y_pot = (general.gear2_max * (!this.side_swipe)) * (!this.off_road);
}
if (((Math.abs(_local2) < player._width) && (!player.side_swipe)) && (!player.off_road)) {
this.lane_x = (road_min + (general.lane_width * 0.5)) + (Math.max(Math.min(player.lane, level_info.lanes - 1), 0) * general.lane_width);
}
this.y_speed = this.y_speed + (this.acc * (this.y_pot > this.y_speed));
this.y_speed = this.y_speed - (this.acc * (this.y_pot < this.y_speed));
this.actual_speed = Math.round(this.y_speed);
this._y = this._y - (this.actual_speed - player.actual_speed);
if ((Math.abs(_local3) < 200) && (Math.abs(_local2) < 200)) {
var _local4 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
player.a1_distance = Math.min(player.a1_distance, _local4);
}
if (!this.side_swipe) {
this.x_pot = ((this.y_speed * ((this.lane_x > this._x) - (this.lane_x < this._x))) * 0.2) * (!this.off_road);
this.x_speed = this.x_speed + Number(this.x_pot > this.x_speed);
this.x_speed = this.x_speed - Number(this.x_pot < this.x_speed);
if ((this.lane_x - this._x) < 0) {
this.x_speed = Math.round(Math.max(this.lane_x - this._x, this.x_speed));
}
if ((this.lane_x - this._x) > 0) {
this.x_speed = Math.round(Math.min(this.lane_x - this._x, this.x_speed));
}
}
if (this.side_swipe) {
if (isNaN(this.x_speed)) {
this.x_speed = 0;
} else if ((this._y > -260) && (this._y < 180)) {
place_skid(this.y_speed, this._x, this._y, this._height);
}
this.x_pot = 0;
this.x_speed = this.x_speed + (0.2 * (this.x_pot > this.x_speed));
this.x_speed = this.x_speed - (0.2 * (this.x_pot < this.x_speed));
if (Math.abs(this.x_speed) < 1) {
this.x_speed = 0;
this.pot_rot = 0;
this.side_swipe = false;
}
}
this._x = this._x + this.x_speed;
this.lane = Math.floor((this._x - road_min) / general.lane_width);
if (((this._x <= road_min) || (this._x >= road_max)) && (!this.off_road)) {
this.off_road = true;
if (this.last_hit == "player") {
scorer(general.points_off_road);
}
if (((_local2 < 200) && (_local2 > -400)) && (this.y_speed > 8)) {
fx("car_off", 1, 50);
}
}
shadow_follow(this);
angle_bash(this);
auto_swap_check(this);
if ((((this._y > player._y) && (this._y < 500)) && (oil_on)) && (!this.oil_struck)) {
oil_collision(this);
}
if (((this._y < 0) && (this._y > -300)) && (missile_on)) {
missile_collision(this);
}
}
}
function auto_logic() {
if ((!freeze) && (!hold)) {
this.mon = "drone";
this.old_position = {x:this._x, y:this._y, x_speed:this.x_speed, y_speed:this.actual_speed};
this.y_pot = ((this.max_speed * (!this.side_swipe)) * (!this.off_road)) * (!this.oil_struck);
this.y_speed = this.y_speed + (this.acc * (this.y_pot > this.y_speed));
this.y_speed = this.y_speed - ((this.acc + (this.off_road * general.brake)) * (this.y_pot < this.y_speed));
this.actual_speed = Math.round(this.y_speed);
this._y = this._y - (this.actual_speed - player.actual_speed);
if ((!this.side_swipe) && (!this.oil_struck)) {
if (((this.lane != this.lane_push) && (this.lane != undefined)) && (this.lane_push != undefined)) {
this.x_pot = ((this.y_speed * ((this.lane_push > this.lane) - (this.lane_push < this.lane))) * 0.1) * (!this.off_road);
this.x_speed = this.x_speed - (this.x_pot < this.x_speed);
this.x_speed = this.x_speed + (this.x_pot > this.x_speed);
} else {
this.lane_position = (this._x - road_min) - (general.lane_width * 0.5);
this.x_pot = ((this.y_speed * ((this.lane_position < (this.lane * general.lane_width)) - (this.lane_position > (this.lane * general.lane_width)))) * 0.1) * (!this.off_road);
if (this.lane_position >= (this.lane * general.lane_width)) {
this.x_speed = Math.max((this.lane * general.lane_width) - this.lane_position, this.x_pot);
}
if (this.lane_position < (this.lane * general.lane_width)) {
this.x_speed = Math.min((this.lane * general.lane_width) - this.lane_position, this.x_pot);
}
}
}
var _local3 = player._x - this._x;
var _local2 = player._y - this._y;
if ((Math.abs(_local3) < 200) && (Math.abs(_local2) < 200)) {
var _local4 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
player.auto_distance = Math.min(player.auto_distance, _local4);
}
if (!plankton_closer) {
if (is_plankton(this)) {
if (Math.abs(_local2) < 250) {
plankton_closer = true;
}
}
}
if (this.side_swipe || (this.oil_struck)) {
if (isNaN(this.x_speed)) {
this.x_speed = 0;
} else if (!this.oil_struck) {
place_skid(this.y_speed, this._x, this._y, this._height);
}
this.x_pot = 0;
this.x_speed = this.x_speed + (0.2 * (this.x_pot > this.x_speed));
this.x_speed = this.x_speed - (0.2 * (this.x_pot < this.x_speed));
if (Math.abs(this.x_speed) < 1) {
this.lane_push = undefined;
this.x_speed = 0;
this.pot_rot = 0;
this.side_swipe = false;
}
}
this._x = this._x + this.x_speed;
this.lane = Math.floor((this._x - road_min) / general.lane_width);
if (((this._x <= road_min) || (this._x >= road_max)) && (!this.off_road)) {
this.off_road = true;
if (this.last_hit == "player") {
scorer(general.points_off_road);
}
if (!plankton_off) {
if (is_plankton(this)) {
plankton_off = true;
}
}
if (((_local2 < 200) && (_local2 > -400)) && (this.y_speed > 8)) {
fx("car_off", 1, 50);
}
}
angle_bash(this);
auto_swap_check(this);
if ((((this._y > player._y) && (this._y < 500)) && (oil_on)) && (!this.oil_struck)) {
oil_collision(this);
}
if (((this._y < 0) && (this._y > -300)) && (missile_on)) {
missile_collision(this);
}
}
}
function car_collision(trg) {
var _local2 = allcars.length;
var _local3 = 0;
var _local1 = 0;
while (_local3 < _local2) {
looker = allcars[_local3];
_local1 = 0;
while (_local1 < _local2) {
look_at = allcars[_local1];
if (test_collision(looker, look_at)) {
test_collision(look_at, looker);
break;
}
_local1++;
}
_local3++;
}
}
function test_collision(looker, look_at) {
if (looker != look_at) {
col_x = Math.abs(looker._x - look_at._x);
col_y = Math.abs(looker._y - look_at._y);
var _local4 = ((looker == player) ? (looker.car.body._height) : (looker._height));
var _local3 = ((look_at == player) ? (look_at.car.body._height) : (look_at._height));
col_x_min = (looker._width + look_at._width) * 0.5;
col_y_min = (_local4 + _local3) * 0.5;
col_x_min = col_x_min * 0.8;
hit_x = col_x < col_x_min;
hit_y = col_y < col_y_min;
if (hit_x && (hit_y)) {
old_col_x = Math.abs(looker.old_position.x - look_at.old_position.x);
old_col_y = Math.abs(looker.old_position.y - look_at.old_position.y);
old_hit_x = old_col_x < col_x_min;
old_hit_y = old_col_y < col_y_min;
if (!plankton_hit) {
if ((is_plankton(looker) && (look_at == player)) || (is_plankton(look_at) && (looker == player))) {
plankton_hit = true;
}
}
if (old_hit_x) {
overlap_y = Math.abs(looker._y - look_at._y);
overlap_y_adj = ((_local4 + _local3) * 0.5) - overlap_y;
if ((looker._y < look_at._y) && (overlap_y_adj < ((_local4 + _local3) * 0.25))) {
looker.y_speed = looker.y_speed + Math.max(look_at.old_position.y_speed * 0.2, 2);
look_at.y_speed = look_at.y_speed * 0.5;
looker.x_speed = look_at.y_speed * ((look_at._x > looker._x) - (look_at._x < looker._x));
place_smoke(look_at._x, look_at._y, _local3);
if (look_at.ai == "player") {
looker._y = looker._y - (overlap_y_adj * 2);
}
if (looker.ai == "player") {
look_at._y = look_at._y + (overlap_y_adj * 2);
}
if ((looker.ai != "player") && (look_at.ai != "player")) {
look_at._y = look_at._y + overlap_y_adj;
}
if ((look_at.ai != "player") && (look_at.ai == "drone")) {
lane_block(look_at);
}
}
if ((look_at.ai == "player") || (looker.ai == "player")) {
if ((looker.ai == "player") && (look_at.powerup)) {
got_powerup(look_at);
} else if ((look_at.ai == "player") && (looker.powerup)) {
got_powerup(looker);
} else {
fx_bash();
}
}
}
if (old_hit_y) {
overlap_x = Math.abs(looker._x - look_at._x);
overlap_x_adj = ((looker._width + look_at._width) * 0.5) - overlap_x;
if ((looker._x < look_at._x) && (overlap_x_adj < ((looker._width + look_at._width) * 0.25))) {
looker.last_hit = look_at.ai;
look_at.last_hit = looker.ai;
looker.x_speed = (look_at.old_position.x_speed * 1) - (looker.old_position.x_speed * 0.3);
look_at.x_speed = (looker.old_position.x_speed * 1) - (look_at.old_position.x_speed * 0.3);
looker._x = looker._x - (overlap_x_adj * 0.5);
look_at._x = look_at._x + (overlap_x_adj * 0.5);
if (look_at._y > looker._y) {
looker.pot_rot = (-looker.x_speed) * 0.9;
}
if (look_at._y < looker._y) {
looker.pot_rot = looker.x_speed * 0.9;
}
if (looker._y > look_at._y) {
look_at.pot_rot = (-look_at.x_speed) * 0.9;
}
if (looker._y < look_at._y) {
look_at.pot_rot = look_at.x_speed * 0.9;
}
look_at.side_swipe = true;
looker.side_swipe = true;
if ((looker.ai == "player") || (look_at.ai == "player")) {
if (looker.ai == "player") {
looker.x_speed = Math.max(looker.x_speed, -general.side_swipe_max);
}
if (look_at.ai == "player") {
look_at.x_speed = Math.min(look_at.x_speed, general.side_swipe_max);
}
if ((looker.ai == "player") && (look_at.powerup)) {
got_powerup(look_at);
} else if ((look_at.ai == "player") && (looker.powerup)) {
got_powerup(looker);
} else {
fx_bash();
if (Math.min(looker.y_speed, look_at.y_speed) > 15) {
fx("side_swipe", 1, 100);
}
}
}
}
}
return(true);
}
}
return(false);
}
function oil_collision(trg) {
for (a in all.oil) {
oil_trg = all.oil[a];
col_x = Math.abs(trg._x - oil_trg._x);
col_y = Math.abs(trg._y - (oil_trg._y - general.player_y_position));
col_x_min = (trg._width + oil_trg._width) * 0.5;
col_y_min = (trg._height + oil_trg._height) * 0.5;
hit_x = col_x < col_x_min;
hit_y = col_y < col_y_min;
if (hit_y && (hit_x)) {
if ((trg.ai = "ai1")) {
trg.ai = "drone";
trg.onEnterFrame = auto_logic;
}
trg.oil_struck = true;
trg.side_swipe = true;
if (trg._x > player._x) {
trg.x_speed = 5;
trg.pot_rot = trg.x_speed * 2;
} else {
trg.x_speed = -5;
trg.pot_rot = trg.x_speed * 2;
}
}
}
}
function missile_collision(trg) {
for (a in all.missiles) {
missile_trg = all.missiles[a];
col_x = Math.abs(trg._x - missile_trg._x);
col_y = Math.abs(trg._y - (missile_trg._y - general.player_y_position));
col_x_min = trg._width * 0.5;
col_y_min = trg._height * 0.5;
hit_x = col_x < col_x_min;
hit_y = col_y < col_y_min;
if (hit_y && (hit_x)) {
fx("sound_explosion", 1, 100);
explosion_lev = all.effects.getNextHighestDepth();
explosion = all.explosion_mark.attachMovie("explosion_mark", "explosion" + explosion_lev, explosion_lev);
e_bubble = all.effects.attachMovie("explosion", "explosion" + explosion_lev, explosion_lev);
e_bubble._x = (explosion._x = trg._x);
e_bubble._y = (explosion._y = general.player_y_position + trg._y);
explosion.speed = trg.y_speed;
explosion.bubble = e_bubble;
explosion.onEnterFrame = explosion_logic;
auto_replace(trg, "below");
missile_trg.removeMovieClip();
check_last_missile();
}
}
}
function explosion_logic() {
if ((!freeze) && (!hold)) {
this._y = this._y + (player.actual_speed - Math.round(this.speed));
this.bubble._y = this._y;
this.speed = this.speed * 0.5;
if (this._currentframe == this._totalframes) {
this.bubble.removeMovieClip();
this.removeMovieClip();
}
}
}
function start_level(level) {
attachMovie("nav", "nav", 30);
mute_sound(mute);
nav.distance.you.gotoAndStop(level);
score = level_score[level - 1];
temp_score = score;
all.removeMovieClip();
all_mask.removeMovieClip();
createEmptyMovieClip("all", 10);
all._x = 100;
attachMovie("all_mask", "all_mask", 20);
all.setMask(all_mask);
general = game_config.general;
temp_info = game_config["level" + level];
level_info = {};
for (var _local1 in temp_info) {
level_info[_local1] = temp_info[_local1];
}
var _local2 = Math.max(2, rounds);
level_info.traffic = level_info.traffic + Math.min(3, Math.round(_local2 / 3));
level_info.ai1_chance = Math.max(2, level_info.ai1_chance - _local2);
level_info.distance = level_info.distance + (30 * Math.min(8, _local2));
for (var _local1 in level_info) {
}
plankton_closer = false;
plankton_hit = false;
plankton_off = false;
nav.lives.gotoAndStop(lives + 1);
showRounds();
old_distance = 0;
look_for = 0;
distance = 0;
freeze = false;
hold = true;
end_condition = false;
seconds = level_info.seconds + 1;
clocker();
time = 100;
shake = 0;
skid_timer = 0;
nav.message.gotoAndStop(1);
acc_multiplier = 0;
speed_boost = 0;
powerup_held = "";
oil_held = 0;
missiles_held = 0;
oil_on = false;
missile_on = false;
auto_player = false;
round_started = false;
cheat = false;
var _local3 = (rounds % 2) == 1;
build_road();
make_placement_array();
init_clips();
if (_local3) {
place_night_light();
}
place_traffic();
place_player(_local3);
intro_animation();
scorer(0);
powerup_missiles(false);
fx("idling", 10000, 50);
Key.addListener(all);
all.road.onEnterFrame = road_logic;
}
function check_key_status() {
key_up = Key.isDown(38);
key_down = Key.isDown(40);
key_left = Key.isDown(37);
key_right = Key.isDown(39);
key_space = Key.isDown(32);
key_n = Key.isDown(78);
key_shift = Key.isDown(16);
key_life = key_shift && (Key.isDown(55));
key_level = key_shift && (Key.isDown(56));
key_power_pickle = key_shift && (Key.isDown(80));
key_power_oil = key_shift && (Key.isDown(70));
key_power_speed = key_shift && (Key.isDown(83));
key_power_time = key_shift && (Key.isDown(84));
if (!cheat) {
if (((((key_life || (key_level)) || (key_power_pickle)) || (key_power_oil)) || (key_power_speed)) || (key_power_time)) {
cheat = true;
}
if (key_power_pickle) {
powerup_missiles();
} else if (key_power_oil) {
powerup_oil();
} else if (key_power_speed && (player.speed == null)) {
powerup_speed();
} else if (key_power_time) {
powerup_time();
}
} else {
key_life = (key_level = false);
if (!key_shift) {
cheat = false;
}
}
}
function showRounds() {
var _local1 = Math.floor(rounds / 2) + 1;
var _local2 = new Array();
while (_local1 > 0) {
var _local3 = _local1 % 10;
_local2.push(_local3);
_local1 = Math.floor(_local1 / 10);
}
var _local4 = 1;
while (_local2.length) {
var _local3 = Number(_local2.pop());
nav.rounds["r" + _local4].gotoAndStop(_local3 + 2);
_local4++;
}
}
function build_road() {
all.attachMovie("road" + level, "road", 10);
all.attachMovie("over" + level, "over", 200);
var _local1 = (rounds % 2) + 1;
all.road.gotoAndStop(_local1);
all.over.gotoAndStop(_local1);
road_height = all.road._height * 0.5;
all_mask._width = all._width;
all_mask._height = stage_height;
road_min = 50;
road_max = (general.lane_width * level_info.lanes) + road_min;
}
function place_night_light() {
var _local1 = all.traffic.attachMovie("hotspot_mc", "hotspot", all.traffic.getNextHighestDepth());
_local1._visible = false;
}
function make_car_shadow(clip) {
clip.cacheAsBitmap = true;
clip.filters = [new flash.filters.DropShadowFilter(6, 45, 0, 0.4, 5, 5)];
}
function init_clips() {
all.createEmptyMovieClip("explosion_mark", 106);
all.createEmptyMovieClip("oil", 107);
all.createEmptyMovieClip("road_marks", 108);
all.createEmptyMovieClip("missiles", 111);
all.createEmptyMovieClip("effects", 112);
all.createEmptyMovieClip("bubbles", 113);
allcars = new Array();
trg = all.createEmptyMovieClip("traffic", 110);
trg._x = 0;
trg._y = general.player_y_position;
}
function place_player(atnight) {
player = all.traffic.attachMovie("car", "player", all.traffic.getNextHighestDepth());
make_car_shadow(player);
player.gotoAndStop(1);
player._visible = 0;
player.x_speed = 0;
player.y_speed = 0;
player.temp_speed = 0;
player._x = (road_min + (level_info.start_lane * general.lane_width)) - (general.lane_width * 0.5);
player.lane = level_info.start_lane;
player.ai = "player";
player.off_road = false;
player.lost = false;
player.vol_auto = 0;
player.vol_ai = 0;
player.speed = null;
player.car.headlight._visible = atnight;
allcars.push(player);
}
function place_traffic() {
temp_last_height = player._y + temp_traffic_height;
var _local1 = 0;
a = 0;
while (a < level_info.traffic) {
trg = all.traffic.attachMovie("car", "car" + a, all.traffic.getNextHighestDepth());
make_car_shadow(trg);
place_auto(trg, a);
trg.x_speed = 0;
trg.y_speed = 0;
trg.x_pot = 0;
trg.off_road = false;
trg.lane = Math.min(Math.max(Math.round((trg._x - road_min) / general.lane_width), 0), level_info.lanes - 1);
trg.lane_x = (road_min + (general.lane_width * 0.5)) + (trg.lane * general.lane_width);
trg.temp_speed = 0;
temp_last_height = temp_last_height + (temp_traffic_height + 20);
trg.gotoAndStop(1);
if (define_traffic(trg)) {
_local1++;
}
allcars.push(trg);
a++;
}
}
function place_auto(trg, num) {
trg._x = traffic_random[num][0];
trg._y = traffic_random[num][1];
}
function make_placement_array() {
y_area = general.traffic_y_swap - general.traffic_start_y_min;
y_fit = Math.floor(y_area / temp_traffic_height);
y_pos = int(Math.random() * y_fit);
y_place = y_pos * temp_traffic_height;
level_info.traffic = Math.min(level_info.traffic, y_fit * level_info.lanes);
traffic_slots = [];
var _local2 = 0;
while (_local2 < level_info.lanes) {
b = 0;
while (b < y_fit) {
traffic_slots.push([road_min + ((_local2 + 0.5) * general.lane_width), -((b * temp_traffic_height) + general.traffic_start_y_min)]);
b++;
}
_local2++;
}
var _local1 = new Array();
var _local3 = 0;
while (_local3 < traffic_slots.length) {
_local1.push(_local3);
_local3++;
}
traffic_random = [];
_local2 = 0;
while (_local2 < level_info.traffic) {
var _local4 = Math.floor(Math.random() * _local1.length);
traffic_random[_local2] = traffic_slots[_local1[_local4]];
_local1[_local4] = _local1[_local1.length - 1];
_local1.pop();
_local2++;
}
}
function numbers(n_len, n_id, n_amount, n_path) {
n_broken = n_amount.toString();
temp_zero = "";
a = n_len;
while (a > n_broken.length) {
temp_zero = temp_zero + "0";
a--;
}
n_broken = temp_zero + n_broken;
a = 0;
while (a < n_len) {
n_path[n_id + (a + 1)].gotoAndStop(Number(n_broken.substr(a, 1)) + 1);
a++;
}
n_path.d1;
}
function numbers_no_zeros(n_len, n_id, n_amount, n_path) {
a = 1;
while (a <= n_len) {
n_path[n_id + a]._visible = a > (n_len - Number(n_amount).toString().length);
a++;
}
n_broken = n_amount.toString();
temp_zero = "";
a = n_len;
while (a > n_broken.length) {
temp_zero = temp_zero + "0";
a--;
}
n_broken = temp_zero + n_broken;
a = 0;
while (a < n_len) {
n_path[n_id + (a + 1)].gotoAndStop(Number(n_broken.substr(a, 1)) + 1);
a++;
}
n_path.d1;
}
function numbers_straight(n_len, n_amount, n_path, n_var) {
n_broken = n_amount.toString();
temp_zero = "";
a = n_len;
while (a > n_broken.length) {
temp_zero = temp_zero + "0";
a--;
}
n_broken = temp_zero + n_broken;
n_path[n_var] = n_broken;
n_path.d1;
}
function road_logic() {
if ((!freeze) && (!hold)) {
check_key_status();
shake++;
shake = shake % 2;
all._y = 0 + ((shake * shaker) * (player.actual_speed * 0.1));
shaker = (player._x <= (road_min + 20)) || (player._x >= (road_max - 20));
nav.distance.you._y = (-252 * distance) / level_info.distance;
player.old_position = {x:player._x, y:player._y, x_speed:player.x_speed, y_speed:player.actual_speed};
if (key_n && (!n_pressed)) {
n_pressed = true;
distance = level_info.distance;
}
if (!key_n) {
n_pressed = false;
}
if ((key_space && (!space_pressed)) && (powerup_held != "")) {
space_pressed = true;
howard_root["activate_" + powerup_held]();
}
if (!key_space) {
space_pressed = false;
}
var _local2 = Math.min(100, Math.floor(20000 / player.auto_distance));
if ((_local2 > 0) && (Math.abs(_local2 - player.vol_auto) > 20)) {
fx("driving_auto", 1, _local2);
player.vol_auto = _local2;
}
_local2 = Math.min(70, Math.floor(3000 / player.a1_distance));
if ((_local2 > 0) && (Math.abs(_local2 - player.vol_ai) > 20)) {
fx("driving_a1", 1, _local2);
player.vol_ai = _local2;
}
player.a1_distance = 1000;
player.auto_distance = 1000;
gear = (player.y_speed >= 0) + (player.y_speed >= general.gear1_max);
if (player.old_actual_speed != player.actual_speed) {
if ((player.actual_speed >= 16) && (player.old_actual_speed < 16)) {
fx("accelerate", 1, 30);
} else if ((player.actual_speed >= 18) && (player.old_actual_speed < 18)) {
fx("accelerate", 1, 30);
} else if ((player.actual_speed >= 20) && (player.old_actual_speed < 20)) {
fx("accelerate", 1, 30);
}
player.old_actual_speed = player.actual_speed;
}
player.y_pot = ((((general[("gear" + (1 + key_up)) + "_max"] + speed_boost) * (!key_down)) * (!player.side_swipe)) * (!player.off_road)) * (!end_condition);
player.y_speed = player.y_speed + ((general[("gear" + gear) + "_acc"] * Math.max(acc_multiplier, 1)) * (player.y_pot > player.y_speed));
player.y_speed = player.y_speed - ((general[("gear" + gear) + "_acc"] + (((key_down || (player.off_road)) || (end_condition)) * general.brake)) * (player.y_pot < player.y_speed));
player.y_speed = Math.max(player.y_speed, 0);
player.actual_speed = Math.round(player.y_speed);
if ((key_down && (player.actual_speed > (general.gear2_max * 0.5))) || (skidding)) {
skidding = true;
place_skid(player.y_speed, player._x, player._y, player._height, 2);
}
if ((!key_down) && (skidding)) {
skidding = false;
skid_fx = false;
stop_fx("skid2");
}
if (skidding && (!skid_fx)) {
fx("skid2", 1, 100);
skid_fx = true;
}
if (this._y > (road_height * 0.5)) {
all.road.starter._visible = 0;
}
this._y = this._y + player.actual_speed;
this._y = this._y % road_height;
if (end_condition && (auto_player)) {
player._y = player._y - (end_speed - player.actual_speed);
}
all.over._y = this._y;
if (!player.side_swipe) {
x_pot = (((player.y_speed * (key_right - key_left)) * 0.3) * (!player.off_road)) * (!end_condition);
player.temp_speed = player.temp_speed - (x_pot < player.x_speed);
player.temp_speed = player.temp_speed + (x_pot > player.x_speed);
player.x_speed = player.temp_speed;
}
if (player.side_swipe) {
place_skid(player.y_speed, player._x, player._y, player.car.body._height, 2);
x_pot = 0;
player.x_speed = player.x_speed + (0.2 * (x_pot > player.x_speed));
player.x_speed = player.x_speed - (0.2 * (x_pot < player.x_speed));
if (Math.abs(player.x_speed) < 1) {
player.x_speed = 0;
player.temp_speed = 0;
player.pot_rot = 0;
player.side_swipe = false;
}
}
player._x = player._x + player.x_speed;
player.lane = Math.floor(player._x / general.lane_width) + 1;
distance = distance + (player.y_speed * 0.01);
if ((player._x <= road_min) || (player._x >= road_max)) {
if (!player.off_road) {
fx("sb_out", 1, 100);
}
if (player.y_speed < 1) {
if (!player.lost) {
lose();
}
player.lost = true;
}
player.off_road = true;
} else if ((key_level || (distance >= level_info.distance)) && (!end_condition)) {
level_complete();
end_speed = player.actual_speed;
} else if (key_life) {
add_live();
}
if (Math.round(distance) != old_distance) {
old_distance = Math.round(distance);
scorer(general.points_for_distance);
}
car_collision();
nav.mon = "Distance: " + Math.round(distance);
nav.speeder.speed_mask._width = ((speed_mask_max / (general.gear2_max + general.powerup_speed_boost)) * player.y_speed) * burn_out;
angle_bash(player);
clocker();
all.traffic.hotspot._x = player._x;
all.traffic.hotspot._y = player._y;
all.traffic.hotspot._rotation = player.car._rotation;
}
}
function powerup_oil() {
powerup_held = "oil";
missiles_held = 0;
oil_held = 3;
nav.cards.gotoAndStop(16);
nav.cards.cards.gotoAndPlay(1);
}
function powerup_time() {
seconds = seconds + general.powerup_time_boost;
}
function powerup_missiles() {
powerup_held = "missile";
oil_held = 0;
missiles_held = 3;
if (distance > 0) {
nav.cards.gotoAndStop(6);
nav.cards.cards.gotoAndPlay(1);
} else {
nav.cards.gotoAndStop(5);
}
}
function powerup_speed() {
if (!player.speed) {
player.speed = player.createEmptyMovieClip("spd", player.getNextHighestDepth());
acc_multiplier = general.powerup_acc_multiplier;
speed_boost = general.powerup_speed_boost;
player.car.gotoAndStop(2);
player.speed.timer = general.powerup_speed_duration * 30;
player.speed.goinit = true;
all.traffic.hotspot.gotoAndStop(2);
player.speed.onEnterFrame = function () {
if (this.goinit) {
this.goinit = false;
fx("speed_burst", 100, 100);
}
if ((!freeze) && (!hold)) {
this.timer--;
if (this.timer <= 0) {
stop_fx("speed_burst");
speed_boost = 0;
player.y_speed = player.y_speed * 0.6;
acc_multiplier = 0;
player.car.gotoAndStop(1);
all.traffic.hotspot.gotoAndStop(1);
player.speed = null;
this.removeMovieClip();
}
}
};
} else {
player.speed.timer = general.powerup_speed_duration * 30;
}
}
function activate_oil() {
oil_held--;
if (oil_held == 0) {
powerup_held = "";
}
fx("champagne", 1, 100);
player.createEmptyMovieClip("oil", player.getNextHighestDepth());
player.oil.timer = 0;
player.oil.count = 0;
player.oil.onEnterFrame = function () {
if ((!freeze) && (!hold)) {
this.timer++;
this.timer = this.timer % 1;
if (!this.timer) {
this.count++;
drop_oil(this.count % 2);
if (this.count >= general.oil_amount) {
this.removeMovieClip();
}
}
}
};
}
function drop_oil(pos) {
oil_on = true;
oil_lev = all.oil.getNextHighestDepth();
trg = all.oil.attachMovie("oil", "oil" + oil_lev, oil_lev);
trg._x = (player._x - 20) + (40 * pos);
trg.x_speed = -10 + (20 * pos);
trg._rotation = int(Math.random() * 360);
trg._x = trg._x - (int(Math.random() * 11) - 5);
trg._y = general.player_y_position;
trg._xscale = (trg._yscale = 50);
trg.onEnterFrame = oil_logic;
update_oil();
}
function oil_logic() {
if ((!freeze) && (!hold)) {
this._xscale = (this._yscale = this._yscale + (10 * (this._yscale < 150)));
this._y = this._y + player.actual_speed;
this._x = this._x + this.x_speed;
this.x_speed = this.x_speed * 0.7;
if (this._y > 600) {
this.removeMovieClip();
check_last_oil();
}
}
}
function check_last_oil() {
oil_on = false;
for (o in all.oil) {
oil_on = true;
}
}
function activate_missile() {
var _local1 = ((player.car._currentframe - 1) % 2) + 3;
if (player.car._currentframe != _local1) {
shoot_animation = true;
missiles_held--;
update_missiles();
if (missiles_held == 0) {
powerup_held = "";
}
player.car.gotoAndStop(_local1);
}
}
function shoot_missile() {
fx("throw", 1, 100);
missile_on = true;
missile_lev = all.missiles.getNextHighestDepth();
trg = all.missiles.attachMovie("missile", "missile" + missile_lev, missile_lev);
trg._x = player._x - 19.5;
trg._y = general.player_y_position - 60;
trg.onEnterFrame = missile_logic;
}
function missile_logic() {
if ((!freeze) && (!hold)) {
this._y = this._y - general.missile_speed;
if (this._y < 0) {
this.removeMovieClip();
check_last_missile();
}
}
}
function check_last_missile() {
missile_on = false;
for (m in all.missiles) {
missile_on = true;
}
}
function update_missiles() {
nav.cards.gotoAndStop(missiles_held + 2);
}
function update_oil() {
nav.cards.gotoAndStop((oil_held + 2) + 10);
}
function set_up_sounds() {
sounds.createEmptyMovieClip("sounds", sounds.getNextHighestDepth());
sounds.createEmptyMovieClip("sounds_button", sounds.getNextHighestDepth());
a = 0;
while (a < sound_list.length) {
var _local2 = sound_list[a];
var _local3 = sounds.sounds;
if ((_local2 == "rollover") || (_local2 == "mouse_down")) {
_local3 = sounds.sounds_button;
}
var _local4 = _local3.createEmptyMovieClip("sound" + _local2, a);
this["sound" + _local2] = new Sound(_local4, true);
this["sound" + _local2].attachSound(_local2);
a++;
}
}
function fx_bash() {
var _local1 = "bash" + bash_index;
fx(_local1, 1, 100);
bash_index = (bash_index + 1) % 3;
}
function fx(stp, loop, vol) {
if (stp == "music_main") {
if (!music_main) {
music_main = true;
this["sound" + stp].setVolume(vol);
this["sound" + stp].start(0, loop);
}
} else {
var _local3 = this["sound" + stp];
if (_local3) {
_local3.setVolume(vol);
_local3.start(0, loop);
}
}
sounds.sounds["sound" + stp].onEnterFrame = null;
return(this["sound" + stp]);
}
function stop_fx(stp) {
this[stp] = false;
this["sound" + stp].stop();
sounds.sounds["sound" + stp].onEnterFrame = null;
}
function fade_fx(stp) {
sounds.sounds["sound" + stp].trg_snd = this["sound" + stp];
sounds.sounds["sound" + stp].stp = stp;
sounds.sounds["sound" + stp].onEnterFrame = function () {
this.vol = this.trg_snd.getVolume();
this.trg_snd.setVolume(this.vol - general.music_fade_steps);
if (this.vol <= 0) {
stop_fx(this.stp);
this.onEnterFrame = null;
}
};
}
function mute_sound(mute) {
howard_root.mute = mute;
muted = new Sound(sounds.sounds);
if (mute) {
muted.setVolume(0);
nav.butts.mute.gotoAndStop(2);
} else {
muted.setVolume(100);
nav.butts.mute.gotoAndStop(1);
}
}
function load_config() {
config = new XML();
config.ignoreWhite = true;
var _local1 = "";
_local1 = _local1 + "<Root_Element>";
_local1 = _local1 + "<hiscore server=\"\" user=\"/games/common/user_name/getUserInfo.jhtml\" score=\"/common/score/Scoreboard.jhtml\" submit=\"/common/score/Scoreboard.jhtml\" />";
_local1 = _local1 + "<general lane_width=\"80\" lane_height=\"380\" gear1_max=\"12\" gear1_acc=\"0.4\" gear2_max=\"24\" gear2_acc=\"0.1\" traffic_y_swap=\"1000\" player_y_position=\"260\" traffic_start_y_min=\"380\" brake=\"0.25\" time_multiplier=\"1\" titles_timer=\"1\" side_swipe_max=\"3\" powerup_time_boost=\"5\" powerup_acc_multiplier=\"5\" powerup_speed_boost=\"8\" powerup_speed_duration=\"6\" oil_amount=\"12\" music_fade_steps=\"5\" points_for_distance=\"5\" points_off_road=\"100\" points_for_shoot=\"200\" missile_speed=\"8\"/>";
_local1 = _local1 + "<level1 lanes=\"5\" start_lane=\"3\" traffic=\"10\" traffic_speed_range=\"16,24\" traffic_acc_range=\"0.2,0.4\" ai1_chance=\"6\" distance=\"200\" seconds=\"60\" powerup_chance=\"10\"/>";
_local1 = _local1 + "<high_scores place1=\"POP,53678\" place2=\"TLK,50345\" place3=\"CDL,48099\" place4=\"JIG,45923\" place5=\"SAW,44238\" place6=\"MTV,43946\" place7=\"PON,43885\" place8=\"TIA,42676\" place9=\"CSO,41271\" place10=\"LST,40645\"/>";
_local1 = _local1 + "</Root_Element>";
config.parseXML(_local1);
sort_config();
}
function load_saved() {
so = SharedObject.getLocal("profiles");
if (!so.data.profiles.length) {
so.data.profiles = [];
high_score = 0;
} else {
so.data.profiles.sortOn("score", Array.NUMERIC | Array.DESCENDING);
high_score = so.data.profiles[0].score;
}
save_loaded = true;
}
function sort_config() {
game_config = {};
t_info = config.childNodes[0];
for (a in t_info.childNodes) {
temp_section = t_info.childNodes[a];
temp_section_name = temp_section.nodeName;
game_config[temp_section_name] = {};
for (b in temp_section.attributes) {
temp_section_var_name = b;
temp_section_var_value = array_string_or_number(temp_section.attributes[b]);
game_config[temp_section_name][temp_section_var_name] = temp_section_var_value;
}
}
cpu_high_scores = [];
a = 1;
while (a <= 10) {
cpu_high_scores.push({name:game_config.high_scores["place" + a][0], score:Number(game_config.high_scores["place" + a][1])});
a++;
}
config_loaded = true;
var _local3 = new Hiscore("sb_dilemma");
}
function load_sound_library() {
howard_root.sound_list = ["ready_go", "1up", "sb_out", "car_off", "hiscore", "speed_burst", "rollover", "mouse_down", "driving_auto", "driving_a1", "idling", "driving", "skid1", "skid2", "side_swipe", "bash0", "bash1", "bash2", "music1", "music2", "music3", "music4", "music_lose", "music_win", "music_main", "go", "accelerate", "sound_powerup", "sound_explosion", "champagne", "throw", "message"];
var _local4 = _root.createEmptyMovieClip("temp_clip", _root.getNextHighestDepth());
_root.sounds = _root.createEmptyMovieClip("sounds_clip", _root.getNextHighestDepth());
_local4.onEnterFrame = function () {
total = _root.getBytesTotal();
loaded = _root.getBytesLoaded();
if (total > 0) {
var _local3 = loaded / total;
if (_local3 < 1) {
_root.loader.gotoAndStop(Math.floor(_local3 * 11) + 1);
} else {
_root.set_up_sounds();
_root.fx("music_main", 1000000, 100);
_root.loader.gotoAndPlay(12);
this.removeMovieClip();
}
}
};
}
function start_butt(show_intro) {
gotoAndStop ("game");
if (show_intro) {
show_menu("help");
} else {
lives = init_lives;
show_menu("main");
}
}
function display_hiscore() {
gotoAndStop ("game");
show_menu("scores");
}
function array_string_or_number(value) {
value = value.split(",");
if (value.length == 1) {
value = value[0];
if (!isNaN(value)) {
value = Number(value);
}
}
return(value);
}
function pause_game(pause_to) {
freeze = pause_to;
}
function reset_game() {
level = 1;
rounds = 0;
score = 0;
lives = 0;
temp_score = 0;
level_score = [0, 0, 0, 0];
}
function hide_quit() {
nav.butts.mute.button.enabled = true;
nav.butts.help.enabled = true;
nav.butts.quit.enabled = true;
pause_game(false);
var _local1 = nav.message.message._currentframe;
if ((_local1 > 1) && (_local1 < nav.message.message._totalframes)) {
nav.message.message.play();
}
nav.animation_holder.animations.holder.play();
if ((!mute) && (round_started)) {
fx("music1", 1000000, 75);
fx("driving", 10000, 25);
if (player.speed) {
fx("speed_burst", 100, 100);
}
}
}
function show_quit() {
pause_game(true);
nav.message.message.stop();
nav.animation_holder.animations.holder.stop();
if (!mute) {
stop_fx("music1");
stop_fx("music_main");
stop_fx("ready_go");
stop_fx("idling");
stop_fx("driving");
stop_fx("speed_burst");
}
nav.mQuitMenu.gotoAndPlay(2);
nav.butts.mute.button.enabled = false;
nav.butts.help.enabled = false;
nav.butts.quit.enabled = false;
}
function show_help() {
nav.butts._visible = 0;
pause_game(true);
show_menu("help");
nav.message.message.stop();
nav.animation_holder.animations.holder.stop();
if (!mute) {
stop_fx("music1");
stop_fx("music_main");
stop_fx("ready_go");
stop_fx("idling");
stop_fx("driving");
stop_fx("speed_burst");
}
}
function continue_game() {
nav.butts._visible = 1;
pause_game(false);
var _local1 = nav.message.message._currentframe;
if ((_local1 > 1) && (_local1 < nav.message.message._totalframes)) {
nav.message.message.play();
}
nav.animation_holder.animations.holder.play();
menu.removeMovieClip();
if ((!mute) && (round_started)) {
fx("music1", 1000000, 75);
fx("driving", 10000, 25);
if (player.speed) {
fx("speed_burst", 100, 100);
}
}
}
function clocker() {
seconds = seconds - (((1 / fps) * general.time_multiplier) * (!end_condition));
display_seconds = Math.floor(seconds);
numbers(2, "t", display_seconds, nav);
if ((display_seconds <= 0) && (!end_condition)) {
end_condition = true;
lose();
}
}
function intro_animation() {
trg = nav.animation_holder.attachMovie("animations", "animations", 1);
trg.gotoAndStop("intro");
trg.onEnterFrame = function () {
if (!freeze) {
if (this.holder._currentframe == this.holder._totalframes) {
start_flag();
player._visible = 1;
player.shad_trg._visible = 1;
this.removeMovieClip();
stop_fx("idling");
fx("driving", 10000, 25);
} else {
var _local2 = (rounds % 2) == 1;
this.holder.headlight._visible = _local2;
this.holder.hotspot._visible = _local2;
}
}
};
}
function outro_animation() {
nav.distance._visible = 0;
nva.butts._visible = false;
nav.gotoAndStop(2);
fade_fx("music_main");
fx("music_win", 2, 100);
clear_traffic();
trg = nav.animation_holder.attachMovie("animations", "animations", 1);
trg.gotoAndStop("outro");
trg.onEnterFrame = function () {
if ((!freeze) && (!hold)) {
if (this.holder._currentframe == this.holder._totalframes) {
stop_fx("music_main");
if (level > 4) {
level = 1;
}
unlock();
nav.removeMovieClip();
fade_fx("music_win");
}
}
};
}
function clear_traffic() {
stop_fx("speed_burst");
Key.removeListener(all);
all.removeMovieClip();
all_mask.removeMovieClip();
}
function start_flag() {
fx("ready_go", 1, 50);
nav.message.gotoAndStop("start");
nav.message.message.timer = 0;
nav.message.message.count = 0;
fade_fx("music_main");
nav.message.message.onEnterFrame = function () {
if (!freeze) {
if (this._currentframe == this._totalframes) {
this.gotoAndStop(1);
this.onEnterFrame = null;
round_started = true;
fx("music1", 1000000, 75);
hold = false;
player.createEmptyMovieClip("skid_start", 1973);
player.skid_start.timer = 0;
burn_out = 5;
acc_multiplier = 2;
player.skid_start.onEnterFrame = function () {
place_skid(player.y_speed, player._x, player._y, player.car.body._height, 2);
this.timer++;
burn_out = burn_out - 0.0444444444444444;
if (this.timer >= 90) {
this.removeMovieClip();
burn_out = 1;
acc_multiplier = 0;
}
};
fx("go", 1, 50);
} else {
all.traffic.hotspot._visible = true;
all.traffic.hotspot._x = player._x;
all.traffic.hotspot._y = player._y;
this.timer++;
if (this.timer >= (general.titles_timer * 30)) {
this.count++;
this.play();
this.timer = 0;
}
}
}
};
}
function level_complete() {
end_condition = true;
auto_player = true;
fade_fx("music" + level);
stop_fx("driving");
stop_fx("driving_a1");
stop_fx("driving_auto");
rounds++;
nav.message.gotoAndStop("goal");
nav.message.message.timer = 0;
nav.message.message.onEnterFrame = function () {
if (!freeze) {
this.timer++;
if (this.timer >= (general.titles_timer * 30)) {
this.play();
}
if (this._currentframe == this._totalframes) {
this._parent.gotoAndStop(1);
level_score[level - 1] = score;
outro_animation();
}
}
};
traffic_end_logic();
}
function quit_game() {
pause_game(false);
round_started = true;
lives = 1;
lose();
}
function lose() {
if (!round_started) {
return(undefined);
}
round_started = false;
fade_fx("music" + level);
stop_fx("driving");
stop_fx("driving_a1");
stop_fx("driving_auto");
fx("music_lose", 1, 100);
level_score[level - 1] = score;
traffic_end_logic();
trg = all.bubbles.attachMovie("bubbles", "bubbles", 1);
trg.onEnterFrame = function () {
this._x = Math.min(Math.max(player._x, -40), 280);
this._y = general.player_y_position;
if (player._x < 0) {
this.gotoAndStop("left" + level);
} else {
this.gotoAndStop("right" + level);
}
if (this.bubble._currentframe == this.bubble._totalframes) {
fail_message();
this.removeMovieClip();
}
};
}
function fail_message() {
if (lives > 1) {
nav.message.gotoAndStop("tryagain");
} else {
nav.message.gotoAndStop("lose");
}
nav.message.message.timer = 0;
nav.message.message.onEnterFrame = function () {
if (!freeze) {
if (this._currentframe == this._totalframes) {
this.gotoAndStop(1);
this.onEnterFrame = null;
fade_fx("music_lose");
clear_traffic();
nav.removeMovieClip();
lives--;
if (lives > 0) {
show_menu("main");
} else {
show_menu("submit");
}
} else {
this.timer++;
if (this.timer >= (general.titles_timer * 30)) {
this.play();
}
}
}
};
}
function got_powerup(trg) {
fx("sound_powerup", 1, 100);
howard_root["powerup_" + trg.powerup.type]();
trg.powerup.removeMovieClip();
}
function unlock() {
nav.removeMovieClip();
clear_traffic();
unlock_level = true;
show_menu("main");
}
function show_menu(frame) {
attachMovie("menus", "menu", 40);
menu.gotoAndStop(frame);
switch (frame) {
case "scores" :
stop_fx("music_main");
fx("hiscore", 1, 100);
break;
case "help" :
break;
case "main" :
if (unlock_level) {
unlock_level = false;
menu.unlock.gotoAndStop(level + 1);
menu.unlock2.gotoAndStop(level + 1);
} else {
menu.select.gotoAndStop(level + 1);
menu.unlock2.gotoAndStop(level + 1);
menu.unlock2.holder.gotoAndStop(25);
}
fx("music_main", 1000000, 100);
a = 1;
while (a <= 4) {
if (a > level) {
menu["level" + a].gotoAndStop(2);
} else {
menu["level" + a].gotoAndStop(1);
}
a++;
}
break;
case "submit" :
fx("music_main", 1000000, 100);
enter_name();
}
}
function enter_name() {
numbers_no_zeros(6, "s", temp_score, menu.score);
menu.score.score_dot._visible = temp_score >= 1000;
var _local2 = 6;
var _local1 = temp_score;
while (_local1 >= 1) {
_local2--;
_local1 = _local1 / 10;
}
menu.score._x = 176 - (_local2 * 22);
}
function submit_score() {
_root.score = temp_score;
Key.removeListener(keyListener);
show_menu("scores");
}
function set_up_scores() {
for (a in so.data.profiles) {
cpu_high_scores.push(so.data.profiles[a]);
}
cpu_high_scores.sortOn("score", Array.NUMERIC | Array.DESCENDING);
so.data.profiles.sortOn("score", Array.NUMERIC | Array.DESCENDING);
high_score = so.data.profiles[0].score;
}
function play_again() {
level_score = [0, 0, 0, 0];
lives = init_lives;
rounds = 0;
score = 0;
level = 1;
show_menu("main");
}
function start_game() {
start_level(level);
menu.onEnterFrame = function () {
if (this._currentframe == this._totalframes) {
this.removeMovieClip();
}
};
}
function add_live() {
if (nav.lives._currentframe < nav.lives._totalframes) {
lives++;
nav.lives.gotoAndStop(lives + 1);
fx("1up", 1, 100);
}
}
function scorer(amount) {
var _local2 = score;
score = score + amount;
if (Math.floor(_local2 / 10000) != Math.floor(score / 10000)) {
add_live();
}
nav.score.onEnterFrame = function () {
if (!freeze) {
if (temp_score < score) {
if ((score - temp_score) > 100) {
temp_score = temp_score + 100;
}
if (((score - temp_score) > 10) && ((score - temp_score) <= 100)) {
temp_score = temp_score + 10;
}
if (((score - temp_score) >= 1) && ((score - temp_score) <= 10)) {
temp_score = temp_score + 1;
}
}
numbers_no_zeros(6, "s", temp_score, nav.score);
nav.score.score_dot._visible = temp_score >= 1000;
if (temp_score == score) {
delete this.onEnterFrame;
}
}
};
}
stop();
this._lockroot = true;
xml_path = "config.xml";
sound_library_path = "sound_library.swf";
_global.howard_root = this;
_root.howard_root = this;
music_main = false;
fps = 31;
stage_height = 400;
stage_width = 600;
speed_mask_max = 94;
mute = false;
temp_traffic_height = 140;
temp_traffic_width = 60;
level = 1;
rounds = 0;
init_lives = 3;
lives = 0;
score = 0;
temp_score = 0;
level_score = [0, 0, 0, 0];
powerups = ["oil", "time", "speed", "missiles"];
bash_index = 0;
load_saved();
load_config();
load_sound_library();
Instance of Symbol 80 MovieClip "version" in Frame 1
onClipEvent (load) {
this.swapDepths(9999999);
this._visible = 0;
version = "BETA_v0.3.2";
this.keyListener = new Object();
this.keyListener.onKeyDown = function () {
if (Key.isDown(86) && (Key.isDown(16))) {
howard_root.version._visible = !howard_root.version._visible;
}
};
Key.addListener(this.keyListener);
}
Frame 2
loader.gotoAndPlay(12);
fx("music_main", 1000000, 100);
Symbol 32 MovieClip [explosion_mark] Frame 49
stop();
Symbol 41 MovieClip [hotspot_mc] Frame 1
stop();
Symbol 48 Button
on (press) {
scrollbar.moveUpdate(-10);
}
Symbol 51 Button
on (press) {
scrollbar.moveUpdate(10);
}
Symbol 55 MovieClip [hiscore_list] Frame 1
#initclip 4
Object.registerClass("hiscore_list", ScoreList);
#endinitclip
Instance of Symbol 54 MovieClip "scrollbar" in Symbol 55 MovieClip [hiscore_list] Frame 1
onClipEvent (load) {
function update() {
var _local2 = (_y - mMin) / (mMax - mMin);
_parent.setPercent(_local2);
}
function moveUpdate(dy) {
var _local1 = _y + dy;
_y = Math.max(mMin, Math.min(mMax, _local1));
update();
}
mMin = 18;
mMax = 78;
mDragging = false;
mShiftY = 0;
_y = mMin;
}
on (press) {
mDragging = true;
mShiftY = this._ymouse;
}
on (release, releaseOutside) {
mDragging = false;
}
onClipEvent (mouseMove) {
if (mDragging) {
var my = (_parent._ymouse - mShiftY);
if (my < mMin) {
my = mMin;
} else if (my > mMax) {
my = mMax;
}
this._y = my;
update();
}
}
Symbol 71 Button
on (release, keyPress "<Space>") {
howard_root.fx("mouse_down", 0, 100, 0);
howard_root.start_butt(false);
}
on (rollOver) {
howard_root.fx("rollover", 0, 100, 0);
}
Symbol 72 Button
on (release) {
howard_root.fx("mouse_down", 0, 100, 0);
howard_root.start_butt(true);
}
on (rollOver) {
howard_root.fx("rollover", 0, 100, 0);
}
Symbol 73 Button
on (release) {
howard_root.fx("mouse_down", 0, 100, 0);
howard_root.display_hiscore();
}
on (rollOver) {
howard_root.fx("rollover", 0, 100, 0);
}
Symbol 74 MovieClip Frame 1
stop();
Symbol 74 MovieClip Frame 17
stop();
Symbol 80 MovieClip Frame 1
var startTime = getTimer();
var numFrames = 0;
var recentSetting = 10;
var recentNumFrames = 0;
var recentStartTime = startTime;
function calcFPS() {
numFrames++;
var _local1 = getTimer();
elapsedSeconds = (_local1 - startTime) / 1000;
actualFPS = int(numFrames / elapsedSeconds);
recentNumFrames++;
if (recentNumFrames == recentSetting) {
var _local2 = (_local1 - recentStartTime) / 1000;
recentFPSoutput = int(recentNumFrames / _local2);
recentStartTime = _local1;
recentNumFrames = 0;
}
}
this.swapDepths(9999999991);
Instance of Symbol 79 MovieClip "callCalcFPS" in Symbol 80 MovieClip Frame 1
onClipEvent (enterFrame) {
_parent.calcFPS();
}
Symbol 84 Button
on (keyPress "<Left>") {
return(undefined);
}
on (keyPress "<Right>") {
return(undefined);
}
on (keyPress "<Up>") {
return(undefined);
}
on (keyPress "<Down>") {
return(undefined);
}
on (keyPress "<Space>") {
return(undefined);
}
Symbol 604 MovieClip [__Packages.Hiscore] Frame 0
class Hiscore
{
var mLoader, mScoreData, mCaller, mCallback;
function Hiscore (gamename) {
singleton = this;
mGameName = gamename;
mLoader = new LoadVars();
mLoader.onLoad = Delegate.create(this, onLoginLoad);
mLoader.load(getBasePath() + getUserPath());
}
function getUserName() {
return(mUserName);
}
function print_loader() {
for (var _local2 in mLoader) {
}
}
function getBasePath() {
return(_root.game_config.hiscore.server);
}
function onLoginLoad(success) {
if (success) {
mUserName = mLoader.screenName;
var _local2 = mUserName.indexOf(newline);
if (_local2 >= 0) {
mUserName = mUserName.substr(0, _local2);
}
}
if (((((mUserName == undefined) || (mUserName == "undefined")) || (mUserName == null)) || (mUserName == "null")) || (mUserName.length == 0)) {
mUserName = "";
}
}
function getUserPath() {
return(_root.game_config.hiscore.user);
}
function getScorePath() {
return((_root.game_config.hiscore.score + "?msg=Q&game=") + mGameName);
}
function getSubmitPath(uname, uscore) {
if ((uname && (uname.length > 0)) && (uscore > 0)) {
if (mScoreData) {
var _local3 = 0;
while (_local3 < mScoreData.length) {
var _local4 = mScoreData[_local3];
if ((_local4.name == uname) && (_local4.score >= uscore)) {
return(getScorePath());
}
_local3++;
}
}
return((((((_root.game_config.hiscore.submit + "?msg=S&game=") + mGameName) + "&name=") + uname) + "&score=") + uscore);
}
return(getScorePath());
}
function submitScore(score, caller, callback) {
mCaller = caller;
mCallback = callback;
mLoader = new LoadVars();
mLoader.onLoad = Delegate.create(this, onScore);
mLoader.load(getBasePath() + getSubmitPath(mUserName, score));
}
function queryScores(caller, callback) {
mCaller = caller;
mCallback = callback;
mLoader = new LoadVars();
mLoader.onLoad = Delegate.create(this, onScore);
mLoader.load(getBasePath() + getScorePath());
}
function onScore(success) {
mScoreData = new Array();
var _local2 = 0;
while (_local2 < 100) {
var _local3 = new Object();
_local3.name = mLoader["pn" + _local2];
_local3.score = parseInt(mLoader["ps" + _local2]);
mScoreData.push(_local3);
_local2++;
}
mCaller[mCallback](mScoreData);
}
static var singleton = null;
var mGameName = "";
var mUserName = "";
}
Symbol 605 MovieClip [__Packages.Delegate] Frame 0
class Delegate
{
function Delegate () {
}
static function create(target, handler) {
var extraArgs = arguments.slice(2);
var delegate;
delegate = function () {
var _local2 = arguments.concat(extraArgs, [delegate]);
return(handler.apply(target, _local2));
};
return(delegate);
}
}
Symbol 606 MovieClip [__Packages.ScoreList] Frame 0
class ScoreList extends MovieClip
{
var mListClip;
function ScoreList () {
super();
}
function setPercent(percent) {
var _local2 = mListClip._height - 134;
if (_local2 < 0) {
_local2 = 0;
}
mListClip._y = (-_local2) * percent;
}
function onLoad() {
if (_root.score > 0) {
Hiscore.singleton.submitScore(_root.score, this, "onScore");
} else {
Hiscore.singleton.queryScores(this, "onScore");
}
}
function onScore(all_scores) {
var _local13 = false;
var _local14 = new Object();
var _local10 = 0;
var _local9 = 0;
while (_local9 < all_scores.length) {
var _local4 = all_scores[_local9];
if ((_local4.name == "") || (_local4.name == undefined)) {
break;
}
if (_local14[_local4.name] != undefined) {
} else {
_local14[_local4.name] = _local4;
var _local3 = mListClip.attachMovie("score_item", "si:" + _local10, mListClip.getNextHighestDepth());
_local3._y = _local10 * 28;
_local3.caption = ((("" + (_local10 + 1)) + ". ") + _local4.name) + " ";
_local3.score = _local4.score.toString();
var _local8 = _local3.caption.length + _local3.score.length;
var _local7 = 42;
var _local5 = 0;
while (_local5 < _local3.caption.length) {
switch (_local3.caption[_local5]) {
case "W" :
case "w" :
_local7 = _local7 - 1;
break;
case "I" :
case "i" :
_local7 = _local7 + 1;
}
_local5++;
}
while (_local8 < _local7) {
_local8 = _local8 + 2;
_local3.caption = _local3.caption + " -";
}
if (_local3.score >= 1000) {
var _local11 = Math.floor(_local4.score / 1000);
var _local12 = _local4.score - (_local11 * 1000);
var _local6 = _local12.toString();
while (_local6.length < 3) {
_local6 = "0" + _local6;
}
_local3.score = (_local11.toString() + ",") + _local6;
}
if (((!_local13) && (_root.score == _local4.score)) && (_local4.name == Hiscore.singleton.getUserName())) {
_local13 = true;
_local3.mCaption.textColor = 4143913 /* 0x3F3B29 */;
_local3.mScore.textColor = 4143913 /* 0x3F3B29 */;
}
_local10++;
}
_local9++;
}
setPercent(0);
_root.score = 0;
}
}
Symbol 87 MovieClip Frame 11
stop();
Symbol 121 MovieClip [skid] Frame 1
stop();
Symbol 124 MovieClip Frame 1
stop();
Symbol 164 Button
on (release) {
_root.fx("mouse_down", 0, 100);
gotoAndStop ("in_game_help");
}
on (rollOver) {
_root.fx("rollover", 0, 100);
}
Symbol 169 Button
on (release) {
_root.fx("mouse_down", 0, 100, 0);
_root.show_menu("scores");
}
on (rollOver) {
howard_root.fx("rollover", 0, 100, 0);
}
Symbol 172 Button
on (release) {
_root.fx("mouse_down", 0, 100, 0);
_root.play_again();
}
on (rollOver) {
howard_root.fx("rollover", 0, 100, 0);
}
Symbol 200 Button
on (release) {
_root.fx("mouse_down", 0, 100, 0);
_root.submit_score();
}
on (rollOver) {
howard_root.fx("rollover", 0, 100, 0);
}
Symbol 204 Button
on (release, keyPress "<Space>") {
_root.fx("mouse_down", 0, 100, 0);
_root.play_again();
}
on (rollOver) {
howard_root.fx("rollover", 0, 100, 0);
}
Symbol 207 Button
on (release) {
_root.fx("mouse_down", 0, 100, 0);
_root.reset_game();
_root.gotoAndStop(2);
this.removeMovieClip();
}
on (rollOver) {
howard_root.fx("rollover", 0, 100, 0);
}
Symbol 212 Button
on (release) {
_root.fx("mouse_down", 0, 100);
if (_root.lives > 0) {
_root.continue_game();
} else {
_root.start_butt(false);
}
}
on (rollOver) {
_root.fx("rollover", 0, 100);
}
Symbol 213 MovieClip [menus] Frame 6
_root.start_game();
Symbol 213 MovieClip [menus] Frame 15
_root.score = 0;
if (Hiscore.singleton.getUserName() == "") {
mSubmitButton.gotoAndStop(2);
} else {
mSubmitButton.gotoAndStop(1);
}
Symbol 213 MovieClip [menus] Frame 27
if (_root.lives > 0) {
gotoAndStop ("help_ingame");
}
Symbol 229 MovieClip Frame 1
stop();
Symbol 262 MovieClip Frame 6
stop();
Symbol 267 MovieClip Frame 1
function getCar() {
var _local2 = _parent;
while (_local2._name != "car") {
_local2 = _local2._parent;
}
return(_local2);
}
Symbol 267 MovieClip Frame 3
_root.shoot_missile();
Symbol 267 MovieClip Frame 9
var car = getCar();
car.gotoAndStop(car._currentframe - 2);
Symbol 272 MovieClip Frame 1
stop();
Symbol 327 MovieClip Frame 22
stop();
Symbol 327 MovieClip Frame 36
stop();
Symbol 327 MovieClip Frame 55
stop();
Symbol 327 MovieClip Frame 67
stop();
Symbol 328 MovieClip Frame 10
stop();
Symbol 328 MovieClip Frame 20
_parent.gotoAndStop(1);
Symbol 330 MovieClip Frame 48
stop();
Symbol 330 MovieClip Frame 65
stop();
Symbol 333 MovieClip Frame 45
stop();
Symbol 333 MovieClip Frame 72
stop();
Symbol 334 MovieClip Frame 1
stop();
Symbol 390 Button
on (release) {
howard_root.mute_sound(true);
howard_root.fx("mouse_down", 1, 100);
}
on (rollOver) {
howard_root.fx("rollover", 1, 100);
}
Symbol 393 Button
on (release) {
howard_root.mute_sound(false);
howard_root.fx("mouse_down", 1, 100);
}
on (rollOver) {
howard_root.fx("rollover", 1, 100);
}
Symbol 394 MovieClip Frame 1
stop();
Symbol 397 Button
on (release) {
howard_root.fx("mouse_down", 1, 100);
howard_root.show_help();
}
on (rollOver) {
howard_root.fx("rollover", 1, 100);
}
Symbol 400 Button
on (release) {
howard_root.fx("mouse_down", 1, 100);
_root.show_quit();
}
on (rollOver) {
howard_root.fx("rollover", 1, 100);
}
Symbol 426 MovieClip Frame 1
stop();
Symbol 449 MovieClip Frame 1
stop();
Symbol 453 MovieClip Frame 4
stop();
Symbol 454 MovieClip Frame 4
stop();
Symbol 455 MovieClip Frame 4
stop();
Symbol 456 MovieClip Frame 10
stop();
Symbol 459 MovieClip Frame 4
stop();
Symbol 460 MovieClip Frame 4
stop();
Symbol 461 MovieClip Frame 4
stop();
Symbol 462 MovieClip Frame 10
stop();
Symbol 463 MovieClip Frame 1
stop();
Symbol 485 Button
on (release) {
howard_root.fx("mouse_down", 1, 100);
this.quit = false;
gotoAndPlay (8);
}
on (rollOver) {
howard_root.fx("rollover", 1, 100);
}
Symbol 486 Button
on (release) {
howard_root.fx("mouse_down", 1, 100);
this.quit = true;
gotoAndPlay (8);
}
on (rollOver) {
howard_root.fx("rollover", 1, 100);
}
Symbol 487 MovieClip Frame 1
stop();
Symbol 487 MovieClip Frame 7
stop();
Symbol 487 MovieClip Frame 13
if (this.quit) {
_root.quit_game();
} else {
_root.hide_quit();
}
Symbol 488 MovieClip [nav] Frame 1
stop();
Symbol 510 MovieClip [road1] Frame 1
stop();
Symbol 515 MovieClip [over1] Frame 1
stop();
Symbol 529 MovieClip Frame 10
stop();
Symbol 544 MovieClip Frame 8
stop();
Symbol 567 MovieClip Frame 12
stop();
Symbol 570 MovieClip Frame 18
stop();
Symbol 571 MovieClip Frame 20
stop();
Symbol 573 MovieClip Frame 46
stop();
Symbol 578 MovieClip Frame 1
if ((_root.rounds % 2) == 0) {
gotoAndStop (2);
} else {
gotoAndStop (1);
}
Symbol 591 MovieClip Frame 1
stop();