Frame 1
stop();
Instance of Symbol 10 MovieClip "flipperRight" in Frame 1
onClipEvent (load) {
angle = 0;
ismoving = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if (this._rotation < 90) {
ismoving = true;
this._rotation = angle;
angle = angle + 50;
} else {
ismoving = false;
}
} else {
ismoving = false;
angle = 0;
this._rotation = angle;
}
}
Instance of Symbol 12 MovieClip "flipperLeft" in Frame 1
onClipEvent (load) {
angle = 0;
ismoving = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
if (-90 < this._rotation) {
ismoving = true;
this._rotation = angle;
angle = angle - 50;
} else {
ismoving = false;
}
} else {
ismoving = false;
angle = 360;
this._rotation = angle;
}
}
Frame 45
stop();
Instance of Symbol 38 MovieClip "ball" in Frame 45
onClipEvent (load) {
movy = -2;
movx = 1;
colid = false;
(oldy = 0);
score = 0;
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
startDrag (this);
}
}
onClipEvent (mouseUp) {
stopDrag();
}
onClipEvent (enterFrame) {
_root.text = score;
s = new Sound();
s.attachSound("looserwav");
if (384 < this._y) {
s.start();
_root.gotoAndPlay(1);
}
var friction = 0.02;
if (Math.abs(movx)) {
movx = movx - (movx * friction);
}
if (Math.abs(movy)) {
movy = movy - (movy * friction);
}
if (!colid) {
movy = movy + 0.12;
}
if (5 < movx) {
movx = 5;
} else if (movx < -5) {
movx = -5;
}
if (4 < movy) {
movy = 4;
} else if (movy < -8) {
movy = -8;
}
this._x = this._x + movx;
this._y = this._y + movy;
obstNum = 11;
i = 0;
for ( ; i < obstNum ; i++) {
var ball = this;
var obstacle = _root["obst" + i];
var collisionX = (obstacle._x - ball._x);
var collisionY = (obstacle._y - ball._y);
var distanceSquared = ((collisionX * collisionX) + (collisionY * collisionY));
var sumRadius = ((ball._height / 2) + (obstacle._height / 2));
var sumRadiusSquared = (sumRadius * sumRadius);
if (sumRadiusSquared >= distanceSquared) {
score = score + 150;
obstacle.play();
var collisionVectorLength = Math.sqrt(distanceSquared);
if (collisionVectorLength == 0) {
collisionVectorLength = 1;
}
var collisionNormalX = (collisionX / collisionVectorLength);
var collisionNormalY = (collisionY / collisionVectorLength);
var Acvx = ((movx * collisionNormalX) + (movy * collisionNormalY));
var Acvy = ((movy * collisionNormalX) - (movx * collisionNormalY));
if (Acvx < 0) {
continue;
}
var Bcvx = 0;
var Bcvy = 0;
var m1 = 3;
var m2 = 100;
var mT = (m1 + m2);
var Afvx = ((((m1 - m2) * Acvx) + ((m2 + m2) * Bcvx)) / mT);
movx = (Afvx * collisionNormalX) - (Acvy * collisionNormalY);
movy = (collisionNormalX * Acvy) + (Afvx * collisionNormalY);
movx = movx * 5;
movy = movy * 5;
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
}
if (this._y < (_root.wallTop._y + (this._height / 2))) {
this._y = _root.wallTop._y + (this._height / 2);
movy = movy * -1;
} else if ((_root.wallBot._y - (this._height / 2)) < this._y) {
this._y = _root.wallBot._y - (this._height / 2);
movy = movy * -1;
} else if ((_root.wallRig._x - (this._height / 2)) < this._x) {
this._x = _root.wallRig._x - (this._height / 2);
movx = movx * -1;
} else if (this._x < (_root.wallLef._x + (this._height / 2))) {
this._x = _root.wallLef._x + (this._height / 2);
movx = movx * -1;
}
oldx = this._x;
oldy = this._y;
if (_root.flipperLeft.hitTest(this._x, this._y, true) || (_root.flipperRight.hitTest(this._x, this._y, true))) {
if (_root.flipperRight.hitTest(this._x, this._y, true)) {
var flipper = _root.flipperRight;
var angle = (45 + _root.flipperRight._rotation);
var phiRad = (Math.PI * (angle / 180));
} else if (_root.flipperLeft.hitTest(this._x, this._y, true)) {
var flipper = _root.flipperLeft;
var angle = (135 + _root.flipperLeft._rotation);
var phiRad = (Math.PI * (angle / 180));
}
var movxN = ((movx * Math.cos(phiRad)) - (movy * Math.sin(phiRad)));
var movyN = ((movx * Math.sin(phiRad)) + (movy * Math.cos(phiRad)));
this._x = oldx;
this._y = oldy - 2;
if ((0 < movy) && (flipper.ismoving)) {
movyN = movyN * -4.5;
} else if ((0 < movy) && (!flipper.ismoving)) {
movyN = movyN * -1;
} else if ((movy < 0) && (flipper.ismoving)) {
movyN = movyN * 4.5;
} else if ((movy < 0) && (!flipper.ismoving)) {
movyN = movyN * 1;
}
movx = (movxN * Math.cos(phiRad)) + (movyN * Math.sin(phiRad));
movy = ((-movxN) * Math.sin(phiRad)) + (movyN * Math.cos(phiRad));
colid = true;
} else {
colid = false;
}
}
Symbol 17 MovieClip Frame 1
stop();
Symbol 17 MovieClip Frame 15
gotoAndStop (1);
Symbol 18 MovieClip Frame 1
stop();
Symbol 18 MovieClip Frame 15
gotoAndStop (1);
Symbol 28 Button
on (release) {
play();
}