Frame 1
stop();
Instance of Symbol 31 MovieClip in Frame 1
onClipEvent (enterFrame) {
if (_root.getBytesLoaded() >= _root.getBytesTotal()) {
_root.gotoAndStop(2);
}
}
Frame 2
stop();
Frame 4
stop();
Frame 73
_root.gotoAndPlay("pickBall");
Frame 137
_root.gotoAndPlay("pickBall");
Frame 198
_root.gotoAndPlay("pickBall");
Frame 199
stop();
Frame 200
function playSound(name) {
var snd = new Sound();
snd.attachSound(name);
snd.start();
}
function resetGame() {
initScore();
playerNum = 0;
frameNum = 0;
throwNum = 0;
}
function setVirtual() {
vpin = new Array();
vpin.push({x:TDball._x, y:TDball._y, dx:0, dy:0, width:TDball._width, still:0});
i = 1;
while (10 >= i) {
vpin.push({x:this["TDpin" + i]._x, y:this["TDpin" + i]._y, dx:0, dy:0, width:this["TDpin" + i]._width + 0.5, still:0});
i++;
}
resetBall();
}
function resetBall() {
vpin[0] = {x:TDball._x, y:TDball._y, dx:0, dy:0, width:TDball._width, still:false};
_root.attachMovie("ball " + ballNum, "ball", 9999);
ball.swapDepths("ballx");
ball._y = 421;
ball._xscale = 125;
ball._yscale = 125;
}
function positionBall() {
x = _root._xmouse;
if (x < (ball._x - (ball._width / 2))) {
x = x + (ball._width / 2);
if (x < 40) {
x = 40;
}
ball._x = x;
vpin[0].x = 748 - ((2.4 * (240 - x)) / 6);
arrow._x = x;
bigbutton._x = x;
} else if ((ball._x + (ball._width / 2)) < x) {
x = x - (ball._width / 2);
if (440 < x) {
x = 440;
}
ball._x = x;
vpin[0].x = 748 + ((2.4 * (x - 240)) / 6);
arrow._x = x;
bigbutton._x = x;
}
a = 2 * (_root._xmouse - ball._x);
if (a < -75) {
a = -75;
}
if (75 < a) {
a = 75;
}
arrow._rotation = a;
}
function setTDball() {
TDball._x = vpin[0].x;
TDball._y = vpin[0].y;
i = 1;
while (10 >= i) {
this["TDpin" + i]._x = vpin[i].x;
this["TDpin" + i]._y = vpin[i].y;
i++;
}
}
function startLine() {
throwOver = 0;
line._x = ball._x;
if (0 < arrow._rotation) {
line._rotation = -120;
dline = 5;
} else {
line._rotation = 120;
dline = -5;
}
}
function swingLine() {
line._rotation = line._rotation + dline;
}
function stopLine() {
dline = 0;
desiredAngle = arrow._rotation;
swingAngle = line._rotation;
ballspin = (swingAngle - desiredAngle) / 2000;
playSound("roll");
hitFirstPin = false;
gotoAndStop (210);
}
function initThrow() {
vpin[0].dx = desiredAngle / 10;
vpin[0].dy = -10;
i = 1;
while (10 >= i) {
vpin[i].dx = 0;
vpin[i].dy = 0;
i++;
}
pinsDown = 0;
gutter = false;
ball.gotoAndPlay("roll");
}
function advanceTime() {
output = "";
collisionTimeArray = findTimes();
nextToCollide = findNext();
if (1 < nextToCollide.time) {
advanceAll(1);
} else if (0 < nextToCollide.time) {
advanceAll(nextToCollide.time);
collide(nextToCollide.mc1, nextToCollide.mc2);
if (throwOver == 0) {
throwOver = 1;
}
} else {
collide(nextToCollide.mc1, nextToCollide.mc2);
if (throwOver == 0) {
throwOver = 1;
}
}
if (0 < throwOver) {
throwOver++;
}
if (throwOver >= 60) {
endThrow();
}
}
function endThrow() {
i = 1;
while (10 >= i) {
if (0 < vpin[i].still) {
vpin[i].still = -1;
vpin[i].x = -1000;
this["pin" + i]._x = -1000;
this["pin" + i].gotoAndStop(6);
}
i++;
}
if (pinsDown < 1) {
playSound("miss");
}
addScore(pinsDown);
if ((throwNum == 0) and (pinsDown == 10)) {
throwNum = 1;
}
if (0 < throwNum) {
gotoAndStop (212);
} else {
gotoAndStop (211);
}
}
function startNextThrow() {
throwNum++;
gotoAndPlay (208);
}
function startNextFrame() {
throwNum = 0;
frameNum++;
gotoAndPlay (206);
}
function findNext() {
smallestDist = 999;
smallestMC1 = 0;
smallestMC2 = 0;
i = 1;
while (10 >= i) {
if (!gutter) {
t = pathintercept(0, i, false);
if (t < smallestDist) {
smallestDist = t;
smallestMC1 = 0;
smallestMC2 = i;
}
}
if (0 < vpin[i].still) {
j = 1;
while (10 >= j) {
t = pathintercept(i, j, false);
if (t < smallestDist) {
smallestDist = t;
smallestMC1 = i;
smallestMC2 = j;
}
j++;
}
}
i++;
}
return({time:smallestDist, mc1:smallestMC1, mc2:smallestMC2});
}
function advanceAll(timeToAdvance) {
if ((vpin[0].y < -80) or ((vpin[0].y < -30) and gutter)) {
if (throwOver < 50) {
throwOver = 50;
}
vpin[0].still = -1;
vpin[0].x = -1000;
ball._x = -1000;
} else if (((640 < vpin[0].x) and (vpin[0].x < 850)) and (vpin[0].y >= -80)) {
if (!gutter) {
vpin[0].dx = vpin[0].dx + ballSpin;
vpin[0].x = vpin[0].x + (vpin[0].dx * timeToAdvance);
if ((840 < vpin[0].x) or (vpin[0].x < 665)) {
gutter = true;
}
}
vpin[0].y = vpin[0].y + (vpin[0].dy * timeToAdvance);
percentDownLane = (vpin[0].y + 117) / 635;
percentHorizontal = (vpin[0].x - 748) / 85;
horizRatio = 27 + (205 * percentDownLane);
x = (horizRatio * percentHorizontal) + 240;
y = (percentDownLane * 330) + 90;
if (((640 < vpin[0].x) and (vpin[0].x < 850)) and (vpin[0].y >= -80)) {
ball._x = x;
ball._y = y;
ball._xscale = ((percentDownLane * 0.75) + 0.25) * 125;
ball._yscale = ball._xscale;
} else {
ball._x = -1000;
}
} else {
if (throwOver == 0) {
throwOver = 1;
}
vpin[0].still = -1;
ball._x = -1000;
}
i = 1;
while (10 >= i) {
if (0 < vpin[i].still) {
if (((((6 < (vpin[i].still++)) or (vpin[i].x < 660)) or (830 < vpin[i].x)) or (vpin[i].y < -110)) or (-20 < vpin[i].y)) {
vpin[i].still = -1;
vpin[i].x = -1000;
this["pin" + i]._x = -1000;
this["pin" + i].gotoAndStop(6);
} else {
vpin[i].x = vpin[i].x + (vpin[i].dx * timeToAdvance);
vpin[i].y = vpin[i].y + (vpin[i].dy * timeToAdvance);
this["pin" + i].gotoAndStop(vpin[i].still);
this["pin" + i]._x = this["pin" + i]._x + (vpin[i].dx * timeToAdvance);
}
}
i++;
}
}
function pathIntercept(n1, n2, allValues) {
mc1 = vpin[n1];
mc2 = vpin[n2];
d = (mc1.width / 2) + (mc2.width / 2);
ddx = mc1.dx - mc2.dx;
ddy = mc1.dy - mc2.dy;
dx = mc1.x - mc2.x;
dy = mc1.y - mc2.y;
a = (ddx * ddx) + (ddy * ddy);
if (a == 0) {
return(999999);
}
b = 2 * ((dx * ddx) + (dy * ddy));
c = ((dx * dx) + (dy * dy)) - (d * d);
d = b * b;
e = (4 * a) * c;
if (d < e) {
t = 999999 /* 0x0F423F */;
} else {
t = ((-b) - Math.sqrt(d - e)) / (2 * a);
}
if ((!allValues) and (t < 0)) {
t = 999999 /* 0x0F423F */;
}
return(t);
}
function collide(n1, n2) {
dx = vpin[n2].x - vpin[n1].x;
dy = vpin[n2].y - vpin[n1].y;
if (dx == 0) {
a1 = 1.5707953267939;
} else {
a1 = Math.atan2(dy, dx);
}
dx1 = vpin[n1].dx;
dy1 = vpin[n1].dy;
dx2 = vpin[n2].dx;
dy2 = vpin[n2].dy;
dx = dx1 - dx2;
dy = dy1 - dy2;
if (dx == 0) {
a2 = 1.5707953267939;
} else {
a2 = Math.atan2(dy, dx);
}
if (Math.sin(a2) == 0) {
f = (dx1 - dx2) / Math.cos(a2);
} else {
f = (dy1 - dy2) / Math.sin(a2);
}
f2 = f * Math.cos(a2 - a1);
f1 = f * Math.sin(a2 - a1);
ra1 = ((Math.random() * 17) - 8) / 10000;
ra2 = ((Math.random() * 17) - 8) / 10000;
vpin[n1].dx = f1 * Math.cos((a1 + ra1) + (Math.PI/2));
vpin[n1].dy = f1 * Math.sin((a1 + ra1) + (Math.PI/2));
if (n1 == 0) {
vpin[n1].dx = vpin[n1].dx + dx1;
vpin[n1].dy = vpin[n1].dy + dy1;
if (-5 < vpin[n1]) {
vpin[n1] = -5;
}
}
vpin[n2].dx = f2 * Math.cos(a1 + ra2);
vpin[n2].dy = f2 * Math.sin(a1 + ra2);
if (vpin[n1].still == 0) {
vpin[n1].still = 1;
if (n1 != 0) {
pinsDown++;
}
}
if (vpin[n2].still == 0) {
vpin[n2].still = 1;
if (n2 != 0) {
pinsDown++;
}
}
if (!hitFirstPin) {
hitFirstPin = true;
playSound("hit");
}
}
function initScore() {
score = new Array();
}
function addScore(n) {
score.push(n);
}
function showScore() {
t = 0;
f = 0;
n = 0;
gameover = false;
reward = 0;
i = 0;
while (i < score.length) {
gotSpare = false;
thisThrow = score[i];
if (i < (score.length - 1)) {
nextThrow = score[i + 1];
} else {
nextThrow = -1;
}
if (i < score.length) {
secondThrow = score[i + 2];
} else {
secondThrow = -1;
}
if (((9 < f) and (n == 0)) and (thisThrow == 10)) {
_root.fs09.third = "X";
n++;
reward++;
if (comingOffOf == "spare") {
gameover = true;
}
} else if ((9 < f) and (n == 0)) {
_root.fs09.third = String(thisThrow);
n++;
reward = 0;
if (comingOffOf == "spare") {
gameover = true;
}
} else if (((9 < f) and (n == 1)) and (thisThrow == 10)) {
_root.fs09.fourth = "X";
reward++;
gameover = true;
} else if ((9 < f) and (n == 1)) {
_root.fs09.fourth = thisThrow;
reward = 0;
gameover = true;
} else if ((((n == 0) and (thisThrow == 10)) and (nextThrow != -1)) and (secondThrow != -1)) {
_root["fs0" + f].first = " ";
_root["fs0" + f].second = "X";
t = t + ((thisThrow + nextThrow) + secondThrow);
_root["fs0" + f].total = String(t);
f++;
reward++;
comingOffOf = "strike";
} else if ((((n == 0) and (thisThrow == 10)) and (nextThrow != -1)) and (secondThrow == -1)) {
_root["fs0" + f].first = " ";
_root["fs0" + f].second = "X";
_root["fs0" + f].total = " ";
f++;
reward++;
comingOffOf = "strike";
} else if (((n == 0) and (thisThrow == 10)) and (nextThrow == -1)) {
_root["fs0" + f].first = " ";
_root["fs0" + f].second = "X";
_root["fs0" + f].total = " ";
f++;
reward++;
comingOffOf = "strike";
} else if (n == 0) {
_root["fs0" + f].first = String(thisThrow);
_root["fs0" + f].second = " ";
t = t + thisThrow;
_root["fs0" + f].total = " ";
reward = 0;
n++;
} else if (((n == 1) and ((score[i - 1] + thisThrow) == 10)) and (nextThrow != -1)) {
_root["fs0" + f].second = "/";
t = t + (thisThrow + nextThrow);
_root["fs0" + f].total = String(t);
f++;
gotSpare = true;
n = 0;
comingOffOf = "spare";
} else if (((n == 1) and ((score[i - 1] + thisThrow) == 10)) and (nextThrow == -1)) {
_root["fs0" + f].second = "/";
_root["fs0" + f].total = " ";
f++;
gotSpare = true;
n = 0;
comingOffOf = "spare";
} else if ((n == 1) and ((score[i - 1] + thisThrow) < 10)) {
_root["fs0" + f].second = String(thisThrow);
t = t + thisThrow;
_root["fs0" + f].total = String(t);
f++;
n = 0;
comingOffOf = "nothing";
reward = 0;
if (9 < f) {
gameover = true;
}
}
if (gameover) {
break;
}
i++;
}
if (gameover) {
gotoAndStop (213);
score = t;
scorecheck = String(t);
} else if (reward == 3) {
rewardMC.gotoAndStop("turkey");
} else if (reward == 2) {
rewardMC.gotoAndStop("double");
} else if ((reward == 1) or (3 < reward)) {
rewardMC.gotoAndStop("strike");
} else if (gotSpare) {
rewardMC.gotoAndPlay("spare");
} else {
rewardMC.gotoAndStop(1);
}
}
resetGame();
Frame 207
setVirtual();
Frame 208
stop();
Instance of Symbol 115 MovieClip in Frame 208
onClipEvent (load) {
_root.resetBall();
}
onClipEvent (enterFrame) {
_root.positionBall();
}
Instance of Symbol 116 MovieClip in Frame 209
onClipEvent (enterFrame) {
_root.swingLine();
}
Instance of Symbol 119 MovieClip in Frame 210
onClipEvent (load) {
_root.initThrow();
}
onClipEvent (enterFrame) {
_root.advanceTime();
}
Frame 211
showScore();
stop();
Frame 212
showScore();
stop();
Frame 213
showScore();
stop();
Instance of Symbol 155 MovieClip in Frame 213
onClipEvent (load) {
if ((_root.scoremode != "guestonly") and (_root.scoremode != "normal")) {
this._visible = false;
}
}
Symbol 14 MovieClip [ball 3] Frame 1
stop();
Symbol 14 MovieClip [ball 3] Frame 7
gotoAndPlay (3);
Symbol 20 MovieClip [ball 1] Frame 1
stop();
Symbol 20 MovieClip [ball 1] Frame 7
gotoAndPlay (3);
Symbol 25 MovieClip [ball 2] Frame 1
stop();
Symbol 25 MovieClip [ball 2] Frame 7
gotoAndPlay (3);
Symbol 26 MovieClip [ball 3] Frame 1
stop();
Symbol 26 MovieClip [ball 3] Frame 7
gotoAndPlay (3);
Symbol 27 MovieClip [ball 1] Frame 1
stop();
Symbol 27 MovieClip [ball 1] Frame 7
gotoAndPlay (3);
Symbol 28 MovieClip [ball 2] Frame 1
stop();
Symbol 28 MovieClip [ball 2] Frame 7
gotoAndPlay (3);
Symbol 54 Button
on (press) {
gotoAndPlay (4);
}
Symbol 59 Button
on (release) {
gotoAndPlay (13);
}
Symbol 60 Button
on (release) {
gotoAndPlay (13);
}
Symbol 61 Button
on (release) {
gotoAndPlay (75);
}
Symbol 62 Button
on (release) {
gotoAndPlay (75);
}
Symbol 63 Button
on (release) {
gotoAndPlay (139);
}
Symbol 64 Button
on (release) {
gotoAndPlay (139);
}
Symbol 81 Button
on (press) {
ballNum = 1;
gotoAndPlay (199);
}
Symbol 82 Button
on (press) {
ballNum = 2;
gotoAndPlay (199);
}
Symbol 83 Button
on (press) {
ballNum = 3;
gotoAndPlay (199);
}
Symbol 84 Button
on (press) {
ballNum = 3;
gotoAndPlay (199);
}
Symbol 101 MovieClip Frame 1
stop();
Symbol 102 MovieClip Frame 1
stop();
Symbol 113 Button
on (press) {
_root.gotoAndStop("line");
_root.startLine();
}
on (release) {
_root.stopLine();
}
Symbol 147 MovieClip Frame 1
stop();
Symbol 147 MovieClip Frame 15
r = Math.floor(Math.Random() * 5) + 1;
if (r < 4) {
_root.playSound("spare" + r);
}
stop();
Symbol 147 MovieClip Frame 19
stop();
Symbol 147 MovieClip Frame 36
stop();
Symbol 147 MovieClip Frame 55
stop();
Symbol 147 MovieClip Frame 74
stop();
Symbol 148 Button
on (press) {
startNextThrow();
}
Symbol 150 Button
on (press) {
startNextFrame();
}
Symbol 151 Button
on (press) {
gotoAndPlay (2);
}
Symbol 153 Button
on (release) {
extra = "";
stats = stats + "";
_root.loadMovie((((((((((((("game.swf?score=" + _root.score) + "&scorecheck=") + _root.scorecheck) + "&extra=") + extra) + "&stats=") + stats) + "&scoremode=") + _root.scoremode) + "&gamename=") + _root.gamename) + "&textname=") + _root.textname, _root);
}