Frame 1
fscommand ("fullscreen", "false");
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
stop();
Frame 2
current_bytes = this.getBytesLoaded();
tot_bytes = this.getBytesTotal();
percent = int((current_bytes / tot_bytes) * 100) + "% ";
if (current_bytes >= tot_bytes) {
gotoAndStop (5);
}
Frame 3
this.gotoAndPlay("loader");
Frame 4
stop();
Frame 5
c1 = _url.indexOf("://") + 3;
c2 = _url.indexOf("/", c1);
domain = _url.substring(c1, c2);
if (((domain == "www.dreamarcade.com") || (domain == "216.55.181.4")) || (domain == "www.ultimatearcade.com")) {
gotoAndStop (15);
} else {
gotoAndStop (15);
}
Frame 15
gotoAndStop (26);
Frame 26
timeover = new Sound();
timeover.attachSound("timeover");
fall = new Sound();
fall.attachSound("fall");
rack = new Sound();
rack.attachSound("rack");
cueball = new Sound();
cueball.attachSound("cueball");
ballhit = new Sound();
ballhit.attachSound("ballhit");
_root.finalscore = 0;
stop();
Math.convertToDeg = function (rad) {
return((rad / Math.PI) * 180);
};
Table = function () {
this.ballSetup = [];
this.ballSetup[0] = [{x:50, y:150}, {x:200, y:100}, {x:200, y:200}, {x:300, y:100}, {x:300, y:200}];
this.ballSetup[1] = [{x:50, y:150}, {x:200, y:100}, {x:200, y:200}, {x:300, y:100}, {x:300, y:200}, {x:250, y:150}];
this.ballSetup[2] = [{x:50, y:150}, {x:100, y:45}, {x:100, y:240}, {x:230, y:45}, {x:230, y:240}, {x:360, y:45}, {x:360, y:240}];
this.ballSetup[3] = [{x:50, y:150}, {x:70, y:270}, {x:120, y:220}, {x:170, y:170}, {x:220, y:120}, {x:270, y:70}, {x:320, y:20}];
this.ballSetup[4] = [{x:50, y:150}, {x:10, y:150}, {x:370, y:150}, {x:85, y:15}, {x:85, y:270}, {x:285, y:270}, {x:285, y:15}];
this.ballSetup[5] = [{x:50, y:150}, {x:200, y:150}, {x:370, y:150}, {x:270, y:15}, {x:270, y:270}, {x:305, y:270}, {x:305, y:15}];
this.ballSetup[6] = [{x:50, y:150}, {x:240, y:150}, {x:270, y:130}, {x:270, y:170}, {x:300, y:110}, {x:300, y:190}, {x:300, y:150}];
this.ballSetup[7] = [{x:50, y:150}, {x:240, y:150}, {x:270, y:130}, {x:270, y:170}, {x:300, y:110}, {x:300, y:190}, {x:300, y:150}, {x:330, y:130}, {x:330, y:170}];
this.ballSetup[8] = [{x:50, y:150}, {x:240, y:150}, {x:270, y:130}, {x:270, y:170}, {x:300, y:110}, {x:300, y:190}, {x:330, y:90}, {x:330, y:210}, {x:330, y:150}];
this.ballSetup[9] = [{x:50, y:150}, {x:240, y:150}, {x:270, y:130}, {x:270, y:170}, {x:300, y:110}, {x:300, y:190}, {x:330, y:90}, {x:330, y:210}, {x:330, y:130}, {x:330, y:170}];
alarm = "off";
this.BALL_DIAMETER = 20;
this.BALL_RADIUS = this.BALL_DIAMETER / 2;
this.TOP = this.surface._y + this.BALL_RADIUS;
this.BOTTOM = (this.surface._y + this.surface._height) - this.BALL_RADIUS;
this.LEFT = this.surface._x + this.BALL_RADIUS;
this.RIGHT = (this.surface._x + this.surface._width) - this.BALL_RADIUS;
this.BOUNCE = -0.8;
this.FRICTION_EFFECT = 0.98;
this.MINSPEED = 0.25;
this.TIME_LIMIT = 100;
this.score = 0;
this.timeRemain_txt.autoSize = "center";
this.score_txt.autoSize = "center";
this.level_txt.autoSize = "center";
this.attachMovie("cue", "cue", 9999);
};
Table.prototype = new MovieClip();
Table.prototype.init = function (level) {
this.balls = [];
this.potted = [];
this.numBalls = this.ballSetup[level].length;
var i = 0;
while (i < this.numBalls) {
var b = this.attachMovie("ball", "ball" + i, i).init(this.ballSetup[level][i].x + this.LEFT, this.ballSetup[level][i].y + this.TOP, i);
b._width = (b._height = this.BALL_DIAMETER);
this.shadow.attachMovie("shadow", "shadow" + i, i, {_x:b._x, _y:b._y});
if (i == 0) {
b.gotoAndStop(1);
} else {
b.gotoAndStop(2);
}
this.balls.push(b);
i++;
}
this.level = level;
this.timeRemain = this.TIME_LIMIT;
this.displayLevel(this.level + 1);
this.displayScore();
this.displayTimeRemain();
this.startTimer();
_root.timeover.stop();
_root.rack.start();
this._parent.explosion.removeMovieClip();
this._parent.win.removeMovieClip();
this._parent.start_mc.removeMovieClip();
this.swapDepths(1);
this.onEnterFrame = this.checkCollisions;
return(this);
};
Table.prototype.checkCollisions = function () {
var moving = false;
var i = 0;
while (i < this.numBalls) {
var ball1 = this.balls[i];
if ((ball1.vx != 0) || (ball1.vy != 0)) {
moving = true;
}
var j = (i + 1);
while (j < this.numBalls) {
var ball2 = this.balls[j];
var dx = (ball1._x - ball2._x);
var dy = (ball1._y - ball2._y);
var dist = Math.sqrt((dx * dx) + (dy * dy));
if (dist < this.BALL_DIAMETER) {
_root.ballhit.start();
var angle = Math.atan2(dy, dx);
ball1._x = ball2._x + (Math.cos(angle) * this.BALL_DIAMETER);
ball1._y = ball2._y + (Math.sin(angle) * this.BALL_DIAMETER);
var vx2 = ((Math.cos(angle) * ball1.vx) + (Math.sin(angle) * ball1.vy));
var vy1 = ((Math.cos(angle) * ball1.vy) - (Math.sin(angle) * ball1.vx));
var vx1 = ((Math.cos(angle) * ball2.vx) + (Math.sin(angle) * ball2.vy));
var vy2 = ((Math.cos(angle) * ball2.vy) - (Math.sin(angle) * ball2.vx));
ball1.vx = (Math.cos(angle) * vx1) - (Math.sin(angle) * vy1);
ball1.vy = (Math.cos(angle) * vy1) + (Math.sin(angle) * vx1);
ball2.vx = (Math.cos(angle) * vx2) - (Math.sin(angle) * vy2);
ball2.vy = (Math.cos(angle) * vy2) + (Math.sin(angle) * vx2);
ball1.onEnterFrame = ball1.move;
ball2.onEnterFrame = ball2.move;
}
j++;
}
i++;
}
if (!moving) {
this.cue.doFadeIn = true;
cuestick = "no";
this.cue.setEventHandlers();
delete this.onEnterFrame;
}
};
Table.prototype.startTimer = function () {
this.startTime = getTimer();
this.timerID = setInterval(this, "gameTimer", 1000);
};
Table.prototype.stopTimer = function () {
clearInterval(this.timerID);
};
Table.prototype.gameTimer = function () {
var timeElapsed = Math.round((getTimer() - this.startTime) / 1000);
this.timeRemain = this.TIME_LIMIT - timeElapsed;
if ((this.timeRemain <= 10) && (alarm == "off")) {
_root.timeover.start();
alarm = "on";
}
if (this.timeRemain <= 0) {
this.stopTimer();
this.gameOver();
} else {
this.displayTimeRemain();
}
};
Table.prototype.displayScore = function () {
this.score_txt.text = "Score: " + this.score;
_root.finalscore = this.score;
};
Table.prototype.displayTimeRemain = function () {
var i = 1;
while (i < this.numBalls) {
this["ball" + i].displayTimeRemain(this.timeRemain);
i++;
}
this.timeRemain_txt.text = "Time: " + this.timeRemain;
};
Table.prototype.displayLevel = function (lvl) {
this.level_txt.text = "Level: " + lvl;
alarm = "off";
};
Table.prototype.gameOver = function () {
trace("game over");
this.stopTimer();
delete this.onEnterFrame;
this._parent.attachMovie("explosion", "explosion", 1, {_x:55, _y:10, pts:this.score});
};
Table.prototype.nextLevel = function () {
this.stopTimer();
delete this.onEnterFrame;
this.level++;
if (this.level < this.ballSetup.length) {
this.init(this.level);
} else {
trace("congratulations");
this._parent.attachMovie("win", "win", 1, {_x:55, _y:10, pts:this.score});
}
};
Object.registerClass("table", Table);
Ball = function () {
};
Ball.prototype = new MovieClip();
Ball.prototype.init = function (x, y, id) {
this._x = x;
this._y = y;
this.id = id;
this.vx = 0;
this.vy = 0;
this.speed = 0;
return(this);
};
Ball.prototype.setColour = function (colour) {
new Color(this).setRGB(colour);
};
Ball.prototype.move = function () {
this.vx = this.vx * this._parent.FRICTION_EFFECT;
this.vy = this.vy * this._parent.FRICTION_EFFECT;
this._x = this._x + this.vx;
this._y = this._y + this.vy;
if (this._x > this._parent.RIGHT) {
this._x = this._parent.RIGHT;
this.vx = this.vx * this._parent.BOUNCE;
} else if (this._x < this._parent.LEFT) {
this._x = this._parent.LEFT;
this.vx = this.vx * this._parent.BOUNCE;
}
if (this._y > this._parent.BOTTOM) {
this._y = this._parent.BOTTOM;
this.vy = this.vy * this._parent.BOUNCE;
} else if (this._y < this._parent.TOP) {
this._y = this._parent.TOP;
this.vy = this.vy * this._parent.BOUNCE;
}
var pocketID = 0;
while (this._parent["pocket" + pocketID] != undefined) {
var p = this._parent["pocket" + pocketID];
var dx = (p._x - this._x);
var dy = (p._y - this._y);
var dist = Math.sqrt((dx * dx) + (dy * dy));
if (dist < (p._width / 2)) {
this.vx = (this.vy = 0);
this._x = -500;
_root.fall.start();
this._y = (this._parent.BALL_DIAMETER + 10) * this.id;
delete this.onEnterFrame;
if (this.id == 0) {
this._parent.gameOver();
} else {
this._parent.score = this._parent.score + this._parent.timeRemain;
this._parent.displayScore();
this._parent.potted.push(this.id);
if (this._parent.potted.length == (this._parent.numBalls - 1)) {
this._parent.nextLevel();
}
}
}
pocketID++;
}
this._parent.shadow["shadow" + this.id]._x = this._x;
this._parent.shadow["shadow" + this.id]._y = this._y;
this.speed = Math.sqrt((this.vx * this.vx) + (this.vy * this.vy));
if (this.speed < this._parent.MINSPEED) {
this.vx = (this.vy = 0);
delete this.onEnterFrame;
}
};
Object.registerClass("ball", Ball);
Cue = function () {
this.onEnterFrame = this.aim;
this._alpha = 0;
this.doFadeIn = true;
this.cueAni._x = (-this._parent.BALL_RADIUS) - 10;
this.midStroke = false;
this.power = 0;
this.dir = 1;
this.setEventHandlers();
};
Cue.prototype = new MovieClip();
Cue.prototype.setEventHandlers = function () {
this.onMouseDown = this.powerUp;
this.onMouseUp = this.startShot;
};
Cue.prototype.aim = function () {
if (!this.midStroke) {
this.cueAngle = Math.atan2(this._parent._ymouse - this._y, this._parent._xmouse - this._x);
this._rotation = Math.convertToDeg(this.cueAngle);
}
if (this.doFadeIn) {
this.fadeIn();
}
};
Cue.prototype.powerUp = function () {
this.power = 0;
this.dir = 1;
this._parent.powerbar.gotoAndStop(1);
this.powerID = setInterval(this, "varyPower", 40);
};
Cue.prototype.varyPower = function () {
this.power = this.power + (this.dir * 2);
if (this.power > 25) {
this.power = 26;
this.dir = this.dir * -1;
} else if (this.power < 1) {
this.power = 0;
this.dir = this.dir * -1;
}
this._parent.powerbar.gotoAndStop(this.power / 2);
};
Cue.prototype.startShot = function () {
this.midStroke = true;
this.cueAni.gotoAndPlay(2);
clearInterval(this.powerID);
delete this.onMouseDown;
delete this.onMouseUp;
};
Cue.prototype.hitBall = function () {
if (cuestick == "yes") {
_root.cueball.start();
}
this.midStroke = false;
this._parent.balls[0].vx = this.power * Math.cos(this.cueAngle);
this._parent.balls[0].vy = this.power * Math.sin(this.cueAngle);
this._parent.onEnterFrame = this._parent.checkCollisions;
this._parent.balls[0].onEnterFrame = this._parent.balls[0].move;
this._alpha = 0;
this.doFadeIn = false;
};
Cue.prototype.fadeIn = function () {
this._x = this._x + ((this._parent.balls[0]._x - this._x) / 5);
this._y = this._y + ((this._parent.balls[0]._y - this._y) / 5);
if (this._alpha < 95) {
this._alpha = this._alpha + ((100 - this._alpha) / 10);
} else {
this._alpha = 100;
cuestick = "yes";
this.doFadeIn = false;
}
};
Object.registerClass("cue", Cue);
this.attachMovie("startscreen", "start_mc", 1, {_x:55, _y:10});
Symbol 15 MovieClip Frame 1
stop();
Symbol 34 Button
on (release) {
getURL ("http://www.ultimatearcade.com", "_blank");
}
Symbol 47 MovieClip Frame 1
stop();
Symbol 47 MovieClip Frame 10
this._parent.hitBall();
Symbol 63 Button
on (release) {
getURL ("http://www.ultimatearcade.com", "_blank");
}
Symbol 71 Button
on (release) {
getURL ("http://www.ultimatearcade.com", "_top");
}
Symbol 77 Button
on (release) {
getURL ("http://www.ultimatearcade.com/", "_blank");
}
Symbol 81 Button
on (release) {
getURL ("http://www.ultimatearcade.com/downloads/", "_blank");
}
Symbol 85 Button
on (release) {
getURL ("http://www.ultimatearcade.com/maillist/signup.html", "_blank");
}
Symbol 87 MovieClip [win] Frame 1
this.score.autoSize = "center";
this.score.text = ("You scored " + this.pts) + " points!";
this.playAgain.onPress = function () {
this._parent._parent.attachMovie("table", "table_mc", 2, {_x:55, _y:10}).init(0);
};
Symbol 93 MovieClip Frame 25
stop();
Symbol 97 Button
on (release) {
getURL ("http://www.ultimatearcade.com/sports/games/ultimatebilliards.html", "_blank");
}
Symbol 104 MovieClip Frame 45
stop();
Symbol 105 MovieClip [explosion] Frame 1
this.score.autoSize = "center";
this.score.text = ("You scored " + this.pts) + " points!";
this.playAgain.onPress = function () {
this._parent._parent.attachMovie("table", "table_mc", 2, {_x:55, _y:10}).init(0);
};
Symbol 108 MovieClip Frame 1
stop();
Symbol 121 MovieClip Frame 50
stop();
Symbol 125 MovieClip [startscreen] Frame 1
startBtn.onPress = function () {
this._parent._parent.attachMovie("table", "table_mc", 2, {_x:55, _y:10}).init(0);
};
Symbol 147 MovieClip Frame 112
_root.gotoAndPlay("loader");