Frame 2
function vecAdd(v0, v1) {
return([v0[0] + v1[0], v0[1] + v1[1]]);
}
function vecSub(v0, v1) {
return([v0[0] - v1[0], v0[1] - v1[1]]);
}
function vecDot(v0, v1) {
return((v0[0] * v1[0]) + (v0[1] * v1[1]));
}
function vecCross(v0, v1) {
return((v0[0] * v1[1]) - (v0[1] * v1[0]));
}
function vecLen(v0) {
return(Math.sqrt(vecLenSq(v0)));
}
function vecLenSq(v0) {
return((v0[0] * v0[0]) + (v0[1] * v0[1]));
}
function vecScale(v, sc) {
return([v[0] * sc, v[1] * sc]);
}
function vecNorm(v) {
l = vecLen(v);
return([v[0] / l, v[1] / l]);
}
function rangePush(r, n) {
if (r[0] == null) {
r[0] = n;
r[1] = n;
} else {
if (n < r[0]) {
r[0] = n;
}
if (n > r[1]) {
r[1] = n;
}
}
}
function rangeIntersect(r0, r1) {
if (r0[1] < r1[0]) {
return(false);
}
if (r1[1] < r0[0]) {
return(false);
}
var _local1 = r0[1] - r1[0];
var _local3 = r0[0] - r1[1];
if (_local1 < (-_local3)) {
return(_local1);
}
return(_local3);
}
function onMouseDown() {
if (bat._currentframe == 1) {
bat.gotoAndPlay("bump");
}
}
function projectPoint(axis, p) {
return(vecDot(axis, p));
}
function projectCircle(axis, cc, cr) {
var _local1 = vecDot(axis, cc);
var _local2 = _local1 - cr;
var _local3 = _local1 + cr;
return([_local2, _local3]);
}
function projectSquare(axis, sq0, sq1) {
var _local1 = [null, null];
rangePush(_local1, projectPoint(axis, sq0));
rangePush(_local1, projectPoint(axis, sq1));
rangePush(_local1, projectPoint(axis, [sq0[0], sq1[1]]));
rangePush(_local1, projectPoint(axis, [sq1[0], sq0[1]]));
return(_local1);
}
function colSquareCircle(sq0, sq1, cc, cr) {
var _local14 = vecSub(sq0, cc);
var _local13 = vecSub(sq1, cc);
var _local12 = vecSub([sq0[0], sq1[1]], cc);
var _local11 = vecSub([sq1[0], sq0[1]], cc);
var _local6 = [[0, 1], [1, 0], _local14, _local13, _local12, _local11];
var _local3 = [null, null];
for (a in _local6) {
var _local2 = vecNorm(_local6[a]);
var _local5 = projectSquare(_local2, sq0, sq1);
var _local4 = projectCircle(_local2, cc, cr);
var _local1 = rangeIntersect(_local5, _local4);
if (_local1 == false) {
return(false);
}
if (((_local1 * _local1) < vecLenSq(_local3)) || (_local3[0] == null)) {
_local3 = vecScale(_local2, _local1);
}
}
return(_local3);
}
function colCircleCircle(c0, r0, c1, r1) {
var _local1 = vecNorm(vecSub(c1, c0));
var _local4 = projectCircle(_local1, c0, r0);
var _local3 = projectCircle(_local1, c1, r1);
var _local2 = rangeIntersect(_local4, _local3);
if (_local2 == false) {
return(false);
}
return(vecScale(_local1, _local2));
}
function initHud() {
_root.gover.removeMovieClip();
var _local2 = attachMovie("GameOver", "gover", _root.getNextHighestDepth());
_local2._x = (_local2._y = 250);
}
function safety(ob) {
var _local2 = false;
if ((ob._x - (ob._width / 2)) < 10) {
ob._x = 10 + (ob._width / 2);
ob.vx = Math.abs(ob.vx);
_local2 = true;
}
if ((ob._x + (ob._width / 2)) > (sw - 10)) {
ob._x = (sw - 10) - (ob._width / 2);
ob.vx = -Math.abs(ob.vx);
_local2 = true;
}
if ((ob._y - (ob._height / 2)) < 10) {
ob._y = 10 + (ob._height / 2);
ob.vy = Math.abs(ob.vy);
_local2 = true;
}
if (ob.vy > 60) {
ob.vy = 60;
}
if (ob.vy < -60) {
ob.vy = -60;
}
return(_local2);
}
function perFrame() {
dispscore = rootscore;
if (!random(600)) {
spawnTab();
}
for (i in balls) {
var _local3 = balls[i];
dispscore = dispscore + _local3.score;
if (_local3.waitingFor) {
if (!_local3.waitingFor._y) {
_local3.waitingFor = false;
}
} else {
_local3._x = _local3._x + _local3.vx;
_local3._y = _local3._y + _local3.vy;
_local3.vy = _local3.vy + 0.5;
}
if (safety(_local3)) {
_local3.addScore(1);
}
if (_local3._y > dbar._y) {
killBall(_local3);
continue;
}
if ((_local3._y + (_local3._height / 2)) >= (bat._y - (bat._height * 2))) {
var _local22 = bat._height;
var _local15 = bat._width / 2;
var _local4 = colSquareCircle([bat._x - _local15, bat._y - _local22], [bat._x + _local15, bat._y], [_local3._x, _local3._y], _local3._width / 2);
if (!(_local4 === false)) {
_local3.nxt = 10;
var _local17 = vecLen([_local3.vx, _local3.vy]);
var _local5 = vecScale(vecNorm(_local4), _local17 * 0.85);
_local3._x = _local3._x + _local4[0];
_local3._y = _local3._y + _local4[1];
_local3.vx = _local5[0];
_local3.vy = _local5[1];
if (bat.bumping) {
_local3.vy = _local3.vy - 5;
}
if (bat._xscale > 5) {
bat._xscale = bat._xscale - 1;
}
var _local11 = new Sound(_root);
_local11.attachSound("thump2.wav");
_local11.start();
var _local14 = _local3._x - bat._x;
if ((_local14 > (-_local15)) && (_local14 < _local15)) {
_local14 = 2 * (_local14 / bat._width);
_local3.vx = _local3.vx + (_local14 * 10);
}
}
}
for (oi in obs) {
var _local2 = obs[oi];
if (!_local2.is) {
return(undefined);
}
if (_local2.is == "t") {
var _local4 = colSquareCircle([_local2._x, _local2._y], [_local2._x + _local2._width, _local2._y + _local2._height], [_local3._x, _local3._y], _local3._width / 2);
if ((_local4 != false) && (!_local2.going)) {
_local2.going = true;
_local2.gotoAndPlay("hit");
if (_local2.tis == "balls") {
_local3.waitingFor = _local2;
}
}
} else if (_local2.is == "b") {
var _local4 = colCircleCircle([_local2._x, _local2._y], _local2._width / 2, [_local3._x, _local3._y], _local3._width / 2);
if (_local4 != false) {
if (!bouncerIn(_local2)) {
_local3.doit(100);
killBouncer(_local2);
continue;
}
if (_local2.bt == "cannon") {
if (!_local2.ftim) {
if (_local2.ltim) {
_local3._x = _local2._x;
_local3._y = _local2._y;
_local2.ltim--;
} else if (_local2.ltim === 0) {
_local2.ltim = undefined;
var _local20 = vecLenSq(_local4);
var _local10 = ((_local2.angle * Math.PI) / 180) + (Math.PI/2);
var _local12 = 20;
_local3.vx = _local12 * Math.cos(_local10);
_local3.vy = _local12 * Math.sin(_local10);
_local3._x = _local2._x;
_local3._y = _local2._y;
_local2.vx = -_local3.vx;
_local2.vy = -_local3.vy;
_local2.ftim = 20;
_local3.doit(50);
var _local11 = new Sound(_root);
_local11.attachSound("thump1.wav");
_local11.start();
} else {
_local2.ltim = 30;
}
}
} else if (_local2.bt == "lock") {
var _local8 = _local2._y - _local3._y;
var _local9 = _local2._x - _local3._x;
_local3.vx = _local3.vx + (_local9 / 50);
_local3.vy = _local3.vy + (_local8 / 50);
_local3.vx = _local3.vx * 0.9;
_local3.vy = _local3.vy * 0.9;
if ((Math.abs(_local3.vx) < 1) && (Math.abs(_local3.vy) < 1)) {
_local3.multScore(2);
killBouncer(_local2);
_local3.vy = -5;
continue;
}
} else {
_local3.doit();
var _local11 = new Sound(_root);
_local11.attachSound("Ding");
_local11.start(0.4);
var _local18 = 1;
var _local17 = vecLen([_local3.vx, _local3.vy]);
var _local5 = vecScale(vecNorm(_local4), _local17 * _local18);
_local3._x = _local3._x + _local4[0];
_local3._y = _local3._y + _local4[1];
_local3.vx = _local5[0];
_local3.vy = _local5[1];
_local2.vx = _local2.vx - (_local5[0] * 0.5);
_local2.vy = _local2.vy - (_local5[1] * 0.5);
}
}
}
}
}
vroo = dispscore;
for (i in obs) {
var _local3 = obs[i];
if (_local3.is != "b") {
continue;
}
var _local19 = 0.8;
if (_local3.bt == "fruit") {
_local19 = 0.95;
}
_local3.vx = _local3.vx * _local19;
_local3.vy = _local3.vy * _local19;
_local3._x = _local3._x + _local3.vx;
_local3._y = _local3._y + _local3.vy;
safety(_local3);
if (Math.abs(_local3.vx) < 0.001) {
_local3.vx = 0;
}
if (Math.abs(_local3.vy) < 0.001) {
_local3.vy = 0;
}
if ((_local3.bt == "ball") && (_local3.b.ball._visible)) {
_local3.b.ball.vx = _local3.b.ball.vx + _local3.vx;
_local3.b.ball.vy = _local3.b.ball.vy + _local3.vy;
var _local9 = -_local3.b.ball._x;
var _local8 = -_local3.b.ball._y;
_local3.b.ball.vx = _local3.b.ball.vx + (_local9 / 4);
_local3.b.ball.vy = _local3.b.ball.vy + (_local8 / 4);
_local3.b.ball.vx = _local3.b.ball.vx * 0.9;
_local3.b.ball.vy = _local3.b.ball.vy * 0.9;
_local3.b.ball._x = _local3.b.ball._x + _local3.b.ball.vx;
_local3.b.ball._y = _local3.b.ball._y + _local3.b.ball.vy;
var _local23 = vecLenSq([_local9, _local8]);
var _local21 = _local3._width / 2;
if (_local23 > (_local21 * _local21)) {
var _local25 = _local3.b.ball._x + _local3._x;
var _local24 = _local3.b.ball._y + _local3._y;
spawnBall(_local25, _local24);
_local3.b.ball._visible = false;
}
} else if (_local3.bt == "magnet") {
for (j in balls) {
var _local6 = balls[j];
var _local8 = _local6._y - _local3._y;
var _local9 = _local6._x - _local3._x;
var _local16 = (_local8 * _local8) + (_local9 * _local9);
var _local13 = 1 / _local16;
_local13 = _local13 * -4000;
var _local7 = vecNorm([_local9, _local8]);
_local7 = vecScale(_local7, _local13);
_local6.vx = _local6.vx + _local7[0];
_local6.vy = _local6.vy + _local7[1];
}
} else if (_local3.bt == "cannon") {
if (!_local3.ltim) {
if (_local3.angle == undefined) {
_local3.angle = 0;
} else {
_local3.angle = _local3.angle + 2;
}
if (_local3.angle >= 360) {
_local3.angle = _local3.angle - 360;
}
}
_local3.b.bar._rotation = _local3.angle + 180;
if (_local3.ftim > 0) {
_local3.ftim--;
}
}
if ((_local3.is == "b") && (_local3._y > 420)) {
killBouncer(_local3);
}
}
}
function initBalls() {
_root.balls.removeMovieClip();
var _local2 = _root.getNextHighestDepth();
_root.createEmptyMovieClip("balls", _local2);
nballs = 0;
}
function spawnBall(x, y) {
var _local2 = balls.getNextHighestDepth();
var _local3 = "b" + _local2;
var _local1 = balls.attachMovie("Ball", _local3, _local2);
_local1._x = x;
_local1._y = y;
_local1.vx = 0;
_local1.vy = 0;
nballs++;
return(_local1);
}
function killBall(ob) {
_root.rootscore = _root.rootscore + ob.score;
ob.removeMovieClip();
nballs--;
if (nballs <= 0) {
delete onEnterFrame;
gover.play();
}
}
function initObs() {
_root.obs.removeMovieClip();
var _local2 = _root.getNextHighestDepth();
_root.createEmptyMovieClip("obs", _local2);
nbouncers = 0;
}
function spawnBouncer() {
var _local4 = (panel._x - (panel._width / 4)) + ((Math.random() * panel._width) / 2);
var _local3 = (panel._y - (panel._height / 4)) + ((Math.random() * panel._height) / 2);
var _local2 = obs.getNextHighestDepth();
var _local5 = "b" + _local2;
var _local1 = obs.attachMovie("Bouncer", _local5, _local2);
_local1._x = _local4;
_local1._y = _local3;
_local1.vx = 0;
_local1.vy = 0;
_local1.gotoAndPlay("appearing");
nbouncers++;
return(_local1);
}
function spawnTab() {
var _local4 = 0;
var _local3 = (Math.random() * (Stage.height - 100)) + 10;
var _local2 = obs.getNextHighestDepth();
var _local5 = "t" + _local2;
var _local1 = obs.attachMovie("Tab", _local5, _local2);
_local1._x = _local4;
_local1._y = _local3;
_local1.interval = setInterval(_local1, "expire", (5 + random(5)) * 1000);
return(_local1);
}
function killBouncer(ob) {
var _local3 = _root.getNextHighestDepth();
var _local4 = attachMovie("Explosion", "e" + _local3, _local3);
_local4._x = ob._x;
_local4._y = ob._y;
ob.removeMovieClip();
nbouncers--;
spawnBouncer();
var _local2 = new Sound(_root);
if (random(2)) {
_local2.attachSound("Burst");
} else {
_local2.attachSound("wathung.wav");
}
_local2.start();
}
function bouncerIn(ob) {
if ((ob._x + (ob._width / 2)) < (panel._x - 168)) {
return(false);
}
if ((ob._x - (ob._width / 2)) > (panel._x + 168)) {
return(false);
}
if ((ob._y + (ob._height / 2)) < (panel._y - 120)) {
return(false);
}
if ((ob._y - (ob._height / 2)) > (panel._y + 120)) {
return(false);
}
return(true);
}
stop();
var vroo = 0;
Mouse.hide();
onMouseMove = function () {
bat._x = _xmouse;
if ((bat._x - (bat._width / 2)) < 10) {
bat._x = 10 + (bat._width / 2);
}
if ((bat._x + (bat._width / 2)) > (sw - 10)) {
bat._x = (sw - 10) - (bat._width / 2);
}
updateAfterEvent();
};
initBalls();
initObs();
initHud();
rootscore = 0;
var b = spawnBall(250, 370);
b.vy = -15;
sw = Stage.width;
sh = Stage.height;
spawnBouncer();
spawnBouncer();
spawnBouncer();
onEnterFrame = perFrame;
Symbol 7 MovieClip [Ball] Frame 1
function bubble(x) {
var _local5 = _root.getNextHighestDepth();
var _local4 = _root.attachMovie("ScoreBubble", _local5, _local5);
_local4.number.text.text = x;
_local4._x = this._x + _parent._x;
_local4._y = this._y + _parent._y;
}
function addScore(x) {
score = score + x;
bubble(x);
update();
}
function doit(x) {
if (x == undefined) {
x = 5;
}
score = score + nxt;
bubble(nxt);
nxt = nxt + x;
update();
}
function zeroScore() {
score = 0;
update();
}
function multScore(x) {
score = score * x;
bubble("x" + x);
update();
}
function update() {
if (score == 0) {
scored = "";
} else {
scored = score;
}
}
var score = 0;
var nxt = 10;
var scored = "";
Symbol 20 MovieClip Frame 41
gotoAndPlay (1);
Symbol 28 MovieClip [Bouncer] Frame 46
var r = ["fruit", "ball", "magnet", "cannon", "lock"];
is = "b";
var bt = r[random(r.length)];
gotoAndPlay(bt);
radius = 60;
Symbol 28 MovieClip [Bouncer] Frame 55
stop();
Symbol 28 MovieClip [Bouncer] Frame 64
stop();
b.ball.vx = 0;
b.ball.vy = 0;
Symbol 28 MovieClip [Bouncer] Frame 73
stop();
Symbol 28 MovieClip [Bouncer] Frame 82
stop();
Symbol 28 MovieClip [Bouncer] Frame 91
stop();
Symbol 49 MovieClip Frame 60
stop();
Symbol 55 MovieClip Frame 60
stop();
Symbol 63 MovieClip Frame 1
if (!rec.lifted) {
rec.lifted = true;
rec._y = rec._y - 50;
} else {
rec._rotation = random(360);
}
Symbol 71 MovieClip Frame 1
function score(x) {
var _local2;
var _local3;
var _local5;
var _local4 = table.length;
i = 0;
while (i < _local4) {
_local2 = table[i];
_local3 = _local2[0];
if (_root.vroo >= _local3) {
_local5 = _local2[1];
de = _local2[2];
} else {
break;
}
i++;
}
_visible = true;
gotoAndStop(_local5);
}
stop();
_visible = false;
var de;
var table = [[0, 2, "Just a smell"], [1, 3, "Half a soap"], [40, 4, "A suicidal glass of water"], [100, 5, "A deformed pencil"], [400, 6, "A cubist robot party"], [666, 10, "A frantic numerologist"], [667, 6, "A cubist robot party"], [1000, 7, "An unsolved duck"], [2500, 8, "A confusing telephone"], [5000, 9, "The Epitome of Readiness"]];
Symbol 80 MovieClip Frame 90
ranks.score(_root.vroo);
Symbol 80 MovieClip Frame 106
dt = ranks.de;
Symbol 80 MovieClip Frame 127
stop();
Symbol 85 MovieClip [GameOver] Frame 1
stop();
Symbol 85 MovieClip [GameOver] Frame 18
stop();
Mouse.show();
delete _root.onMouseDown;
hit.onPress = function () {
_root.gotoAndPlay(1);
this._parent.removeMovieClip();
};
Symbol 87 MovieClip Frame 1
function onEnterFrame() {
_xscale = (_xscale - 2);
_yscale = (_yscale - 2);
_y = (_y + vy);
_x = (_x + vx);
vx = vx + ((Math.random() * 2) - 1);
}
vy = -((Math.random() * 10) + 5);
vx = (Math.random() * 10) - 5;
Symbol 88 MovieClip [Explosion] Frame 65
this.removeMovieClip();
Symbol 92 MovieClip Frame 1
var things = ["balls", "stretch"];
var thing = things[random(things.length)];
if ((thing == "stretch") && (_root.bat._xscale >= 200)) {
thing = "squash";
}
gotoAndStop(thing);
_parent.tis = thing;
Symbol 92 MovieClip Frame 2
function onHit() {
}
Symbol 92 MovieClip Frame 10
function onHit() {
_root.bat._xscale = _root.bat._xscale + 50;
}
Symbol 92 MovieClip Frame 18
function onHit() {
_root.bat._xscale = 100;
}
Symbol 93 MovieClip [Tab] Frame 1
function expire() {
clearInterval(interval);
gotoAndPlay ("expire");
}
Symbol 93 MovieClip [Tab] Frame 9
is = "t";
stop();
Symbol 93 MovieClip [Tab] Frame 15
tab.onHit();
this.removeMovieClip();
stop();
Symbol 93 MovieClip [Tab] Frame 23
stop();
this.removeMovieClip();
Symbol 97 MovieClip [ScoreBubble] Frame 41
this.removeMovieClip();
Symbol 110 MovieClip Frame 1
stop();
bumping = false;
Symbol 110 MovieClip Frame 7
bumping = true;
Symbol 110 MovieClip Frame 12
gotoAndStop ("idle");