Frame 2
function gameInit() {
blnPause = false;
blnMouse = true;
btnCtrl.useHandCursor = false;
_parent.gameStart();
sweeper.swapDepths(220);
mcBackground.swapDepths(95);
mcTopBG.swapDepths(8000);
mcStatusBar.swapDepths(8032);
mcForce.swapDepths(8020);
mcQuitSubmit.swapDepths(8011);
mcShowScore.swapDepths(8012);
mcSoundOff.swapDepths(8013);
mcRules.swapDepths(8014);
mcHelp.swapDepths(98);
mcScores.swapDepths(8019);
mcSoundOff.btnSoundOn._visible = false;
mcHandsWithBall.swapDepths(this.getNextHighestDepth());
this.attachMovie("mcSweeperMask", "mcSweeperMask", 1348);
mcSweeperMask._y = 10._y;
mcSweeperMask._x = 10._x;
sweeper.setMask(mcSweeperMask);
}
function loud(device, infinite, snd, vol) {
if (!blnSoundOff) {
if (vol > -1) {
eval ("snd" + device).setVolume(vol);
}
eval ("snd" + device).attachSound(snd);
if (infinite) {
eval ("snd" + device).start(0, 999);
} else {
eval ("snd" + device).start(0, 1);
}
}
}
function roundInit() {
mcArrow.removeMovieClip();
removeMovieClip(mcBall);
removeMovieClip(mcRollArrow);
mcForce.gotoAndStop("stay");
strState = "ballPos";
Mouse.hide();
blnMouse = false;
blnBorder = false;
blnBorderRoll = false;
viewHeightDist = 300;
blnAllowThr = false;
blnRoll = false;
blnSplit = false;
sideFwdTState = 0;
if (!blnFirstFrame) {
blnStrike = false;
blnSpare = false;
fallCnt = 0;
i = 1;
while (i < 11) {
j = 1;
while (j < 11) {
arrPin2Pin[i][j] = 0;
j++;
}
if (arrFalling[i] == 1) {
arrFalling[i] = -1;
fallCnt++;
}
i++;
}
if ((!blnSecondThrow) && (fallCnt >= 5)) {
dSplit = (center - leftBoard) - 3;
i = 1;
while (i < 11) {
if (arrFalling[i] == 0) {
j = 1;
while (j < 11) {
if ((arrFalling[j] == 0) && (Math.abs(eval (i)._x - eval (j)._x) > dSplit)) {
blnSplit = true;
break;
}
j++;
}
}
i++;
}
}
totalPins = totalPins + fallCnt;
totalPinCnt = totalPinCnt + fallCnt;
if (blnSecondThrow) {
if (totalPinCnt == 10) {
blnSpare = true;
}
printScores(fallCnt);
if (blnSpare && (numFrame >= 10)) {
if (lastStrikeState == 0) {
lastStrikeState = 2;
}
}
totalPinCnt = 0;
sweeper.gotoAndPlay("refresh");
numFrame++;
blnSecondThrow = false;
} else if (fallCnt == 10) {
blnStrike = true;
sweeper.gotoAndPlay("refresh");
totalPinCnt = 0;
printScores(fallCnt);
if (numFrame == 10) {
lastStrikeState = 1;
}
numFrame++;
blnSecondThrow = false;
} else {
sweeper.gotoAndPlay("sweep");
printScores(fallCnt);
blnSecondThrow = true;
}
strState = "wait";
if ((numFrame > 10) && ((lastStrikeState == 0) || (lastStrikeState > 2))) {
gameOver();
sweeper.removeMovieClip();
mcSweeperMask.removeMovieClip();
}
}
if (blnFirstFrame) {
blnFirstFrame = false;
pinScale = eval (1)._xscale;
i = 1;
while (i < 11) {
j = 1;
while (j < 11) {
arrPin2Pin[i][j] = 0;
j++;
}
arrFalling[i] = 0;
arrPinX[i] = eval (i)._x;
arrPinY[i] = eval (i)._y;
i++;
}
destributePinDepths();
}
if (blnStrike) {
mcStatusBar.txtStatus.text = "strike!";
} else if (blnSpare) {
mcStatusBar.txtStatus.text = "spare!";
}
}
function gameOver() {
Mouse.show();
blnMouse = true;
mcScores.txtTotal.text = totalScores;
strState = "wait";
waitFrames = 100000 /* 0x0186A0 */;
mcScores.txtGameOver.text = "GAME OVER";
_parent.setScore(totalScores);
trace("total Score are: " + totalScores);
_parent.gameOver();
}
function newGame() {
i = 0;
while (i < 3) {
loan[i] = 0;
i++;
}
numFrame = 1;
lastStrikeState = 0;
i = 1;
while (i < 11) {
mcScores["f" + i].text = " ";
mcScores[("f" + i) + "a"].text = " ";
mcScores[("f" + i) + "b"].text = " ";
mcScores["f" + i]._visible = false;
i++;
}
mcScores.f10c.text = "";
mcScores.txtTotal.text = "";
mcScores.txtPinTotal.text = "";
totalPins = 0;
waitFrames = 50;
waitCnt = 0;
totalScores = 0;
blnSecondThrow = false;
mcStatusBar.txtStatus.text = "";
}
function arrangePins() {
i = 1;
while (i < 11) {
arrFalling[i] = 0;
eval (i).removeMovieClip();
this.attachMovie("mcPin", i, pinDepth + i);
eval (i)._x = arrPinX[i];
eval (i)._y = arrPinY[i];
eval (i)._xscale = pinScale;
eval (i)._yscale = pinScale;
i++;
}
i = 0;
while (i < 4) {
delete eval ("depthLayer" + i);
i++;
}
depthLayer1 = new Array();
depthLayer2 = new Array();
depthLayer3 = new Array();
depthLayer0 = new Array();
destributePinDepths();
}
function printScores(pins) {
var _local1 = 0;
var _local3 = 0;
if (blnStrike) {
loud(13, false, "strike", 100);
}
if (blnSpare) {
loud(13, false, "spare", 100);
} else {
loud(13, false, "scorecard", 100);
}
totalScores = totalScores + pins;
i = 0;
while (i < 3) {
if (((loan[i] > 0) && (_local1 != loan[i])) && (_local3 != loan[i])) {
if (lastStrikeState < 1) {
totalScores = totalScores + pins;
} else if (loan[i] == 9) {
totalScores = totalScores + pins;
}
if (_local1 == 0) {
_local1 = loan[i];
} else {
_local3 = loan[i];
}
mcScores["f" + loan[i]].text = Number(mcScores["f" + loan[i]].text) + pins;
if (_local3 > 0) {
mcScores["f" + _local1].text = Number(mcScores["f" + _local1].text) + pins;
}
loan[i] = 0;
}
i++;
}
if (lastStrikeState >= 1) {
if (lastStrikeState == 1) {
if (blnStrike) {
mcScores.f10b.text = "X";
} else if (blnSpare) {
mcScores.f10b.text = "/";
} else {
mcScores.f10b.text = pins;
}
}
if (lastStrikeState == 2) {
if (blnStrike) {
mcScores.f10c.text = "X";
} else if (blnSpare) {
mcScores.f10c.text = "/";
} else {
mcScores.f10c.text = pins;
}
}
} else if (blnStrike) {
i = 0;
while (i < 3) {
if (loan[i] == 0) {
loan[i] = numFrame;
break;
}
i++;
}
i = 0;
while (i < 3) {
if (loan[i] == 0) {
loan[i] = numFrame;
break;
}
i++;
}
mcScores[("f" + numFrame) + "a"].text = "X";
} else if (blnSpare) {
i = 0;
while (i < 3) {
if (loan[i] == 0) {
loan[i] = numFrame;
break;
}
i++;
}
mcScores[("f" + numFrame) + "b"].text = "/";
} else {
if (pins == 0) {
tmp = "-";
} else {
tmp = pins;
}
if (blnSecondThrow) {
mcScores[("f" + numFrame) + "b"].text = tmp;
} else {
mcScores[("f" + numFrame) + "a"].text = tmp;
}
}
if (blnStrike || (blnSecondThrow)) {
mcScores["f" + numFrame].text = totalScores;
i = 0;
while (i < 3) {
if (loan[i] == numFrame) {
break;
}
i++;
}
if (i == 3) {
mcScores["f" + numFrame]._visible = true;
}
}
j = 1;
while (j < numFrame) {
i = 0;
while (i < 3) {
if (loan[i] == j) {
break;
}
i++;
}
if (i == 3) {
mcScores["f" + j]._visible = true;
}
j++;
}
if (lastStrikeState > 0) {
lastStrikeState++;
}
info._xscale = 70;
info._yscale = 70;
info._x = center;
info._y = -35;
info.gotoAndPlay(1);
}
function destributePinDepths() {
i = 1;
while (i < 11) {
obj = eval (i);
obj.state = "stay";
if (i < 5) {
depthLayer1[i] = 1;
obj.swapDepths(100 + i);
obj.layer = 1;
} else if (i < 8) {
depthLayer2[i] = 1;
obj.swapDepths(120 + i);
obj.layer = 2;
} else if (i < 10) {
depthLayer3[i] = 1;
obj.swapDepths(140 + i);
obj.layer = 3;
} else if (i == 10) {
obj.swapDepths(160);
obj.layer = 4;
}
i++;
}
}
function ballPos() {
var _local3 = 4;
var _local4 = (this._xmouse - mcHandsWithBall._x) / _local3;
var _local2 = mcHandsWithBall._x + _local4;
if (!((_local2 < (leftBorder + 60)) || (_local2 > (rightBorder - 60)))) {
mcHandsWithBall._x = _local2;
} else if (_local2 < (leftBorder + 60)) {
mcHandsWithBall._x = leftBorder + 60;
} else {
mcHandsWithBall._x = rightBorder - 60;
}
if (_ymouse < 60) {
Mouse.show();
blnMouse = true;
} else {
Mouse.hide();
blnMouse = false;
}
}
function force() {
var _local1 = 3;
mcArrow._x = mcArrow._x + ((_xmouse - mcArrow._x) / _local1);
mcArrow._y = mcArrow._y + ((_ymouse - mcArrow._y) / _local1);
forceStrike = (startForceY - _ymouse) / forceYLength;
if (forceStrike > 1) {
forceStrike = 1;
}
if (forceStrike < 0) {
forceStrike = 0;
}
mcForce.gotoAndStop(2 + Math.round(16 * forceStrike));
visualAngle = Math.atan((_xmouse - mcHandsWithBall._x) / (_ymouse - gameHeight));
mcArrow._rotation = (-180 * visualAngle) / PI;
}
function roll() {
if (blnAllowThr) {
if (!blnRoll) {
blnRoll = true;
this.attachMovie("mcBall", "mcBall", 9999);
mcBall._x = mcHandsWithBall._x;
mcBall._y = gameHeight + 25;
this.attachMovie("mcRollArrow", "mcRollArrow", this.getNextHighestDepth());
steering();
rollVol = (90 * Math.pow(Math.sqrt((dY * dY) + (dX * dX)) / maxSpeed, 0.5)) + 40;
loud(12, true, "roll1", rollVol);
loud(11, false, "throw", rollVol * 1.2);
trace((dY + " ") + dX);
rollSndState = 1;
mcStatusBar.txtStatus.text = "";
}
mcRollArrow._x = this._xmouse;
mcRollArrow._y = this._ymouse;
switch (numCalc) {
case 0 :
numCalc++;
distRatio = viewDistStart / Math.sqrt((viewHeightDist * viewHeightDist) + (viewHeight * viewHeight));
viewCos = Math.sqrt(Math.cos(Math.atan(viewHeightDist / viewHeight)));
mcBall._yscale = distRatio * 100;
mcBall._xscale = mcBall._yscale;
break;
case 1 :
numCalc++;
distRatio = viewDistStart / Math.sqrt((viewHeightDist * viewHeightDist) + (viewHeight * viewHeight));
mcBall._yscale = distRatio * 100;
mcBall._xscale = mcBall._yscale;
snd12.setVolume(distRatio * rollVol);
steering();
case 2 :
if (blnBorderRoll) {
if (((gameHeight - mcBall._y) / ((mcBall._x - leftBorder) + 12)) > bATang) {
mcBall._x = mcBall._x + 0.3;
} else if (((gameHeight - mcBall._y) / ((rightBorder + 8) - mcBall._x)) > bATang) {
mcBall._x = mcBall._x - 0.3;
}
}
numCalc = 1;
viewCos = Math.sqrt(Math.cos(Math.atan(viewHeightDist / viewHeight)));
break;
default :
numCalc++;
}
if ((((((((gameHeight - mcBall._y) / (mcBall._x - leftBorder)) > bATang) || (((gameHeight - mcBall._y) / (rightBorder - mcBall._x)) > bATang)) && (!blnBorderRoll)) && (!blnBorder)) && (strState != "ballFalls")) && (mcBall._y > boardTopY)) {
dX1 = dX1 * 1.7;
if (Math.abs(dX1) < (minBorderX * distRatio)) {
dX1 = minBorderX * distRatio;
}
if (Math.abs(dX1) > (maxBorderX * distRatio)) {
dX1 = maxBorderX * distRatio;
}
if (mcBall._x >= center) {
dX1 = Math.abs(dX1);
} else {
dX1 = -Math.abs(dX1);
}
blnBorder = true;
snd12.stop();
mcRollArrow.removeMovieClip();
dY1 = dY1 * 0.4;
vel = Math.sqrt((dY * dY) + (dX * dX)) * Math.abs(1 - (0.6 * Math.abs(dX / dY)));
loud(13, false, "throw", 20 + ((((80 * Math.abs(dX / dY)) * vel) / maxSpeed) * distRatio));
loud(13, false, "knock2", 20 + ((((60 * Math.abs(dX / dY)) * vel) / maxSpeed) * distRatio));
}
if (blnBorder) {
if (((gameHeight - mcBall._y) / ((rightBorder + 12) - mcBall._x)) > bATang) {
blnBorder = false;
while (((gameHeight - mcBall._y) / ((rightBorder + 12) - mcBall._x)) > bATang) {
mcBall._x--;
}
vel = Math.sqrt((dY * dY) + (dX * dX)) * Math.abs(1 - (0.6 * Math.abs(dX / dY)));
dX = (-Math.cos(borderAngle)) * vel;
dY = (-Math.sin(borderAngle)) * vel;
dX1 = (dX * distRatio) * viewCos;
dY1 = (dY * distRatio) * viewCos;
blnBorderRoll = true;
rollVol = 100 * Math.pow(vel / maxSpeed, 0.6);
loud(12, true, "roll2", rollVol * distRatio);
rollSndState = -1;
}
if (((gameHeight - mcBall._y) / ((mcBall._x - leftBorder) + 12)) > bATang) {
blnBorder = false;
while (((gameHeight - mcBall._y) / ((mcBall._x - leftBorder) + 12)) > bATang) {
mcBall._x++;
}
vel = Math.sqrt((dY * dY) + (dX * dX)) * Math.abs(1 - (0.6 * Math.abs(dX / dY)));
dX = Math.cos(borderAngle) * vel;
dY = (-Math.sin(borderAngle)) * vel;
dX1 = (dX * distRatio) * viewCos;
dY1 = (dY * distRatio) * viewCos;
blnBorderRoll = true;
rollVol = 100 * Math.pow(vel / maxSpeed, 0.6);
loud(12, true, "roll2", rollVol * distRatio);
rollSndState = -1;
}
} else if (strState != "ballFalls") {
dX1 = (dX * distRatio) * viewCos;
dY1 = (dY * distRatio) * viewCos;
viewHeightDist = viewHeightDist - dY;
} else {
dY1 = dY1 + 0.6;
}
mcBall._y = mcBall._y + dY1;
mcBall._x = mcBall._x + dX1;
}
if (mcBall._y < (boardTopY + 70)) {
fallD = (((-dY) / fSpeed) * 1.5) - 0.7;
x = mcBall._x;
i = 1;
while (i < 11) {
obj = eval (i);
var r = (((obj._x - x) * (obj._x - x)) + ((obj._y - mcBall._y) * (obj._y - mcBall._y)));
dH = (-dY1) * 0.3;
if (((((((arrFalling[i] == 0) && (r < (((ballR + 8) + dH) * ((ballR + 8) + dH)))) && (r > 1)) && (Math.abs(obj._x - x) < (ballR + 8.5))) && (obj._y < (mcBall._y - 4))) && (strState != "ballFalls")) && (!blnBorderRoll)) {
var dR = Math.abs(obj._x - x);
var pinId = obj._name;
if (obj._x < mcBall._x) {
obj._xscale = -Math.abs(obj._xscale);
} else {
obj._xscale = Math.abs(obj._xscale);
}
arrFalling[i] = 1;
if (random(2) == 1) {
loud(i, false, "knock1", (30 * fallD) + 30);
} else {
loud(i, false, "knock5", 40 * fallD);
}
if (dY <= (-fSpeed)) {
if (dR > (ballR + 3)) {
if ((((pinId == "1") || (pinId == "5")) && (obj._x < x)) || (((pinId == "4") || (pinId == "7")) && (obj._x >= x))) {
obj.gotoAndPlay("sideReflect");
obj.state = "sideReflect";
} else if (((obj._x < (center - 2)) && (x < obj._x)) || ((obj._x > (center + 2)) && (x >= obj._x))) {
obj.gotoAndPlay("side");
obj.state = "side";
} else {
obj.gotoAndPlay("sideFast");
obj.state = "sideFast";
}
} else if ((dR <= (ballR + 3)) && (dR > 5)) {
switch (pinId) {
case "10" :
if (((x > obj._x) && (arrFalling[8] == 0)) || ((x <= obj._x) && (arrFalling[9] == 0))) {
obj.gotoAndPlay("sideFwdT");
obj.state = "sideFwdT";
} else {
obj.gotoAndPlay("sideFwd");
obj.state = "sideFwd";
}
break;
case "8" :
if (((x > obj._x) && (arrFalling[5] == 0)) || ((x <= obj._x) && (arrFalling[6] == 0))) {
obj.gotoAndPlay("sideFwdT");
obj.state = "sideFwdT";
} else {
obj.gotoAndPlay("sideFwd");
obj.state = "sideFwd";
}
break;
case "9" :
if (((x > obj._x) && (arrFalling[6] == 0)) || ((x <= obj._x) && (arrFalling[7] == 0))) {
obj.gotoAndPlay("sideFwdT");
obj.state = "sideFwdT";
} else {
obj.gotoAndPlay("sideFwd");
obj.state = "sideFwd";
}
break;
default :
if ((piId == "1") || (pinId == "4")) {
obj.gotoAndPlay("sideFwdWeakF");
obj.state = "sideFwdWeakF";
} else {
obj.gotoAndPlay("sideFwd");
obj.state = "sideFwd";
}
}
} else {
obj.gotoAndPlay("forward");
obj.state = "forward";
}
} else if (dR > (ballR + 3)) {
if (((((pinId == "1") || (pinId == "4")) || (pinId == "5")) || (pinId == "7")) && (Math.abs(x - center) < Math.abs(obj._x - center))) {
obj.gotoAndPlay("sideFwdWeakF");
obj.state = "sideFwdWeakF";
} else {
obj.gotoAndPlay("sideWeak");
obj.state = "sideWeak";
}
} else if ((dR <= (ballR + 3)) && (dR > 7)) {
if (Number(pinId) < 8) {
obj.gotoAndPlay("sideFwdWeakF");
obj.state = "sideFwdWeakF";
} else {
obj.gotoAndPlay("sideFwdWeak1");
obj.state = "sideFwdWeak1";
}
} else if (Number(pinId) < 8) {
obj.gotoAndPlay("forwardWeak");
obj.state = "forwardWeak";
} else {
obj.gotoAndPlay("forwardT");
obj.state = "forwardT";
}
}
i++;
}
delete layer1;
delete layer2;
delete layer3;
delete layer0;
layer1 = new Array();
layer2 = new Array();
layer3 = new Array();
layer0 = new Array();
i = 1;
while (i < 11) {
obj = eval (i);
if (arrFalling[i] == 1) {
if (obj.layer == 1) {
layer1.push(i);
if (depthLayer1[i] != 1) {
depthLayer1[i] = 1;
depthLayer2[i] = 0;
obj.swapDepths(100 + i);
}
} else if (obj.layer == 2) {
layer2.push(i);
if (depthLayer2[i] != 1) {
depthLayer2[i] = 1;
depthLayer3[i] = 0;
obj.swapDepths(120 + i);
}
} else if (obj.layer == 3) {
layer3.push(i);
if (depthLayer3[i] != 1) {
depthLayer3[i] = 1;
depthLayer4[i] = 0;
obj.swapDepths(140 + i);
}
} else if (obj.layer <= 0) {
layer0.push(i);
if (depthLayer0[i] != 1) {
depthLayer0[i] = 1;
depthLayer1[i] = 0;
obj.swapDepths(80 + i);
}
}
}
i++;
}
i = 1;
while (i < 11) {
if (arrFalling[i] == 0) {
obj = eval (i);
if (obj.layer != 4) {
curLayer = eval ("layer" + obj.layer);
k = curLayer.length;
} else {
k = 0;
}
j = 0;
while (j < k) {
pul = eval (curLayer[j]);
if (((((((pul.hitTest(obj._x + 3, obj._y - 3, true) || (pul.hitTest(obj._x + 3, obj._y + 13, true))) || (pul.hitTest(obj._x + 3, obj._y + 5, true))) || (pul.hitTest(obj._x - 3, obj._y - 3, true))) || (pul.hitTest(obj._x - 3, obj._y + 5, true))) || (pul.hitTest(obj._x - 3, obj._y + 13, true))) && (obj.state != "tremble")) && (arrPin2Pin[curLayer[j]][i] == 0)) {
arrFalling[i] = 1;
obj._xscale = pul._xscale;
switch (pul.state) {
case "side" :
if ((random(3) == 1) || (blnSplit)) {
obj.gotoAndPlay("sideFwdWeakF");
obj.state = "sideFwdWeakF";
} else {
arrFalling[i] = 0;
obj.gotoAndPlay("tremble");
obj.state = "tremble";
}
break;
case "sideWeak" :
if (((Math.abs(obj._x - center) < (1.5 * ballR)) || (Math.abs(obj._x - center) < Math.abs(pul._x - center))) && (random(3) == 1)) {
obj.gotoAndPlay("sideWeak");
obj.state = "sideWeak";
obj._rotation = (pul._xscale / Math.abs(pul._xscale)) * 10;
} else {
arrFalling[i] = 0;
obj.gotoAndPlay("tremble");
obj.state = "tremble";
}
break;
case "forward" :
if (Math.abs(obj._x - pul._x) < 4) {
obj._xscale = obj._xscale * -1;
obj.gotoAndPlay("forwardWeak");
obj.state = "forwardWeak";
} else {
arrFalling[i] = 0;
obj.gotoAndPlay("tremble");
obj.state = "tremble";
}
break;
case "forwardWeak" :
arrFalling[i] = 0;
break;
case "sideFast" :
if ((random(6) < (2 * fallD)) || (blnSplit)) {
if (Math.abs(obj._x - center) < (1.7 * ballR)) {
obj._rotation = (pul._xscale / Math.abs(pul._xscale)) * 15;
obj.gotoAndPlay("sideFast");
obj.state = "sideFast";
} else {
obj.gotoAndPlay("sideFwdWeakF");
obj.state = "sideFwdWeakF";
}
} else {
arrFalling[i] = 0;
}
break;
case "sideReflect" :
arrFalling[i] = 0;
break;
case "forwardT" :
if (Math.abs(obj._x - pul._x) < 3) {
obj._xscale = obj._xscale * -1;
obj.gotoAndPlay("forwardWeak");
obj.state = "forwardWeak";
} else if ((random(16) < ((fallD * 5) - 2)) && (i < 5)) {
obj.gotoAndPlay("forwardWeak");
obj.state = "forwardWeak";
} else {
arrFalling[i] = 0;
}
break;
case "sideFwdT" :
if (Math.abs(obj._x - pul._x) > (ballR * 1.5)) {
if ((random(9) > 3) || (blnSplit)) {
arrFalling[i] = 0;
obj.gotoAndPlay("tremble");
obj.state = "tremble";
} else if (random(13) < (fallD * 3)) {
obj.gotoAndPlay("forwardWeak");
obj.state = "forwardWeak";
} else {
arrFalling[i] = 0;
}
} else if ((random(7) > 0) || (blnSplit)) {
if (curLayer[j] < 8) {
obj.gotoAndPlay("forwardWeak");
obj.state = "forwardWeak";
} else {
obj.gotoAndPlay("forwardT");
obj.state = "forwardT";
}
} else {
arrFalling[i] = 0;
obj.gotoAndPlay("tremble");
obj.state = "tremble";
}
break;
case "sideFwdT2" :
if (i < 5) {
obj.gotoAndPlay("sideFwdWeakF");
obj.state = "sideFwdWeakF";
}
break;
case "sideFwdWeakF" :
if ((random(3) == 1) || (blnSplit)) {
obj.gotoAndPlay("forwardWeak");
obj.state = "forwardWeak";
} else {
arrFalling[i] = 0;
obj.gotoAndPlay("tremble");
obj.state = "tremble";
}
break;
case "sideFwdWeak1" :
if ((random(14) < (fallD * 8)) || (blnSplit)) {
if (curLayer[j] < 8) {
obj.gotoAndPlay("forwardWeak");
obj.state = "forwardWeak";
} else {
obj.gotoAndPlay("sideFwdWeak1");
obj.state = "sideFwdWeak1";
obj._rotation = (pul._xscale / Math.abs(pul._xscale)) * 20;
}
} else {
arrFalling[i] = 0;
}
break;
case "sideFwd" :
arrFalling[i] = 0;
}
arrPin2Pin[curLayer[j]][i] = 1;
if (arrFalling[i] == 1) {
loud(i, false, "knock2", 40 + ((100 * dY) / maxSpeed));
}
}
j++;
}
}
i++;
}
if ((mcBall._y < (boardTopY - 12)) && (strState != "ballFalls")) {
depthLayer1[11] = 1;
depthLayer2[11] = 0;
mcBall.swapDepths(111);
} else if ((mcBall._y < (boardTopY - 3)) && (strState != "ballFalls")) {
depthLayer2[11] = 1;
depthLayer3[11] = 0;
mcBall.swapDepths(131);
} else if ((mcBall._y < (boardTopY + 4)) && (strState != "ballFalls")) {
depthLayer3[11] = 1;
mcBall.swapDepths(151);
}
}
if (((((mcBall._y < (boardTopY - 13)) && (!blnBorderRoll)) || ((mcBall._y < (boardTopY - 9)) && (blnBorderRoll))) && (strState != "ballFalls")) && (!blnBorder)) {
depthLayer0[11] = 1;
depthLayer1[11] = 0;
mcBall.swapDepths(91);
strState = "ballFalls";
mcRollArrow.removeMovieClip();
dX = dX * 0.4;
dX1 = dX1 * 0.4;
i = 1;
while (i < 11) {
dY1 = dY1 * 0.1;
i++;
}
snd12.stop();
if (fallCnt > 0) {
loud(13, false, "maschine", 100);
} else {
loud(13, false, "maschine", 50);
}
fallCnt = 0;
}
if ((mcBall._y > (boardTopY + 600)) && (strState == "ballFalls")) {
roundInit();
}
}
function steering() {
if (((!blnBorder) && (!blnBorderRoll)) && (mcRollArrow._x > -1)) {
arrowAngle = (-steerRatio) * (mcBall._x - this._xmouse);
if (Math.abs(arrowAngle) > 1.2) {
arrowAngle = (Math.abs(arrowAngle) / arrowAngle) * 1.2;
}
var tmpDX = dX;
dX = dX - ((arrowAngle * 0.1) * dY);
var gf = ((-dX) / dY);
if (!((gf < (-MATan)) || (gf > MATan))) {
mcRollArrow._rotation = ((-180 / PI) * Math.atan(dX / dY)) + arrowAngle;
cX = 0;
cY = arrowLength / 2;
aX = (Math.sin(arrowAngle) * arrowLength) / 2;
aY = (arrowLength / 2) + ((Math.cos(arrowAngle) * arrowLength) / 2);
with (mcRollArrow) {
mcArrowBack.clear();
mcArrowBack.moveTo(0, 0);
mcArrowBack.lineStyle(10, 3381759, 100);
mcArrowBack.curveTo(cX, cY, aX, aY);
mcArrowBack.moveTo(0, 0);
mcArrowBack.lineStyle(8, 16777215, 100);
mcArrowBack.curveTo(cX, cY, aX, aY);
}
} else {
dX = tmpDX;
}
}
}
function gamePause(flag) {
if (flag) {
Mouse.show();
} else if (!blnMouse) {
Mouse.hide();
}
blnPause = flag;
}
stop();
var gameHeight = 600;
var gameWidth = 800;
var strState;
var PI = Math.PI;
var viewHeight = 275;
var viewHeightDist = 300;
var angleRatio = 1.5;
var steerRatio = 0.01;
var leftBorder = 6;
var rightBorder = 795;
var leftBoard = 333;
var boardTopY = 210;
var center = (((rightBorder - leftBorder) / 2) + leftBorder);
var rightBoard = (rightBorder - (leftBoard - leftBorder));
var borderAngle = Math.atan((gameHeight - boardTopY) / (leftBoard - leftBorder));
var borderProect = (borderAngle / (PI - borderAngle));
var bATang = Math.tan(borderAngle);
var blnAllowThr = false;
var startForceY = (gameHeight - 170);
var forceYLength = 130;
var forceStrike;
var sideFwdTState = 0;
var ballR = 16;
var blnRoll = false;
var numCalc = 0;
var viewCos;
var distRatio;
var viewDistStart = Math.sqrt((viewHeight * viewHeight) + (viewHeightDist * viewHeightDist));
var viewDist = viewDistStart;
var dY;
var dY1;
var dX;
var dX1;
var maxAngle = 0.4;
var MATan = 0.8;
var maxSpeed = 50;
var minSpeed = 10;
var visualAngle = 0;
var moveAngle = 0;
var azimuth;
var blnBorder = false;
var blnBorderRoll = false;
var minBorderX = 1.5;
var maxBorderX = 3;
var arrFalling = new Array();
var blnFirstFrame = true;
var arrPin2Pin = new Array();
i = 0;
while (i < 11) {
arrPin2Pin[i] = new Array();
i++;
}
var pinDepth = 100;
var arrPinX = new Array();
var arrPinY = new Array();
var layer1 = new Array();
var layer2 = new Array();
var layer3 = new Array();
var layer0 = new Array();
var obj;
var depthLayer1 = new Array();
var depthLayer2 = new Array();
var depthLayer3 = new Array();
var depthLayer0 = new Array();
var fSpeed = 29;
var blnStrike = false;
var blnSecondThrow = false;
var blnSpare = false;
var fallCnt = 0;
var totalPinCnt = 0;
var numFrame = 1;
var totalPins = 0;
var totalScores = 0;
var loan = new Array();
var waitFrames = 10;
var waitCnt = 0;
var lastStrikeState = 0;
var blnRollOver = false;
var blnMouse = true;
var blnSoundOff = false;
var blnRules = false;
var blnSplit = false;
var pinScale = 100;
i = 1;
while (i < 11) {
this.createEmptyMovieClip("sndContainer" + i, 1400 + i);
this["snd" + i] = new Sound(eval ("sndContainer" + i));
i++;
}
var snd11 = new Sound(mcBackground);
var snd12 = new Sound(mcSndContainer);
var snd13 = new Sound(mcTopBG);
var globalSound = new Sound(this);
var rollVol = 100;
var rollSndState = 0;
var arrowLength = 50;
function eRollOver(obj) {
blnRollOver = true;
Mouse.show();
if (strState == "force") {
mcArrow.removeMovieClip();
}
}
function eRollOut(obj) {
if (blnRollOver) {
blnRollOver = false;
trace(blnMouse);
if (!blnMouse) {
trace("blnRollOver");
Mouse.hide();
}
if (strState == "force") {
this.attachMovie("mcArrow", "mcArrow", 10000);
mcArrow._x = _xmouse;
mcArrow._y = _ymouse;
}
}
}
this.onEnterFrame = function () {
if ((!blnRules) && (!blnPause)) {
switch (strState) {
case "ballPos" :
ballPos();
break;
case "force" :
force();
break;
case "roll" :
roll();
break;
case "ballFalls" :
roll();
}
}
if ((strState == "wait") && (!blnRules)) {
waitCnt++;
if (waitCnt > waitFrames) {
waitCnt = 0;
mcHandsWithBall.gotoAndStop(1);
strState = "ballPos";
}
}
};
btnCtrl.onRelease = function () {
if (((strState == "force") && (!blnRollOver)) && (!blnRules)) {
if (forceStrike < 0.2) {
forceStrike = 0.2;
}
azimuth = Math.atan((mcHandsWithBall._x - center) / (gameHeight - boardTopY));
moveAngle = ((visualAngle - azimuth) / angleRatio) + (azimuth / 1.02);
if (moveAngle > maxAngle) {
moveAngle = maxAngle;
}
if (moveAngle < (-maxAngle)) {
moveAngle = -maxAngle;
}
dY = ((-maxSpeed) * forceStrike) * Math.cos(moveAngle);
dX = ((-maxSpeed) * forceStrike) * Math.sin(moveAngle);
strState = "roll";
mcArrow.removeMovieClip();
mcHandsWithBall.gotoAndPlay(2);
}
if (((strState == "ballPos") && (!blnRollOver)) && (!blnRules)) {
strState = "force";
this._parent.attachMovie("mcArrow", "mcArrow", this._parent.getNextHighestDepth());
mcArrow._x = this._parent._xmouse;
mcArrow._y = this._parent._ymouse;
Mouse.hide();
blnMouse = false;
}
};
btnCtrl.onRollOver = function () {
eRollOut(btnCtrl);
};
mcRules.btnRules.onPress = function () {
mcRulesField.swapDepths(mcRulesField._parent.getNextHighestDepth());
if (blnRules) {
blnRules = false;
mcRulesField.gotoAndPlay("disapear");
} else {
blnRules = true;
mcRulesField._x = center + 14;
mcRulesField._y = 0;
mcRulesField.gotoAndPlay(2);
}
};
mcQuitSubmit.btnQuitSubmit.onRollOver = function () {
eRollOver(this);
};
mcSoundOff.btnSoundOff.onRollOver = function () {
eRollOver(this);
};
mcSoundOff.btnSoundOn.onRollOver = function () {
eRollOver(this);
};
mcRules.btnRules.onRollOver = function () {
eRollOver(this);
};
mcHelp.btnHelp.onRollOver = function () {
eRollOver(this);
};
mcQuitSubmit.btnQuitSubmit.onRollOut = function () {
eRollOut(this);
};
mcSoundOff.btnSoundOff.onRollOut = function () {
eRollOut(this);
};
mcSoundOff.btnSoundOn.onRollOut = function () {
eRollOut(this);
};
mcRules.btnRules.onRollOut = function () {
eRollOut(this);
};
mcHelp.btnHelp.onRollOut = function () {
eRollOut(this);
};
gameInit();
newGame();
roundInit();
Symbol 22 MovieClip [mcSpare] Frame 81
this.removeMovieClip();
Symbol 27 MovieClip [mcStrike] Frame 72
this.removeMovieClip();
Symbol 69 MovieClip [mcRulesField] Frame 1
stop();
Symbol 69 MovieClip [mcRulesField] Frame 19
stop();
Symbol 184 MovieClip [mcForce] Frame 1
stop();
Symbol 199 MovieClip [mcPin] Frame 1
stop();
var pinSnd = new Sound();
Symbol 199 MovieClip [mcPin] Frame 4
_parent.loud(13, false, "knock6", 50);
Symbol 199 MovieClip [mcPin] Frame 6
if (((((this._rotation == 0) && (this._name != "1")) && (this._name != "4")) && (this._name != "2")) && (this._name != "3")) {
this.layer--;
}
Symbol 199 MovieClip [mcPin] Frame 12
if ((Number(this._name) >= 1) && (Number(this._name) <= 4)) {
this.onEnterFrame = function () {
this._y = this._y + 2;
};
this.layer--;
}
Symbol 199 MovieClip [mcPin] Frame 16
stop();
Symbol 199 MovieClip [mcPin] Frame 31
stop();
_parent.loud(13, false, "knock6", 20);
Symbol 199 MovieClip [mcPin] Frame 33
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 34
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 36
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 38
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 42
_parent.loud(13, false, "knock6", 20);
Symbol 199 MovieClip [mcPin] Frame 45
stop();
Symbol 199 MovieClip [mcPin] Frame 48
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 50
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 55
stop();
_parent.loud(13, false, "knock2", 30);
Symbol 199 MovieClip [mcPin] Frame 59
_parent.loud(13, false, "knock5", 30);
Symbol 199 MovieClip [mcPin] Frame 77
stop();
Symbol 199 MovieClip [mcPin] Frame 81
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 84
this.layer--;
_parent.loud(13, false, "knock6", 40);
Symbol 199 MovieClip [mcPin] Frame 93
stop();
_parent.loud(13, false, "knock2", 30);
Symbol 199 MovieClip [mcPin] Frame 95
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 97
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 99
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 101
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 106
stop();
_parent.loud(13, false, "knock5", 30);
Symbol 199 MovieClip [mcPin] Frame 109
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 112
this.layer--;
if ((random(10) < ((_parent.fallD * 4) - 2)) && (Number(this._name) < 10)) {
this.state = "sideFwdT2";
this.gotoAndPlay("sideFwdT2");
}
Symbol 199 MovieClip [mcPin] Frame 114
_parent.loud(13, false, "knock6", 30);
Symbol 199 MovieClip [mcPin] Frame 118
_parent.loud(13, false, "knock6", 20);
Symbol 199 MovieClip [mcPin] Frame 120
stop();
if (random(2) == 1) {
bn = 10;
} else if (random(5) > 2) {
bn = -10;
} else {
bn = 0;
}
mcPinStay23._rotation = 80 + bn;
if ((sideFwdTState == 0) || (sideFwdTState == 2)) {
sideFwdTState = 1;
mcPinStay23._y = mcPinStay23._y + 2;
mcPinStay23._x = mcPinStay23._x - 4;
} else if (sideFwdTState == 1) {
sideFwdTState = 2;
mcPinStay23._y = mcPinStay23._y + 3;
mcPinStay23._x = mcPinStay23._x + 5;
}
Symbol 199 MovieClip [mcPin] Frame 124
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 129
stop();
_parent.loud(13, false, "knock5", 30);
Symbol 199 MovieClip [mcPin] Frame 134
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 138
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 142
stop();
_parent.loud(13, false, "knock5", 30);
Symbol 199 MovieClip [mcPin] Frame 144
if (random(2) == 1) {
gotoAndPlay ("tremble2");
}
Symbol 199 MovieClip [mcPin] Frame 184
stop();
this.state = "stay";
Symbol 199 MovieClip [mcPin] Frame 188
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 191
_parent.loud(13, false, "knock6", 30);
Symbol 199 MovieClip [mcPin] Frame 195
_parent.loud(13, false, "knock6", 20);
Symbol 199 MovieClip [mcPin] Frame 197
stop();
Symbol 199 MovieClip [mcPin] Frame 201
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 203
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 206
this.layer--;
switch (Number(this._name)) {
case 1 :
case 4 :
case 5 :
case 7 :
_parent.loud(13, false, "knock5", 30);
}
Symbol 199 MovieClip [mcPin] Frame 208
this.layer--;
Symbol 199 MovieClip [mcPin] Frame 215
stop();
Symbol 205 MovieClip [pin area] Frame 1
stop();
i = 1;
while (i < 11) {
trace(_parent.arrFalling[i]);
i++;
}
Symbol 205 MovieClip [pin area] Frame 2
play();
Symbol 205 MovieClip [pin area] Frame 12
var wx = false;
var wx2 = false;
i = 1;
while (i < 11) {
if ((_parent.arrFalling[i] == 1) || (_parent.arrFalling[i] == -1)) {
eval ("_parent." + i).removeMovieClip();
if (random(3) == 1) {
_parent.loud(i, false, "knock1", 14);
} else if (random(2) == 1) {
wx = true;
} else {
wx2 = true;
}
}
i++;
}
Symbol 205 MovieClip [pin area] Frame 14
if (_parent.arrFalling[10] == 0) {
trace("4 level swept");
var fObj = _parent.10;
if (random(2) == 1) {
fObj._xscale = fObj._xscale * -1;
}
fObj.gotoAndPlay("forwardT");
_parent.loud(10, false, "knock5", 28);
fObj.setMask(_parent.maskHole10);
}
if (wx) {
_parent.loud(i, false, "knock5", 14);
}
Symbol 205 MovieClip [pin area] Frame 17
if (_parent.arrFalling[9] == 0) {
var fObj = _parent.9;
trace("3 level swept");
if (random(2) == 1) {
fObj._xscale = fObj._xscale * -1;
}
fObj.gotoAndPlay("forwardT");
fObj.setMask(_parent.maskHole9);
_parent.loud(9, false, "knock5", 27);
}
if (_parent.arrFalling[8] == 0) {
trace("3 level swept");
var fObj = _parent.8;
if (random(2) == 1) {
fObj._xscale = fObj._xscale * -1;
}
fObj.gotoAndPlay("forwardT");
fObj.setMask(_parent.maskHole8);
_parent.loud(8, false, "knock5", 27);
}
if (wx2) {
_parent.loud(i, false, "knock6", 15);
}
Symbol 205 MovieClip [pin area] Frame 20
i = 5;
while (i <= 7) {
var fObj = eval ("_parent." + i);
if (_parent.arrFalling[i] == 0) {
trace("2 level swept");
fObj.gotoAndPlay("forwardWeak");
if (random(2) == 1) {
fObj._xscale = fObj._xscale * -1;
}
fObj.setMask(eval ("_parent.maskHole" + i));
_parent.loud(i, false, "knock6", 28);
}
i++;
}
i = 1;
while (i <= 10) {
eval ("_parent." + i).swapDepths(80 + i);
i++;
}
Symbol 205 MovieClip [pin area] Frame 23
i = 1;
while (i <= 4) {
var fObj = eval ("_parent." + i);
if (_parent.arrFalling[i] == 0) {
trace("1 level swept");
fObj.gotoAndPlay("forwardWeak");
if (random(2) == 1) {
fObj._xscale = fObj._xscale * -1;
}
fObj.setMask(eval ("_parent.maskHole" + i));
_parent.loud(i, false, "knock6", 28);
}
i++;
}
Symbol 205 MovieClip [pin area] Frame 43
_parent.loud(12, false, "sweeper1", 20);
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 50
_parent.arrangePins();
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 66
gotoAndStop (1);
Symbol 205 MovieClip [pin area] Frame 81
_parent.loud(12, false, "maschine2", 30);
Symbol 205 MovieClip [pin area] Frame 92
var arrUp = new Array();
var j = 0;
i = 1;
while (i < 11) {
if (_parent.arrFalling[i] == 0) {
arrUp[j] = i;
j++;
}
i++;
}
this.onEnterFrame = function () {
j = 0;
while (j < arrUp.length) {
eval ("_parent." + arrUp[j])._y = eval ("_parent." + arrUp[j])._y - 5.5;
j++;
}
};
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 98
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 105
delete this.onEnterFrame;
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 111
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 118
var wx = false;
var wx2 = false;
i = 1;
while (i < 11) {
if ((_parent.arrFalling[i] == 1) || (_parent.arrFalling[i] == -1)) {
eval ("_parent." + i).removeMovieClip();
if (random(3) == 1) {
_parent.loud(i, false, "knock1", 14);
} else if (random(2) == 1) {
wx = true;
} else {
wx2 = true;
}
}
i++;
}
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 121
if (wx2) {
_parent.loud(i, false, "knock6", 12);
}
Symbol 205 MovieClip [pin area] Frame 123
if (wx) {
_parent.loud(i, false, "knock5", 12);
}
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 140
this.onEnterFrame = function () {
j = 0;
while (j < arrUp.length) {
eval ("_parent." + arrUp[j])._y = eval ("_parent." + arrUp[j])._y + 5.5;
j++;
}
};
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 151
_parent.loud(12, false, "sweeper1", 20);
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 153
delete this.onEnterFrame;
_parent.snd12.stop();
Symbol 205 MovieClip [pin area] Frame 170
this.GotoAndStop(1);
_parent.snd12.stop();
Symbol 214 MovieClip [mcHandsWithBall] Frame 1
stop();
Symbol 214 MovieClip [mcHandsWithBall] Frame 19
stop();
_parent.blnAllowThr = true;
Symbol 247 Button
on (press) {
_parent._parent.showHelp();
}