Frame 1
stop();
Frame 2
function moveTheBalls() {
x = 1;
while (theNumberOfBalls >= x) {
thisBall = theBallsList["ball" + x];
if ((!thisBall) == 0) {
thisBall.moveBall();
}
x++;
}
}
function newBallList(startBallNum) {
this["ball" + startBallNum] = new newBall("ball" + startBallNum);
}
function addNewBall() {
theNumberOfBalls++;
theCurBallNum++;
theBallsList["ball" + theNumberOfBalls] = new newBall("ball" + theNumberOfBalls);
}
function maketargetList(numOfTiles) {
i = 0;
while (i < numOfTiles) {
gTargetList[i] = String("tile" + (i + 1));
i++;
}
}
function newBall(instName) {
duplicateMovieClip ("ball", instName, theNumberOfBalls);
this.name = instName;
this.MovieClip = _root[instName];
this.MovieClip._x = gBallBaseLoc[0];
this.MovieClip._y = gBallBaseLoc[1];
this.deltaX = getRandom(-5, 5);
this.deltaY = -10;
this.HitNum = 0;
}
function resetGame() {
maketargetList(gTileNum);
resetTiles();
}
function resetTiles() {
i = 0;
while (i < gTileNum) {
var thisTile = gTargetList[i];
_root[thisTile]._x = _root[thisTile].startX;
i++;
}
}
function checkForXtraBall(theBallName) {
var xtraBallNum = xtraBallList.length;
i = 0;
while (i < xtraBallNum) {
if (theBallName eq xtraBallList[i]) {
return(1);
}
i++;
}
}
function getRandom(x, y) {
return(Math.round(Math.random() * (y - x)) + x);
}
Mouse.hide();
gameOn = 1;
theScore = 0;
gBallBaseLoc = [200, 300];
gThePaddle = [_root.paddle, _root.paddle2];
gGameRect = [0, 0, 400, 500];
gHMax = pGameRect[2] - 5;
gTileNum = 35;
gTargetList = [];
maketargetList(gTileNum);
theNumberOfBalls = 1;
theCurBallNum = 1;
theBallsList = new newBallList(theNumberOfBalls);
ballsLeft = 2;
xtraBallList = ["tile16", "tile18", "tile33"];
_root.resetTiles();
newBall.prototype.moveBall = function () {
this.MovieClip._x = this.MovieClip._x + this.deltaX;
this.MovieClip._y = this.MovieClip._y + this.deltaY;
if (this.MovieClip._y < 0) {
this.flipY();
}
var theTileNum = gTargetList.length;
i = 0;
while (i < theTileNum) {
var thisTile = gTargetList[i];
if (this.MovieClip.hitTest(_root[thisTile])) {
this.increaseSpeed();
theScore = theScore + (10 * theCurBallNum);
_root[thisTile]._x = _root[thisTile]._x + -1000;
gTargetList.splice(i, 1);
this.flipY();
if (checkForXtraBall(thisTile)) {
addNewBall();
}
if (gTargetList.length == 0) {
resetGame();
}
break;
}
i++;
}
thisPad = 0;
while (thisPad < 2) {
var thePaddle = gThePaddle[thisPad];
if (this.MovieClip.hitTest(thePaddle) && (0 < this.deltaY)) {
this.paddleHit(thePaddle);
}
thisPad++;
}
if ((gGameRect[3] + 20) < this.MovieClip._y) {
theBallsList[this.name] = 0;
removeMovieClip(this.MovieClip);
theCurBallNum--;
if (0 >= theCurBallNum) {
ballsLeft--;
if (ballsLeft < 0) {
ballsLeft = 0;
gameOn = 0;
gotoAndStop (6);
} else {
addNewBall();
}
}
}
if ((this.MovieClip._x < gGameRect[0]) || (gGameRect[2] < this.MovieClip._x)) {
this.flipX();
}
};
newBall.prototype.serveBall = function () {
this.MovieClip._x = gBallBaseLoc[0];
this.MovieClip._y = gBallBaseLoc[1];
this.deltaX = getRandom(-5, 5);
this.deltaY = -10;
};
newBall.prototype.flipY = function () {
this.deltaY = this.deltaY * -1;
};
newBall.prototype.flipX = function () {
this.deltaX = this.deltaX * -1;
};
newBall.prototype.paddleHit = function (thePaddle) {
this.deltaX = (this.MovieClip._x - thePaddle._x) / 4;
this.flipY();
this.MovieClip._y = Math.min(this.MovieClip._y, thePaddle._y + 10);
};
newBall.prototype.increaseSpeed = function () {
if ((this.deltaY < -18) || (18 < this.deltaY)) {
} else {
this.hitNum++;
if (3 < this.hitNum) {
this.hitNum = 0;
if (0 < this.deltaY) {
this.deltaY++;
} else {
this.deltaY--;
}
}
}
};
Instance of Symbol 18 MovieClip "tile29" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile30" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile31" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile32" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile33" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile34" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile35" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile22" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile23" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile24" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile25" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile26" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile27" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile28" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile15" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile16" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile17" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile18" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile19" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile20" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile21" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile8" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile9" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile10" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile11" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile12" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile13" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile14" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile1" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile2" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile3" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile4" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile5" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile6" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 19 MovieClip "tile7" in Frame 2
onClipEvent (load) {
startX = this._x;
}
Instance of Symbol 20 MovieClip "paddle" in Frame 2
onClipEvent (enterFrame) {
if (_root.gameOn) {
if (_root.useMouseOn) {
this._x = _root._xmouse;
} else if (Key.isDown(Key.LEFT)) {
this._x = this._x - 15;
} else if (Key.isDown(Key.RIGHT)) {
this._x = this._x + 15;
}
}
if (this._x < 0) {
this._x = 0;
} else if (400 < this._x) {
this._x = 400;
}
}
Instance of Symbol 20 MovieClip "paddle2" in Frame 2
onClipEvent (enterFrame) {
if (_root.gameOn) {
if (_root.useMouseOn) {
this._x = _root._xmouse;
} else if (Key.isDown(Key.LEFT)) {
this._x = this._x - 15;
} else if (Key.isDown(Key.RIGHT)) {
this._x = this._x + 15;
}
}
if (this._x < 0) {
this._x = 0;
} else if (400 < this._x) {
this._x = 400;
}
}
Frame 3
moveTheBalls();
Frame 4
gotoAndPlay (3);
Frame 6
Mouse.show();
Symbol 6 Button
on (release) {
useMouseOn = 1;
gotoAndPlay (2);
}
Symbol 9 Button
on (release) {
_root.useMouseOn = 0;
gotoAndPlay (2);
}
Symbol 31 Button
on (release) {
gotoAndPlay (1);
}