Frame 1
MovieClip.prototype.tween = function (prop, target, a, s) {
var _local3 = this;
var _local2 = 999000 /* 0x0F3E58 */;
var name = ("mc" + prop);
var d = ((i = 0));
var _local1 = ["_x", "_y", "_rotation", "_alpha", "_xscale", "_yscale", "_width", "_height"];
i = 0;
while (i < _local1.length) {
if (prop == _local1[i]) {
_local2 = _local2 + i;
break;
}
i++;
}
var mc = _local3.createEmptyMovieClip(name, _local2);
mc.onEnterFrame = function () {
var _local1 = this;
d = (((_local1._parent[prop] - target) / a) + d) / s;
_local1._parent[prop] = _local1._parent[prop] - d;
if ((d > -0.1) && (d < 0.1)) {
d = int(target);
_local1._parent[prop] = d;
delete _local1.onEnterFrame;
_local1.removeMovieClip();
}
};
};
System.security.allowDomain("http://disney.go.com");
System.security.allowDomain("http://www.disney.go.com");
System.security.allowDomain("http://psc.disney.go.com");
smoothpercent = (rSmoothpercent = 0);
Frame 2
bytesloaded = this.getBytesLoaded();
if (bytesloaded > 0) {
bytestotal = this.getBytesTotal();
percent = Math.floor((bytesloaded / bytestotal) * 100);
smoothpercent = smoothpercent + ((percent - smoothpercent) / 3);
rSmoothpercent = Math.round(smoothpercent);
loadedText = rSmoothpercent;
loadingbar.gotoAndStop(rSmoothpercent);
if (rSmoothpercent == 100) {
this.gotoAndStop("splash");
}
}
Frame 3
gotoAndPlay(_currentframe - 1);
Frame 4
mc_mask.gotoAndPlay(2);
play();
Frame 10
stop();
Frame 11
function startoffgame() {
instructions.tween("_alpha", 0, 2, 2);
mc_logo.tween("_alpha", 100, 3, 3);
game_mc.table_mc.gotoAndStop("start");
}
startoffgame();
Frame 58
_level0.scoreboard.balls.gotoAndStop(_level0.lives + 1);
Frame 100
function keystart() {
game_mc.table_mc.gotoAndStop("start");
}
function gameOver() {
game_mc.table_mc.gotoAndStop("init");
}
function resetgame() {
game_mc.table_mc.gotoAndStop("start");
_level0.lives = 5;
_level0.score = 0;
_level0.scorenum = 0;
game_mc.table_mc.Pinball.addScore(0);
}
function resetVariables() {
_level0.lives = 5;
_level0.score = 0;
_level0.scorenum = 0;
game_mc.table_mc.Pinball.addScore(0);
}
function formatScore(scoreNum) {
var _local2 = "";
_local2 = "000000000" + scoreNum;
_local2 = _local2.substr(_local2.length - 9, 9);
var str = String((((_local2.substr(1, 3) + ",") + _local2.substr(3, 3)) + ",") + _local2.substr(6, 3));
var _local3 = [];
var _local1 = 0;
while (_local1 < 9) {
_local3.push(String(_local2.substr(_local1, 1)));
_local1++;
}
return(_local3);
}
_global._timeline = this;
stop();
Frame 101
stop();
Frame 113
stop();
var score_url = _level0.fsd;
if (score_url == undefined) {
var score_url = "http://www.disney.go.com/disneychannel/global/game/scoredisplays/fsd.swf";
}
_level0.eventID = "dc_ad_dmp";
_level0.subject = "American Dragon - Dragon Master Pinball";
_level0.playerScore = _level0.scorenum;
_level0.fsdPlayAgain = function () {
resetVariables();
gotoAndPlay ("instructions");
_level0.bPaused = false;
};
submit_score_container.loadMovie(score_url, 1);
trace(_level0.playerScore);
Symbol 2 MovieClip [component] Frame 1
var sAngle = Math.min(startAngle, endAngle);
var eAngle = Math.max(startAngle, endAngle);
mask_mc._rotation = sAngle + 90;
var diff = (eAngle - sAngle);
mask_mc.gotoAndStop(Math.floor(diff));
if (direction == "outer") {
var str = "Obstacles.addOuterArc(";
directionarrow.gotoAndStop(2);
} else if (direction == "inner") {
var str = "Obstacles.addInnerArc(";
directionarrow.gotoAndStop(1);
}
var x = (Math.round(_x) + ",");
var y = (Math.round(_y) + ",");
var radius = (((_width + _height) * 0.25) + ",");
var startAngle = (("Math.toRadians(" + startAngle) + "),");
var endAngle = (("Math.toRadians(" + endAngle) + "),");
var force = (force + ",");
var linkedmc = (linkedmc + ",");
var tree = tree;
if (tree != -1) {
tree = _parent.getTreeRegion(Math.round(_y));
}
str = ((((((((str + x) + y) + radius) + startAngle) + endAngle) + force) + linkedmc) + tree) + ")";
trace(str);
stop();
Symbol 13 MovieClip Frame 1
stop();
Symbol 13 MovieClip Frame 6
stop();
Symbol 14 MovieClip Frame 1
stop();
Symbol 14 MovieClip Frame 2
l1.gotoAndPlay(2);
Symbol 14 MovieClip Frame 3
l2.gotoAndPlay(2);
l3.gotoAndPlay(2);
Symbol 14 MovieClip Frame 4
l4.gotoAndPlay(2);
l5.gotoAndPlay(2);
l6.gotoAndPlay(2);
Symbol 14 MovieClip Frame 5
l7.gotoAndPlay(2);
l8.gotoAndPlay(2);
l9.gotoAndPlay(2);
l10.gotoAndPlay(2);
Symbol 14 MovieClip Frame 6
l11.gotoAndPlay(2);
l12.gotoAndPlay(2);
l13.gotoAndPlay(2);
l14.gotoAndPlay(2);
Symbol 14 MovieClip Frame 7
l15.gotoAndPlay(2);
l16.gotoAndPlay(2);
l17.gotoAndPlay(2);
l18.gotoAndPlay(2);
Symbol 14 MovieClip Frame 8
l19.gotoAndPlay(2);
l20.gotoAndPlay(2);
l21.gotoAndPlay(2);
l22.gotoAndPlay(2);
Symbol 14 MovieClip Frame 9
l23.gotoAndPlay(2);
l24.gotoAndPlay(2);
l25.gotoAndPlay(2);
l26.gotoAndPlay(2);
Symbol 14 MovieClip Frame 10
l27.gotoAndPlay(2);
l28.gotoAndPlay(2);
l29.gotoAndPlay(2);
Symbol 14 MovieClip Frame 11
l30.gotoAndPlay(2);
l31.gotoAndPlay(2);
Symbol 14 MovieClip Frame 12
l32.gotoAndPlay(2);
Symbol 14 MovieClip Frame 20
stop();
Symbol 22 MovieClip Frame 1
stop();
Symbol 22 MovieClip Frame 100
stop();
Symbol 54 MovieClip Frame 35
stop();
Symbol 67 MovieClip Frame 320
_parent.gotoAndPlay("instructions");
stop();
Symbol 79 Button
on (release) {
gotoAndPlay ("instructions");
}
Symbol 89 MovieClip Frame 1
stop();
Symbol 89 MovieClip Frame 15
gotoAndStop (1);
Symbol 89 MovieClip Frame 30
gotoAndStop (1);
Symbol 98 MovieClip Frame 1
stop();
Symbol 98 MovieClip Frame 12
gotoAndStop ("off");
Symbol 108 MovieClip Frame 1
stop();
Symbol 117 MovieClip Frame 1
stop();
Symbol 122 MovieClip Frame 1
stop();
Symbol 125 MovieClip Frame 1
stop();
Symbol 128 MovieClip Frame 1
stop();
Symbol 131 MovieClip Frame 1
stop();
Symbol 131 MovieClip Frame 50
gotoAndStop ("off");
Symbol 148 MovieClip Frame 1
stop();
Symbol 148 MovieClip Frame 25
stop();
Symbol 153 MovieClip Frame 1
stop();
Symbol 153 MovieClip Frame 25
stop();
Symbol 161 MovieClip Frame 1
stop();
Symbol 161 MovieClip Frame 100
stop();
Symbol 161 MovieClip Frame 101
prevFrame();
Symbol 161 MovieClip Frame 109
gotoAndStop (1);
Symbol 171 MovieClip Frame 1
stop();
Symbol 171 MovieClip Frame 7
stop();
Symbol 177 MovieClip Frame 1
function trackBall() {
var _local1 = ball_mc._y + _y;
Pinball.positionTable(_local1);
}
stop();
Symbol 177 MovieClip Frame 5
this.onEnterFrame = trackBall;
Symbol 177 MovieClip Frame 55
gotoAndStop (1);
this.onEnterFrame = null;
Symbol 177 MovieClip Frame 60
this.onEnterFrame = trackBall;
Symbol 177 MovieClip Frame 110
gotoAndStop (1);
this.onEnterFrame = null;
Symbol 192 MovieClip Frame 1
stop();
Symbol 192 MovieClip Frame 5
gotoAndStop (1);
Symbol 192 MovieClip Frame 15
gotoAndStop (1);
Symbol 192 MovieClip Frame 24
gotoAndStop (1);
Symbol 192 MovieClip Frame 34
gotoAndStop (1);
Symbol 192 MovieClip Frame 44
gotoAndStop (1);
Symbol 192 MovieClip Frame 54
gotoAndStop (1);
Symbol 192 MovieClip Frame 64
gotoAndStop (1);
Symbol 192 MovieClip Frame 74
gotoAndStop (1);
Symbol 192 MovieClip Frame 84
gotoAndStop (1);
Symbol 192 MovieClip Frame 94
gotoAndStop (1);
Symbol 192 MovieClip Frame 104
gotoAndStop (1);
Symbol 192 MovieClip Frame 114
gotoAndStop (1);
Symbol 192 MovieClip Frame 124
gotoAndStop (1);
Symbol 192 MovieClip Frame 134
gotoAndStop (1);
Symbol 192 MovieClip Frame 144
gotoAndStop (1);
Symbol 192 MovieClip Frame 154
gotoAndStop (1);
Symbol 192 MovieClip Frame 170
gotoAndStop (1);
Symbol 197 MovieClip Frame 1
function getTreeRegion(y) {
return(Math.ceil(y / splitrange));
}
totalheight = 1019;
range = 300;
segments = Math.floor(totalheight / range);
_global.splitrange = Math.round(totalheight / segments);
var j = 1;
while (j <= segments) {
var area = Math.floor((totalheight / segments) * j);
var lmc = linebound.duplicateMovieClip("bound" + j, j);
lmc._x = 0;
lmc._y = area;
lmc._visible = 0;
j++;
}
linebound._visible = 0;
stop();
Symbol 200 MovieClip Frame 17
stop();
_parent.gotoAndPlay(7);
Symbol 216 Button
on (release) {
_global._timeline.resetgame();
}
Symbol 219 Button
on (release) {
_parent._parent.gotoAndStop("high_score");
}
Symbol 222 Button
on (release) {
_global._timeline.resetVariables();
_parent._parent.gotoAndStop("splash");
}
Symbol 226 Button
on (release) {
_level0.gotoAndStop("high_score");
}
Symbol 229 Button
on (release) {
this.gotoAndStop("off");
_level0.bPaused = false;
}
Symbol 238 Button
on (release) {
this.nextFrame();
}
Symbol 244 MovieClip Frame 30
stop();
Symbol 246 Button
on (release) {
this.prevFrame();
}
Symbol 248 MovieClip Frame 1
stop();
Symbol 249 MovieClip Frame 1
stop();
Symbol 249 MovieClip Frame 6
stop();
Symbol 249 MovieClip Frame 14
stop();
Symbol 250 MovieClip Frame 1
stop();
Symbol 250 MovieClip Frame 2
play();
Symbol 250 MovieClip Frame 18
stop();
Symbol 251 MovieClip Frame 1
fscommand ("allowscale", false);
_quality = "HIGH";
_focusrect = false;
_global._timeline = this;
Math.toRadians = function (deg) {
return((deg * Math.PI) / 180);
};
Math.toDegrees = function (rad) {
return((rad * 180) / Math.PI);
};
Color.prototype.setTint = function (r, g, b, percent) {
var _local2 = percent / 100;
var _local1 = {rb:r * _local2, gb:g * _local2, bb:b * _local2};
_local1.ra = (_local1.ga = (_local1.ba = 100 - percent));
this.setTransform(_local1);
};
Color.prototype.setTint2 = function (rgb, percent) {
var _local3 = rgb;
var r = (_local3 >> 16);
var g = ((_local3 >> 8) & 255);
var b = (_local3 & 255);
var _local2 = percent / 100;
var _local1 = {rb:r * _local2, gb:g * _local2, bb:b * _local2};
_local1.ra = (_local1.ga = (_local1.ba = 100 - percent));
this.setTransform(_local1);
};
Color.prototype.reset = function () {
this.setTransform({ra:100, ga:100, ba:100, rb:0, gb:0, bb:0});
};
XML.prototype.ignoreWhite = true;
XMLNode.prototype.getText = function (node) {
var _local3 = node;
if (_local3 == null) {
return(null);
}
var _local1 = this.firstChild;
while (_local1) {
if (_local1.nodeName == _local3) {
var _local2 = _local1.firstChild;
if (_local2.nodeType == 3) {
return(_local2.nodeValue);
}
}
_local1 = _local1.nextSibling;
}
return(null);
};
XMLNode.prototype.getNodes = function (node) {
var _local2 = node;
if (_local2 == null) {
return(null);
}
var _local1 = this.firstChild;
while (_local1) {
if (_local1.nodeName == _local2) {
return(_local1);
}
_local1 = _local1.nextSibling;
}
return(null);
};
_global.Point = function (x, y) {
this.x = x;
this.y = y;
};
Point.prototype.duplicate = function () {
return(new Point(this.x, this.y));
};
Point.prototype.moveBy = function (v) {
var _local1 = this;
_local1.x = _local1.x + v.x;
_local1.y = _local1.y + v.y;
return(_local1);
};
Point.prototype.moveTo = function (p) {
var _local1 = this;
_local1.x = p.x;
_local1.y = p.y;
return(_local1);
};
Point.prototype.getMidPoint = function (p) {
return(this.addVector(this.getVector(p).divide(2)));
};
Point.prototype.plus = function (p) {
var _local1 = this;
_local1.x = _local1.x + p.x;
_local1.y = _local1.y + p.y;
return(_local1);
};
Point.prototype.minus = function (p) {
var _local1 = this;
_local1.x = _local1.x - p.x;
_local1.y = _local1.y - p.y;
return(_local1);
};
Point.prototype.addPoint = function (p) {
var _local2 = this.x + p.x;
var _local1 = this.y + p.y;
return(new Point(_local2, _local1));
};
Point.prototype.subtractPoint = function (p) {
var _local2 = this.x - p.x;
var _local1 = this.y - p.y;
return(new Point(_local2, _local1));
};
Point.prototype.addVector = function (v) {
var _local2 = this.x + v.x;
var _local1 = this.y + v.y;
return(new Point(_local2, _local1));
};
Point.prototype.getVector = function (p) {
var _local2 = p.x - this.x;
var _local1 = p.y - this.y;
return(new Vector(_local2, _local1));
};
Point.prototype.multiply = function (n) {
var _local2 = this.x * n;
var _local1 = this.y * n;
return(new Point(_local2, _local1));
};
Point.prototype.lerp = function (p, t) {
var _local1 = this;
var _local3 = _local1.x + ((p.x - _local1.x) * t);
var _local2 = _local1.y + ((p.y - _local1.y) * t);
return(new Point(_local3, _local2));
};
Point.prototype.crossProduct = function (p0, p1) {
var _local1 = this;
return(((p0.x - _local1.x) * (p1.y - _local1.y)) - ((p0.y - _local1.y) * (p1.x - _local1.x)));
};
Point.prototype.rotate = function (a) {
var _local1 = this;
var _local2 = Math.sin(a);
var _local3 = Math.cos(a);
var x = ((_local1.x * _local3) - (_local1.y * _local2));
var y = ((_local1.y * _local3) + (_local1.x * _local2));
_local1.x = x;
_local1.y = y;
return(_local1);
};
Point.prototype.rotateAbout = function (p, a) {
var _local1 = this;
_local1.minus(p);
_local1.rotate(a);
_local1.plus(p);
return(_local1);
};
Point.prototype.getAngle = function (p) {
var _local2 = p.x - this.x;
var _local1 = p.y - this.y;
return(Math.atan2(_local1, _local2));
};
Point.prototype.min = function (p) {
var _local2 = Math.min(this.x, p.x);
var _local1 = Math.min(this.y, p.y);
return(new Point(_local2, _local1));
};
Point.prototype.max = function (p) {
var _local2 = Math.max(this.x, p.x);
var _local1 = Math.max(this.y, p.y);
return(new Point(_local2, _local1));
};
Point.prototype.draw = function (mc, colour, type) {
var _local1 = this;
var _local2 = mc;
if (type == "dot") {
_local2.lineStyle(3, colour, 100);
_local2.moveTo(_local1.x, _local1.y);
_local2.lineTo(_local1.x + 0.5, _local1.y);
} else {
_local2.lineStyle(0, colour, 100);
_local2.moveTo(_local1.x - 5, _local1.y - 5);
_local2.lineTo(_local1.x + 5, _local1.y + 5);
_local2.moveTo(_local1.x + 5, _local1.y - 5);
_local2.lineTo(_local1.x - 5, _local1.y + 5);
}
};
Point.prototype.toString = function () {
var _local1 = ((("[class 'Point' x: " + (Math.round(this.x * 1000) / 1000)) + ", y: ") + (Math.round(this.y * 1000) / 1000)) + "]";
return(_local1);
};
Point.prototype.trace = function () {
trace(this.toString());
};
_global.Vector = function (x, y) {
this.x = x;
this.y = y;
};
Vector.prototype.duplicate = function () {
return(new Vector(this.x, this.y));
};
Vector.prototype.negate = function () {
var _local1 = this;
_local1.x = -_local1.x;
_local1.y = -_local1.y;
return(_local1);
};
Vector.prototype.addVector = function (v) {
var _local1 = this;
_local1.x = _local1.x + v.x;
_local1.y = _local1.y + v.y;
return(_local1);
};
Vector.prototype.subtractVector = function (v) {
var _local1 = this;
_local1.x = _local1.x - v.x;
_local1.y = _local1.y - v.y;
return(_local1);
};
Vector.prototype.getAddedVector = function (v) {
var _local2 = this.x + v.x;
var _local1 = this.y + v.y;
return(new Vector(_local2, _local1));
};
Vector.prototype.getSubtractedVector = function (v) {
var _local2 = this.x - v.x;
var _local1 = this.y - v.y;
return(new Vector(_local2, _local1));
};
Vector.prototype.multiply = function (n) {
var _local1 = this;
_local1.x = _local1.x * n;
_local1.y = _local1.y * n;
return(_local1);
};
Vector.prototype.divide = function (n) {
var _local1 = this;
_local1.x = _local1.x / n;
_local1.y = _local1.y / n;
return(_local1);
};
Vector.prototype.getMultipliedVector = function (n) {
var _local2 = this.x * n;
var _local1 = this.y * n;
return(new Vector(_local2, _local1));
};
Vector.prototype.getDividedVector = function (n) {
var _local2 = this.x / n;
var _local1 = this.y / n;
return(new Vector(_local2, _local1));
};
Vector.prototype.length = function () {
var _local1 = this;
return(Math.sqrt((_local1.x * _local1.x) + (_local1.y * _local1.y)));
};
Vector.prototype.normalise = function () {
var _local1 = this;
_local1.divide(_local1.length());
return(_local1);
};
Vector.prototype.getNormalisedVector = function () {
var _local2 = this;
var _local1 = _local2.length();
return(new Vector(_local2.x / _local1, _local2.y / _local1));
};
Vector.prototype.rotate = function (a) {
var _local1 = this;
var _local2 = Math.sin(a);
var _local3 = Math.cos(a);
var x = ((_local1.x * _local3) - (_local1.y * _local2));
var y = ((_local1.y * _local3) + (_local1.x * _local2));
_local1.x = x;
_local1.y = y;
return(_local1);
};
Vector.prototype.getRotatedVector = function (a) {
var _local2 = this;
var _local1 = Math.sin(a);
var _local3 = Math.cos(a);
var x = ((_local2.x * _local3) + (_local2.y * _local1));
var y = ((_local2.y * _local3) - (_local2.x * _local1));
return(new Vector(x, y));
};
Vector.prototype.scalarProduct = (Vector.prototype.dotProduct = function (v) {
return((this.x * v.x) + (this.y * v.y));
});
Vector.prototype.vectorProduct = (Vector.prototype.crossProduct = function (v) {
return((this.x * v.y) - (this.y * v.x));
});
Vector.prototype.getAngle = function () {
var _local1 = Math.atan2(this.y, this.x);
if (_local1 < 0) {
_local1 = _local1 + (Math.PI*2);
}
return(_local1);
};
Vector.prototype.getAngleBetween = function (v) {
var _local2 = this.getNormalisedVector();
var _local1 = v.getNormalisedVector();
return(Math.acos(_local2.dotProduct(_local1)));
};
Vector.prototype.draw = function (mc, colour) {
var _local1 = mc;
_local1.lineStyle(0, colour, 100);
_local1.moveTo(0, 0);
_local1.lineTo(this.x, this.y);
};
Vector.prototype.toString = function () {
var _local1 = ((("[class 'Vector' x: " + (Math.round(this.x * 1000) / 1000)) + ", y: ") + (Math.round(this.y * 1000) / 1000)) + "]";
return(_local1);
};
Vector.prototype.trace = function () {
trace(this.toString());
};
_global.Line = function (p0, p1) {
this.p0 = p0;
this.p1 = p1;
};
Line.prototype.duplicate = function () {
var _local2 = this.p0.duplicate();
var _local1 = this.p1.duplicate();
return(new Line(_local2, _local1));
};
Line.prototype.scale = function (n) {
var _local1 = this;
var _local2 = _local1.getVector().normalise().multiply(_local1.length() * (((n / 100) - 1) / 2));
_local1.p1.moveBy(_local2);
_local1.p0.moveBy(_local2.negate());
return(_local1);
};
Line.prototype.moveBy = function (v) {
var _local1 = this;
var _local2 = v;
_local1.p0.x = _local1.p0.x + _local2.x;
_local1.p0.y = _local1.p0.y + _local2.y;
_local1.p1.x = _local1.p1.x + _local2.x;
_local1.p1.y = _local1.p1.y + _local2.y;
return(_local1);
};
Line.prototype.getVector = function () {
var _local1 = this;
var _local3 = _local1.p1.x - _local1.p0.x;
var _local2 = _local1.p1.y - _local1.p0.y;
return(new Vector(_local3, _local2));
};
Line.prototype.getAngle = function () {
var _local1 = this;
var _local3 = _local1.p1.x - _local1.p0.x;
var _local2 = _local1.p1.y - _local1.p0.y;
return(Math.atan2(_local2, _local3));
};
Line.prototype.getTangent = function (p) {
return(this.getVector());
};
Line.prototype.getNormal = function () {
var _local1 = this;
var _local3 = _local1.p1.x - _local1.p0.x;
var _local2 = _local1.p1.y - _local1.p0.y;
return(new Vector(-_local2, _local3).normalise());
};
Line.prototype.length = function () {
var _local3 = this;
var _local2 = _local3.p1.x - _local3.p0.x;
var _local1 = _local3.p1.y - _local3.p0.y;
return(Math.sqrt((_local2 * _local2) + (_local1 * _local1)));
};
Line.prototype.draw = function (mc, colour) {
var _local1 = this;
var _local2 = mc;
_local2.lineStyle(0, colour, 100);
_local2.moveTo(_local1.p0.x, _local1.p0.y);
_local2.lineTo(_local1.p1.x, _local1.p1.y);
};
Line.prototype.toString = function () {
var _local1 = this;
var _local2 = ((((((("[class 'Line' x0: " + _local1.p0.x) + ", y0: ") + _local1.p0.y) + ", x1: ") + _local1.p1.x) + ", y1: ") + _local1.p1.y) + "]";
return(_local2);
};
Line.prototype.trace = function () {
trace(this.toString());
};
_global.Circle = function (x, y, radius) {
super(x, y);
this.radius = radius;
};
Circle.prototype = new Point();
Circle.prototype.duplicate = function () {
var _local1 = this;
return(new Circle(_local1.x, _local1.y, _local1.radius));
};
Circle.prototype.addRadius = function (n) {
this.radius = this.radius + n;
return(this);
};
Circle.prototype.subtractRadius = function (n) {
this.radius = this.radius - n;
return(this);
};
Circle.prototype.multiplyRadius = function (n) {
this.radius = this.radius * n;
return(this);
};
Circle.prototype.divideRadius = function (n) {
this.radius = this.radius / n;
return(this);
};
Circle.prototype.getNormal = function (p) {
var _local2 = p.x - this.x;
var _local1 = p.y - this.y;
return(new Vector(_local2, _local1).normalise());
};
Circle.prototype.getTangent = function (p) {
var _local1 = this.getVector(p).rotate((Math.PI/2));
return(_local1);
};
Circle.prototype.getTangentOfTwoCircles = function (c) {
var _local2 = this;
var _local1;
var angle;
var intersecting_line;
var _local3;
var midpoint;
var t0;
var t1;
_local1 = c.duplicate();
angle = _local2.getVector(_local1).getAngle();
_local1.rotateAbout(_local2, -angle);
intersecting_line = new Line(new Point(_local2.x, _local2.y + _local2.radius), new Point(_local1.x, _local1.y + _local1.radius));
intersecting_line.scale(200);
_local3 = Intersection.getCircleLine(_local2, intersecting_line);
midpoint = _local3[0].getMidPoint(_local3[1]);
t0 = _local2.addVector(_local2.getVector(midpoint).normalise().multiply(_local2.radius));
_local3 = Intersection.getCircleLine(_local1, intersecting_line);
midpoint = _local3[0].getMidPoint(_local3[1]);
t1 = _local1.addVector(_local1.getVector(midpoint).normalise().multiply(_local1.radius));
return(new Line(t0.rotateAbout(_local2, angle), t1.rotateAbout(_local2, angle)));
};
Circle.prototype.draw = function (mc, colour) {
var _local1 = this;
mc.lineStyle(0, colour, 100);
var arc = (Math.PI*2);
var segs = Math.ceil(Math.abs(arc) / (Math.PI/4));
var _local3 = arc / segs;
var _local2 = 0;
var ax = (_local1.x + (Math.cos(_local2) * _local1.radius));
var ay = (_local1.y + (Math.sin(_local2) * _local1.radius));
mc.moveTo(ax, ay);
if (segs > 0) {
var angleMid;
var bx;
var by;
var cx;
var cy;
var i = 0;
while (i < segs) {
_local2 = _local2 + _local3;
angleMid = _local2 - (_local3 / 2);
bx = _local1.x + (Math.cos(_local2) * _local1.radius);
by = _local1.y + (Math.sin(_local2) * _local1.radius);
cx = _local1.x + (Math.cos(angleMid) * (_local1.radius / Math.cos(_local3 / 2)));
cy = _local1.y + (Math.sin(angleMid) * (_local1.radius / Math.cos(_local3 / 2)));
mc.curveTo(cx, cy, bx, by);
i++;
}
}
};
Circle.prototype.toString = function () {
var _local2 = this;
var _local1 = ((((("[class 'Circle' x: " + (Math.round(_local2.x * 1000) / 1000)) + ", y: ") + (Math.round(_local2.y * 1000) / 1000)) + ", radius: ") + _local2.radius) + "]";
return(_local1);
};
Circle.prototype.trace = function () {
trace(this.toString());
};
_global.Arc = function (x, y, radius, startAngle, endAngle) {
super(x, y, radius);
this.startAngle = startAngle;
this.endAngle = endAngle;
};
Arc.prototype = new Circle();
Arc.prototype.duplicate = function () {
var _local1 = this;
return(new Arc(_local1.x, _local1.y, _local1.radius, _local1.startAngle, _local1.endAngle));
};
Arc.prototype.draw = function (mc, colour) {
var _local1 = this;
mc.lineStyle(0, colour, 100);
var arc = (_local1.endAngle - _local1.startAngle);
var segs = Math.ceil(Math.abs(arc) / (Math.PI/4));
var _local3 = arc / segs;
var _local2 = _local1.startAngle;
var ax = (_local1.x + (Math.cos(_local2) * _local1.radius));
var ay = (_local1.y + (Math.sin(_local2) * _local1.radius));
mc.moveTo(ax, ay);
if (segs > 0) {
var angleMid;
var bx;
var by;
var cx;
var cy;
var i = 0;
while (i < segs) {
_local2 = _local2 + _local3;
angleMid = _local2 - (_local3 / 2);
bx = _local1.x + (Math.cos(_local2) * _local1.radius);
by = _local1.y + (Math.sin(_local2) * _local1.radius);
cx = _local1.x + (Math.cos(angleMid) * (_local1.radius / Math.cos(_local3 / 2)));
cy = _local1.y + (Math.sin(angleMid) * (_local1.radius / Math.cos(_local3 / 2)));
mc.curveTo(cx, cy, bx, by);
i++;
}
}
};
Arc.prototype.toString = function () {
var _local1 = this;
var _local2 = ((((((((("[class 'Arc' x: " + (Math.round(_local1.x * 1000) / 1000)) + ", y: ") + (Math.round(_local1.y * 1000) / 1000)) + ", radius: ") + _local1.radius) + ", startAngle: ") + Math.toDegrees(_local1.startAngle)) + ", endAngle: ") + Math.toDegrees(_local1.endAngle)) + "]";
return(_local2);
};
Arc.prototype.trace = function () {
trace(this.toString());
};
ClassIntersection = function () {
};
ClassIntersection.prototype.getLineLine = function (lineA, lineB) {
var _local2 = lineA.p0.x;
var _local1 = lineA.p0.y;
var x2 = lineA.p1.x;
var y2 = lineA.p1.y;
var _local3 = lineB.p0.x;
var y3 = lineB.p0.y;
var x4 = lineB.p1.x;
var y4 = lineB.p1.y;
var numeratorA = (((x4 - _local3) * (_local1 - y3)) - ((y4 - y3) * (_local2 - _local3)));
var numeratorB = (((x2 - _local2) * (_local1 - y3)) - ((y2 - _local1) * (_local2 - _local3)));
var demoninator = (((y4 - y3) * (x2 - _local2)) - ((x4 - _local3) * (y2 - _local1)));
if (demoninator == 0) {
return([]);
}
var uA = (numeratorA / demoninator);
var uB = (numeratorB / demoninator);
if (((0 <= uA) && (uA <= 1)) && ((0 <= uB) && (uB <= 1))) {
var x = (_local2 + (uA * (x2 - _local2)));
var y = (_local1 + (uA * (y2 - _local1)));
return([new Point(x, y)]);
}
return([]);
};
ClassIntersection.prototype.getCircleLine = function (circle, line) {
var _local1 = line;
if (_local1.length() <= 0) {
return([]);
}
var _local3 = _local1.p0.x;
var _local2 = _local1.p0.y;
var x2 = _local1.p1.x;
var y2 = _local1.p1.y;
var x3 = circle.x;
var y3 = circle.y;
var r = circle.radius;
var dx = (x2 - _local3);
var dy = (y2 - _local2);
var a = ((dx * dx) + (dy * dy));
var b = (2 * ((dx * (_local3 - x3)) + (dy * (_local2 - y3))));
var c = ((((((x3 * x3) + (y3 * y3)) + (_local3 * _local3)) + (_local2 * _local2)) - (2 * ((x3 * _local3) + (y3 * _local2)))) - (r * r));
var discriminant = ((b * b) - ((4 * a) * c));
if (discriminant < 0) {
return([]);
}
if (discriminant == 0) {
return([_local1.p0.lerp(_local1.p1, (-b) / (2 * a))]);
}
var e = Math.sqrt(discriminant);
var u1 = (((-b) + e) / (2 * a));
var u2 = (((-b) - e) / (2 * a));
var points = [];
if ((0 <= u1) && (u1 <= 1)) {
points.push(_local1.p0.lerp(_local1.p1, u1));
}
if ((0 <= u2) && (u2 <= 1)) {
points.push(_local1.p0.lerp(_local1.p1, u2));
}
return(points);
};
ClassIntersection.prototype.getArcLine = function (arc, line) {
var POI = this.getCircleLine(arc, line);
var noOfPoints = POI.length;
if (noOfPoints < 1) {
return([]);
}
var startAngle = arc.startAngle;
var endAngle = arc.endAngle;
var points = [];
var _local2 = 0;
while (_local2 < noOfPoints) {
var P = POI[_local2];
var normalVector = arc.getVector(P);
var _local1 = normalVector.getAngle();
var _local3 = _local1 + (Math.PI*2);
if (((startAngle <= _local1) && (_local1 <= endAngle)) || ((startAngle <= _local3) && (_local3 <= endAngle))) {
points.push(P);
}
_local2++;
}
return(points);
};
_global.Intersection = new ClassIntersection();
ClassPinball = function () {
var _local1 = this;
_local1.gravity = new Vector(0, 0.9);
_local1.ballRadius = 5;
_local1.gameScreen = {width:772, height:265, width2:386, height2:90};
_local1.tableSize = {width:341, height:1019};
};
ClassPinball.prototype.init = function (pinball_mc) {
var _local1 = this;
var _local2 = pinball_mc;
_local1.pinball_mc = _local2;
_local1.initTable(_local2.lines_mc);
_local1.initPaddles(_local2.paddles_mc);
_local1.initSpring(_local2.spring_mc);
_local1.initTriggers(_local2.triggers_mc);
_local1.initBalls(_local2.balls_mc);
_level0.lives = 5;
_level0.score = 0;
_level0.scoreboard.balls.gotoAndStop(_level0.lives + 1);
};
ClassPinball.prototype.start = function () {
var _local1 = this;
var pinball_mc = _local1.pinball_mc;
_timeline.Jake.gotoAndPlay(1);
_local1.addScore(0);
_local1.addBall(337, 880, _local1.ballRadius, new Vector(0, 0));
pinball_mc.gameScreen = _local1.gameScreen;
pinball_mc.tableSize = _local1.tableSize;
pinball_mc.ball = _local1.balls[0];
pinball_mc.bTilted = false;
pinball_mc.tilt_delay = 5;
pinball_mc.onEnterFrame = function () {
var _local1 = this;
if (_level0.bPaused) {
} else {
Pinball.doSpring();
Pinball.doPaddles();
Pinball.doBalls();
if (Key.isDown(32)) {
if (!_local1.bTilted) {
_local1.bTilted = true;
trace("tilt");
if (!_local1.ball.mc.bHold) {
var _local3 = 1 + (Math.random() * 4);
if (Math.random() < 0.5) {
_local3 = _local3 * -1;
}
var _local2 = 1 + (Math.random() * 4);
if (Math.random() < 0.5) {
_local2 = _local2 * -1;
}
_local1.ball.velocity.addVector(new Vector(_local3, _local2));
} else {
trace("ball is held");
}
}
} else if (_local1.bTilted) {
_local1.bTilted = false;
}
if (pinball_mc.OPT_scroll.bScroll || (pinball_mc.OPT_scroll.bScroll == undefined)) {
Pinball.positionTable(_local1.ball.y);
}
}
};
};
ClassPinball.prototype.positionTable = function (bally) {
var _local2 = this;
var dest_y = (_local2.gameScreen.height2 - bally);
var dy = ((dest_y - pinball_mc._y) * 2);
var _local1 = pinball_mc._y + (dy / 6);
var min = 0;
var _local3 = _local2.gameScreen.height - _local2.tableSize.height;
if (_local1 > min) {
_local1 = min;
} else if (_local1 < _local3) {
_local1 = _local3;
}
if (_local2.bTilted) {
_local1 = _local1 - 5;
}
pinball_mc._y = Math.round(_local1);
};
ClassPinball.prototype.initTable = function (mc) {
this.lines_mc = mc;
var _local1 = this.pinball_mc;
Obstacles.clearAll();
Obstacles.addInnerArc(195, 681, 154.175, Math.toRadians(285), Math.toRadians(360), 0, null, -1);
Obstacles.addInnerArc(182, 660, 145.275, Math.toRadians(180), Math.toRadians(243), 0, null, 2);
Obstacles.addOuterCircle(326, 763, 4.75, 0, null, 3);
Obstacles.addOuterCircle(62, 789, 4.75, 0, null, 3);
Obstacles.addOuterCircle(62, 845, 4.75, 0, null, 3);
Obstacles.addOuterCircle(302, 789, 4.75, 0, null, 3);
Obstacles.addOuterCircle(302, 846, 4.75, 0, null, 3);
Obstacles.addOuterCircle(240, 524, 10.85, 0, null, 2);
Obstacles.addOuterCircle(59, 995, 6.45, 0, null, 3);
Obstacles.addOuterCircle(120, 1018, 5.7, 0, null, -1);
Obstacles.addOuterCircle(233, 1018, 5.7, 0, null, -1);
Obstacles.addOuterCircle(292, 993, 6.45, 0, null, 3);
Obstacles.addOuterCircle(111, 523, 10.05, 0, null, 2);
Obstacles.addInnerArc(196, 679, 151.125, Math.toRadians(285), Math.toRadians(360), 0, null, -1);
Obstacles.addLine(new Point(64, 780), new Point(48, 761), 12, _local1.anglebounce_left, 3);
Obstacles.addLine(new Point(319, 760), new Point(299, 781), 12, _local1.anglebounce_right, 3);
Obstacles.addLine(new Point(123, 1013), new Point(60, 989), 0, null, 3);
Obstacles.addLine(new Point(52, 993), new Point(52, 1024), 0, null, -1);
Obstacles.addLine(new Point(299, 1026), new Point(299, 995), 0, null, -1);
Obstacles.addLine(new Point(292, 986), new Point(229, 1014), 0, null, 3);
Obstacles.addLine(new Point(298, 849), new Point(326, 877), 0, null, 3);
Obstacles.addLine(new Point(323, 760), new Point(298, 786), 0, null, 3);
Obstacles.addLine(new Point(33, 879), new Point(64, 849), 0, null, 3);
Obstacles.addLine(new Point(66, 786), new Point(37, 751), 0, null, 3);
Obstacles.addLine(new Point(297, 790), new Point(297, 846), 0, null, 3);
Obstacles.addLine(new Point(322, 862), new Point(322, 1015), 0, null, 3);
Obstacles.addLine(new Point(33, 1015), new Point(33, 876), 0, null, 3);
Obstacles.addLine(new Point(67, 844), new Point(67, 790), 0, null, 3);
Obstacles.addLine(new Point(40, 760), new Point(40, 601), 0, null, -1);
Obstacles.addLine(new Point(343, 615), new Point(343, 953), 0, null, -1);
Obstacles.addLine(new Point(331, 952), new Point(331, 763), 0, null, 3);
Obstacles.addLine(new Point(347, 950), new Point(330, 950), 0, null, 3);
Obstacles.addOuterCircle(80, 899, 4.75, 0, null, 3);
Obstacles.addOuterCircle(80, 937, 4.75, 0, null, 3);
Obstacles.addOuterCircle(108, 949, 5.75, 0, null, 3);
Obstacles.addLine(new Point(75, 899), new Point(75, 936), 0, null, 3);
Obstacles.addLine(new Point(77, 940), new Point(106, 954), 0, null, 3);
Obstacles.addLine(new Point(113, 947), new Point(83, 896), 13.5, _local1.bumper_left1, 3);
Obstacles.addOuterCircle(273, 899, 4.75, 0, null, 3);
Obstacles.addOuterCircle(273, 938, 4.75, 0, null, 3);
Obstacles.addOuterCircle(244, 951, 5.75, 0, null, 3);
Obstacles.addLine(new Point(246, 956), new Point(275, 942), 0, null, 3);
Obstacles.addLine(new Point(278, 938), new Point(278, 899), 0, null, 3);
Obstacles.addLine(new Point(269, 897), new Point(239, 949), 13.5, _local1.bumper_right1, 3);
Obstacles.addOuterCircle(136, 629, 12.5, 10, _local1.bumper_2, 2);
Obstacles.addOuterCircle(82, 684, 12.5, 10, _local1.bumper_1, -1);
Obstacles.addOuterCircle(136, 747, 12.5, 10, _local1.bumper_6, 3);
Obstacles.addOuterCircle(216, 747, 12.5, 10, _local1.bumper_5, 3);
Obstacles.addOuterCircle(269, 685, 12.5, 10, _local1.bumper_4, -1);
Obstacles.addOuterCircle(216, 629, 12.5, 10, _local1.bumper_3, 2);
Obstacles.addOuterCircle(136, 629, 12.5, 10, _local1.bumper_2, 2);
Obstacles.addOuterCircle(82, 684, 12.5, 10, _local1.bumper_1, -1);
Obstacles.addOuterCircle(136, 747, 12.5, 10, _local1.bumper_6, 3);
Obstacles.addOuterCircle(216, 747, 12.5, 10, _local1.bumper_5, 3);
Obstacles.addOuterCircle(269, 685, 12.5, 10, _local1.bumper_4, -1);
Obstacles.addOuterCircle(216, 629, 12.5, 10, _local1.bumper_3, 2);
Obstacles.addOuterCircle(243, 573, 5.5, 5, _local1.bumper_8, 2);
Obstacles.addOuterCircle(243, 592, 5.5, 5, _local1.bumper_8, 2);
Obstacles.addOuterCircle(272, 596, 5.5, 5, _local1.bumper_9, 2);
Obstacles.addOuterCircle(272, 615, 5.5, 5, _local1.bumper_9, 2);
Obstacles.addOuterCircle(110, 573, 5.5, 5, _local1.bumper_11, 2);
Obstacles.addOuterCircle(110, 592, 5.5, 5, _local1.bumper_11, 2);
Obstacles.addOuterCircle(81, 596, 5.5, 5, _local1.bumper_10, 2);
Obstacles.addOuterCircle(81, 615, 5.5, 5, _local1.bumper_10, 2);
Obstacles.addLine(new Point(75, 596), new Point(75, 615), 0, _local1.bumper_10, 2);
Obstacles.addLine(new Point(86, 615), new Point(86, 596), 0, _local1.bumper_10, 2);
Obstacles.addLine(new Point(104, 573), new Point(104, 591), 0, _local1.bumper_11, 2);
Obstacles.addLine(new Point(115, 591), new Point(115, 573), 0, _local1.bumper_11, 2);
Obstacles.addLine(new Point(237, 573), new Point(237, 591), 0, _local1.bumper_8, 2);
Obstacles.addLine(new Point(266, 596), new Point(266, 615), 0, _local1.bumper_9, 2);
Obstacles.addLine(new Point(277, 615), new Point(277, 596), 0, _local1.bumper_9, 2);
Obstacles.addLine(new Point(248, 591), new Point(248, 573), 0, _local1.bumper_8, 2);
Obstacles.addOuterCircle(301, 899, 1.85, 0, null, 3);
Obstacles.addOuterCircle(300, 955, 2.55, 0, null, 3);
Obstacles.addOuterCircle(237, 983, 2.4, 0, null, 3);
Obstacles.addOuterCircle(54, 900, 1.85, 0, null, 3);
Obstacles.addOuterCircle(55, 955, 2.55, 0, null, 3);
Obstacles.addOuterCircle(122, 984, 2.4, 0, null, 3);
Obstacles.addLine(new Point(54, 957), new Point(123, 986), 0, null, 3);
Obstacles.addLine(new Point(123, 982), new Point(55, 954), 0, null, 3);
Obstacles.addLine(new Point(56, 953), new Point(56, 900), 0, null, 3);
Obstacles.addLine(new Point(52, 900), new Point(52, 955), 0, null, 3);
Obstacles.addLine(new Point(303, 954), new Point(303, 900), 0, null, 3);
Obstacles.addLine(new Point(238, 986), new Point(303, 957), 0, null, 3);
Obstacles.addLine(new Point(299, 899), new Point(299, 953), 0, null, 3);
Obstacles.addLine(new Point(298, 953), new Point(235, 981), 0, null, 3);
Obstacles.addInnerArc(181, 172, 146.975, Math.toRadians(270), Math.toRadians(360), 0, null, -1);
Obstacles.addInnerArc(181, 172, 146.975, Math.toRadians(180), Math.toRadians(270), 0, null, -1);
Obstacles.addOuterCircle(52, 350, 4.75, 0, null, 2);
Obstacles.addOuterCircle(301, 350, 4.75, 0, null, 2);
Obstacles.addOuterCircle(301, 292, 4.75, 0, null, 1);
Obstacles.addInnerArc(43, 473, 9.975, Math.toRadians(175), Math.toRadians(135), 0, null, -1);
Obstacles.addInnerArc(311, 474, 9.875, Math.toRadians(45), Math.toRadians(2), 0, null, -1);
Obstacles.addOuterCircle(52, 290, 4.75, 0, null, 1);
Obstacles.addLine(new Point(317, 253), new Point(301, 277), 12, _local1.anglebounce_right1, 1);
Obstacles.addLine(new Point(56, 278), new Point(46, 253), 12, _local1.anglebounce_left1, 1);
Obstacles.addLine(new Point(56, 288), new Point(37, 241), 0, null, 1);
Obstacles.addLine(new Point(39, 248), new Point(39, 125), 0, null, 1);
Obstacles.addLine(new Point(319, 480), new Point(238, 514), 0, null, 2);
Obstacles.addLine(new Point(325, 120), new Point(325, 252), 0, null, 1);
Obstacles.addLine(new Point(321, 375), new Point(321, 485), 0, null, 2);
Obstacles.addLine(new Point(297, 352), new Point(325, 380), 0, null, 2);
Obstacles.addLine(new Point(326, 245), new Point(297, 290), 0, null, 1);
Obstacles.addLine(new Point(296, 292), new Point(296, 350), 0, null, -1);
Obstacles.addLine(new Point(115, 513), new Point(35, 479), 0, null, 2);
Obstacles.addLine(new Point(33, 477), new Point(33, 367), 0, null, 2);
Obstacles.addLine(new Point(33, 377), new Point(56, 353), 0, null, 2);
Obstacles.addLine(new Point(57, 350), new Point(57, 289), 0, null, -1);
Obstacles.addOuterArc(193, 168, 135.2, Math.toRadians(178), Math.toRadians(240), 0, null, 1);
Obstacles.addInnerArc(200, 121, 91.9, Math.toRadians(166), Math.toRadians(224), 0, null, 1);
Obstacles.addOuterCircle(65, 173, 5.8, 0, null, 1);
Obstacles.addOuterCircle(104, 144, 8.7, 0, null, 1);
Obstacles.addOuterCircle(130, 56, 5.15, 0, null, 1);
Obstacles.addLine(new Point(68, 178), new Point(108, 151), 0, null, 1);
Obstacles.addOuterArc(172, 169, 135.95, Math.toRadians(299), Math.toRadians(360), 0, null, 1);
Obstacles.addInnerArc(168, 122, 90.95, Math.toRadians(0), Math.toRadians(15), 0, null, 1);
Obstacles.addOuterCircle(300, 173, 5.8, 0, null, 1);
Obstacles.addOuterCircle(260, 145, 5.8, 0, null, 1);
Obstacles.addOuterCircle(235, 56, 5.15, 0, null, 1);
Obstacles.addInnerArc(168, 122, 90.95, Math.toRadians(315), Math.toRadians(360), 0, null, 1);
Obstacles.addOuterArc(172, 169, 135.95, Math.toRadians(0), Math.toRadians(2), 0, null, 1);
Obstacles.addLine(new Point(258, 150), new Point(297, 178), 0, null, 1);
Obstacles.addOuterCircle(80, 400, 4.75, 0, null, 2);
Obstacles.addOuterCircle(80, 437, 4.75, 0, null, 2);
Obstacles.addOuterCircle(109, 450, 5.75, 0, null, 2);
Obstacles.addLine(new Point(75, 400), new Point(75, 437), 0, null, 2);
Obstacles.addLine(new Point(78, 441), new Point(107, 455), 0, null, 2);
Obstacles.addLine(new Point(114, 447), new Point(84, 397), 13.5, _local1.bumper_right2, 2);
Obstacles.addOuterCircle(274, 400, 4.75, 0, null, 2);
Obstacles.addOuterCircle(273, 438, 4.75, 0, null, 2);
Obstacles.addOuterCircle(244, 451, 5.75, 0, null, 2);
Obstacles.addLine(new Point(247, 457), new Point(276, 442), 0, null, 2);
Obstacles.addLine(new Point(278, 438), new Point(278, 400), 0, null, 2);
Obstacles.addLine(new Point(269, 398), new Point(239, 449), 13.5, _local1.bumper_right2, 2);
Obstacles.addOuterCircle(104, 368, 12.5, 10, _local1.bumper_13, 2);
Obstacles.addOuterCircle(248, 368, 12.5, 10, _local1.bumper_14, 2);
Obstacles.addOuterCircle(177, 292, 12.5, 10, _local1.bumper_15, 1);
Obstacles.addOuterCircle(226, 178, 12.5, 10, _local1.bumper_17, 1);
Obstacles.addOuterCircle(128, 177, 12.5, 10, _local1.bumper_16, 1);
Obstacles.addOuterCircle(206, 94, 5.8, 5, _local1.bumper_20, 1);
Obstacles.addOuterCircle(206, 114, 5.8, 5, _local1.bumper_20, 1);
Obstacles.addOuterCircle(162, 94, 5.8, 5, _local1.bumper_19, 1);
Obstacles.addOuterCircle(162, 114, 5.8, 5, _local1.bumper_19, 1);
Obstacles.addOuterCircle(135, 108, 5.8, 5, _local1.bumper_18, 1);
Obstacles.addOuterCircle(135, 128, 5.8, 5, _local1.bumper_18, 1);
Obstacles.addOuterCircle(234, 108, 5.8, 5, _local1.bumper_21, 1);
Obstacles.addOuterCircle(234, 128, 5.8, 5, _local1.bumper_21, 1);
Obstacles.addLine(new Point(229, 108), new Point(229, 127), 0, _local1.bumper_21, 1);
Obstacles.addLine(new Point(240, 128), new Point(240, 108), 0, _local1.bumper_21, 1);
Obstacles.addLine(new Point(130, 108), new Point(130, 127), 0, _local1.bumper_18, 1);
Obstacles.addLine(new Point(141, 128), new Point(141, 108), 0, _local1.bumper_18, 1);
Obstacles.addLine(new Point(157, 94), new Point(157, 113), 0, _local1.bumper_19, 1);
Obstacles.addLine(new Point(168, 113), new Point(168, 94), 0, _local1.bumper_19, 1);
Obstacles.addLine(new Point(200, 94), new Point(200, 113), 0, _local1.bumper_20, 1);
Obstacles.addLine(new Point(212, 113), new Point(212, 94), 0, _local1.bumper_20, 1);
Obstacles.addOuterCircle(301, 402, 1.85, 0, null, 2);
Obstacles.addOuterCircle(300, 458, 2.55, 0, null, 2);
Obstacles.addOuterCircle(247, 482, 2.4, 0, null, 2);
Obstacles.addOuterCircle(54, 403, 1.85, 0, null, 2);
Obstacles.addOuterCircle(55, 458, 2.55, 0, null, 2);
Obstacles.addOuterCircle(112, 482, 2.4, 0, null, 2);
Obstacles.addLine(new Point(54, 460), new Point(111, 484), 0, null, 2);
Obstacles.addLine(new Point(113, 480), new Point(57, 456), 0, null, 2);
Obstacles.addLine(new Point(56, 456), new Point(56, 403), 0, null, 2);
Obstacles.addLine(new Point(52, 403), new Point(52, 458), 0, null, 2);
Obstacles.addLine(new Point(303, 457), new Point(303, 403), 0, null, 2);
Obstacles.addLine(new Point(248, 484), new Point(302, 460), 0, null, 2);
Obstacles.addLine(new Point(299, 402), new Point(299, 456), 0, null, 2);
Obstacles.addLine(new Point(298, 456), new Point(246, 479), 0, null, 2);
Obstacles.addLine(new Point(331.3, 489), new Point(317.5, 489), 0, null, 1);
};
ClassPinball.prototype.initPaddles = function (mc) {
var _local1 = this;
_local1.paddles_mc = mc;
trace("ziggy");
var _local2 = _local1.pinball_mc;
Obstacles.addPaddle(new Circle(123, 989, 7.5), new Circle(171, 1009, 2), -Math.toRadians(50), _local2.paddle_left, 1);
Obstacles.addPaddle(new Circle(235, 989, 7.5), new Circle(190, 1009, 2), Math.toRadians(50), _local2.paddle_right, 1);
Obstacles.addPaddle(new Circle(116, 488, 7.5), new Circle(161, 508, 2), -Math.toRadians(50), _local2.paddle_left2, 1);
Obstacles.addPaddle(new Circle(243.3, 488, 7.5), new Circle(198.4, 508, 2), Math.toRadians(50), _local2.paddle_right2, 1);
_local1.leftPaddle1 = Obstacles.paddles[0].paddle;
_local1.rightPaddle1 = Obstacles.paddles[1].paddle;
_local1.leftPaddle2 = Obstacles.paddles[2].paddle;
_local1.rightPaddle2 = Obstacles.paddles[3].paddle;
_local1.bIsKeyDown_LEFT = false;
_local1.bIsKeyDown_RIGHT = false;
};
ClassPinball.prototype.initSpring = function (mc) {
this.spring_mc = mc;
this.spring_mc.bFired = false;
};
ClassPinball.prototype.initTriggers = function (mc) {
this.triggers_mc = mc;
Events.clearTriggers();
var _local1 = this.pinball_mc;
Events.addLineTrigger(new Point(347, 690), new Point(325, 711), "springBlocker", "blocker_1");
_local1.blocker_1._visible = false;
_local1.blocker_4._visible = false;
_local1.blocker_5._visible = false;
Events.addCircleTrigger(178, 587, 7, "holeTop", "hole1", "null");
Events.addCircleTrigger(185, 124, 11, "holeHold", "hole2", "null");
_local1.light1.gotoAndStop(1);
_local1.light2.gotoAndStop(1);
Events.addLineTrigger(new Point(165.1, 92.5), new Point(187.1, 92.5), "leftPillarLight");
Events.addLineTrigger(new Point(192.1, 86.8), new Point(214.1, 86.8), "rightPillarLight");
Events.addCircleTrigger(95, 568, 8.25, "light", "tablelight3", "null", 1000);
Events.addCircleTrigger(177, 659, 8.25, "light", "tablelight2", "null", 1000);
Events.addCircleTrigger(177, 718, 8.25, "light", "tablelight1", "null", 1000);
Events.addCircleTrigger(124, 546, 8.25, "light", "tablelight4", "null", 1000);
Events.addCircleTrigger(258, 568, 8.25, "light", "tablelight6", "null", 1000);
Events.addCircleTrigger(230, 546, 8.25, "light", "tablelight5", "null", 1000);
Events.addCircleTrigger(73, 800, 7.25, "lightswitch", "leftLight1", "leftSwitch1", 1000);
Events.addCircleTrigger(73, 817, 7.25, "lightswitch", "leftLight2", "leftSwitch2", 1000);
Events.addCircleTrigger(73, 837, 7.25, "lightswitch", "leftLight3", "leftSwitch3", 1000);
Events.addCircleTrigger(289, 800, 7.25, "lightswitch", "rightLight1", "rightSwitch1", 1000);
Events.addCircleTrigger(289, 817, 7.25, "lightswitch", "rightLight2", "rightSwitch2", 1000);
Events.addCircleTrigger(289, 837, 7.25, "lightswitch", "rightLight3", "rightSwitch3", 1000);
Events.addCircleTrigger(176, 197, 7.25, "light", "tablelight9", "null", 2500);
Events.addCircleTrigger(218, 215, 7.25, "light", "tablelight10", "null", 2500);
Events.addCircleTrigger(235, 256, 7.25, "light", "tablelight22", "null", 2500);
Events.addCircleTrigger(132, 215, 7.25, "light", "tablelight8", "null", 2500);
Events.addCircleTrigger(115, 256, 7.25, "light", "tablelight7", "null", 2500);
Events.addCircleTrigger(76, 88, 6.2, "light", "tablelight14", "null", 3000);
Events.addCircleTrigger(62, 112, 6.2, "light", "tablelight13", "null", 3000);
Events.addCircleTrigger(53, 141, 6.2, "light", "tablelight12", "null", 3000);
Events.addCircleTrigger(97, 66, 6.2, "light", "tablelight15", "null", 3000);
Events.addCircleTrigger(289, 88, 6.2, "light", "tablelight17", "null", 3000);
Events.addCircleTrigger(301, 112, 6.2, "light", "tablelight18", "null", 3000);
Events.addCircleTrigger(311, 141, 6.2, "light", "tablelight19", "null", 3000);
Events.addCircleTrigger(268, 66, 6.2, "light", "tablelight16", "null", 3000);
Events.addCircleTrigger(61, 304, 7.25, "lightswitch", "leftLight4", "leftSwitch4", 2000);
Events.addCircleTrigger(61, 321, 7.25, "lightswitch", "leftLight5", "leftSwitch5", 2000);
Events.addCircleTrigger(61, 339, 7.25, "lightswitch", "leftLight6", "leftSwitch6", 2000);
Events.addCircleTrigger(293, 304, 7.25, "lightswitch", "rightLight1", "rightSwitch1", 2000);
Events.addCircleTrigger(293, 321, 7.25, "lightswitch", "rightLight5", "rightSwitch5", 2000);
Events.addCircleTrigger(293, 339, 7.25, "lightswitch", "rightLight6", "rightSwitch6", 2000);
Events.addLineTrigger(new Point(267, 185), new Point(294, 198), "rightRail", "null");
Events.addLineTrigger(new Point(69, 198), new Point(96, 185), "leftRail", "null");
};
ClassPinball.prototype.initBalls = function (mc) {
var _local1 = this;
_local1.balls_mc = mc;
_local1.balls = [];
_local1.depth = 0;
};
ClassPinball.prototype.addBall = function (x, y, radius, velocity) {
var _local2 = this;
var _local3 = _local2.balls_mc.attachMovie("ball", "ball" + _local2.depth, _local2.depth);
_local2.depth++;
var _local1 = new ClassBall(x, y, radius, _local3);
_local1.velocity = velocity;
_local1.mc._x = x;
_local1.mc._y = y;
_local1.mc.bHold = false;
_local2.balls.push(_local1);
};
ClassPinball.prototype.clear = function (mc) {
mc.clear();
};
ClassPinball.prototype.addScore = function (s) {
_level0.scorenum = _level0.scorenum + s;
_level0.score = _timeline.formatScore(_level0.scorenum);
var _local1 = 1;
while (_local1 < 9) {
_level0.scoreboard["s" + _local1] = _level0.score[_local1 - 1];
_local1++;
}
};
ClassPinball.prototype.playSound = function (s) {
this.pinball_mc.soundfx.gotoAndPlay(s);
};
ClassPinball.prototype.loseLife = function (mc) {
var _local1 = this;
mc.removeMovieClip();
_level0.lives--;
_level0.scoreboard.balls.gotoAndStop(_level0.lives + 1);
if (_level0.lives < 1) {
_local1.playSound("gameover");
_timeline.Jake.gotoAndPlay("looseBall");
_local1.gameOver();
} else {
_local1.playSound("loselife");
_local1.initTable(pinball_mc.lines_mc);
_local1.initPaddles(pinball_mc.paddles_mc);
_local1.initSpring(pinball_mc.spring_mc);
_local1.initTriggers(pinball_mc.triggers_mc);
_local1.initBalls(pinball_mc.balls_mc);
_local1.start();
}
};
ClassPinball.prototype.gameOver = function () {
var _local1 = this.pinball_mc;
delete _local1.onEnterFrame;
_timeline.gameOver();
};
ClassPinball.prototype.doSpring = function () {
var _local1 = this.spring_mc;
if (Key.isDown(40)) {
_local1.bFired = true;
var _local3 = _local1._currentframe + 4;
if (_local3 > 100) {
_local3 = 100;
}
_local1.gotoAndStop(_local3);
} else if (_local1.bFired) {
_local1.bFired = false;
var _local2 = this.pinball_mc.ball;
if ((940 < _local2.y) && (_local2.y < 955)) {
var power = (Math.floor(_local1._currentframe / 3) + (Math.random() * 3));
_local2.velocity.y = -power;
}
_local1.gotoAndPlay("release");
this.playSound("launch");
}
};
ClassPinball.prototype.doBalls = function () {
var _local2 = this;
_local2.clear(_local2.balls_mc);
var len = _local2.balls.length;
var i = 0;
while (i < len) {
var _local1 = _local2.balls[i];
var _local3 = _local1.duplicate();
var velocity = _local1.velocity;
velocity.addVector(_local2.gravity);
if (velocity.length() > 0.0001) {
_local1.moveBy(velocity);
var list = Obstacles.checkForCollisions(_local3, _local1);
Obstacles.resolveCollisions(_local3, _local1, list);
Events.checkTriggers(_local3, _local1);
if (_local1.y > (_local2.tableSize.height + 20)) {
_local2.loseLife(_local1.mc);
}
}
_local1.mc._x = _local1.x;
_local1.mc._y = _local1.y;
if (pinball_mc.OPT_collision.bShowLines) {
_local1.draw(_local2.balls_mc, 255);
}
if (pinball_mc.OPT_motion.bShowLines) {
var trail_mc = _local2.balls_mc.createEmptyMovieClip("trail" + _local2.depth, _local2.depth);
_local2.depth++;
trail_mc.onEnterFrame = function () {
var _local1 = this;
if (_local1._alpha < 1) {
delete _local1.onEnterFrame;
_local1.removeMovieClip();
}
_local1._alpha--;
};
var trail = new Line(_local3, _local1);
trail.draw(trail_mc, 3355443);
}
i++;
}
};
ClassPinball.prototype.doPaddles = function () {
var _local1 = this;
if (Key.isDown(37)) {
if (!_local1.bIsKeyDown_LEFT) {
_local1.bIsKeyDown_LEFT = true;
var paddle = _local1.leftPaddle1;
var c0 = paddle.c0;
var c1 = paddle.c1;
var origin = paddle.origin;
var startAngle = paddle.startAngle;
var endAngle = paddle.endAngle;
paddle.rotate(paddle.angle);
paddle.mc._rotation = Math.toDegrees(paddle.angle);
var len = _local1.balls.length;
var i = 0;
while (i < len) {
var _local2 = _local1.balls[i];
var minDist = (c0.getVector(c1).length() + c1.radius);
var dist = c0.getVector(_local2).length();
if ((dist < minDist) && (_local2.x > c0.x)) {
trace("able to hit");
var _local3 = origin.getVector(_local2).getAngle();
var angle2 = (_local3 + (Math.PI*2));
if (((startAngle <= _local3) && (_local3 <= endAngle)) || ((startAngle <= angle2) && (angle2 <= endAngle))) {
trace("should colllide here");
BallCollision.resolvePaddle(paddle, _local2);
Pinball.playSound("hitball");
}
}
i++;
}
var paddle = _local1.leftPaddle2;
var c0 = paddle.c0;
var c1 = paddle.c1;
var origin = paddle.origin;
var startAngle = paddle.startAngle;
var endAngle = paddle.endAngle;
paddle.rotate(paddle.angle);
paddle.mc._rotation = Math.toDegrees(paddle.angle);
var len = _local1.balls.length;
var i = 0;
while (i < len) {
var _local2 = _local1.balls[i];
var minDist = (c0.getVector(c1).length() + c1.radius);
var dist = c0.getVector(_local2).length();
if ((dist < minDist) && (_local2.x > c0.x)) {
trace("able to hit");
var _local3 = origin.getVector(_local2).getAngle();
var angle2 = (_local3 + (Math.PI*2));
if (((startAngle <= _local3) && (_local3 <= endAngle)) || ((startAngle <= angle2) && (angle2 <= endAngle))) {
trace("should colllide here");
BallCollision.resolvePaddle(paddle, _local2);
Pinball.playSound("hitball");
}
}
i++;
}
_local1.playSound("paddle_up");
}
} else if (_local1.bIsKeyDown_LEFT) {
_local1.bIsKeyDown_LEFT = false;
_local1.leftPaddle1.rotate(-_local1.leftPaddle1.angle);
_local1.leftPaddle1.mc._rotation = 0;
_local1.leftPaddle2.rotate(-_local1.leftPaddle2.angle);
_local1.leftPaddle2.mc._rotation = 0;
_local1.playSound("paddle_down");
}
if (Key.isDown(39)) {
if (!_local1.bIsKeyDown_RIGHT) {
_local1.bIsKeyDown_RIGHT = true;
var paddle = _local1.rightPaddle1;
var c0 = paddle.c0;
var c1 = paddle.c1;
var origin = paddle.origin;
var startAngle = paddle.startAngle;
var endAngle = paddle.endAngle;
paddle.rotate(paddle.angle);
paddle.mc._rotation = Math.toDegrees(paddle.angle);
var len = _local1.balls.length;
var i = 0;
while (i < len) {
var _local2 = _local1.balls[i];
var minDist = (c0.getVector(c1).length() + c1.radius);
var dist = c0.getVector(_local2).length();
if ((dist < minDist) && (_local2.x < c0.x)) {
var _local3 = origin.getVector(_local2).getAngle();
var angle2 = (_local3 + (Math.PI*2));
if (((startAngle <= _local3) && (_local3 <= endAngle)) || ((startAngle <= angle2) && (angle2 <= endAngle))) {
BallCollision.resolvePaddle(paddle, _local2);
Pinball.playSound("hitball");
}
}
i++;
}
var paddle = _local1.rightPaddle2;
var c0 = paddle.c0;
var c1 = paddle.c1;
var origin = paddle.origin;
var startAngle = paddle.startAngle;
var endAngle = paddle.endAngle;
paddle.rotate(paddle.angle);
paddle.mc._rotation = Math.toDegrees(paddle.angle);
var len = _local1.balls.length;
var i = 0;
while (i < len) {
var _local2 = _local1.balls[i];
var minDist = (c0.getVector(c1).length() + c1.radius);
var dist = c0.getVector(_local2).length();
if ((dist < minDist) && (_local2.x < c0.x)) {
var _local3 = origin.getVector(_local2).getAngle();
var angle2 = (_local3 + (Math.PI*2));
if (((startAngle <= _local3) && (_local3 <= endAngle)) || ((startAngle <= angle2) && (angle2 <= endAngle))) {
BallCollision.resolvePaddle(paddle, _local2);
Pinball.playSound("hitball");
}
}
i++;
}
_local1.playSound("paddle_up");
}
} else if (_local1.bIsKeyDown_RIGHT) {
_local1.bIsKeyDown_RIGHT = false;
_local1.rightPaddle1.rotate(-_local1.rightPaddle1.angle);
_local1.rightPaddle1.mc._rotation = 0;
_local1.rightPaddle2.rotate(-_local1.rightPaddle1.angle);
_local1.rightPaddle2.mc._rotation = 0;
_local1.playSound("paddle_down");
}
Obstacles.clearPaddles(_local1.paddles_mc);
};
ClassPinball.prototype.paddleCollisions = function (mypaddle) {
var paddle = this[mypaddle + j];
var c0 = paddle.c0;
var c1 = paddle.c1;
var origin = paddle.origin;
var startAngle = paddle.startAngle;
var endAngle = paddle.endAngle;
paddle.rotate(paddle.angle);
paddle.mc._rotation = Math.toDegrees(paddle.angle);
var len = this.balls.length;
var _local3 = 0;
while (_local3 < len) {
var _local1 = this.balls[_local3];
var minDist = (c0.getVector(c1).length() + c1.radius);
var dist = c0.getVector(_local1).length();
if ((dist < minDist) && (_local1.x > c0.x)) {
trace("able to hit");
var _local2 = origin.getVector(_local1).getAngle();
var angle2 = (_local2 + (Math.PI*2));
if (((startAngle <= _local2) && (_local2 <= endAngle)) || ((startAngle <= angle2) && (angle2 <= endAngle))) {
trace("should colllide here");
BallCollision.resolvePaddle(paddle, _local1);
Pinball.playSound("hitball");
}
}
_local3++;
}
};
_global.Pinball = new ClassPinball();
_global.ClassBall = function (x, y, radius, mc) {
super(x, y, radius);
this.velocity = new Vector(0, 0);
this.mc = mc;
};
ClassBall.prototype = new Circle();
ClassBall.prototype.draw = function (mc, colour) {
var _local1 = this;
mc.lineStyle(0, 0, 100);
var arc = (Math.PI*2);
var segs = Math.ceil(Math.abs(arc) / (Math.PI/4));
var _local3 = arc / segs;
var _local2 = 0;
var ax = (_local1.x + (Math.cos(_local2) * _local1.radius));
var ay = (_local1.y + (Math.sin(_local2) * _local1.radius));
mc.moveTo(ax, ay);
if (segs > 0) {
var angleMid;
var bx;
var by;
var cx;
var cy;
mc.beginFill(colour, 100);
var i = 0;
while (i < segs) {
_local2 = _local2 + _local3;
angleMid = _local2 - (_local3 / 2);
bx = _local1.x + (Math.cos(_local2) * _local1.radius);
by = _local1.y + (Math.sin(_local2) * _local1.radius);
cx = _local1.x + (Math.cos(angleMid) * (_local1.radius / Math.cos(_local3 / 2)));
cy = _local1.y + (Math.sin(angleMid) * (_local1.radius / Math.cos(_local3 / 2)));
mc.curveTo(cx, cy, bx, by);
i++;
}
mc.beginFill();
}
};
ClassBall.prototype.toString = function () {
var _local1 = this;
var _local2 = ((((((((((("[class 'Ball' x: " + (Math.round(_local1.x * 1000) / 1000)) + ", y: ") + (Math.round(_local1.y * 1000) / 1000)) + ", radius: ") + _local1.radius) + ", velocity.x: ") + _local1.velocity.x) + ", velocity.y: ") + _local1.velocity.y) + ", mc: ") + _local1.mc) + "]";
return(_local2);
};
ClassBall.prototype.trace = function () {
trace(this.toString());
};
ClassBallCollision = function () {
};
ClassBallCollision.prototype.checkLine = function (oldBall, newBall, obstacle) {
var _local3 = obstacle.getNormal();
var _local1 = obstacle.duplicate();
_local1.moveBy(_local3.multiply(newBall.radius));
var motionLine = new Line(oldBall, newBall);
var _local2 = Intersection.getLineLine(_local1, motionLine);
return(_local2);
};
ClassBallCollision.prototype.resolveLine = function (ball, pointOfImpact, obstacle, force) {
var _local1 = obstacle.getNormal();
this.setNewVelocity(ball, obstacle, pointOfImpact, _local1, force);
};
ClassBallCollision.prototype.checkOuterCircle = function (oldBall, newBall, obstacle) {
var _local2 = obstacle.duplicate().addRadius(newBall.radius);
var _local3 = new Line(oldBall, newBall);
var _local1 = Intersection.getCircleLine(_local2, _local3);
return(_local1);
};
ClassBallCollision.prototype.resolveOuterCircle = function (ball, pointOfImpact, obstacle, force) {
var _local1 = obstacle.getNormal(pointOfImpact);
this.setNewVelocity(ball, obstacle, pointOfImpact, _local1, force);
};
ClassBallCollision.prototype.checkInnerCircle = function (oldBall, newBall, obstacle) {
var _local2 = obstacle.duplicate().subtractRadius(newBall.radius);
var _local3 = new Line(oldBall, newBall);
var _local1 = Intersection.getCircleLine(_local2, _local3);
return(_local1);
};
ClassBallCollision.prototype.resolveInnerCircle = function (ball, pointOfImpact, obstacle, force) {
var _local1 = obstacle.getNormal(pointOfImpact).negate();
this.setNewVelocity(ball, obstacle, pointOfImpact, _local1, force);
};
ClassBallCollision.prototype.checkOuterArc = function (oldBall, newBall, obstacle) {
var _local2 = obstacle.duplicate().addRadius(newBall.radius);
var _local3 = new Line(oldBall, newBall);
var _local1 = Intersection.getArcLine(_local2, _local3);
return(_local1);
};
ClassBallCollision.prototype.resolveOuterArc = function (ball, pointOfImpact, obstacle, force) {
var _local1 = obstacle.getNormal(pointOfImpact);
this.setNewVelocity(ball, obstacle, pointOfImpact, _local1, force);
};
ClassBallCollision.prototype.checkInnerArc = function (oldBall, newBall, obstacle) {
var _local2 = obstacle.duplicate().subtractRadius(newBall.radius);
var _local3 = new Line(oldBall, newBall);
var _local1 = Intersection.getArcLine(_local2, _local3);
return(_local1);
};
ClassBallCollision.prototype.resolveInnerArc = function (ball, pointOfImpact, obstacle, force) {
var _local1 = obstacle.getNormal(pointOfImpact).negate();
this.setNewVelocity(ball, obstacle, pointOfImpact, _local1, force);
};
ClassBallCollision.prototype.setNewVelocity = function (ball, obstacle, POI, normalVector, force) {
ball.moveTo(POI.addVector(normalVector.multiply(0.5)));
var _local3 = 0.6;
var friction = 0.9;
var _local2 = obstacle.getTangent(POI).getAngle();
var _local1 = ball.velocity;
_local1.rotate(-_local2);
_local1.y = _local1.y * (-_local3);
if ((_local1.y * _local1.y) < 1) {
_timeline.txt_state.text = "sliding";
_local1.y = _local1.y * 0;
_local1.x = _local1.x * 1;
} else {
_timeline.txt_state.text = "in motion";
_local1.x = _local1.x * friction;
}
_local1.rotate(_local2);
var forceVector = normalVector.Multiply(force);
_local1.addVector(forceVector);
this.resolveBallSpeed(_local1);
};
ClassBallCollision.prototype.resolvePaddle = function (paddle, ball) {
var _local1 = ball;
var POI;
var midpoint;
var t0;
var t1;
var _local2 = _local1.velocity;
var _local3 = paddle.c0;
var c1 = paddle.c1;
var intersecting_line = new Line(new Point(_local3.x, _local3.y - _local3.radius), new Point(_local1.x, _local1.y + _local1.radius));
intersecting_line.scale(1000);
POI = Intersection.getCircleLine(_local3, intersecting_line);
midpoint = POI[0].getMidPoint(POI[1]);
t0 = _local3.addVector(_local3.getVector(midpoint).normalise().multiply(_local3.radius));
POI = Intersection.getCircleLine(_local1, intersecting_line);
midpoint = POI[0].getMidPoint(POI[1]);
t1 = _local1.addVector(_local1.getVector(midpoint).normalise().multiply(_local1.radius));
var tangent = new Line(t0, t1);
var angleOfTangent = tangent.getAngle();
var lengthOfTangent = tangent.length();
_local2.rotate(-angleOfTangent);
_local2.y = _local2.y * -2;
_local2.rotate(angleOfTangent);
_local2.y = -Math.abs(_local2.y);
_local2.y = _local2.y - lengthOfTangent;
_local2.x = _local2.x * 2.7;
this.resolveBallSpeed(_local2);
var lineOfMotion = new Line(_local1, _local1.addVector(_local2));
lineOfMotion.scale(1000);
var POI = Intersection.getLineLine(lineOfMotion, paddle.maxLine);
_local1.moveTo(POI[0].moveBy(paddle.maxLine.getNormal()));
};
ClassBallCollision.prototype.resolveBallSpeed = function (velocity) {
var _local2 = velocity.length();
var _local1 = 30;
if (_local2 > _local1) {
velocity.normalise().multiply(_local1);
}
};
_global.BallCollision = new ClassBallCollision();
ClassObstacles = function () {
var _local1 = this;
_local1.lines = [];
_local1.outerCircles = [];
_local1.innerCircles = [];
_local1.outerArcs = [];
_local1.innerArcs = [];
_local1.paddles = [];
};
ClassObstacles.prototype.clearAll = function () {
var _local1 = this;
_local1.lines = [];
_local1.outerCircles = [];
_local1.innerCircles = [];
_local1.outerArcs = [];
_local1.innerArcs = [];
_local1.paddles = [];
};
ClassObstacles.prototype.clearLine = function (id) {
this.lines[id] = null;
};
ClassObstacles.prototype.clearOuterCircles = function (id) {
this.outerCircles[id] = null;
};
ClassObstacles.prototype.clearInnerCircles = function (id) {
this.innerCircles[id] = null;
};
ClassObstacles.prototype.clearOuterArcs = function (id) {
this.outerArcs[id] = null;
};
ClassObstacles.prototype.clearIinnerArcs = function (id) {
this.innerArcs[id] = null;
};
ClassObstacles.prototype.addLine = function (p0, p1, force, mc, bound) {
var _local1 = p1;
var _local2 = p0;
var line = new Line(_local2, _local1);
var min = _local2.min(_local1);
var max = _local2.max(_local1);
this.lines.push({line:line, force:force, mc:mc, bound:bound, min:min, max:max});
return(this.lines.length - 1);
};
ClassObstacles.prototype.drawLines = function (mc, ballRadius) {
var len = this.lines.length;
var _local2 = 0;
while (_local2 < len) {
var _local1 = this.lines[_local2].line;
_local1.draw(mc, 16711680);
var normalVector = _local1.getNormal();
var _local3 = _local1.duplicate();
_local3.moveBy(normalVector.multiply(ballRadius));
_local3.draw(mc, 13421772);
_local2++;
}
};
ClassObstacles.prototype.addOuterCircle = function (x, y, radius, force, mc, bound) {
var _local1 = radius;
var _local2 = y;
var _local3 = x;
var circle = new Circle(_local3, _local2, _local1);
var min = new Point(_local3 - _local1, _local2 - _local1);
var max = new Point(_local3 + _local1, _local2 + _local1);
this.outerCircles.push({circle:circle, force:force, mc:mc, bound:bound, min:min, max:max});
return(this.outerCircles.length - 1);
};
ClassObstacles.prototype.drawOuterCircles = function (mc, ballRadius) {
var len = this.outerCircles.length;
var _local1 = 0;
while (_local1 < len) {
var _local2 = this.outerCircles[_local1].circle;
_local2.draw(mc, 16711935);
var _local3 = _local2.duplicate().addRadius(ballRadius);
_local3.draw(mc, 13421772);
_local1++;
}
};
ClassObstacles.prototype.addInnerCircle = function (x, y, radius, force, mc, bound) {
var _local1 = radius;
var _local2 = y;
var _local3 = x;
var circle = new Circle(_local3, _local2, _local1);
var min = new Point(_local3 - _local1, _local2 - _local1);
var max = new Point(_local3 + _local1, _local2 + _local1);
this.innerCircles.push({circle:circle, force:force, mc:mc, bound:bound, min:min, max:max});
return(this.innerCircles.length - 1);
};
ClassObstacles.prototype.drawInnerCircles = function (mc, ballRadius) {
var len = this.innerCircles.length;
var _local1 = 0;
while (_local1 < len) {
var _local2 = this.innerCircles[_local1].circle;
_local2.draw(mc, 16711680);
var _local3 = _local2.duplicate().subtractRadius(ballRadius);
_local3.draw(mc, 13421772);
_local1++;
}
};
ClassObstacles.prototype.addOuterArc = function (x, y, radius, startAngle, endAngle, force, mc, bound) {
var _local1 = radius;
var _local2 = y;
var _local3 = x;
var arc = new Arc(_local3, _local2, _local1, startAngle, endAngle);
var min = new Point(_local3 - _local1, _local2 - _local1);
var max = new Point(_local3 + _local1, _local2 + _local1);
this.outerArcs.push({arc:arc, force:force, mc:mc, bound:bound, min:min, max:max});
return(this.outerArcs.length - 1);
};
ClassObstacles.prototype.drawOuterArcs = function (mc, ballRadius) {
var len = this.outerArcs.length;
var _local1 = 0;
while (_local1 < len) {
var _local2 = this.outerArcs[_local1].arc;
_local2.draw(mc, 65280);
var _local3 = _local2.duplicate().addRadius(ballRadius);
_local3.draw(mc, 13421772);
_local1++;
}
};
ClassObstacles.prototype.addInnerArc = function (x, y, radius, startAngle, endAngle, force, mc, bound) {
var _local1 = radius;
var _local2 = y;
var _local3 = x;
var arc = new Arc(_local3, _local2, _local1, startAngle, endAngle);
var min = new Point(_local3 - _local1, _local2 - _local1);
var max = new Point(_local3 + _local1, _local2 + _local1);
this.innerArcs.push({arc:arc, force:force, mc:mc, bound:bound, min:min, max:max});
return(this.innerArcs.length - 1);
};
ClassObstacles.prototype.drawInnerArcs = function (mc, ballRadius) {
var len = this.innerArcs.length;
var _local1 = 0;
while (_local1 < len) {
var _local2 = this.innerArcs[_local1].arc;
_local2.draw(mc, 255);
var _local3 = _local2.duplicate().subtractRadius(ballRadius);
_local3.draw(mc, 13421772);
_local1++;
}
};
ClassObstacles.prototype.addPaddle = function (c0, c1, angle, mc, bound) {
var paddle = new ClassPaddle(c0, c1, angle, mc);
this.paddles.push({paddle:paddle, mc:mc, bound:bound});
return(this.paddles.length - 1);
};
ClassObstacles.prototype.drawPaddles = function (mc, ballRadius) {
var _local3 = this.paddles.length;
var _local1 = 0;
while (_local1 < _local3) {
var _local2 = this.paddles[_local1].paddle;
_local2.draw(mc, 16711935, ballRadius);
_local1++;
}
};
ClassObstacles.prototype.clearPaddles = function (mc) {
mc.clear();
};
ClassObstacles.prototype.drawCollisionLines = function (mc, ballRadius) {
var _local1 = mc;
var _local2 = ballRadius;
var _local3 = this;
_local3.drawPaddles(_local1, _local2);
_local3.drawLines(_local1, _local2);
_local3.drawOuterCircles(_local1, _local2);
_local3.drawInnerCircles(_local1, _local2);
_local3.drawOuterArcs(_local1, _local2);
_local3.drawInnerArcs(_local1, _local2);
};
ClassObstacles.prototype.clearCollisionLines = function (mc) {
mc.clear();
};
ClassObstacles.prototype.checkForCollisions = function (oldBall, newBall) {
var len;
var _local3;
var _local1;
var obstacle;
var force;
var mc;
var pointOfImpact;
var _local2;
var list = [];
var bound = Math.ceil(newBall.y / _global.splitrange);
var offset = (newBall.radius + 2);
var ball_min = oldBall.min(newBall);
ball_min.x = ball_min.x - offset;
ball_min.y = ball_min.y - offset;
var ball_max = oldBall.max(newBall);
ball_max.x = ball_max.x + offset;
ball_max.y = ball_max.y + offset;
len = this.lines.length;
_local3 = 0;
while (_local3 < len) {
var line = this.lines[_local3];
if ((line.bound == bound) || (line.bound == -1)) {
if (this.checkBoundingBox(ball_min, ball_max, line.min, line.max)) {
obstacle = line.line;
force = line.force;
mc = line.mc;
pointOfImpact = BallCollision.checkLine(oldBall, newBall, obstacle);
_local1 = 0;
while (_local1 < pointOfImpact.length) {
_local2 = pointOfImpact[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle, force:force, mc:mc, type:0});
_local1++;
}
}
}
_local3++;
}
len = this.outerCircles.length;
_local3 = 0;
while (_local3 < len) {
var outerCircle = this.outerCircles[_local3];
if ((outerCircle.bound == bound) || (outerCircle.bound == -1)) {
if (this.checkBoundingBox(ball_min, ball_max, outerCircle.min, outerCircle.max)) {
obstacle = outerCircle.circle;
force = outerCircle.force;
mc = outerCircle.mc;
pointOfImpact = BallCollision.checkOuterCircle(oldBall, newBall, obstacle);
_local1 = 0;
while (_local1 < pointOfImpact.length) {
_local2 = pointOfImpact[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle, force:force, mc:mc, type:1});
_local1++;
}
}
}
_local3++;
}
len = this.innerCircles.length;
_local3 = 0;
while (_local3 < len) {
var innerCircle = this.innerCircles[_local3];
if ((innerCircle.bound == bound) || (innerCircle.bound == -1)) {
if (this.checkBoundingBox(ball_min, ball_max, innerCircle.min, innerCircle.max)) {
obstacle = innerCircle.circle;
force = innerCircle.force;
mc = innerCircle.mc;
pointOfImpact = BallCollision.checkInnerCircle(oldBall, newBall, obstacle);
_local1 = 0;
while (_local1 < pointOfImpact.length) {
_local2 = pointOfImpact[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle, force:force, mc:mc, type:2});
_local1++;
}
}
}
_local3++;
}
len = this.outerArcs.length;
_local3 = 0;
while (_local3 < len) {
var outerArc = this.outerArcs[_local3];
if ((outerArc.bound == bound) || (outerArc.bound == -1)) {
if (this.checkBoundingBox(ball_min, ball_max, outerArc.min, outerArc.max)) {
obstacle = outerArc.arc;
force = outerArc.force;
mc = outerArc.mc;
pointOfImpact = BallCollision.checkOuterArc(oldBall, newBall, obstacle);
_local1 = 0;
while (_local1 < pointOfImpact.length) {
_local2 = pointOfImpact[_local1];
_local2 = pointOfImpact[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle, force:force, mc:mc, type:3});
_local1++;
}
}
}
_local3++;
}
len = this.innerArcs.length;
_local3 = 0;
while (_local3 < len) {
var innerArc = this.innerArcs[_local3];
if ((innerArc.bound == bound) || (innerArc.bound == -1)) {
if (this.checkBoundingBox(ball_min, ball_max, innerArc.min, innerArc.max)) {
obstacle = innerArc.arc;
force = innerArc.force;
mc = innerArc.mc;
pointOfImpact = BallCollision.checkInnerArc(oldBall, newBall, obstacle);
_local1 = 0;
while (_local1 < pointOfImpact.length) {
_local2 = pointOfImpact[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle, force:force, mc:mc, type:4});
_local1++;
}
}
}
_local3++;
}
if (bound == 3) {
len = 2;
_local3 = 0;
while (_local3 < len) {
obstacle = this.paddles[_local3].paddle;
force = 0;
mc = this.paddles[_local3].mc;
var impact_c0 = BallCollision.checkOuterCircle(oldBall, newBall, obstacle.c0);
var impact_c1 = BallCollision.checkOuterCircle(oldBall, newBall, obstacle.c1);
var impact_t0 = BallCollision.checkLine(oldBall, newBall, obstacle.t0);
var impact_t1 = BallCollision.checkLine(oldBall, newBall, obstacle.t1);
_local1 = 0;
while (_local1 < impact_c0.length) {
_local2 = impact_c0[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle.c0, force:force, mc:mc, type:1});
_local1++;
}
_local1 = 0;
while (_local1 < impact_c1.length) {
_local2 = impact_c1[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle.c1, force:force, mc:mc, type:1});
_local1++;
}
_local1 = 0;
while (_local1 < impact_t0.length) {
_local2 = impact_t0[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle.t0, force:force, mc:mc, type:0});
_local1++;
}
_local1 = 0;
while (_local1 < impact_t1.length) {
_local2 = impact_t1[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle.t1, force:force, mc:mc, type:0});
_local1++;
}
_local3++;
}
}
if (bound == 2) {
len = 4;
_local3 = 2;
while (_local3 < len) {
obstacle = this.paddles[_local3].paddle;
force = 0;
mc = this.paddles[_local3].mc;
var impact_c0 = BallCollision.checkOuterCircle(oldBall, newBall, obstacle.c0);
var impact_c1 = BallCollision.checkOuterCircle(oldBall, newBall, obstacle.c1);
var impact_t0 = BallCollision.checkLine(oldBall, newBall, obstacle.t0);
var impact_t1 = BallCollision.checkLine(oldBall, newBall, obstacle.t1);
_local1 = 0;
while (_local1 < impact_c0.length) {
_local2 = impact_c0[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle.c0, force:force, mc:mc, type:1});
_local1++;
}
_local1 = 0;
while (_local1 < impact_c1.length) {
_local2 = impact_c1[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle.c1, force:force, mc:mc, type:1});
_local1++;
}
_local1 = 0;
while (_local1 < impact_t0.length) {
_local2 = impact_t0[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle.t0, force:force, mc:mc, type:0});
_local1++;
}
_local1 = 0;
while (_local1 < impact_t1.length) {
_local2 = impact_t1[_local1];
list.push({pointOfImpact:_local2, obstacle:obstacle.t1, force:force, mc:mc, type:0});
_local1++;
}
_local3++;
}
}
return(list);
};
ClassObstacles.prototype.resolveCollisions = function (oldBall, newBall, list) {
var len = list.length;
if (len > 0) {
var _local2 = list[0];
var closestDist = oldBall.getVector(_local2.pointOfImpact).length();
var _local1 = 1;
while (_local1 < len) {
var _local3 = list[_local1];
var dist = oldBall.getVector(_local3.pointOfImpact).length();
if (dist < closestDist) {
closestDist = dist;
_local2 = _local3;
}
_local1++;
}
_local2.mc.gotoAndPlay("hit");
var score = (_local2.force * 200);
switch (_local2.force) {
case 13.5 :
Pinball.playSound("bouncers");
break;
case 12 :
Pinball.playSound("bumpers");
break;
case 10 :
Pinball.playSound("mini_bouncers");
Pinball.playSound("ping");
break;
case 5 :
Pinball.playSound("mini_bouncers");
}
if (score > 0) {
Pinball.addScore(score);
}
switch (_local2.type) {
case 0 :
BallCollision.resolveLine(newBall, _local2.pointOfImpact, _local2.obstacle, _local2.force);
return;
case 1 :
BallCollision.resolveOuterCircle(newBall, _local2.pointOfImpact, _local2.obstacle, _local2.force);
return;
case 2 :
BallCollision.resolveInnerCircle(newBall, _local2.pointOfImpact, _local2.obstacle, _local2.force);
return;
case 3 :
BallCollision.resolveOuterArc(newBall, _local2.pointOfImpact, _local2.obstacle, _local2.force);
return;
case 4 :
BallCollision.resolveInnerArc(newBall, _local2.pointOfImpact, _local2.obstacle, _local2.force);
}
}
};
ClassObstacles.prototype.checkBoundingBox = function (min1, max1, min2, max2) {
if (max1.x < min2.x) {
return(false);
}
if (min1.x > max2.x) {
return(false);
}
if (max1.y < min2.y) {
return(false);
}
if (min1.y > max2.y) {
return(false);
}
return(true);
};
_global.Obstacles = new ClassObstacles();
_global.ClassPaddle = function (c0, c1, angle, mc) {
var _local1 = this;
_local1.c0 = c0;
_local1.c1 = c1;
_local1.angle = angle;
_local1.mc = mc;
if (_local1.c0.x < _local1.c1.x) {
_local1.t0 = _local1.c1.getTangentOfTwoCircles(_local1.c0);
_local1.t1 = _local1.c0.getTangentOfTwoCircles(_local1.c1);
_local1.init("left");
} else {
_local1.t0 = _local1.c0.getTangentOfTwoCircles(_local1.c1);
_local1.t1 = _local1.c1.getTangentOfTwoCircles(_local1.c0);
_local1.init("right");
}
_local1.mc._x = _local1.c0.x;
_local1.mc._y = _local1.c0.y;
};
ClassPaddle.prototype.init = function (type) {
var _local1 = this;
var _local2 = Pinball.ballRadius;
_local1.minLine = _local1.t1.duplicate().scale(1000);
_local1.minLine.moveBy(_local1.minLine.getNormal().multiply(_local2));
var tangent1 = _local1.t1.duplicate().moveBy(_local1.t1.getNormal().multiply(_local2));
var vect1 = tangent1.getVector().normalise().multiply(tangent1.length() + c1.radius);
var p1 = tangent1.p0.duplicate().moveBy(vect1);
_local1.rotate(_local1.angle);
_local1.maxLine = _local1.t0.duplicate().scale(1000);
_local1.maxLine.moveBy(_local1.maxLine.getNormal().multiply(_local2));
var _local3 = _local1.t0.duplicate().moveBy(_local1.t0.getNormal().multiply(_local2));
var vect0 = _local3.getVector().normalise().multiply(_local3.length() + c1.radius);
var p0 = _local3.p1.duplicate().moveBy(vect0.negate());
_local1.rotate(-_local1.angle);
_local1.origin = Intersection.getLineLine(_local1.maxLine, _local1.minLine)[0];
if (type == "left") {
_local1.startAngle = _local1.origin.getVector(p0).getAngle();
_local1.endAngle = _local1.origin.getVector(p1).getAngle();
} else if (type == "right") {
_local1.startAngle = _local1.origin.getVector(p1).getAngle();
_local1.endAngle = _local1.origin.getVector(p0).getAngle();
}
if (_local1.startAngle > _local1.endAngle) {
_local1.endAngle = _local1.endAngle + (Math.PI*2);
}
_local1.mc._rotation = 0;
};
ClassPaddle.prototype.rotate = function (a) {
var _local1 = this;
_local1.c1.rotateAbout(_local1.c0, a);
if (_local1.c0.x < _local1.c1.x) {
_local1.t0 = _local1.c1.getTangentOfTwoCircles(_local1.c0);
_local1.t1 = _local1.c0.getTangentOfTwoCircles(_local1.c1);
} else {
_local1.t0 = _local1.c0.getTangentOfTwoCircles(_local1.c1);
_local1.t1 = _local1.c1.getTangentOfTwoCircles(_local1.c0);
}
};
ClassPaddle.prototype.draw = function (mc, colour, ballRadius) {
var _local1 = this;
var _local2 = mc;
var _local3 = ballRadius;
_local2.lineStyle(0, colour, 100);
_local1.c0.draw(_local2, colour);
_local1.c1.draw(_local2, colour);
_local1.t0.draw(_local2, 16711680);
_local1.t1.draw(_local2, 255);
_local1.c0.duplicate().addRadius(_local3).draw(_local2, 13421772);
_local1.c1.duplicate().addRadius(_local3).draw(_local2, 13421772);
_local1.t0.duplicate().moveBy(_local1.t0.getNormal().multiply(_local3)).draw(_local2, 13421772);
_local1.t1.duplicate().moveBy(_local1.t1.getNormal().multiply(_local3)).draw(_local2, 13421772);
};
ClassPaddle.prototype.toString = function () {
var _local1 = this;
var _local2 = ((((((((("[class 'Paddle' c0: " + _local1.c0.toString()) + ", c1: ") + _local1.c1.toString()) + ", angle: ") + Math.toDegrees(_local1.angle)) + ", startAngle: ") + Math.toDegrees(_local1.startAngle)) + ", endAngle: ") + Math.toDegrees(_local1.endAngle)) + "]";
return(_local2);
};
ClassPaddle.prototype.trace = function () {
trace(this.toString());
};
ClassEvents = function () {
this.lineTriggers = [];
this.circleTriggers = [];
};
ClassEvents.prototype.addLineTrigger = function (p0, p1, event, mc) {
var _local2 = this;
var _local3 = p1;
var shape = new Line(p0, _local3);
var min = p0.min(_local3);
var max = p0.max(_local3);
var _local1 = {mc:mc, shape:shape, event:event, min:min, max:max};
_local1.trace = function () {
trace((this.shape + ", ") + this.event);
};
_local2.lineTriggers.push(_local1);
};
ClassEvents.prototype.addCircleTrigger = function (x, y, radius, event, mc, switchmc, scr) {
var _local2 = radius;
var _local3 = this;
var shape = new Circle(x, y, _local2);
var min = new Point(x - _local2, y - _local2);
var max = new Point(x + _local2, y + _local2);
var _local1 = {mc:mc, shape:shape, score:scr, event:event, min:min, max:max};
if (switchmc != null) {
_local1.switchmc = switchmc;
_local1.switchmc.gotoAndStop(1);
}
_local1.mc.gotoAndStop(1);
_local1.trace = function () {
trace((this.shape + ", ") + this.event);
};
_local3.circleTriggers.push(_local1);
};
ClassEvents.prototype.checkLineTrigger = function (oldBall, newBall, trigger) {
var _local2 = trigger.shape;
var _local3 = new Line(oldBall, newBall);
var _local1 = Intersection.getLineLine(_local2, _local3);
if (_local1.length > 0) {
return(trigger);
}
return(null);
};
ClassEvents.prototype.checkCircleTrigger = function (oldBall, newBall, trigger) {
var _local2 = trigger.shape;
var _local3 = new Line(oldBall, newBall);
var _local1 = Intersection.getCircleLine(_local2, _local3);
if (_local1.length > 0) {
return(trigger);
}
return(null);
};
ClassEvents.prototype.checkTriggers = function (oldBall, newBall) {
var _local3;
var len;
var _local1;
var _local2;
var event;
var offset = (newBall.radius + 2);
var ball_min = oldBall.min(newBall);
ball_min.x = ball_min.x - offset;
ball_min.y = ball_min.y - offset;
var ball_max = oldBall.max(newBall);
ball_max.x = ball_max.x + offset;
ball_max.y = ball_max.y + offset;
len = this.lineTriggers.length;
_local3 = 0;
while (_local3 < len) {
_local1 = this.lineTriggers[_local3];
if (Obstacles.checkBoundingBox(ball_min, ball_max, _local1.min, _local1.max)) {
_local2 = this.checkLineTrigger(oldBall, newBall, _local1);
if (_local2 != null) {
this[_local2.event](_local2);
}
}
_local3++;
}
len = this.circleTriggers.length;
_local3 = 0;
while (_local3 < len) {
_local1 = this.circleTriggers[_local3];
if (Obstacles.checkBoundingBox(ball_min, ball_max, _local1.min, _local1.max)) {
_local2 = this.checkCircleTrigger(oldBall, newBall, _local1);
if (_local2 != null) {
this[_local2.event](_local2);
}
}
_local3++;
}
};
ClassEvents.prototype.clearTriggers = function () {
this.lineTriggers = [];
this.circleTriggers = [];
};
ClassEvents.prototype.springBlocker = function (triggerObj) {
if (!Pinball.pinball_mc[triggerObj.mc]._visible) {
Obstacles.addLine(new Point(347, 737), new Point(325, 758), 0, null, -1);
Pinball.playSound("gate");
Pinball.pinball_mc[triggerObj.mc]._visible = true;
_level0.keydown.gotoAndStop("idle");
}
};
ClassEvents.prototype.startBlocker = function () {
if (Pinball.pinball_mc.blocker_2._visible) {
Obstacles.clearLine(Pinball.pinball_mc.blocker_2.id);
Pinball.pinball_mc.blocker_2._visible = false;
Obstacles.addLine(new Point(260.5, 30.9), new Point(238.2, 63.7), 0, null, 0);
Obstacles.addLine(new Point(246.2, 63.7), new Point(268.5, 30.9), 0, null, 0);
Pinball.pinball_mc.blocker_3._visible = true;
}
};
ClassEvents.prototype.holeTop = function (triggerObj) {
var _local1 = this;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0;
_timeline.Jake.gotoAndPlay("jump");
Pinball.pinball_mc.dragoneyes.gotoAndPlay("hit");
var _local2 = Pinball.pinball_mc[triggerObj.mc];
var x = _local2._x;
var _local3 = _local2._y;
if (_local2._currentframe == 1) {
_local2.gotoAndPlay("in");
}
if (Math.floor(Math.random() * 2) < 1) {
destHole = Pinball.pinball_mc.hole3;
if (Pinball.pinball_mc.blocker_4._visible) {
Obstacles.clearLine(Pinball.pinball_mc.blocker_4.id);
Pinball.pinball_mc.blocker_4._visible = false;
}
} else {
destHole = Pinball.pinball_mc.hole4;
if (Pinball.pinball_mc.blocker_5._visible) {
Obstacles.clearLine(Pinball.pinball_mc.blocker_5.id);
Pinball.pinball_mc.blocker_5._visible = false;
}
}
var ball = Pinball.pinball_mc.ball;
ball.x = x;
ball.y = _local3;
ball.velocity.x = 0;
ball.velocity.y = 0;
var ball_mc = ball.mc;
ball_mc._visible = false;
ball_mc.destHole = destHole;
ball_mc.ball = ball;
ball_mc.delay = 15;
ball_mc.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
destHole.gotoAndPlay("out");
ball.x = destHole._x;
ball.y = destHole._y;
ball_mc.delay = 10;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1._visible = true;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0.7;
}
};
}
};
Pinball.addScore(100000);
Pinball.playSound("dragon");
};
ClassEvents.prototype.holeLeft = function () {
var _local1 = this;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0;
var _local2 = Pinball.pinball_mc.hole5;
var x = _local2._x;
var _local3 = _local2._y;
if (_local2._currentframe == 1) {
_local2.gotoAndPlay("in");
}
destHole = Pinball.pinball_mc.hole3;
if (!Pinball.pinball_mc.blocker_4._visible) {
var line = new Line(new Point(47, 531), new Point(14.7, 516.5));
Obstacles.lines[Pinball.pinball_mc.blocker_4.id] = {line:line, force:0, mc:null, bound:1};
Pinball.pinball_mc.blocker_4._visible = true;
}
var ball = Pinball.pinball_mc.ball;
ball.x = x;
ball.y = _local3;
ball.velocity.x = 0;
ball.velocity.y = 0;
var ball_mc = ball.mc;
ball_mc._visible = false;
ball_mc.destHole = destHole;
ball_mc.ball = ball;
ball_mc.delay = 15;
ball_mc.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
destHole.gotoAndPlay("out");
ball.x = destHole._x;
ball.y = destHole._y;
ball_mc.delay = 10;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1._visible = true;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0.7;
}
};
}
};
Pinball.playSound("teleport");
};
ClassEvents.prototype.holeRight = function () {
var _local1 = this;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0;
var _local2 = Pinball.pinball_mc.hole6;
var x = _local2._x;
var _local3 = _local2._y;
if (_local2._currentframe == 1) {
_local2.gotoAndPlay("in");
}
destHole = Pinball.pinball_mc.hole4;
if (!Pinball.pinball_mc.blocker_5._visible) {
var line = new Line(new Point(310.9, 516.4), new Point(278.5, 531));
Obstacles.lines[Pinball.pinball_mc.blocker_5.id] = {line:line, force:0, mc:null, bound:1};
Pinball.pinball_mc.blocker_5._visible = true;
}
var ball = Pinball.pinball_mc.ball;
ball.x = x;
ball.y = _local3;
ball.velocity.x = 0;
ball.velocity.y = 0;
var ball_mc = ball.mc;
ball_mc._visible = false;
ball_mc.destHole = destHole;
ball_mc.ball = ball;
ball_mc.delay = 15;
ball_mc.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
destHole.gotoAndPlay("out");
ball.x = destHole._x;
ball.y = destHole._y;
ball_mc.delay = 10;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1._visible = true;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0.7;
}
};
}
};
Pinball.playSound("teleport");
};
ClassEvents.prototype.holeHold = function () {
var _local3 = this;
var building = Pinball.pinball_mc.building;
if (building._currentframe == 1) {
building.gotoAndPlay("hit");
Pinball.gravity.x = 0;
Pinball.gravity.y = 0;
var _local2 = Pinball.pinball_mc.hole2;
var x = (_local2._x - 1);
var y = (_local2._y - 1);
var ball = Pinball.pinball_mc.ball;
ball.x = x;
ball.y = y;
ball.velocity.x = 0;
ball.velocity.y = 0;
var _local1 = ball.mc;
_local1.ball = ball;
_local1.delay = 50;
_local1.building = building;
_local1.bHold = true;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
building.gotoAndPlay("hit");
_local1.bHold = false;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0.7;
ball.velocity.x = 20;
ball.velocity.y = 0;
var _local2 = Math.toRadians(90 + Math.floor(Math.random() * 50));
ball.velocity.rotate(_local2);
Pinball.playSound("fire");
}
Pinball.addScore(200);
};
Pinball.playSound("hold");
}
};
ClassEvents.prototype.leftPillarLight = function () {
var _local2 = this;
var _local1 = Pinball.pinball_mc.light1;
if (_local1._currentframe == 1) {
_local1.gotoAndPlay("hit");
_local1.delay = 300;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
}
};
Pinball.addScore(10000);
Pinball.playSound("lights");
}
};
ClassEvents.prototype.rightPillarLight = function () {
var _local2 = this;
var _local1 = Pinball.pinball_mc.light2;
if (_local1._currentframe == 1) {
_local1.gotoAndPlay("hit");
_local1.delay = 300;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
}
};
Pinball.addScore(10000);
Pinball.playSound("lights");
}
};
ClassEvents.prototype.timerLight0 = function () {
var _local3 = Pinball.pinball_mc;
var light = _local3.timerLight0;
if (light._currentframe == 1) {
light.gotoAndPlay("hit");
var bResult = true;
var _local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
if (_local2._currentframe == 1) {
bResult = false;
break;
}
_local1++;
}
if (bResult) {
trace("BONUS");
_local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
_local2.gotoAndPlay("bonusFlash");
_local1++;
}
Pinball.addScore(100000);
} else {
light.delay = 400;
light.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
}
};
}
Pinball.addScore(5000);
Pinball.playSound("lights");
}
};
ClassEvents.prototype.timerLight1 = function () {
var _local3 = Pinball.pinball_mc;
var light = _local3.timerLight1;
if (light._currentframe == 1) {
light.gotoAndPlay("hit");
var bResult = true;
var _local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
if (_local2._currentframe == 1) {
bResult = false;
break;
}
_local1++;
}
if (bResult) {
trace("BONUS");
_local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
_local2.gotoAndPlay("bonusFlash");
_local1++;
}
Pinball.addScore(100000);
} else {
light.delay = 400;
light.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
}
};
}
Pinball.addScore(5000);
Pinball.playSound("lights");
}
};
ClassEvents.prototype.timerLight2 = function () {
var _local3 = Pinball.pinball_mc;
var light = _local3.timerLight2;
if (light._currentframe == 1) {
light.gotoAndPlay("hit");
var bResult = true;
var _local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
if (_local2._currentframe == 1) {
bResult = false;
break;
}
_local1++;
}
if (bResult) {
trace("BONUS");
_local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
_local2.gotoAndPlay("bonusFlash");
_local1++;
}
Pinball.addScore(100000);
} else {
light.delay = 400;
light.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
}
};
}
Pinball.addScore(5000);
Pinball.playSound("lights");
}
};
ClassEvents.prototype.timerLight3 = function () {
var _local3 = Pinball.pinball_mc;
var light = _local3.timerLight3;
if (light._currentframe == 1) {
light.gotoAndPlay("hit");
var bResult = true;
var _local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
if (_local2._currentframe == 1) {
bResult = false;
break;
}
_local1++;
}
if (bResult) {
trace("BONUS");
_local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
_local2.gotoAndPlay("bonusFlash");
_local1++;
}
Pinball.addScore(100000);
} else {
light.delay = 400;
light.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
}
};
}
Pinball.addScore(5000);
Pinball.playSound("lights");
}
};
ClassEvents.prototype.timerLight4 = function () {
var _local3 = Pinball.pinball_mc;
var light = _local3.timerLight4;
if (light._currentframe == 1) {
light.gotoAndPlay("hit");
var bResult = true;
var _local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
if (_local2._currentframe == 1) {
bResult = false;
break;
}
_local1++;
}
if (bResult) {
trace("BONUS");
_local1 = 0;
while (_local1 < 5) {
var _local2 = _local3["timerLight" + _local1];
_local2.gotoAndPlay("bonusFlash");
_local1++;
}
Pinball.addScore(100000);
} else {
light.delay = 400;
light.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
}
};
}
Pinball.addScore(5000);
Pinball.playSound("lights");
}
};
ClassEvents.prototype.light = function (triggerObj) {
var _local2 = this;
var _local3 = Pinball.pinball_mc;
var _local1 = _local3[triggerObj.mc];
if (_local1._currentframe == 1) {
_local1.gotoAndPlay("hit");
_local1.delay = 120;
trace("hit");
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
}
};
Pinball.addScore(triggerObj.score);
Pinball.playSound("lights");
}
};
ClassEvents.prototype.lightswitch = function (triggerObj) {
var _local2 = this;
var _local3 = triggerObj;
var pinball_mc = Pinball.pinball_mc;
var light = pinball_mc[_local3.mc];
var _local1 = pinball_mc[_local3.switchmc];
_local1.light = light;
if (_local1._currentframe == 1) {
_local1.gotoAndPlay("hit");
light.gotoAndPlay("hit");
_local1.delay = 200;
trace("lightswitch!!");
var lineID = 0;
var dir = 0;
if (pinball_mc.leftSwitch1._currentframe != 1) {
if (pinball_mc.leftSwitch2._currentframe != 1) {
if (pinball_mc.leftSwitch3._currentframe != 1) {
pinball_mc.blocker_4._visible = true;
lineID = Obstacles.addLine(new Point(55, 898), new Point(31, 884), 0, null, 3);
dir = -1;
trace("line created left" + lineID);
}
}
}
if (pinball_mc.rightSwitch1._currentframe != 1) {
if (pinball_mc.rightSwitch2._currentframe != 1) {
if (pinball_mc.rightSwitch3._currentframe != 1) {
pinball_mc.blocker_5._visible = true;
lineID = Obstacles.addLine(new Point(324, 884), new Point(301, 897), 0, null, 3);
dir = 1;
trace("line created right" + lineID);
}
}
}
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
_local1.gotoAndStop(1);
_local1.light.gotoAndStop(1);
if (lineID != 0) {
trace("clear here " + dir);
Obstacles.clearLine(lineID);
if (dir == 1) {
pinball_mc.blocker_5._visible = false;
}
if (dir == -1) {
pinball_mc.blocker_4._visible = false;
}
}
}
};
Pinball.addScore(_local3.score);
Pinball.playSound("switches");
}
};
ClassEvents.prototype.leftRail = function () {
var _local3 = this;
var _local2 = Pinball.pinball_mc;
var ball = _local2.ball;
if (ball.velocity.y < -15) {
Pinball.gravity.x = 0;
Pinball.gravity.y = 0;
ball.x = 279.3;
ball.y = 196;
ball.velocity.x = 0;
ball.velocity.y = 0;
_local2.rail.gotoAndPlay("clockwise");
var _local1 = ball.mc;
_local1._visible = false;
_local1.ball = ball;
_local1.delay = 50;
Pinball.pinball_mc.OPT_scroll.bScroll = false;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0.7;
Pinball.pinball_mc.OPT_scroll.bScroll = true;
ball.velocity.x = -2;
ball.velocity.y = 3;
_local1._visible = true;
}
Pinball.addScore(300);
};
Pinball.playSound("rail");
_local2.runners.gotoAndPlay("play");
}
};
ClassEvents.prototype.rightRail = function () {
var _local3 = this;
var _local2 = Pinball.pinball_mc;
var ball = _local2.ball;
if (ball.velocity.y < -18) {
Pinball.gravity.x = 0;
Pinball.gravity.y = 0;
ball.x = 88.5;
ball.y = 196;
ball.velocity.x = 0;
ball.velocity.y = 0;
_local2.rail.gotoAndPlay("anticlockwise");
var _local1 = ball.mc;
_local1._visible = false;
_local1.ball = ball;
_local1.delay = 50;
Pinball.pinball_mc.OPT_scroll.bScroll = false;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.delay--;
if (_local1.delay < 1) {
delete _local1.onEnterFrame;
Pinball.gravity.x = 0;
Pinball.gravity.y = 0.7;
Pinball.pinball_mc.OPT_scroll.bScroll = true;
ball.velocity.x = 1;
ball.velocity.y = 3;
_local1._visible = true;
}
Pinball.addScore(300);
};
Pinball.playSound("rail");
_local2.runners.gotoAndPlay("play");
}
};
_global.Events = new ClassEvents();
Symbol 251 MovieClip Frame 6
trace("**INIT**");
stop();
Symbol 251 MovieClip Frame 7
trace("**SCORE**");
var i = 1;
while (i < 9) {
this["s" + i] = _level0.score[i - 1];
i++;
}
stop();
Symbol 251 MovieClip Frame 10
stop();
Pinball.init(pinball_mc);
Pinball.start();
trace("start");
fader.gotoAndPlay(2);
Symbol 273 MovieClip Frame 1
stop();
Symbol 277 MovieClip Frame 1
s1 = (s2 = (s3 = (s4 = (s5 = (s6 = (s7 = (s8 = 0)))))));
Symbol 285 Button
on (release) {
_level0.bPaused = true;
_level0.game_mc.table_mc.popUp_mc.gotoAndStop("help");
}
Symbol 287 Button
on (release) {
_level0.bPaused = true;
_level0.game_mc.table_mc.popUp_mc.gotoAndStop("confirm");
}
Symbol 291 MovieClip Frame 56
play();
Symbol 291 MovieClip Frame 90
rnd = Math.ceil(Math.random() * 500);
i = 0;
this.onEnterFrame = function () {
i++;
if (i > rnd) {
delete this.onEnterFrame;
this.gotoAndPlay(56);
}
};
stop();
Symbol 301 MovieClip Frame 1
stop();
Symbol 301 MovieClip Frame 30
stop();
Symbol 305 MovieClip Frame 1
stop();
Symbol 305 MovieClip Frame 2
stop();
Symbol 305 MovieClip Frame 40
stop();
Symbol 306 MovieClip Frame 1
stop();
Symbol 306 MovieClip Frame 40
stop();
Symbol 319 MovieClip Frame 1
animation = false;
stop();
Symbol 319 MovieClip Frame 12
l_paddle.gotoAndStop(2);
Symbol 319 MovieClip Frame 41
l_paddle.gotoAndPlay(3);
Symbol 319 MovieClip Frame 78
twanger.gotoAndStop(2);
Symbol 319 MovieClip Frame 99
twanger.gotoAndPlay(3);
Symbol 319 MovieClip Frame 145
r_paddle.gotoAndStop(2);
Symbol 319 MovieClip Frame 166
r_paddle.gotoAndPlay(3);
Symbol 319 MovieClip Frame 235
animation = true;
startoffgame();
stop();
Symbol 321 MovieClip Frame 23
gotoAndPlay (1);
Symbol 321 MovieClip Frame 24
stop();
Symbol 363 MovieClip Frame 159
gotoAndPlay (1);
Symbol 363 MovieClip Frame 209
gotoAndPlay (1);
Symbol 363 MovieClip Frame 280
stop();
Symbol 382 Button
on (release) {
gotoAndPlay ("ready");
}