Frame 1
function open_ax_url() {
getURL ("http://www.axifer.com/?billiards", "_blank");
}
advert_url = "http://axifer.com/billiards_advert.php";
context_menu = new ContextMenu();
context_menu.customItems.push(new ContextMenuItem("Developed by AXIFER", open_ax_url));
context_menu.hideBuiltInItems();
_root.menu = context_menu;
ADVERT_HTML = "loading";
this.onEnterFrame = function () {
var _local4 = this.getBytesLoaded();
var _local3 = this.getBytesTotal();
if (_local3 < 100) {
var _local2 = 1;
} else {
var _local2 = Math.floor((_local4 / (_local3 / 38)) + 0.0001) + 1;
if (_local4 >= _local3) {
this.onEnterFrame = function () {
};
play();
}
}
if (_local2 < 1) {
var _local2 = 1;
} else if (_local2 > 38) {
var _local2 = 38;
}
progress_bar.gotoAndStop(_local2);
};
stop();
Frame 2
function turnSounds(p) {
if (p) {
useSOUNDS = 1;
} else {
useSOUNDS = 0;
}
}
function turnMus(p) {
if (p) {
sound_Mus.setVolume(100);
} else {
sound_Mus.setVolume(0);
}
}
function run_game(gametype, playerstype) {
PLAY_GAME = gametype;
PLAYERS_TYPE = playerstype;
if (PLAY_GAME == "8ball") {
game_name = "8-Ball";
} else if (PLAY_GAME == "straight") {
game_name = "Straight Pool";
}
gotoAndStop ("game");
}
useSOUNDS = 1;
sound_Mus = new Sound("mus");
Frame 3
if (ADVERT_HTML == "loading") {
var obj_xml = new XML();
obj_xml.ignoreWhite = true;
obj_xml.load(_root.advert_url);
obj_xml.onLoad = function (resload) {
if ((!resload) || (obj_xml == "")) {
ADVERT_HTML = "";
adverts.gotoAndStop(2);
} else {
ADVERT_HTML = ("<FONT COLOR=\"#FAE776\" FACE=\"Arial\" SIZE=\"13\">" + obj_xml) + "</FONT>";
adverts.tx.html = true;
adverts.tx.htmlText = ADVERT_HTML;
}
};
}
b1.onRelease = function () {
run_game("8ball", "2");
};
b2.onRelease = function () {
run_game("8ball", "R");
};
b3.onRelease = function () {
run_game("straight", "1");
};
b4.onRelease = function () {
run_game("straight", "2");
};
b5.onRelease = function () {
run_game("straight", "R");
};
stop();
Frame 4
stop();
Symbol 10 MovieClip Frame 2
stop();
Symbol 15 MovieClip Frame 2
stop();
Symbol 19 MovieClip Frame 2
stop();
Symbol 23 MovieClip Frame 2
stop();
Symbol 27 MovieClip Frame 2
stop();
Symbol 31 MovieClip Frame 2
stop();
Symbol 35 MovieClip Frame 2
stop();
Symbol 40 MovieClip Frame 2
stop();
Symbol 46 MovieClip Frame 2
stop();
Symbol 52 MovieClip Frame 2
stop();
Symbol 58 MovieClip Frame 2
stop();
Symbol 64 MovieClip Frame 2
stop();
Symbol 70 MovieClip Frame 2
stop();
Symbol 76 MovieClip Frame 2
stop();
Symbol 82 MovieClip Frame 2
stop();
Symbol 87 MovieClip Frame 2
stop();
Symbol 87 MovieClip Frame 23
if (_parent._parent.kick()) {
gotoAndPlay ("kick");
}
Symbol 87 MovieClip Frame 24
stop();
Symbol 87 MovieClip Frame 31
_root.main.curr_cue.removeMovieClip();
stop();
Symbol 89 MovieClip [cue_R] Frame 1
function kick() {
_parent.sound_keykick(1, RES_STEP);
_parent.b1.dirc = RES_DIRC;
_parent.b1.mystep = RES_STEP;
_parent.set_game_status("run");
return(1);
}
if (_root.PLAY_GAME == "8ball") {
if (_parent.total2 >= 7) {
TARGET_BALLS = new Array();
TARGET_BALLS.push(9);
} else if (_parent.SelfBall_1 == "strip") {
TARGET_BALLS = new Array(10, 11, 12, 13, 14, 15, 16);
} else if (_parent.SelfBall_1 == "solid") {
TARGET_BALLS = new Array(2, 3, 4, 5, 6, 7, 8);
} else {
TARGET_BALLS = new Array(2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16);
}
} else if (_root.PLAY_GAME == "straight") {
TARGET_BALLS = new Array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
}
RES_DIRC = 0;
RES_STEP = 1;
arrPocketPoss = new Array();
offs = 10;
p = 1;
while (p <= 6) {
switch (p) {
case 1 :
sx = _parent.topleft_poket[0] + offs;
sy = _parent.topleft_poket[1] + offs;
break;
case 2 :
sx = _parent.topcenter_poket[0];
sy = _parent.topcenter_poket[1] + offs;
break;
case 3 :
sx = _parent.topright_poket[0] - offs;
sy = _parent.topright_poket[1] + offs;
break;
case 4 :
sx = _parent.bottright_poket[0] - offs;
sy = _parent.bottright_poket[1] - offs;
break;
case 5 :
sx = _parent.bottcenter_poket[0];
sy = _parent.bottcenter_poket[1] - offs;
break;
case 6 :
sx = _parent.bottleft_poket[0] + offs;
sy = _parent.bottleft_poket[1] - offs;
break;
default :
s = "";
}
arrPocketPoss[p] = new Array(sx, sy);
p++;
}
shooted = 0;
allShoots = new Array();
num_balls = TARGET_BALLS.length;
i = 0;
while (i < num_balls) {
objTarget = eval ("_parent.b" + TARGET_BALLS[i]);
if (objTarget.ex) {
zpk = 6;
p = 1;
while (p <= zpk) {
pocketPos = arrPocketPoss[p];
dist_cue_target = _parent.mathem_distance(_parent.b1._x, _parent.b1._y, objTarget._x, objTarget._y);
dist_cue_pocket = _parent.mathem_distance(_parent.b1._x, _parent.b1._y, objTarget._x, objTarget._y);
ang_cue_target = _parent.mathem_angle(_parent.b1._x, _parent.b1._y, objTarget._x, objTarget._y);
ang_target_pocket = _parent.mathem_angle(objTarget._x, objTarget._y, pocketPos[0], pocketPos[1]);
mg = _parent.normalize(ang_target_pocket - ang_cue_target);
if (Math.abs(mg) < 70) {
bcGlobal = Math.sin(_parent.mpi * mg) * _parent.ball_diam;
bcGlobal2 = bcGlobal * bcGlobal;
ac1 = Math.sqrt(_parent.ball_2diam - bcGlobal2);
ac2 = dist_cue_target - Math.abs(ac1);
s_ang = Math.atan(bcGlobal / ac2) / (Math.PI/180);
s_dirc = ang_cue_target - s_ang;
shootData = new Array();
shootData.dirc = s_dirc;
shootData.obs = 0;
shootData.mystep = 16 + random(10);
c = 2;
while (c <= 16) {
if ((c != TARGET_BALLS[i]) && (eval ("_parent.b" + c).ex)) {
e_dist = _parent.mathem_distance(_parent.b1._x, _parent.b1._y, eval ("_parent.b" + c)._x, eval ("_parent.b" + c)._y);
e_ang = _parent.mathem_angle(_parent.b1._x, _parent.b1._y, eval ("_parent.b" + c)._x, eval ("_parent.b" + c)._y);
se_ang = Math.abs(_parent.normalize(ang_cue_target - e_ang));
if (se_ang < 90) {
se_bc = Math.abs(Math.sin(_parent.mpi * se_ang) * e_dist);
if (se_bc <= _parent.ball_diam) {
shootData.obs = 1;
break;
}
}
}
c++;
}
if (!shootData.obs) {
c = 2;
while (c <= 16) {
if ((c != TARGET_BALLS[i]) && (eval ("_parent.b" + c).ex)) {
e_dist = _parent.mathem_distance(objTarget._x, objTarget._y, eval ("_parent.b" + c)._x, eval ("_parent.b" + c)._y);
e_ang = _parent.mathem_angle(objTarget._x, objTarget._y, eval ("_parent.b" + c)._x, eval ("_parent.b" + c)._y);
se_ang = _parent.normalize(ang_target_pocket - e_ang);
if (Math.abs(se_ang) < 90) {
se_bc = Math.abs(Math.sin(_parent.mpi * se_ang) * e_dist);
if (se_bc <= _parent.ball_diam) {
shootData.obs = 1;
break;
}
}
}
c++;
}
}
if (!shootData.obs) {
RES_DIRC = shootData.dirc;
RES_STEP = shootData.mystep;
shooted = 1;
num_balls = 0;
zpk = 0;
break;
}
allShoots.push(shootData);
}
p++;
}
}
i++;
}
if (!shooted) {
num_Shoots = allShoots.length;
numr = random(num_Shoots + 1);
if (numr > num_Shoots) {
numr = num_Shoots;
}
psh = allShoots[numr];
if ((psh.dirc == "") || (psh.dirc == undefined)) {
psh = new Array();
psh.dirc = random(360) - 180;
psh.mystep = 5 + random(20);
}
RES_DIRC = psh.dirc;
RES_STEP = psh.mystep;
}
cue._rotation = RES_DIRC;
cue.ins.gotoAndPlay("run");
Symbol 90 MovieClip [cue_2] Frame 1
pos = 1;
mdown = 0;
this.onEnterFrame = function () {
if (pos && (_parent.table.hitTest(_root._xmouse, _root._ymouse))) {
cue._rotation = _parent.mathem_angle(0, 0, this._xmouse, this._ymouse);
}
};
this.onMouseDown = function () {
if (pos && (_parent.table.hitTest(_root._xmouse, _root._ymouse))) {
mdown = 1;
cue.ins.play();
}
};
this.onMouseUp = function () {
if (pos && (mdown)) {
pos = 0;
var _local2 = cue.ins._currentframe * 1;
_parent.sound_keykick(1, _local2);
_parent.b1.dirc = _parent.mathem_angle(_parent.b1._x, _parent.b1._y, _parent._xmouse, _parent._ymouse);
_parent.b1.mystep = _local2;
_parent.set_game_status("run");
cue.ins.gotoAndPlay("kick");
}
};
Symbol 92 MovieClip Frame 1
stop();
Symbol 92 MovieClip Frame 23
stop();
Symbol 92 MovieClip Frame 30
_root.main.curr_cue.removeMovieClip();
stop();
Symbol 94 MovieClip [cue_1] Frame 1
pos = 1;
mdown = 0;
this.onEnterFrame = function () {
if (pos && (_parent.table.hitTest(_root._xmouse, _root._ymouse))) {
cue._rotation = _parent.mathem_angle(0, 0, this._xmouse, this._ymouse);
}
};
this.onMouseDown = function () {
if (pos && (_parent.table.hitTest(_root._xmouse, _root._ymouse))) {
mdown = 1;
cue.ins.play();
}
};
this.onMouseUp = function () {
if (pos && (mdown)) {
pos = 0;
var _local2 = cue.ins._currentframe * 1;
_parent.sound_keykick(1, _local2);
_parent.b1.dirc = _parent.mathem_angle(_parent.b1._x, _parent.b1._y, _parent._xmouse, _parent._ymouse);
_parent.b1.mystep = _local2;
_parent.set_game_status("run");
cue.ins.gotoAndPlay("kick");
}
};
Symbol 95 MovieClip [game_straight] Frame 1
function start_game(gameType) {
tellTarget (_parent) {
total1 = 0;
total2 = 0;
SelfBall_1 = "";
current_game_type = gameType;
set_balls();
set_game_status("player1");
};
}
function inshot() {
tellTarget (_parent) {
ex_shots++;
var _local4 = "player" + current_player;
var _local5 = 1;
var _local7 = 0;
var _local3 = 0;
var _local6 = 0;
if (shotRes_pkBalls[1]) {
_local7 = 1;
}
var _local2 = 2;
while (_local2 <= 16) {
if (shotRes_pkBalls[_local2]) {
_local3++;
}
_local2++;
}
if (_local7) {
_local5 = 0;
_local6 = 1;
} else if (_local3 <= 0) {
_local5 = 0;
}
if (!_local5) {
if (current_game_type == "1") {
_local4 = "player1";
} else if (current_game_type == "2") {
if (current_player == "1") {
_local4 = "player2";
} else {
_local4 = "player1";
}
} else if (current_game_type == "R") {
if (current_player == "1") {
_local4 = "playerR";
} else {
_local4 = "player1";
}
}
}
if (_local6) {
_local3 = 0;
_local2 = 1;
while (_local2 <= 16) {
if (shotRes_pkBalls[_local2]) {
takeBall_out(_local2);
}
_local2++;
}
}
if (current_player == "1") {
total1 = total1 + _local3;
} else {
total2 = total2 + _local3;
}
controls.score1 = total1;
controls.score2 = total2;
if (total1 >= 8) {
game_over(1);
return(undefined);
}
if (total2 >= 8) {
game_over(2);
return(undefined);
}
set_game_status(_local4);
return(undefined);
}
}
function inshot__() {
tellTarget (_parent) {
ex_shots++;
var nextPlayer = ("player" + current_player);
var selfTurn = 1;
var firstSelfContact = 0;
var p_cueBall = 0;
var p_blackBall = 0;
var total_self = 0;
var total_strip = 0;
var total_solid = 0;
var falseNumBallsPocket = 0;
var selfNumBallsPocket = 0;
var num_stripBallsPocket = 0;
var num_solidBallsPocket = 0;
var SelfBall_1_SET = 0;
var back_AllBalls = 0;
var back_SelfBalls = 0;
if ((SelfBall_1 == "") && (shotRes_firstPocket > 0)) {
firstSelfContact = 1;
SelfBall_1_SET = 1;
if (current_player == "1") {
if (shotRes_firstPocket < 9) {
SelfBall_1 = "strip";
SelfBall_2 = "solid";
} else {
SelfBall_1 = "solid";
SelfBall_2 = "strip";
}
} else if (shotRes_firstPocket < 9) {
SelfBall_1 = "solid";
SelfBall_2 = "strip";
} else {
SelfBall_1 = "strip";
SelfBall_2 = "solid";
}
controls.balltype1.set_ball_type(SelfBall_1);
controls.balltype2.set_ball_type(SelfBall_2);
}
if (shotRes_pkBalls[1]) {
p_cueBall = 1;
}
if (shotRes_pkBalls[9]) {
p_blackBall = 1;
}
var i = 2;
while (i <= 8) {
if (!eval ("b" + i).ex) {
total_strip++;
}
if (shotRes_pkBalls[i]) {
num_stripBallsPocket++;
}
i++;
}
var i = 10;
while (i <= 16) {
if (!eval ("b" + i).ex) {
total_solid++;
}
if (shotRes_pkBalls[i]) {
num_solidBallsPocket++;
}
i++;
}
if (current_player == "1") {
if (SelfBall_1 == "strip") {
if (shotRes_firstContact < 9) {
firstSelfContact = 1;
}
total1 = (total_self = total_strip);
total2 = total_solid;
selfNumBallsPocket = num_stripBallsPocket;
falseNumBallsPocket = num_solidBallsPocket;
} else {
if (shotRes_firstContact > 9) {
firstSelfContact = 1;
}
total1 = (total_self = total_solid);
total2 = total_strip;
selfNumBallsPocket = num_solidBallsPocket;
falseNumBallsPocket = num_stripBallsPocket;
}
} else if (SelfBall_1 == "strip") {
if (shotRes_firstContact > 9) {
firstSelfContact = 1;
}
total1 = total_strip;
total2 = (total_self = total_solid);
selfNumBallsPocket = num_solidBallsPocket;
falseNumBallsPocket = num_stripBallsPocket;
} else {
if (shotRes_firstContact < 9) {
firstSelfContact = 1;
}
total1 = total_solid;
total2 = (total_self = total_strip);
selfNumBallsPocket = num_stripBallsPocket;
falseNumBallsPocket = num_solidBallsPocket;
}
if (p_cueBall) {
selfTurn = 0;
back_AllBalls = 1;
}
if (!firstSelfContact) {
back_SelfBalls = 1;
selfTurn = 0;
} else if (selfNumBallsPocket <= 0) {
selfTurn = 0;
}
if (!selfTurn) {
if (current_game_type == "1") {
nextPlayer = "player1";
} else if (current_game_type == "2") {
if (current_player == "1") {
nextPlayer = "player2";
} else {
nextPlayer = "player1";
}
} else if (current_game_type == "R") {
if (current_player == "1") {
nextPlayer = "playerR";
} else {
nextPlayer = "player1";
}
}
}
if (back_AllBalls) {
var i = 1;
while (i <= 16) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
} else if (back_SelfBalls) {
if (current_player == "1") {
if (SelfBall_1 == "strip") {
var i = 1;
while (i <= 8) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
} else {
if (shotRes_pkBalls[1]) {
takeBall_out(1);
}
var i = 10;
while (i <= 16) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
}
} else if (SelfBall_1 == "strip") {
if (shotRes_pkBalls[1]) {
takeBall_out(1);
}
var i = 10;
while (i <= 16) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
} else {
var i = 1;
while (i <= 8) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
}
}
total_strip = 0;
total_solid = 0;
num_stripBallsPocket = 0;
num_solidBallsPocket = 0;
var i = 2;
while (i <= 8) {
if (!eval ("b" + i).ex) {
total_strip++;
}
if (shotRes_pkBalls[i]) {
num_stripBallsPocket++;
}
i++;
}
var i = 10;
while (i <= 16) {
if (!eval ("b" + i).ex) {
total_solid++;
}
if (shotRes_pkBalls[i]) {
num_solidBallsPocket++;
}
i++;
}
if (current_player == "1") {
if (SelfBall_1 == "strip") {
total1 = (total_self = total_strip);
total2 = total_solid;
} else {
total1 = (total_self = total_solid);
total2 = total_strip;
}
} else if (SelfBall_1 == "strip") {
total1 = total_strip;
total2 = (total_self = total_solid);
} else {
total1 = total_solid;
total2 = (total_self = total_strip);
}
controls.score1 = total1;
controls.score2 = total2;
set_game_status(nextPlayer);
return(undefined);
}
}
_parent.ex_shots = 0;
Symbol 96 MovieClip [game_8balls] Frame 1
function start_game(gameType) {
tellTarget (_parent) {
total1 = 0;
total2 = 0;
SelfBall_1 = "";
current_game_type = gameType;
set_balls();
set_game_status("player1");
};
}
function inshot() {
tellTarget (_parent) {
ex_shots++;
var nextPlayer = ("player" + current_player);
var selfTurn = 1;
var firstSelfContact = 0;
var p_cueBall = 0;
var p_blackBall = 0;
var total_self = 0;
var total_strip = 0;
var total_solid = 0;
var falseNumBallsPocket = 0;
var selfNumBallsPocket = 0;
var num_stripBallsPocket = 0;
var num_solidBallsPocket = 0;
var SelfBall_1_SET = 0;
var back_AllBalls = 0;
var back_SelfBalls = 0;
if ((SelfBall_1 == "") && (shotRes_firstPocket > 0)) {
firstSelfContact = 1;
SelfBall_1_SET = 1;
if (current_player == "1") {
if (shotRes_firstPocket < 9) {
SelfBall_1 = "strip";
SelfBall_2 = "solid";
} else {
SelfBall_1 = "solid";
SelfBall_2 = "strip";
}
} else if (shotRes_firstPocket < 9) {
SelfBall_1 = "solid";
SelfBall_2 = "strip";
} else {
SelfBall_1 = "strip";
SelfBall_2 = "solid";
}
controls.balltype1.set_ball_type(SelfBall_1);
controls.balltype2.set_ball_type(SelfBall_2);
}
if (shotRes_pkBalls[1]) {
p_cueBall = 1;
}
if (shotRes_pkBalls[9]) {
p_blackBall = 1;
}
var i = 2;
while (i <= 8) {
if (!eval ("b" + i).ex) {
total_strip++;
}
if (shotRes_pkBalls[i]) {
num_stripBallsPocket++;
}
i++;
}
var i = 10;
while (i <= 16) {
if (!eval ("b" + i).ex) {
total_solid++;
}
if (shotRes_pkBalls[i]) {
num_solidBallsPocket++;
}
i++;
}
if (current_player == "1") {
if (SelfBall_1 == "strip") {
if (shotRes_firstContact < 9) {
firstSelfContact = 1;
}
total1 = (total_self = total_strip);
total2 = total_solid;
selfNumBallsPocket = num_stripBallsPocket;
falseNumBallsPocket = num_solidBallsPocket;
} else {
if (shotRes_firstContact > 9) {
firstSelfContact = 1;
}
total1 = (total_self = total_solid);
total2 = total_strip;
selfNumBallsPocket = num_solidBallsPocket;
falseNumBallsPocket = num_stripBallsPocket;
}
} else if (SelfBall_1 == "strip") {
if (shotRes_firstContact > 9) {
firstSelfContact = 1;
}
total1 = total_strip;
total2 = (total_self = total_solid);
selfNumBallsPocket = num_solidBallsPocket;
falseNumBallsPocket = num_stripBallsPocket;
} else {
if (shotRes_firstContact < 9) {
firstSelfContact = 1;
}
total1 = total_solid;
total2 = (total_self = total_strip);
selfNumBallsPocket = num_stripBallsPocket;
falseNumBallsPocket = num_solidBallsPocket;
}
if (p_blackBall) {
selfTurn = 0;
if (ex_shots == 1) {
if (current_player == "1") {
var winner = "1";
} else {
var winner = "2";
}
game_over(winner);
return(undefined);
}
if ((!p_selfBall) && (total_self == 7)) {
if ((shotRes_firstContact == 9) && (!p_cueBall)) {
if (current_player == "1") {
var winner = "1";
} else {
var winner = "2";
}
} else if (current_player == "1") {
var winner = "2";
} else {
var winner = "1";
}
game_over(winner);
return(undefined);
}
if (current_player == "1") {
var winner = "2";
} else {
var winner = "1";
}
game_over(winner);
return(undefined);
}
if (p_cueBall) {
selfTurn = 0;
if ((SelfBall_1 == "") || (SelfBall_1_SET)) {
SelfBall_1 = "";
back_AllBalls = 1;
} else {
back_SelfBalls = 1;
}
}
if (!firstSelfContact) {
back_SelfBalls = 1;
selfTurn = 0;
} else if (selfNumBallsPocket <= 0) {
selfTurn = 0;
}
if (!selfTurn) {
if (current_game_type == "1") {
nextPlayer = "player1";
} else if (current_game_type == "2") {
if (current_player == "1") {
nextPlayer = "player2";
} else {
nextPlayer = "player1";
}
} else if (current_game_type == "R") {
if (current_player == "1") {
nextPlayer = "playerR";
} else {
nextPlayer = "player1";
}
}
}
if (back_AllBalls) {
var i = 1;
while (i <= 16) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
} else if (back_SelfBalls) {
if (current_player == "1") {
if (SelfBall_1 == "strip") {
var i = 1;
while (i <= 8) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
} else {
if (shotRes_pkBalls[1]) {
takeBall_out(1);
}
var i = 10;
while (i <= 16) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
}
} else if (SelfBall_1 == "strip") {
if (shotRes_pkBalls[1]) {
takeBall_out(1);
}
var i = 10;
while (i <= 16) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
} else {
var i = 1;
while (i <= 8) {
if (shotRes_pkBalls[i]) {
takeBall_out(i);
}
i++;
}
}
}
total_strip = 0;
total_solid = 0;
num_stripBallsPocket = 0;
num_solidBallsPocket = 0;
var i = 2;
while (i <= 8) {
if (!eval ("b" + i).ex) {
total_strip++;
}
if (shotRes_pkBalls[i]) {
num_stripBallsPocket++;
}
i++;
}
var i = 10;
while (i <= 16) {
if (!eval ("b" + i).ex) {
total_solid++;
}
if (shotRes_pkBalls[i]) {
num_solidBallsPocket++;
}
i++;
}
if (current_player == "1") {
if (SelfBall_1 == "strip") {
total1 = (total_self = total_strip);
total2 = total_solid;
} else {
total1 = (total_self = total_solid);
total2 = total_strip;
}
} else if (SelfBall_1 == "strip") {
total1 = total_strip;
total2 = (total_self = total_solid);
} else {
total1 = total_solid;
total2 = (total_self = total_strip);
}
controls.score1 = total1;
controls.score2 = total2;
set_game_status(nextPlayer);
return(undefined);
}
}
_parent.ex_shots = 0;
Symbol 144 MovieClip Frame 2
stop();
Symbol 148 Button
on (release) {
_root.open_ax_url();
}
Symbol 154 MovieClip Frame 1
if (_root.ADVERT_HTML != "loading") {
if ((_root.ADVERT_HTML == "") || (_root.ADVERT_HTML == undefined)) {
gotoAndStop (2);
} else {
tx.html = true;
tx.htmlText = _root.ADVERT_HTML;
stop();
}
} else {
stop();
}
Symbol 154 MovieClip Frame 2
stop();
Symbol 180 MovieClip Frame 1
bts.onRelease = function () {
if (_currentframe == 1) {
_parent.turnMus(0);
gotoAndStop (2);
} else {
_parent.turnMus(1);
gotoAndStop (1);
}
};
stop();
Symbol 182 MovieClip Frame 1
bts.onRelease = function () {
if (_currentframe == 1) {
_parent.turnSounds(0);
gotoAndStop (2);
} else {
_parent.turnSounds(1);
gotoAndStop (1);
}
};
stop();
Symbol 185 Button
on (release) {
gotoAndStop ("menu");
}
Symbol 206 MovieClip Frame 1
function set_ball_type(t) {
if (t == "strip") {
gotoAndStop (3);
} else if (t == "solid") {
gotoAndStop (4);
} else {
gotoAndStop (2);
}
}
Symbol 206 MovieClip Frame 2
stop();
Symbol 221 MovieClip Frame 1
function switch_curr_player(n) {
if (n == 1) {
crr1._visible = 1;
crr2._visible = 0;
} else if (n == 2) {
crr1._visible = 0;
crr2._visible = 1;
} else {
crr1._visible = 0;
crr2._visible = 0;
}
}
switch_curr_player(0);
if (_root.PLAYERS_TYPE == "1") {
gotoAndStop (3);
} else if (_root.PLAYERS_TYPE == "2") {
stop();
} else if (_root.PLAYERS_TYPE == "R") {
gotoAndStop (2);
}
Symbol 221 MovieClip Frame 2
stop();
Symbol 221 MovieClip Frame 3
stop();
Symbol 229 MovieClip Frame 1
function show_winner(n) {
if (((n == "1") || (n == "2")) || (n == "R")) {
winnerName = eval ("_root.playername" + n);
gotoAndStop (3);
} else {
gotoAndStop (4);
}
}
Symbol 229 MovieClip Frame 2
stop();
Symbol 230 MovieClip Frame 1
function sound_kick(p, step) {
if (!_root.useSOUNDS) {
return(undefined);
}
var _local2 = soundRat_kick * step;
if (_local2 > 100) {
_local2 = 100;
}
var _local3 = new Sound("b" + p);
_local3.attachSound("kick");
_local3.setVolume(_local2);
_local3.start();
}
function sound_bordkick(p, step) {
if (!_root.useSOUNDS) {
return(undefined);
}
var _local2 = soundRat_bordkick * step;
if (_local2 > 100) {
_local2 = 100;
}
var _local3 = new Sound("b" + p);
_local3.attachSound("bordkick");
_local3.setVolume(_local2);
_local3.start();
}
function sound_keykick(p, step) {
if (!_root.useSOUNDS) {
return(undefined);
}
var _local2 = soundRat_keykick * step;
if (_local2 > 100) {
_local2 = 100;
}
var _local3 = new Sound("b" + p);
_local3.attachSound("keykick");
_local3.setVolume(_local2);
_local3.start();
}
function sound_loose(p, step) {
if (!_root.useSOUNDS) {
return(undefined);
}
var _local2 = soundRat_loose * step;
if (_local2 > 100) {
_local2 = 100;
}
if (_local2 < 40) {
_local2 = 40;
}
var _local3 = new Sound("b" + p);
_local3.attachSound("loose");
_local3.setVolume(_local2);
_local3.start();
}
function mathem_distance(px1, py1, px2, py2) {
var _local2 = px1 - px2;
var _local1 = py1 - py2;
return(Math.sqrt((_local2 * _local2) + (_local1 * _local1)));
}
function mathem_angle(xCenter, yCenter, xDistant, yDistant) {
var _local3 = xDistant - xCenter;
var _local2 = yDistant - yCenter;
var _local1 = Math.atan2(_local2, _local3);
return(_local1 / (Math.PI/180));
}
function mathem_pos(xCenter, yCenter, angleToDistant, distance) {
var _local1 = Math.sin((Math.PI/180) * angleToDistant) * distance;
var _local2 = Math.sqrt((distance * distance) - (_local1 * _local1));
if (Math.abs(angleToDistant) > 90) {
_local2 = _local2 * -1;
}
return(Array(xCenter + _local2, yCenter + _local1));
}
function normalize(angle) {
if (angle > 180) {
angle = angle - 360;
}
if (angle < -180) {
angle = angle + 360;
}
return(angle);
}
function wheel_steps(ball, f) {
var nf = (eval ("b" + ball).wheel._currentframe + Math.floor((f * 6) + 1E-5));
if (nf > 200) {
nf = nf - 200;
}
eval ("b" + ball).wheel.gotoAndStop(nf);
}
function BallToPocket(ball, pk) {
if ((shotRes_firstPocket == 0) && ((ball != 1) && (ball != 9))) {
shotRes_firstPocket = ball;
}
shotRes_pkBalls[ball] = 1;
eval ("b" + ball).pocket = pk;
eval ("b" + ball).ex = 0;
}
function checkPockets(arParams) {
var kicktype = "border";
var cango = 1;
var can_pre = 1;
var prep = 0;
var cmpr = 0;
var paramSet = eval ((("pocketPositions." + arParams.c_side) + ".") + arParams.c_pocket);
var cnr_ins = paramSet.ins_left;
var cnr_out = paramSet.out_left;
var crrAngPocket = paramSet.ang_left;
var angRef = paramSet.angref_left;
var newposAngOut = mathem_angle(cnr_out[0], cnr_out[1], arParams.nx, arParams.ny);
var prevposAngOut = mathem_angle(cnr_out[0], cnr_out[1], arParams.px, arParams.py);
var newposAngIns = mathem_angle(cnr_ins[0], cnr_ins[1], arParams.nx, arParams.ny);
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if (((newposAngOut > 45) || (newposAngOut < -135)) && ((prevposAngOut < 45) && (prevposAngOut > -135))) {
prep = 1;
}
if ((newposAngOut > 45) || (newposAngOut < -135)) {
can_pre = 0;
}
} else if (arParams.c_pocket == "right") {
if (((newposAngOut > 135) || (newposAngOut < -45)) && ((prevposAngOut < 135) && (prevposAngOut > -45))) {
prep = 1;
}
if ((newposAngOut > 135) || (newposAngOut < -45)) {
can_pre = 0;
}
} else {
if (((newposAngOut < -70) || (newposAngOut > 110)) && ((prevposAngOut > -70) && (prevposAngOut < 110))) {
prep = 1;
}
if ((newposAngOut < -70) || (newposAngOut > 110)) {
can_pre = 0;
}
}
} else if (arParams.c_pocket == "left") {
if (((newposAngOut > 135) || (newposAngOut < -45)) && ((prevposAngOut < 135) && (prevposAngOut > -45))) {
prep = 1;
}
if ((newposAngOut > 135) || (newposAngOut < -45)) {
can_pre = 0;
}
} else if (arParams.c_pocket == "right") {
if (((newposAngOut < -135) || (newposAngOut > 45)) && ((prevposAngOut > -135) && (prevposAngOut < 45))) {
prep = 1;
}
if ((newposAngOut < -135) || (newposAngOut > 45)) {
can_pre = 0;
}
} else {
if (((newposAngOut > 70) || (newposAngOut < -110)) && ((prevposAngOut < 70) && (prevposAngOut > -110))) {
prep = 1;
}
if ((newposAngOut > 70) || (newposAngOut < -110)) {
can_pre = 0;
}
}
if (prep == 1) {
var p_ang = normalize(prevposAngOut - crrAngPocket);
var p_dist = mathem_distance(cnr_out[0], cnr_out[1], arParams.px, arParams.py);
var m_bc = (Math.sin(mpi * p_ang) * p_dist);
var m_ang = normalize(crrAngPocket - arParams.dirc);
var nst = (m_bc / Math.sin(mpi * m_ang));
if (nst > 0) {
var newPos = mathem_pos(arParams.px, arParams.py, arParams.dirc, nst);
var angToNew = mathem_angle(cnr_ins[0], cnr_ins[1], newPos[0], newPos[1]);
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if ((angToNew > 135) || (angToNew < -45)) {
cmpr = 1;
}
} else if (arParams.c_pocket == "right") {
if ((angToNew > -135) && (angToNew < 45)) {
cmpr = 1;
}
} else if ((angToNew > -160) && (angToNew < 20)) {
cmpr = 1;
}
} else if (arParams.c_pocket == "left") {
if ((angToNew > 45) || (angToNew < -135)) {
cmpr = 1;
}
} else if (arParams.c_pocket == "right") {
if ((angToNew < 135) && (angToNew > -45)) {
cmpr = 1;
}
} else if ((angToNew < 160) && (angToNew > -20)) {
cmpr = 1;
}
if (cmpr == 1) {
if (nst > 0) {
arParams.nx = newPos[0];
arParams.ny = newPos[1];
} else {
arParams.nx = arParams.px;
arParams.ny = arParams.py;
}
kicktype = "ins";
arParams.dirc = normalize(((arParams.dirc - crrAngPocket) * -1) + crrAngPocket);
} else {
var toins_dist = mathem_distance(arParams.px, arParams.py, cnr_ins[0], cnr_ins[1]);
var toins_ang = mathem_angle(arParams.px, arParams.py, cnr_ins[0], cnr_ins[1]);
var angleToCorner = normalize(Math.abs(arParams.dirc - toins_ang));
var toins_bc = Math.abs(toins_dist * Math.sin(mpi * angleToCorner));
if (toins_bc < ball_radius) {
var newins_dist = mathem_distance(arParams.nx, arParams.ny, cnr_ins[0], cnr_ins[1]);
if (newins_dist < ball_radius) {
var toins_bc2 = (toins_bc * toins_bc);
var ac_curr = Math.sqrt((toins_dist * toins_dist) - toins_bc2);
var ac_nx = Math.sqrt(ball_2radius - toins_bc2);
var distBack = (ac_curr - ac_nx);
var newPos = mathem_pos(arParams.px, arParams.py, arParams.dirc, distBack);
var checkAng = mathem_angle(cnr_ins[0], cnr_ins[1], newPos[0], newPos[1]);
var chkp = 0;
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if (((checkAng > -45) && (checkAng < 135)) && ((arParams.dirc > 67.5) || (arParams.dirc < -112.5))) {
chkp = 1;
}
} else if (arParams.c_pocket == "right") {
if (((checkAng > 45) || (checkAng < -135)) && ((arParams.dirc > 157.5) || (arParams.dirc < -22.5))) {
chkp = 1;
}
} else if (((checkAng > 20) || (checkAng < -160)) && ((arParams.dirc < -35) || (arParams.dirc > 145))) {
chkp = 1;
}
} else if (arParams.c_pocket == "left") {
if (((checkAng < 45) && (checkAng > -135)) && ((arParams.dirc < -67.5) || (arParams.dirc > 112.5))) {
chkp = 1;
}
} else if (arParams.c_pocket == "right") {
if (((checkAng < -45) || (checkAng > 135)) && ((arParams.dirc > 22.5) || (arParams.dirc < -157.5))) {
chkp = 1;
}
} else if (((checkAng < -20) || (checkAng > 160)) && ((arParams.dirc > 35) || (arParams.dirc < -145))) {
chkp = 1;
}
if (chkp == 1) {
if (distBack > 0) {
arParams.nx = newPos[0];
arParams.ny = newPos[1];
} else {
arParams.nx = arParams.px;
arParams.ny = arParams.py;
}
kicktype = "cnr1L";
arParams.dirc = normalize(((2 * angRef) - 180) - arParams.dirc);
}
}
}
}
}
} else {
var toins_dist = mathem_distance(arParams.px, arParams.py, cnr_ins[0], cnr_ins[1]);
var toins_ang = mathem_angle(arParams.px, arParams.py, cnr_ins[0], cnr_ins[1]);
var angleToCorner = normalize(Math.abs(arParams.dirc - toins_ang));
var toins_bc = Math.abs(toins_dist * Math.sin(mpi * angleToCorner));
if (toins_bc < ball_radius) {
var newins_dist = mathem_distance(arParams.nx, arParams.ny, cnr_ins[0], cnr_ins[1]);
if (newins_dist < ball_radius) {
var toins_bc2 = (toins_bc * toins_bc);
var ac_curr = Math.sqrt((toins_dist * toins_dist) - toins_bc2);
var ac_nx = Math.sqrt(ball_2radius - toins_bc2);
var distBack = (ac_curr - ac_nx);
var newPos = mathem_pos(arParams.px, arParams.py, arParams.dirc, distBack);
var checkAng = mathem_angle(cnr_ins[0], cnr_ins[1], newPos[0], newPos[1]);
var chkp = 0;
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if (((checkAng > -45) && (checkAng < 135)) && ((arParams.dirc > 67.5) || (arParams.dirc < -112.5))) {
chkp = 1;
}
} else if (arParams.c_pocket == "right") {
if (((checkAng > 45) || (checkAng < -135)) && ((arParams.dirc > 157.5) || (arParams.dirc < -22.5))) {
chkp = 1;
}
} else if (((checkAng > 20) || (checkAng < -160)) && ((arParams.dirc < -35) || (arParams.dirc > 145))) {
chkp = 1;
}
} else if (arParams.c_pocket == "left") {
if (((checkAng < 45) && (checkAng > -135)) && ((arParams.dirc < -67.5) || (arParams.dirc > 112.5))) {
chkp = 1;
}
} else if (arParams.c_pocket == "right") {
if (((checkAng < -45) || (checkAng > 135)) && ((arParams.dirc > 22.5) || (arParams.dirc < -157.5))) {
chkp = 1;
}
} else if (((checkAng < -20) || (checkAng > 160)) && ((arParams.dirc > 35) || (arParams.dirc < -145))) {
chkp = 1;
}
if (chkp == 1) {
if (distBack > 0) {
arParams.nx = newPos[0];
arParams.ny = newPos[1];
} else {
arParams.nx = arParams.px;
arParams.ny = arParams.py;
}
kicktype = "cnr2L";
arParams.dirc = normalize(((2 * angRef) - 180) - arParams.dirc);
}
}
}
}
var can_pre_s = 1;
var prep_s = 0;
var cmpr_s = 0;
var cnr_ins = paramSet.ins_right;
var cnr_out = paramSet.out_right;
var crrAngPocket = paramSet.ang_right;
var angRef = paramSet.angref_right;
var newposAngOut = mathem_angle(cnr_out[0], cnr_out[1], arParams.nx, arParams.ny);
var prevposAngOut = mathem_angle(cnr_out[0], cnr_out[1], arParams.px, arParams.py);
var newposAngIns = mathem_angle(cnr_ins[0], cnr_ins[1], arParams.nx, arParams.ny);
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if (((newposAngOut < 45) && (newposAngOut > -135)) && ((prevposAngOut > 45) || (prevposAngOut < -135))) {
prep_s = 1;
}
if ((newposAngOut < 45) && (newposAngOut > -135)) {
can_pre_s = 0;
}
} else if (arParams.c_pocket == "right") {
if (((newposAngOut < 135) && (newposAngOut > -45)) && ((prevposAngOut > 135) || (prevposAngOut < -45))) {
prep_s = 1;
}
if ((newposAngOut < 135) && (newposAngOut > -45)) {
can_pre_s = 0;
}
} else {
if (((newposAngOut < 70) && (newposAngOut > -110)) && ((prevposAngOut > 70) || (prevposAngOut < -110))) {
prep_s = 1;
}
if ((newposAngOut < 70) && (newposAngOut > -110)) {
can_pre_s = 0;
}
}
} else if (arParams.c_pocket == "left") {
if (((newposAngOut < 135) && (newposAngOut > -45)) && ((prevposAngOut > 135) || (prevposAngOut < -45))) {
prep_s = 1;
}
if ((newposAngOut < 135) && (newposAngOut > -45)) {
can_pre_s = 0;
}
} else if (arParams.c_pocket == "right") {
if (((newposAngOut < 45) && (newposAngOut > -135)) && ((prevposAngOut < -135) || (prevposAngOut > 45))) {
prep_s = 1;
}
if ((newposAngOut < 45) && (newposAngOut > -135)) {
can_pre_s = 0;
}
} else {
if (((newposAngOut > -70) && (newposAngOut < 110)) && ((prevposAngOut > 110) || (prevposAngOut < -70))) {
prep_s = 1;
}
if ((newposAngOut > -70) && (newposAngOut < 110)) {
can_pre_s = 0;
}
}
if ((can_pre == 1) && (can_pre_s == 1)) {
cango = 0;
}
if (prep_s == 1) {
var p_ang = normalize(prevposAngOut - crrAngPocket);
var p_dist = mathem_distance(cnr_out[0], cnr_out[1], arParams.px, arParams.py);
var m_bc = (Math.sin(mpi * p_ang) * p_dist);
var m_ang = normalize(crrAngPocket - arParams.dirc);
var nst = (m_bc / Math.sin(mpi * m_ang));
if (nst > 0) {
var newPos = mathem_pos(arParams.px, arParams.py, arParams.dirc, nst);
var angToNew = mathem_angle(cnr_ins[0], cnr_ins[1], newPos[0], newPos[1]);
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if ((angToNew > 135) || (angToNew < -45)) {
cmpr_s = 1;
}
} else if (arParams.c_pocket == "right") {
if ((angToNew > -135) && (angToNew < 45)) {
cmpr_s = 1;
}
} else if ((angToNew > 160) || (angToNew < -20)) {
cmpr_s = 1;
}
} else if (arParams.c_pocket == "left") {
if ((angToNew > 45) || (angToNew < -135)) {
cmpr_s = 1;
}
} else if (arParams.c_pocket == "right") {
if ((angToNew > -45) && (angToNew < 135)) {
cmpr_s = 1;
}
} else if ((angToNew < -160) || (angToNew > 20)) {
cmpr_s = 1;
}
if (cmpr_s == 1) {
if (nst > 0) {
arParams.nx = newPos[0];
arParams.ny = newPos[1];
} else {
arParams.nx = arParams.px;
arParams.ny = arParams.py;
}
kicktype = "ins";
arParams.dirc = normalize(((arParams.dirc - crrAngPocket) * -1) + crrAngPocket);
} else {
var toins_dist = mathem_distance(arParams.px, arParams.py, cnr_ins[0], cnr_ins[1]);
var toins_ang = mathem_angle(arParams.px, arParams.py, cnr_ins[0], cnr_ins[1]);
var angleToCorner = normalize(Math.abs(arParams.dirc - toins_ang));
var toins_bc = Math.abs(toins_dist * Math.sin(mpi * angleToCorner));
if (toins_bc < ball_radius) {
var newins_dist = mathem_distance(arParams.nx, arParams.ny, cnr_ins[0], cnr_ins[1]);
if (newins_dist < ball_radius) {
var toins_bc2 = (toins_bc * toins_bc);
var ac_curr = Math.sqrt((toins_dist * toins_dist) - toins_bc2);
var ac_nx = Math.sqrt(ball_2radius - toins_bc2);
var distBack = (ac_curr - ac_nx);
var newPos = mathem_pos(arParams.px, arParams.py, arParams.dirc, distBack);
var checkAng = mathem_angle(cnr_ins[0], cnr_ins[1], newPos[0], newPos[1]);
var chkp = 0;
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if (((checkAng < 135) && (checkAng > -45)) && ((arParams.dirc > -157.5) && (arParams.dirc < 22.5))) {
chkp = 1;
}
} else if (arParams.c_pocket == "right") {
if (((checkAng < -135) || (checkAng > 45)) && ((arParams.dirc > -67.5) && (arParams.dirc < 112.5))) {
chkp = 1;
}
} else if (((checkAng > -20) && (checkAng < 160)) && ((arParams.dirc < 35) && (arParams.dirc > -145))) {
chkp = 1;
}
} else if (arParams.c_pocket == "left") {
if (((checkAng > -135) && (checkAng < 45)) && ((arParams.dirc < 157.5) && (arParams.dirc > -22.5))) {
chkp = 1;
}
} else if (arParams.c_pocket == "right") {
if (((checkAng > 135) || (checkAng < -45)) && ((arParams.dirc < 67.5) && (arParams.dirc > -112.5))) {
chkp = 1;
}
} else if (((checkAng > -160) && (checkAng < 20)) && ((arParams.dirc < 145) && (arParams.dirc > -35))) {
chkp = 1;
}
if (chkp == 1) {
if (distBack > 0) {
arParams.nx = newPos[0];
arParams.ny = newPos[1];
} else {
arParams.nx = arParams.px;
arParams.ny = arParams.py;
}
kicktype = "cnr1R";
arParams.dirc = normalize(((2 * angRef) - 180) - arParams.dirc);
}
}
}
}
}
} else {
var toins_dist = mathem_distance(arParams.px, arParams.py, cnr_ins[0], cnr_ins[1]);
var toins_ang = mathem_angle(arParams.px, arParams.py, cnr_ins[0], cnr_ins[1]);
var angleToCorner = normalize(Math.abs(arParams.dirc - toins_ang));
var toins_bc = Math.abs(toins_dist * Math.sin(mpi * angleToCorner));
if (toins_bc < ball_radius) {
var newins_dist = mathem_distance(arParams.nx, arParams.ny, cnr_ins[0], cnr_ins[1]);
if (newins_dist < ball_radius) {
var toins_bc2 = (toins_bc * toins_bc);
var ac_curr = Math.sqrt((toins_dist * toins_dist) - toins_bc2);
var ac_nx = Math.sqrt(ball_2radius - toins_bc2);
var distBack = (ac_curr - ac_nx);
var newPos = mathem_pos(arParams.px, arParams.py, arParams.dirc, distBack);
var checkAng = mathem_angle(cnr_ins[0], cnr_ins[1], newPos[0], newPos[1]);
var chkp = 0;
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if (((checkAng < 135) && (checkAng > -45)) && ((arParams.dirc > -157.5) && (arParams.dirc < 22.5))) {
chkp = 1;
}
} else if (arParams.c_pocket == "right") {
if (((checkAng < -135) || (checkAng > 45)) && ((arParams.dirc > -67.5) && (arParams.dirc < 112.5))) {
chkp = 1;
}
} else if (((checkAng > -20) && (checkAng < 160)) && ((arParams.dirc < 35) && (arParams.dirc > -145))) {
chkp = 1;
}
} else if (arParams.c_pocket == "left") {
if (((checkAng > -135) && (checkAng < 45)) && ((arParams.dirc < 157.5) && (arParams.dirc > -22.5))) {
chkp = 1;
}
} else if (arParams.c_pocket == "right") {
if (((checkAng > 135) || (checkAng < -45)) && ((arParams.dirc < 67.5) && (arParams.dirc > -112.5))) {
chkp = 1;
}
} else if (((checkAng > -160) && (checkAng < 20)) && ((arParams.dirc < 145) && (arParams.dirc > -35))) {
chkp = 1;
}
if (chkp == 1) {
if (distBack > 0) {
arParams.nx = newPos[0];
arParams.ny = newPos[1];
} else {
arParams.nx = arParams.px;
arParams.ny = arParams.py;
}
kicktype = "cnr1R";
arParams.dirc = normalize(((2 * angRef) - 180) - arParams.dirc);
}
}
}
}
var inpk = 0;
var pkn = 0;
var distPk = pocketToBall;
if (arParams.c_side == "top") {
if (arParams.c_pocket == "left") {
if ((arParams.ny < (y_min - ball_2A_diam)) || (arParams.nx < (x_min - ball_2A_diam))) {
inpk = 1;
pkn = 1;
} else {
distPk = mathem_distance(arParams.nx, arParams.ny, topleft_poket[0], topleft_poket[1]);
pkn = 1;
}
} else if (arParams.c_pocket == "right") {
if ((arParams.ny < (y_min - ball_2A_diam)) || (arParams.nx > (x_max + ball_2A_diam))) {
inpk = 1;
pkn = 3;
} else {
distPk = mathem_distance(arParams.nx, arParams.ny, topright_poket[0], topright_poket[1]);
pkn = 3;
}
} else if (arParams.ny < (y_min - ball_2A_diam)) {
inpk = 1;
pkn = 2;
} else {
distPk = mathem_distance(arParams.nx, arParams.ny, topcenter_poket[0], topcenter_poket[1]);
pkn = 2;
}
} else if (arParams.c_pocket == "left") {
if ((arParams.ny > (y_max + ball_2A_diam)) || (arParams.nx < (x_min - ball_2A_diam))) {
inpk = 1;
pkn = 6;
} else {
distPk = mathem_distance(arParams.nx, arParams.ny, bottleft_poket[0], bottleft_poket[1]);
pkn = 6;
}
} else if (arParams.c_pocket == "right") {
if ((arParams.ny > (y_max + ball_2A_diam)) || (arParams.nx > (x_max + ball_2A_diam))) {
inpk = 1;
pkn = 4;
} else {
distPk = mathem_distance(arParams.nx, arParams.ny, bottright_poket[0], bottright_poket[1]);
pkn = 4;
}
} else if (arParams.ny > (y_max + ball_2A_diam)) {
inpk = 1;
pkn = 5;
} else {
distPk = mathem_distance(arParams.nx, arParams.ny, bottcenter_poket[0], bottcenter_poket[1]);
pkn = 5;
}
if ((distPk < pocketToBall) || (inpk)) {
_root.main.sound_loose(arParams.ball, arParams.ballstep);
BallToPocket(arParams.ball, pkn);
}
arParams.kicktype = kicktype;
arParams.cango = cango;
return(arParams);
}
function ballMoving(c) {
if (!eval ("b" + c).ex) {
return(0);
}
tellTarget ("b" + c) {
if (mystep <= 0) {
return(1);
}
if (ex) {
mystep = mystep - _root.main.easing;
if (mystep < 0) {
mystep = 0;
}
var setstep = 0;
var NewPosition_arr = _root.main.mathem_pos(_x, _y, dirc, mystep);
var u = 1;
while (u <= _root.main.existsBalls) {
if ((u != c) && (eval ("_root.main.b" + u).ex)) {
var distance = _root.main.mathem_distance(_x, _y, eval ("_root.main.b" + u)._x, eval ("_root.main.b" + u)._y);
if (distance < (mystep + _root.main.ball_diam)) {
var distance_to = _root.main.mathem_distance(NewPosition_arr[0], NewPosition_arr[1], eval ("_root.main.b" + u)._x, eval ("_root.main.b" + u)._y);
var glob_angleToBall = _root.main.mathem_angle(_x, _y, eval ("_root.main.b" + u)._x, eval ("_root.main.b" + u)._y);
var angleToBall = Math.abs(_root.main.normalize(dirc - glob_angleToBall));
var bc = Math.abs(distance * Math.sin(_root.main.mpi * angleToBall));
var angToNewpos = _root.main.mathem_angle(NewPosition_arr[0], NewPosition_arr[1], eval ("_root.main.b" + u)._x, eval ("_root.main.b" + u)._y);
var angleN_ball = Math.abs(_root.main.normalize(dirc - angToNewpos));
if ((((distance_to < _root.main.ball_diam) || (angleN_ball > 90)) && (bc < _root.main.ball_diam)) && (angleToBall < 90)) {
if (_root.main.shotRes_firstContact == 0) {
if (c == 1) {
_root.main.shotRes_firstContact = u;
} else if (u == 1) {
_root.main.shotRes_firstContact = c;
}
}
_root.main.sound_kick(c, mystep);
var bc2 = (bc * bc);
var ac_curr = Math.sqrt((distance * distance) - bc2);
var ac_nx = Math.sqrt(_root.main.ball_2diam - bc2);
var distBack = (ac_curr - ac_nx);
if (distBack > 0) {
NewPosition_arr = _root.main.mathem_pos(_x, _y, dirc, distBack);
} else {
NewPosition_arr[0] = _x;
NewPosition_arr[1] = _y;
}
var ecr = _root.main.normalize(dirc - glob_angleToBall);
if (ecr < 0) {
var dm = -90;
} else {
var dm = 90;
}
var ANG1 = _root.main.normalize((dirc - glob_angleToBall) - dm);
var ANG2 = _root.main.normalize((eval ("_root.main.b" + u).dirc - glob_angleToBall) - dm);
var U1 = mystep;
var U2 = eval ("_root.main.b" + u).mystep;
var U1x = (Math.sin((Math.PI/180) * ANG1) * U1);
var U2x = (Math.sin((Math.PI/180) * ANG2) * U2);
var U1y = Math.sqrt((U1 * U1) - (U1x * U1x));
var U2y = Math.sqrt((U2 * U2) - (U2x * U2x));
if (Math.abs(ANG1) < 90) {
U1y = U1y * -1;
}
if (Math.abs(ANG2) < 90) {
U2y = U2y * -1;
}
var V1x = (((U1x + U2x) - (U1x - U2x)) * 0.5);
var V2x = (((U1x + U2x) - (U2x - U1x)) * 0.5);
var V1y = U1y;
var V2y = U2y;
var V1 = Math.sqrt((V1y * V1y) + (V1x * V1x));
var V2 = Math.sqrt((V2y * V2y) + (V2x * V2x));
var ang_res1 = _root.main.normalize(_root.main.mathem_angle(0, 0, V1x, V1y) + 90);
var ang_res2 = _root.main.normalize(_root.main.mathem_angle(0, 0, V2x, V2y) + 90);
var newAng1 = _root.main.normalize((ang_res1 + glob_angleToBall) + dm);
var newAng2 = _root.main.normalize((ang_res2 + glob_angleToBall) + dm);
eval ("_root.main.b" + u).dirc = newAng2;
eval ("_root.main.b" + u).mystep = V2;
setstep = 1;
}
}
}
u++;
}
if (setstep) {
dirc = newAng1;
mystep = V1;
}
kicktype = "border";
cango = 1;
var rParams = new Array();
rParams.ballstep = mystep;
rParams.ball = c;
rParams.dirc = dirc;
rParams.px = _x;
rParams.py = _y;
rParams.nx = NewPosition_arr[0];
rParams.ny = NewPosition_arr[1];
if (NewPosition_arr[1] < _root.main.y_center) {
rParams.c_side = "top";
if ((kicktype == "border") && (NewPosition_arr[0] < _root.main.leftArea_xmax)) {
rParams.c_pocket = "left";
var resPocket = _root.main.checkPockets(rParams);
kicktype = resPocket.kicktype;
cango = resPocket.cango;
NewPosition_arr[0] = rParams.nx;
NewPosition_arr[1] = rParams.ny;
dirc = rParams.dirc;
}
if ((kicktype == "border") && (NewPosition_arr[0] > _root.main.rightArea_xmin)) {
rParams.c_pocket = "right";
var resPocket = _root.main.checkPockets(rParams);
kicktype = resPocket.kicktype;
cango = resPocket.cango;
NewPosition_arr[0] = rParams.nx;
NewPosition_arr[1] = rParams.ny;
dirc = rParams.dirc;
}
if ((kicktype == "border") && ((NewPosition_arr[0] > _root.main.centerArea_xmin) && (NewPosition_arr[0] < _root.main.centerArea_xmax))) {
rParams.c_pocket = "center";
var resPocket = _root.main.checkPockets(rParams);
kicktype = resPocket.kicktype;
cango = resPocket.cango;
NewPosition_arr[0] = rParams.nx;
NewPosition_arr[1] = rParams.ny;
dirc = rParams.dirc;
}
} else {
rParams.c_side = "bottom";
if ((kicktype == "border") && (NewPosition_arr[0] < _root.main.leftArea_xmax)) {
rParams.c_pocket = "left";
var resPocket = _root.main.checkPockets(rParams);
kicktype = resPocket.kicktype;
cango = resPocket.cango;
NewPosition_arr[0] = rParams.nx;
NewPosition_arr[1] = rParams.ny;
dirc = rParams.dirc;
}
if ((kicktype == "border") && (NewPosition_arr[0] > _root.main.rightArea_xmin)) {
rParams.c_pocket = "right";
var resPocket = _root.main.checkPockets(rParams);
kicktype = resPocket.kicktype;
cango = resPocket.cango;
NewPosition_arr[0] = rParams.nx;
NewPosition_arr[1] = rParams.ny;
dirc = rParams.dirc;
}
if ((kicktype == "border") && ((NewPosition_arr[0] > _root.main.centerArea_xmin) && (NewPosition_arr[0] < _root.main.centerArea_xmax))) {
rParams.c_pocket = "center";
var resPocket = _root.main.checkPockets(rParams);
kicktype = resPocket.kicktype;
cango = resPocket.cango;
NewPosition_arr[0] = rParams.nx;
NewPosition_arr[1] = rParams.ny;
dirc = rParams.dirc;
}
}
if (kicktype != "border") {
_root.main.sound_bordkick(c, mystep);
}
if ((kicktype == "border") && (cango == 1)) {
if ((NewPosition_arr[0] < _root.main.x_min) && (Math.abs(dirc) > 90)) {
_root.main.sound_bordkick(c, mystep);
var alpha = (180 - Math.abs(dirc));
var ac = (_root.main.x_min - NewPosition_arr[0]);
var bc = (ac * Math.tan(_root.main.mpi * alpha));
var ab = Math.sqrt((ac * ac) + (bc * bc));
if (ab > mystep) {
NewPosition_arr[0] = _x;
NewPosition_arr[1] = _y;
} else {
NewPosition_arr = _root.main.mathem_pos(_x, _y, dirc, mystep - ab);
}
dirc = _root.main.normalize(180 - dirc);
mystep = mystep - _root.main.bordEasing;
} else if ((NewPosition_arr[0] > _root.main.x_max) && (Math.abs(dirc) < 90)) {
_root.main.sound_bordkick(c, mystep);
var alpha = Math.abs(dirc);
var ac = (NewPosition_arr[0] - _root.main.x_max);
var bc = (ac * Math.tan(_root.main.mpi * alpha));
var ab = Math.sqrt((ac * ac) + (bc * bc));
if (ab > mystep) {
NewPosition_arr[0] = _x;
NewPosition_arr[1] = _y;
} else {
NewPosition_arr = _root.main.mathem_pos(_x, _y, dirc, mystep - ab);
}
dirc = _root.main.normalize(180 - dirc);
mystep = mystep - _root.main.bordEasing;
} else if ((NewPosition_arr[1] < _root.main.y_min) && (dirc < 0)) {
_root.main.sound_bordkick(c, mystep);
var alpha = Math.abs(Math.abs(dirc) - 90);
var ac = (_root.main.y_min - NewPosition_arr[1]);
var bc = (ac * Math.tan(_root.main.mpi * alpha));
var ab = Math.sqrt((ac * ac) + (bc * bc));
if (ab > mystep) {
NewPosition_arr[0] = _x;
NewPosition_arr[1] = _y;
} else {
NewPosition_arr = _root.main.mathem_pos(_x, _y, dirc, mystep - ab);
}
dirc = dirc * -1;
mystep = mystep - _root.main.bordEasing;
} else if ((NewPosition_arr[1] > _root.main.y_max) && (dirc > 0)) {
_root.main.sound_bordkick(c, mystep);
var alpha = Math.abs(Math.abs(dirc) - 90);
var ac = (NewPosition_arr[1] - _root.main.y_max);
var bc = (ac * Math.tan(_root.main.mpi * alpha));
var ab = Math.sqrt((ac * ac) + (bc * bc));
if (ab > mystep) {
NewPosition_arr[0] = _x;
NewPosition_arr[1] = _y;
} else {
NewPosition_arr = _root.main.mathem_pos(_x, _y, dirc, mystep - ab);
}
dirc = dirc * -1;
mystep = mystep - _root.main.bordEasing;
}
}
_root.main.wheel_steps(c, mystep);
if (prevDirc != dirc) {
wheel._rotation = _root.main.normalize(dirc - 180);
}
prevDirc = dirc;
_x = NewPosition_arr[0];
_y = NewPosition_arr[1];
}
};
return(0);
}
function remove_balls() {
var i = 1;
while (i <= existsBalls) {
eval ("b" + i).removeMovieClip();
i++;
}
}
function set_balls() {
var i = 1;
while (i <= existsBalls) {
this.attachMovie("b_" + (i - 1), "b" + i, 100 + i);
eval ("b" + i).outstep = 0;
eval ("b" + i).j_out = 0;
eval ("b" + i).ex = 1;
eval ("b" + i).mystep = 0;
eval ("b" + i).dirc = 0;
eval ("b" + i).wheel._rotation = random(360) - 180;
wheel_steps(i, random(18) + 1);
i++;
}
var exPoss = new Array();
arBalls = new Array();
var bp8 = 0;
var n8num = 9;
var i = 0;
while (i < 20) {
var nr = (random(14) + 2);
if (!exPoss[nr]) {
exPoss[nr] = 1;
arBalls.push(nr);
if (nr == n8num) {
bp8 = arBalls.length - 1;
}
}
i++;
}
var i = 2;
while (i <= 16) {
if (!exPoss[i]) {
exPoss[i] = 1;
arBalls.push(i);
if (i == n8num) {
bp8 = arBalls.length - 1;
}
}
i++;
}
arBalls[bp8] = arBalls[4];
arBalls[4] = n8num;
var nCols = arColumns.length;
var crBall = 0;
var crrpos_x = pos_FirstBall_x;
var crrpos_y = 0;
var i = 0;
while (i < nCols) {
var cm = arColumns[i];
var firstYPos = ((pos_FirstBall_y - ((cm * stepBalls_Y) / 2)) + ball_radius);
var c = 1;
while (c <= cm) {
eval ("b" + arBalls[crBall])._x = crrpos_x;
eval ("b" + arBalls[crBall])._y = firstYPos;
firstYPos = firstYPos + stepBalls_Y;
crBall++;
c++;
}
crrpos_x = crrpos_x - stepBalls_X;
i++;
}
b1._x = pos_WBall_x;
b1._y = pos_WBall_y;
}
function takeBall_out(n) {
if (!eval ("b" + n).ex) {
eval ("b" + n).outstep = 0;
eval ("b" + n).j_out = 0;
eval ("b" + n).ex = 1;
eval ("b" + n).mystep = 0;
eval ("b" + n).dirc = 0;
eval ("b" + n).wheel._rotation = random(360) - 180;
wheel_steps(n, random(18) + 1);
eval ("b" + n)._visible = 1;
eval ("b" + n)._alpha = 100;
eval ("b" + n)._xscale = 100;
eval ("b" + n)._yscale = 100;
var crs = 1;
while (crs) {
if (n == 1) {
eval ("b" + n)._x = 575 + random(150);
} else {
eval ("b" + n)._x = ((ball_diam + 2) + x_offset) + random((field_w - ball_2A_diam) - 4);
}
eval ("b" + n)._y = ((ball_diam + 2) + y_offset) + random((field_h - ball_2A_diam) - 4);
crs = 0;
var c = 1;
while (c <= 16) {
if (n != c) {
if (eval ("b" + n).hitTest(eval ("b" + c))) {
crs = 1;
break;
}
}
c++;
}
}
}
}
function reset_shot_data() {
shotRes_pkBalls = new Array();
shotRes_firstPocket = 0;
shotRes_firstContact = 0;
}
function switch_next() {
game_engine.inshot();
}
function set_game_status(st) {
reset_shot_data();
game_status = st;
if (st == "lobby") {
controls.switch_curr_player(0);
remove_balls();
curr_cue.removeMovieClip();
return(undefined);
}
if (st == "off") {
controls.switch_curr_player(0);
curr_cue.removeMovieClip();
return(undefined);
}
if (st == "run") {
return(undefined);
}
if (st == "player1") {
controls.switch_curr_player(1);
current_player = "1";
this.attachMovie("cue_1", "curr_cue", 5000);
} else if (st == "player2") {
controls.switch_curr_player(2);
current_player = "2";
this.attachMovie("cue_2", "curr_cue", 5000);
} else if (st == "playerR") {
controls.switch_curr_player(2);
current_player = "R";
this.attachMovie("cue_R", "curr_cue", 5000);
}
curr_cue._x = b1._x;
curr_cue._y = b1._y;
}
function game_over(winner_id) {
set_game_status("off");
if (_root.PLAYERS_TYPE == "1") {
winner.show_winner(0);
} else if ((_root.PLAYERS_TYPE == "R") && (winner_id == "2")) {
winner.show_winner("R");
} else {
winner.show_winner(winner_id);
}
}
winner.swapDepths(6000);
soundRat_kick = 3;
soundRat_bordkick = 2;
soundRat_keykick = 3;
soundRat_loose = 4;
field_w = 700;
field_h = 350;
x_offset = 50;
y_offset = 50;
existsBalls = 16;
ball_diam = 20;
easing = 0.12;
bordEasing = 0.12;
pocket_anim_alpha_num_steps = 6;
pocket_anim_scale_out = 70;
pocket_anim_alpha_step = 100 / pocket_anim_alpha_num_steps;
pocket_anim_scale_out_step = (100 - pocket_anim_scale_out) / pocket_anim_alpha_num_steps;
ball_radius = ball_diam / 2;
ball_2radius = ball_radius * ball_radius;
ball_2diam = ball_diam * ball_diam;
ball_2A_diam = ball_diam + ball_diam;
x_min = ball_radius + x_offset;
x_max = (field_w - ball_radius) + x_offset;
y_min = ball_radius + y_offset;
y_max = (field_h - ball_radius) + y_offset;
x_center = (field_w / 2) + x_offset;
y_center = (field_h / 2) + y_offset;
mpi = (Math.PI/180);
centerPocket_width = 40;
cornerSidePocket_width = 24;
h_centerPocket_width = centerPocket_width / 2;
h_cornerSidePocket_width = cornerSidePocket_width / 2;
centerArea_xmin = x_center - 50;
centerArea_xmax = x_center + 50;
leftArea_xmin = x_min - 40;
leftArea_xmax = x_min + 40;
rightArea_xmin = x_max - 40;
rightArea_xmax = x_max + 40;
pocketToBall = 14;
rPocket = 16;
topright_poket = mathem_pos(x_max + ball_radius, y_min - ball_radius, -45, rPocket);
bottright_poket = mathem_pos(x_max + ball_radius, y_max + ball_radius, 45, rPocket);
topleft_poket = mathem_pos(x_min - ball_radius, y_min - ball_radius, -135, rPocket);
bottleft_poket = mathem_pos(x_min - ball_radius, y_max + ball_radius, 135, rPocket);
topcenter_poket = new Array(x_center, (y_min - ball_radius) - rPocket);
bottcenter_poket = new Array(x_center, (y_max + ball_radius) + rPocket);
pocketPositions = new Array();
pocketPositions.top = new Array();
pocketPositions.top.left = new Array();
pocketPositions.top.center = new Array();
pocketPositions.top.right = new Array();
pocketPositions.bottom = new Array();
pocketPositions.bottom.left = new Array();
pocketPositions.bottom.center = new Array();
pocketPositions.bottom.right = new Array();
pocketPositions.top.center.angref_left = 55;
pocketPositions.top.center.angref_right = 125;
pocketPositions.top.center.ang_left = -70;
pocketPositions.top.center.ang_right = -110;
pocketPositions.top.center.ins_left = new Array(x_center - h_centerPocket_width, y_offset);
pocketPositions.top.center.ins_right = new Array(x_center + h_centerPocket_width, y_offset);
pocketPositions.top.center.out_left = mathem_pos(pocketPositions.top.center.ins_left[0], pocketPositions.top.center.ins_left[1], normalize(pocketPositions.top.center.ang_left + 90), ball_radius);
pocketPositions.top.center.out_right = mathem_pos(pocketPositions.top.center.ins_right[0], pocketPositions.top.center.ins_right[1], normalize(pocketPositions.top.center.ang_right - 90), ball_radius);
pocketPositions.bottom.center.angref_left = -55;
pocketPositions.bottom.center.angref_right = -125;
pocketPositions.bottom.center.ang_left = 70;
pocketPositions.bottom.center.ang_right = 110;
pocketPositions.bottom.center.ins_left = new Array(x_center - h_centerPocket_width, y_offset + field_h);
pocketPositions.bottom.center.ins_right = new Array(x_center + h_centerPocket_width, y_offset + field_h);
pocketPositions.bottom.center.out_left = mathem_pos(pocketPositions.bottom.center.ins_left[0], pocketPositions.bottom.center.ins_left[1], normalize(pocketPositions.bottom.center.ang_left - 90), ball_radius);
pocketPositions.bottom.center.out_right = mathem_pos(pocketPositions.bottom.center.ins_right[0], pocketPositions.bottom.center.ins_right[1], normalize(pocketPositions.bottom.center.ang_right + 90), ball_radius);
pocketPositions.top.left.angref_left = -22.5;
pocketPositions.top.left.angref_right = 112.5;
pocketPositions.top.left.ang_left = -135;
pocketPositions.top.left.ang_right = -135;
pocketPositions.top.left.ins_left = new Array(x_offset, y_offset + cornerSidePocket_width);
pocketPositions.top.left.ins_right = new Array(x_offset + cornerSidePocket_width, y_offset);
pocketPositions.top.left.out_left = mathem_pos(pocketPositions.top.left.ins_left[0], pocketPositions.top.left.ins_left[1], normalize(pocketPositions.top.left.ang_left + 90), ball_radius);
pocketPositions.top.left.out_right = mathem_pos(pocketPositions.top.left.ins_right[0], pocketPositions.top.left.ins_right[1], normalize(pocketPositions.top.left.ang_right - 90), ball_radius);
pocketPositions.bottom.left.angref_left = 22.5;
pocketPositions.bottom.left.angref_right = -112.5;
pocketPositions.bottom.left.ang_left = 135;
pocketPositions.bottom.left.ang_right = 135;
pocketPositions.bottom.left.ins_left = new Array(x_offset, (y_offset + field_h) - cornerSidePocket_width);
pocketPositions.bottom.left.ins_right = new Array(x_offset + cornerSidePocket_width, y_offset + field_h);
pocketPositions.bottom.left.out_left = mathem_pos(pocketPositions.bottom.left.ins_left[0], pocketPositions.bottom.left.ins_left[1], normalize(pocketPositions.bottom.left.ang_left - 90), ball_radius);
pocketPositions.bottom.left.out_right = mathem_pos(pocketPositions.bottom.left.ins_right[0], pocketPositions.bottom.left.ins_right[1], normalize(pocketPositions.bottom.left.ang_right + 90), ball_radius);
pocketPositions.top.right.angref_left = 67.5;
pocketPositions.top.right.angref_right = -157.5;
pocketPositions.top.right.ang_left = -45;
pocketPositions.top.right.ang_right = -45;
pocketPositions.top.right.ins_left = new Array((x_offset + field_w) - cornerSidePocket_width, y_offset);
pocketPositions.top.right.ins_right = new Array(x_offset + field_w, y_offset + cornerSidePocket_width);
pocketPositions.top.right.out_left = mathem_pos(pocketPositions.top.right.ins_left[0], pocketPositions.top.right.ins_left[1], normalize(pocketPositions.top.right.ang_left + 90), ball_radius);
pocketPositions.top.right.out_right = mathem_pos(pocketPositions.top.right.ins_right[0], pocketPositions.top.right.ins_right[1], normalize(pocketPositions.top.right.ang_right - 90), ball_radius);
pocketPositions.bottom.right.angref_left = -67.5;
pocketPositions.bottom.right.angref_right = 157.5;
pocketPositions.bottom.right.ang_left = 45;
pocketPositions.bottom.right.ang_right = 45;
pocketPositions.bottom.right.ins_left = new Array((x_offset + field_w) - cornerSidePocket_width, y_offset + field_h);
pocketPositions.bottom.right.ins_right = new Array(x_offset + field_w, (y_offset + field_h) - cornerSidePocket_width);
pocketPositions.bottom.right.out_left = mathem_pos(pocketPositions.bottom.right.ins_left[0], pocketPositions.bottom.right.ins_left[1], normalize(pocketPositions.bottom.right.ang_left - 90), ball_radius);
pocketPositions.bottom.right.out_right = mathem_pos(pocketPositions.bottom.right.ins_right[0], pocketPositions.bottom.right.ins_right[1], normalize(pocketPositions.bottom.right.ang_right + 90), ball_radius);
this.onEnterFrame = function () {
var stop_all = 1;
n = 1;
while (n <= existsBalls) {
if ((!eval ("b" + n).ex) && (!eval ("b" + n).j_out)) {
if (eval ("b" + n).outstep == 0) {
var ar_s = new Array();
switch (eval ("b" + n).pocket) {
case 1 :
ar_s = topleft_poket;
break;
case 2 :
ar_s = topcenter_poket;
break;
case 3 :
ar_s = topright_poket;
break;
case 4 :
ar_s = bottright_poket;
break;
case 5 :
ar_s = bottcenter_poket;
break;
case 6 :
ar_s = bottleft_poket;
break;
default :
eval ("b" + n).j_out = 1;
eval ("b" + n)._visible = 0;
}
eval ("b" + n)._x = ar_s[0];
eval ("b" + n)._y = ar_s[1];
}
eval ("b" + n).outstep++;
if (eval ("b" + n).outstep > pocket_anim_alpha_num_steps) {
eval ("b" + n)._visible = 0;
eval ("b" + n).j_out = 1;
} else {
var scl = (100 - (pocket_anim_scale_out_step * eval ("b" + n).outstep));
eval ("b" + n)._xscale = scl;
eval ("b" + n)._yscale = scl;
eval ("b" + n)._alpha = 100 - (pocket_anim_alpha_step * eval ("b" + n).outstep);
}
} else {
var rs = ballMoving(n);
if ((!rs) && (eval ("b" + n).ex)) {
stop_all = 0;
}
}
n++;
}
if (stop_all && (game_status == "run")) {
switch_next();
}
};
pos_FirstBall_x = 230;
pos_FirstBall_y = y_center;
stepBalls_Y = ball_diam + 2;
stepBalls_X = 18;
arColumns = new Array(1, 2, 3, 4, 5);
pos_WBall_x = 580;
pos_WBall_y = y_center;
reset_shot_data();
game_status = "off";
if (_root.PLAY_GAME == "8ball") {
this.attachMovie("game_8balls", "game_engine", 5100);
} else if (_root.PLAY_GAME == "straight") {
this.attachMovie("game_straight", "game_engine", 5100);
}
Symbol 230 MovieClip Frame 2
game_engine.start_game(_root.PLAYERS_TYPE);
stop();