Frame 1
function newContextMenu() {
var _local2 = new ContextMenu();
_local2.hideBuiltInItems();
var _local3 = new ContextMenuItem("ZuiGe's flash game development studios", gotoSite1);
_local2.customItems.push(_local3);
_root.menu = _local2;
}
function gotoSite1() {
getURL ("http://zuige.net", "_blank");
}
stop();
var gamemode = 1;
var currSong = 0;
var bgMusic = new Sound(this);
var musicvolume = 80;
var dragging = false;
newContextMenu();
onEnterFrame = function () {
perc = _root.getBytesLoaded() / _root.getBytesTotal();
loader._xscale = perc * 100;
if (perc == 1) {
loadd._visible = false;
_root.onEnterFrame = undefined;
urlStart = _url.indexOf("://") + 3;
urlEnd = _url.indexOf("/", urlStart);
domain = _url.substring(urlStart, urlEnd);
LastDot = domain.lastIndexOf(".") - 1;
domEnd = domain.lastIndexOf(".", LastDot) + 1;
domain = domain.substring(domEnd, domain.length);
if (((domain != "funny-games.biz") && (domain != "funny-base.com")) && (domain != "")) {
stealtxt.text = "this game has been taken without permission";
domaintxt.text = domain;
} else {
play();
}
}
};
Frame 2
_root.createEmptyMovieClip("sound", _root.getNextHighestDepth());
_root.createEmptyMovieClip("musics", _root.getNextHighestDepth());
gotoAndStop (3);
onEnterFrame = undefined;
Frame 3
stop();
if (sounds == undefined) {
var sounds = new Sound(sound);
sounds.setVolume(100);
}
if (music == undefined) {
var music = new Sound(musics);
music.setVolume(25);
music.attachSound("song");
music.start(0, 999);
}
onKeyDown = function () {
gotoAndStop (4);
onKeyDown = undefined;
onMouseDown = undefined;
};
onMouseDown = function () {
onMouseUp = function () {
gotoAndStop (4);
onKeyDown = undefined;
onMouseDown = undefined;
onMouseUp = undefined;
};
};
Key.addListener(this);
var affs = new Array(6);
var colors = new Array("red", "blue", "green", "yellow", "pink", "purple");
var modes = new Array(undefined, false, false, false, true, true, true);
var diffs = new Array(6);
var ctrls = new Array(6);
var players = 0;
var games = new Array("SUMO DEATHMATCH", "SUMO SURVIVAL");
var maxplayers = new Array(3, 3);
var gamescenes = new Array("sumogame", "sumogame");
var gameexp = new Array("2-6 balls on arena \n max 3 human \n \n 1min time limit \n \n drop someone = 2p \n fall down = -1p \n \n get the most points to win", "2-6 balls on arena \n max 3 human \n \n arena shrinks \n \n last player on arena wins");
var respawn = true;
var frames = new Array(1, 1, 1, 1, 1, 1);
Frame 4
function playgame() {
_root.frames = new Array(_root.player1.modex._currentframe, _root.player2.modex._currentframe, _root.player3.modex._currentframe, _root.player4.modex._currentframe, _root.player5.modex._currentframe, _root.player6.modex._currentframe);
if ((players >= 2) && (gamescenes[gamemode] == "sumogame")) {
if (games[gamemode] == "SUMO SURVIVAL") {
_root.respawn = false;
}
if (games[gamemode] == "SUMO DEATHMATCH") {
_root.respawn = true;
}
gotoAndStop (7);
}
onEnterFrame = undefined;
onKeyDown = undefined;
}
stop();
onKeyDown = function () {
key = Key.getCode();
if (key == 13) {
playgame();
}
};
Key.addListener(this);
k = 1;
while (k <= 6) {
_root["player" + k].playertxt.text = "player " + k;
_root["player" + k].gotoAndStop(k);
_root["player" + k].modex.k = k;
_root["player" + k].modex.gotoAndStop(frames[k - 1]);
_root["player" + k].modex.onRelease = function () {
if (this._currentframe < (_root.maxplayers[_root.gamemode] + 4)) {
this.gotoAndStop(this._currentframe + 1);
} else {
this.gotoAndStop(1);
}
if (this._currentframe == 5) {
_root.ctrls[this.k - 1] = 1;
t = 1;
while (t <= 6) {
if ((_root["player" + t].modex._currentframe == 5) && (t != this.k)) {
if (this._currentframe < (_root.maxplayers[_root.gamemode] + 4)) {
this.gotoAndStop(this._currentframe + 1);
} else {
this.gotoAndStop(1);
}
break;
}
t++;
}
}
if (this._currentframe == 6) {
_root.ctrls[this.k - 1] = 2;
t = 1;
while (t <= 6) {
if ((_root["player" + t].modex._currentframe == 6) && (t != this.k)) {
if (this._currentframe < (_root.maxplayers[_root.gamemode] + 4)) {
this.gotoAndStop(this._currentframe + 1);
} else {
this.gotoAndStop(1);
}
break;
}
t++;
}
}
if (this._currentframe == 7) {
_root.ctrls[this.k - 1] = 3;
t = 1;
while (t <= 6) {
if ((_root["player" + t].modex._currentframe == 7) && (t != this.k)) {
if (this._currentframe < (_root.maxplayers[_root.gamemode] + 4)) {
this.gotoAndStop(this._currentframe + 1);
} else {
this.gotoAndStop(1);
}
break;
}
t++;
}
}
if ((this._currentframe < 5) && (this._currentframe > 1)) {
_root.diffs[this.k - 1] = this._currentframe - 2;
} else {
_root.diffs[this.k - 1] = undefined;
}
_root.affs[this.k - 1] = _root.modes[this._currentframe - 1];
_root.players = 0;
r = 0;
while (r < 6) {
if (_root.affs[r] != undefined) {
_root.players++;
}
r++;
}
};
k++;
}
modeswtc.txt.txt.text = games[gamemode];
gametuto.text = gameexp[gamemode];
modeswtc.onRelease = function () {
gamemode++;
if (gamemode >= games.length) {
gamemode = 0;
}
_root.gametuto.text = gameexp[gamemode];
this.txt.txt.text = games[gamemode];
};
playbtn.onRelease = function () {
playgame();
};
onKeyDown = function () {
key = Key.getCode();
if (key == 77) {
if (musicplaying != undefined) {
musicplaying = undefined;
music.attachSound("song");
music.start(mspot, 999);
mspot = 0;
} else {
musicplaying = false;
mspot = music.position / 1000;
music.stop();
}
}
if (key == 13) {
playgame();
}
if (key == 78) {
if (sfx != undefined) {
sfx = undefined;
} else {
sfx = false;
}
}
if (key == 81) {
if (_root._quality == "HIGH") {
_root._quality = "LOW";
} else if (_root._quality == "LOW") {
_root._quality = "MEDIUM";
} else if (_root._quality == "MEDIUM") {
_root._quality = "HIGH";
}
}
};
Key.addListener(this);
Frame 6
play();
Frame 7
function oneSec() {
fps = oSec;
oSec = 0;
}
function addMsec() {
if (clockrun == true) {
if (spedUp == false) {
if (msecs > 2.38095238095238) {
msecs = msecs - 2.38095238095238;
} else {
msecs = 99;
if (secs > 0) {
secs--;
} else {
secs = 59;
mins--;
}
}
} else if (msecs > 8.69565217391304) {
msecs = msecs - 8.69565217391304;
} else {
msecs = 99;
if (secs > 0) {
secs--;
} else {
secs = 59;
mins--;
}
}
}
}
function Pause(countdown) {
if (countdown == false) {
if (_root.started == false) {
if (_root.Paused2 == true) {
_root.Paused2 = false;
_root.countdown.play();
_root.cover._visible = false;
pausemenu._visible = false;
_root.sounds.start(spos / 1000, 0);
} else {
_root.Paused2 = true;
_root.countdown.stop();
_root.cover._visible = true;
pausemenu._visible = true;
spos = _root.sounds.position;
_root.sounds.stop();
}
} else if (_root.Paused == true) {
_root.arena.fill.play();
_root.Paused = false;
if (respawn == true) {
clockrun = true;
}
cover._visible = false;
pausemenu._visible = false;
_root.sounds.start(spos / 1000, 0);
} else {
_root.Paused = true;
_root.arena.fill.stop();
if (respawn == true) {
clockrun = false;
}
cover._visible = true;
pausemenu._visible = true;
spos = _root.sounds.position;
_root.sounds.stop();
}
} else if (countdown == true) {
_root.arena.fill.play();
_root.Paused = false;
clearInterval(countDown);
clockrun = true;
started = true;
}
cover.swapDepths(_root.getNextHighestDepth());
pausemenu.swapDepths(_root.getNextHighestDepth());
}
function addBall(color, human, ctrls, diff) {
ballNum++;
_root.attachMovie(color + "ball", "ball" + ballNum, 500 + ballNum);
xSpot = (((_root.arena._width / 2) / 4) * 3) * (-Math.cos((spotAngle * Math.PI) / 180));
ySpot = (((_root.arena._width / 2) / 4) * 3) * (-Math.sin((spotAngle * Math.PI) / 180));
_root["ball" + ballNum].spotAngle = _root.spotAngle;
_root[color + "score"]._y = 10;
_root[color + "score"]._x = -50 + (52 * ballNum);
_root.spotAngle = _root.spotAngle + (360 / _root.players);
_root["ball" + ballNum]._x = arena._x + xSpot;
_root["ball" + ballNum]._y = arena._y + ySpot;
_root["ball" + ballNum].xspeed = 0;
_root["ball" + ballNum].yspeed = 0;
_root["ball" + ballNum].mass = 1;
_root["ball" + ballNum].score = 0;
_root["ball" + ballNum].lastTouch = 0;
_root["ball" + ballNum].invinsibility = false;
_root["ball" + ballNum].collisiontime = 0;
_root["ball" + ballNum].num = ballNum;
_root["ball" + ballNum].ballcolor = color;
_root["ball" + ballNum].falling = false;
if (human == true) {
_root["ball" + ballNum].onEnterFrame = humanControl;
_root.humanNum++;
_root["ball" + ballNum].humanNum = ctrls;
_root["ball" + ballNum].identifier._visible = true;
_root["ball" + ballNum].identifier.playernum.text = ctrls;
_root["ball" + ballNum].identifier._alpha = 400;
_root["ball" + ballNum].identifier.onEnterFrame = function () {
if (this._alpha > 0) {
this._alpha = this._alpha - 5;
}
};
} else {
_root["ball" + ballNum].onEnterFrame = cpuControl;
_root["ball" + ballNum].diff = diff;
_root["ball" + ballNum].ditime = 0;
_root["ball" + ballNum].identifier._visible = false;
}
}
function humanControl() {
if (_root.Paused == false) {
this.balldist = Math.sqrt(Math.pow(this._y - arena._y, 2) + Math.pow(this._x - arena._x, 2));
this.speed = Math.abs(this.xspeed) + Math.abs(this.yspeed);
if ((this.balldist <= (_root.arena._width / 2)) && (this.falling == false)) {
this.falling = false;
this.reducer = this._xscale / 50;
if (this.humanNum == 1) {
if (Key.isDown(controls1[0])) {
this.yspeed = this.yspeed - 0.22;
}
if (Key.isDown(controls1[1])) {
this.yspeed = this.yspeed + 0.22;
}
if (Key.isDown(controls1[2])) {
this.xspeed = this.xspeed - 0.22;
}
if (Key.isDown(controls1[3])) {
this.xspeed = this.xspeed + 0.22;
}
}
if (this.humanNum == 2) {
if (Key.isDown(controls2[0])) {
this.yspeed = this.yspeed - 0.22;
}
if (Key.isDown(controls2[1])) {
this.yspeed = this.yspeed + 0.22;
}
if (Key.isDown(controls2[2])) {
this.xspeed = this.xspeed - 0.22;
}
if (Key.isDown(controls2[3])) {
this.xspeed = this.xspeed + 0.22;
}
}
if (this.humanNum == 3) {
if (Key.isDown(controls3[0])) {
this.yspeed = this.yspeed - 0.2;
}
if (Key.isDown(controls3[1])) {
this.yspeed = this.yspeed + 0.2;
}
if (Key.isDown(controls3[2])) {
this.xspeed = this.xspeed - 0.2;
}
if (Key.isDown(controls3[3])) {
this.xspeed = this.xspeed + 0.2;
}
}
} else {
this.falling = true;
this.invinsibility = true;
this.xspeed = this.xspeed - (this.xspeed / 10);
this.yspeed = this.yspeed - (this.yspeed / 10);
if (this._xscale > 2) {
this._xscale = this._xscale - this.reducer;
this._yscale = this._yscale - this.reducer;
} else if (_root.respawn == true) {
_root.scores[this.lastTouch - 1] = _root.scores[this.lastTouch - 1] + 2;
_root.scores[this.num - 1]--;
this.falling = false;
this.ball._alpha = 0;
this._xscale = 100;
this._yscale = 100;
if (swap == players) {
g = 1;
while (g <= _root.players) {
_root["ball" + g].spotAngle = _root["ball" + g].spotAngle + (360 / _root.players);
g++;
}
swap = 0;
} else {
swap++;
}
this.xSpot = (((_root.arena._width / 2) / 4) * 3) * (-Math.cos((this.spotAngle * Math.PI) / 180));
this.ySpot = (((_root.arena._width / 2) / 4) * 3) * (-Math.sin((this.spotAngle * Math.PI) / 180));
_root.tester._x = _root.arena._x + this.xSpot;
_root.tester._y = _root.arena._y + this.ySpot;
t = 1;
while (t < players) {
if (_root["ball" + t].hitTest(_root.tester._x, _root.tester._y, 2)) {
this.spotAngle2 = this.spotAngle + (360 / _root.players);
this.xSpot = (((_root.arena._width / 2) / 4) * 3) * (-Math.cos((this.spotAngle2 * Math.PI) / 180));
this.ySpot = (((_root.arena._width / 2) / 4) * 3) * (-Math.sin((this.spotAngle2 * Math.PI) / 180));
}
t++;
}
this._x = _root.arena._x + this.xSpot;
this._y = _root.arena._y + this.ySpot;
this.xspeed = 0;
this.yspeed = 0;
this.identifier._alpha = 300;
this.ball.onEnterFrame = function () {
if (this._alpha < 100) {
this._alpha = this._alpha + 10;
} else {
this.onEnterFrame = undefined;
this._parent.invinsibility = false;
}
};
} else {
_root.playersOnArena--;
this._alpha = 0;
this.onEnterFrame = undefined;
}
}
this.collisiontime--;
if (_root.finished != true) {
this._x = this._x + this.xspeed;
this._y = this._y + this.yspeed;
}
}
}
function cpuControl() {
if (_root.Paused == false) {
this.balldist = Math.sqrt(Math.pow(this._y - arena._y, 2) + Math.pow(this._x - arena._x, 2));
this.speed = Math.abs(this.xspeed) + Math.abs(this.yspeed);
this.z = 1;
while (this.z <= _root.players) {
if ((_root["ball" + this.z] != this) && (_root["ball" + this.z].falling == false)) {
this.aDist = Math.sqrt(Math.pow(_root["ball" + this.z]._y - this._y, 2) + Math.pow(_root["ball" + this.z]._x - this._x, 2));
if ((this.aDist < this.bDist) || (bDist == undefined)) {
this.nearestBall = _root["ball" + this.z];
this.bDist = this.aDist;
}
}
this.z++;
}
if ((this.balldist <= (_root.arena._width / 2)) && (this.falling == false)) {
this.falling = false;
this.reducer = this._xscale / 50;
if (((this.balldist < (((_root.arena._width / 2) / 4) * 2.5)) && (this.speed > 4)) && (this.nearestBall.falling == false)) {
this.Target = this.nearestBall;
} else {
this.Target = _root.arena;
}
if (this.speed > 3) {
this.angle = (Math.atan2(this._y - this.Target._y, this._x - this.Target._x) * 180) / Math.PI;
} else if (this.speed <= 3) {
if (this.gainSpeed <= 0) {
this.angle = (Math.atan2(this._y - this.Target._y, this._x - this.Target._x) * 180) / Math.PI;
this.gainSpeed = 40;
if (this.Target == this.nearestBall) {
this.angle = this.angle * -1;
}
} else {
this.gainSpeed--;
}
}
if (this.ditime <= 0) {
this.dissarray = 10 - (Math.random() * 20);
this.ditime = 60;
} else {
this.ditime--;
}
this.toSpeedx = _root.maxspeed * (-Math.cos(((this.angle + this.dissarray) * Math.PI) / 180));
this.toSpeedy = _root.maxspeed * (-Math.sin(((this.angle + this.dissarray) * Math.PI) / 180));
if (respawn == true) {
if (spedUp == false) {
spd = 0.15;
} else {
spd = 0.6;
}
} else if (spedUp == false) {
spd = 0.2;
} else {
spd = 0.8;
}
if (this.diff == 0) {
spd = spd * 0.6;
} else if (this.diff == 1) {
spd = spd * 0.8;
} else {
spd = spd;
}
trace(this.diff);
if (this.xspeed < this.toSpeedx) {
this.xspeed = this.xspeed + spd;
} else if (this.xspeed > this.toSpeedx) {
this.xspeed = this.xspeed - spd;
}
if (this.yspeed < this.toSpeedy) {
this.yspeed = this.yspeed + spd;
} else if (this.xspeed > this.toSpeedy) {
this.yspeed = this.yspeed - spd;
}
} else {
this.falling = true;
this.invinsibility = true;
this.xspeed = this.xspeed - (this.xspeed / 10);
this.yspeed = this.yspeed - (this.yspeed / 10);
if (this._xscale > 2) {
this._xscale = this._xscale - this.reducer;
this._yscale = this._yscale - this.reducer;
} else if (_root.respawn == true) {
this.falling = false;
this.ball._alpha = 0;
_root.scores[this.lastTouch - 1] = _root.scores[this.lastTouch - 1] + 2;
_root.scores[this.num - 1]--;
this._xscale = 100;
this._yscale = 100;
if (swap == players) {
g = 1;
while (g <= _root.players) {
_root["ball" + g].spotAngle = _root["ball" + g].spotAngle + (360 / _root.players);
g++;
}
swap = 0;
} else {
swap++;
}
if (_root.respawn != true) {
modemultiplier = 2.5;
} else {
modemultiplier = 3;
}
this.xSpot = (((_root.arena._width / 2) / 4) * modemultiplier) * (-Math.cos((this.spotAngle * Math.PI) / 180));
this.ySpot = (((_root.arena._width / 2) / 4) * modemultiplier) * (-Math.sin((this.spotAngle * Math.PI) / 180));
_root.tester._x = _root.arena._x + this.xSpot;
_root.tester._y = _root.arena._y + this.ySpot;
t = 1;
while (t < _root.players) {
if (_root["ball" + t].hitTest(_root.tester._x, _root.tester._y, 2)) {
this.spotAngle2 = this.spotAngle + (360 / _root.players);
this.xSpot = (((_root.arena._width / 2) / 4) * 3) * (-Math.cos((this.spotAngle2 * Math.PI) / 180));
this.ySpot = (((_root.arena._width / 2) / 4) * 3) * (-Math.sin((this.spotAngle2 * Math.PI) / 180));
}
t++;
}
this._x = _root.arena._x + this.xSpot;
this._y = _root.arena._y + this.ySpot;
this.xspeed = 0;
this.yspeed = 0;
this.ball.onEnterFrame = function () {
if (this._alpha < 100) {
this._alpha = this._alpha + 10;
} else {
this.onEnterFrame = undefined;
this._parent.invinsibility = false;
}
};
} else {
_root.playersOnArena--;
this._alpha = 0;
this.onEnterFrame = undefined;
}
}
this.collisiontime--;
if (_root.finished != true) {
this._x = this._x + this.xspeed;
this._y = this._y + this.yspeed;
}
}
}
function resetAll() {
r = 1;
while (r <= players) {
_root["ball" + r].removeMovieClip();
r++;
}
i = 200;
while (i <= 400) {
_root["line" + i]._visible = false;
i++;
}
cover.removeMovieClip();
wintext.removeMovieClip();
pressentericon.removeMovieClip();
countdown.removeMovieClip();
pausemenu.removeMovieClip();
clearInterval(gotoMenu);
clearInterval(reduceSize);
clearInterval(fpscounter);
onEnterFrame = undefined;
_root.sounds.stop();
}
function menu() {
resetAll();
gotoAndStop (4);
}
function restart() {
resetAll();
gotoAndPlay (6);
}
function addPowerUp() {
sdist = Math.random() * (_root.arena._width / 2);
sangle = Math.random() * 360;
xS = 320 + (sdist * (-Math.cos((sangle * Math.PI) / 180)));
yS = 240 + (sdist * (-Math.sin((sangle * Math.PI) / 180)));
powerupform = "supersize";
powerup = attachMovie(powerupform, [powerupform + _root.getNextHighestDepth()], _root.getNextHighestDepth());
powerup._x = xS;
powerup._y = yS;
}
function endGame() {
_root.finished = true;
w = 1;
while (w <= players) {
if (_root.scores[w - 1] == _root.bscore) {
_root.winner = "draw";
} else if ((_root.scores[w - 1] > _root.bscore) || (_root.bscore == undefined)) {
_root.bscore = _root.scores[w - 1];
_root.winner = _root["ball" + w].ballcolor;
}
w++;
}
winsound = new Sound();
winsound.attachSound(winner + "wins");
winsound.start(0, 1);
cover._visible = true;
cover.swapDepths(_root.getNextHighestDepth());
wintext.swapDepths(_root.getNextHighestDepth());
pressentericon.swapDepths(_root.getNextHighestDepth());
wintext.gotoAndStop(_root.winner);
wintext._visible = true;
gotoMenu = setInterval(menu, 3000);
}
function superSize(ball) {
ball.mass = ball.mass * 2;
ball._xscale = ball._xscale + 50;
ball._yscale = ball._yscale + 50;
}
function manageBounce(ball1, ball2) {
dx = ball1._x - ball2._x;
dy = ball1._y - ball2._y;
distance = Math.sqrt((dx * dx) + (dy * dy));
collisionision_angle = Math.atan2(dy, dx);
_root.sounds.attachSound("zang");
_root.sounds.start(0.04, 0);
sparks = attachMovie("sparks", "sparks" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
sparks._x = ball1._x - (Math.cos(collisionision_angle) * (distance / 2));
sparks._y = ball1._y - (Math.sin(collisionision_angle) * (distance / 2));
if (_root.spedUp == false) {
sparks._xscale = (sparks._yscale = ((Math.abs(ball1.yspeed - ball2.yspeed) + Math.abs(ball1.xspeed - ball2.xspeed)) / 12) * 200);
} else {
sparks._xscale = (sparks._yscale = ((Math.abs(ball1.yspeed - ball2.yspeed) + Math.abs(ball1.xspeed - ball2.xspeed)) / 12) * 100);
}
if (sfx != false) {
if (_root.spedUp == false) {
_root.sounds.setVolume(((Math.abs(ball1.yspeed - ball2.yspeed) + Math.abs(ball1.xspeed - ball2.xspeed)) / 12) * 200);
} else {
_root.sounds.setVolume(((Math.abs(ball1.yspeed - ball2.yspeed) + Math.abs(ball1.xspeed - ball2.xspeed)) / 12) * 100);
}
} else {
_root.sounds.setVolume(0);
}
magnitude_1 = Math.sqrt((ball1.xspeed * ball1.xspeed) + (ball1.yspeed * ball1.yspeed));
magnitude_2 = Math.sqrt((ball2.xspeed * ball2.xspeed) + (ball2.yspeed * ball2.yspeed));
if (_root.respawn == false) {
magnitude_1 = (magnitude_1 / 8) * 7;
magnitude_2 = (magnitude_2 / 8) * 7;
}
direction_1 = Math.atan2(ball1.yspeed, ball1.xspeed);
direction_2 = Math.atan2(ball2.yspeed, ball2.xspeed);
new_xspeed_1 = magnitude_1 * Math.cos(direction_1 - collisionision_angle);
new_yspeed_1 = magnitude_1 * Math.sin(direction_1 - collisionision_angle);
new_xspeed_2 = magnitude_2 * Math.cos(direction_2 - collisionision_angle);
new_yspeed_2 = magnitude_2 * Math.sin(direction_2 - collisionision_angle);
final_xspeed_1 = (((ball1.mass - ball2.mass) * new_xspeed_1) + ((ball2.mass + ball2.mass) * new_xspeed_2)) / (ball1.mass + ball2.mass);
final_xspeed_2 = (((ball1.mass + ball1.mass) * new_xspeed_1) + ((ball2.mass - ball1.mass) * new_xspeed_2)) / (ball1.mass + ball2.mass);
final_yspeed_1 = new_yspeed_1;
final_yspeed_2 = new_yspeed_2;
if (_root.spedUp == false) {
ball1.xspeed = 1.1 * ((Math.cos(collisionision_angle) * final_xspeed_1) + (Math.cos(collisionision_angle + (Math.PI/2)) * final_yspeed_1));
ball1.yspeed = 1.1 * ((Math.sin(collisionision_angle) * final_xspeed_1) + (Math.sin(collisionision_angle + (Math.PI/2)) * final_yspeed_1));
ball2.xspeed = 1.1 * ((Math.cos(collisionision_angle) * final_xspeed_2) + (Math.cos(collisionision_angle + (Math.PI/2)) * final_yspeed_2));
ball2.yspeed = 1.1 * ((Math.sin(collisionision_angle) * final_xspeed_2) + (Math.sin(collisionision_angle + (Math.PI/2)) * final_yspeed_2));
} else {
ball1.xspeed = 1.7 * ((Math.cos(collisionision_angle) * final_xspeed_1) + (Math.cos(collisionision_angle + (Math.PI/2)) * final_yspeed_1));
ball1.yspeed = 1.7 * ((Math.sin(collisionision_angle) * final_xspeed_1) + (Math.sin(collisionision_angle + (Math.PI/2)) * final_yspeed_1));
ball2.xspeed = 1.7 * ((Math.cos(collisionision_angle) * final_xspeed_2) + (Math.cos(collisionision_angle + (Math.PI/2)) * final_yspeed_2));
ball2.yspeed = 1.7 * ((Math.sin(collisionision_angle) * final_xspeed_2) + (Math.sin(collisionision_angle + (Math.PI/2)) * final_yspeed_2));
}
line = ((ball1._width / 2) + (ball2._width / 2)) - 2.5;
ball1._x = ball1._x + ((Math.cos(collisionision_angle) * (line - distance)) / 2);
ball1._y = ball1._y + ((Math.sin(collisionision_angle) * (line - distance)) / 2);
ball2._x = ball2._x + ((Math.cos(collisionision_angle) * (-(line - distance))) / 2);
ball2._y = ball2._y + ((Math.sin(collisionision_angle) * (-(line - distance))) / 2);
ball1.lastTouch = ball2.num;
ball2.lastTouch = ball1.num;
}
stop();
var ballNum = 0;
var controls1 = new Array(38, 40, 37, 39);
var controls2 = new Array(87, 83, 65, 68);
var controls3 = new Array(73, 75, 74, 76);
var spotAngle = 90;
var humanNum = 0;
var Paused = true;
var maxspeed = 6;
var clockrun = false;
var swap = 0;
var colors = new Array("red", "blue", "green", "yellow", "pink", "purple");
var playersOnArena = players;
var scores = new Array();
p = 0;
while (p < players) {
scores[p] = 0;
p++;
}
arena.fill.gotoAndPlay(1 + ((Math.floor(Math.random() * 8) + 1) * 250));
arena.fill.stop();
var bscore = undefined;
var mins = 0;
var secs = 0;
var spedUp = false;
var msecs = 0;
var oSec = 0;
var fps = 30;
var linedepths = 200;
var finished = false;
var redder = 0.2;
var started = false;
if (sfx != false) {
_root.sounds.attachSound("321");
_root.sounds.start(0, 0);
_root.sounds.setVolume(100);
}
onKeyDown = function () {
key = Key.getCode();
if ((key == 80) || (key == 27)) {
Pause(false);
}
if (key == 77) {
if (musicplaying != undefined) {
musicplaying = undefined;
music.attachSound("song");
music.start(mspot, 999);
mspot = 0;
} else {
musicplaying = false;
mspot = music.position / 1000;
music.stop();
}
}
if (key == 78) {
if (sfx != undefined) {
sfx = undefined;
} else {
sfx = false;
}
}
if (key == 13) {
restart();
}
if (key == 81) {
if (_root._quality == "HIGH") {
_root._quality = "LOW";
} else if (_root._quality == "LOW") {
_root._quality = "MEDIUM";
} else if (_root._quality == "MEDIUM") {
_root._quality = "HIGH";
}
}
};
if (respawn == true) {
fpscounter = setInterval(oneSec, 1000);
mins = 1;
secs = 0;
} else {
timetxt._visible = false;
}
wintext._visible = false;
cover._visible = false;
redscore._visible = false;
bluescore._visible = false;
greenscore._visible = false;
yellowscore._visible = false;
pinkscore._visible = false;
purplescore._visible = false;
pausemenu._visible = false;
pressentericon._visible = false;
a = 0;
while (a < 6) {
if (affs[a] != undefined) {
addBall(colors[a], affs[a], ctrls[a], diffs[a]);
}
a++;
}
onEnterFrame = function () {
if (playersOnArena <= 1) {
_root.finished = true;
w = 1;
while (w <= players) {
if (_root["ball" + w].falling != true) {
_root.winner = _root["ball" + w].ballcolor;
break;
}
_root.winner = "draw";
w++;
}
if (sfx != false) {
sounds.attachSound(winner + "wins");
sounds.start(0, 0);
sounds.setVolume(100);
}
cover._visible = true;
cover.swapDepths(_root.getNextHighestDepth());
wintext.swapDepths(_root.getNextHighestDepth());
wintext.gotoAndStop(_root.winner);
wintext._visible = true;
gotoMenu = setInterval(menu, 3000);
onEnterFrame = undefined;
}
spedUp = true;
pressentericon._visible = true;
i = 1;
while (i <= 6) {
if (_root["ball" + i].onEnterFrame == humanControl) {
spedUp = false;
pressentericon._visible = false;
}
i++;
}
if (((respawn != true) && (_root.Paused == false)) && (_root.arena._width > 100)) {
if (spedUp != true) {
_root.arena._width = _root.arena._width - _root.redder;
_root.arena._height = _root.arena._height - _root.redder;
} else {
_root.arena._width = _root.arena._width - (_root.redder * 4);
_root.arena._height = _root.arena._height - (_root.redder * 4);
_root.arena.fill.gotoAndPlay(_root.arena.fill._currentframe + 3);
}
}
if (presstimer > 0) {
pressability = false;
presstimer--;
} else {
pressability = true;
}
if (run == true) {
startstop.text = "stop";
} else {
startstop.text = "start";
}
addMsec();
oSec++;
g = 1;
while (g <= players) {
if (respawn == true) {
_root[_root["ball" + g].ballcolor + "score"]._visible = true;
_root[_root["ball" + g].ballcolor + "score"].text = scores[g - 1];
}
g++;
}
x = 1;
while (x < players) {
y = x + 1;
while (y <= players) {
if ((_root["ball" + x].collisiontime <= 0) && (_root["ball" + y].collisiontime <= 0)) {
if ((_root["ball" + x].falling == false) && (_root["ball" + y].falling == false)) {
if (spedUp == false) {
distance_x = Math.abs((_root["ball" + x]._x + _root["ball" + x].xspeed) - (_root["ball" + y]._x + _root["ball" + y].xspeed));
distance_y = Math.abs((_root["ball" + x]._y + _root["ball" + x].yspeed) - (_root["ball" + y]._y + _root["ball" + y].yspeed));
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
line = ((_root["ball" + x]._width / 2) + (_root["ball" + y]._width / 2)) - 5;
if (((distance < line) && (_root["ball" + x].invinsibility == false)) && (_root["ball" + y].invinsibility == false)) {
_root["ball" + x].collision = 1;
_root["ball" + y].collision = 1;
_root["ball" + x].collisiontime = 2;
_root["ball" + y].collisiontime = 2;
manageBounce(_root["ball" + x], _root["ball" + y]);
} else if (distance >= line) {
_root["ball" + x].collision = 0;
_root["ball" + y].collision = 0;
}
} else {
i = 4;
while (i > 0) {
distance_x = Math.abs((_root["ball" + x]._x + (_root["ball" + x].xspeed / i)) - (_root["ball" + y]._x + (_root["ball" + y].xspeed / i)));
distance_y = Math.abs((_root["ball" + x]._y + (_root["ball" + x].yspeed / i)) - (_root["ball" + y]._y + (_root["ball" + y].yspeed / i)));
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
line = ((_root["ball" + x]._width / 2) + (_root["ball" + y]._width / 2)) - 5;
if (((distance < line) && (_root["ball" + x].invinsibility == false)) && (_root["ball" + y].invinsibility == false)) {
_root["ball" + x].collision = 1;
_root["ball" + y].collision = 1;
_root["ball" + x].collisiontime = 2;
_root["ball" + y].collisiontime = 2;
manageBounce(_root["ball" + x], _root["ball" + y]);
} else if (distance >= line) {
_root["ball" + x].collision = 0;
_root["ball" + y].collision = 0;
}
i--;
}
}
}
}
y++;
}
x++;
}
i = 1;
while (i <= players) {
if ((((_root["ball" + i] != undefined) && (_root.started == true)) && (_root["ball" + i].falling != true)) && (_root.Paused == false)) {
line = _root.attachMovie("line", "line" + linedepths, linedepths);
line._x = _root["ball" + i]._x;
line._y = _root["ball" + i]._y;
line.onEnterFrame = function () {
if (_root.Paused == false) {
if (this.gr._alpha > 0) {
this.gr._alpha = this.gr._alpha - 5;
this.gr._xscale = this.gr._xscale - 3;
this.gr._yscale = this.gr._yscale - 3;
} else {
this.removeMovieClip();
}
}
};
if (linedepths < 400) {
linedepths++;
} else {
linedepths = 200;
}
}
i++;
}
if ((((mins <= 0) && (secs <= 0)) && (msecs <= 8.69565217391304)) && (respawn == true)) {
msecs = 0;
secs = 0;
mins = 0;
endGame();
onEnterFrame = undefined;
clockrun = false;
}
if (msecs < 10) {
mtext = "0" + Math.floor(msecs);
} else {
mtext = Math.floor(msecs);
}
if (secs < 10) {
stext = "0" + secs;
} else {
stext = secs;
}
timetxt.text = (((mins + ":") + stext) + ".") + mtext;
};
Key.addListener(this);
pausemenu.resumebtn.onRelease = function () {
Pause(false);
};
pausemenu.menubtn.onRelease = function () {
menu();
};
pausemenu.restartbtn.onRelease = function () {
restart();
};
Symbol 39 MovieClip [line] Frame 1
stop();
Symbol 41 MovieClip [sparks] Frame 10
this.removeMovieClip();
Symbol 52 MovieClip Frame 1
stop();
Symbol 78 MovieClip Frame 1
stop();
Symbol 84 MovieClip Frame 1
stop();
Symbol 127 MovieClip Frame 126
_root.Pause(true);
Symbol 127 MovieClip Frame 165
stop();
Symbol 145 MovieClip Frame 1
stop();