Frame 1
var geladen;
if (geladen != true) {
geladen = true;
var funky = new Sound();
funky.attachSound("funk");
funky.start();
}
mus.onRelease = function () {
if (this._currentframe == 1) {
this.gotoAndStop(2);
funky.stop();
} else {
this.gotoAndStop(1);
funky.start();
}
};
funky.onSoundComplete = function () {
funky.start();
};
stop();
spiel.onRelease = function () {
gotoAndStop (3);
};
logo.onRelease = function () {
gotoAndStop (3);
};
about.onRelease = function () {
gotoAndStop (2);
};
stmp.onRelease = function () {
getURL ("http://www.8baller.co.uk/", "_blank");
};
Frame 2
stop();
zurueck.onRelease = function () {
gotoAndStop (1);
};
Frame 3
function normalisieren(linie) {
linie.dx = linie.p1x - linie.p0x;
linie.dy = linie.p1y - linie.p0y;
linie.d = Math.sqrt((linie.dx * linie.dx) + (linie.dy * linie.dy));
linie.dx = linie.dx / linie.d;
linie.dy = linie.dy / linie.d;
linie.lx = linie.dy;
linie.ly = -linie.dx;
}
function setup() {
stoss.text = 0;
versenkt.text = 0;
zieler._visible = true;
zieler.fleck._visible = false;
zieler.kreuz._visible = true;
zieler.fleck._y = (zieler.kreuz._y = (vert = 0));
zieler.fleck._x = (zieler.kreuz._x = (horz = 0));
spin = 0;
spina = 0;
zieler.zielbut.enabled = true;
bew = anz;
stoesse = 1;
fort = 0;
warte = 0;
but._visible = true;
strich._visible = false;
win._visible = false;
lost._visible = false;
attachMovie("koe_mc", "koe", 100);
koe._visible = false;
koeAktiv = false;
attachMovie("weiss_mc", "b0", 0);
b0.vx = (b0.vy = (b0.v = 0));
b0.va = 0;
b0.e = true;
b0.k = (b0.spin = false);
b0.l = "n";
i = 1;
while (i < anz) {
attachMovie("rot_mc", "b" + i, i);
this["b" + i].vx = (this["b" + i].vy = (this["b" + i].v = 0));
this["b" + i].va = 0;
this["b" + i].e = true;
this["b" + i].k = false;
this["b" + i].l = "n";
i++;
}
b0.xpos = bx / 2;
b0.ypos = by - (by / 4.2);
b1.xpos = bx / 2;
b2.xpos = (bx / 2) - rad;
b3.xpos = (bx / 2) + rad;
b4.xpos = (bx / 2) - (rad * 2);
b5.xpos = bx / 2;
b6.xpos = (bx / 2) + (rad * 2);
b7.xpos = (bx / 2) - rad;
b8.xpos = (bx / 2) + rad;
b9.xpos = bx / 2;
b9.ypos = (by / 4.25) - 55;
b8.ypos = ((by / 4.25) + (rad * 1.81)) - 55;
b7.ypos = ((by / 4.25) + (rad * 1.81)) - 55;
b6.ypos = ((by / 4.25) + (rad * 3.62)) - 55;
b5.ypos = ((by / 4.25) + (rad * 3.62)) - 55;
b4.ypos = ((by / 4.25) + (rad * 3.62)) - 55;
b3.ypos = ((by / 4.25) + (rad * 5.43)) - 55;
b2.ypos = ((by / 4.25) + (rad * 5.43)) - 55;
b1.ypos = ((by / 4.25) + (rad * 7.24)) - 55;
i = 0;
while (i < anz) {
this["b" + i].gx = Math.floor(this["b" + i].xpos / gridx) + 3;
this["b" + i].gy = Math.floor(this["b" + i].ypos / gridy) + 3;
i++;
}
}
function loeschen() {
removeMovieClip(koe);
i = 0;
while (i < anz) {
removeMovieClip("b" + i);
i++;
}
}
function roll() {
i = 0;
while (i < anz) {
ball = this["b" + i];
if (ball.e) {
ball.xpos = ball.xpos + ball.vx;
ball.ypos = ball.ypos + ball.vy;
ball.gx = Math.floor(ball.xpos / gridx) + 3;
ball.gy = Math.floor(ball.ypos / gridy) + 3;
if ((ball.gx <= 3) || (ball.gx >= 12)) {
bandex(ball);
}
if ((ball.gy <= 3) || (ball.gy >= 22)) {
bandey(ball);
}
if ((ball.gx <= 3) && (ball.gy <= 3)) {
schraege(ball, l0);
schraege(ball, l1);
lochen(ball, l_ol);
} else if ((ball.gx <= 3) && ((ball.gy == 12) || (ball.gy == 13))) {
schraege(ball, l2);
schraege(ball, l3);
lochen(ball, l_ml);
} else if ((ball.gx <= 3) && (ball.gy >= 22)) {
schraege(ball, l4);
schraege(ball, l5);
lochen(ball, l_ul);
} else if ((ball.gx >= 12) && (ball.gy <= 3)) {
schraege(ball, l10);
schraege(ball, l11);
lochen(ball, l_or);
} else if ((ball.gx >= 12) && ((ball.gy == 12) || (ball.gy == 13))) {
schraege(ball, l8);
schraege(ball, l9);
lochen(ball, l_mr);
} else if ((ball.gx >= 12) && (ball.gy >= 22)) {
schraege(ball, l6);
schraege(ball, l7);
lochen(ball, l_ur);
}
if (ball.k) {
ball.vx = ball.vx * prall;
ball.vy = ball.vy * prall;
ball.k = false;
}
if ((spin > 0) && (ball == b0)) {
if (b0.spin) {
b0.vx = b0.vx + (spinx * 0.2);
b0.vy = b0.vy + (spiny * 0.2);
spinx = spinx - (spinx * 0.6);
spiny = spiny - (spiny * 0.6);
spin--;
} else {
spin = spin - 0.25;
}
}
ball.v = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
if (ball.v < vmin) {
ball.vx = (ball.vy = (ball.v = 0));
bew--;
} else {
bremf = (vmax - ball.v) / brem;
ball.vx = ball.vx * (reib - bremf);
ball.vy = ball.vy * (reib - bremf);
}
} else {
bew--;
}
i++;
}
}
function bandex(ball) {
if (((ball.ypos > punkt11.ypos) && (ball.ypos < punkt20.ypos)) || ((ball.ypos > punkt31.ypos) && (ball.ypos < punkt40.ypos))) {
if ((ball.xpos > (punkt100.xpos - rad)) || (ball.xpos < rad)) {
ball.xpos = ((ball.xpos < rad) ? (rad) : (punkt100.xpos - rad));
ball.vx = -ball.vx;
ball.k = true;
if (ball == b0) {
b0.spin = true;
}
}
}
}
function bandey(ball) {
if ((ball.xpos > punkt00.xpos) && (ball.xpos < punkt111.xpos)) {
if ((ball.ypos > (punkt51.ypos - rad)) || (ball.ypos < rad)) {
ball.ypos = ((ball.ypos < rad) ? (rad) : (punkt51.ypos - rad));
ball.vy = -ball.vy;
ball.k = true;
if (ball == b0) {
b0.spin = true;
}
}
}
}
function schraege(ball, linie) {
dx = ball.xpos - linie.p0x;
dy = ball.ypos - linie.p0y;
dp = (dx * linie.dx) + (dy * linie.dy);
if (dp < 0) {
d = Math.sqrt((dx * dx) + (dy * dy));
if (d < rad) {
dx = dx / d;
dy = dy / d;
dd = rad - d;
ball.xpos = ball.xpos + (dd * dx);
ball.ypos = ball.ypos + (dd * dy);
dp = Math.abs((ball.vx * dx) + (ball.vy * dy));
ball.vx = ball.vx + ((dp * dx) * 2);
ball.vy = ball.vy + ((dp * dy) * 2);
ball.k = true;
if (ball == b0) {
b0.spin = true;
}
}
} else if (dp > linie.d) {
dx = ball.xpos - linie.p1x;
dy = ball.ypos - linie.p1y;
d = Math.sqrt((dx * dx) + (dy * dy));
if (d < rad) {
dx = dx / d;
dy = dy / d;
dd = rad - d;
ball.xpos = ball.xpos + (dd * dx);
ball.ypos = ball.ypos + (dd * dy);
dp = Math.abs((ball.vx * dx) + (ball.vy * dy));
ball.vx = ball.vx + ((dp * dx) * 2);
ball.vy = ball.vy + ((dp * dy) * 2);
ball.k = true;
if (ball == b0) {
b0.spin = true;
}
}
} else {
dx = ball.xpos - ((dp * linie.dx) + linie.p0x);
dy = ball.ypos - ((dp * linie.dy) + linie.p0y);
d = Math.sqrt((dx * dx) + (dy * dy));
if (d < rad) {
dx = dx / d;
dy = dy / d;
dd = rad - d;
ball.xpos = ball.xpos + (dd * dx);
ball.ypos = ball.ypos + (dd * dy);
dp = Math.abs((ball.vx * linie.lx) + (ball.vy * linie.ly));
ball.vx = ball.vx + ((dp * linie.lx) * 2);
ball.vy = ball.vy + ((dp * linie.ly) * 2);
ball.k = true;
if (ball == b0) {
b0.spin = true;
}
}
}
}
function kollision() {
i = 0;
while (i < (anz - 1)) {
j = i + 1;
while (j < anz) {
ball1 = this["b" + i];
ball2 = this["b" + j];
grid = Math.abs(ball1.gx - ball2.gx) + Math.abs(ball1.gy - ball2.gy);
if ((ball1.e && (ball2.e)) && (grid < 3)) {
dx = ball2.xpos - ball1.xpos;
dy = ball2.ypos - ball1.ypos;
d = Math.sqrt((dx * dx) + (dy * dy));
if (d < dmax) {
dx = dx / d;
dy = dy / d;
dpx = ball2.vx - ball1.vx;
dpy = ball2.vy - ball1.vy;
dp = Math.abs((dpx * dx) + (dpy * dy));
ball1.v = Math.sqrt((ball1.vx * ball1.vx) + (ball1.vy * ball1.vy));
ball2.v = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
vg = ball1.v + ball2.v;
dd1 = ((dmax - d) * ball1.v) / vg;
dd2 = ((dmax - d) * ball2.v) / vg;
ball1.xpos = ball1.xpos - (dx * dd1);
ball1.ypos = ball1.ypos - (dy * dd1);
ball2.xpos = ball2.xpos + (dx * dd2);
ball2.ypos = ball2.ypos + (dy * dd2);
ball1.vx = ball1.vx - (dp * dx);
ball1.vy = ball1.vy - (dp * dy);
ball2.vx = ball2.vx + (dp * dx);
ball2.vy = ball2.vy + (dp * dy);
ball1.k = (ball2.k = true);
if (ball1 == b0) {
b0.spin = true;
}
}
}
j++;
}
i++;
}
}
function lochen(ball, loch) {
dx = ball.xpos - (loch._x - hx);
dy = ball.ypos - (loch._y - hy);
d = Math.sqrt((dx * dx) + (dy * dy));
if (d < (loch._width / 2)) {
fort++;
warte++;
bew--;
ball.e = false;
ball.l = loch;
}
}
function verschwinde() {
i = 0;
while (i < anz) {
ball = this["b" + i];
if (ball.l != "n") {
dx = ball.l._x - ball._x;
dy = ball.l._y - ball._y;
d = Math.sqrt((dx * dx) + (dy * dy));
if (d > 1) {
ball.v = ((ball.v < 2) ? (ball.v + 0.2) : (ball.v * 0.5));
ball._x = ball._x + ((dx / d) * ball.v);
ball._y = ball._y + ((dy / d) * ball.v);
} else {
ball._x = ball.l._x;
ball._y = ball.l._y;
ball._alpha = ball._alpha - 10;
if (ball._alpha < 5) {
ball.l = "n";
ball._visible = false;
warte--;
}
}
}
i++;
}
}
function beenden() {
if ((warte == 0) && (bew == 0)) {
stoss.text = stoesse;
versenkt.text = (b0.e ? (fort) : (fort - 1));
clearInterval(_root.sidBewegung);
clearInterval(_root.sidBeenden);
beende = false;
but._visible = false;
if (b0.e) {
win._visible = true;
win.shots = stoesse;
if (stoesse < 10) {
win.t.text = "MARVELLOUS!";
} else if (stoesse < 16) {
win.t.text = "IMPRESSIVE!";
} else if (stoesse < 20) {
win.t.text = "BRILLIANT!";
} else if (stoesse < 26) {
win.t.text = "VERY GOOD!";
} else {
win.t.text = "CONGRATULATIONS!";
}
} else {
lost._visible = true;
}
loeschen();
}
}
function zeichnen() {
i = 0;
while (i < anz) {
ball = this["b" + i];
if (ball.e) {
ball._x = ball.xpos + hx;
ball._y = ball.ypos + hy;
}
i++;
}
}
function bewegung() {
bew = anz;
verschwinde();
roll();
kollision();
zeichnen();
if ((((bew == 0) && (warte == 0)) && (fort < (anz - 1))) && (b0.e)) {
clearInterval(_root.sidBewegung);
stoss.text = stoesse;
versenkt.text = fort;
stoesse++;
but._visible = true;
vert = (horz = (spin = (spina = 0)));
b0.spin = false;
zieler.zielbut.enabled = true;
zieler.fleck._visible = false;
zieler.kreuz._visible = true;
zieler.fleck._y = (zieler.kreuz._y = 0);
zieler.fleck._x = (zieler.kreuz._x = 0);
}
if ((fort == (anz - 1)) || (!b0.e)) {
if (!beende) {
beende = true;
sidBeenden = setInterval(_root, "beenden", msec);
}
}
updateAfterEvent();
}
function zielen() {
dx = _xmouse - b0._x;
dy = _ymouse - b0._y;
d = Math.sqrt((dx * dx) + (dy * dy)) - (rad * vzoom);
if (d < (vmin * vzoom)) {
d = (vmin * vzoom) + 1;
} else if (d > (vmax * vzoom)) {
d = vmax * vzoom;
}
da = Math.atan2(dy, dx);
b0.vx = ((-Math.cos(da)) * d) / vzoom;
b0.vy = ((-Math.sin(da)) * d) / vzoom;
koe._visible = true;
koe._x = b0._x + (Math.cos(da) * (d + rad));
koe._y = b0._y + (Math.sin(da) * (d + rad));
koe._rotation = (da / Math.PI) * 180;
strich._visible = true;
strich._x = b0._x;
strich._y = b0._y;
strich._rotation = ((da / Math.PI) * 180) + 180;
}
function stossen() {
strich._visible = false;
koe.vx = b0.vx;
koe.vy = b0.vy;
koe._x = koe._x + koe.vx;
koe._y = koe._y + koe.vy;
dx = koe._x - b0._x;
dy = koe._y - b0._y;
d = Math.sqrt((dx * dx) + (dy * dy));
if (d < rad) {
Mouse.show();
clearInterval(_root.sidStoss);
koe._visible = false;
zieler.zielbut.enabled = false;
zieler.kreuz._visible = false;
zieler.fleck._visible = true;
da = Math.atan2(b0.vy, b0.vx);
b0.v = Math.sqrt((b0.vx * b0.vx) + (b0.vy * b0.vy));
spinx = ((-(spin / spinmax)) * Math.cos(da + spina)) * b0.v;
spiny = ((-(spin / spinmax)) * Math.sin(da + spina)) * b0.v;
b0.vx = b0.vx * (1 - ((spin / spinmax) / 5));
b0.vy = b0.vy * (1 - ((spin / spinmax) / 5));
b0.v = Math.sqrt((b0.vx * b0.vx) + (b0.vy * b0.vy));
sidBewegung = setInterval(_root, "bewegung", msec);
}
}
stop();
var anz = 10;
var prall = 0.9;
var rad = 9;
var vmax = (rad * 1.2);
var vmin = 0.05;
var dmax = (rad * 2);
var vzoom = 3;
var reib = 0.998;
var brem = 700;
var bremf;
var bx = (punkt100._x - punkt11._x);
var by = (punkt51._y - punkt00._y);
var hx = punkt11._x;
var hy = punkt00._y;
var bew;
var fort = 0;
var warte = 0;
var stoesse;
var vert = 0;
var horz = 0;
var spin = 0;
var spinx = 0;
var spiny = 0;
var spina;
var spinmax = 20;
var grid;
var gridx = (bx / 10);
var gridy = (by / 20);
var koeAktiv = false;
var beende = false;
var sidBewegung;
var sidZielen;
var sidStoss;
var sidBeenden;
var msec = 5;
i = 0;
while (i < 12) {
this[("punkt" + i) + "0"].xpos = this[("punkt" + i) + "0"]._x - hx;
this[("punkt" + i) + "0"].ypos = this[("punkt" + i) + "0"]._y - hy;
this[("punkt" + i) + "1"].xpos = this[("punkt" + i) + "1"]._x - hx;
this[("punkt" + i) + "1"].ypos = this[("punkt" + i) + "1"]._y - hy;
i++;
}
var l0 = {p0x:punkt00.xpos, p0y:punkt00.ypos, p1x:punkt01.xpos, p1y:punkt01.ypos};
normalisieren(l0);
var l1 = {p0x:punkt10.xpos, p0y:punkt10.ypos, p1x:punkt11.xpos, p1y:punkt11.ypos};
normalisieren(l1);
var l2 = {p0x:punkt20.xpos, p0y:punkt20.ypos, p1x:punkt21.xpos, p1y:punkt21.ypos};
normalisieren(l2);
var l3 = {p0x:punkt30.xpos, p0y:punkt30.ypos, p1x:punkt31.xpos, p1y:punkt31.ypos};
normalisieren(l3);
var l4 = {p0x:punkt40.xpos, p0y:punkt40.ypos, p1x:punkt41.xpos, p1y:punkt41.ypos};
normalisieren(l4);
var l5 = {p0x:punkt50.xpos, p0y:punkt50.ypos, p1x:punkt51.xpos, p1y:punkt51.ypos};
normalisieren(l5);
var l6 = {p0x:punkt60.xpos, p0y:punkt60.ypos, p1x:punkt61.xpos, p1y:punkt61.ypos};
normalisieren(l6);
var l7 = {p0x:punkt70.xpos, p0y:punkt70.ypos, p1x:punkt71.xpos, p1y:punkt71.ypos};
normalisieren(l7);
var l8 = {p0x:punkt80.xpos, p0y:punkt80.ypos, p1x:punkt81.xpos, p1y:punkt81.ypos};
normalisieren(l8);
var l9 = {p0x:punkt90.xpos, p0y:punkt90.ypos, p1x:punkt91.xpos, p1y:punkt91.ypos};
normalisieren(l9);
var l10 = {p0x:punkt100.xpos, p0y:punkt100.ypos, p1x:punkt101.xpos, p1y:punkt101.ypos};
normalisieren(l10);
var l11 = {p0x:punkt110.xpos, p0y:punkt110.ypos, p1x:punkt111.xpos, p1y:punkt111.ypos};
normalisieren(l11);
but.onPress = function () {
Mouse.hide();
koeAktiv = true;
sidZielen = setInterval(_root, "zielen", msec);
};
zieler.zielbut.onRelease = function () {
vert = (_root.zieler._y - _root._ymouse) * 0.86;
horz = (_root.zieler._x - _root._xmouse) * 0.86;
zieler.kreuz._y = -vert;
zieler.fleck._y = -vert;
zieler.kreuz._x = -horz;
zieler.fleck._x = -horz;
vert = Math.round((vert * spinmax) / 10);
horz = Math.round((horz * spinmax) / 10);
spin = Math.round(Math.sqrt((vert * vert) + (horz * horz)));
spina = Math.atan2(vert, horz);
spina = spina + (Math.PI/2);
};
but.onRelease = function () {
if (koeAktiv) {
this._visible = false;
clearInterval(_root.sidZielen);
koeAktiv = false;
sidStoss = setInterval(_root, "stossen", msec);
}
};
but.onReleaseOutside = function () {
if (koeAktiv) {
this._visible = false;
clearInterval(_root.sidZielen);
koeAktiv = false;
sidStoss = setInterval(_root, "stossen", msec);
}
};
mp.onRelease = function () {
getURL ("http://www.8baller.co.uk/", "_blank");
};
addgame.onRelease = function () {
getURL ("http://www.8baller.co.uk/singleplayer/index.php", "_blank");
};
help.onRelease = function () {
clearInterval(sidBewegung);
clearInterval(sidZielen);
clearInterval(sidStoss);
clearInterval(sidBeenden);
loeschen();
gotoAndStop (1);
};
los.onRelease = function () {
clearInterval(sidBewegung);
clearInterval(sidZielen);
clearInterval(sidStoss);
clearInterval(sidBeenden);
loeschen();
gotoAndStop (4);
};
Mouse.show();
strich._visible = false;
win._visible = false;
lost._visible = false;
setup();
zeichnen();
Frame 4
gotoAndStop (3);
Symbol 20 MovieClip [win_mc] Frame 1
stop();
gratlink.onRelease = function () {
getURL ("http://www.8baller.co.uk/singleplayer/leaderboard.php?score=" + shots, "_blank");
};
Symbol 22 MovieClip [lost_mc] Frame 1
stop();
gratlink.onRelease = function () {
getURL ("http://www.8baller.co.uk/", "_blank");
};
Symbol 33 MovieClip Frame 101
gotoAndPlay (30);
Symbol 46 MovieClip Frame 1
stop();