Frame 1
Frame 3
function g2w_playagain() {
trace("PLAYAGAIN");
game_stage.gameState = 6;
game_stage.repositionCars();
game_stage.splash.gotoAndStop("frmSelectCar");
}
function getphstatus(phno) {
swfurl = this._url;
if (swfurl.split("gangofgamers.com").length == 1) {
obj_game.ph1_status = true;
}
var _local2 = obj_game[("ph" + phno) + "_status"];
trace("phstatus ->>" + _local2);
if (!_local2) {
play();
}
}
function checkhost() {
swfurl = this._url;
trace("swfurl >>> " + swfurl.indexOf("gangofgamers.com"));
if (swfurl.indexOf("gangofgamers.com") == -1) {
return(false);
}
return(true);
}
function load_rgames(trgt) {
var rel_games = new XML();
rel_games.ignoreWhite = true;
rel_games.onLoad = function () {
game_details = new Object();
var _local1 = 0;
while (_local1 < trgt.rel_games.firstChild.childNodes.length) {
game_details[rel_games.firstChild.childNodes[_local1].nodeName] = rel_games.firstChild.childNodes[_local1].firstChild.nodeValue;
_local1++;
}
};
rel_games.load((curl + "game_details.xml?") + getTimer());
}
function getScore(_loc) {
_loc.gotoAndStop("lbl_top_scores");
_root.g_trg = _loc;
int_gscore = setInterval(_root, "getTop10", 150);
}
function getTop10() {
trace("getTop10");
clearInterval(int_gscore);
_root.send_lv = new XML();
_root.rst_lv = new XML();
_root.rst_lv.onLoad = function (success) {
if (success) {
var _local3 = new it.sephiroth.XML2Object();
_root.lst_top_scorer = _local3.parseXML(this);
_root.g_trg.gotoAndStop("top10");
} else {
_root.c_fail++;
if (_root.c_fail >= 3) {
_root.g_trg.gotoAndStop("error_screen");
} else {
_root.send_lv.sendAndLoad(url, _root.rst_lv, "POST");
}
}
};
var url = ((((((obj_partner.top10URL + "?game_id=") + _root.obj_game._gid) + "&order=") + obj_game._score_ord) + "&timspam") + getTimer());
trace(url + " Url");
_root.send_lv.sendAndLoad(url, _root.rst_lv, "POST");
}
function itemHandler(obj, item) {
getURL (obj_partner.clickthru, "_blank");
}
function _newUser() {
getURL (_registerurl, "_blank");
}
function _trackClickThru(mc) {
trace(mc + " _trackClickThru");
if (obj_partner._allowclick) {
mc.hit_area.onRelease = function () {
getURL (obj_partner.clickthru, "_blank");
};
} else {
mc.hit_area.useHandCursor = false;
}
}
function _readSharedData() {
so_uname = ((_sostatus.data.so_uname == undefined) ? "" : (_sostatus.data.so_uname));
so_jumpframe = ((_sostatus.data.so_jumpframe == undefined) ? "" : (_sostatus.data.so_jumpframe));
so_sound = ((_sostatus.data.so_sound == undefined) ? 0 : (_sostatus.data.so_sound));
_resetString = _sostatus.data.so_resetString;
trace("==========================");
trace((("so_jumpframe : " + _sostatus.data.so_jumpframe) + " : ") + so_uname);
if (so_jumpframe != "") {
_assignValue(_resetString);
createEmptyMovieClip("eye", getNextHighestDepth());
eye.onEnterFrame = function () {
if ((getBytesTotal() == getBytesLoaded()) and (getBytesLoaded() > 50000)) {
intro = 0;
_sostatus.data.so_jumpframe = "";
_sostatus.flush();
this.onEnterFrame = null;
gotoAndStop(so_jumpframe);
}
};
} else {
intro = 1;
play();
}
uname = so_uname;
gamesound = so_sound;
}
function _writeSharedData(jumpframe, jumpurl, _resetString) {
_sostatus.data.so_uname = ((so_uname == undefined) ? "" : (so_uname));
_sostatus.data.so_resetString = _resetString;
_sostatus.data.so_jumpframe = jumpframe;
_writeSoundData();
if (jumpurl != "") {
getURL (jumpurl);
} else {
gotoAndPlay (1);
}
}
function _writeSoundData() {
trace("Sound Share Data Called:");
_sostatus.data.so_sound = so_sound;
_sostatus.flush();
}
function _assignValue(_val) {
_arr = new Array();
_arr = _val.split("|");
i = 0;
while (i < (_arr.length / 2)) {
_var2 = ((i * 2) + 1) - 1;
_var3 = _var2 + 1;
_val = _arr[_var3];
_rst = isNaN(_val);
if (_rst) {
_root[_arr[_var2]] = _arr[_var3];
} else {
_root[_arr[_var2]] = int(_arr[_var3]);
}
i++;
}
}
function _playAgain(mc, jumpframe, _resetString) {
intro = 0;
_assignValue(_resetString);
trace("jumpframe " + jumpframe);
mc.gotoAndStop(jumpframe);
}
function _doGameOver(showskip, score) {
trace("CALLED : _doGameOver " + showskip);
clearInterval(_gameoverinterval);
_root.partner_score = score;
_root.obj_game._gstatus = "gameover";
_gameoverinterval = setInterval(attachGameOverMc, 3000, showskip);
}
function attachGameOverMc(showskip) {
var _local2 = flash.external.ExternalInterface.call("document.URL.toString");
if ((_local2 != null) && (_local2.indexOf("gangofgamers.com") != -1)) {
trace(_local2.indexOf("gangofgamers.com"));
flash.external.ExternalInterface.call("inviziShowHtmlPlaceHolder", "");
}
clearInterval(_gameoverinterval);
_root.__gameover_mc = _root.attachMovie("mc_topscore_box", "mc_gameover", _root.getNextHighestDepth(), {_x:Stage.width / 2, _y:Stage.height / 2});
trace((("CREATED : " + _root.__gameover_mc) + " ,Skip: ") + showskip);
_root.__gameover_mc.gotoAndStop("gameover");
if (showskip) {
_root.__gameover_mc.panel_btn.gotoAndStop("skip");
}
}
_sndBtn._visible = false;
var obj_game = new Array();
obj_game._host = "gog";
obj_game._gid = "1080";
obj_game._tra = "demolition_derby";
obj_game.game_name = "demolition_derby";
obj_game._gtitle = "Demolition Derby";
obj_game._google_text = "Demolition Derby";
obj_game.StageW = 800;
obj_game.StageH = 600;
obj_game._res = (Stage.width + "x") + Stage.height;
obj_game._score_ord = "desc";
obj_game.mochi_tag = "";
obj_game.g2wbot = "ba1f153d";
obj_game.g2wbotid = 10301;
obj_game.ph1_status = false;
obj_game.ph2_status = false;
obj_game.adv_zedo = true;
obj_game.adv_mochi = false;
obj_game.inviziads = ("http://s1.inviziads.com/lookup.html?g=" + obj_game._gid) + "&h=gog";
zedo_tim = 15;
var obj_partner = new Array();
obj_partner.partner_name = "gog";
obj_partner.partner_id = 1;
obj_partner.invalid_txt = "Invalid Nickname!";
obj_partner.show_submit = false;
obj_partner.submitURL = "/submit_score.asp";
obj_partner.top10URL = "/get_top_scorer.asp";
obj_partner.lblsubmit = "Enter your GangofGamers Nickname below";
obj_partner.show_g2w_slate = true;
obj_partner.show_register = true;
obj_partner.text_register = "Create Nickname";
obj_partner.url_register = "/register.asp";
obj_partner.clickthru = "http://www.gangofgamers.com/";
obj_partner._allowclick = true;
_root.uname = "";
scoreSubmit = function (_loc) {
trace(_loc + " _loc");
myname = _root.partner_uname;
myscore = _root.partner_score;
mygameid = _root.obj_game._gid;
myname = myname.trim();
if ((((myname.length == 0) or (myname == obj_partner.invalid_txt)) or (myname == "Connecting Error!")) or (myname == undefined)) {
trace(obj_partner.invalid_txt);
_root.partner_uname = obj_partner.invalid_txt;
} else {
_root.send_lv = new LoadVars();
_root.send_lv.onLoad = function (success) {
if (success) {
if (_root.send_lv.isreg == 0) {
_root.uname = obj_partner.invalid_txt;
_loc.gotoAndStop("invalid_user_screen");
} else if (_root.send_lv.isreg == 1) {
Key.removeListener(_loc.keyListener);
_root.getScore(_loc);
}
} else {
_loc.gotoAndStop("error_screen");
}
};
_root.send_lv.nickname = myname;
_root.send_lv.points = myscore;
_root.send_lv.gameid = mygameid;
_root.send_lv.sendAndLoad(obj_partner.submitURL, _root.send_lv, "POST");
trace(_root.send_lv);
_loc.gotoAndStop("lbl_submit_screen");
}
};
c_fail = 0;
var g2w_menu = new ContextMenu();
g2w_menu.hideBuiltInItems();
g2w_menu.customItems.push(new ContextMenuItem("gangofgamers.com", itemHandler));
this.menu = g2w_menu;
var _sostatus = SharedObject.getLocal("gamestatus", "/");
String.prototype.trim = function () {
var _local3 = 0;
var _local2 = this.length;
white = new Object();
white._32 = 1;
_local2--;
while (white["_" + ord(this.charAt(_local2))]) {
}
while (white["_" + ord(this.charAt(_local3++))]) {
}
return(this.slice(_local3 - 1, _local2 + 1));
};
Frame 9
stop();
getphstatus(1);
Frame 21
stop();
Frame 31
var bLoaded = this.getBytesLoaded();
var bTotal = this.getBytesTotal();
this.onEnterFrame = function () {
bLoaded = this.getBytesLoaded();
bTotal = this.getBytesTotal();
preloadBar._width = (preloadBG._width * bLoaded) / bTotal;
if ((bTotal > 1) && (bLoaded >= bTotal)) {
gotoAndStop ("lblgame");
}
};
stop();
Frame 38
play();
Frame 48
stop();
Frame 60
gotoAndStop ("lblgame");
Symbol 9 MovieClip Frame 1
function brain() {
create_assets(myself, _global.obj_iads.type);
switch (_global.obj_iads.type) {
case "FULL" :
mcLoader.loadClip(_global.obj_iads.url, trgt_main);
break;
case "EMBED" :
mcLoader.loadClip(_global.obj_iads.url, trgt_main.trgt_ads);
if (_global.obj_iads.link ne undefined) {
trgt_main.onRelease = function () {
trace("_global.obj_iads.link " + _global.obj_iads.link);
getURL (_global.obj_iads.link, "_blank");
};
}
break;
case "NOOP" :
_parent._parent._visible = 0;
break;
}
}
function get_iads() {
lv_iads = new XML();
lv_result = new XML();
lv_result.ignoreWhite = true;
lv_result.onLoad = function (success) {
trace("success " + success);
if (success) {
parse_iads(lv_result);
myself.attachMovie("invizi_logo", "invizi_logo", this.getNextHighestDepth(), {_x:Stage.width - 120, _y:Stage.height - 20});
}
};
lv_iads.sendAndLoad(adurl, lv_result, "POST");
}
function parse_iads(lv_result) {
_global.obj_iads = new Array();
var _local2 = 0;
while (_local2 < lv_result.firstChild.childNodes.length) {
if (lv_result.firstChild.childNodes[_local2].firstChild.nodeValue != null) {
obj_iads[lv_result.firstChild.childNodes[_local2].nodeName] = lv_result.firstChild.childNodes[_local2].firstChild.nodeValue;
} else if (lv_result.firstChild.childNodes[_local2].firstChild.firstChild.nodeValue != null) {
var _local5 = new Object();
var _local4 = 0;
while (_local4 < lv_result.firstChild.childNodes[_local2].childNodes.length) {
_local5[lv_result.firstChild.childNodes[_local2].childNodes[_local4].nodeName] = lv_result.firstChild.childNodes[_local2].childNodes[_local4].firstChild.nodeValue;
_local4++;
}
obj_iads[lv_result.firstChild.childNodes[_local2].nodeName] = _local5;
}
_local2++;
}
show_time = int(_global.obj_iads.t);
check_type();
}
function create_assets(mc, _type) {
trace((("Create _ assets " + mc) + " ") + _type);
mc.createEmptyMovieClip("trgt_main", 4);
mcLoader = new MovieClipLoader();
mcLoader.addListener(mc);
if (_type != "FULL") {
mc.createEmptyMovieClip("square_mc", 5);
var _local4 = trgt_main.createEmptyMovieClip("trgt_ads", getNextHighestDepth());
var _local2 = new TextFormat();
_local2.align = "center";
_local2.font = "Verdana";
_local2.size = 10;
mc.createTextField("h_txt", mc.getNextHighestDepth(), 0, 0, 100, 22);
mc.createTextField("b_txt", mc.getNextHighestDepth(), 0, 0, 100, 22);
b_txt.autoSize = true;
b_txt.selectable = false;
h_txt.selectable = false;
b_txt.multiline = true;
b_txt.setNewTextFormat(_local2);
h_txt.autoSize = true;
h_txt.setNewTextFormat(_local2);
h_txt.text = "";
}
}
function onLoadInit(mc) {
ad_width = int(_global.obj_iads.x);
ad_height = int(_global.obj_iads.y);
_x = ((336 - ad_width) / 2);
_y = ((280 - ad_height) / 2);
progressBar.tim = show_time;
progressBar.width = _global.obj_iads.x;
progressBar.height = 15;
progressBar.start = function () {
maxw = this.width - 2;
this.ad = maxw / (this.tim + 1);
this.ad = this.ad / game_fps;
};
progressBar.onEnterFrame = function () {
if (this.bar._width < (this.width - 2)) {
this.bar._width = this.bar._width + this.ad;
} else {
this.bar._width = this.width;
}
};
progressBar._x = 100;
progressBar._y = 100;
bar_mc = progressBar.createEmptyMovieClip("bar", 1);
box_mc = progressBar.createEmptyMovieClip("box", 2);
bar_mc.beginFill(26112);
bar_mc.moveTo(0, 0);
bar_mc.lineTo(1, 0);
bar_mc.lineTo(1, progressBar.height - 2);
bar_mc.lineTo(0, progressBar.height - 2);
bar_mc.lineTo(0, 0);
bar_mc.endFill();
bar_mc._x = 1.5;
bar_mc._y = 1.5;
box_mc.lineStyle(1, 3355443, 100, true, "none", "round", "miter", 1);
box_mc.lineTo(progressBar.width, 0);
box_mc.lineTo(progressBar.width, progressBar.height);
box_mc.lineTo(0, progressBar.height);
box_mc.lineTo(0, 0);
box_mc._x = 0;
box_mc._y = 0;
progressBar.start();
x = 0;
y = 0;
mc._x = x;
mc._y = y;
square_mc.beginFill(16711680);
square_mc.moveTo(0, 0);
square_mc.lineTo(ad_width, 0);
square_mc.lineTo(ad_width, ad_height);
square_mc.lineTo(0, ad_height);
square_mc.lineTo(0, 0);
square_mc.endFill();
square_mc._x = x;
square_mc._y = y;
trgt_main.setMask(square_mc);
}
function check_type() {
if (_global.obj_iads.type eq "UPDATE") {
this.createEmptyMovieClip("holder", 100);
var _local5 = _global.obj_iads.url;
_root.obj_iads = _global.obj_iads.payload;
holder.loadMovie(_global.obj_iads.url);
holder.obj_iads = _root.obj_iads;
show_time = 20;
} else {
if (((_global.obj_iads.htmlPostRoll != undefined) && (purl != null)) && (purl.indexOf("gangofgamers.com") != -1)) {
trace(purl.indexOf("gangofgamers.com") != -1);
var _local4 = flash.external.ExternalInterface.call("inviziShowHtmlPostRoll", _global.obj_iads.htmlPostRoll);
}
if (((_local4 != null) && (purl != null)) && (purl.indexOf("gangofgamers.com") != -1)) {
this._parent._visible = false;
} else {
brain();
}
}
}
function parse_xml(mydata) {
var _local4 = new Array();
var _local1 = 0;
while (_local1 < mydata.firstChild.childNodes.length) {
if (mydata.firstChild.childNodes[_local1].firstChild.nodeValue != null) {
_local4[mydata.firstChild.childNodes[_local1].nodeName] = mydata.firstChild.childNodes[_local1].firstChild.nodeValue;
} else if (mydata.firstChild.childNodes[_local1].firstChild.firstChild.nodeValue != null) {
var _local5 = new Object();
var _local2 = 0;
while (_local2 < lv_result.firstChild.childNodes[_local1].childNodes.length) {
_local4[lv_result.firstChild.childNodes[_local1].childNodes[_local2].nodeName] = mydata.firstChild.childNodes[_local1].childNodes[_local2].firstChild.nodeValue;
_local2++;
}
_local4[lv_result.firstChild.childNodes[_local1].nodeName] = _local5;
}
_local1++;
}
return(_local4);
}
System.security.allowDomain("*");
this.getFps = function () {
if (signal == true) {
time = getTimer();
} else {
tempo = int(1000 / (getTimer() - time));
}
signal = !signal;
return(tempo);
};
this.onEnterFrame = function () {
game_fps = getFps();
if ((game_fps ne 0) and (game_fps ne undefined)) {
this.onEnterFrame = null;
}
};
myself = this;
signal = true;
var purl = flash.external.ExternalInterface.call("document.URL.toString");
var hurl = escape(_root._url);
adurl = _root.obj_game.inviziads;
adurl = adurl + "&type=post&v=2_0";
adurl = adurl + ("&purl=" + escape(purl));
adurl = adurl + ("&hurl=" + hurl);
adurl = adurl + ("&ts=" + getTimer());
trace(adurl);
get_iads();
stop();
Symbol 12 MovieClip Frame 1
invizi_logo.onRelease = function () {
getURL ("http://www.inviziads.com/", "_blank");
};
Symbol 21 MovieClip Frame 1
_root._trackClickThru(this);
Symbol 46 MovieClip Frame 2
stop();
gotoAndStop(_root.obj_game._gstatus);
Symbol 52 Button
on (release) {
tryAgain();
}
Symbol 80 MovieClip [mc_topscore_box] Frame 1
trace("_root.checkhost() " + _root.checkhost());
trace("this._url " + this._url);
if (_root.checkhost()) {
gotoAndStop ("login_screen");
} else {
gotoAndStop ("lblalienhost");
}
Symbol 80 MovieClip [mc_topscore_box] Frame 2
function tryAgain() {
gotoAndStop ("login_screen");
}
function filltopscore(destmc) {
trace(_root.lst_top_scorer.top_score.status.data);
if ((_root.lst_top_scorer.top_score.status.data == 0) or (_root.lst_top_scorer.top_score.user[0].score.data == 0)) {
_top10_lbl._visible = false;
var _local2 = 0;
while (_local2 < 10) {
destmc["row" + _local2]._visible = false;
_local2++;
}
} else {
_noscore_mc._visible = false;
var _local2 = 0;
while (_local2 < 10) {
if ((_root.lst_top_scorer.top_score.user[_local2] == undefined) or (_root.lst_top_scorer.top_score.user[_local2].score.data == 0)) {
destmc["row" + _local2].txtrollno.text = "";
destmc["row" + _local2].txtusername.text = "";
destmc["row" + _local2].txtscore.text = "";
} else {
destmc["row" + _local2].txtrollno.text = _local2 + 1;
destmc["row" + _local2].txtusername.text = _root.lst_top_scorer.top_score.user[_local2].nick_name.data;
destmc["row" + _local2].txtscore.text = _root.lst_top_scorer.top_score.user[_local2].score.data;
}
_local2++;
}
}
}
stop();
username_txt.onSetFocus = function () {
trace((this.text + " ") + _root.obj_partner.invalid_txt);
if ((this.text == _root.obj_partner.invalid_txt) or (this.text == "Connecting Error!")) {
this.text = "";
}
};
Selection.setFocus("username_txt");
btn_scoresubmit.onRelease = function () {
_root.scoreSubmit(this._parent);
};
playAgain_btn.onRelease = function () {
trace("CALLING : _root.g2w_playagain()");
_root.g2w_playagain();
};
skiplvl_btn.onRelease = function () {
trace("CALLING : _root.g2w_skiplevel()");
_root.g2w_skiplevel();
};
_trg_loc = this;
var keyListener = new Object();
keyListener.onKeyDown = function () {
if (!(Key.getCode() === 13)) {
} else {
Selection.setFocus("btn_scoresubmit");
_root.scoreSubmit(_trg_loc);
}
};
Key.addListener(keyListener);
btn_create_nickname.onRelease = function () {
getURL (_root.obj_partner.url_register, "_blank");
};
if (_root.obj_partner.show_submit) {
btn_scoresubmit._visible = false;
}
stop();
_btn_g2w.useHandCursor = false;
Symbol 80 MovieClip [mc_topscore_box] Frame 31
stop();
Symbol 80 MovieClip [mc_topscore_box] Frame 45
stop();
Symbol 80 MovieClip [mc_topscore_box] Frame 60
stop();
playAgain_btn.onRelease = function () {
_root._playAgain(_root, "lblgameintro");
};
Symbol 80 MovieClip [mc_topscore_box] Frame 74
stop();
filltopscore(this);
playAgain_btn.onRelease = function () {
_root._playAgain(_root, "lblgameintro");
};
Symbol 80 MovieClip [mc_topscore_box] Frame 85
function tryAgain() {
gotoAndStop ("login_screen");
}
function filltopscore(destmc) {
trace(_root.lst_top_scorer.top_score.status.data);
if ((_root.lst_top_scorer.top_score.status.data == 0) or (_root.lst_top_scorer.top_score.user[0].score.data == 0)) {
_top10_lbl._visible = false;
var _local2 = 0;
while (_local2 < 10) {
destmc["row" + _local2]._visible = false;
_local2++;
}
} else {
_noscore_mc._visible = false;
var _local2 = 0;
while (_local2 < 10) {
if ((_root.lst_top_scorer.top_score.user[_local2] == undefined) or (_root.lst_top_scorer.top_score.user[_local2].score.data == 0)) {
destmc["row" + _local2].txtrollno.text = "";
destmc["row" + _local2].txtusername.text = "";
destmc["row" + _local2].txtscore.text = "";
} else {
destmc["row" + _local2].txtrollno.text = _local2 + 1;
destmc["row" + _local2].txtusername.text = _root.lst_top_scorer.top_score.user[_local2].nick_name.data;
destmc["row" + _local2].txtscore.text = _root.lst_top_scorer.top_score.user[_local2].score.data;
}
_local2++;
}
}
}
username_txt.onSetFocus = function () {
trace((this.text + " ") + _root.obj_partner.invalid_txt);
if ((this.text == _root.obj_partner.invalid_txt) or (this.text == "Connecting Error!")) {
this.text = "";
}
};
Selection.setFocus("username_txt");
btn_scoresubmit.onRelease = function () {
_root.scoreSubmit(this._parent);
};
playAgain_btn.onRelease = function () {
trace("CALLING : _root.g2w_playagain()");
_root.g2w_playagain();
};
skiplvl_btn.onRelease = function () {
trace("CALLING : _root.g2w_skiplevel()");
_root.g2w_skiplevel();
};
_trg_loc = this;
var keyListener = new Object();
keyListener.onKeyDown = function () {
if (!(Key.getCode() === 13)) {
} else {
Selection.setFocus("btn_scoresubmit");
_root.scoreSubmit(_trg_loc);
}
};
Key.addListener(keyListener);
btn_create_nickname.onRelease = function () {
getURL (_root.obj_partner.url_register, "_blank");
};
if (_root.obj_partner.show_submit) {
btn_scoresubmit._visible = false;
}
stop();
stop();
Symbol 84 MovieClip Frame 1
_root._trackClickThru(this);
Symbol 87 MovieClip [brain_inviziads] Frame 1
function brain() {
create_assets(myself, _global.obj_iads.type);
switch (_global.obj_iads.type) {
case "FULL" :
mcLoader.loadClip(_global.obj_iads.url, trgt_main);
break;
case "EMBED" :
mcLoader.loadClip(_global.obj_iads.url, trgt_main.trgt_ads);
if (_global.obj_iads.link ne undefined) {
trgt_main.onRelease = function () {
trace("_global.obj_iads.link " + _global.obj_iads.link);
getURL (_global.obj_iads.link, "_blank");
};
}
break;
case "NOOP" :
clearInterval(int1);
_parent.play();
break;
}
}
function get_iads() {
lv_iads = new XML();
lv_result = new XML();
lv_result.ignoreWhite = true;
lv_result.onLoad = function (success) {
trace("success " + success);
if (success) {
parse_iads(lv_result);
} else {
_root.play();
}
};
lv_iads.g = game_id;
lv_iads.sendAndLoad(_root.adurl, lv_result, "POST");
}
function parse_iads(lv_result) {
_global.obj_iads = new Array();
var _local2 = 0;
while (_local2 < lv_result.firstChild.childNodes.length) {
if (lv_result.firstChild.childNodes[_local2].firstChild.nodeValue != null) {
obj_iads[lv_result.firstChild.childNodes[_local2].nodeName] = lv_result.firstChild.childNodes[_local2].firstChild.nodeValue;
} else if (lv_result.firstChild.childNodes[_local2].firstChild.firstChild.nodeValue != null) {
var _local5 = new Object();
var _local4 = 0;
while (_local4 < lv_result.firstChild.childNodes[_local2].childNodes.length) {
_local5[lv_result.firstChild.childNodes[_local2].childNodes[_local4].nodeName] = lv_result.firstChild.childNodes[_local2].childNodes[_local4].firstChild.nodeValue;
_local4++;
}
obj_iads[lv_result.firstChild.childNodes[_local2].nodeName] = _local5;
}
_local2++;
}
show_time = int(_global.obj_iads.t);
check_type();
}
function time_delay() {
tim = 0;
int1 = setInterval(timespam, 1000);
}
function timespam() {
tim++;
trace(((tim + " tim Tim") + " show_time") + show_time);
if (tim == show_time) {
clearInterval(int1);
_parent.play();
}
}
function create_assets(mc, _type) {
trace((("Create _ assets " + mc) + " ") + _type);
mc.createEmptyMovieClip("trgt_main", 4);
mcLoader = new MovieClipLoader();
mcLoader.addListener(mc);
if (_type != "FULL") {
mc.createEmptyMovieClip("square_mc", 5);
var _local4 = trgt_main.createEmptyMovieClip("trgt_ads", getNextHighestDepth());
var _local2 = new TextFormat();
_local2.align = "center";
_local2.font = "Verdana";
_local2.size = 10;
mc.createTextField("h_txt", mc.getNextHighestDepth(), 0, 0, 100, 22);
mc.createTextField("b_txt", mc.getNextHighestDepth(), 0, 0, 100, 22);
b_txt.autoSize = true;
b_txt.selectable = false;
h_txt.selectable = false;
b_txt.multiline = true;
b_txt.setNewTextFormat(_local2);
h_txt.autoSize = true;
h_txt.setNewTextFormat(_local2);
h_txt.text = "";
mc.createEmptyMovieClip("progressBar", 500);
}
}
function onLoadInit(mc) {
ad_width = int(_global.obj_iads.x);
ad_height = int(_global.obj_iads.y);
trace("Ad Width : " + ad_width);
trace("Ad Height : " + ad_height);
h_txt.text = "Advertisement";
progressBar.tim = show_time;
progressBar.width = _global.obj_iads.x;
progressBar.height = 15;
progressBar.start = function () {
game_fps = getFps();
maxw = this.width - 2;
this.ad = maxw / (this.tim + 1);
this.ad = this.ad / game_fps;
};
progressBar.onEnterFrame = function () {
if (this.bar._width < (this.width - 2)) {
this.bar._width = this.bar._width + this.ad;
} else {
this.bar._width = this.width;
}
};
progressBar._x = 100;
progressBar._y = 100;
bar_mc = progressBar.createEmptyMovieClip("bar", 1);
box_mc = progressBar.createEmptyMovieClip("box", 2);
bar_mc.beginFill(26112);
bar_mc.moveTo(0, 0);
bar_mc.lineTo(1, 0);
bar_mc.lineTo(1, progressBar.height - 2);
bar_mc.lineTo(0, progressBar.height - 2);
bar_mc.lineTo(0, 0);
bar_mc.endFill();
bar_mc._x = 1.5;
bar_mc._y = 1.5;
box_mc.lineStyle(1, 3355443, 100, true, "none", "round", "miter", 1);
box_mc.lineTo(progressBar.width, 0);
box_mc.lineTo(progressBar.width, progressBar.height);
box_mc.lineTo(0, progressBar.height);
box_mc.lineTo(0, 0);
box_mc._x = 0;
box_mc._y = 0;
progressBar.start();
b_txt.text = "Note Clicking on the above Ad won't interrupt your game. Ad link opens in a new window.\rThanks to our sponsors, we provide you free games to play.";
myself._y = b_txt._y - 10;
x = (Stage.width / 2) - (ad_width / 2);
y = (Stage.height / 2) - (ad_height / 2);
mc._x = x;
mc._y = y;
h_txt._x = (x + (ad_width / 2)) - (h_txt._width / 2);
if ((_embedscale = "down")) {
h_txt._y = y - 40;
}
progressBar._x = (x + (ad_width / 2)) - (progressBar._width / 2);
progressBar._y = (y + 5) + ad_height;
myself.attachMovie("invizi_logo", "invizi_logo", this.getNextHighestDepth(), {_x:int(progressBar._x + progressBar._width) - 114, _y:int((progressBar._y + progressBar._height) + 5)});
myself.invizi_logo.onRelease = function () {
getURL ("http://www.inviziads.com", "_blank");
};
b_txt._x = (x + (ad_width / 2)) - (b_txt._width / 2);
b_txt._y = progressBar._y + 30;
square_mc.beginFill(16711680);
square_mc.moveTo(0, 0);
square_mc.lineTo(ad_width, 0);
square_mc.lineTo(ad_width, ad_height);
square_mc.lineTo(0, ad_height);
square_mc.lineTo(0, 0);
square_mc.endFill();
square_mc._x = x;
square_mc._y = y;
trgt_main.setMask(square_mc);
var _local5 = ((Stage.width - scaled_width) / scaled_width) * 100;
var _local4 = ((Stage.height - scaled_height) / scaled_height) * 100;
this._xscale = 100 + _local5;
this._yscale = 100 + _local4;
new_xpos = (-(((Stage.width * this._xscale) / 100) - Stage.width)) / 2;
new_ypos = (-(((Stage.height * this._yscale) / 100) - Stage.height)) / 2;
_parent[this._name]._x = new_xpos;
_parent[this._name]._y = new_ypos;
}
function check_type() {
if (_global.obj_iads.type eq "UPDATE") {
trace(" _global.obj_iads.payload.type " + _global.obj_iads.payload.type);
this.createEmptyMovieClip("holder", 100);
var _local4 = _global.obj_iads.url;
_root.obj_iads = _global.obj_iads.payload;
holder.loadMovie(_global.obj_iads.url);
holder.obj_iads = _root.obj_iads;
show_time = 20;
} else {
brain();
}
time_delay();
}
function parse_xml(mydata) {
var _local4 = new Array();
var _local1 = 0;
while (_local1 < mydata.firstChild.childNodes.length) {
if (mydata.firstChild.childNodes[_local1].firstChild.nodeValue != null) {
_local4[mydata.firstChild.childNodes[_local1].nodeName] = mydata.firstChild.childNodes[_local1].firstChild.nodeValue;
} else if (mydata.firstChild.childNodes[_local1].firstChild.firstChild.nodeValue != null) {
var _local5 = new Object();
var _local2 = 0;
while (_local2 < lv_result.firstChild.childNodes[_local1].childNodes.length) {
_local4[lv_result.firstChild.childNodes[_local1].childNodes[_local2].nodeName] = mydata.firstChild.childNodes[_local1].childNodes[_local2].firstChild.nodeValue;
_local2++;
}
_local4[lv_result.firstChild.childNodes[_local1].nodeName] = _local5;
}
_local1++;
}
return(_local4);
}
System.security.allowDomain("*");
Stage.scaleMode = "noscale";
scaled_width = Stage.width;
scaled_height = Stage.height;
Stage.scaleMode = "showAll";
getFps = function () {
if (signal == true) {
time = getTimer();
} else {
tempo = int(1000 / (getTimer() - time));
}
signal = !signal;
return(tempo);
};
this.onEnterFrame = function () {
game_fps = getFps();
if ((game_fps != 0) && (game_fps != undefined)) {
this.onEnterFrame = null;
}
};
myself = this;
signal = true;
_root.adurl = (_root.obj_game.inviziads + "&ts=") + getTimer();
get_iads();
stop();
Symbol 91 MovieClip [game_sound_ctrl] Frame 1
_gameSounds = new Sound();
var frame = "on";
changeVol = function (targetvol, step) {
this.onEnterFrame = function () {
var _local3 = _gameSounds.getVolume();
if ((step < 0) and (_local3 <= targetvol)) {
_local3 = targetvol;
delete this.onEnterFrame;
_root.so_sound = 1;
} else if ((step > 0) and (_local3 >= targetvol)) {
_local3 = targetvol;
delete this.onEnterFrame;
_root.so_sound = 0;
} else {
_gameSounds.setVolume(_local3 + step);
}
};
};
if (_root.so_sound == 1) {
frame = "off";
this.gotoAndPlay(frame);
}
this.onRelease = function () {
if (frame == "on") {
frame = "off";
} else {
frame = "on";
}
this.gotoAndPlay(frame);
};
Symbol 91 MovieClip [game_sound_ctrl] Frame 2
stop();
changeVol(100, 5);
Symbol 91 MovieClip [game_sound_ctrl] Frame 3
stop();
changeVol(0, -5);
Symbol 721 MovieClip [__Packages.it.sephiroth.XML2Object] Frame 0
class it.sephiroth.XML2Object
{
var oXML;
function XML2Object () {
}
function get xml() {
return(oXML);
}
function parseXML(sFile) {
oResult = new Object();
oXML = sFile;
oResult = translateXML();
return(oResult);
}
function translateXML(from, path, name, position) {
var _local2;
var _local9;
var _local4;
var _local10;
if (path == undefined) {
path = this;
name = "oResult";
}
path = path[name];
if (from == undefined) {
from = new XML(xml.toString());
from.ignoreWhite = true;
}
if (from.hasChildNodes()) {
_local9 = from.childNodes;
if (position != undefined) {
_local10 = path;
path = path[position];
}
while (_local9.length > 0) {
_local4 = _local9.shift();
_local2 = _local4.nodeName;
if (_local2 != undefined) {
var _local5 = new Object();
_local5.attributes = _local4.attributes;
_local5.data = _local4.firstChild.nodeValue;
if (position != undefined) {
_local10 = path;
}
if (path[_local2] != undefined) {
if (path[_local2].__proto__ == Array.prototype) {
path[_local2].push(_local5);
name = _local4.nodeName;
position = path[_local2].length - 1;
} else {
var _local8 = path[_local2];
path[_local2] = new Array();
path[_local2].push(_local8);
path[_local2].push(_local5);
name = _local2;
position = path[_local2].length - 1;
}
} else {
path[_local2] = _local5;
name = _local2;
position = undefined;
}
}
if (_local4.hasChildNodes()) {
translateXML(_local4, path, name, position);
}
}
}
return(oResult);
}
var oResult = new Object();
}
Symbol 722 MovieClip [__Packages.Car] Frame 0
class Car
{
var speed, turnMax, turnDirection, healthFront, healthBack, healthLeft, healthRight, heading, posX, posY, theta, thetaDiff;
function Car () {
speed = (Math.random() * (carSpeedMax - carSpeedMin)) + carSpeedMin;
turnMax = PI2 / 32;
turnDirection = Math.ceil(Math.random() * 2);
healthFront = healthFrontMax;
healthBack = healthBackMax;
healthLeft = healthLeftMax;
healthRight = healthRightMax;
}
function drive(Void) {
}
function turn(Void) {
heading = heading + (((Math.random() * turnMax) * 2) - turnMax);
if (heading < 0) {
heading = heading + PI2;
} else if (heading >= PI2) {
heading = heading % PI2;
}
}
function turn2(Void) {
if (turnDirection == 0) {
turnDirection = Math.ceil(Math.random() * 2);
}
switch (turnDirection) {
case 1 :
heading = heading - turnMax;
if (heading < 0) {
heading = heading + PI2;
}
break;
case 2 :
heading = heading + turnMax;
if (heading >= PI2) {
heading = heading % PI2;
}
break;
default :
trace(turnDirection);
}
}
function changeSpeed(Void) {
speed = (Math.random() * (carSpeedMax - carSpeedMin)) + carSpeedMin;
}
function chase(targetX, targetY) {
var _local2 = targetX - posX;
var _local3 = targetY - posY;
if (_local2 > 0) {
theta = Math.atan(_local3 / _local2);
} else {
theta = Math.PI + Math.atan(_local3 / _local2);
}
if (theta < 0) {
theta = theta + PI2;
}
thetaDiff = heading - theta;
if (thetaDiff < 0) {
if (thetaDiff > -3.14159265358979) {
if (thetaDiff > (-turnMax)) {
heading = heading - thetaDiff;
} else {
heading = heading + turnMax;
}
} else {
heading = heading - turnMax;
}
} else if (thetaDiff > 0) {
if (thetaDiff > Math.PI) {
heading = heading + turnMax;
} else if (turnMax > thetaDiff) {
heading = heading - thetaDiff;
} else {
heading = heading - turnMax;
}
}
if (heading < 0) {
heading = heading + PI2;
} else if (heading >= PI2) {
heading = heading % PI2;
}
}
function changeCState(Void) {
if (Math.random() < propensityWander) {
cState = cStateCount - 1;
} else {
cState = Math.floor(Math.random() * cStateCount);
}
}
static var RAD2DEG = 57.2957795130823;
static var PI2 = (Math.PI*2);
static var carSpeedMin = 1.5;
static var carSpeedMax = 5;
var cStateCount = 4;
var propensityWander = 0.6;
var velocityX = 0;
var velocityY = 0;
var speedX = 0;
var speedY = 0;
var speedMax = 4;
var speedMaxReverse = 3;
var frontX = 19;
var frontSideX = 19;
var frontSideY = 11;
var backSideX = -17;
var backSideY = 11;
var frontSideX2 = 19;
var frontSideY2 = 11;
var backSideX2 = -17;
var backSideY2 = 11;
var frontSideX3 = 19;
var frontSideY3 = 11;
var backSideX3 = -17;
var backSideY3 = 11;
var lookAheadX = 200;
var healthFrontMax = 150;
var healthBackMax = 100;
var healthLeftMax = 100;
var healthRightMax = 100;
var shieldFront = 2;
var shieldLeft = 1;
var shieldRight = 1;
var shieldBack = 1;
var velocityHeading = 0;
var velocityTheta = 0;
var acceleration = 0.4;
var frictionRolling = 0.05;
var tireGrip = 0.25;
var velocityLateral = 0;
var mass = 50;
var thrust = 2;
var isAlive = true;
var cState = 0;
var pointValue = 1000;
var carExplodeCountdown = 48;
}
Symbol 723 MovieClip [__Packages.CarA] Frame 0
class CarA extends Car
{
var speed, turnMax, turnDirection, healthFront, healthBack, healthLeft, healthRight, heading, posX, posY, theta, thetaDiff;
function CarA () {
super();
speed = (Math.random() * (carSpeedMax - carSpeedMin)) + carSpeedMin;
turnMax = PI2 / 32;
turnDirection = Math.ceil(Math.random() * 2);
healthFront = healthFrontMax;
healthBack = healthBackMax;
healthLeft = healthLeftMax;
healthRight = healthRightMax;
}
function drive(Void) {
}
function turn(Void) {
heading = heading + (((Math.random() * turnMax) * 2) - turnMax);
if (heading < 0) {
heading = heading + PI2;
} else if (heading >= PI2) {
heading = heading % PI2;
}
}
function turn2(Void) {
if (turnDirection == 0) {
turnDirection = Math.ceil(Math.random() * 2);
}
switch (turnDirection) {
case 1 :
heading = heading - turnMax;
if (heading < 0) {
heading = heading + PI2;
}
break;
case 2 :
heading = heading + turnMax;
if (heading >= PI2) {
heading = heading % PI2;
}
break;
default :
trace(turnDirection);
}
}
function changeSpeed(Void) {
speed = (Math.random() * (carSpeedMax - carSpeedMin)) + carSpeedMin;
}
function chase(targetX, targetY) {
var _local2 = targetX - posX;
var _local3 = targetY - posY;
if (_local2 > 0) {
theta = Math.atan(_local3 / _local2);
} else {
theta = Math.PI + Math.atan(_local3 / _local2);
}
if (theta < 0) {
theta = theta + PI2;
}
thetaDiff = heading - theta;
if (thetaDiff < 0) {
if (thetaDiff > -3.14159265358979) {
if (thetaDiff > (-turnMax)) {
heading = heading - thetaDiff;
} else {
heading = heading + turnMax;
}
} else {
heading = heading - turnMax;
}
} else if (thetaDiff > 0) {
if (thetaDiff > Math.PI) {
heading = heading + turnMax;
} else if (turnMax > thetaDiff) {
heading = heading - thetaDiff;
} else {
heading = heading - turnMax;
}
}
if (heading < 0) {
heading = heading + PI2;
} else if (heading >= PI2) {
heading = heading % PI2;
}
}
function changeCState(Void) {
if (Math.random() < propensityWander) {
cState = cStateCount - 1;
} else {
cState = Math.floor(Math.random() * cStateCount);
}
}
static var RAD2DEG = 57.2957795130823;
static var PI2 = (Math.PI*2);
static var carSpeedMin = 1.5;
static var carSpeedMax = 5;
var cStateCount = 4;
var propensityWander = 0.6;
var velocityX = 0;
var velocityY = 0;
var speedX = 0;
var speedY = 0;
var speedMax = 6;
var speedMaxReverse = 3;
var pointValue = 1000;
var frontX = 33;
var frontSideX = 33;
var frontSideY = 16;
var backSideX = -31;
var backSideY = 17;
var frontSideX2 = 28;
var frontSideY2 = 20;
var backSideX2 = -28;
var backSideY2 = 20;
var frontSideX3 = 33;
var frontSideY3 = 19;
var backSideX3 = -31;
var backSideY3 = 19;
var lookAheadX = 200;
var healthFrontMax = 100;
var healthBackMax = 60;
var healthLeftMax = 60;
var healthRightMax = 60;
var shieldFront = 2;
var shieldLeft = 1;
var shieldRight = 1;
var shieldBack = 1;
var velocityHeading = 0;
var velocityTheta = 0;
var acceleration = 0.4;
var frictionRolling = 0.05;
var tireGrip = 0.25;
var velocityLateral = 0;
var mass = 50;
var thrust = 2;
var isAlive = true;
var cState = 0;
}
Symbol 724 MovieClip [__Packages.CarB] Frame 0
class CarB extends Car
{
var speed, turnMax, turnDirection, healthFront, healthBack, healthLeft, healthRight, heading, posX, posY, theta, thetaDiff;
function CarB () {
super();
speed = (Math.random() * (carSpeedMax - carSpeedMin)) + carSpeedMin;
turnMax = PI2 / 32;
turnDirection = Math.ceil(Math.random() * 2);
healthFront = healthFrontMax;
healthBack = healthBackMax;
healthLeft = healthLeftMax;
healthRight = healthRightMax;
}
function drive(Void) {
}
function turn(Void) {
heading = heading + (((Math.random() * turnMax) * 2) - turnMax);
if (heading < 0) {
heading = heading + PI2;
} else if (heading >= PI2) {
heading = heading % PI2;
}
}
function turn2(Void) {
if (turnDirection == 0) {
turnDirection = Math.ceil(Math.random() * 2);
}
switch (turnDirection) {
case 1 :
heading = heading - turnMax;
if (heading < 0) {
heading = heading + PI2;
}
break;
case 2 :
heading = heading + turnMax;
if (heading >= PI2) {
heading = heading % PI2;
}
break;
default :
trace(turnDirection);
}
}
function changeSpeed(Void) {
speed = (Math.random() * (carSpeedMax - carSpeedMin)) + carSpeedMin;
}
function chase(targetX, targetY) {
var _local2 = targetX - posX;
var _local3 = targetY - posY;
if (_local2 > 0) {
theta = Math.atan(_local3 / _local2);
} else {
theta = Math.PI + Math.atan(_local3 / _local2);
}
if (theta < 0) {
theta = theta + PI2;
}
thetaDiff = heading - theta;
if (thetaDiff < 0) {
if (thetaDiff > -3.14159265358979) {
if (thetaDiff > (-turnMax)) {
heading = heading - thetaDiff;
} else {
heading = heading + turnMax;
}
} else {
heading = heading - turnMax;
}
} else if (thetaDiff > 0) {
if (thetaDiff > Math.PI) {
heading = heading + turnMax;
} else if (turnMax > thetaDiff) {
heading = heading - thetaDiff;
} else {
heading = heading - turnMax;
}
}
if (heading < 0) {
heading = heading + PI2;
} else if (heading >= PI2) {
heading = heading % PI2;
}
}
function changeCState(Void) {
if (Math.random() < propensityWander) {
cState = cStateCount - 1;
} else {
cState = Math.floor(Math.random() * cStateCount);
}
}
static var RAD2DEG = 57.2957795130823;
static var PI2 = (Math.PI*2);
static var carSpeedMin = 1.5;
static var carSpeedMax = 5;
var cStateCount = 4;
var propensityWander = 0.6;
var velocityX = 0;
var velocityY = 0;
var speedX = 0;
var speedY = 0;
var speedMax = 6;
var speedMaxReverse = 5;
var pointValue = 1250;
var frontX = 36;
var frontSideX = 32;
var frontSideY = 18;
var backSideX = -35;
var backSideY = 19;
var frontSideX2 = 31;
var frontSideY2 = 21;
var backSideX2 = -32;
var backSideY2 = 21;
var frontSideX3 = 34;
var frontSideY3 = 12;
var backSideX3 = -35;
var backSideY3 = 18;
var lookAheadX = 200;
var healthFrontMax = 120;
var healthBackMax = 70;
var healthLeftMax = 70;
var healthRightMax = 70;
var shieldFront = 2;
var shieldLeft = 1;
var shieldRight = 1;
var shieldBack = 1;
var velocityHeading = 0;
var velocityTheta = 0;
var acceleration = 0.4;
var frictionRolling = 0.05;
var tireGrip = 0.25;
var velocityLateral = 0;
var mass = 60;
var thrust = 2;
var isAlive = true;
var cState = 0;
}
Symbol 725 MovieClip [__Packages.CarC] Frame 0
class CarC extends Car
{
var speed, turnMax, turnDirection, healthFront, healthBack, healthLeft, healthRight, heading, posX, posY, theta, thetaDiff;
function CarC () {
super();
speed = (Math.random() * (carSpeedMax - carSpeedMin)) + carSpeedMin;
turnMax = PI2 / 32;
turnDirection = Math.ceil(Math.random() * 2);
healthFront = healthFrontMax;
healthBack = healthBackMax;
healthLeft = healthLeftMax;
healthRight = healthRightMax;
}
function drive(Void) {
}
function turn(Void) {
heading = heading + (((Math.random() * turnMax) * 2) - turnMax);
if (heading < 0) {
heading = heading + PI2;
} else if (heading >= PI2) {
heading = heading % PI2;
}
}
function turn2(Void) {
if (turnDirection == 0) {
turnDirection = Math.ceil(Math.random() * 2);
}
switch (turnDirection) {
case 1 :
heading = heading - turnMax;
if (heading < 0) {
heading = heading + PI2;
}
break;
case 2 :
heading = heading + turnMax;
if (heading >= PI2) {
heading = heading % PI2;
}
break;
default :
trace(turnDirection);
}
}
function changeSpeed(Void) {
speed = (Math.random() * (carSpeedMax - carSpeedMin)) + carSpeedMin;
}
function chase(targetX, targetY) {
var _local2 = targetX - posX;
var _local3 = targetY - posY;
if (_local2 > 0) {
theta = Math.atan(_local3 / _local2);
} else {
theta = Math.PI + Math.atan(_local3 / _local2);
}
if (theta < 0) {
theta = theta + PI2;
}
thetaDiff = heading - theta;
if (thetaDiff < 0) {
if (thetaDiff > -3.14159265358979) {
if (thetaDiff > (-turnMax)) {
heading = heading - thetaDiff;
} else {
heading = heading + turnMax;
}
} else {
heading = heading - turnMax;
}
} else if (thetaDiff > 0) {
if (thetaDiff > Math.PI) {
heading = heading + turnMax;
} else if (turnMax > thetaDiff) {
heading = heading - thetaDiff;
} else {
heading = heading - turnMax;
}
}
if (heading < 0) {
heading = heading + PI2;
} else if (heading >= PI2) {
heading = heading % PI2;
}
}
function changeCState(Void) {
if (Math.random() < propensityWander) {
cState = cStateCount - 1;
} else {
cState = Math.floor(Math.random() * cStateCount);
}
}
static var RAD2DEG = 57.2957795130823;
static var PI2 = (Math.PI*2);
static var carSpeedMin = 1.5;
static var carSpeedMax = 5;
var cStateCount = 4;
var propensityWander = 0.6;
var velocityX = 0;
var velocityY = 0;
var speedX = 0;
var speedY = 0;
var speedMax = 4;
var speedMaxReverse = 3;
var pointValue = 750;
var frontX = 30;
var frontSideX = 27;
var frontSideY = 13;
var backSideX = -28;
var backSideY = 14;
var frontSideX2 = 25;
var frontSideY2 = 16;
var backSideX2 = -26;
var backSideY2 = 18;
var frontSideX3 = 29;
var frontSideY3 = 13;
var backSideX3 = -29;
var backSideY3 = 13;
var lookAheadX = 200;
var healthFrontMax = 80;
var healthBackMax = 40;
var healthLeftMax = 40;
var healthRightMax = 40;
var shieldFront = 2;
var shieldLeft = 1;
var shieldRight = 1;
var shieldBack = 1;
var velocityHeading = 0;
var velocityTheta = 0;
var acceleration = 0.4;
var frictionRolling = 0.05;
var tireGrip = 0.25;
var velocityLateral = 0;
var mass = 40;
var thrust = 2;
var isAlive = true;
var cState = 0;
}
Symbol 726 MovieClip [__Packages.SpawnPoint] Frame 0
class SpawnPoint
{
var xPos, yPos;
function SpawnPoint (xPos, yPos) {
this.xPos = xPos;
this.yPos = yPos;
}
}
Symbol 727 MovieClip [__Packages.CarPlayer] Frame 0
class CarPlayer extends Car
{
var speed, turnMax, turnDirection, thrustDiag, healthFront, healthBack, healthLeft, healthRight, heading;
function CarPlayer () {
super();
speed = 0;
turnMax = PI2 / 32;
turnDirection = Math.ceil(Math.random() * 2);
thrustDiag = thrust * Math.cos(PIQUARTER);
healthFront = healthFrontMax;
healthBack = healthBackMax;
healthLeft = healthLeftMax;
healthRight = healthRightMax;
}
function drive(Void) {
}
function turn(Void) {
heading = heading + (((Math.random() * turnMax) * 2) - turnMax);
}
function turn2(Void) {
if (turnDirection == 0) {
turnDirection = Math.ceil(Math.random() * 2);
}
switch (turnDirection) {
case 1 :
heading = heading - turnMax;
break;
case 2 :
heading = heading + turnMax;
break;
default :
trace(turnDirection);
}
}
function changeSpeed(Void) {
speed = (Math.random() * (Car.carSpeedMax - Car.carSpeedMin)) + Car.carSpeedMin;
}
static var RAD2DEG = 57.2957795130823;
static var PI2 = (Math.PI*2);
static var PIQUARTER = (Math.PI/4);
var friction = 0.5;
var airFrictionCoefficient = 2;
var horsePower = 0;
var speedDiff = 0;
var velocityX = 0;
var velocityY = 0;
var vX2 = 0;
var vY2 = 0;
var diffX = 0;
var diffY = 0;
var diffHeading = 0;
var mass = 50;
var speedX = 0;
var speedY = 0;
var speedMax = 9;
var speedMaxReverse = -5;
var velocityHeading = 0;
var velocityTheta = 0;
var acceleration = 0.6;
var frictionRolling = 0.05;
var tireGrip = 0.5;
var velocityLateral = 0;
var thrust = 1;
var frontX = 34;
var frontSideX = 32;
var frontSideY = 17;
var backSideX = -32;
var backSideY = 17;
var frontSideX2 = 27;
var frontSideY2 = 19;
var backSideX2 = -28;
var backSideY2 = 20;
var frontSideX3 = 33;
var frontSideY3 = 18;
var backSideX3 = -33;
var backSideY3 = 18;
var healthFrontMax = 170;
var healthBackMax = 120;
var healthLeftMax = 120;
var healthRightMax = 120;
var shieldFront = 2;
var shieldLeft = 1;
var shieldRight = 1;
var shieldBack = 1;
}
Symbol 100 MovieClip Frame 90
_root.gotoAndStop("lblloader");
Symbol 137 MovieClip Frame 1
stop();
Symbol 137 MovieClip Frame 2
stop();
Symbol 137 MovieClip Frame 3
stop();
Symbol 137 MovieClip Frame 4
stop();
Symbol 137 MovieClip Frame 5
stop();
Symbol 143 MovieClip Frame 1
stop();
Symbol 143 MovieClip Frame 2
stop();
Symbol 143 MovieClip Frame 3
stop();
Symbol 143 MovieClip Frame 4
stop();
Symbol 143 MovieClip Frame 5
stop();
Symbol 149 MovieClip Frame 1
stop();
Symbol 149 MovieClip Frame 2
stop();
Symbol 149 MovieClip Frame 3
stop();
Symbol 149 MovieClip Frame 4
stop();
Symbol 149 MovieClip Frame 5
stop();
Symbol 155 MovieClip Frame 1
stop();
Symbol 155 MovieClip Frame 2
stop();
Symbol 155 MovieClip Frame 3
stop();
Symbol 155 MovieClip Frame 4
stop();
Symbol 155 MovieClip Frame 5
stop();
Symbol 172 MovieClip Frame 1
stop();
Symbol 172 MovieClip Frame 2
stop();
Symbol 172 MovieClip Frame 3
stop();
Symbol 172 MovieClip Frame 4
stop();
Symbol 172 MovieClip Frame 5
stop();
Symbol 178 MovieClip Frame 1
stop();
Symbol 178 MovieClip Frame 2
stop();
Symbol 178 MovieClip Frame 3
stop();
Symbol 178 MovieClip Frame 4
stop();
Symbol 178 MovieClip Frame 5
stop();
Symbol 184 MovieClip Frame 1
stop();
Symbol 184 MovieClip Frame 2
stop();
Symbol 184 MovieClip Frame 3
stop();
Symbol 184 MovieClip Frame 4
stop();
Symbol 184 MovieClip Frame 5
stop();
Symbol 190 MovieClip Frame 1
stop();
Symbol 190 MovieClip Frame 2
stop();
Symbol 190 MovieClip Frame 3
stop();
Symbol 190 MovieClip Frame 4
stop();
Symbol 190 MovieClip Frame 5
stop();
Symbol 208 MovieClip Frame 1
stop();
Symbol 208 MovieClip Frame 2
stop();
Symbol 208 MovieClip Frame 3
stop();
Symbol 208 MovieClip Frame 4
stop();
Symbol 208 MovieClip Frame 5
stop();
Symbol 214 MovieClip Frame 1
stop();
Symbol 214 MovieClip Frame 2
stop();
Symbol 214 MovieClip Frame 3
stop();
Symbol 214 MovieClip Frame 4
stop();
Symbol 214 MovieClip Frame 5
stop();
Symbol 220 MovieClip Frame 1
stop();
Symbol 220 MovieClip Frame 2
stop();
Symbol 220 MovieClip Frame 3
stop();
Symbol 220 MovieClip Frame 4
stop();
Symbol 220 MovieClip Frame 5
stop();
Symbol 226 MovieClip Frame 1
stop();
Symbol 226 MovieClip Frame 2
stop();
Symbol 226 MovieClip Frame 3
stop();
Symbol 226 MovieClip Frame 4
stop();
Symbol 226 MovieClip Frame 5
stop();
Symbol 244 MovieClip Frame 1
stop();
Symbol 244 MovieClip Frame 2
stop();
Symbol 244 MovieClip Frame 3
stop();
Symbol 244 MovieClip Frame 4
stop();
Symbol 244 MovieClip Frame 5
stop();
Symbol 250 MovieClip Frame 1
stop();
Symbol 250 MovieClip Frame 2
stop();
Symbol 250 MovieClip Frame 3
stop();
Symbol 250 MovieClip Frame 4
stop();
Symbol 250 MovieClip Frame 5
stop();
Symbol 256 MovieClip Frame 1
stop();
Symbol 256 MovieClip Frame 2
stop();
Symbol 256 MovieClip Frame 3
stop();
Symbol 256 MovieClip Frame 4
stop();
Symbol 256 MovieClip Frame 5
stop();
Symbol 262 MovieClip Frame 1
stop();
Symbol 262 MovieClip Frame 2
stop();
Symbol 262 MovieClip Frame 3
stop();
Symbol 262 MovieClip Frame 4
stop();
Symbol 262 MovieClip Frame 5
stop();
Symbol 280 MovieClip Frame 1
stop();
Symbol 280 MovieClip Frame 2
stop();
Symbol 280 MovieClip Frame 3
stop();
Symbol 280 MovieClip Frame 4
stop();
Symbol 280 MovieClip Frame 5
stop();
Symbol 286 MovieClip Frame 1
stop();
Symbol 286 MovieClip Frame 2
stop();
Symbol 286 MovieClip Frame 3
stop();
Symbol 286 MovieClip Frame 4
stop();
Symbol 286 MovieClip Frame 5
stop();
Symbol 292 MovieClip Frame 1
stop();
Symbol 292 MovieClip Frame 2
stop();
Symbol 292 MovieClip Frame 3
stop();
Symbol 292 MovieClip Frame 4
stop();
Symbol 292 MovieClip Frame 5
stop();
Symbol 298 MovieClip Frame 1
stop();
Symbol 298 MovieClip Frame 2
stop();
Symbol 298 MovieClip Frame 3
stop();
Symbol 298 MovieClip Frame 4
stop();
Symbol 298 MovieClip Frame 5
stop();
Symbol 313 MovieClip Frame 1
stop();
Symbol 313 MovieClip Frame 2
stop();
Symbol 313 MovieClip Frame 3
stop();
Symbol 313 MovieClip Frame 4
stop();
Symbol 313 MovieClip Frame 5
stop();
Symbol 319 MovieClip Frame 1
stop();
Symbol 319 MovieClip Frame 2
stop();
Symbol 319 MovieClip Frame 3
stop();
Symbol 319 MovieClip Frame 4
stop();
Symbol 319 MovieClip Frame 5
stop();
Symbol 325 MovieClip Frame 1
stop();
Symbol 325 MovieClip Frame 2
stop();
Symbol 325 MovieClip Frame 3
stop();
Symbol 325 MovieClip Frame 4
stop();
Symbol 325 MovieClip Frame 5
stop();
Symbol 331 MovieClip Frame 1
stop();
Symbol 331 MovieClip Frame 2
stop();
Symbol 331 MovieClip Frame 3
stop();
Symbol 331 MovieClip Frame 4
stop();
Symbol 331 MovieClip Frame 5
stop();
Symbol 349 MovieClip Frame 1
stop();
Symbol 349 MovieClip Frame 2
stop();
Symbol 349 MovieClip Frame 3
stop();
Symbol 349 MovieClip Frame 4
stop();
Symbol 349 MovieClip Frame 5
stop();
Symbol 355 MovieClip Frame 1
stop();
Symbol 355 MovieClip Frame 2
stop();
Symbol 355 MovieClip Frame 3
stop();
Symbol 355 MovieClip Frame 4
stop();
Symbol 355 MovieClip Frame 5
stop();
Symbol 361 MovieClip Frame 1
stop();
Symbol 361 MovieClip Frame 2
stop();
Symbol 361 MovieClip Frame 3
stop();
Symbol 361 MovieClip Frame 4
stop();
Symbol 361 MovieClip Frame 5
stop();
Symbol 367 MovieClip Frame 1
stop();
Symbol 367 MovieClip Frame 2
stop();
Symbol 367 MovieClip Frame 3
stop();
Symbol 367 MovieClip Frame 4
stop();
Symbol 367 MovieClip Frame 5
stop();
Symbol 384 MovieClip Frame 1
stop();
Symbol 384 MovieClip Frame 2
stop();
Symbol 384 MovieClip Frame 3
stop();
Symbol 384 MovieClip Frame 4
stop();
Symbol 384 MovieClip Frame 5
stop();
Symbol 390 MovieClip Frame 1
stop();
Symbol 390 MovieClip Frame 2
stop();
Symbol 390 MovieClip Frame 3
stop();
Symbol 390 MovieClip Frame 4
stop();
Symbol 390 MovieClip Frame 5
stop();
Symbol 396 MovieClip Frame 1
stop();
stop();
Symbol 396 MovieClip Frame 2
stop();
Symbol 396 MovieClip Frame 3
stop();
Symbol 396 MovieClip Frame 4
stop();
Symbol 396 MovieClip Frame 5
stop();
Symbol 402 MovieClip Frame 1
stop();
Symbol 402 MovieClip Frame 2
stop();
Symbol 402 MovieClip Frame 3
stop();
Symbol 402 MovieClip Frame 4
stop();
Symbol 402 MovieClip Frame 5
stop();
Symbol 418 MovieClip Frame 1
stop();
Symbol 418 MovieClip Frame 2
stop();
Symbol 418 MovieClip Frame 3
stop();
Symbol 418 MovieClip Frame 4
stop();
Symbol 418 MovieClip Frame 5
stop();
Symbol 424 MovieClip Frame 1
stop();
Symbol 424 MovieClip Frame 2
stop();
Symbol 424 MovieClip Frame 3
stop();
Symbol 424 MovieClip Frame 4
stop();
Symbol 424 MovieClip Frame 5
stop();
Symbol 430 MovieClip Frame 1
stop();
Symbol 430 MovieClip Frame 2
stop();
Symbol 430 MovieClip Frame 3
stop();
Symbol 430 MovieClip Frame 4
stop();
Symbol 430 MovieClip Frame 5
stop();
Symbol 436 MovieClip Frame 1
stop();
Symbol 436 MovieClip Frame 2
stop();
Symbol 436 MovieClip Frame 3
stop();
Symbol 436 MovieClip Frame 4
stop();
Symbol 436 MovieClip Frame 5
stop();
Symbol 454 MovieClip Frame 1
stop();
Symbol 454 MovieClip Frame 2
stop();
Symbol 454 MovieClip Frame 3
stop();
Symbol 454 MovieClip Frame 4
stop();
Symbol 454 MovieClip Frame 5
stop();
Symbol 460 MovieClip Frame 1
stop();
Symbol 460 MovieClip Frame 2
stop();
Symbol 460 MovieClip Frame 3
stop();
Symbol 460 MovieClip Frame 4
stop();
Symbol 460 MovieClip Frame 5
stop();
Symbol 466 MovieClip Frame 1
stop();
Symbol 466 MovieClip Frame 2
stop();
Symbol 466 MovieClip Frame 3
stop();
Symbol 466 MovieClip Frame 4
stop();
Symbol 466 MovieClip Frame 5
stop();
Symbol 472 MovieClip Frame 1
stop();
Symbol 472 MovieClip Frame 2
stop();
Symbol 472 MovieClip Frame 3
stop();
Symbol 472 MovieClip Frame 4
stop();
Symbol 472 MovieClip Frame 5
stop();
Symbol 490 MovieClip Frame 1
stop();
Symbol 490 MovieClip Frame 2
stop();
Symbol 490 MovieClip Frame 3
stop();
Symbol 490 MovieClip Frame 4
stop();
Symbol 490 MovieClip Frame 5
Symbol 496 MovieClip Frame 1
stop();
Symbol 496 MovieClip Frame 2
stop();
Symbol 496 MovieClip Frame 3
stop();
Symbol 496 MovieClip Frame 4
stop();
Symbol 496 MovieClip Frame 5
stop();
Symbol 502 MovieClip Frame 1
stop();
Symbol 502 MovieClip Frame 2
stop();
Symbol 502 MovieClip Frame 3
stop();
Symbol 502 MovieClip Frame 4
stop();
Symbol 502 MovieClip Frame 5
stop();
Symbol 508 MovieClip Frame 1
stop();
Symbol 508 MovieClip Frame 2
stop();
Symbol 508 MovieClip Frame 3
stop();
Symbol 508 MovieClip Frame 4
stop();
Symbol 508 MovieClip Frame 5
stop();
Symbol 526 MovieClip Frame 1
stop();
Symbol 526 MovieClip Frame 2
stop();
Symbol 526 MovieClip Frame 3
stop();
Symbol 526 MovieClip Frame 4
stop();
Symbol 526 MovieClip Frame 5
stop();
Symbol 532 MovieClip Frame 1
stop();
Symbol 532 MovieClip Frame 2
stop();
Symbol 532 MovieClip Frame 3
stop();
Symbol 532 MovieClip Frame 4
stop();
Symbol 532 MovieClip Frame 5
stop();
Symbol 538 MovieClip Frame 1
stop();
Symbol 538 MovieClip Frame 2
stop();
Symbol 538 MovieClip Frame 3
stop();
Symbol 538 MovieClip Frame 4
stop();
Symbol 538 MovieClip Frame 5
stop();
Symbol 544 MovieClip Frame 1
stop();
Symbol 544 MovieClip Frame 2
stop();
Symbol 544 MovieClip Frame 3
stop();
Symbol 544 MovieClip Frame 4
stop();
Symbol 544 MovieClip Frame 5
stop();
Symbol 557 MovieClip Frame 14
_parent.removeMovieClip();
Symbol 564 MovieClip Frame 24
this.removeMovieClip();
Symbol 611 MovieClip Frame 1
stop();
Symbol 611 MovieClip Frame 2
stop();
Symbol 616 MovieClip Frame 1
stop();
Symbol 616 MovieClip Frame 75
gotoAndStop ("silent");
Symbol 621 MovieClip Frame 1
stop();
Symbol 621 MovieClip Frame 2
textAnnounceWin.points.text = Math.floor(_parent.timeBonus / 24) * _parent.timeBonusMultiplier;
Symbol 621 MovieClip Frame 75
gotoAndStop ("silent");
Symbol 628 MovieClip Frame 1
stop();
Symbol 628 MovieClip Frame 2
stop();
Symbol 635 MovieClip Frame 1
buttonReturn.onRelease = function () {
_parent.instructionsViewed = true;
_parent.gameState = 9;
_parent.enemiesLeft.text = _parent.carsRemaining;
this.gotoAndStop("normal");
_visible = false;
enabled = false;
};
buttonReturn.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttonReturn.onRollOut = function () {
this.gotoAndStop("normal");
};
buttonReturn.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
stop();
Symbol 646 MovieClip Frame 1
stop();
Symbol 646 MovieClip Frame 2
stop();
Symbol 650 MovieClip Frame 1
stop();
Symbol 650 MovieClip Frame 2
stop();
Symbol 657 MovieClip Frame 1
stop();
Symbol 657 MovieClip Frame 2
stop();
Symbol 693 MovieClip Frame 1
stop();
Symbol 693 MovieClip Frame 2
stop();
Symbol 697 MovieClip Frame 1
stop();
Symbol 697 MovieClip Frame 2
stop();
Symbol 701 MovieClip Frame 1
stop();
Symbol 701 MovieClip Frame 2
stop();
Symbol 706 MovieClip Frame 1
stop();
Symbol 706 MovieClip Frame 2
stop();
Symbol 709 MovieClip Frame 1
stop();
Symbol 709 MovieClip Frame 2
stop();
Symbol 713 MovieClip Frame 1
buttStart.onRelease = function () {
_parent.gameState = 6;
gotoAndStop ("frmSelectCar");
};
buttStart.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttStart.onRollOut = function () {
this.gotoAndStop("normal");
};
buttStart.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
buttInstructions.onRelease = function () {
_parent.instructionsViewed = true;
_parent.gameState = 2;
gotoAndStop ("frmInstructions");
};
buttInstructions.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttInstructions.onRollOut = function () {
this.gotoAndStop("normal");
};
buttInstructions.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
stop();
Symbol 713 MovieClip Frame 2
buttonReturn.onRelease = function () {
_parent.gameState = 0;
this.gotoAndStop("normal");
gotoAndStop ("frmTitle");
};
buttonReturn.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttonReturn.onRollOut = function () {
this.gotoAndStop("normal");
};
buttonReturn.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
stop();
Symbol 713 MovieClip Frame 3
buttonReturn.onRelease = function () {
_parent.gameState = 6;
this.gotoAndStop("normal");
gotoAndStop ("frmSelectCar");
};
buttonReturn.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttonReturn.onRollOut = function () {
this.gotoAndStop("normal");
};
buttonReturn.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
stop();
Symbol 713 MovieClip Frame 4
buttCarSelect1.onRelease = function () {
_parent.pCar.sprite = _parent.carHolder.pCarA;
_parent.pCar.speedMax = 11.5;
_parent.pCar.acceleration = 0.8;
_parent.pCar.healthFrontMax = 120;
_parent.pCar.healthBackMax = 90;
_parent.pCar.healthLeftMax = 90;
_parent.pCar.healthRightMax = 90;
_parent.pCar.healthFront = _parent.pCar.healthFrontMax;
_parent.pCar.healthBack = _parent.pCar.healthBackMax;
_parent.pCar.healthLeft = _parent.pCar.healthLeftMax;
_parent.pCar.healthRight = _parent.pCar.healthRightMax;
_parent.carHolder.pCarA._x = -200;
_parent.carHolder.pCarA._y = -200;
_parent.carHolder.pCarB._x = -200;
_parent.carHolder.pCarB._y = -200;
_parent.carHolder.pCarC._x = -200;
_parent.carHolder.pCarC._y = -200;
_parent.gameState = 8;
this.gotoAndStop("normal");
gotoAndStop ("frmMain");
};
buttCarSelect1.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttCarSelect1.onRollOut = function () {
this.gotoAndStop("normal");
};
buttCarSelect1.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
buttCarSelect2.onRelease = function () {
_parent.pCar.sprite = _parent.carHolder.pCarB;
_parent.pCar.speedMax = 9.5;
_parent.pCar.acceleration = 0.6;
_parent.pCar.healthFrontMax = 180;
_parent.pCar.healthBackMax = 135;
_parent.pCar.healthLeftMax = 135;
_parent.pCar.healthRightMax = 135;
_parent.pCar.healthFront = _parent.pCar.healthFrontMax;
_parent.pCar.healthBack = _parent.pCar.healthBackMax;
_parent.pCar.healthLeft = _parent.pCar.healthLeftMax;
_parent.pCar.healthRight = _parent.pCar.healthRightMax;
_parent.carHolder.pCarA._x = -200;
_parent.carHolder.pCarA._y = -200;
_parent.carHolder.pCarB._x = -200;
_parent.carHolder.pCarB._y = -200;
_parent.carHolder.pCarC._x = -200;
_parent.carHolder.pCarC._y = -200;
_parent.gameState = 8;
this.gotoAndStop("normal");
gotoAndStop ("frmMain");
};
buttCarSelect2.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttCarSelect2.onRollOut = function () {
this.gotoAndStop("normal");
};
buttCarSelect2.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
buttCarSelect3.onRelease = function () {
_parent.pCar.sprite = _parent.carHolder.pCarC;
_parent.pCar.speedMax = 7.5;
_parent.pCar.acceleration = 0.5;
_parent.pCar.healthFrontMax = 240;
_parent.pCar.healthBackMax = 180;
_parent.pCar.healthLeftMax = 180;
_parent.pCar.healthRightMax = 180;
_parent.pCar.healthFront = _parent.pCar.healthFrontMax;
_parent.pCar.healthBack = _parent.pCar.healthBackMax;
_parent.pCar.healthLeft = _parent.pCar.healthLeftMax;
_parent.pCar.healthRight = _parent.pCar.healthRightMax;
_parent.carHolder.pCarA._x = -200;
_parent.carHolder.pCarA._y = -200;
_parent.carHolder.pCarB._x = -200;
_parent.carHolder.pCarB._y = -200;
_parent.carHolder.pCarC._x = -200;
_parent.carHolder.pCarC._y = -200;
_parent.gameState = 8;
this.gotoAndStop("normal");
gotoAndStop ("frmMain");
};
buttCarSelect3.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttCarSelect3.onRollOut = function () {
this.gotoAndStop("normal");
};
buttCarSelect3.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
stop();
Symbol 713 MovieClip Frame 5
stop();
Symbol 713 MovieClip Frame 6
stopAllSounds();
pScore.text = ("Score " + _parent.playerScore) + " pts";
_root.obj_game._gstatus = "gamecompleted";
partner_score = _parent.playerScore;
buttPlayAgain.onRelease = function () {
_parent.gameState = 6;
_parent.repositionCars();
this.gotoAndStop("normal");
gotoAndStop ("frmSelectCar");
};
buttPlayAgain.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttPlayAgain.onRollOut = function () {
this.gotoAndStop("normal");
};
buttPlayAgain.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
buttMainMenu.onRelease = function () {
_parent.gameState = 0;
_parent.repositionCars();
this.gotoAndStop("normal");
gotoAndStop ("frmTitle");
};
buttMainMenu.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttMainMenu.onRollOut = function () {
this.gotoAndStop("normal");
};
buttMainMenu.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
stop();
Symbol 713 MovieClip Frame 7
stopAllSounds();
pScore.text = ("Score " + _parent.playerScore) + " pts";
_root.obj_game._gstatus = "gameover";
partner_score = _parent.playerScore;
buttPlayAgain.onRelease = function () {
_parent.gameState = 6;
_parent.repositionCars();
this.gotoAndStop("normal");
gotoAndStop ("frmSelectCar");
};
buttPlayAgain.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttPlayAgain.onRollOut = function () {
this.gotoAndStop("normal");
};
buttPlayAgain.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
buttMainMenu.onRelease = function () {
_parent.gameState = 0;
_parent.repositionCars();
this.gotoAndStop("normal");
gotoAndStop ("frmTitle");
};
buttMainMenu.onRollOver = function () {
this.gotoAndStop("hilite");
};
buttMainMenu.onRollOut = function () {
this.gotoAndStop("normal");
};
buttMainMenu.onReleaseOutside = function () {
this.gotoAndStop("normal");
};
stop();
Symbol 719 MovieClip Frame 1
stop();
Symbol 720 MovieClip Frame 1
function repositionCars() {
var _local1;
var _local2;
cleaningUp = true;
timeStart = getTimer();
_local1 = 0;
while (_local1 < carCount) {
deleteCar(_local1);
}
carsRemaining = carsRemainingMax;
enemiesLeft.text = carsRemaining;
timerFreezeCount = 0;
timerFreezeDuration = 0;
txtEnemiesFrozen._alpha = 0;
timeBonus = timeBonusMax;
timeElapsed.text = Math.floor(timeBonus / 24);
playerScore = 0;
pScore.text = playerScore;
carsAreSpawning = true;
spawnIndex = 0;
spawned = 0;
spawnTimeIndex = 0;
timeIndex = 0;
playerIsAlive = true;
spCount = sp.length;
spIndex = 0;
while (spIndex < spCount) {
spHolder[spIndex] = sp[spIndex];
spIndex++;
}
j = Math.floor(Math.random() * spCount);
pCar.posX = spHolder[j].xPos;
pCar.posY = spHolder[j].yPos;
pCar.sprite._x = pCar.posX;
pCar.sprite._y = pCar.posY;
pCar.healthFront = pCar.healthFrontMax;
pCar.healthLeft = pCar.healthLeftMax;
pCar.healthRight = pCar.healthRightMax;
pCar.healthBack = pCar.healthBackMax;
pCar.sprite.panelFront.gotoAndStop("dmg0");
pCar.sprite.panelLeft.gotoAndStop("dmg0");
pCar.sprite.panelRight.gotoAndStop("dmg0");
pCar.sprite.panelBack.gotoAndStop("dmg0");
pCarHealthFront.health1._alpha = 100;
pCarHealthLeft.health1._alpha = 100;
pCarHealthRight.health1._alpha = 100;
pCarHealthBack.health1._alpha = 100;
pCarHealthMid.health1._alpha = 100;
pCarHealthFront.health2._alpha = 100;
pCarHealthLeft.health2._alpha = 100;
pCarHealthRight.health2._alpha = 100;
pCarHealthBack.health2._alpha = 100;
pCarHealthMid.health2._alpha = 100;
pCar.sprite.panelMiddle._alpha = 0;
pCar.heading = Math.random() * PI2;
pCar.velocityX = 0;
pCar.velocityY = 0;
cleaningUp = false;
}
function drawVehicles() {
var _local1 = 0;
while (_local1 < carCount) {
cars[_local1].sprite._x = cars[_local1].posX;
cars[_local1].sprite._y = cars[_local1].posY;
cars[_local1].sprite._rotation = cars[_local1].heading * RAD2DEG;
cars[_local1].spray._x = cars[_local1].posX;
cars[_local1].spray._y = cars[_local1].posY;
cars[_local1].spray._rotation = cars[_local1].sprite._rotation;
_local1++;
}
pCar.sprite._x = pCar.posX;
pCar.sprite._y = pCar.posY;
pCar.sprite._rotation = pCar.heading * RAD2DEG;
pCar.spray._x = pCar.posX;
pCar.spray._y = pCar.posY;
pCar.spray._rotation = pCar.sprite._rotation;
}
function v1Elastic(m1, m2, v1, v2) {
return((((m1 - m2) / (m1 + m2)) * v1) + (((2 * m2) / (m1 + m2)) * v2));
}
function v2Elastic(m1, m2, v1, v2) {
return((((2 * m1) / (m1 + m2)) * v1) + (((m2 - m1) / (m1 + m2)) * v2));
}
function vInelastic(M1, M2, V1, V2) {
return(((M1 * V1) + (M2 * V2)) / (M1 + M2));
}
function deleteCar(carID) {
var _local1 = explosions.getNextHighestDepth();
if (!cleaningUp) {
explosions.boom.duplicateMovieClip("boom" + _local1, _local1);
explosions["boom" + _local1]._x = cars[carID].posX;
explosions["boom" + _local1]._y = cars[carID].posY;
explosions["boom" + _local1].play();
if (soundIsOn) {
sBoom.start();
}
}
cars[carID].sprite.removeMovieClip();
cars[carID].spray.removeMovieClip();
_local1 = carID;
while (_local1 < carCount) {
cars[_local1] = cars[_local1 + 1];
_local1++;
}
carCount--;
}
function collideCheckP(checkX, checkY) {
var _local1;
var _local2;
var _local3;
var _local6;
var _local7;
var _local8;
var _local9;
if (carHolder.hitTest(checkX, checkY, true)) {
_local1 = 0;
while (_local1 < carCount) {
if (cars[_local1].sprite.hitTest(checkX, checkY, true)) {
_local3 = getDamage(pCar, cars[_local1]);
if (soundIsOn) {
sBump.start();
}
if (!isNaN(_local3)) {
pCarIsHit = false;
if (cars[_local1].isAlive) {
panelHit(checkX, checkY, cars[_local1], _local3);
if ((!cars[_local1].isAlive) && (playerIsAlive)) {
_local2 = scoreOverlay.getNextHighestDepth();
scoreOverlay.scoreBox.duplicateMovieClip("scoreBox" + _local2, _local2);
scoreOverlay["scoreBox" + _local2]._x = cars[_local1].posX;
scoreOverlay["scoreBox" + _local2]._y = cars[_local1].posY;
scoreOverlay["scoreBox" + _local2].pHolder.points.text = "+" + cars[_local1].pointValue;
playerScore = playerScore + cars[_local1].pointValue;
}
} else {
panelHit(checkX, checkY, cars[_local1], _local3);
}
}
_local6 = v1Elastic(pCar.mass, cars[_local1].mass, pCar.velocityX, cars[_local1].velocityX);
_local7 = v1Elastic(pCar.mass, cars[_local1].mass, pCar.velocityY, cars[_local1].velocityY);
_local8 = v2Elastic(pCar.mass, cars[_local1].mass, pCar.velocityX, cars[_local1].velocityX);
_local9 = v2Elastic(pCar.mass, cars[_local1].mass, pCar.velocityY, cars[_local1].velocityY);
pCar.velocityX = _local6;
pCar.velocityY = _local7;
cars[_local1].velocityX = _local8;
cars[_local1].velocityY = _local9;
repel(pCar, cars[_local1]);
break;
}
_local1++;
}
}
}
function collideCheckAI(i, checkX, checkY) {
var _local2;
var _local5 = 0;
var _local6 = 0;
var _local7 = 0;
var _local8 = 0;
if (pCar.sprite.hitTest(checkX, checkY, true)) {
if (cars[i].isAlive) {
pCarIsHit = true;
panelHit(checkX, checkY, pCar, getDamage(cars[i], pCar));
if (carsNotFrozen) {
switch (impactPoint) {
case 0 :
cars[i].turnDirection = 2;
cars[i].turn2();
break;
case 1 :
cars[i].turnDirection = 1;
cars[i].turn2();
}
}
}
_local5 = v1Elastic(cars[i].mass, pCar.mass, cars[i].velocityX, pCar.velocityX);
_local6 = v1Elastic(cars[i].mass, pCar.mass, cars[i].velocityY, pCar.velocityY);
_local7 = v2Elastic(cars[i].mass, pCar.mass, cars[i].velocityX, pCar.velocityX);
_local8 = v2Elastic(cars[i].mass, pCar.mass, cars[i].velocityY, pCar.velocityY);
cars[i].velocityX = _local5;
cars[i].velocityY = _local6;
pCar.velocityX = _local7;
pCar.velocityY = _local8;
repel(pCar, cars[i]);
if (cars[i].cState == 0) {
cars[i].changeCState();
}
} else {
_local2 = 0;
while (_local2 < carCount) {
if (i != _local2) {
if (cars[_local2].sprite.hitTest(checkX, checkY, true)) {
if (cars[i].isAlive) {
pCarIsHit = false;
if (cars[_local2].isAlive) {
panelHit(checkX, checkY, cars[_local2], getDamage(cars[i], cars[_local2]));
} else {
panelHit(checkX, checkY, cars[_local2], getDamage(cars[i], cars[_local2]));
}
switch (impactPoint) {
case 0 :
cars[i].turnDirection = 2;
cars[i].turn2();
break;
case 1 :
cars[i].turnDirection = 1;
cars[i].turn2();
}
}
_local5 = v1Elastic(cars[i].mass, cars[_local2].mass, cars[i].velocityX, cars[_local2].velocityX);
_local6 = v1Elastic(cars[i].mass, cars[_local2].mass, cars[i].velocityY, cars[_local2].velocityY);
_local7 = v2Elastic(cars[i].mass, cars[_local2].mass, cars[i].velocityX, cars[_local2].velocityX);
_local8 = v2Elastic(cars[i].mass, cars[_local2].mass, cars[i].velocityY, cars[_local2].velocityY);
cars[i].velocityX = _local5;
cars[i].velocityY = _local6;
cars[_local2].velocityX = _local7;
cars[_local2].velocityY = _local8;
repel(cars[i], cars[_local2]);
cars[i].changeCState();
break;
}
}
_local2++;
}
}
}
function repel(c1, c2) {
if (c1.posX < c2.posX) {
c1.posX = c1.posX - repelStrength;
c2.posX = c2.posX + repelStrength;
} else if (c1.posX > c2.posX) {
c1.posX = c1.posX + repelStrength;
c2.posX = c2.posX - repelStrength;
}
if (c1.posY < c2.posY) {
c1.posY = c1.posY - repelStrength;
c2.posY = c2.posY + repelStrength;
} else if (c1.posY > c2.posY) {
c1.posY = c1.posY + repelStrength;
c2.posY = c2.posY - repelStrength;
}
}
function centerHome(c) {
if (c.posX < ellipseX) {
c.posX = c.posX + (attractStrength * 2);
} else if (c.posX > ellipseX) {
c.posX = c.posX - (attractStrength * 2);
}
if (c.posY < ellipseY) {
c.posY = c.posY + (attractStrength * 2);
} else if (c.posY > ellipseY) {
c.posY = c.posY - (attractStrength * 2);
}
}
function getAngle(x1, x2, y1, y2) {
var _local3 = x1 - x2;
var _local2 = y1 - y2;
var _local1;
if (_local3 > 0) {
_local1 = Math.atan(_local2 / _local3);
} else if (_local3 < 0) {
_local1 = Math.PI + Math.atan(_local2 / _local3);
} else if (_local2 > 0) {
_local1 = (Math.PI/2);
} else if (_local2 < 0) {
_local1 = 4.71238898038469;
} else {
_local1 = 0;
}
if (_local1 < 0) {
_local1 = _local1 + PI2;
}
return(_local1);
}
function panelHit(xPos, yPos, cClip, dmg) {
var _local5 = 0;
var _local3 = 0;
var _local2;
var _local4;
if (cClip.sprite.hitFront.hitTest(xPos, yPos, true)) {
if (dmg > cClip.shieldFront) {
_local5 = dmg - cClip.shieldFront;
cClip.healthFront = cClip.healthFront - _local5;
_local4 = Math.floor(damageScoreMultiplier * _local5);
if (((isPlayerCar && (cClip.isAlive)) && (_local4 > 0)) && (playerIsAlive)) {
playerScore = playerScore + _local4;
_local2 = scoreOverlay.getNextHighestDepth();
scoreOverlay.scoreBox.duplicateMovieClip("scoreBox" + _local2, _local2);
scoreOverlay["scoreBox" + _local2]._x = xPos;
scoreOverlay["scoreBox" + _local2]._y = yPos;
scoreOverlay["scoreBox" + _local2].pHolder.points.text = "+" + _local4;
if (soundIsOn) {
sBump.start();
}
pScore.text = playerScore;
}
if (cClip.healthFront >= (cClip.healthFrontMax * 0.75)) {
cClip.sprite.panelFront.gotoAndStop("dmg0");
} else if (cClip.healthFront >= (cClip.healthFrontMax * 0.5)) {
cClip.sprite.panelFront.gotoAndStop("dmg1");
} else if (cClip.healthFront >= (cClip.healthFrontMax * 0.25)) {
cClip.sprite.panelFront.gotoAndStop("dmg2");
} else if (cClip.healthFront > 0) {
cClip.sprite.panelFront.gotoAndStop("dmg3");
} else if (cClip.healthFront <= 0) {
cClip.sprite.panelFront.gotoAndStop("dmg4");
cClip.sprite.panelMiddle._alpha = 100;
if (cClip.isAlive) {
cClip.isAlive = false;
if (soundIsOn) {
sCrash.start();
}
}
}
if (pCarIsHit) {
_local3 = Math.floor((100 * pCar.healthFront) / pCar.healthFrontMax);
if (_local3 > 50) {
pCarHealthFront.health1._alpha = 2 * (_local3 - 50);
pCarHealthFront.health2._alpha = 100;
} else {
pCarHealthFront.health1._alpha = 0;
pCarHealthFront.health2._alpha = 2 * _local3;
}
}
}
} else if (cClip.sprite.hitLeft.hitTest(xPos, yPos, true)) {
if (dmg > cClip.shieldLeft) {
_local5 = dmg - cClip.shieldLeft;
cClip.healthLeft = cClip.healthLeft - _local5;
_local4 = Math.floor(damageScoreMultiplier * _local5);
if (((isPlayerCar && (cClip.isAlive)) && (_local4 > 0)) && (playerIsAlive)) {
playerScore = playerScore + _local4;
_local2 = scoreOverlay.getNextHighestDepth();
scoreOverlay.scoreBox.duplicateMovieClip("scoreBox" + _local2, _local2);
scoreOverlay["scoreBox" + _local2]._x = xPos;
scoreOverlay["scoreBox" + _local2]._y = yPos;
scoreOverlay["scoreBox" + _local2].pHolder.points.text = "+" + _local4;
if (soundIsOn) {
sBump.start();
}
pScore.text = playerScore;
}
if (cClip.healthLeft >= (cClip.healthLeftMax * 0.75)) {
cClip.sprite.panelLeft.gotoAndStop("dmg0");
} else if (cClip.healthLeft >= (cClip.healthLeftMax * 0.5)) {
cClip.sprite.panelLeft.gotoAndStop("dmg1");
} else if (cClip.healthLeft >= (cClip.healthLeftMax * 0.25)) {
cClip.sprite.panelLeft.gotoAndStop("dmg2");
} else if (cClip.healthLeft > 0) {
cClip.sprite.panelLeft.gotoAndStop("dmg3");
} else if (cClip.healthLeft <= 0) {
cClip.sprite.panelLeft.gotoAndStop("dmg4");
cClip.sprite.panelMiddle._alpha = 100;
if (cClip.isAlive) {
cClip.isAlive = false;
if (soundIsOn) {
sCrash.start();
}
}
}
if (pCarIsHit) {
_local3 = Math.floor((100 * pCar.healthLeft) / pCar.healthLeftMax);
if (_local3 > 50) {
pCarHealthLeft.health1._alpha = 2 * (_local3 - 50);
pCarHealthLeft.health2._alpha = 100;
} else {
pCarHealthLeft.health1._alpha = 0;
pCarHealthLeft.health2._alpha = 2 * _local3;
}
}
}
} else if (cClip.sprite.hitRight.hitTest(xPos, yPos, true)) {
if (dmg > cClip.shieldRight) {
_local5 = dmg - cClip.shieldRight;
cClip.healthRight = cClip.healthRight - _local5;
_local4 = Math.floor(damageScoreMultiplier * _local5);
if (((isPlayerCar && (cClip.isAlive)) && (_local4 > 0)) && (playerIsAlive)) {
playerScore = playerScore + _local4;
_local2 = scoreOverlay.getNextHighestDepth();
scoreOverlay.scoreBox.duplicateMovieClip("scoreBox" + _local2, _local2);
scoreOverlay["scoreBox" + _local2]._x = xPos;
scoreOverlay["scoreBox" + _local2]._y = yPos;
scoreOverlay["scoreBox" + _local2].pHolder.points.text = "+" + _local4;
if (soundIsOn) {
sBump.start();
}
pScore.text = playerScore;
}
if (cClip.healthRight >= (cClip.healthRightMax * 0.75)) {
cClip.sprite.panelRight.gotoAndStop("dmg0");
} else if (cClip.healthRight >= (cClip.healthRightMax * 0.5)) {
cClip.sprite.panelRight.gotoAndStop("dmg1");
} else if (cClip.healthRight >= (cClip.healthRightMax * 0.25)) {
cClip.sprite.panelRight.gotoAndStop("dmg2");
} else if (cClip.healthRight > 0) {
cClip.sprite.panelRight.gotoAndStop("dmg3");
} else if (cClip.healthRight <= 0) {
cClip.sprite.panelRight.gotoAndStop("dmg4");
cClip.sprite.panelMiddle._alpha = 100;
if (cClip.isAlive) {
cClip.isAlive = false;
if (soundIsOn) {
sCrash.start();
}
}
}
if (pCarIsHit) {
_local3 = Math.floor((100 * pCar.healthRight) / pCar.healthRightMax);
if (_local3 > 50) {
pCarHealthRight.health1._alpha = 2 * (_local3 - 50);
pCarHealthRight.health2._alpha = 100;
} else {
pCarHealthRight.health1._alpha = 0;
pCarHealthRight.health2._alpha = 2 * _local3;
}
}
}
} else if (cClip.sprite.hitBack.hitTest(xPos, yPos, true)) {
if (dmg > cClip.shieldBack) {
_local5 = dmg - cClip.shieldBack;
cClip.healthBack = cClip.healthBack - _local5;
_local4 = Math.floor(damageScoreMultiplier * _local5);
if (((isPlayerCar && (cClip.isAlive)) && (_local4 > 0)) && (playerIsAlive)) {
playerScore = playerScore + _local4;
_local2 = scoreOverlay.getNextHighestDepth();
scoreOverlay.scoreBox.duplicateMovieClip("scoreBox" + _local2, _local2);
scoreOverlay["scoreBox" + _local2]._x = xPos;
scoreOverlay["scoreBox" + _local2]._y = yPos;
scoreOverlay["scoreBox" + _local2].pHolder.points.text = "+" + _local4;
if (soundIsOn) {
sBump.start();
}
pScore.text = playerScore;
}
if (cClip.healthBack >= (cClip.healthBackMax * 0.75)) {
cClip.sprite.panelBack.gotoAndStop("dmg0");
} else if (cClip.healthBack >= (cClip.healthBackMax * 0.5)) {
cClip.sprite.panelBack.gotoAndStop("dmg1");
} else if (cClip.healthBack >= (cClip.healthBackMax * 0.25)) {
cClip.sprite.panelBack.gotoAndStop("dmg2");
} else if (cClip.healthBack > 0) {
cClip.sprite.panelBack.gotoAndStop("dmg3");
} else if (cClip.healthBack <= 0) {
cClip.sprite.panelBack.gotoAndStop("dmg4");
cClip.sprite.panelMiddle._alpha = 100;
if (cClip.isAlive) {
cClip.isAlive = false;
if (soundIsOn) {
sCrash.start();
}
}
}
if (pCarIsHit) {
_local3 = Math.floor((100 * pCar.healthBack) / pCar.healthBackMax);
if (_local3 > 50) {
pCarHealthBack.health1._alpha = 2 * (_local3 - 50);
pCarHealthBack.health2._alpha = 100;
} else {
pCarHealthBack.health1._alpha = 0;
pCarHealthBack.health2._alpha = 2 * _local3;
}
}
}
} else if (cClip.sprite.panelBack.hitTest(xPos, yPos, true)) {
if (dmg > cClip.shieldBack) {
dm2 = dmg - cClip.shieldBack;
cClip.healthBack = cClip.healthBack - _local5;
_local4 = Math.floor(damageScoreMultiplier * _local5);
if (((isPlayerCar && (cClip.isAlive)) && (_local4 > 0)) && (playerIsAlive)) {
playerScore = playerScore + _local4;
_local2 = scoreOverlay.getNextHighestDepth();
scoreOverlay.scoreBox.duplicateMovieClip("scoreBox" + _local2, _local2);
scoreOverlay["scoreBox" + _local2]._x = xPos;
scoreOverlay["scoreBox" + _local2]._y = yPos;
scoreOverlay["scoreBox" + _local2].pHolder.points.text = "+" + _local4;
if (soundIsOn) {
sBump.start();
}
pScore.text = playerScore;
}
if (cClip.healthBack >= (cClip.healthBackMax * 0.75)) {
cClip.sprite.panelBack.gotoAndStop("dmg0");
} else if (cClip.healthBack >= (cClip.healthBackMax * 0.5)) {
cClip.sprite.panelBack.gotoAndStop("dmg1");
} else if (cClip.healthBack >= (cClip.healthBackMax * 0.25)) {
cClip.sprite.panelBack.gotoAndStop("dmg2");
} else if (cClip.healthBack > 0) {
cClip.sprite.panelBack.gotoAndStop("dmg3");
} else if (cClip.healthBack <= 0) {
cClip.sprite.panelBack.gotoAndStop("dmg4");
cClip.sprite.panelMiddle._alpha = 100;
if (cClip.isAlive) {
cClip.isAlive = false;
if (soundIsOn) {
sCrash.start();
}
}
}
if (pCarIsHit) {
_local3 = Math.floor((100 * pCar.healthBack) / pCar.healthBackMax);
if (_local3 > 50) {
pCarHealthBack.health1._alpha = 2 * (_local3 - 50);
pCarHealthBack.health2._alpha = 100;
} else {
pCarHealthBack.health1._alpha = 0;
pCarHealthBack.health2._alpha = 2 * _local3;
}
}
}
}
if (pCarIsHit) {
if (pCarHealthFront.health1._alpha < pCarHealthLeft.health1._alpha) {
if (pCarHealthFront.health1._alpha < pCarHealthRight.health1._alpha) {
if (pCarHealthFront.health1._alpha < pCarHealthBack.health1._alpha) {
pCarHealthMid.health1._alpha = pCarHealthFront.health1._alpha;
} else {
pCarHealthMid.health1._alpha = pCarHealthBack.health1._alpha;
}
} else if (pCarHealthRight.health1._alpha < pCarHealthBack.health1._alpha) {
pCarHealthMid.health1._alpha = pCarHealthRight.health1._alpha;
} else {
pCarHealthMid.health1._alpha = pCarHealthBack.health1._alpha;
}
} else if (pCarHealthLeft.health1._alpha < pCarHealthRight.health1._alpha) {
if (pCarHealthLeft.health1._alpha < pCarHealthBack.health1._alpha) {
pCarHealthMid.health1._alpha = pCarHealthLeft.health1._alpha;
} else {
pCarHealthMid.health1._alpha = pCarHealthBack.health1._alpha;
}
} else if (pCarHealthRight.health1._alpha < pCarHealthBack.health1._alpha) {
pCarHealthMid.health1._alpha = pCarHealthRight.health1._alpha;
} else {
pCarHealthMid.health1._alpha = pCarHealthBack.health1._alpha;
}
if (pCarHealthFront.health2._alpha < pCarHealthLeft.health2._alpha) {
if (pCarHealthFront.health2._alpha < pCarHealthRight.health2._alpha) {
if (pCarHealthFront.health2._alpha < pCarHealthBack.health2._alpha) {
pCarHealthMid.health2._alpha = pCarHealthFront.health2._alpha;
} else {
pCarHealthMid.health2._alpha = pCarHealthBack.health2._alpha;
}
} else if (pCarHealthRight.health2._alpha < pCarHealthBack.health2._alpha) {
pCarHealthMid.health2._alpha = pCarHealthRight.health2._alpha;
} else {
pCarHealthMid.health2._alpha = pCarHealthBack.health2._alpha;
}
} else if (pCarHealthLeft.health2._alpha < pCarHealthRight.health2._alpha) {
if (pCarHealthLeft.health2._alpha < pCarHealthBack.health2._alpha) {
pCarHealthMid.health2._alpha = pCarHealthLeft.health2._alpha;
} else {
pCarHealthMid.health2._alpha = pCarHealthBack.health2._alpha;
}
} else if (pCarHealthRight.health2._alpha < pCarHealthBack.health2._alpha) {
pCarHealthMid.health2._alpha = pCarHealthRight.health2._alpha;
} else {
pCarHealthMid.health2._alpha = pCarHealthBack.health2._alpha;
}
if (pCarHealthMid.health2._alpha <= 0) {
playerLose();
}
}
}
function getDamage(vehicle1, vehicle2) {
if (vehicle2.velocityX > 0) {
vehicle2.velocityHeading = Math.atan(vehicle2.velocityY / vehicle2.velocityX);
} else if (vehicle2.velocityX < 0) {
vehicle2.velocityHeading = Math.PI + Math.atan(vehicle2.velocityY / vehicle2.velocityX);
} else if (vehicle2.velocityY > 0) {
vehicle2.velocityHeading = (Math.PI/2);
} else if (vehicle2.velocityY < 0) {
vehicle2.velocityHeading = 4.71238898038469;
} else {
vehicle2.velocityHeading = vehicle2.heading;
}
headingDiff = vehicle2.velocityHeading - vehicle1.velocityHeading;
velocityDiff = Math.cos(headingDiff) * Math.sqrt((vehicle2.velocityX * vehicle2.velocityX) + (vehicle2.velocityY * vehicle2.velocityY));
damageDiff = Math.sqrt((vehicle1.velocityX * vehicle1.velocityX) + (vehicle1.velocityY * vehicle1.velocityY)) - velocityDiff;
if (damageDiff > 0) {
} else {
damageDiff = 0;
}
return(damageDiff);
}
function playerWin() {
txtEnemiesFrozen._alpha = 0;
announceWin.gotoAndPlay("announce");
playerScore = playerScore + (Math.floor(timeBonus / 24) * timeBonusMultiplier);
_root.partner_score = playerScore;
txtEnemiesFrozen._alpha = 0;
playerWon = true;
}
function playerLose() {
txtEnemiesFrozen._alpha = 0;
_root.partner_score = playerScore;
announceLose.gotoAndPlay("announce");
txtEnemiesFrozen._alpha = 0;
playerIsAlive = false;
}
_parent._sndBtn._visible = true;
var PI2 = (Math.PI*2);
var PIHALF = (Math.PI/2);
var RAD2DEG = 57.2957795130823;
var i;
var j;
var gameState = 0;
var carCount = 0;
var carTypes = 9;
var carIndex = 0;
var carsRemaining = 0;
var carsRemainingMax = 0;
var cars = new Array();
var carsLength;
var carDepthBase = 500;
var arenaCarCapacity = 7;
var arenaCarSlot = new Array();
var endTimer = 0;
var endTimeOut = 125;
var timeStart = getTimer();
var timeCurrent;
var timerFreezeCount = 0;
var timerFreezeDuration = 0;
var timerFreezeCountInterval = 840;
var timerFreezeDurationInterval = 240;
var carsNotFrozen = true;
var timeBonusMax = 7200;
var timeBonus = 7200;
var timeBonusMultiplier = 100;
var ellipseX = 400;
var ellipseY = 250;
var carRadius = 150;
var pCar = new CarPlayer();
var repelStrength = 0.5;
var attractStrength = 1;
var wallDamp = 0.5;
var pCarIsHit = false;
var isPlayerCar = false;
var playerScore = 0;
var exits = new Array();
var exitHolder = new Array();
var exitCount = 4;
var exitIndex = 0;
var sp = new Array();
var spHolder = new Array();
var spCount = 0;
var spIndex = 0;
var damageScoreMultiplier = 10;
var playerIsAlive = true;
var playerWon = false;
var impactPoint = 0;
var mouseListener = new Object();
var spawnSequence = new Array();
var spawnIndex = 0;
var spawned = 0;
var timeIndex = 0;
var intervalSpawnCar = 360;
var spawnTimeIndex = 0;
var spawnTimeInterval = 48;
var carsAreSpawning = true;
var spawnEndProximityThreshold = 5;
var headingDiff = 0;
var velocityDiff = 0;
var dmgDiff = 0;
var sBoom = new Sound();
var sBump = new Sound();
var sCarStart = new Sound();
var sCrash = new Sound();
var sBGM = new Sound();
var cleaningUp = false;
var soundIsOn = true;
var instructionsViewed = false;
sBoom.attachSound("soundBoom");
sBump.attachSound("soundBump");
sCarStart.attachSound("soundCarStart");
sCrash.attachSound("soundCrash");
sBGM.attachSound("BGM");
exits[0] = new SpawnPoint(88, 87);
exits[1] = new SpawnPoint(700, 80);
exits[2] = new SpawnPoint(720, 414);
exits[3] = new SpawnPoint(67, 412);
spawnSequence[0] = 1;
spawnSequence[1] = 2;
spawnSequence[2] = 3;
spawnSequence[3] = 4;
spawnSequence[4] = 5;
i = 0;
while (i < spawnSequence.length) {
carsRemaining = carsRemaining + spawnSequence[i];
i++;
}
carsRemainingMax = carsRemaining;
i = 0;
while (i < arenaCarCapacity) {
arenaCarSlot[i] = 0;
i++;
}
sp[0] = new SpawnPoint(401, 195);
sp[1] = new SpawnPoint(240, 102);
sp[2] = new SpawnPoint(163, 168);
sp[3] = new SpawnPoint(118, 251);
sp[4] = new SpawnPoint(164, 327);
sp[5] = new SpawnPoint(261, 393);
sp[6] = new SpawnPoint(362, 439);
sp[7] = new SpawnPoint(494, 412);
sp[8] = new SpawnPoint(586, 378);
spCount = sp.length;
spIndex = 0;
while (spIndex < spCount) {
spHolder[spIndex] = sp[spIndex];
spIndex++;
}
pCar.sprite = carHolder.carA;
pCar.spray = sprays.pCarSpray;
j = Math.floor(Math.random() * spCount);
pCar.posX = spHolder[j].xPos;
pCar.posY = spHolder[j].yPos;
pCar.heading = 0;
sBGM.start(0, 9999);
this.onEnterFrame = function (Void) {
var _local2;
var _local1;
switch (gameState) {
case 0 :
break;
case 2 :
break;
case 4 :
break;
case 6 :
break;
case 8 :
if (instructionsViewed) {
instructions2.enabled = false;
instructions2._visible = false;
txtEnemiesFrozen._alpha = 0;
timeBonus = timeBonusMax;
enemiesLeft.text = carsRemaining;
gameState = 9;
} else if (Key.isDown(32)) {
instructions2.enabled = false;
instructions2._visible = false;
txtEnemiesFrozen._alpha = 0;
timeBonus = timeBonusMax;
enemiesLeft.text = carsRemaining;
gameState = 9;
}
break;
case 9 :
if (carsNotFrozen) {
if (timerFreezeCount >= timerFreezeCountInterval) {
txtEnemiesFrozen._alpha = 75;
timerFreezeCount = 0;
carsNotFrozen = false;
}
timerFreezeCount++;
} else {
if (timerFreezeDuration >= timerFreezeDurationInterval) {
txtEnemiesFrozen._alpha = 0;
timerFreezeDuration = 0;
carsNotFrozen = true;
}
timerFreezeDuration++;
}
if (spawnIndex < spawnSequence.length) {
if (carsAreSpawning) {
if (carCount < arenaCarCapacity) {
if (spawnTimeIndex >= spawnTimeInterval) {
if ((spawned < spawnSequence[spawnIndex]) && (carsNotFrozen)) {
spawnTimeIndex = 0;
k = carHolder.getNextHighestDepth();
j = Math.floor(Math.random() * carTypes);
sprays.pCarSpray.duplicateMovieClip("spray" + k, k);
switch (j) {
case 0 :
cars[carCount] = new CarA();
carHolder.va1.duplicateMovieClip("car" + k, k);
break;
case 1 :
cars[carCount] = new CarA();
carHolder.va2.duplicateMovieClip("car" + k, k);
break;
case 2 :
cars[carCount] = new CarA();
carHolder.va3.duplicateMovieClip("car" + k, k);
break;
case 3 :
cars[carCount] = new CarB();
carHolder.vb1.duplicateMovieClip("car" + k, k);
break;
case 4 :
cars[carCount] = new CarB();
carHolder.vb2.duplicateMovieClip("car" + k, k);
break;
case 5 :
cars[carCount] = new CarB();
carHolder.vb3.duplicateMovieClip("car" + k, k);
break;
case 6 :
cars[carCount] = new CarC();
carHolder.vc1.duplicateMovieClip("car" + k, k);
break;
case 7 :
cars[carCount] = new CarC();
carHolder.vc2.duplicateMovieClip("car" + k, k);
break;
case 8 :
cars[carCount] = new CarC();
carHolder.vc3.duplicateMovieClip("car" + k, k);
}
cars[carCount].sprite = carHolder["car" + k];
cars[carCount].spray = sprays["spray" + k];
j = Math.floor(Math.random() * exits.length);
cars[carCount].posX = exits[j].xPos;
cars[carCount].posY = exits[j].yPos;
cars[carCount].heading = getAngle(ellipseX, cars[carCount].posX, ellipseY, cars[carCount].posY);
cars[carCount].sprite._rotation = cars[carCount].heading * RAD2DEG;
cars[carCount].cState = 3;
cars[carCount].prey = Math.floor(Math.random() * carCount);
if (cars[carCount].prey == carCount) {
cars[carCount].prey++;
if (cars[carCount].prey >= carCount) {
cars[carCount].prey = 0;
}
}
carCount++;
if (soundIsOn) {
sCarStart.start();
}
spawned++;
if (spawned >= spawnSequence[spawnIndex]) {
spawned = 0;
carsAreSpawning = false;
spawnIndex++;
if (spawnIndex >= spawnSequence.length) {
timeIndex = intervalSpawnCar;
}
}
spawnTimeIndex = 0;
}
} else {
spawnTimeIndex++;
}
}
} else {
timeIndex++;
if (timeIndex >= intervalSpawnCar) {
timeIndex = 0;
spawnTimeIndex = spawnTimeInterval;
carsAreSpawning = true;
}
}
}
i = 0;
while (i < carCount) {
if (cars[i].isAlive) {
if (carsNotFrozen) {
if ((cars[i].speedMomentum < cars[i].speedMax) || (isNaN(cars[i].speedMomentum))) {
if ((cars[i].speedMax - cars[i].speedMomentum) < cars[i].acceleration) {
acceleration = cars[i].speedMax - cars[i].speedMomentum;
} else {
acceleration = cars[i].acceleration;
}
} else {
acceleration = 0;
}
cars[i].velocityX = cars[i].velocityX + (Math.cos(cars[i].heading) * acceleration);
cars[i].velocityY = cars[i].velocityY + (Math.sin(cars[i].heading) * acceleration);
}
} else {
cars[i].carExplodeCountdown--;
if (cars[i].carExplodeCountdown <= 0) {
deleteCar(i);
i--;
carsRemaining--;
enemiesLeft.text = carsRemaining;
if (carsRemaining <= 0) {
playerWin();
}
}
}
i++;
}
isPlayerCar = true;
if (pCar.velocityX > 0) {
pCar.velocityHeading = Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityX < 0) {
pCar.velocityHeading = Math.PI + Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityY > 0) {
pCar.velocityHeading = (Math.PI/2);
} else if (pCar.velocityY < 0) {
pCar.velocityHeading = 4.71238898038469;
} else {
pCar.velocityHeading = pCar.heading;
}
pCar.velocityTheta = pCar.velocityHeading - pCar.heading;
pCar.speedMomentum = Math.cos(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
pCar.velocityLateral = Math.sin(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
if (pCar.speedMomentum >= 0) {
if (pCar.velocityLateral <= 0) {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.frontSideX)) + (Math.cos(pCar.heading - PIHALF) * pCar.frontSideY)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.frontSideX)) + (Math.sin(pCar.heading - PIHALF) * pCar.frontSideY)) + pCar.velocityY;
collideCheckP(_local2, _local1);
} else {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.frontSideX3)) + (Math.cos(pCar.heading - PIHALF) * pCar.frontSideY3)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.frontSideX3)) + (Math.sin(pCar.heading - PIHALF) * pCar.frontSideY3)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
} else if (pCar.velocityLateral <= 0) {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.frontSideX2)) + (Math.cos(pCar.heading - PIHALF) * pCar.frontSideY2)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.frontSideX2)) + (Math.sin(pCar.heading - PIHALF) * pCar.frontSideY2)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
if (pCar.velocityX > 0) {
pCar.velocityHeading = Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityX < 0) {
pCar.velocityHeading = Math.PI + Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityY > 0) {
pCar.velocityHeading = (Math.PI/2);
} else if (pCar.velocityY < 0) {
pCar.velocityHeading = 4.71238898038469;
} else {
pCar.velocityHeading = pCar.heading;
}
pCar.velocityTheta = pCar.velocityHeading - pCar.heading;
pCar.speedMomentum = Math.cos(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
pCar.velocityLateral = Math.sin(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
if (pCar.speedMomentum >= 0) {
if (pCar.velocityLateral >= 0) {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.frontSideX)) + (Math.cos(pCar.heading + PIHALF) * pCar.frontSideY)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.frontSideX)) + (Math.sin(pCar.heading + PIHALF) * pCar.frontSideY)) + pCar.velocityY;
collideCheckP(_local2, _local1);
} else {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.frontSideX3)) + (Math.cos(pCar.heading + PIHALF) * pCar.frontSideY3)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.frontSideX3)) + (Math.sin(pCar.heading + PIHALF) * pCar.frontSideY3)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
} else if (pCar.velocityLateral >= 0) {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.frontSideX2)) + (Math.cos(pCar.heading + PIHALF) * pCar.frontSideY2)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.frontSideX2)) + (Math.sin(pCar.heading + PIHALF) * pCar.frontSideY2)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
if (pCar.velocityX > 0) {
pCar.velocityHeading = Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityX < 0) {
pCar.velocityHeading = Math.PI + Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityY > 0) {
pCar.velocityHeading = (Math.PI/2);
} else if (pCar.velocityY < 0) {
pCar.velocityHeading = 4.71238898038469;
} else {
pCar.velocityHeading = pCar.heading;
}
pCar.velocityTheta = pCar.velocityHeading - pCar.heading;
pCar.speedMomentum = Math.cos(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
pCar.velocityLateral = Math.sin(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
if (pCar.speedMomentum >= 0) {
_local2 = (pCar.posX + (Math.cos(pCar.heading) * pCar.frontX)) + pCar.velocityX;
_local1 = (pCar.posY + (Math.sin(pCar.heading) * pCar.frontX)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
if (pCar.velocityX > 0) {
pCar.velocityHeading = Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityX < 0) {
pCar.velocityHeading = Math.PI + Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityY > 0) {
pCar.velocityHeading = (Math.PI/2);
} else if (pCar.velocityY < 0) {
pCar.velocityHeading = 4.71238898038469;
} else {
pCar.velocityHeading = pCar.heading;
}
pCar.velocityTheta = pCar.velocityHeading - pCar.heading;
pCar.speedMomentum = Math.cos(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
pCar.velocityLateral = Math.sin(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
if (pCar.speedMomentum <= 0) {
if (pCar.velocityLateral <= 0) {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.backSideX)) + (Math.cos(pCar.heading - PIHALF) * pCar.backSideY)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.backSideX)) + (Math.sin(pCar.heading - PIHALF) * pCar.backSideY)) + pCar.velocityY;
collideCheckP(_local2, _local1);
} else {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.backSideX3)) + (Math.cos(pCar.heading - PIHALF) * pCar.backSideY3)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.backSideX3)) + (Math.sin(pCar.heading - PIHALF) * pCar.backSideY3)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
} else if (pCar.velocityLateral <= 0) {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.backSideX2)) + (Math.cos(pCar.heading - PIHALF) * pCar.backSideY2)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.backSideX2)) + (Math.sin(pCar.heading - PIHALF) * pCar.backSideY2)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
if (pCar.velocityX > 0) {
pCar.velocityHeading = Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityX < 0) {
pCar.velocityHeading = Math.PI + Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityY > 0) {
pCar.velocityHeading = (Math.PI/2);
} else if (pCar.velocityY < 0) {
pCar.velocityHeading = 4.71238898038469;
} else {
pCar.velocityHeading = pCar.heading;
}
pCar.velocityTheta = pCar.velocityHeading - pCar.heading;
pCar.speedMomentum = Math.cos(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
pCar.velocityLateral = Math.sin(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
if (pCar.speedMomentum <= 0) {
if (pCar.velocityLateral >= 0) {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.backSideX)) + (Math.cos(pCar.heading + PIHALF) * pCar.backSideY)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.backSideX)) + (Math.sin(pCar.heading + PIHALF) * pCar.backSideY)) + pCar.velocityY;
collideCheckP(_local2, _local1);
} else {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.backSideX3)) + (Math.cos(pCar.heading + PIHALF) * pCar.backSideY3)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.backSideX3)) + (Math.sin(pCar.heading + PIHALF) * pCar.backSideY3)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
} else if (pCar.velocityLateral >= 0) {
_local2 = ((pCar.posX + (Math.cos(pCar.heading) * pCar.backSideX2)) + (Math.cos(pCar.heading + PIHALF) * pCar.backSideY2)) + pCar.velocityX;
_local1 = ((pCar.posY + (Math.sin(pCar.heading) * pCar.backSideX2)) + (Math.sin(pCar.heading + PIHALF) * pCar.backSideY2)) + pCar.velocityY;
collideCheckP(_local2, _local1);
}
pCar.posX = pCar.posX + pCar.velocityX;
pCar.posY = pCar.posY + pCar.velocityY;
isPlayerCar = false;
i = 0;
while (i < carCount) {
impactPoint = 0;
if (cars[i].velocityX > 0) {
cars[i].velocityHeading = Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityX < 0) {
cars[i].velocityHeading = Math.PI + Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityY > 0) {
cars[i].velocityHeading = (Math.PI/2);
} else if (cars[i].velocityY < 0) {
cars[i].velocityHeading = 4.71238898038469;
} else {
cars[i].velocityHeading = cars[i].heading;
}
cars[i].velocityTheta = cars[i].velocityHeading - cars[i].heading;
cars[i].speedMomentum = Math.cos(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
cars[i].velocityLateral = Math.sin(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
if (cars[i].speedMomentum >= 0) {
if (cars[i].velocityTheta <= 0) {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontSideX)) + (Math.cos(cars[i].heading - PIHALF) * cars[i].frontSideY)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontSideX)) + (Math.sin(cars[i].heading - PIHALF) * cars[i].frontSideY)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
} else {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontSideX3)) + (Math.cos(cars[i].heading - PIHALF) * cars[i].frontSideY3)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontSideX3)) + (Math.sin(cars[i].heading - PIHALF) * cars[i].frontSideY3)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
} else if (cars[i].velocityTheta <= 0) {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontSideX2)) + (Math.cos(cars[i].heading - PIHALF) * cars[i].frontSideY2)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontSideX2)) + (Math.sin(cars[i].heading - PIHALF) * cars[i].frontSideY2)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
impactPoint = 1;
if (cars[i].velocityX > 0) {
cars[i].velocityHeading = Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityX < 0) {
cars[i].velocityHeading = Math.PI + Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityY > 0) {
cars[i].velocityHeading = (Math.PI/2);
} else if (cars[i].velocityY < 0) {
cars[i].velocityHeading = 4.71238898038469;
} else {
cars[i].velocityHeading = cars[i].heading;
}
cars[i].velocityTheta = cars[i].velocityHeading - cars[i].heading;
cars[i].speedMomentum = Math.cos(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
cars[i].velocityLateral = Math.sin(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
if (cars[i].speedMomentum >= 0) {
if (cars[i].velocityTheta >= 0) {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontSideX)) + (Math.cos(cars[i].heading + PIHALF) * cars[i].frontSideY)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontSideX)) + (Math.sin(cars[i].heading + PIHALF) * cars[i].frontSideY)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
} else {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontSideX3)) + (Math.cos(cars[i].heading + PIHALF) * cars[i].frontSideY3)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontSideX3)) + (Math.sin(cars[i].heading + PIHALF) * cars[i].frontSideY3)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
} else if (cars[i].velocityTheta >= 0) {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontSideX2)) + (Math.cos(cars[i].heading + PIHALF) * cars[i].frontSideY2)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontSideX2)) + (Math.sin(cars[i].heading + PIHALF) * cars[i].frontSideY2)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
impactPoint = 2;
if (cars[i].velocityX > 0) {
cars[i].velocityHeading = Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityX < 0) {
cars[i].velocityHeading = Math.PI + Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityY > 0) {
cars[i].velocityHeading = (Math.PI/2);
} else if (cars[i].velocityY < 0) {
cars[i].velocityHeading = 4.71238898038469;
} else {
cars[i].velocityHeading = cars[i].heading;
}
cars[i].velocityTheta = cars[i].velocityHeading - cars[i].heading;
cars[i].speedMomentum = Math.cos(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
cars[i].velocityLateral = Math.sin(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
if (cars[i].speedMomentum >= 0) {
_local2 = (cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontX)) + cars[i].velocityX;
_local1 = (cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontX)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
impactPoint = 3;
if (cars[i].velocityX > 0) {
cars[i].velocityHeading = Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityX < 0) {
cars[i].velocityHeading = Math.PI + Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityY > 0) {
cars[i].velocityHeading = (Math.PI/2);
} else if (cars[i].velocityY < 0) {
cars[i].velocityHeading = 4.71238898038469;
} else {
cars[i].velocityHeading = 0;
}
cars[i].velocityTheta = cars[i].velocityHeading - cars[i].heading;
cars[i].speedMomentum = Math.cos(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
cars[i].velocityLateral = Math.sin(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
if (cars[i].speedMomentum <= 0) {
if (cars[i].velocityTheta <= 0) {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].backSideX)) + (Math.cos(cars[i].heading - PIHALF) * cars[i].backSideY)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].backSideX)) + (Math.sin(cars[i].heading - PIHALF) * cars[i].backSideY)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
} else {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].backSideX3)) + (Math.cos(cars[i].heading - PIHALF) * cars[i].backSideY3)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].backSideX3)) + (Math.sin(cars[i].heading - PIHALF) * cars[i].backSideY3)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
} else if (cars[i].velocityTheta <= 0) {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].backSideX2)) + (Math.cos(cars[i].heading - PIHALF) * cars[i].backSideY2)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].backSideX2)) + (Math.sin(cars[i].heading - PIHALF) * cars[i].backSideY2)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
impactPoint = 4;
if (cars[i].velocityX > 0) {
cars[i].velocityHeading = Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityX < 0) {
cars[i].velocityHeading = Math.PI + Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityY > 0) {
cars[i].velocityHeading = (Math.PI/2);
} else if (cars[i].velocityY < 0) {
cars[i].velocityHeading = 4.71238898038469;
} else {
cars[i].velocityHeading = cars[i].heading;
}
cars[i].velocityTheta = cars[i].velocityHeading - cars[i].heading;
cars[i].speedMomentum = Math.cos(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
cars[i].velocityLateral = Math.sin(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
if (cars[i].speedMomentum <= 0) {
if (cars[i].velocityTheta >= 0) {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].backSideX)) + (Math.cos(cars[i].heading + PIHALF) * cars[i].backSideY)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].backSideX)) + (Math.sin(cars[i].heading + PIHALF) * cars[i].backSideY)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
} else {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].backSideX3)) + (Math.cos(cars[i].heading + PIHALF) * cars[i].backSideY3)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].backSideX3)) + (Math.sin(cars[i].heading + PIHALF) * cars[i].backSideY3)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
} else if (cars[i].velocityTheta >= 0) {
_local2 = ((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].backSideX2)) + (Math.cos(cars[i].heading + PIHALF) * cars[i].backSideY2)) + cars[i].velocityX;
_local1 = ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].backSideX2)) + (Math.sin(cars[i].heading + PIHALF) * cars[i].backSideY2)) + cars[i].velocityY;
if (carHolder.hitTest(_local2, _local1, true)) {
collideCheckAI(i, _local2, _local1);
}
}
if (cars[i].isAlive && (carsNotFrozen)) {
if (Math.random() < 0.05) {
cars[i].changeCState();
}
if (Math.random() < 0.1) {
cars[i].heading = cars[i].heading + (((Math.random() * cars[i].turnMax) * 2) - cars[i].turnMax);
}
switch (cars[i].cState) {
case 0 :
cars[i].chase(pCar.posX, pCar.posY);
break;
case 1 :
if (cars[cars[i].prey].isAlive) {
cars[i].chase(cars[cars[i].prey].posX, cars[cars[i].prey].posY);
}
break;
case 2 :
if (ellipse1.hitTest((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].lookAheadX)) + cars[i].velocityX, (cars[i].posY + (Math.sin(cars[i].heading) * cars[i].lookAheadX)) + cars[i].velocityY, true) == false) {
cars[i].chase(ellipseX, ellipseY);
}
break;
case 3 :
if (floor2.hitTest(cars[i].posX, cars[i].posY, true) == false) {
cars[i].chase(ellipseX, ellipseY);
}
break;
case 4 :
}
}
if (ellipse1.hitTest(((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontSideX)) + (Math.cos(cars[i].heading - PIHALF) * cars[i].frontSideY)) + cars[i].velocityX, ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontSideX)) + (Math.sin(cars[i].heading - PIHALF) * cars[i].frontSideY)) + cars[i].velocityY, true) == false) {
cars[i].velocityX = (-cars[i].velocityX) * wallDamp;
cars[i].velocityY = (-cars[i].velocityY) * wallDamp;
cars[i].turnDirection = 2;
cars[i].turn2();
centerHome(cars[i]);
} else if (ellipse1.hitTest(((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].frontSideX)) + (Math.cos(cars[i].heading + PIHALF) * cars[i].frontSideY)) + cars[i].velocityX, ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].frontSideX)) + (Math.sin(cars[i].heading + PIHALF) * cars[i].frontSideY)) + cars[i].velocityY, true) == false) {
cars[i].velocityX = (-cars[i].velocityX) * wallDamp;
cars[i].velocityY = (-cars[i].velocityY) * wallDamp;
cars[i].turnDirection = 1;
cars[i].turn2();
centerHome(cars[i]);
}
if (ellipse1.hitTest(((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].backSideX)) + (Math.cos(cars[i].heading - PIHALF) * cars[i].backSideY)) + cars[i].velocityX, ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].backSideX)) + (Math.sin(cars[i].heading - PIHALF) * cars[i].backSideY)) + cars[i].velocityY, true) == false) {
cars[i].velocityX = (-cars[i].velocityX) * wallDamp;
cars[i].velocityY = (-cars[i].velocityY) * wallDamp;
centerHome(cars[i]);
} else if (ellipse1.hitTest(((cars[i].posX + (Math.cos(cars[i].heading) * cars[i].backSideX)) + (Math.cos(cars[i].heading + PIHALF) * cars[i].backSideY)) + cars[i].velocityX, ((cars[i].posY + (Math.sin(cars[i].heading) * cars[i].backSideX)) + (Math.sin(cars[i].heading + PIHALF) * cars[i].backSideY)) + cars[i].velocityY, true) == false) {
cars[i].velocityX = (-cars[i].velocityX) * wallDamp;
cars[i].velocityY = (-cars[i].velocityY) * wallDamp;
centerHome(cars[i]);
}
if (cars[i].velocityX > 0) {
cars[i].velocityHeading = Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityX < 0) {
cars[i].velocityHeading = Math.PI + Math.atan(cars[i].velocityY / cars[i].velocityX);
} else if (cars[i].velocityY > 0) {
cars[i].velocityHeading = (Math.PI/2);
} else if (cars[i].velocityY < 0) {
cars[i].velocityHeading = 4.71238898038469;
} else {
cars[i].velocityHeading = cars[i].heading;
}
cars[i].velocityTheta = cars[i].velocityHeading - cars[i].heading;
cars[i].speedMomentum = Math.cos(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
cars[i].velocityLateral = Math.sin(cars[i].velocityTheta) * Math.sqrt((cars[i].velocityX * cars[i].velocityX) + (cars[i].velocityY * cars[i].velocityY));
if ((cars[i].speedMomentum > 3) && (cars[i].isAlive)) {
cars[i].spray._visible = true;
} else {
cars[i].spray._visible = false;
}
i++;
}
i = 0;
while (i < carCount) {
if (cars[i].speedMomentum < 0) {
if (cars[i].speedMomentum < (-cars[i].frictionRolling)) {
cars[i].velocityX = cars[i].velocityX + (Math.cos(cars[i].heading) * cars[i].frictionRolling);
cars[i].velocityY = cars[i].velocityY + (Math.sin(cars[i].heading) * cars[i].frictionRolling);
} else {
cars[i].velocityX = cars[i].velocityX - (Math.cos(cars[i].heading) * cars[i].speedMomentum);
cars[i].velocityY = cars[i].velocityY - (Math.sin(cars[i].heading) * cars[i].speedMomentum);
}
} else if (cars[i].speedMomentum > 0) {
if (cars[i].speedMomentum > cars[i].frictionRolling) {
cars[i].velocityX = cars[i].velocityX - (Math.cos(cars[i].heading) * cars[i].frictionRolling);
cars[i].velocityY = cars[i].velocityY - (Math.sin(cars[i].heading) * cars[i].frictionRolling);
} else {
cars[i].velocityX = cars[i].velocityX - (Math.cos(cars[i].heading) * cars[i].speedMomentum);
cars[i].velocityY = cars[i].velocityY - (Math.sin(cars[i].heading) * cars[i].speedMomentum);
}
}
if (cars[i].velocityLateral < 0) {
if (Math.abs(cars[i].velocityLateral) < cars[i].tireGrip) {
cars[i].velocityX = cars[i].velocityX + (Math.cos(cars[i].heading + PIHALF) * Math.abs(cars[i].velocityLateral));
cars[i].velocityY = cars[i].velocityY + (Math.sin(cars[i].heading + PIHALF) * Math.abs(cars[i].velocityLateral));
} else {
cars[i].velocityX = cars[i].velocityX + (Math.cos(cars[i].heading + PIHALF) * cars[i].tireGrip);
cars[i].velocityY = cars[i].velocityY + (Math.sin(cars[i].heading + PIHALF) * cars[i].tireGrip);
}
} else if (cars[i].velocityLateral > 0) {
if (Math.abs(cars[i].velocityLateral) < cars[i].tireGrip) {
cars[i].velocityX = cars[i].velocityX + (Math.cos(cars[i].heading - PIHALF) * Math.abs(cars[i].velocityLateral));
cars[i].velocityY = cars[i].velocityY + (Math.sin(cars[i].heading - PIHALF) * Math.abs(cars[i].velocityLateral));
} else {
cars[i].velocityX = cars[i].velocityX + (Math.cos(cars[i].heading - PIHALF) * cars[i].tireGrip);
cars[i].velocityY = cars[i].velocityY + (Math.sin(cars[i].heading - PIHALF) * cars[i].tireGrip);
}
}
i++;
}
i = 0;
while (i < carCount) {
cars[i].posX = cars[i].posX + cars[i].velocityX;
cars[i].posY = cars[i].posY + cars[i].velocityY;
i++;
}
if ((!ellipse1.hitTest(((pCar.posX + (Math.cos(pCar.heading) * pCar.frontSideX)) + (Math.cos(pCar.heading - PIHALF) * pCar.frontSideY)) + pCar.velocityX, ((pCar.posY + (Math.sin(pCar.heading) * pCar.frontSideX)) + (Math.sin(pCar.heading - PIHALF) * pCar.frontSideY)) + pCar.velocityY, true)) || (!ellipse1.hitTest(((pCar.posX + (Math.cos(pCar.heading) * pCar.frontSideX)) + (Math.cos(pCar.heading + PIHALF) * pCar.frontSideY)) + pCar.velocityX, ((pCar.posY + (Math.sin(pCar.heading) * pCar.frontSideX)) + (Math.sin(pCar.heading + PIHALF) * pCar.frontSideY)) + pCar.velocityY, true))) {
pCar.velocityX = (-pCar.velocityX) * wallDamp;
pCar.velocityY = (-pCar.velocityY) * wallDamp;
centerHome(pCar);
} else if ((!ellipse1.hitTest(((pCar.posX + (Math.cos(pCar.heading) * pCar.backSideX)) + (Math.cos(pCar.heading - PIHALF) * pCar.backSideY)) + pCar.velocityX, ((pCar.posY + (Math.sin(pCar.heading) * pCar.backSideX)) + (Math.sin(pCar.heading - PIHALF) * pCar.backSideY)) + pCar.velocityY, true)) || (!ellipse1.hitTest(((pCar.posX + (Math.cos(pCar.heading) * pCar.backSideX)) + (Math.cos(pCar.heading + PIHALF) * pCar.backSideY)) + pCar.velocityX, ((pCar.posY + (Math.sin(pCar.heading) * pCar.backSideX)) + (Math.sin(pCar.heading + PIHALF) * pCar.backSideY)) + pCar.velocityY, true))) {
pCar.velocityX = (-pCar.velocityX) * wallDamp;
pCar.velocityY = (-pCar.velocityY) * wallDamp;
centerHome(pCar);
}
if (playerIsAlive) {
if (Key.isDown(38)) {
if ((pCar.speedMomentum < pCar.speedMax) || (isNaN(pCar.speedMomentum))) {
if ((pCar.speedMax - pCar.speedMomentum) < pCar.acceleration) {
acceleration = pCar.speedMax - pCar.speedMomentum;
} else {
acceleration = pCar.acceleration;
}
} else {
acceleration = 0;
}
pCar.velocityX = pCar.velocityX + (Math.cos(pCar.heading) * acceleration);
pCar.velocityY = pCar.velocityY + (Math.sin(pCar.heading) * acceleration);
} else if (Key.isDown(40)) {
acceleration = -pCar.acceleration;
if ((pCar.speedMomentum > pCar.speedMaxReverse) || (isNaN(pCar.speedMomentum))) {
if ((pCar.speedMax - pCar.speedMomentum) < pCar.acceleration) {
acceleration = -(pCar.speedMax - pCar.speedMomentum);
} else {
acceleration = -pCar.acceleration;
}
} else {
acceleration = 0;
}
pCar.velocityX = pCar.velocityX + (Math.cos(pCar.heading) * acceleration);
pCar.velocityY = pCar.velocityY + (Math.sin(pCar.heading) * acceleration);
} else {
acceleration = 0;
}
if (Key.isDown(37)) {
pCar.heading = pCar.heading - pCar.turnMax;
if (pCar.heading < 0) {
pCar.heading = pCar.heading + PI2;
}
} else if (Key.isDown(39)) {
pCar.heading = pCar.heading + pCar.turnMax;
if (pCar.heading > PI2) {
pCar.heading = pCar.heading % PI2;
}
}
} else {
endTimer++;
if (endTimer >= endTimeOut) {
announceLose.gotoAndStop("silent");
playerIsAlive = true;
endTimer = 0;
splash.gotoAndStop("frmLose");
gameState = 12;
}
}
if (pCar.velocityX > 0) {
pCar.velocityHeading = Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityX < 0) {
pCar.velocityHeading = Math.PI + Math.atan(pCar.velocityY / pCar.velocityX);
} else if (pCar.velocityY > 0) {
pCar.velocityHeading = (Math.PI/2);
} else if (pCar.velocityY < 0) {
pCar.velocityHeading = 4.71238898038469;
} else {
pCar.velocityHeading = pCar.heading;
}
pCar.velocityTheta = pCar.velocityHeading - pCar.heading;
pCar.speedMomentum = Math.cos(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
pCar.velocityLateral = Math.sin(pCar.velocityTheta) * Math.sqrt((pCar.velocityX * pCar.velocityX) + (pCar.velocityY * pCar.velocityY));
if ((pCar.speedMomentum > 4) && (playerIsAlive)) {
pCar.spray._visible = true;
} else {
pCar.spray._visible = false;
}
if (pCar.speedMomentum < 0) {
if (pCar.speedMomentum < (-pCar.frictionRolling)) {
pCar.velocityX = pCar.velocityX + (Math.cos(pCar.heading) * pCar.frictionRolling);
pCar.velocityY = pCar.velocityY + (Math.sin(pCar.heading) * pCar.frictionRolling);
} else {
pCar.velocityX = pCar.velocityX - (Math.cos(pCar.heading) * pCar.speedMomentum);
pCar.velocityY = pCar.velocityY - (Math.sin(pCar.heading) * pCar.speedMomentum);
}
} else if (pCar.speedMomentum > 0) {
if (pCar.speedMomentum > pCar.frictionRolling) {
pCar.velocityX = pCar.velocityX - (Math.cos(pCar.heading) * pCar.frictionRolling);
pCar.velocityY = pCar.velocityY - (Math.sin(pCar.heading) * pCar.frictionRolling);
} else {
pCar.velocityX = pCar.velocityX - (Math.cos(pCar.heading) * pCar.speedMomentum);
pCar.velocityY = pCar.velocityY - (Math.sin(pCar.heading) * pCar.speedMomentum);
}
}
if (pCar.velocityLateral < 0) {
if (Math.abs(pCar.velocityLateral) < pCar.tireGrip) {
pCar.velocityX = pCar.velocityX + (Math.cos(pCar.heading + PIHALF) * Math.abs(pCar.velocityLateral));
pCar.velocityY = pCar.velocityY + (Math.sin(pCar.heading + PIHALF) * Math.abs(pCar.velocityLateral));
} else {
pCar.velocityX = pCar.velocityX + (Math.cos(pCar.heading + PIHALF) * pCar.tireGrip);
pCar.velocityY = pCar.velocityY + (Math.sin(pCar.heading + PIHALF) * pCar.tireGrip);
}
} else if (pCar.velocityLateral > 0) {
if (Math.abs(pCar.velocityLateral) < pCar.tireGrip) {
pCar.velocityX = pCar.velocityX + (Math.cos(pCar.heading - PIHALF) * Math.abs(pCar.velocityLateral));
pCar.velocityY = pCar.velocityY + (Math.sin(pCar.heading - PIHALF) * Math.abs(pCar.velocityLateral));
} else {
pCar.velocityX = pCar.velocityX + (Math.cos(pCar.heading - PIHALF) * pCar.tireGrip);
pCar.velocityY = pCar.velocityY + (Math.sin(pCar.heading - PIHALF) * pCar.tireGrip);
}
}
if (playerWon) {
endTimer++;
if (endTimer >= endTimeOut) {
announceWin.gotoAndStop("silent");
endTimer = 0;
playerWon = false;
splash.gotoAndStop("frmWin");
gameState = 10;
}
} else if (timeBonus > 0) {
timeBonus--;
}
drawVehicles();
timeElapsed.text = Math.floor(timeBonus / 24);
if (carsAreSpawning) {
waveCountDown.text = 0;
} else {
waveCountDown.text = Math.floor((intervalSpawnCar - timeIndex) / 24);
}
break;
case 10 :
gameState = 11;
break;
case 11 :
break;
case 12 :
gameState = 13;
break;
case 13 :
}
};
stop();
Symbol 720 MovieClip Frame 3
_root.current_level = 1;
Symbol 720 MovieClip Frame 11
_root.current_level = 2;
Symbol 720 MovieClip Frame 18
_root.current_level = 3;
Symbol 720 MovieClip Frame 26
_root.current_level = 4;