Frame 1
_global.musicStart = true;
p1.gotoAndPlay(5);
stop();
Frame 2
function ARGH(ship, box, shipmass) {
var _local1 = box;
var _local2 = shipmass;
localMass = _local1.randomMass * forceMult;
gravity = 30;
Xdis = _local1._x - ship._x;
Ydis = _local1._y - ship._y;
distSq = (Xdis * Xdis) + (Ydis * Ydis);
distance = math.sqrt(distSq);
force = ((localMass * _local2) / distSq) * gravity;
totalMass = math.abs(localMass) + math.abs(_local2);
perForce = math.abs(localMass) / math.abs(_local2);
Fx = -(((Xdis * force) / distance) * perForce);
Fy = -(((Ydis * force) / distance) * perForce);
dx = _local1._x - 512;
dy = _local1._y - 384;
distance = math.sqrt((dx * dx) + (dy * dy));
_local1._x = _local1._x + Fx;
_local1._y = _local1._y + Fy;
}
delta_time = 0.1;
gravity = 1;
forceMult = 0.8;
Mouse.hide();
_global.player1 = 0;
_global.player2 = 0;
_global.done1 = true;
_global.done2 = true;
_global.p1control = true;
_global.p2control = true;
_global.p1xPos = 180;
_global.p1yPos = 340;
_global.p2xPos = 725;
_global.p2yPos = 340;
_global.p1mass = ((p1._height / 2) * 9.86960440108936) / 5;
_global.p2mass = ((p2._height / 2) * 9.86960440108936) / 5;
_global.numObjects = 0;
_global.timer = 0;
_global.p1done = false;
_global.p2done = false;
_global.p1counter = 0;
_global.p2counter = 0;
_global.attached = false;
_global.angle = 0;
_global.wallUp = true;
_global.wallBounce = 10;
_global.initialPush1 = false;
_global.initialPush2 = false;
_global.done = false;
_global.music = new Sound();
_global.absorb = new Sound();
_global.lose = new Sound();
_global.change = new Sound();
_global.spin = new Sound();
absorb.attachSound("absorb");
absorb.setVolume(50);
lose.attachSound("lose");
lose.setVolume(100);
change.attachSound("switch");
change.setVolume(50);
spin.attachSound("spin1");
spin.setVolume(75);
music.attachSound("song");
music.setVolume(100);
if (musicStart == true) {
music.start("", 100);
musicStart = false;
}
Instance of Symbol 25 MovieClip "clouds" in Frame 2
onClipEvent (enterFrame) {
gotoAndPlay (3);
}
Instance of Symbol 28 MovieClip "board" in Frame 2
onClipEvent (load) {
this._x = 512;
this._y = 384;
}
Instance of Symbol 35 MovieClip "object0" in Frame 2
onClipEvent (load) {
this._x = 1600;
}
Instance of Symbol 12 MovieClip "p1" in Frame 2
onClipEvent (load) {
vel_x = 0;
vel_y = 0;
acc_x = 0;
acc_y = 0;
rate = 0.2;
delta_time = 0.1;
gravity = 1;
massMult = 100;
forceMult = 3;
vel = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(87) && (p1control == true)) {
acc_x = Math.cos((Math.PI * this._rotation) / 180);
acc_y = Math.sin((Math.PI * this._rotation) / 180);
vel_x = vel_x + acc_x;
vel_y = vel_y + acc_y;
} else if (Key.isDown(83) && (p1control == true)) {
acc_x = Math.cos((Math.PI * this._rotation) / 180);
acc_y = Math.sin((Math.PI * this._rotation) / 180);
vel_x = vel_x + (-acc_x);
vel_y = vel_y + (-acc_y);
} else {
if (vel_x < 0) {
vel_x = vel_x + (rate / 1.5);
}
if (vel_x > 0) {
vel_x = vel_x - (rate / 1.5);
}
if (vel_y < 0) {
vel_y = vel_y + (rate / 1.5);
}
if (vel_y > 0) {
vel_y = vel_y - (rate / 1.5);
}
}
if (Key.isDown(68)) {
this._rotation = this._rotation + 20;
if (attached) {
if (math.abs(p1mass) > math.abs(p2mass)) {
_global.angle = _global.angle + 0.25;
if (spinCount == 12) {
spin.start("", 1);
spinCount = 0;
} else {
spinCount++;
}
}
}
} else if (Key.isDown(65)) {
this._rotation = this._rotation - 20;
if (attached) {
if (math.abs(p1mass) > math.abs(p2mass)) {
_global.angle = _global.angle - 0.25;
if (spinCount == 12) {
spin.start("", 1);
spinCount = 0;
} else {
spinCount++;
}
}
}
} else {
spinCount = 0;
}
cap = (400 - p1mass) / 50;
if (vel_x >= cap) {
vel_x = cap;
}
if (vel_x <= (-cap)) {
vel_x = -cap;
}
if (vel_y >= cap) {
vel_y = cap;
}
if (vel_y <= (-cap)) {
vel_y = -cap;
}
if (math.abs(p1mass / 6) >= 300) {
this._xscale = 300;
this._yscale = 300;
if (p1mass > 300) {
_global.p1mass = 300;
} else {
_global.p1mass = -300;
}
} else {
this._xscale = math.abs(p1mass / 6);
this._yscale = math.abs(p1mass / 6);
}
if ((vel_x < 0.2) && (vel_x > -0.2)) {
vel_x = 0;
}
if ((vel_y < 0.2) && (vel_y > -0.2)) {
vel_y = 0;
}
if (player1 != player2) {
localMass = -p1mass;
} else {
localMass = p1mass;
}
gravity = 30;
Xdis = this._x - _root.p2._x;
Ydis = this._y - _root.p2._y;
distSq = (Xdis * Xdis) + (Ydis * Ydis);
distance = math.sqrt(distSq);
force = ((localMass * p2mass) / distSq) * gravity;
totalMass = math.abs(p1mass) + math.abs(p2mass);
perForce = math.abs(p1mass) / totalMass;
Fx = ((Xdis * force) / distance) * perForce;
Fy = ((Ydis * force) / distance) * perForce;
bothRadius = totalMass / 3;
if (!attached) {
if ((player1 != player2) && (distance <= bothRadius)) {
tempX1 = Xdis;
tempY1 = Ydis;
_global.angle = math.atan(tempY1 / tempX1);
_global.attached = true;
} else if (initialPush2 == false) {
_global.attached = false;
this._x = this._x + (vel_x + Fx);
this._y = this._y + (vel_y + Fy);
} else {
this._x = this._x + (vel_x + (1.5 * Fx));
this._y = this._y + (vel_y + (1.5 * Fy));
_global.initialPush2 = false;
_global.initialPush1 = false;
}
_global.angle = 0;
} else if (player1 != player2) {
if (math.abs(p1mass) < math.abs(p2mass)) {
this._x = _root.p2._x + ((-1 * bothRadius) * math.cos(angle));
this._y = _root.p2._y + ((-1 * bothRadius) * math.sin(angle));
} else if (math.abs(p1mass) == math.abs(p2mass)) {
this._x = this._x + 0;
this._y = this._y + 0;
} else {
this._x = this._x + vel_x;
this._y = this._y + vel_y;
}
} else {
_global.initialPush2 = true;
_global.initialPush1 = true;
_global.attached = false;
}
dx = this._x - 512;
dy = this._y - 384;
d = math.sqrt((dx * dx) + (dy * dy));
moveConst = cap * wallBounce;
if ((d > 350) && (p1done == false)) {
if (p1counter > 15) {
_global.p1control = false;
_global.p1done = true;
vel_x = 0;
vel_y = 0;
if (player1 == 0) {
gotoAndPlay (31);
} else {
gotoAndPlay (46);
}
lose.start("", lose);
}
_global.p1counter++;
} else {
_global.p1counter = 0;
}
}
Instance of Symbol 15 MovieClip "p2" in Frame 2
onClipEvent (load) {
vel_x = 0;
vel_y = 0;
acc_x = 0;
acc_y = 0;
ForceCum_x = 0;
ForceCum_y = 0;
rate = 0.2;
delta_time = 0.1;
gravity = 30;
massMult = 100;
forceMult = 1;
theKeyIsDown = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(17)) {
if ((theKeyIsDown == false) && (done2 == true)) {
if (player2 == 0) {
gotoAndPlay ("pos");
} else if (player2 == 1) {
gotoAndPlay (21);
}
change.start("", 1);
}
theKeyIsDown = true;
} else {
theKeyIsDown = false;
}
if (Key.isDown(38) && (p2control == true)) {
acc_x = Math.cos((Math.PI * this._rotation) / 180);
acc_y = Math.sin((Math.PI * this._rotation) / 180);
vel_x = vel_x + (-acc_x);
vel_y = vel_y + (-acc_y);
} else if (Key.isDown(40) && (p2control == true)) {
acc_x = Math.cos((Math.PI * this._rotation) / 180);
acc_y = Math.sin((Math.PI * this._rotation) / 180);
vel_x = vel_x + acc_x;
vel_y = vel_y + acc_y;
} else {
if (vel_x < 0) {
vel_x = vel_x + (rate / 1.5);
}
if (vel_x > 0) {
vel_x = vel_x - (rate / 1.5);
}
if (vel_y < 0) {
vel_y = vel_y + (rate / 1.5);
}
if (vel_y > 0) {
vel_y = vel_y - (rate / 1.5);
}
}
if (Key.isDown(39)) {
this._rotation = this._rotation + 20;
if (attached) {
if (math.abs(p1mass) < math.abs(p2mass)) {
_global.angle = _global.angle + 0.25;
if (spinCount == 12) {
spin.start("", 1);
spinCount = 0;
} else {
spinCount++;
}
}
}
}
if (Key.isDown(37)) {
this._rotation = this._rotation - 20;
if (attached) {
if (math.abs(p1mass) < math.abs(p2mass)) {
_global.angle = _global.angle - 0.25;
if (spinCount == 12) {
spin.start("", 1);
spinCount = 0;
} else {
spinCount++;
}
}
}
} else {
spinCount = 0;
}
if (p2mass < 200) {
cap = (350 - p2mass) / 50;
} else {
cap = (350 - p2mass) / 20;
}
if (vel_x >= cap) {
vel_x = cap;
}
if (vel_x <= (-cap)) {
vel_x = -cap;
}
if (vel_y >= cap) {
vel_y = cap;
}
if (vel_y <= (-cap)) {
vel_y = -cap;
}
if (math.abs(p2mass / 6) >= 300) {
this._xscale = 300;
this._yscale = 300;
} else {
this._xscale = math.abs(p2mass / 6);
this._yscale = math.abs(p2mass / 6);
}
if ((vel_x < 0.2) && (vel_x > -0.2)) {
vel_x = 0;
}
if ((vel_y < 0.2) && (vel_y > -0.2)) {
vel_y = 0;
}
if (player1 != player2) {
localMass = -p2mass;
} else {
localMass = p2mass;
}
gravity = 30;
Xdis = this._x - _root.p1._x;
Ydis = this._y - _root.p1._y;
distSq = (Xdis * Xdis) + (Ydis * Ydis);
distance = math.sqrt(distSq);
force = ((localMass * p1mass) / distSq) * gravity;
totalMass = math.abs(p1mass) + math.abs(p2mass);
perForce = math.abs(p1mass) / totalMass;
Fx = ((Xdis * force) / distance) * perForce;
Fy = ((Ydis * force) / distance) * perForce;
bothRadius = totalMass / 3;
if (!attached) {
if ((player1 != player2) && (distance <= bothRadius)) {
tempX2 = Xdis;
tempY2 = Ydis;
_global.angle = math.atan(tempY2 / tempX2);
} else if (initialPush2 == false) {
this._x = this._x + (vel_x + Fx);
this._y = this._y + (vel_y + Fy);
} else {
this._x = this._x + (vel_x + (1.5 * Fx));
this._y = this._y + (vel_y + (1.5 * Fy));
_global.initialPush2 = false;
_global.initialPush1 = false;
}
_global.angle = 0;
} else if (player1 != player2) {
if (math.abs(p2mass) < math.abs(p1mass)) {
this._x = _root.p1._x + (bothRadius * math.cos(angle));
this._y = _root.p1._y + (bothRadius * math.sin(angle));
} else if (math.abs(p1mass) == math.abs(p2mass)) {
this._x = this._x + 0;
this._y = this._y + 0;
} else {
this._x = this._x + vel_x;
this._y = this._y + vel_y;
}
} else {
_root.wall.gotoAndPlay(20);
wallUp.start("", 1);
_global.initialPush2 = true;
_global.initialPush1 = true;
}
dx = this._x - 512;
dy = this._y - 384;
d = math.sqrt((dx * dx) + (dy * dy));
moveConst = cap * wallBounce;
if ((d > 350) && (p2done == false)) {
if (p2counter > 15) {
_global.p2control = false;
_global.p2done = true;
vel_x = 0;
vel_y = 0;
if (player2 == 0) {
gotoAndPlay (31);
} else {
gotoAndPlay (46);
}
lose.start("", lose);
}
_global.p2counter++;
} else {
_global.p2counter = 0;
}
}
Frame 3
if (done == true) {
gotoAndPlay (6);
}
objectArray = new Array(10);
objectArray[0] = _root.object1;
objectArray[1] = _root.object2;
objectArray[2] = _root.object3;
objectArray[3] = _root.object4;
objectArray[4] = _root.object5;
objectArray[5] = _root.object6;
objectArray[6] = _root.object7;
objectArray[7] = _root.object8;
objectArray[8] = _root.object9;
objectArray[9] = _root.object10;
i = 0;
while (i < 10) {
boxArray = _root.objectArray[i];
pMass = 0;
if (player1 == 0) {
pMass = -p1mass;
} else {
pMass = p1mass;
}
ARGH(p1, boxArray, pMass);
if (player2 == 0) {
pMass = -p2mass;
} else {
pMass = p2mass;
}
ARGH(p2, boxArray, pMass);
i++;
}
object0._x = 1600;
if (timer == 10) {
while (numObjects < 10) {
i = numObjects + 1;
object0.duplicateMovieClip("object" + i, i + 100);
_global.numObjects++;
}
} else if (timer > 150) {
if (numObjects == 0) {
while (numObjects < 10) {
i = numObjects + 1;
object0.duplicateMovieClip("object" + i, i + 100);
_global.numObjects++;
}
}
}
Instance of Symbol 35 MovieClip "object0" in Frame 3
onClipEvent (enterFrame) {
delta_time = 0.1;
var vel = 0;
var bMass = 0;
var x_velocity = 0;
var y_velocity = 0;
i = 1;
while (i < 3) {
if (this.hitTest(_root["p" + i])) {
if ((state != player1) && (i == 1)) {
if (math.abs(p1mass < 300)) {
_global.p1mass = _global.p1mass + math.abs(((randomMass / 2) * 9.86960440108936) / 30);
} else {
_global.p1mass = 300;
}
_global.numObjects--;
absorb.start("", 1);
this.removeMovieClip();
}
if ((state != player2) && (i == 2)) {
if (math.abs(p2mass < 300)) {
_global.p2mass = _global.p2mass + math.abs(((randomMass / 2) * 9.86960440108936) / 30);
} else {
_global.p2mass = 300;
}
_global.numObjects--;
absorb.start("", 1);
this.removeMovieClip();
}
}
i++;
}
dx = this._x - 512;
dy = this._y - 384;
if ((math.sqrt((dx * dx) + (dy * dy)) > 350) && (this._x != 1600)) {
if (state == 0) {
gotoAndPlay (6);
} else {
gotoAndPlay (16);
}
_global.numObjects--;
this.removeMovieClip();
}
_global.timer++;
}
onClipEvent (load) {
function reset() {
var _local1 = this;
randomX = random(480) + -240;
randomY = random(480) + -240;
_local1._x = 512 + randomX;
_local1._y = 384 + randomY;
if (p1mass >= p2mass) {
bMass = p2mass;
} else {
bMass = p1mass;
}
randomMass = random(20) + 30;
_local1._xscale = randomMass;
_local1._yscale = randomMass;
state = random(2);
if (state == 0) {
_local1.gotoAndPlay(1);
bMass = randomMass;
} else {
_local1.gotoAndPlay(2);
bMass = -randomMass;
}
randomMass = bMass;
}
reset();
}
Frame 5
gotoAndPlay (3);
Frame 6
if (p2done == true) {
gotoAndPlay (7);
} else {
gotoAndPlay (8);
}
i = 0;
while (i < 10) {
boxArray = _root.objectArray[i];
boxArray.removeMovieClip();
i++;
}
Frame 7
stop();
Frame 8
stop();
Frame 9
stop();
Symbol 12 MovieClip Frame 1
stop();
Symbol 12 MovieClip Frame 5
_global.done1 = false;
_global.player1 = 0;
Symbol 12 MovieClip Frame 10
_global.done1 = true;
_global.player1 = 1;
stop();
Symbol 12 MovieClip Frame 20
_global.done1 = false;
_global.player1 = 1;
Symbol 12 MovieClip Frame 25
_global.done1 = true;
_global.player1 = 0;
stop();
Symbol 12 MovieClip Frame 44
_global.done = true;
stop();
Symbol 12 MovieClip Frame 59
_global.done = true;
stop();
Symbol 15 MovieClip Frame 1
stop();
Symbol 15 MovieClip Frame 5
_global.done2 = false;
trace("start pos");
Symbol 15 MovieClip Frame 10
_global.done2 = true;
_global.player2 = 1;
stop();
Symbol 15 MovieClip Frame 20
_global.done2 = false;
trace("start neg");
Symbol 15 MovieClip Frame 25
_global.done2 = true;
_global.player2 = 0;
trace("DONE");
stop();
Symbol 15 MovieClip Frame 44
_global.done = true;
stop();
Symbol 15 MovieClip Frame 59
_global.done = true;
stop();
Symbol 22 Button
on (keyPress "<Space>") {
gotoAndPlay (2);
}
Symbol 35 MovieClip Frame 1
stop();
Symbol 35 MovieClip Frame 2
stop();
Symbol 35 MovieClip Frame 10
stop();
Symbol 35 MovieClip Frame 20
stop();
Symbol 37 Button
on (keyPress "<Space>") {
if (done1 == true) {
if (player1 == 0) {
p1.gotoAndPlay("pos");
} else {
p1.gotoAndPlay("neg");
}
change.start("", 1);
}
}
Symbol 40 Button
on (release) {
gotoAndPlay (2);
}