Frame 1
showInstructions = function () {
game.paused = true;
shower._visible = true;
results.but.enabled = false;
instBut._visible = false;
};
hideInstructions = function () {
game.paused = false;
shower._visible = false;
results.but.enabled = true;
instBut._visible = true;
};
clearIntervals = function () {
i = 0;
while (i < 3000) {
clearInterval(i);
i++;
}
};
myFadeColor = new Color(this);
myFadeTransform = new Object();
fade = function (destination) {
locked = true;
Mouse.show();
clearIntervals();
clearPopups();
gameActive = false;
fader.focuser = null;
fader.destination = destination;
competedMessage._visible = false;
fader.gotoAndPlay(2);
};
Frame 2
loadedItems = Math.round((getBytesLoaded() / getBytesTotal()) * 100);
loader_mc.bar._xscale = loadedItems;
ifFrameLoaded (47) {
level = 1;
score = 0;
gotoAndStop ("pre");
}
Frame 3
gotoAndPlay (2);
Frame 4
best = 0;
_global.gfx = fx;
if (getUri == undefined) {
getUri = "/tasks/api?method=get&field=data1&week=6";
getUri = "test.txt";
}
if (setUri == undefined) {
setUri = "/tasks/api?method=set&week=6";
}
var hasPlayedForBucks = false;
var gameState = new LoadVars();
gameState.onLoad = function (success) {
if (!success) {
trace("HO");
hasPlayedForBucks = false;
trace(hasPlayedForBucks);
fade("title");
} else {
trace("HEY");
var _local1;
for (prop in gameState) {
if (typeof(gameState[prop]) != "function") {
trace(prop.toString());
_local1 = Number(prop.toString());
}
}
hasPlayedForBucks = _local1 > 0;
trace(hasPlayedForBucks);
fade("title");
}
};
gameState.sendAndLoad(getUri, gameState, "POST");
Frame 9
level = 0;
lives = 3;
time = 0;
myTime = 0;
invincible = false;
testing = false;
gfx.idle.enter();
testBut._visible = testing;
testBut2._visible = testing;
Frame 19
practicer._visible = mode == 1;
Frame 27
level = 1;
clearIntervals();
clearAllIntervals();
Frame 28
trace("level: " + level);
trace("lives: " + lives);
trace("time: " + time);
trace("mode: " + mode);
if (level == 1) {
gfx.music.enter();
gfx.stairs.start();
}
practicer._visible = mode == 1;
stop();
Frame 34
practicer._visible = mode == 1;
Frame 40
practicer._visible = mode == 1;
gfx.sillyString.goalVolume = 0;
gfx.music.exit();
gotoAndPlay ("preGame");
Frame 47
practicer._visible = mode == 1;
time = time * 10;
time = int(time);
time = Math.round(time);
time = time + 0.5;
time = int(time);
time = Math.round(time);
time = time * 0.1;
myTime = myTime + time;
gfx.idle.enter();
trace("winner: " + winner);
trace("level: " + level);
if (winner and (level == 0)) {
score = Math.max(0, 3000 - int(time * 10));
trace("shooting you to preGame");
gotoAndPlay ("preGame");
} else if ((!winner) and (lives > 1)) {
gotoAndStop ("lives");
} else {
trace("your score for the first round was " + score);
roundScore = Math.max(0, 3000 - int(time * 10));
score = score + roundScore;
trace("your score for the second round was " + roundScore);
trace("your total score was " + score);
if (score > best) {
best = score;
}
if (mode == 0) {
totalScore = 50;
if (winner) {
totalScore = totalScore + 50;
}
if (winner and (lives >= 2)) {
totalScore = totalScore + 50;
}
if ((myTime < 150) and winner) {
totalScore = totalScore + 50;
}
if (!winner) {
myTime = 1000;
}
schruteBucks = "Sb $" + totalScore;
strSetUri = (((setUri + "&data1=") + totalScore) + "&data2=") + myTime;
trace("sending: " + strSetUri);
gameState.onLoad = function (success) {
trace("sent score to " + strSetUri);
};
gameState.sendAndLoad(strSetUri, gameState, "POST");
}
level = 0;
lives = 3;
}
Symbol 10 MovieClip Frame 1
changeColor = function (percent) {
};
changeColor(0);
stop();
Symbol 10 MovieClip Frame 2
changeColor(20);
gfx.whoosh.start();
play();
Symbol 10 MovieClip Frame 3
changeColor(40);
_root.sounds.fade.start();
Symbol 10 MovieClip Frame 4
changeColor(60);
Symbol 10 MovieClip Frame 5
changeColor(80);
Symbol 10 MovieClip Frame 6
changeColor(100);
_parent.gotoAndStop(destination);
gfx.sillyString.goalVolume = 0;
Symbol 10 MovieClip Frame 7
changeColor(90);
gfx.sillyString.goalVolume = 0;
Symbol 10 MovieClip Frame 8
changeColor(80);
Symbol 10 MovieClip Frame 9
changeColor(70);
Symbol 10 MovieClip Frame 10
changeColor(60);
Symbol 10 MovieClip Frame 11
changeColor(50);
Symbol 10 MovieClip Frame 12
changeColor(40);
Symbol 10 MovieClip Frame 13
changeColor(30);
Symbol 10 MovieClip Frame 14
changeColor(20);
Symbol 10 MovieClip Frame 15
changeColor(10);
Symbol 10 MovieClip Frame 16
changeColor(0);
Symbol 15 MovieClip Frame 1
start = function () {
gotoAndStop("step" + step);
step++;
if (step >= steps) {
step = 0;
}
};
step = 0;
steps = 3;
stop();
Symbol 18 MovieClip Frame 1
enter = function () {
s.setVolume(0);
s.stop();
playing = true;
_parent.idle.exit();
gotoAndPlay ("enter");
};
turnOn = function () {
gotoAndPlay ("on");
};
exit = function () {
playing = false;
gotoAndPlay ("exit");
};
onEnterFrame = function () {
if (s.getVolume() > maxVolume) {
s.setVolume(maxVolume);
}
};
s = new Sound(this);
stop();
playing = false;
Symbol 18 MovieClip Frame 2
playing = true;
Symbol 18 MovieClip Frame 3
if (s.getVolume() < 20) {
s.setVolume(20);
}
Symbol 18 MovieClip Frame 4
if (s.getVolume() < 40) {
s.setVolume(40);
}
Symbol 18 MovieClip Frame 5
if (s.getVolume() < 60) {
s.setVolume(60);
}
Symbol 18 MovieClip Frame 6
if (s.getVolume() < 80) {
s.setVolume(80);
}
Symbol 18 MovieClip Frame 7
if (s.getVolume() < 100) {
s.setVolume(100);
}
Symbol 18 MovieClip Frame 8
stop();
Symbol 18 MovieClip Frame 9
playing = false;
stop();
Symbol 18 MovieClip Frame 16
trace("beginning idle exit");
play();
Symbol 18 MovieClip Frame 17
if (s.getVolume() > 80) {
s.setVolume(80);
}
trace("fading out");
Symbol 18 MovieClip Frame 18
if (s.getVolume() > 60) {
s.setVolume(60);
}
Symbol 18 MovieClip Frame 19
if (s.getVolume() > 40) {
s.setVolume(40);
}
Symbol 18 MovieClip Frame 20
if (s.getVolume() > 20) {
s.setVolume(20);
}
Symbol 18 MovieClip Frame 21
if (s.getVolume() > 0) {
s.setVolume(0);
}
Symbol 18 MovieClip Frame 22
trace("finishing idle exit");
stop();
Symbol 22 MovieClip Frame 1
start = function () {
gotoAndStop("step" + step);
step++;
if (step >= steps) {
step = 0;
}
};
step = 0;
steps = 3;
stop();
Symbol 26 MovieClip Frame 1
start = function (vol) {
s.setVolume(vol);
gotoAndStop("step" + step);
step++;
if (step >= steps) {
step = 0;
}
};
s = new Sound(this);
s.setVolume(50);
step = 0;
steps = 5;
stop();
Symbol 26 MovieClip Frame 13
stop();
Symbol 26 MovieClip Frame 23
stop();
Symbol 26 MovieClip Frame 34
stop();
Symbol 26 MovieClip Frame 42
stop();
Symbol 26 MovieClip Frame 52
stop();
Symbol 28 MovieClip Frame 1
start = function () {
if (_currentframe == 1) {
gotoAndPlay (2);
}
};
stop();
Symbol 28 MovieClip Frame 2
play();
Symbol 30 MovieClip Frame 1
start = function () {
if (_currentframe == 1) {
gotoAndPlay (2);
}
};
stop();
Symbol 30 MovieClip Frame 2
play();
Symbol 32 MovieClip Frame 1
enter = function () {
s.setVolume(0);
s.stop();
playing = true;
gotoAndPlay ("enter");
};
turnOn = function () {
gotoAndPlay ("on");
};
exit = function () {
playing = false;
gotoAndPlay ("exit");
};
onEnterFrame = function () {
if (s.getVolume() > maxVolume) {
s.setVolume(maxVolume);
}
};
s = new Sound(this);
stop();
playing = false;
Symbol 32 MovieClip Frame 2
playing = true;
Symbol 32 MovieClip Frame 3
if (s.getVolume() < 40) {
s.setVolume(40);
}
Symbol 32 MovieClip Frame 4
if (s.getVolume() < 80) {
s.setVolume(80);
}
Symbol 32 MovieClip Frame 5
if (s.getVolume() < 100) {
s.setVolume(100);
}
Symbol 32 MovieClip Frame 6
stop();
Symbol 32 MovieClip Frame 7
playing = false;
stop();
Symbol 32 MovieClip Frame 16
trace("beginning idle exit");
play();
Symbol 32 MovieClip Frame 17
if (s.getVolume() > 80) {
s.setVolume(80);
}
trace("fading out");
Symbol 32 MovieClip Frame 18
if (s.getVolume() > 60) {
s.setVolume(60);
}
Symbol 32 MovieClip Frame 19
if (s.getVolume() > 40) {
s.setVolume(40);
}
Symbol 32 MovieClip Frame 20
if (s.getVolume() > 20) {
s.setVolume(20);
}
Symbol 32 MovieClip Frame 21
if (s.getVolume() > 0) {
s.setVolume(0);
}
Symbol 32 MovieClip Frame 22
trace("finishing idle exit");
stop();
Symbol 36 MovieClip Frame 1
start = function (vol) {
gotoAndStop("step" + step);
step++;
if (step >= steps) {
step = 0;
}
};
step = random(3);
steps = 3;
stop();
Symbol 36 MovieClip Frame 13
stop();
Symbol 36 MovieClip Frame 23
stop();
Symbol 36 MovieClip Frame 34
stop();
Symbol 40 MovieClip Frame 1
start = function (vol) {
gotoAndStop("step" + step);
step++;
if (step >= steps) {
step = 0;
}
};
step = random(3);
steps = 3;
stop();
Symbol 40 MovieClip Frame 13
stop();
Symbol 40 MovieClip Frame 23
stop();
Symbol 40 MovieClip Frame 34
stop();
Symbol 44 MovieClip Frame 1
start = function (vol) {
gotoAndStop("step" + step);
step++;
if (step >= steps) {
step = 0;
}
};
step = random(3);
steps = 3;
stop();
Symbol 44 MovieClip Frame 12
stop();
Symbol 44 MovieClip Frame 23
stop();
Symbol 44 MovieClip Frame 34
stop();
Symbol 50 MovieClip Frame 1
start = function (which) {
gotoAndStop("step" + which);
};
stop();
Symbol 50 MovieClip Frame 13
stop();
Symbol 50 MovieClip Frame 23
stop();
Symbol 50 MovieClip Frame 34
stop();
Symbol 50 MovieClip Frame 45
stop();
Symbol 50 MovieClip Frame 56
stop();
Symbol 52 MovieClip Frame 1
start = function () {
if (_currentframe == 1) {
gotoAndPlay (2);
}
};
stop();
Symbol 52 MovieClip Frame 2
play();
Symbol 55 MovieClip Frame 1
start = function () {
if (_currentframe == 1) {
gotoAndPlay (2);
}
};
stop();
Symbol 55 MovieClip Frame 3
play();
Symbol 55 MovieClip Frame 15
play();
Symbol 57 MovieClip Frame 1
enter = function () {
s.setVolume(0);
s.stop();
playing = true;
_parent.music.exit();
gotoAndPlay ("enter");
};
turnOn = function () {
gotoAndPlay ("on");
};
exit = function () {
playing = false;
gotoAndPlay ("exit");
};
onEnterFrame = function () {
if (s.getVolume() > maxVolume) {
s.setVolume(maxVolume);
}
};
s = new Sound(this);
stop();
playing = false;
Symbol 57 MovieClip Frame 2
playing = true;
Symbol 57 MovieClip Frame 3
if (s.getVolume() < 20) {
s.setVolume(20);
}
Symbol 57 MovieClip Frame 4
if (s.getVolume() < 40) {
s.setVolume(40);
}
Symbol 57 MovieClip Frame 5
if (s.getVolume() < 60) {
s.setVolume(60);
}
Symbol 57 MovieClip Frame 6
if (s.getVolume() < 80) {
s.setVolume(80);
}
Symbol 57 MovieClip Frame 7
if (s.getVolume() < 100) {
s.setVolume(100);
}
Symbol 57 MovieClip Frame 8
stop();
Symbol 57 MovieClip Frame 9
playing = false;
stop();
Symbol 57 MovieClip Frame 16
trace("beginning idle exit");
play();
Symbol 57 MovieClip Frame 17
if (s.getVolume() > 80) {
s.setVolume(80);
}
trace("fading out");
Symbol 57 MovieClip Frame 18
if (s.getVolume() > 60) {
s.setVolume(60);
}
Symbol 57 MovieClip Frame 19
if (s.getVolume() > 40) {
s.setVolume(40);
}
Symbol 57 MovieClip Frame 20
if (s.getVolume() > 20) {
s.setVolume(20);
}
Symbol 57 MovieClip Frame 21
if (s.getVolume() > 0) {
s.setVolume(0);
}
Symbol 57 MovieClip Frame 22
trace("finishing idle exit");
stop();
Symbol 61 MovieClip Frame 1
stop();
Symbol 63 Button
on (release) {
if (goals[0] == 100) {
goals[0] = 0;
} else {
goals[0] = 100;
}
}
Symbol 64 MovieClip Frame 1
instance = new Array();
names = ["this", "collide", "music", "buzzer"];
goals = [100, 100, 100, 100, 100, 0];
volumes = [100, 100, 100, 100, 100, 0];
adjustments = [5, 5, 4, 5, 10, 10];
i = 0;
while (i < names.length) {
instance[i] = new Sound(eval (names[i]));
instance[i].setVolume(volumes[i]);
i++;
}
onEnterFrame = function () {
i = 0;
while (i < names.length) {
if (goals[i] < volumes[i]) {
volumes[i] = volumes[i] - adjustments[i];
} else if (goals[i] > volumes[i]) {
volumes[i] = volumes[i] + adjustments[i];
}
if (Math.abs(goals[i] - volumes[i]) < adjustments[i]) {
volumes[i] - goals[i];
}
instance[i].setVolume(volumes[i]);
i++;
}
frame = int(volumes[0] / 10) + 1;
speaker.gotoAndStop(frame);
};
Symbol 72 Button
on (press) {
_parent.mode = 0;
_parent.fade("confirm");
}
Symbol 75 Button
on (press) {
_parent.mode = 1;
_parent.fade("help");
}
Symbol 76 MovieClip Frame 1
btnBucks.enabled = _parent.hasPlayedForBucks == false;
btnBucks._alpha = ((_parent.hasPlayedForBucks == false) ? 100 : 50);
trace("_parent.hasPlayedForBucks" + _parent.hasPlayedForBucks);
Symbol 78 Button
on (press) {
winner = true;
mode = 0;
myTime = 115.5;
time = 0;
lives = 2;
level = 1;
fade("results");
}
Symbol 79 Button
on (press) {
winner = false;
mode = 0;
myTime = 115.5;
time = 0;
lives = 0;
level = 1;
fade("results");
}
Symbol 88 Button
on (press) {
_parent.fade("title");
}
Symbol 91 Button
on (press) {
_parent.fade("help");
}
Symbol 95 MovieClip Frame 1
score = int(_parent._parent.time * 100);
if (_parent._parent.level == 0) {
_parent._parent.roundOneScore = score;
} else {
_parent._parent.roundTwoScore = score;
}
Symbol 98 Button
on (press) {
_parent.fade("game");
}
Symbol 111 MovieClip Frame 1
_visible = false;
Symbol 117 MovieClip Frame 1
_visible = false;
Symbol 119 MovieClip Frame 1
_visible = false;
Symbol 121 MovieClip Frame 1
left = _x - (_width / 2);
right = _x + (_width / 2);
top = _y - (_height / 2);
bottom = _y + (_height / 2);
center = new Array();
center[0] = new Object();
center[0].y = _y;
center[0].x = _x - 10000;
center[1] = new Object();
center[1].y = _y + 10000;
center[1].x = _x;
center[2] = new Object();
center[2].y = _y;
center[2].x = _x + 10000;
center[3] = new Object();
center[3].y = _y - 10000;
center[3].x = _x;
_parent.boxList.push(this);
_visible = false;
Symbol 123 MovieClip Frame 1
_visible = false;
active = true;
_parent.bumperList.push(this);
fixed = true;
span = this._width / 2;
Symbol 127 MovieClip Frame 1
_visible = false;
Symbol 135 MovieClip Frame 1
r = random(3) + 1;
gotoAndStop(r);
Symbol 142 MovieClip Frame 1
r = random(3) + 1;
gotoAndStop(r);
Symbol 165 MovieClip Frame 1
function wallTest(which) {
clip = _parent.wallList[which];
if (hitter.hitTest(clip)) {
startNormal = new Object();
startNormal.x = (_x + clip.point2.y) - clip.point1.y;
startNormal.y = (_y + clip.point1.x) - clip.point2.x;
crossPoint = new Object();
crossPoint = getIntersection(clip.point1.x, clip.point1.y, clip.point2.x, clip.point2.y, startNormal.x, startNormal.y, _x, _y);
myDiff = distance(_x, _y, crossPoint.x, crossPoint.y) - span;
if (myDiff <= 0) {
collisionInfo = new Object();
collisionInfo.perpVector = new Object();
collisionInfo.perpVector.x = 0;
collisionInfo.perpVector.y = 0;
collisionInfo.heft = heft * 1000;
collisionInfo.normal = new Object();
collisionInfo.normal.x = _x - crossPoint.x;
collisionInfo.normal.y = _y - crossPoint.y;
collisionInfo.speed = new Object();
collisionInfo.speed.x = 0;
collisionInfo.speed.y = 0;
collisionInfo.mass = 1000000 /* 0x0F4240 */;
collisionInfo.body = clip;
myCollisions.push(collisionInfo);
}
}
}
distance = function (x1, y1, x2, y2) {
distx = x1 - x2;
disty = y1 - y2;
return(Math.sqrt((distx * distx) + (disty * disty)));
};
magnitude = function (v1) {
return(distance(0, 0, v1.x, v1.y));
};
dot = function (v1, v2) {
return((v1.x * v2.x) + (v1.y * v2.y));
};
adds = function (v1, v2) {
tempVector = new Object();
tempVector.x = v1.x + v2.x;
tempVector.y = v1.y + v2.y;
return(tempVector);
};
subtract = function (v1, v2) {
tempVector = new Object();
tempVector.x = v1.x - v2.x;
tempVector.y = v1.y - v2.y;
return(tempVector);
};
multiply = function (s, v) {
tempVector = new Object();
tempVector.x = v.x * s;
tempVector.y = v.y * s;
return(tempVector);
};
resetCollisions = function () {
myCollisions = new Array();
};
findAngle = function (xdist, ydist) {
a = Math.atan(ydist / xdist) * rad;
if ((xdist > 0) and (ydist < 0)) {
a = -a;
}
if (xdist < 0) {
a = 180 - a;
}
if ((xdist > 0) and (ydist > 0)) {
a = 360 - a;
}
return(a);
};
getSlope = function (x1, y1, x2, y2) {
return((y1 - y2) / (x1 - x2));
};
getIntercept = function (x1, y1, slope) {
return(y1 - (x1 * slope));
};
getIntersection = function (x1, y1, x2, y2, x3, y3, x4, y4) {
m1 = getSlope(x1, y1, x2, y2);
m2 = getSlope(x3, y3, x4, y4);
b1 = getIntercept(x1, y1, m1);
b2 = getIntercept(x3, y3, m2);
tempPoint = new Object();
tempPoint.x = (b2 - b1) / (m1 - m2);
tempPoint.y = (m1 * tempPoint.x) + b1;
return(tempPoint);
};
findWhichWall = function (c, x1, y1) {
retVec = new Object();
retVec.x = 0;
retVec.y = 0;
wallDist = new Array();
myVel = distance(0, 0, speed.x, speed.y);
wallDist[0] = (Math.abs(c.right - (x1 - span)) < myVel) and (oldPos.x > _x);
wallDist[1] = (Math.abs(c.top - (y1 + span)) < myVel) and (oldPos.y < _y);
wallDist[2] = (Math.abs(c.left - (x1 + span)) < myVel) and (oldPos.x < _x);
wallDist[3] = (Math.abs(c.bottom - (y1 - span)) < myVel) and (oldPos.y > _y);
if (wallDist[0]) {
retVec.x = retVec.x + 1;
}
if (wallDist[1]) {
retVec.y = retVec.y - 1;
}
if (wallDist[2]) {
retVec.x = retVec.x - 1;
}
if (wallDist[3]) {
retVec.y = retVec.y + 1;
}
return(retVec);
};
myHitTest = function (c) {
hitting = true;
if (((((_x + span) < c.left) or ((_x - span) > c.right)) or ((_y + span) < c.top)) or ((_y - span) > c.bottom)) {
hitting = false;
}
return(hitting);
};
boxTest = function (which) {
clip = _parent.boxList[which];
if (myHitTest(clip)) {
myDist = distance(_x, _y, clip._x, clip._y);
currentdistx = distx;
currentdisty = disty;
futureDist = distance(_x + speed.x, _y + speed.y, clip._x, clip._y);
wallVector = new Object();
wallVector = findWhichWall(clip, _x, _y);
if ((wallVector.x != 0) or (wallVector.y != 0)) {
collisionInfo = new Object();
collisionInfo.collider = "wall";
collisionInfo.perpVector = new Object();
collisionInfo.perpVector.x = 0;
collisionInfo.perpVector.y = 0;
collisionInfo.heft = heft * 100000000;
collisionInfo.normal = new Object();
collisionInfo.normal = wallVector;
collisionInfo.speed = new Object();
collisionInfo.speed.x = 0;
collisionInfo.speed.y = 0;
collisionInfo.mass = 1E16;
collisionInfo.body = clip;
myCollisions.push(collisionInfo);
if (stunFrames > stunned) {
stunned = stunFrames;
}
}
}
};
bumperTest = function (which) {
clip = currentBumperList[which];
if (clip.active) {
if (hitter.hitTest(clip)) {
myDist = distance(_x, _y, clip._x, clip._y);
futureDist = distance(_x + speed.x, _y + speed.y, clip._x, clip._y);
myDiff = myDist - (span + (clip._width / 2));
if ((myDiff <= 0) and (myDist > futureDist)) {
if ((this.span > clip.owner.mass) and (!clip.fixed)) {
_parent.beginSuckUp(clip.owner);
this.hitter._xscale = this.hitter._xscale * 1.05;
this.hitter._yscale = this.hitter._yscale * 1.05;
this.span = this.hitter._width / 2;
gfx.crash.start(clip.owner.fx);
} else {
if ((this.span < clip.owner.mass) and (!clip.owner.bumped)) {
clip.owner.bumped = true;
_parent.bumped++;
if (((_parent.bumped >= 2) and (_parent.objectsEaten < 1)) and (!_parent.toldSmallStuff)) {
_parent.toldSmallStuff = true;
_parent.doWordBubble(4);
_parent.smallInterval = setInterval(_parent.hideWordBubble, 3000);
}
if (((_parent.bumped >= 4) and (_parent.objectsEaten < 2)) and (!_parent.toldSmallStuff)) {
_parent.toldSmallStuff = true;
_parent.doWordBubble(4);
_parent.smallInterval = setInterval(_parent.hideWordBubble, 3000);
}
}
collisionInfo = new Object();
collisionInfo.collider = "ball";
collisionInfo.perpVector = new Object();
collisionInfo.perpVector.x = 0;
collisionInfo.perpVector.y = 0;
collisionInfo.heft = heft * 1000;
collisionInfo.normal = new Object();
collisionInfo.normal = findNormal(this, clip);
collisionInfo.speed = new Object();
collisionInfo.speed.x = 0;
collisionInfo.speed.y = 0;
collisionInfo.mass = 10000000000000;
myCollisions.push(collisionInfo);
if (stunFrames > stunned) {
stunned = stunFrames;
}
}
}
}
}
};
cornerTest = function (which) {
clip = _parent.cornerList[which];
if (hitTest(clip)) {
myDist = distance(_x, _y, clip._x, clip._y);
futureDist = distance(_x + speed.x, _y + speed.y, clip._x, clip._y);
myDiff = myDist - (clip._width - span);
if ((myDiff >= 0) and (myDist < futureDist)) {
collisionInfo = new Object();
collisionInfo.perpVector = new Object();
collisionInfo.perpVector.x = 0;
collisionInfo.perpVector.y = 0;
collisionInfo.heft = heft * 1000;
collisionInfo.normal = new Object();
collisionInfo.normal = findNormal(this, clip);
collisionInfo.normal.x = collisionInfo.normal.x * -1;
collisionInfo.normal.y = collisionInfo.normal.y * -1;
collisionInfo.speed = new Object();
collisionInfo.speed.x = 0;
collisionInfo.speed.y = 0;
collisionInfo.rot = 0;
collisionInfo.mass = 100000000 /* 0x5F5E100 */;
collisionInfo.body = clip;
myCollisions.push(collisionInfo);
}
}
};
unDaze = function () {
clearInterval(dazeInterval);
dazed = false;
};
daze = function () {
clearInterval(dazeInterval);
dazeInterval = setInterval(unDaze, 75);
dazed = true;
};
findNormal = function (me, him) {
tempVector = new Object();
tempVector.x = him._x - me._x;
tempVector.y = him._y - me._y;
return(tempVector);
};
findBoxNormal = function (me, him, wall) {
tempVector = new Object();
if (wall == 0) {
tempVector.x = 10;
tempVector.y = 0;
}
if (wall == 1) {
tempVector.x = 0;
tempVector.y = -10;
}
if (wall == 2) {
tempVector.x = -10;
tempVector.y = 0;
}
if (wall == 3) {
tempVector.x = 0;
tempVector.y = 10;
}
return(tempVector);
};
getJ = function (mine, his, normal, hismass, hisHeft, hisPerp) {
myr = (temp = new Object());
diff = new Object();
diff = subtract(mine, his);
if (dazed) {
} else {
myNum = Math.max(1.1, myNum);
}
temp = multiply(-(1.1 + elastic), diff);
top = dot(temp, normal);
massnum = (1 / mass) + (1 / hismass);
temp = multiply(massnum, normal);
firstAdd = dot(perpVector, normal);
firstAdd = firstAdd * firstAdd;
firstAdd = firstAdd / heft;
secondAdd = dot(hisPerp, normal);
secondAdd = secondAdd * secondAdd;
secondAdd = secondAdd / hisHeft;
bottom = dot(normal, temp);
bottom = bottom + (firstAdd + secondAdd);
j = top / bottom;
return(j);
};
getCollisions = function () {
var _local3 = 0;
while (_local3 < currentBallList.length) {
clip = currentBallList[_local3];
if (clip.id > id) {
if (hitter.hitTest(clip.hitter)) {
myDist = distance(_x, _y, clip._x, clip._y);
futureDist = distance(_x + speed.x, _y + speed.y, clip._x + clip.speed.x, clip._y + clip.speed.y);
myDiff = (span + clip.span) - myDist;
if ((myDiff > 0) and (myDist > futureDist)) {
collisionInfo = new Object();
collisionInfo.perpVector = new Object();
collisionInfo.perpVector = clip.perpVector;
collisionInfo.normal = new Object();
collisionInfo.normal = findNormal(this, clip);
collisionInfo.speed = new Object();
collisionInfo.speed = clip.speed;
collisionInfo.rot = clip.rot;
collisionInfo.mass = clip.mass;
collisionInfo.heft = clip.heft;
myCollisions.push(collisionInfo);
collisionInfo = new Object();
collisionInfo.perpVector = new Object();
collisionInfo.perpVector = perpVector;
collisionInfo.normal = new Object();
collisionInfo.normal = findNormal(clip, this);
collisionInfo.speed = new Object();
collisionInfo.speed = speed;
collisionInfo.rot = rot;
collisionInfo.mass = mass;
collisionInfo.heft = heft;
clip.myCollisions.push(collisionInfo);
}
}
}
_local3++;
}
_local3 = 0;
while (_local3 < _parent.cornerList.length) {
cornerTest(_local3);
_local3++;
}
_local3 = 0;
while (_local3 < _parent.boxList.length) {
boxTest(_local3);
_local3++;
}
_local3 = 0;
while (_local3 < currentBumperList.length) {
bumperTest(_local3);
_local3++;
}
_local3 = 0;
while (_local3 < _parent.wallList.length) {
wallTest(_local3);
_local3++;
}
if (this.hitter.hitTest(_parent.stairs)) {
speed.x = speed.x + 0.3;
}
return(myCollisions);
};
translate = function () {
oldPos = new Object();
oldPos.x = _x;
oldPos.y = _y;
preVelocity = distance(0, 0, speed.x, speed.y);
spin = spin + preVelocity;
frame = (int(spin * 0.1) % 35) + 1;
_parent.display.hider.gotoAndStop(frame);
if (maxVelocity > maxVelocity) {
finalVel = finalVel * 0.8;
} else {
finalVel = maxVelocity;
}
finalVel = Math.max(finalVel, maxVelocity);
if (preVelocity > finalVel) {
ratio = finalVel / preVelocity;
speed.x = speed.x * ratio;
speed.y = speed.y * ratio;
}
_x = (_x + (speed.x / _parent.iterations));
_y = (_y + (speed.y / _parent.iterations));
_rotation = (_rotation + (rot * rad));
rot = rot * 0.85;
perpVector.x = (-Math.sin(_rotation / rad)) * span;
perpVector.y = Math.cos(_rotation / rad) * span;
preVelocity = distance(0, 0, speed.x, speed.y);
if (preVelocity > 0) {
velocity = preVelocity - friction;
velocity = Math.max(0, velocity);
ratio = velocity / preVelocity;
speed.x = speed.x * ratio;
speed.y = speed.y * ratio;
}
};
collisionDetection = function () {
collisionList = new Array();
collisionList = getCollisions();
};
determineSound = function (who) {
if (((who._name == "bumper0") or (who._name == "bumper1")) or (who._name == "box2")) {
return(2);
}
if (who._name == "box1") {
return(4);
}
return(1);
};
collisionResponse = function () {
if (collisionList.length > 0) {
speedTotal = new Object();
speedTotal.x = 0;
speedTotal.y = 0;
rotTotal = 0;
if (collisionList.length > 1) {
trace("---------------------------------");
}
i = 0;
while (i < collisionList.length) {
j = getJ(speed, collisionList[i].speed, collisionList[i].normal, collisionList[i].mass, collisionList[i].heft, collisionList[i].perpVector);
temp = new Object();
temp = multiply(j / mass, collisionList[i].normal);
speedTotal = adds(speedTotal, temp);
if (collisionList.length > 1) {
trace((((collisionList[i].collider + ": ") + temp.x) + ", ") + temp.y);
trace((("Vector: " + collisionList[i].normal.x) + ", ") + collisionList[i].normal.y);
trace((("Speed Total: " + temp.x) + ", ") + temp.y);
}
jNormal = new Object();
jNormal = multiply(j, collisionList[i].normal);
value = dot(jNormal, perpVector);
rotTotal = rotTotal + (value / heft);
var _local3 = collisionList[i].body;
i++;
}
_parent.determineSpecs(_local3._name);
if ((magnitude(speedTotal) > 10) and ((!_parent.time) > 10)) {
_parent.doWally("hit");
}
vol = int(magnitude(speedTotal) * 2);
if (vol > 0) {
daze();
}
if ((vol > 4) and (this == _parent.ball)) {
gfx.crash.start(vol * 5);
}
speedTotal.x = speedTotal.x * collisionList.length;
speedTotal.y = speedTotal.y * collisionList.length;
rotTotal = rotTotal / collisionList.length;
rot = rot - rotTotal;
speed = adds(speed, speedTotal);
var _local5 = distance(0, 0, speed.x, speed.y);
if (_local5 > 8) {
var _local4 = 8 / _local5;
speed.x = speed.x * _local4;
speed.y = speed.y * _local4;
}
if (collisionList.length > 1) {
trace("---------------------------------");
}
}
};
myNum = 1.1;
Symbol 166 MovieClip Frame 1
function wallTest(which) {
clip = _parent.wallList[which];
if (hitter.hitTest(clip)) {
startNormal = new Object();
startNormal.x = (_x + clip.point2.y) - clip.point1.y;
startNormal.y = (_y + clip.point1.x) - clip.point2.x;
crossPoint = new Object();
crossPoint = getIntersection(clip.point1.x, clip.point1.y, clip.point2.x, clip.point2.y, startNormal.x, startNormal.y, _x, _y);
myDiff = distance(_x, _y, crossPoint.x, crossPoint.y) - span;
if (myDiff <= 0) {
collisionInfo = new Object();
collisionInfo.perpVector = new Object();
collisionInfo.perpVector.x = 0;
collisionInfo.perpVector.y = 0;
collisionInfo.heft = heft * 1000;
collisionInfo.normal = new Object();
collisionInfo.normal.x = _x - crossPoint.x;
collisionInfo.normal.y = _y - crossPoint.y;
collisionInfo.speed = new Object();
collisionInfo.speed.x = 0;
collisionInfo.speed.y = 0;
collisionInfo.mass = 1E15;
collisionInfo.body = clip;
myCollisions.push(collisionInfo);
}
}
}
distance = function (x1, y1, x2, y2) {
distx = x1 - x2;
disty = y1 - y2;
return(Math.sqrt((distx * distx) + (disty * disty)));
};
magnitude = function (v1) {
return(distance(0, 0, v1.x, v1.y));
};
dot = function (v1, v2) {
return((v1.x * v2.x) + (v1.y * v2.y));
};
adds = function (v1, v2) {
tempVector = new Object();
tempVector.x = v1.x + v2.x;
tempVector.y = v1.y + v2.y;
return(tempVector);
};
subtract = function (v1, v2) {
tempVector = new Object();
tempVector.x = v1.x - v2.x;
tempVector.y = v1.y - v2.y;
return(tempVector);
};
multiply = function (s, v) {
tempVector = new Object();
tempVector.x = v.x * s;
tempVector.y = v.y * s;
return(tempVector);
};
resetCollisions = function () {
myCollisions = new Array();
};
findAngle = function (xdist, ydist) {
a = Math.atan(ydist / xdist) * rad;
if ((xdist > 0) and (ydist < 0)) {
a = -a;
}
if (xdist < 0) {
a = 180 - a;
}
if ((xdist > 0) and (ydist > 0)) {
a = 360 - a;
}
return(a);
};
getSlope = function (x1, y1, x2, y2) {
return((y1 - y2) / (x1 - x2));
};
getIntercept = function (x1, y1, slope) {
return(y1 - (x1 * slope));
};
getIntersection = function (x1, y1, x2, y2, x3, y3, x4, y4) {
m1 = getSlope(x1, y1, x2, y2);
m2 = getSlope(x3, y3, x4, y4);
b1 = getIntercept(x1, y1, m1);
b2 = getIntercept(x3, y3, m2);
tempPoint = new Object();
tempPoint.x = (b2 - b1) / (m1 - m2);
tempPoint.y = (m1 * tempPoint.x) + b1;
return(tempPoint);
};
findWhichWall = function (c, x1, y1) {
retVec = new Object();
retVec.x = 0;
retVec.y = 0;
wallDist = new Array();
myVel = distance(0, 0, speed.x, speed.y);
wallDist[0] = (Math.abs(c.right - (x1 - span)) < myVel) and (oldPos.x > _x);
wallDist[1] = (Math.abs(c.top - (y1 + span)) < myVel) and (oldPos.y < _y);
wallDist[2] = (Math.abs(c.left - (x1 + span)) < myVel) and (oldPos.x < _x);
wallDist[3] = (Math.abs(c.bottom - (y1 - span)) < myVel) and (oldPos.y > _y);
if (wallDist[0]) {
}
if (wallDist[1]) {
}
if (wallDist[2]) {
}
if (wallDist[3]) {
}
if (wallDist[0] or wallDist[2]) {
if (speed.x > 0) {
retVec.x = retVec.x - 1;
} else {
retVec.x = retVec.x + 1;
}
}
if (wallDist[1] or wallDist[3]) {
if (speed.y > 0) {
retVec.y = retVec.y - 1;
} else {
retVec.y = retVec.y + 1;
}
}
return(retVec);
};
myHitTest = function (c) {
hitting = true;
if (((((_x + span) < c.left) or ((_x - span) > c.right)) or ((_y + span) < c.top)) or ((_y - span) > c.bottom)) {
hitting = false;
}
return(hitting);
};
boxTest = function (which) {
clip = _parent.boxList[which];
if (myHitTest(clip)) {
myDist = distance(_x, _y, clip._x, clip._y);
currentdistx = distx;
currentdisty = disty;
futureDist = distance(_x + speed.x, _y + speed.y, clip._x, clip._y);
wallVector = new Object();
wallVector = findWhichWall(clip, _x, _y);
if ((wallVector.x != 0) or (wallVector.y != 0)) {
collisionInfo = new Object();
collisionInfo.collider = "wall";
collisionInfo.perpVector = new Object();
collisionInfo.perpVector.x = 0;
collisionInfo.perpVector.y = 0;
collisionInfo.heft = heft * 1000;
collisionInfo.normal = new Object();
collisionInfo.normal = wallVector;
collisionInfo.speed = new Object();
collisionInfo.speed.x = 0;
collisionInfo.speed.y = 0;
collisionInfo.mass = 1E15;
collisionInfo.body = clip;
myCollisions.push(collisionInfo);
if (stunFrames > stunned) {
stunned = stunFrames;
}
}
}
};
bumperTest = function (which) {
clip = currentBumperList[which];
if (clip.active) {
if (hitter.hitTest(clip)) {
myDist = distance(_x, _y, clip._x, clip._y);
futureDist = distance(_x + speed.x, _y + speed.y, clip._x, clip._y);
myDiff = myDist - (span + (clip._width / 2));
if ((myDiff <= 0) and (myDist > futureDist)) {
if ((this.span > clip.owner.mass) and (!clip.fixed)) {
_parent.beginSuckUp(clip.owner);
this.hitter._xscale = this.hitter._xscale * 1.05;
this.hitter._yscale = this.hitter._yscale * 1.05;
this.span = this.hitter._width / 2;
gfx.crash.start(clip.owner.fx);
} else {
if ((this.span < clip.owner.mass) and (!clip.owner.bumped)) {
clip.owner.bumped = true;
_parent.bumped++;
if (((_parent.bumped >= 2) and (_parent.objectsEaten < 1)) and (!_parent.toldSmallStuff)) {
_parent.toldSmallStuff = true;
_parent.doWordBubble(4);
_parent.smallInterval = setInterval(_parent.hideWordBubble, 3000);
}
if (((_parent.bumped >= 4) and (_parent.objectsEaten < 2)) and (!_parent.toldSmallStuff)) {
_parent.toldSmallStuff = true;
_parent.doWordBubble(4);
_parent.smallInterval = setInterval(_parent.hideWordBubble, 3000);
}
}
collisionInfo = new Object();
collisionInfo.collider = "ball";
collisionInfo.perpVector = new Object();
collisionInfo.perpVector.x = 0;
collisionInfo.perpVector.y = 0;
collisionInfo.heft = heft * 1000;
collisionInfo.normal = new Object();
collisionInfo.normal = findNormal(this, clip);
collisionInfo.speed = new Object();
collisionInfo.speed.x = 0;
collisionInfo.speed.y = 0;
collisionInfo.mass = 10000000000000;
collisionInfo.body = clip;
myCollisions.push(collisionInfo);
if (stunFrames > stunned) {
stunned = stunFrames;
}
}
}
}
}
};
cornerTest = function (which) {
clip = _parent.cornerList[which];
if (hitter.hitTest(clip)) {
myDist = distance(_x, _y, clip._x, clip._y);
futureDist = distance(_x + speed.x, _y + speed.y, clip._x, clip._y);
myDiff = myDist - (clip._width - span);
if ((myDiff >= 0) and (myDist < futureDist)) {
collisionInfo = new Object();
collisionInfo.perpVector = new Object();
collisionInfo.perpVector.x = 0;
collisionInfo.perpVector.y = 0;
collisionInfo.heft = heft * 1000;
collisionInfo.normal = new Object();
collisionInfo.normal = findNormal(this, clip);
collisionInfo.normal.x = collisionInfo.normal.x * -1;
collisionInfo.normal.y = collisionInfo.normal.y * -1;
collisionInfo.speed = new Object();
collisionInfo.speed.x = 0;
collisionInfo.speed.y = 0;
collisionInfo.rot = 0;
collisionInfo.mass = 10000000000000;
collisionInfo.body = clip;
myCollisions.push(collisionInfo);
}
}
};
unDaze = function () {
clearInterval(dazeInterval);
dazed = false;
};
daze = function () {
clearInterval(dazeInterval);
dazeInterval = setInterval(unDaze, 200);
dazed = true;
};
findNormal = function (me, him) {
tempVector = new Object();
tempVector.x = him._x - me._x;
tempVector.y = him._y - me._y;
return(tempVector);
};
findBoxNormal = function (me, him, wall) {
tempVector = new Object();
if (wall == 0) {
tempVector.x = 10;
tempVector.y = 0;
}
if (wall == 1) {
tempVector.x = 0;
tempVector.y = -10;
}
if (wall == 2) {
tempVector.x = -10;
tempVector.y = 0;
}
if (wall == 3) {
tempVector.x = 0;
tempVector.y = 10;
}
return(tempVector);
};
getJ = function (mine, his, normal, hismass, hisHeft, hisPerp) {
myr = (temp = new Object());
diff = new Object();
diff = subtract(mine, his);
temp = multiply(-(1.5 + elastic), diff);
top = dot(temp, normal);
massnum = (1 / mass) + (1 / hismass);
temp = multiply(massnum, normal);
firstAdd = dot(perpVector, normal);
firstAdd = firstAdd * firstAdd;
firstAdd = firstAdd / heft;
secondAdd = dot(hisPerp, normal);
secondAdd = secondAdd * secondAdd;
secondAdd = secondAdd / hisHeft;
bottom = dot(normal, temp);
bottom = bottom + (firstAdd + secondAdd);
j = top / bottom;
return(j);
};
getCollisions = function () {
var _local3 = 0;
while (_local3 < currentBallList.length) {
clip = currentBallList[_local3];
if (clip.id > id) {
if (hitter.hitTest(clip.hitter)) {
myDist = distance(_x, _y, clip._x, clip._y);
futureDist = distance(_x + speed.x, _y + speed.y, clip._x + clip.speed.x, clip._y + clip.speed.y);
myDiff = (span + clip.span) - myDist;
if ((myDiff > 0) and (myDist > futureDist)) {
collisionInfo = new Object();
collisionInfo.perpVector = new Object();
collisionInfo.perpVector = clip.perpVector;
collisionInfo.normal = new Object();
collisionInfo.normal = findNormal(this, clip);
collisionInfo.speed = new Object();
collisionInfo.speed = clip.speed;
collisionInfo.rot = clip.rot;
collisionInfo.mass = clip.mass;
collisionInfo.heft = clip.heft;
myCollisions.push(collisionInfo);
collisionInfo = new Object();
collisionInfo.perpVector = new Object();
collisionInfo.perpVector = perpVector;
collisionInfo.normal = new Object();
collisionInfo.normal = findNormal(clip, this);
collisionInfo.speed = new Object();
collisionInfo.speed = speed;
collisionInfo.rot = rot;
collisionInfo.mass = mass;
collisionInfo.heft = heft;
clip.myCollisions.push(collisionInfo);
}
}
}
_local3++;
}
_local3 = 0;
while (_local3 < _parent.cornerList.length) {
cornerTest(_local3);
_local3++;
}
_local3 = 0;
while (_local3 < currentBumperList.length) {
bumperTest(_local3);
_local3++;
}
_local3 = 0;
while (_local3 < _parent.boxList.length) {
boxTest(_local3);
_local3++;
}
_local3 = 0;
while (_local3 < _parent.wallList.length) {
wallTest(_local3);
_local3++;
}
if (this.hitter.hitTest(_parent.stairs)) {
speed.x = speed.x + 0.3;
}
return(myCollisions);
};
translate = function () {
oldPos = new Object();
oldPos.x = _x;
oldPos.y = _y;
preVelocity = distance(0, 0, speed.x, speed.y);
spin = spin + preVelocity;
frame = (int(spin * 0.1) % 35) + 1;
_parent.display.hider.gotoAndStop(frame);
if (maxVelocity > maxVelocity) {
finalVel = finalVel * 0.8;
} else {
finalVel = maxVelocity;
}
finalVel = Math.max(finalVel, maxVelocity);
if (preVelocity > finalVel) {
ratio = finalVel / preVelocity;
speed.x = speed.x * ratio;
speed.y = speed.y * ratio;
}
_x = (_x + (speed.x / _parent.iterations));
_y = (_y + (speed.y / _parent.iterations));
_rotation = (_rotation + (rot * rad));
rot = rot * 0.85;
perpVector.x = (-Math.sin(_rotation / rad)) * span;
perpVector.y = Math.cos(_rotation / rad) * span;
preVelocity = distance(0, 0, speed.x, speed.y);
if (preVelocity > 0) {
velocity = preVelocity - friction;
velocity = Math.max(0, velocity);
ratio = velocity / preVelocity;
speed.x = speed.x * ratio;
speed.y = speed.y * ratio;
}
};
collisionDetection = function () {
collisionList = new Array();
collisionList = getCollisions();
};
determineSound = function (who) {
if (((who._name == "bumper0") or (who._name == "bumper1")) or (who._name == "box2")) {
return(2);
}
if (who._name == "box1") {
return(4);
}
return(1);
};
collisionResponse = function () {
if (collisionList.length > 0) {
speedTotal = new Object();
speedTotal.x = 0;
speedTotal.y = 0;
rotTotal = 0;
i = 0;
while (i < collisionList.length) {
j = getJ(speed, collisionList[i].speed, collisionList[i].normal, collisionList[i].mass, collisionList[i].heft, collisionList[i].perpVector);
temp = new Object();
temp = multiply(j / mass, collisionList[i].normal);
speedTotal = adds(speedTotal, temp);
jNormal = new Object();
jNormal = multiply(j, collisionList[i].normal);
value = dot(jNormal, perpVector);
rotTotal = rotTotal + (value / heft);
var _local3 = collisionList[i].body;
i++;
}
_parent.determineSpecs(_local3._name);
if ((magnitude(speedTotal) > 10) and ((!_parent.time) > 10)) {
_parent.doWally("hit");
}
vol = int(magnitude(speedTotal) * 2);
if (vol > 0) {
daze();
}
if (vol > 15) {
var _local4 = determineSound(_local3);
_root.sounds.instance[_local4].setVolume(vol);
_root.sounds.volumes[_local4] = vol;
_root.sounds.goals[_local4] = vol;
if (_local4 == 1) {
_root.sounds.bounce.start();
} else if (_local4 == 2) {
_root.sounds.rim.start();
} else if (_local4 == 4) {
_root.sounds.backboard.start();
}
}
speedTotal.x = speedTotal.x / collisionList.length;
speedTotal.y = speedTotal.y / collisionList.length;
speedTotal.x;
speedTotal.y;
rotTotal = rotTotal / collisionList.length;
rot = rot - rotTotal;
speed = adds(speed, speedTotal);
_parent.checkBounces();
}
};
Symbol 168 MovieClip Frame 1
_visible = false;
Symbol 170 MovieClip Frame 1
_visible = false;
Symbol 255 MovieClip Frame 19
gotoAndPlay ("walk");
Symbol 255 MovieClip Frame 30
gfx.guardEyes.start();
Symbol 255 MovieClip Frame 42
gotoAndPlay ("rubLoop");
Symbol 255 MovieClip Frame 60
stop();
Symbol 256 MovieClip Frame 1
hitter._visible = false;
Symbol 260 MovieClip Frame 1
_visible = false;
Symbol 305 MovieClip Frame 1
stop();
Symbol 305 MovieClip Frame 23
gotoAndPlay ("walk");
Symbol 305 MovieClip Frame 26
trace("dwight has been caught");
Symbol 305 MovieClip Frame 27
trace("dwight has been caught2");
Symbol 305 MovieClip Frame 28
trace("dwight has been caught3");
Symbol 305 MovieClip Frame 29
trace("dwight has been caught4");
Symbol 305 MovieClip Frame 34
stop();
Symbol 306 MovieClip Frame 1
hitter._visible = false;
Symbol 331 MovieClip Frame 15
gotoAndPlay (1);
Symbol 331 MovieClip Frame 27
stop();
Symbol 332 MovieClip Frame 1
hitter._visible = false;
Symbol 337 MovieClip Frame 1
onEnterFrame = function () {
this._x = this._x + this.speed.x;
this._y = this._y + this.speed.y;
};
Symbol 337 MovieClip Frame 9
this.removeMovieClip(this);
stop();
Symbol 341 MovieClip Frame 1
feedback = "";
Symbol 351 MovieClip Frame 1
_visible = false;
Symbol 361 MovieClip Frame 1
init = function () {
this.createEmptyMovieClip("stringer", this.getNextHighestDepth());
wally = _parent.wally.dude;
gravity = 2.5;
fragCount = 0;
balls = 2;
maxSpring = 37;
maxSpeed = 8;
iterations = 2;
display.startx = display.slider._x;
display.starty = display.slider._y;
camSpeed = 0;
camMax = 40;
dudeDist = 30;
_parent.ground.start = {x:_parent.ground._x, y:_parent.ground._y};
beginTime = _parent.time;
startx = this._x;
starty = this._y;
ballStartx = ball._x;
ballStarty = ball._y;
bumperList = [];
cornerList = [];
boxList = [];
wallList = [];
ballProperties();
totalTime = 90;
dwightAngle = random(360);
dwightSpinInterval = setInterval(dwightSpin, 1000);
dwight.hitter._visible = false;
dwightSpin();
dwight.walking = false;
if (level == 1) {
gameStarted = true;
} else {
gameStarted = false;
}
gameOver = false;
objectsEaten = 0;
bumped = 0;
ballCount = 0;
clocked = false;
overlay.swapDepths(1000);
display.swapDepths(900);
state = "idle";
display.pusher.dude.gotoAndStop("idle");
doWally("intro");
setSpans();
toldSmallStuff = false;
toldDoingGreat = false;
ballList = [];
totalObjects = 14;
ball.walking = true;
jim = [jim0, jim1, jim2, jim3, jim4];
saidJim = [false, false, false, false, false];
newBall(ball, 60, 200000000, null);
newBall(guard0, 20, 20000, guardAI);
newBall(guard1, 20, 20000, guardAI);
newBall(guard2, 20, 20000, guardAI);
newBall(dwight, 20, 20000, dwightAI);
setUpGuards();
masterList = [];
dwightDisplay.swapDepths(this.getNextHighestDepth());
};
doJim = function () {
for (var _local1 in jim) {
if (ball.hitter.hitTest(jim[_local1]) and (!saidJim[_local1])) {
saidJim[_local1] = true;
gfx.jim.start(_local1);
}
}
};
setUpGuards = function () {
guard = [guard0, guard1, guard2];
goal = [goal0, goal1, goal2, goal3, goal4, goal5];
orient = ["hor", "vert", "hor"];
var _local2 = 0;
while (_local2 < guard.length) {
guard[_local2].aware = false;
guard[_local2].goalList = [goal[_local2 * 2], goal[(_local2 * 2) + 1]];
guard[_local2].goal = guard[_local2].goalList[0];
guard[_local2].orient = orient[_local2];
guard[_local2].goalCount = 0;
duplicateMovieClip (guardDisplayKing, "guardDisplay" + _local2, this.getNextHighestDepth());
guard[_local2].display = this["guardDisplay" + _local2];
guard[_local2]._alpha = 0;
_local2++;
}
};
chaseAI = function () {
var _local3 = distance(0, 0, this.speed.x, this.speed.y);
if (!this.dead) {
if (((_local3 < 0.2) and (!this.standing)) and (!this.gubPulled)) {
this.standing = true;
this.display.inside.gotoAndStop("stand");
}
if (((_local3 >= 0.2) and this.standing) and (!this.gubPulled)) {
this.standing = false;
this.display.inside.gotoAndPlay("walk");
}
}
if ((((!gameOver) and (!this.dead)) and (!onStairs)) and (!this.dazed)) {
if (this.target == undefined) {
var _local7 = this.lastKnown.x;
var _local6 = this.lastKnown.y;
} else {
var _local7 = this.target._x;
var _local6 = this.target._y;
}
var _local4 = this._x - _local7;
var _local5 = this._y - _local6;
_local3 = distance(this._x, this._y, _local7, _local6);
var _local2 = 5 / _local3;
oldSpeed = {x:this.speed.x, y:this.speed.y};
this.speed.x = this.speed.x - ((_local2 * distx) * 0.5);
this.speed.y = this.speed.y - ((_local2 * disty) * 0.5);
_local3 = distance(0, 0, this.speed.x, this.speed.y);
if (_local3 > 5) {
_local2 = 5 / _local3;
this.speed.x = this.speed.x * _local2;
this.speed.y = this.speed.y * _local2;
}
}
if (this.dead) {
if (this.deadCount > 150) {
this.display.inside.gotoAndPlay("walk");
this.friction = this.friction * 0.25;
this.dead = false;
}
}
};
lookForHeroes = function (who, chasing) {
var _local7 = {x:dwight._x, y:dwight._y};
this.localToGlobal(_local7);
var _local6 = {x:ball._x, y:ball._y};
this.localToGlobal(_local6);
var _local9;
if (!chasing) {
possibleTargets = [];
if (who.display.looker.hitTest(_local7.x, _local7.y, true)) {
possibleTargets.push(dwight);
}
if (who.display.looker.hitTest(_local6.x, _local6.y, true)) {
possibleTargets.push(ball);
}
} else {
possibleTargets = [ball, dwight];
}
if (possibleTargets.length > 0) {
var _local4;
var _local3 = 1000;
for (var _local5 in possibleTargets) {
var _local2 = shootRay(who, possibleTargets[_local5], 600);
if (_local2.who == possibleTargets[_local5]) {
if (_local2.dist < _local3) {
_local3 = _local2.dist;
_local4 = _local2.who;
}
}
}
if (_local4 != undefined) {
who.target = _local4;
who.lastKnown = {who:_local4, x:_local4._x, y:_local4._y};
if (!chasing) {
gfx.guardHey.start();
who.onEnterFrame = chaseAI;
}
} else {
who.target = undefined;
}
}
};
guardAI = function () {
var _local2 = distance(this._x, this._y, this.goal._x, this.goal._y);
if (_local2 < 20) {
this.goalCount = 1 - this.goalCount;
this.goal = this.goalList[this.goalCount];
}
if (this.orient == "hor") {
if (this._x > this.goal._x) {
this._x = this._x - 4;
this.speed = {x:-4, y:0};
} else {
this._x = this._x + 4;
this.speed = {x:4, y:0};
}
} else if (this._y > this.goal._y) {
this._y = this._y - 4;
this.speed = {x:0, y:-4};
} else {
this._y = this._y + 4;
this.speed = {x:0, y:4};
}
lookForHeroes(this, false);
};
shootRay = function (shooter, victim, range) {
var _local13 = distance(shooter._x, shooter._y, victim._x, victim._y);
var _local4 = {x:0, y:0};
var _local8 = 5 / _local13;
_local4.x = distx * _local8;
_local4.y = disty * _local8;
var _local6 = Math.min(_local13, range);
var _local3 = 0;
while (_local3 <= int(_local6 / 5)) {
var _local2 = {who:rayHitter, x:shooter._x - (_local4.x * _local3), y:shooter._y - (_local4.y * _local3)};
this.localToGlobal(_local2);
if (rayHitter.hitTest(_local2.x, _local2.y, true)) {
this.globalToLocal(_local2);
var _local9 = {x:_local2.x, y:_local2.y};
return(_local9);
}
_local3++;
}
if (_local13 > range) {
this.globalToLocal(_local2);
var _local9 = {who:rayHitter, x:_local2.x, y:_local2.y};
return(_local9);
}
var _local9 = {who:victim, x:victim._x, y:victim._y, dist:_local13};
return(_local9);
};
shootCanRay = function (shooter, victim, range) {
var _local12 = distance(canPos.x, canPos.y, victim._x, victim._y);
var _local4 = {x:0, y:0};
var _local7 = 5 / _local12;
_local4.x = distx * _local7;
_local4.y = disty * _local7;
var _local5 = Math.min(_local12, range);
var _local3 = 0;
while (_local3 <= int(_local5 / 5)) {
var _local2 = {who:rayHitter, x:canPos.x - (_local4.x * _local3), y:canPos.y - (_local4.y * _local3)};
this.localToGlobal(_local2);
if (rayHitter.hitTest(_local2.x, _local2.y, true)) {
this.globalToLocal(_local2);
var _local8 = {x:_local2.x, y:_local2.y};
return(_local8);
}
_local3++;
}
if (_local12 > range) {
this.globalToLocal(_local2);
var _local8 = {who:rayHitter, x:_local2.x, y:_local2.y};
return(_local8);
}
var _local8 = {who:victim, x:victim._x, y:victim._y, dist:_local12};
return(_local8);
};
springTo = function (who, where, k, damp) {
var _local4 = distance(who._x, who._y, where.x, where.y);
who.speed.x = who.speed.x - (distx * k);
who.speed.y = who.speed.y - (disty * k);
dwight.speed.x = dwight.speed.x * damp;
dwight.speed.y = dwight.speed.y * damp;
};
dwightAI = function () {
var _local4 = this._x - ball._x;
var _local5 = this._y - ball._y;
var _local6 = distance(this._x, this._y, ball._x, ball._y);
var _local2 = 95 / _local6;
_local2 = Math.min(_local2, 1);
var _local3 = {x:ball._x + (_local2 * _local4), y:ball._y + (_local2 * _local5)};
springTo(this, _local3, 0.15, 0.9);
};
giveBall = function (who) {
if (who.owner.picture == undefined) {
ballCount++;
duplicateMovieClip ("ballKing", "ball" + ballCount, ballCount + 300);
var b = eval ("ball" + ballCount);
b._x = who._x;
b._y = who._y;
b._xscale = who._width;
b._yscale = who._height;
who.alpha = 0;
who.kid = b;
var r = random(3);
b.gotoAndStop(r + 1);
}
};
dobLeave = function () {
_parent.clearAllIntervals();
clearInterval(bleaveInterval);
_parent.gotoAndStop("results");
};
doLeave = function () {
_parent.clearAllIntervals();
clearInterval(leaveInterval);
_parent.gotoAndStop("results");
};
doWally = function (what) {
if (!wally.going) {
wally.gotoAndPlay(what);
wally.going = true;
}
};
rotate = function (n) {
var _local2 = n.parent._x - n._x;
n._rotation = _local2 * 1.95;
};
distance = function (x1, y1, x2, y2) {
distx = x1 - x2;
disty = y1 - y2;
return(Math.sqrt((distx * distx) + (disty * disty)));
};
identifyStringTarget = function () {
closest = {who:null, dist:10000};
for (var _local3 in guard) {
var _local1 = distance(canPos.x, canPos.y, guard[_local3]._x, guard[_local3]._y);
var _local2 = shootCanRay(dwight, guard[_local3], 500);
if (((_local1 < closest.dist) and (!guard[_local3].dead)) and (_local2.who == guard[_local3])) {
closest.who = guard[_local3];
closest.dist = _local1;
}
}
return(closest.who);
};
shootRayToPoint = function (x1, y1, x2, y2) {
var _local6 = distance(x1, y1, x2, y2);
var _local4 = {x:0, y:0};
var _local9 = 5 / _local6;
_local4.x = distx * _local9;
_local4.y = disty * _local9;
var _local3 = 0;
while (_local3 <= int(_local6 / 5)) {
var _local2 = {x:x1 - (_local4.x * _local3), y:y1 - (_local4.y * _local3)};
this.localToGlobal(_local2);
if (rayHitter.hitTest(_local2.x, _local2.y, true)) {
this.globalToLocal(_local2);
var _local10 = {x:_local2.x, y:_local2.y};
return(_local10);
}
for (var _local5 in guard) {
if (guard[_local5].hitTest(_local2.x, _local2.y, true)) {
this.globalToLocal(_local2);
var _local10 = {x:guard[_local5]._x, y:guard[_local5]._y};
return(_local10);
}
}
_local3++;
}
var _local10 = {x:x2, y:y2};
return(_local10);
};
makeFragment = function (x, y) {
fragCount++;
duplicateMovieClip (fragmentKing, "fragment" + fragCount, this.getNextHighestDepth());
var _local2 = this["fragment" + fragCount];
_local2._x = x;
_local2._y = y;
trace(_local2._name);
_local2.speed = {x:random(11) - 5, y:random(11) - 5};
};
doString = function () {
stringer.clear();
if (shootingString) {
var _local1 = identifyStringTarget();
findDwightEnemy();
stringer.lineStyle(2, 16742314, 100);
stringer.moveTo(canPos.x, canPos.y);
if (_local1 == undefined) {
var _local4 = (dwightDisplay._rotation - 4) / 57.2957795130823;
var _local8 = canPos.x + (Math.cos(_local4) * 300);
var _local7 = canPos.y + (Math.sin(_local4) * 300);
var _local3 = shootRayToPoint(canPos.x, canPos.y, _local8, _local7);
var _local6 = (_local3.x + random(11)) - 5;
var _local5 = (_local3.y + random(11)) - 5;
stringer.lineTo(_local6, _local5);
makeFragment(_local6, _local5);
} else {
var _local2 = shootCanRay(dwight, _local1, 300);
if (_local2.who == _local1) {
if (shootCount == 0) {
gfx.guardHey.start();
}
shootCount++;
} else {
shootCount = 0;
}
var _local6 = (_local2.x + random(11)) - 5;
var _local5 = (_local2.y + random(11)) - 5;
stringer.lineTo((_local2.x + random(11)) - 5, (_local2.y + random(11)) - 5);
makeFragment(_local6, _local5);
if (_local2.who == _local1) {
lookForHeroes(_local1, true);
if (shootCount == 0) {
gfx.guardHey.start();
}
_local1.onEnterFrame = chaseAI;
}
if ((shootCount > 9) and (!_local1.dead)) {
_local1.dead = true;
_local1.display.inside.gotoAndPlay("rubEyes");
_local1.feedback.feedback = "Rubbing Eyes";
_local1.friction = _local1.friction * 4;
_local1.deadCount = 0;
}
}
} else {
stringer.clear();
}
};
doKeys = function () {
if (!gameOver) {
if ((Key.isDown(38) and (!onStairs)) and (!ball.dazed)) {
ball.speed.x = ball.speed.x + ((Math.cos(ball._rotation / ball.rad) * 0.8) * (ball.hitter._xscale / 100));
ball.speed.y = ball.speed.y + (Math.sin(ball._rotation / ball.rad) * 0.6);
var _local3 = distance(0, 0, ball.speed.x, ball.speed.y);
if (_local3 > maxSpeed) {
var _local2 = maxSpeed / _local3;
ball.speed.x = ball.speed.x * _local2;
ball.speed.y = ball.speed.y * _local2;
}
if (!gameStarted) {
if (_parent.level == 0) {
gfx.music.enter();
}
hideWordBubble();
setSpans();
startTime = getTimer();
gameStarted = true;
}
}
amTurning = 0;
if (Key.isDown(37) and (!onStairs)) {
amTurning = 37;
ball._rotation = ball._rotation - 10;
}
if (Key.isDown(39) and (!onStairs)) {
amTurning = 37;
ball._rotation = ball._rotation + 10;
}
if (Key.isDown(32)) {
if (!shootingString) {
gfx.sillyString.enter();
shootCount = 0;
shootingString = true;
stringTarget = identifyStringTarget();
}
} else if (shootingString) {
gfx.sillyString.exit();
shootingString = false;
}
}
};
handleDisplay = function () {
display._x = ball._x;
display._y = ball._y;
display.pusher._rotation = ball._rotation;
display.slider._x = display.slider._x + (ball.speed.x * (100 / display.slider._xscale));
display.slider._y = display.slider._y + (ball.speed.y * (100 / display.slider._xscale));
if (display.slider._x > (display.startx + 100)) {
display.slider._x = display.slider._x - 100;
}
if (display.slider._x < (display.startx - 100)) {
display.slider._x = display.slider._x + 100;
}
if (display.slider._y > (display.starty + 100)) {
display.slider._y = display.slider._y - 100;
}
if (display.slider._y < (display.starty - 100)) {
display.slider._y = display.slider._y + 100;
}
display.hider._xscale = ball.hitter._xscale;
display.hider._yscale = ball.hitter._yscale;
display.shadow._xscale = ball.hitter._xscale;
display.shadow._yscale = ball.hitter._yscale;
display.pusher.dude._x = ((dudeDist * ball.hitter._xscale) * -0.008) - 5;
};
moveCamera = function () {
var _local8 = ball._x - ballStartx;
var _local7 = ball._y - ballStarty;
var _local4 = startx - _local8;
var _local3 = starty - _local7;
if (_parent.level == 0) {
_local4 = Math.max(92, _local4);
_local4 = Math.min(1059, _local4);
_local3 = Math.max(-268, _local3);
_local3 = Math.min(668, _local3);
} else {
_local4 = Math.max(641, _local4);
_local4 = Math.min(1594, _local4);
_local3 = Math.max(-875, _local3);
_local3 = Math.min(236, _local3);
}
var _local6 = distance(this._x, this._y, _local4, _local3) / 3;
if (camSpeed < _local6) {
camSpeed = camSpeed + 4;
}
camSpeed = Math.min(camMax, camSpeed);
camSpeed = Math.min(camSpeed, _local6);
var _local5 = camSpeed / _local6;
_parent.ground._x = _parent.ground._x + int(((_local4 - this._x) / 3) * _local5);
_parent.ground._y = _parent.ground._y + int(((_local3 - this._y) / 3) * _local5);
if (_parent.ground._x > _parent.ground.start.x) {
_parent.ground._x = _parent.ground._x - 256;
}
if (_parent.ground._y > _parent.ground.start.y) {
_parent.ground._y = _parent.ground._y - 256;
}
if (_parent.ground._x < (_parent.ground.start.x - 256)) {
_parent.ground._x = _parent.ground._x + 256;
}
if (_parent.ground._y < (_parent.ground.start.y - 256)) {
_parent.ground._y = _parent.ground._y + 256;
}
this._x = this._x + int(((_local4 - this._x) / 3) * _local5);
this._y = this._y + int(((_local3 - this._y) / 3) * _local5);
};
jumpCamera = function () {
var _local8 = ball._x - ballStartx;
var _local7 = ball._y - ballStarty;
var _local4 = startx - _local8;
var _local3 = starty - _local7;
if (_parent.level == 0) {
_local4 = Math.max(92, _local4);
_local4 = Math.min(1059, _local4);
_local3 = Math.max(-268, _local3);
_local3 = Math.min(668, _local3);
} else {
_local4 = Math.max(641, _local4);
_local4 = Math.min(1594, _local4);
_local3 = Math.max(-875, _local3);
_local3 = Math.min(236, _local3);
}
var _local5 = distance(this._x, this._y, _local4, _local3) / 3;
if (camSpeed < _local5) {
camSpeed = camSpeed + 4;
}
camSpeed = Math.min(camMax, camSpeed);
camSpeed = Math.min(camSpeed, _local5);
var _local6 = camSpeed / _local5;
_parent.ground._x = _parent.ground._x + int(((_local4 - this._x) / 3) * _local6);
_parent.ground._y = _parent.ground._y + int(((_local3 - this._y) / 3) * _local6);
if (_parent.ground._x > _parent.ground.start.x) {
_parent.ground._x = _parent.ground._x - 256;
}
if (_parent.ground._y > _parent.ground.start.y) {
_parent.ground._y = _parent.ground._y - 256;
}
if (_parent.ground._x < (_parent.ground.start.x - 256)) {
_parent.ground._x = _parent.ground._x + 256;
}
if (_parent.ground._y < (_parent.ground.start.y - 256)) {
_parent.ground._y = _parent.ground._y + 256;
}
this._x = _local4;
this._y = _local3;
};
distance = function (x1, y1, x2, y2) {
distx = x1 - x2;
disty = y1 - y2;
return(Math.sqrt((distx * distx) + (disty * disty)));
};
gunOut = function (who) {
gfx.sillyString.exit();
gameOver = true;
gfx.music.exit();
gfx.lose.start();
shootingString = false;
_parent.winner = false;
dwight.friction = dwight.friction * 3;
dwight.onEnterFrame = null;
dwight.dead = true;
ball.dead = true;
dwightDisplay.inside.gotoAndPlay("caught");
ballDisplay.inside.gotoAndPlay("caught");
ball.friction = ball.friction * 3;
clearInterval(leaveInterval);
leaveInterval = setInterval(doLeave, 3000);
gfx.guardDraw.start();
for (var _local2 in guard) {
if (!guard[_local2].dead) {
guard[_local2].dead = true;
guard[_local2].display.inside.gotoAndPlay("drawGun");
guard[_local2].friction = guard[_local2].friction * 4;
guard[_local2].onEnterFrame = null;
}
}
};
testGuards = function () {
for (var _local4 in guard) {
var _local2 = distance(guard[_local4]._x, guard[_local4]._y, dwight._x, dwight._y);
var _local1 = distance(guard[_local4]._x, guard[_local4]._y, ball._x, ball._y);
var _local3 = Math.min(_local2, _local1);
if ((((_local3 < 90) and (!gameOver)) and (!guard[_local4].dead)) and (!guard[_local4].pulledGun)) {
guard[_local4].pulledGun = true;
gunOut(guard[_local4]);
}
}
};
doTime = function () {
if (!gameOver) {
if (gameStarted) {
var _local2 = (getTimer() - startTime) + (beginTime * 1000);
time = int(_local2 * 0.011) * 0.1;
if ((time == int(time)) and (time > 0)) {
time = time + ".0";
}
} else {
time = _parent.time;
}
}
_parent.displayTime = time.toString();
};
testVictory = function () {
if (ball.hitTest(elevators) and (!gameOver)) {
gameOver = true;
gfx.music.exit();
if (_parent.level > 0) {
gfx.win.start();
}
_parent.winner = true;
_parent.time = time;
_parent.displayTime = displayTime;
clearInterval(leaveInterval);
leaveInterval = setInterval(doLeave, 2000);
}
};
doPusher = function () {
if (amTurning > 0) {
if (amTurning == 37) {
if (state != "left") {
state = "left";
display.pusher.dude.gotoAndPlay("left");
}
}
if (amTurning == 39) {
if (state != "right") {
state = "right";
display.pusher.dude.gotoAndPlay("right");
}
}
} else {
if (state == "idle") {
if (ball.preVelocity > 1) {
state = "with";
display.pusher.dude.gotoAndPlay("with");
}
}
if (ball.preVelocity <= 1) {
state = "idle";
display.pusher.dude.gotoAndStop("idle");
}
}
};
alignBalls = function () {
for (var _local1 in bumperList) {
bumperList[_local1].kid._x = bumperList[_local1]._x;
bumperList[_local1].kid._y = bumperList[_local1]._y;
bumperList[_local1].kid._visible = bumperList[_local1]._visible;
}
};
setSpans = function (who) {
if (bumperList[0].ballSpan == undefined) {
ballSpan = who.hitter._width / 2;
for (var _local1 in bumperList) {
bumperList[_local1].ballSpan = (bumperList[_local1]._width / 2) + ballSpan;
}
for (var _local1 in ballList) {
ballList[_local1].ballSpan = (ballList[_local1]._width / 2) + ballSpan;
}
}
};
buildCurrentBumperList = function (who) {
setSpans(who);
who.currentBumperList = [];
for (var _local4 in bumperList) {
var _local3 = Math.abs(who._x - bumperList[_local4]._x);
if (_local3 < bumperList[_local4].ballSpan) {
var _local2 = Math.abs(who._y - bumperList[_local4]._y);
if (_local2 <= bumperList[_local4].ballSpan) {
who.currentBumperList.push(bumperList[_local4]);
}
}
}
who.disp = who.currentBumperList.length;
};
buildCurrentBallList = function (who) {
who.currentBallList = [];
var _local1 = 0;
while (_local1 < ballList.length) {
if (ballList[_local1] != who) {
var _local4 = Math.abs(who._x - ballList[_local1]._x);
if (_local4 < ballList[_local1].ballSpan) {
var _local3 = Math.abs(who._y - ballList[_local1]._y);
if (_local3 <= ballList[_local1].ballSpan) {
who.currentBallList.push(ballList[_local1]);
}
}
}
_local1++;
}
};
newBall = function (who, mass, heft, AI, parameters) {
who.rad = 57.2957795130823;
who.span = who.hitter._width / 2;
who.active = false;
who.rot = 0;
who._rotation = 0;
who.preVelocity = 0;
who.maxVelocity = 200;
who.elastic = 0.5;
who.heft = heft;
who.speed = new Object();
who.speed.y = 0;
who.speed.x = 0;
who.mass = mass;
who.id = ballList.length;
who.growthRate = 1.1;
who.friction = 0.15;
who.dazed = false;
who.standing = false;
who.hitDistance = new Array();
who.wallDistance = new Array();
who.bumperDistance = new Array();
who.cornerDistance = new Array();
who.perpVector = new Object();
who.hitter._alpha = 0;
who.spin = 0;
who.type = "ball";
who.onEnterFrame = AI;
who.swapDepths(this.getNextHighestDepth());
ballList.push(who);
};
rotateActor = function (who, targetAngle, inc) {
var _local1 = who._rotation - targetAngle;
if (_local1 > 180) {
_local1 = _local1 - 360;
}
if (_local1 < -180) {
_local1 = _local1 + 360;
}
if (_local1 > 180) {
_local1 = _local1 - 360;
}
if (_local1 < -180) {
_local1 = _local1 + 360;
}
if (_local1 < 0) {
who._rotation = who._rotation + inc;
if ((_local1 + inc) > 0) {
who._rotation = targetAngle;
}
} else {
who._rotation = who._rotation - inc;
if ((_local1 - inc) < 0) {
who._rotation = targetAngle;
}
}
};
findAngle = function (dx, dy) {
var _local1 = (Math.atan2(dy, dx) * 180) / Math.PI;
return(_local1);
};
dwightSpin = function () {
if (((!dwight.engaged) and (!shootingString)) and (!dwight.dead)) {
dwightAngle = random(360);
}
};
findDwightEnemy = function () {
canPos = {x:dwightDisplay.inside.can._x, y:dwightDisplay.inside.can._y};
dwightDisplay.inside.localToGlobal(canPos);
this.globalToLocal(canPos);
dwightEnemy = identifyStringTarget();
if (dwightEnemy != undefined) {
dwight.engaged = true;
var _local4 = dwight._x - dwightEnemy._x;
var _local3 = dwight._y - dwightEnemy._y;
var _local2 = findAngle(-_local4, -_local3);
dwightAngle = _local2;
return(_local2);
}
dwight.engaged = false;
return(dwightAngle);
};
handleFacings = function () {
for (var _local1 in guard) {
if (distance(0, 0, guard[_local1].speed.x, guard[_local1].speed.y) > 0) {
var _local2 = findAngle(guard[_local1].speed.x, guard[_local1].speed.y);
rotateActor(guard[_local1].display, _local2, 22.5);
}
guard[_local1].display._x = guard[_local1]._x;
guard[_local1].display._y = guard[_local1]._y;
}
dwightDisplay._x = dwight._x;
dwightDisplay._y = dwight._y;
var _local2 = findDwightEnemy();
if (dwight.engaged) {
rotateActor(dwightDisplay, _local2, 22.5);
} else {
rotateActor(dwightDisplay, _local2, 11.25);
}
var _local3 = distance(0, 0, dwight.speed.x, dwight.speed.y);
if (!dwight.dead) {
if (_local3 > 0.2) {
if (!dwight.walking) {
dwight.walking = true;
dwightDisplay.inside.gotoAndPlay("walk");
}
} else if (dwight.walking) {
dwight.walking = false;
dwightDisplay.inside.gotoAndPlay("stand");
}
}
ballDisplay._x = ball._x;
ballDisplay._y = ball._y;
ballDisplay._rotation = ball._rotation;
if (!ball.dead) {
if (distance(0, 0, ball.speed.x, ball.speed.y) < 1) {
if (ball.walking) {
ballDisplay.inside.stop();
ball.walking = false;
}
} else if (!ball.walking) {
ballDisplay.inside.gotoAndPlay(1);
ball.walking = true;
}
}
for (var _local1 in chair) {
chair[_local1].overlay._x = chair[_local1]._x;
chair[_local1].overlay._y = chair[_local1]._y;
chair[_local1].overlay._rotation = chair[_local1]._rotation;
}
};
goOnStairs = function () {
if (!onStairs) {
gfx.stairs.start();
onStairs = true;
_parent.time = time;
_parent.winner = true;
_parent.displayTime = displayTime;
clearInterval(bleaveInterval);
bleaveInterval = setInterval(dobLeave, 1000);
}
};
doStairs = function () {
if (ball.hitter.hitTest(stairs1)) {
ball.speed.y = ball.speed.y + 0.8;
goOnStairs();
}
if (ball.hitter.hitTest(stairs0)) {
ball.speed.y = ball.speed.y + 0.8;
}
};
onEnterFrame = function () {
doKeys();
for (var _local5 in ballList) {
if (ballList[_local5] != ball) {
var _local3 = true;
var _local4 = {x:ballList[_local5]._x + (ballList[_local5].ballSpan * 0.5), y:ballList[_local5]._y};
this.localToGlobal(_local4);
if (rayHitter.hitTest(_local4.x, _local4.y, true)) {
_local3 = false;
}
_local4 = {x:ballList[_local5]._x - (ballList[_local5].ballSpan * 0.5), y:ballList[_local5]._y};
this.localToGlobal(_local4);
if (rayHitter.hitTest(_local4.x, _local4.y, true)) {
_local3 = false;
}
_local4 = {x:ballList[_local5]._x, y:ballList[_local5]._y + (ballList[_local5].ballSpan * 0.5)};
this.localToGlobal(_local4);
if (rayHitter.hitTest(_local4.x, _local4.y, true)) {
_local3 = false;
}
_local4 = {x:ballList[_local5]._x, y:ballList[_local5]._y - (ballList[_local5].ballSpan * 0.5)};
this.localToGlobal(_local4);
if (rayHitter.hitTest(_local4.x, _local4.y, true)) {
_local3 = false;
}
if (!_local3) {
ballList[_local5].mass = 10000;
} else {
ballList[_local5].mass = 20;
}
}
}
i = 0;
while (i < iterations) {
for (var _local5 in ballList) {
ballList[_local5].resetCollisions();
}
for (var _local5 in ballList) {
if ((ballList[_local5] == ball) or (ballList[_local5] == dwight)) {
buildCurrentBumperList(ballList[_local5]);
}
buildCurrentBallList(ballList[_local5]);
ballList[_local5].collisionDetection();
}
for (var _local5 in ballList) {
ballList[_local5].collisionResponse();
}
for (var _local5 in ballList) {
ballList[_local5].translate();
}
i++;
}
handleDisplay();
moveCamera();
doTime();
doPusher();
alignBalls();
if (!_parent.invincible) {
testGuards();
}
handleFacings();
doString();
testVictory();
doStairs();
doJim();
};
gotoAndStop("level" + _parent.level);
stop();
init();
Symbol 361 MovieClip Frame 7
init();
Symbol 361 MovieClip Frame 14
init();
ball.speed.y = 5;
dwight.speed.y = 5;
Symbol 375 Button
on (press) {
if (_parent.level == 1) {
gfx.music.enter();
}
_parent.fade("game");
}
Symbol 378 MovieClip Frame 1
gotoAndStop(3 - _parent._parent.lives);
Symbol 379 MovieClip Frame 1
_parent.lives--;
lifeText = ["You've got one life remaining.", "You've got two lives remaining."];
trace("the lives are " + _parent.lives);
trace("the level is " + _parent.level);
lifer = lifeText[_parent.lives - 1];
Symbol 382 Button
on (press) {
_parent.level++;
_parent.fade("game");
}
Symbol 386 MovieClip Frame 1
score = Math.max(0, 20000 - int(_parent._parent.time * 100));
if (score > _parent._parent.best) {
_parent._parent.best = score;
}
Symbol 390 Button
on (press) {
_parent.hasPlayedForBucks = true;
_parent.fade("title");
}
Symbol 400 MovieClip Frame 1
gotoAndStop(_parent._parent.mode + 1);
Symbol 405 MovieClip Frame 1
gotoAndStop(_parent._parent.mode + 1);
Symbol 406 MovieClip Frame 1
if (_parent.winner) {
gotoAndStop (1);
} else {
gotoAndStop (2);
}
Symbol 406 MovieClip Frame 2