Frame 1
_root.lev = 48;
fscommand ("showmenu", false);
_root.sunet = 1;
stop();
logo.onEnterFrame = function () {
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
_root.logo.play();
} else {
tgFrame = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
this.progress.gotoAndStop(tgFrame);
}
};
Frame 2
_root.scorMe = 0;
_root.scorAi = 0;
Instance of Symbol 27 MovieClip "mVel" in Frame 2
onClipEvent (enterFrame) {
newTime = getTimer();
newXMousePos = _root.b10._x;
dXDistance = newXMousePos - oldXMousePos;
newYMousePos = _root.b10._y;
dYDistance = newYMousePos - oldYMousePos;
dTime = Math.abs(oldTime - newTime);
xVelocity = Math.round((dXDistance / dTime) * 50);
yVelocity = Math.round((dYDistance / dTime) * 50);
oldTime = getTimer();
oldXMousePos = _root.b10._x;
oldYMousePos = _root.b10._y;
}
Instance of Symbol 35 MovieClip "b0" in Frame 2
onClipEvent (enterFrame) {
if (this._y > 290) {
this._y = 288;
}
if (this._y < 75) {
this._y = 77;
}
if (this._x < 68) {
this._x = 70;
}
if (this._x > 482) {
this._x = 480;
}
}
Instance of Symbol 37 MovieClip "b10" in Frame 2
onClipEvent (enterFrame) {
this._x = _root.zz1._x;
this._y = _root.zz1._y;
}
Instance of Symbol 38 MovieClip "zz" in Frame 2
onClipEvent (load) {
vx = 0;
vy = 0;
}
onClipEvent (enterFrame) {
if (_root.b0._x > 275) {
this._x = this._x + ((_root.b0._x - this._x) / 8);
vx = (_root.b0._x - this._x) / 8;
} else {
this._x = this._x + ((450 - this._x) / 8);
vx = (_root.b0._x - this._x) / 8;
}
this._y = this._y + ((_root.b0._y - this._y) / _root.lev);
vy = (_root.b0._y - this._y) / _root.lev;
}
Instance of Symbol 40 MovieClip "b3" in Frame 2
onClipEvent (enterFrame) {
this._x = _root.zz._x;
this._y = _root.zz._y;
}
Instance of Symbol 41 MovieClip "zz1" in Frame 2
onClipEvent (enterFrame) {
if ((_root._xmouse > 80) && (_root._xmouse < 250)) {
this._x = _root._xmouse;
Mouse.hide();
} else if (_root._xmouse < 80) {
this._x = 80;
} else if (_root._xmouse > 250) {
this._x = 250;
}
if ((_root._ymouse > 80) && (_root._ymouse < 280)) {
this._y = _root._ymouse;
Mouse.hide();
} else if (_root._ymouse < 80) {
this._y = 80;
Mouse.show();
} else if (_root._ymouse > 290) {
this._y = 280;
Mouse.show();
}
}
Frame 3
stop();
controller.ballHittest = function (clip1, clip2) {
xp = clip1._x - clip2._x;
yp = clip1._y - clip2._y;
dist = Math.sqrt((xp * xp) + (yp * yp));
r1 = clip1._width / 2;
r2 = clip2._width / 2;
if (dist <= (r1 + r2)) {
return(true);
}
return(false);
};
stop();
this.onEnterFrame = function () {
txt1.text = scorMe;
txt2.text = scorAi;
};
controller.ballHittest = function (clip1, clip2) {
xp = clip1._x - clip2._x;
yp = clip1._y - clip2._y;
dist = Math.sqrt((xp * xp) + (yp * yp));
r1 = clip1._width / 2;
r2 = clip2._width / 2;
if (dist <= (r1 + r2)) {
return(true);
}
return(false);
};
Instance of Symbol 51 MovieClip "controller" in Frame 3
onClipEvent (load) {
function getDistanceSquare(clip, clip2) {
var xp = (clip._x - clip2._x);
var yp = (clip._y - clip2._y);
return((xp * xp) + (yp * yp));
}
ballsArray = [];
ballsArray[2] = _root.b0;
ballsArray[1] = _root.b3;
ballsArray[0] = _root.b10;
var k = 0;
while (k < ballsArray.length) {
ballsArray[k].dx = 0;
ballsArray[k].dy = 0;
ballsArray[k].moving = false;
ballsArray[k].disabled = false;
k++;
}
diameter = _root.b10._width;
diameterSquare = diameter * diameter;
bgLeft = 48 + (diameter / 2);
bgRight = 502 - (diameter / 2);
bgTop = 55 + (diameter / 2);
bgBottom = 310 - (diameter / 2);
}
onClipEvent (enterFrame) {
_root.b0.moving = true;
_root.zz1.atins = 0;
if (ballHittest(_root.b10, _root.b0)) {
_root.zz1.atins = 1;
oldTime2 = getTimer();
}
_root.b10.dx = _root.mVel.xVelocity;
_root.b10.dy = _root.mVel.yVelocity;
if (Math.abs(_root.b10.dx) > 15) {
_root.b10.dx = 15 * (_root.b10.dx / Math.abs(_root.b10.dx));
}
if (Math.abs(_root.b10.dy) > 15) {
_root.b10.dy = 15 * (_root.b10.dy / Math.abs(_root.b10.dy));
}
_root.b10.frictionX = _root.b10.dx / 200;
_root.b10.frictionY = _root.b10.dy / 200;
_root.b10.moving = true;
_root.b3.dx = _root.zz.vx;
_root.b3.dy = _root.zz.vy;
_root.b3.dx = 10 * (_root.b3.dx / Math.abs(_root.b3.dx));
_root.b3.dy = 10 * (_root.b3.dy / Math.abs(_root.b3.dy));
_root.b3.frictionX = _root.b3.dx / 200;
_root.b3.frictionY = _root.b3.dy / 200;
_root.b3.moving = true;
if (fsec > 70) {
return(undefined);
}
var k = 0;
while (k < ballsArray.length) {
clip = ballsArray[k];
if (clip.moving == false) {
} else if (clip.disabled) {
} else if (clip.bounced) {
} else {
var m = 0;
while (m < ballsArray.length) {
clip2 = ballsArray[m];
if ((m <= k) && (clip2.moving)) {
} else if (clip2.disabled) {
} else {
xoff = clip2._x - clip._x;
yoff = clip2._y - clip._y;
if (((xoff * xoff) + (yoff * yoff)) > diameterSquare) {
} else {
clip.moving = true;
clip2.moving = true;
_root.bouncer.bounce(clip, clip2);
}
}
m++;
}
var m = 0;
while (m < holesArray.length) {
clip2 = holesArray[m];
xoff = clip2._x - clip._x;
yoff = clip2._y - clip._y;
if (((xoff * xoff) + (yoff * yoff)) > diameterSquare) {
} else {
fireN++;
duplicateMovieClip (_root.fire, "fire" + fireN, fireN);
_root["fire" + fireN].ball = clip;
}
m++;
}
}
k++;
}
}
onClipEvent (enterFrame) {
t1 = getTimer();
fsec = t1 - t2;
t2 = t1;
var p = 0;
while (p < ballsArray.length) {
clip3 = ballsArray[p];
if (clip3.disabled) {
} else if (clip3.moving == false) {
} else {
clip3.dx = clip3.dx - clip3.frictionX;
clip3.dy = clip3.dy - clip3.frictionY;
clip3._x = clip3._x + clip3.dx;
clip3._y = clip3._y + clip3.dy;
dx = clip3.dx;
dy = clip3.dy;
if (clip3._x < bgLeft) {
clip3.dx = Math.abs(dx);
clip3.frictionX = Math.abs(clip3.frictionX);
if (_root.sunet == 1) {
_root.son1.start();
}
} else if (clip3._x > bgRight) {
if (_root.sunet == 1) {
}
clip3.dx = -Math.abs(dx);
clip3.frictionX = -Math.abs(clip3.frictionX);
}
if (clip3._y < bgTop) {
if (_root.sunet == 1) {
}
clip3.dy = Math.abs(dy);
clip3.frictionY = Math.abs(clip3.frictionY);
} else if (clip3._y > bgBottom) {
if (_root.sunet == 1) {
}
clip3.dy = -Math.abs(dy);
clip3.frictionY = -Math.abs(clip3.frictionY);
}
if (((dx * dx) + (dy * dy)) < 0.003) {
clip3.dx = 0;
clip3.dy = 0;
clip3.frictionX = 0;
clip3.frictionY = 0;
clip3.moving = false;
}
}
p++;
}
}
Instance of Symbol 52 MovieClip "bouncer" in Frame 3
onClipEvent (load) {
function bounce(clip, clip2) {
var angle = Math.atan2(clip._y - clip2._y, clip._x - clip2._x);
this._rotation = (angle * 180) / Math.PI;
var pt2 = {x:clip2.dx * 10, y:clip2.dy * 10};
this.globalToLocal(pt2);
var subVector2 = {x:pt2.x, y:0};
this.localToGlobal(subVector2);
var pt = {x:clip.dx * 10, y:clip.dy * 10};
this.globalToLocal(pt);
var subVector = {x:pt.x, y:0};
this.localToGlobal(subVector);
if ((pt2.x <= 0) && (pt.x >= 0)) {
return(undefined);
}
var xSub = ((subVector2.x - subVector.x) / 10);
var ySub = ((subVector2.y - subVector.y) / 10);
clip.dx = clip.dx + xSub;
clip.dy = clip.dy + ySub;
clip2.dx = clip2.dx - xSub;
clip2.dy = clip2.dy - ySub;
var ang = Math.atan2(clip.dy, clip.dx);
clip.frictionX = Math.cos(ang) / 20;
clip.frictionY = Math.sin(ang) / 20;
var ang2 = Math.atan2(clip2.dy, clip2.dx);
clip2.frictionX = Math.cos(ang2) / 20;
clip2.frictionY = Math.sin(ang2) / 20;
}
}
Frame 4
if (_root.lev == 48) {
bbx1._visible = 1;
bbx2._visible = 0;
bbx3._visible = 0;
}
if (_root.lev == 24) {
bbx1._visible = 0;
bbx2._visible = 1;
bbx3._visible = 0;
}
if (_root.lev == 6) {
bbx1._visible = 0;
bbx2._visible = 0;
bbx3._visible = 1;
}
if (_root.scorMe > _root.scorAi) {
if (_root.lev == 48) {
mesaj = "YOU WON! \nTry your skills with the medium difficulty level.";
}
if (_root.lev == 24) {
mesaj = "YOU WON! \nTry your skills with the hard difficulty level.";
}
if (_root.lev == 6) {
mesaj = "YOU WON!";
}
}
if (_root.scorAi > _root.scorMe) {
if (_root.lev == 48) {
mesaj = "YOU LOST! \nTry again.";
}
if (_root.lev == 24) {
mesaj = "YOU LOST! \nTry with the easy difficulty level.";
}
if (_root.lev == 6) {
mesaj = "YOU LOST! \nTry with the medium difficulty level.";
}
}
if (_root.scorAi == _root.scorMe) {
mesaj = "DRAW! \nTry Again.";
}
_root.mes.text = mesaj;
son = new Sound();
son.attachSound("muzica");
son.setVolume(40);
son1 = new Sound();
son1.attachSound("shot");
if (_root.kx == null) {
son.start(1, 9999);
_root.kx = 1;
}
stop();
Mouse.show();
but.onRelease = function () {
_root.gotoAndPlay(2);
};
if ((_root.scorMe - _root.scorAi) > _root.oldScore) {
bMe.text = _root.scorMe;
bAi.text = _root.scorAi;
_root.oldScore = _root.scorMe - _root.scorAi;
}
Symbol 11 MovieClip Frame 1
stop();
Symbol 15 MovieClip Frame 84
stop();
Symbol 15 MovieClip Frame 358
_root.gotoAndStop(4);
Symbol 25 MovieClip Frame 1
tg1.onEnterFrame = function () {
if (this.hittest(_root.b0)) {
if ((getTimer() - oldTime1) > 2000) {
oldTime1 = getTimer;
_root.scorAi++;
_root.scorer = "ai";
_root.scored.play();
}
}
if (_root.scorAi > 6) {
_root.gotoAndStop(4);
}
};
tg2.onEnterFrame = function () {
if (this.hittest(_root.b0)) {
if ((getTimer() - oldTime2) > 2000) {
oldTime2 = getTimer;
_root.scorMe++;
_root.scorer = "me";
_root.scored.play();
}
}
if (_root.scorMe > 6) {
_root.gotoAndStop(4);
}
};
Symbol 35 MovieClip Frame 1
stop();
Symbol 44 Button
on (release) {
_root.gotoAndStop(4);
}
Symbol 59 MovieClip Frame 1
stop();
Symbol 59 MovieClip Frame 2
_root.b0._x = 270;
_root.b0._y = 180;
_root.b0.dx = 0;
_root.b0.dy = 0;
if (_root.scorer == "me") {
_root.b0.dx = 3;
}
if (_root.scorer == "ai") {
_root.b0.dx = -3;
}
_root.b0.disabled = true;
_root.b0._visible = 0;
Symbol 59 MovieClip Frame 55
_root.b0.disabled = false;
_root.b0._visible = 1;
Symbol 62 Button
on (release) {
if (_root.sunet == 0) {
_root.sunet = 1;
_root.son.start(0, 100);
} else {
_root.sunet = 0;
_root.son.stop();
}
}
Symbol 73 Button
on (release) {
bbx1._visible = 1;
bbx2._visible = 0;
bbx3._visible = 0;
_root.lev = 48;
}
Symbol 75 Button
on (release) {
bbx1._visible = 0;
bbx2._visible = 1;
bbx3._visible = 0;
_root.lev = 24;
}
Symbol 77 Button
on (release) {
bbx1._visible = 0;
bbx2._visible = 0;
bbx3._visible = 1;
_root.lev = 6;
}