Frame 1
tellTarget ("_level0") {
lbLoadingGame = "";
};
Frame 3
if (_framesloaded >= _totalframes) {
gotoAndPlay (4);
} else {
gotoAndPlay (2);
}
Frame 4
function NewGame() {
stTime = 0;
Time = 0;
hole._visible = true;
var i = 0;
while (i < nBalls) {
attachMovie("red", "red" + i, 100 + i);
var b = eval ("red" + i);
b._x = (x1 + (b._width / 2)) + random((x2 - x1) - b._width);
b._y = (y1 + (b._height / 2)) + random((y2 - y1) - b._height);
var V = (random(5) + 1);
var A = (((random(365) * 2) * Math.PI) / 360);
b.Vx = V * Math.cos(A);
b.Vy = V * Math.sin(A);
if (Math.abs(b.Vx < 2)) {
b.Vx = -2;
}
if (Math.abs(b.Vy < 2)) {
b.Vy = -2;
}
rBall.push(b);
i++;
}
var i = 0;
while (i < nBalls) {
attachMovie("blue", "blue" + i, 200 + i);
var b = eval ("blue" + i);
b._x = (x1 + (b._width / 2)) + random((x2 - x1) - b._width);
b._y = (y1 + (b._height / 2)) + random((y2 - y1) - b._height);
var V = (random(5) + 1);
var A = (((random(365) * 2) * Math.PI) / 360);
b.Vx = V * Math.cos(A);
b.Vy = V * Math.sin(A);
if (Math.abs(b.Vx < 2)) {
b.Vx = 2;
}
if (Math.abs(b.Vy < 2)) {
b.Vy = -2;
}
bBall.push(b);
i++;
}
}
if (!init) {
init = true;
} else {
return(undefined);
}
Beta = 0.95;
Beta1 = 1 - Beta;
FPS = 0;
nBalls = 10;
x1 = 10;
x2 = 492;
y1 = 10;
y2 = 317;
xb1 = hole._x - (hole._width / 2);
xb2 = hole._x + (hole._width / 2);
rBall = [];
bBall = [];
R = 5;
D = 2 * R;
NewGame();
Instance of Symbol 36 MovieClip "hole" in Frame 4
onClipEvent (mouseMove) {
_y = _parent._ymouse;
if (_y < (_parent.y1 + (_height / 2))) {
_y = ((_parent.y1 + (_height / 2)) - 3);
}
if ((_parent.y2 - (_height / 2)) < _y) {
_y = ((_parent.y2 - (_height / 2)) + 3);
}
}
Frame 6
dt = getTimer() - tLst;
tLst = getTimer();
FPS = (Beta1 * dt) + (Beta * FPS);
stFPS = Math.round(FPS);
if (hole._visible) {
Time = Time + dt;
}
stTime = Math.round(Time / 1000);
yb1 = hole._y - (hole._height / 2);
yb2 = hole._y + (hole._height / 2);
nr = (nb = 0);
var i = 0;
while (i < (2 * nBalls)) {
if (i < nBalls) {
b = rBall[i];
if (xb2 < b._x) {
nr++;
}
} else {
b = bBall[i - nBalls];
if (b._x < xb1) {
nb++;
}
}
if (b._x < x1) {
b.Vx = Math.abs(b.Vx);
}
if (x2 < b._x) {
b.Vx = -Math.abs(b.Vx);
}
if (b._y < y1) {
b.Vy = Math.abs(b.Vy);
}
if (y2 < b._y) {
b.Vy = -Math.abs(b.Vy);
}
if (((((b._y - R) + b.Vy) < yb1) || (yb2 < ((b._y + R) + b.Vy))) || (!hole._visible)) {
if (((b._x + b.Vx) >= xb1) && (xb1 >= b._x)) {
b.Vx = -Math.abs(b.Vx);
}
if ((xb2 >= (b._x + b.Vx)) && (b._x >= xb2)) {
b.Vx = Math.abs(b.Vx);
}
}
b._x = b._x + b.Vx;
b._y = b._y + b.Vy;
i++;
}
stNR = nr;
stNB = nb;
if ((nr == nBalls) && (nb == nBalls)) {
hole._visible = false;
}
prevFrame();
play();
Symbol 21 Button
on (release) {
NewGame();
}
Symbol 27 Button
on (release) {
getURL ("http://absolutist.com", "_blank");
}
Symbol 31 Button
on (release) {
getURL ("http://absolutist.com/games.html", "_blank");
}