Frame 1
function pmgHandler() {
if (_root.lang == "eng") {
getURL ("http://www.gamesheep.com", "_blank");
} else {
getURL ("http://www.ejocuri.ro", "_blank");
}
}
function atgHandler() {
if (_root.lang == "eng") {
getURL ("http://www.ejocuri.ro/jocuri-pentru-site.php", "_blank");
} else {
getURL ("http://www.gamesheep.com/free-games-for-website.php", "_blank");
}
}
_root.lang = "eng";
instructiuni = "The battle between the two best clubs in the world in 2007 is not over yet!";
_root.locatie = _url;
Stage.scaleMode = "noScale";
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
if (_root.lang == "eng") {
var menuItem_cmi = new ContextMenuItem("Play More Games", pmgHandler);
myMenu.customItems.push(menuItem_cmi);
var menuItem_cmi = new ContextMenuItem("Add This Game Your Website", atgHandler);
myMenu.customItems.push(menuItem_cmi);
} else {
var menuItem_cmi = new ContextMenuItem("Mai multe jocuri", pmgHandler);
myMenu.customItems.push(menuItem_cmi);
var menuItem_cmi = new ContextMenuItem("Adauga jocul pe site-ul tau", atgHandler);
myMenu.customItems.push(menuItem_cmi);
}
this.menu = myMenu;
Instance of Symbol 72 MovieClip in Frame 3
//component parameters
onClipEvent (construct) {
instructiuni = "instructiunile jocului";
_root.locked = false;
}
Frame 4
if (_root.lang == "rom") {
_root.locatie = _url;
if (_root.locatie.slice(0, 21) == "http://www.ejocuri.ro") {
play();
} else {
gotoAndPlay ("preloadFinished");
}
} else {
_root.locatie = _url;
if (_root.locatie.slice(0, 24) == "http://www.gamesheep.com") {
play();
} else {
gotoAndPlay ("preloadFinished");
}
}
Frame 8
if (lang == "eng") {
kickofftxt = "KICK OFF";
pleasewaittxt = "PLEASE WAIT";
skiptxt = "PRESS X TO SKIP";
gotxt = "GO!!";
goaltxt = "GOAL!!";
scorertxt = "SCORER";
ptstxt = "PTS";
halftimetxt = "HALF TIME";
goalstxt = "GOALS";
shotstxt = "SHOTS";
possesiontxt = "POSSESION";
efficiencytxt = "EFFICIENCY";
htscoretxt = "FINAL SCORE";
continuetxt = "CONTINUE";
fulltimetxt = "FULL TIME";
submittxt = "SUBMIT SCORE";
mainmenutxt = "MAIN MENU";
chooseteamtxt = "CHOOSE YOUR CLUB";
} else {
kickofftxt = "INCEPE REPRIZA";
pleasewaittxt = "ASTEAPTA";
skiptxt = "APASA X PENTRU A CONTINUA";
gotxt = "START!!";
goaltxt = "GOOL!!";
scorertxt = "A INSCRIS";
ptstxt = "PCT";
halftimetxt = "PAUZA";
goalstxt = "GOLURI";
shotstxt = "SHOTS";
possesiontxt = "POSESIE";
efficiencytxt = "EFICIENTA";
htscoretxt = "SCOR FINAL";
continuetxt = "CONTINUA";
fulltimetxt = "FINAL DE PARTIDA";
submittxt = "TRIMITE SCORUL";
mainmenutxt = "JOACA DIN NOU";
chooseteamtxt = "ALEGE O ECHIPA";
}
if (lang == "eng") {
menu0 = "START GAME";
menu1 = "TOP 50";
menu2 = "INSTRUCTIONS";
menu3 = "PLAY MORE GAMES";
menu4 = "ADD THIS GAME TO YOUR WEBSITE";
} else {
menu0 = "START JOC";
menu1 = "TOP 50";
menu2 = "INSTRUCTIUNI";
menu3 = "MAI MULTE JOCURI";
menu4 = "ADAUGA ACEST JOC PE SITUL TAU";
}
sunet = 1;
muzica = 1;
s_muzica = new Sound(soundmc);
s_muzica.attachSound("muzica");
s_gol1 = new Sound();
s_gol1.attachSound("gol1");
s_gol2 = new Sound();
s_gol2.attachSound("gol2");
s_arbitru1 = new Sound();
s_arbitru1.attachSound("arbitru1");
s_arbitru2 = new Sound();
s_arbitru2.attachSound("arbitru1");
s_arbitru3 = new Sound();
s_arbitru3.attachSound("arbitru1");
s_muzica.start(0, 9999);
s_muzica.setVolume(80);
Frame 9
stop();
s_muzica.setVolume(80);
Frame 10
stop();
Frame 11
_root.gotoAndStop("coperta");
Frame 12
score = 0;
score1 = 0;
score2 = 0;
teamshort1 = "LIV";
teamshort2 = "MIL";
teamlong1 = "LIVERPOOL";
teamlong2 = "MILAN";
playernames1 = ["C.BELLAMY", "S. GERRARD", "J.CARRAGHER"];
playernames2 = ["A.PIRLO", "KAKA", "F.INZAGHI"];
scoremsg = (((((teamshort1 + " ") + score1) + " - ") + score2) + " ") + teamshort2;
actcontroller1 = controller1;
actcontroller2 = controller2;
Frame 14
timermc.timelimit = (timelimitini = 2700 + random(120));
stuntime = 16;
camElastPlayer = 8;
camElastBall = 16;
camElast = camElastPlayer;
playersperteam = 4;
playerspeed = 4;
playerspeed45 = Math.round(Math.sqrt((playerspeed * playerspeed) / 2) * 100) / 100;
fatigueini = 1;
linedup = 0;
friction = 0.97;
ballradius = 8;
playerradius = 10;
playerballdist = ballradius + playerradius;
gameStarted = false;
pointvariation = 70;
balldist = playerballdist + 5;
balldist45 = Math.round(Math.sqrt((balldist * balldist) / 2) * 100) / 100;
shootframes = 12;
passframes = 4;
changetime = 15;
fatigue = 0.9;
passlimit = 50;
passspeed = 12;
maxpassspeed = 10;
maxkbspeed = 8;
passrandom = 7;
scored = 0;
half = 1;
keepspeed1 = 3;
keepspeed2 = 8;
jumpframes1 = 18;
jumpframes2 = 25;
disttojump = 60;
keepertime = 72;
ballframe = 1;
stat = "live";
timetocheer = 60;
scoutcount = 0;
possesion1 = 0;
possesion2 = 0;
shots1 = 0;
shots2 = 0;
timetxt = "00:00 (1st)";
defensivex = [0, 0, 0, 260, 400, 530, 260, 397, 520];
defensivey = [0, 0, 0, 828, 847, 827, 261, 238, 261];
offensivex = [0, 0, 0, 210, 380, 580, 200, 390, 580];
offensivey = [0, 0, 0, 307, 327, 307, 771, 751, 771];
keeper1x = [0, 334, 394, 454];
keeper1y = [0, 958, 948, 958];
keeper2x = [0, 334, 394, 454];
keeper2y = [0, 148, 158, 148];
goal2x = [0, 324, 394, 464];
goal2y = [0, 983, 983, 983];
goal1x = [0, 324, 394, 464];
goal1y = [0, 103, 103, 103];
lineupx = [0, 0, 0, 240, 410, 580, 240, 390, 520];
lineupy = [0, 0, 0, 610, 653, 580, 490, 440, 460];
lineuprot = [0, 0, 0, 2, 1, 8, 4, 5, 6];
team1 = [1, 3, 4, 5];
team2 = [2, 6, 7, 8];
game.player1._type = "keeper";
game.player2._type = "keeper";
game.player1.no = 1;
game.player2.no = 2;
game.player1.xtemp = game.player1._x;
game.player2.xtemp = game.player2._x;
game.player1.ytemp = game.player1._y;
game.player2.ytemp = game.player2._y;
game.player1.vx = 0;
game.player1.vy = 0;
game.player2.vx = 0;
game.player2.vy = 0;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i]._type = "field";
game["player" + i]._stat = "lineup";
game["player" + i].vx = 0;
game["player" + i].vy = 0;
game["player" + i].rot = 7;
game["player" + i].xtemp = game["player" + i]._x;
game["player" + i].ytemp = game["player" + i]._y;
game["player" + i].no = i;
if (i < (2 + playersperteam)) {
game["player" + i].team = 1;
} else {
game["player" + i].team = 2;
}
i++;
}
i = 1;
while (i <= 4) {
game["post" + i].xtemp = game["post" + i]._x;
game["post" + i].ytemp = game["post" + i]._y;
i++;
}
game.ball._stat = "free";
game.ball.vx = 0;
game.ball.vy = 0;
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
i = 1;
while (i <= 8) {
_root["_pposx" + i] = new Array();
_root["_pposy" + i] = new Array();
_root["_pframea" + i] = new Array();
_root["_pframeb" + i] = new Array();
i++;
}
_bposx = new Array();
_bposy = new Array();
_bframe = new Array();
_brot = new Array();
_tposx = new Array();
_tposy = new Array();
replayspeedini = 2;
replaytime = 192;
function startGame() {
scorerTeam = 0;
game.tribune.vx = 0;
game.tribune.vy = 0;
camTarg = game.tribune;
camElast = camElastBall;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i].onEnterFrame = function () {
uncontWOB(this);
};
i++;
}
game.player1._stat = "stay";
game.player2._stat = "stay";
game.player1.onEnterFrame = function () {
keeperEF(game.player1);
};
game.player2.onEnterFrame = function () {
keeperEF(game.player2);
};
if (half == 1) {
game.player1.gotoAndStop(1);
i = 3;
while (i <= (1 + playersperteam)) {
game["player" + i].gotoAndStop(1);
i++;
}
game.player2.gotoAndStop(2);
i = playersperteam + 2;
while (i <= (2 * playersperteam)) {
game["player" + i].gotoAndStop(2);
i++;
}
} else {
game.player1.gotoAndStop(2);
i = 3;
while (i <= (1 + playersperteam)) {
game["player" + i].gotoAndStop(2);
i++;
}
game.player2.gotoAndStop(1);
i = playersperteam + 2;
while (i <= (2 * playersperteam)) {
game["player" + i].gotoAndStop(1);
i++;
}
}
game.player1.anim.gotoAndStop("kstay1");
game.player2.anim.gotoAndStop("kstay2");
game.player1._x = keeper1x[2];
game.player1._y = keeper1y[2];
game.player1.tempx = game.player1._x;
game.player1.tempy = game.player1._y;
game.player2._x = keeper2x[2];
game.player2._y = keeper2y[2];
game.player2.tempx = game.player2._x;
game.player2.tempy = game.player2._y;
messages.gotoAndPlay("begin");
}
function resetPlayers() {
i = 1;
while (i <= 8) {
game["player" + i].highlightmc.gotoAndStop(1);
i++;
}
game.player1._type = "keeper";
game.player2._type = "keeper";
game.player1.no = 1;
game.player2.no = 2;
game.player1.xtemp = game.player1._x;
game.player2.xtemp = game.player2._x;
game.player1.ytemp = game.player1._y;
game.player2.ytemp = game.player2._y;
game.player1.vx = 0;
game.player1.vy = 0;
game.player2.vx = 0;
game.player2.vy = 0;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i]._type = "field";
game["player" + i]._stat = "lineup";
game["player" + i].vx = 0;
game["player" + i].vy = 0;
game["player" + i].rot = 7;
game["player" + i].xtemp = game["player" + i]._x;
game["player" + i].ytemp = game["player" + i]._y;
game["player" + i].no = i;
if (i < (2 + playersperteam)) {
game["player" + i].team = 1;
} else {
game["player" + i].team = 2;
}
i++;
}
i = 1;
while (i <= 4) {
game["post" + i].xtemp = game["post" + i]._x;
game["post" + i].ytemp = game["post" + i]._y;
i++;
}
game.ball._stat = "free";
game.ball.vx = 0;
game.ball.vy = 0;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i].onEnterFrame = function () {
uncontWOB(this);
};
i++;
}
game.player1._stat = "stay";
game.player2._stat = "stay";
game.player1.onEnterFrame = function () {
keeperEF(game.player1);
};
game.player2.onEnterFrame = function () {
keeperEF(game.player2);
};
replayer.gotoAndStop(1);
skiper.play();
game.ball.xtemp = 400;
game.ball.ytemp = 550;
game.ball._x = 400;
game.ball._y = 550;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i].xtemp = lineupx[game["player" + i].no] + 20;
game["player" + i].ytemp = lineupy[game["player" + i].no] + 20;
game["player" + i]._stat = "lineup";
i++;
}
stat = "live";
game.ball._stat = "free";
scoutchooser.play();
}
function chooseScout() {
if (game.ball._stat == "free") {
var _local4 = 10000;
var _local6 = game.ball._x;
var _local5 = game.ball._y;
i = 1;
while (i < playersperteam) {
var _local2 = game["player" + team1[i]]._x - _local6;
var _local1 = game["player" + team1[i]]._y - _local5;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 < _local4) {
if (((game["player" + team1[i]]._stat == "runscout") || (game["player" + team1[i]]._stat == "runstay")) || (game["player" + team1[i]]._stat == "runrun")) {
_local4 = _local3;
var chosen1 = team1[i];
}
}
i++;
}
_local4 = 10000;
i = 1;
while (i < playersperteam) {
var _local2 = game["player" + team2[i]]._x - _local6;
var _local1 = game["player" + team2[i]]._y - _local5;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 < _local4) {
if (((game["player" + team2[i]]._stat == "runscout") || (game["player" + team2[i]]._stat == "runstay")) || (game["player" + team2[i]]._stat == "runrun")) {
_local4 = _local3;
var chosen2 = team2[i];
}
}
i++;
}
delete game["player" + chosen1].onEnterFrame;
delete game["player" + chosen2].onEnterFrame;
game["player" + chosen1].onEnterFrame = function () {
uncontWOB(game["player" + chosen1]);
};
game["player" + chosen2].onEnterFrame = function () {
uncontWOB(game["player" + chosen2]);
};
game["player" + chosen1]._stat = "scout";
game["player" + chosen2]._stat = "scout";
}
if (game.ball._stat == "player") {
if (game.ball.team == 2) {
var _local4 = 10000;
var _local6 = game.ball._x;
var _local5 = game.ball._y;
i = 1;
while (i < playersperteam) {
var _local2 = game["player" + team1[i]]._x - _local6;
var _local1 = game["player" + team1[i]]._y - _local5;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 < _local4) {
if (((game["player" + team1[i]]._stat == "runscout") || (game["player" + team1[i]]._stat == "runstay")) || (game["player" + team1[i]]._stat == "runrun")) {
_local4 = _local3;
var chosen1 = team1[i];
}
}
i++;
}
game["player" + chosen1].onEnterFrame = function () {
uncontWOB(game["player" + chosen1]);
};
game["player" + chosen1]._stat = "scout";
i = 1;
while (i < playersperteam) {
if (game["player" + team1[i]]._stat != "scout") {
game["player" + team1[i]]._stat = "defensive";
}
i++;
}
} else {
var _local4 = 10000;
var _local6 = game.ball._x;
var _local5 = game.ball._y;
i = 1;
while (i < playersperteam) {
var _local2 = game["player" + team2[i]]._x - _local6;
var _local1 = game["player" + team2[i]]._y - _local5;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 < _local4) {
if (((game["player" + team2[i]]._stat == "runscout") || (game["player" + team2[i]]._stat == "runstay")) || (game["player" + team2[i]]._stat == "runrun")) {
_local4 = _local3;
var chosen2 = team2[i];
}
}
i++;
}
game["player" + chosen2]._stat = "scout";
game["player" + chosen2].onEnterFrame = function () {
uncontWOB(game["player" + chosen2]);
};
i = 1;
while (i < playersperteam) {
if (game["player" + team2[i]]._stat != "scout") {
game["player" + team2[i]]._stat = "defensive";
}
i++;
}
}
}
}
function keeperEF(who) {
if (who._stat == "stay") {
if (scored == 0) {
who.targx = _root[("keeper" + who.no) + "x"][2];
who.targy = _root[("keeper" + who.no) + "y"][2];
if (who.targx > who.xtemp) {
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.anim.gotoAndStop("krunleft" + who.no);
}
who._stat = "runstay";
} else {
who._stat = "idle";
who.vx = 0;
who.vy = 0;
if (_root.scorerTeam == who.no) {
who.anim.gotoAndStop(33 + random(2));
} else {
who.anim.gotoAndStop(38 + random(2));
}
}
}
if (who._stat == "runstay") {
if (who.targx > who.xtemp) {
who.vx = keepspeed1;
} else if (who.targx < who.xtemp) {
who.vx = -keepspeed1;
}
if (Math.abs(who.targx - who.xtemp) < keepspeed1) {
who.vx = 0;
}
if (who.targy > who.ytemp) {
who.vy = keepspeed1;
} else if (who.targy < who.ytemp) {
who.vy = -keepspeed1;
}
if (Math.abs(who.targy - who.ytemp) < keepspeed1) {
who.vy = 0;
}
if ((who.vy == 0) && (who.vx == 0)) {
who.anim.gotoAndStop("kstay" + who.no);
}
if (checkCollision(who, game.ball)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > maxkbspeed) {
bouncer.bounce(game["player" + who.no], game.ball);
} else {
who._stat = "ball";
}
}
if (who.no == 1) {
if (game.ball.ytemp > 700) {
who._stat = "topoint";
}
} else if (game.ball.ytemp < 400) {
who._stat = "topoint";
}
}
if (who._stat == "topoint") {
if (game.ball.xtemp < 290) {
whatpoint = 1;
} else if ((game.ball.xtemp >= 290) && (game.ball.xtemp <= 510)) {
whatpoint = 2;
} else if (game.ball.xtemp > 510) {
whatpoint = 3;
}
who.targx = _root[("keeper" + who.no) + "x"][whatpoint];
who.targy = _root[("keeper" + who.no) + "y"][whatpoint];
if (who.targx > who.xtemp) {
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.anim.gotoAndStop("krunleft" + who.no);
}
who._stat = "runtopoint";
}
if (who._stat == "runtopoint") {
if (game.ball.xtemp < 290) {
whatpoint = 1;
} else if ((game.ball.xtemp >= 290) && (game.ball.xtemp <= 510)) {
whatpoint = 2;
} else if (game.ball.xtemp > 510) {
whatpoint = 3;
}
who.targx = _root[("keeper" + who.no) + "x"][whatpoint];
who.targy = _root[("keeper" + who.no) + "y"][whatpoint];
if (who.targx > who.xtemp) {
who.vx = keepspeed1;
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.vx = -keepspeed1;
who.anim.gotoAndStop("krunleft" + who.no);
}
if (Math.abs(who.targx - who.xtemp) < keepspeed1) {
who.vx = 0;
}
if (who.targy > who.ytemp) {
who.vy = keepspeed1;
} else if (who.targy < who.ytemp) {
who.vy = -keepspeed1;
}
if (Math.abs(who.targy - who.ytemp) < keepspeed1) {
who.vy = 0;
}
if ((who.vy == 0) && (who.vx == 0)) {
who.anim.gotoAndStop("kstay" + who.no);
}
if (checkCollision(who, game.ball)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > maxkbspeed) {
bouncer.bounce(game["player" + who.no], game.ball);
} else {
who._stat = "ball";
}
}
if (who.no == 1) {
if (game.ball.ytemp < 700) {
who._stat = "stay";
}
} else if (game.ball.ytemp > 400) {
who._stat = "stay";
}
if (who.no == 1) {
if (game.ball.ytemp > 880) {
if ((game.ball.xtemp > 225) && (game.ball.xtemp < 575)) {
who._stat = "toball";
}
}
} else if (game.ball.ytemp < 220) {
if ((game.ball.xtemp > 225) && (game.ball.xtemp < 575)) {
who._stat = "toball";
}
}
}
if (who._stat == "toball") {
who.targx = game.ball.xtemp;
who.targy = game.ball.ytemp;
if (who.targx > who.xtemp) {
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.anim.gotoAndStop("krunleft" + who.no);
}
who._stat = "runtoball";
}
if (who._stat == "runtoball") {
who.targx = game.ball.xtemp;
who.targy = game.ball.ytemp;
if (who.targx > who.xtemp) {
who.vx = keepspeed1;
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.vx = -keepspeed1;
who.anim.gotoAndStop("krunleft" + who.no);
}
if (Math.abs(who.targx - who.xtemp) < keepspeed1) {
who.vx = 0;
}
if (who.targy > who.ytemp) {
who.vy = keepspeed1;
} else if (who.targy < who.ytemp) {
who.vy = -keepspeed1;
}
if (Math.abs(who.targy - who.ytemp) < keepspeed1) {
who.vy = 0;
}
if (checkCollision(who, game.ball)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > maxkbspeed) {
bouncer.bounce(game["player" + who.no], game.ball);
} else {
who._stat = "ball";
}
}
var _local5 = game.ball.xtemp - who.xtemp;
var _local4 = game.ball.ytemp - who.ytemp;
var _local3 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
if (who.no == 1) {
if (game.ball.ytemp < 880) {
who._stat = "stay";
}
} else if (game.ball.ytemp > 220) {
who._stat = "stay";
}
if (((_local3 > disttojump) && ((game.ball.xtemp + (3 * game.ball.vx)) > who.xtemp)) && (game)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > 8) {
if ((game.ball.xtemp > 225) && (game.ball.xtemp < 575)) {
if ((who.no == 1) && (game.ball.vy > 0)) {
whichdirection = "right";
who._stat = "jump";
} else if ((who.no == 2) && (game.ball.vy < 0)) {
whichdirection = "right";
who._stat = "jump";
}
}
}
} else if ((_local3 > disttojump) && ((game.ball.xtemp + (3 * game.ball.vx)) < who.xtemp)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > 8) {
if ((game.ball.xtemp > 225) && (game.ball.xtemp < 575)) {
if ((who.no == 1) && (game.ball.vy > 0)) {
whichdirection = "left";
who._stat = "jump";
} else if ((who.no == 2) && (game.ball.vy < 0)) {
whichdirection = "left";
who._stat = "jump";
}
}
}
}
}
if (who._stat == "jump") {
who.anim.gotoAndStop(("kjump" + whichdirection) + who.no);
if (whichdirection == "right") {
who.vx = keepspeed2;
} else {
who.vx = -keepspeed2;
}
who.jumpcounter = 0;
who.vy = 0;
who._stat = "runjump";
}
if (who._stat == "runjump") {
who.jumpcounter++;
if (who.jumpcounter == (jumpframes1 - 6)) {
who.vx = who.vx / 2;
}
if (who.jumpcounter == jumpframes1) {
who.vx = 0;
}
if (who.jumpcounter == jumpframes2) {
who._stat = "stay";
}
if (checkCollision(who, game.ball)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > maxkbspeed) {
bouncer.bounce(game["player" + who.no], game.ball);
} else {
who._stat = "pickup";
}
}
}
if (who._stat == "pickup") {
arrows1.gotoAndStop(1);
arrows2.gotoAndStop(1);
game.ball._stat = "keeper";
scoutchooser.stop();
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i]._stat = "defensive";
i++;
}
who.vx = 0;
who.vy = 0;
game.ball.vx = 0;
game.ball.vy = 0;
pickupcounter = 0;
game.ball._x = who._x;
if (who.no == 1) {
game.ball._y = who._y - 16;
} else {
game.ball._y = who._y + 16;
}
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
if (whichdirection == "right") {
who.anim.gotoAndStop("kjumpright" + who.no);
who.anim.inside.gotoAndPlay("ridic");
} else {
who.anim.gotoAndStop("kjumpleft" + who.no);
who.anim.inside.gotoAndPlay("ridic");
}
who._stat = "runpickup";
}
if (who._stat == "runpickup") {
pickupcounter++;
if (pickupcounter >= 8) {
who._stat = "ball";
}
}
if (who._stat == "ball") {
i = 1;
while (i <= 8) {
game["player" + i].highlightmc.gotoAndStop(1);
i++;
}
arrows1.gotoAndStop(1);
arrows2.gotoAndStop(1);
game.ball._stat = "keeper";
scoutchooser.stop();
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i]._stat = "defensive";
i++;
}
who.keeptimer = 0;
who.targx = _root[("keeper" + who.no) + "x"][2];
who.targy = _root[("keeper" + who.no) + "y"][2];
if (who.targx > who.xtemp) {
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.anim.gotoAndStop("krunleft" + who.no);
}
who._stat = "runball";
}
if (who._stat == "runball") {
camTarg = who;
if (who.targx > who.xtemp) {
who.vx = keepspeed1;
} else if (who.targx < who.xtemp) {
who.vx = -keepspeed1;
}
if (Math.abs(who.targx - who.xtemp) < keepspeed1) {
who.vx = 0;
}
if (who.targy > who.ytemp) {
who.vy = keepspeed1;
} else if (who.targy < who.ytemp) {
who.vy = -keepspeed1;
}
if (Math.abs(who.targy - who.ytemp) < keepspeed1) {
who.vy = 0;
}
if ((who.vy == 0) && (who.vx == 0)) {
who.anim.gotoAndStop("kstay" + who.no);
}
game.ball._x = who._x;
if (who.no == 1) {
game.ball._y = who._y - 16;
} else {
game.ball._y = who._y + 16;
}
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
who.keeptimer++;
if (who.keeptimer >= keepertime) {
who._stat = "pass";
}
}
if (who._stat == "pass") {
bounceBall();
scoutchooser.gotoAndPlay(1);
if (who.no == 1) {
passchosen = random(3) + 3;
} else {
passchosen = random(3) + 6;
}
ptx = game["player" + passchosen]._x;
pty = game["player" + passchosen]._y;
ballx = game.ball._x;
bally = game.ball._y;
ang = Math.atan((bally - pty) / (ballx - ptx));
if (ptx < ballx) {
ang = ang + 3.14;
}
bvx = Math.cos(ang) * (passspeed - 1);
bvy = Math.sin(ang) * (passspeed - 1);
game.ball.vx = bvx;
game.ball.vy = bvy;
game.ball.xtemp = game.ball.xtemp + (4 * bvx);
game.ball.ytemp = game.ball.ytemp + (4 * bvy);
game.ball._stat = "free";
camTarg = game.ball;
camElast = camElastBall;
game["player" + passchosen]._stat = "scout";
who._stat = "stay";
}
}
function uncontWOB(who) {
who.funct = "uncontWOB";
if (who._stat == "lineup") {
who.targx = lineupx[who.no];
who.targy = lineupy[who.no];
who._stat = "runlineup";
}
if (who._stat == "runlineup") {
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = lineuprot[who.no];
who.vx = 0;
who.vy = 0;
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
} else {
who._stat = "stay";
linedup++;
if (((linedup >= ((2 * playersperteam) - 2)) && (_root.scorerTeam == 0)) && (half == 1)) {
messages.gotoAndPlay("go");
camTarg = game.ball;
}
}
who.anim.gotoAndStop(who.rot + 8);
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
} else if (who.rot == 3) {
who.vx = playerspeed45;
who.vy = 0;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
}
}
}
if (who._stat == "scout") {
who._stat = "runscout";
scoutcounter = 2;
if ((who.team == 1) && (actcontroller1 == "human")) {
i = 1;
while (i <= playersperteam) {
game["player" + team1[i]].highlightmc.gotoAndStop(1);
i++;
}
who.highlightmc.gotoAndStop(2);
_root.contplayer = who.no;
} else if ((who.team == 2) && (actcontroller2 == "human")) {
i = 1;
while (i <= playersperteam) {
game["player" + team2[i]].highlightmc.gotoAndStop(1);
i++;
}
who.highlightmc.gotoAndStop(2);
_root.contplayer = who.no;
}
}
if (who._stat == "runscout") {
who.targx = game.ball._x;
who.targy = game.ball._y;
scoutcounter++;
if (scoutcounter == 3) {
scoutcounter = 0;
if (_root.contplayer != who.no) {
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) > playerballdist)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) > playerballdist)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) > playerballdist)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) > playerballdist)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
who.targrot = 7;
}
}
} else {
if (Key.isDown(38)) {
who.targrot = 1;
}
if (Key.isDown(39)) {
who.targrot = 3;
}
if (Key.isDown(40)) {
who.targrot = 5;
}
if (Key.isDown(37)) {
who.targrot = 7;
}
if (Key.isDown(39) && (Key.isDown(38))) {
who.targrot = 2;
}
if (Key.isDown(39) && (Key.isDown(40))) {
who.targrot = 4;
}
if (Key.isDown(37) && (Key.isDown(38))) {
who.targrot = 8;
}
if (Key.isDown(37) && (Key.isDown(40))) {
who.targrot = 6;
}
}
}
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
var _local2 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local2 < maxpassspeed) {
if (who.team == 1) {
i = 1;
while (i < playersperteam) {
if ((game["player" + team1[i]]._stat != "runloseball") && (game["player" + team1[i]].funct != "uncontWB")) {
game["player" + team1[i]]._stat = "offensive";
} else if (game["player" + team1[i]].funct == "uncontWB") {
game["player" + team1[i]]._stat = "defensive";
}
if (game["player" + team2[i]]._stat != "runloseball") {
game["player" + team2[i]]._stat = "defensive";
}
i++;
}
who.oldplayer = game.ball.player;
game.ball.team = 1;
game.ball.player = who.no;
} else {
i = 1;
while (i < playersperteam) {
if ((game["player" + team2[i]]._stat != "runloseball") && (game["player" + team2[i]].funct != "uncontWB")) {
game["player" + team2[i]]._stat = "offensive";
} else if (game["player" + team2[i]].funct == "uncontWB") {
game["player" + team2[i]]._stat = "defensive";
}
if (game["player" + team1[i]]._stat != "runloseball") {
game["player" + team1[i]]._stat = "defensive";
}
i++;
}
who.oldplayer = game.ball.player;
game.ball.team = 2;
game.ball.player = who.no;
}
if (game.ball._stat == "player") {
game["player" + who.oldplayer]._stat = "loseball";
}
game.ball._stat = "player";
camTarg = who;
camElast = camElastPlayer;
who.onEnterFrame = function () {
uncontWB(who);
};
} else {
bouncer.bounce(who, game.ball);
}
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
} else if (who.rot == 3) {
who.vx = playerspeed45;
who.vy = 0;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
}
}
}
if (who._stat == "offensive") {
who.targx = (offensivex[who.no] + pointvariation) - random(2 * pointvariation);
who.targy = (offensivey[who.no] + pointvariation) - random(2 * pointvariation);
who.changecounter = 0;
changetimeax = random(changetime) + 8;
who.gonefrom = "offense";
who._stat = "runrun";
}
if (who._stat == "defensive") {
who.targx = (defensivex[who.no] + pointvariation) - random(2 * pointvariation);
who.targy = (defensivey[who.no] + pointvariation) - random(2 * pointvariation);
who.changecounter = 0;
changetimeax = random(changetime) + 8;
who.gonefrom = "defense";
who._stat = "runrun";
}
if (who._stat == "runrun") {
who.changecounter++;
if (who.changecounter > changetimeax) {
who.changecounter = 0;
if (who.gonefrom == "offense") {
who._stat = "offensive";
} else {
who._stat = "defensive";
}
}
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if (game.ball._stat == "free") {
if ((Math.abs(who._x - game.ball._x) < playerballdist) && (Math.abs(who._y - game.ball._y) < playerballdist)) {
var _local2 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local2 < maxpassspeed) {
if (who.team == 1) {
i = 1;
while (i < playersperteam) {
if ((game["player" + team1[i]]._stat != "runloseball") && (game["player" + team1[i]].funct != "uncontWB")) {
game["player" + team1[i]]._stat = "offensive";
} else if (game["player" + team1[i]].funct == "uncontWB") {
game["player" + team1[i]]._stat = "defensive";
}
if (game["player" + team2[i]]._stat != "runloseball") {
game["player" + team2[i]]._stat = "defensive";
}
i++;
}
game.ball.team = 1;
game.ball.player = who.no;
} else {
i = 1;
while (i < playersperteam) {
if ((game["player" + team2[i]]._stat != "runloseball") && (game["player" + team2[i]].funct != "uncontWB")) {
game["player" + team2[i]]._stat = "offensive";
} else if (game["player" + team2[i]].funct == "uncontWB") {
game["player" + team2[i]]._stat = "defensive";
}
if (game["player" + team1[i]]._stat != "runloseball") {
game["player" + team1[i]]._stat = "defensive";
}
i++;
}
game.ball.team = 2;
game.ball.player = who.no;
}
game.ball._stat = "player";
camTarg = who;
camElast = camElastPlayer;
who._stat = "offensive";
who.onEnterFrame = function () {
uncontWB(who);
};
} else {
bouncer.bounce(who, game.ball);
}
}
}
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
if (who.gonefrom == "offense") {
who._stat = "offensive";
} else if (who._stat != "runscout") {
who._stat = "defensive";
}
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
} else if (who.rot == 3) {
who.vx = playerspeed45;
who.vy = 0;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
}
}
}
if (who._stat == "takeball") {
who._stat = "runtakeball";
}
if (who._stat == "cheer") {
who.anim.gotoAndStop(32 + random(2));
who._stat = "runcheer";
}
if (who._stat == "runcheer") {
}
if (who._stat == "cry") {
who.anim.gotoAndStop(38 + random(2));
who._stat = "runcry";
}
if (who._stat == "runcry") {
}
if (who._stat == "stay") {
who.anim.gotoAndStop(who.rot + 8);
who._stat = "runstay";
}
if (who._stat == "runstay") {
}
}
function uncontWB(who) {
who.funct = "uncontWB";
if (half == 1) {
if (who.team == 1) {
possesion1 = possesion1 + 1;
} else {
possesion2 = possesion2 + 1;
}
} else if (who.team == 1) {
possesion1 = possesion1 + 1;
} else {
possesion2 = possesion2 + 1;
}
if (who._stat == "offensive") {
if ((who.team == 1) && (actcontroller1 == "human")) {
i = 1;
while (i <= playersperteam) {
game["player" + team1[i]].highlightmc.gotoAndStop(1);
i++;
}
who.highlightmc.gotoAndStop(2);
_root.contplayer = who.no;
} else if ((who.team == 2) && (actcontroller2 == "human")) {
i = 1;
while (i <= playersperteam) {
game["player" + team2[i]].highlightmc.gotoAndStop(1);
i++;
}
who.highlightmc.gotoAndStop(2);
_root.contplayer = who.no;
}
who.changecounter = 0;
who.targx = (offensivex[who.no] + pointvariation) - random(2 * pointvariation);
who.targy = (offensivey[who.no] + pointvariation) - random(2 * pointvariation);
who.gonefrom = "offense";
who._stat = "runrun";
}
if (who._stat == "defensive") {
who._stat = "defensive";
who.onEnterFrame = function () {
_root.uncontWOB(who);
};
}
if (who._stat == "runrun") {
who.changecounter++;
if (who.changecounter > changetimeax) {
who.changecounter = 0;
if (who.gonefrom == "offense") {
who._stat = "offensive";
} else {
who._stat = "defensive";
}
}
if (who.team == 1) {
who.bx = game.ball._x;
who.by = game.ball._y;
i = 1;
while (i < playersperteam) {
who.px = game["player" + team2[i]]._x;
who.py = game["player" + team2[i]]._y;
who.pbd = Math.sqrt(((who.bx - who.px) * (who.bx - who.px)) + ((who.by - who.py) * (who.by - who.py)));
if (who.pbd < passlimit) {
if (who._y > who.py) {
var _local2 = random(passrandom);
} else {
var _local2 = random(passrandom + 8);
}
if (_local2 == 1) {
if (_root.contplayer != who.no) {
who._stat = "pass";
}
}
}
i++;
}
} else {
who.bx = game.ball._x;
who.by = game.ball._y;
i = 1;
while (i < playersperteam) {
who.px = game["player" + team1[i]]._x;
who.py = game["player" + team1[i]]._y;
who.pbd = Math.sqrt(((who.bx - who.px) * (who.bx - who.px)) + ((who.by - who.py) * (who.by - who.py)));
if (who.pbd < passlimit) {
if (who._y < who.py) {
var _local2 = random(passrandom);
} else {
var _local2 = random(passrandom + 8);
}
if (_local2 == 1) {
if (_root.contplayer != who.no) {
who._stat = "pass";
}
}
}
i++;
}
}
if (_root.contplayer != who.no) {
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
} else {
if (Key.isDown(38)) {
who.targrot = 1;
}
if (Key.isDown(39)) {
who.targrot = 3;
}
if (Key.isDown(40)) {
who.targrot = 5;
}
if (Key.isDown(37)) {
who.targrot = 7;
}
if (Key.isDown(39) && (Key.isDown(38))) {
who.targrot = 2;
}
if (Key.isDown(39) && (Key.isDown(40))) {
who.targrot = 4;
}
if (Key.isDown(37) && (Key.isDown(38))) {
who.targrot = 8;
}
if (Key.isDown(37) && (Key.isDown(40))) {
who.targrot = 6;
}
}
if (_root.contplayer != who.no) {
if (who.team == 1) {
if (who._y < who.targy) {
who._stat = "shoot";
}
} else if (who._y > who.targy) {
who._stat = "shoot";
}
}
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
if (_root.contplayer != who.no) {
who._stat = "shoot";
}
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
who.vx = playerspeed;
who.vy = 0;
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
who.vx = who.vx * fatigue;
who.vy = who.vy * fatigue;
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
}
if (_root.contplayer == who.no) {
if (Key.isDown(67)) {
who._stat = "shoot";
}
}
if (_root.contplayer == who.no) {
if (Key.isDown(88)) {
who._stat = "pass";
}
}
}
if (who._stat == "shoot") {
if (who.rot == 1) {
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
shootdirection = random(3) + 1;
who.targx = _root[("goal" + who.team) + "x"][shootdirection];
who.targy = _root[("goal" + who.team) + "y"][shootdirection];
who.shootcount = 0;
shootframeax = 0;
shootframe = random(8) + 7;
var _local6 = Math.sqrt(((who.targx - game.ball._x) * (who.targx - game.ball._x)) + ((who.targy - game.ball._y) * (who.targy - game.ball._y)));
var _local3 = shootframe + Math.round(_local6 / 5);
dff = _local3 - (2 * random(_local3 + 1));
if (who.anim._currentframe < 9) {
who.anim.gotoAndStop(who.anim._currentframe + 16);
} else {
who.anim.gotoAndStop(who.anim._currentframe + 8);
}
_root["arrows" + who.team].gotoAndStop(2);
who.targx = who.targx + dff;
who._stat = "runshoot";
}
if (who._stat == "runshoot") {
shoottrigx = game.ball.xtemp;
shoottrigy = game.ball.ytemp;
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot + 16);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
who.vx = playerspeed;
who.vy = 0;
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
}
_root["arrows" + who.team]["arrow" + shootdirection].gotoAndStop(2);
who.shootcount++;
if (shootframeax < shootframe) {
shootframeax++;
_root["arrows" + who.team].bar.gotoAndStop(shootframeax);
}
if (who.shootcount == shootframes) {
if (_root.sunet == 1) {
var _local4 = random(3) + 1;
if (_root.soundmc2._currentframe == 1) {
_root.soundmc2.gotoAndPlay("ball" + _local4);
}
}
ptx = _root[("goal" + who.team) + "x"][shootdirection] + dff;
pty = _root[("goal" + who.team) + "y"][shootdirection];
ballx = game.ball._x;
bally = game.ball._y;
axptx = _root[("goal" + who.team) + "x"][2];
axpty = _root[("goal" + who.team) + "y"][2];
shootscore = Math.round(Math.sqrt(((axptx - ballx) * (axptx - ballx)) + ((axpty - bally) * (axpty - bally))) * 100);
if (half == 1) {
if (who.team == 1) {
shots1 = shots1 + 1;
} else {
shots2 = shots2 + 1;
}
} else if (who.team == 1) {
shots1 = shots1 + 1;
} else {
shots2 = shots2 + 1;
}
ang = Math.atan((bally - pty) / (ballx - ptx));
if (ptx < ballx) {
ang = ang + 3.14;
}
bvx = Math.cos(ang) * (shootframe + 16);
bvy = Math.sin(ang) * (shootframe + 16);
game.ball.vx = bvx;
game.ball.vy = bvy;
game.ball._stat = "free";
camTarg = game.ball;
camElast = camElastBall;
_root["arrows" + who.team].gotoAndStop(1);
_root.scorer = who;
who._stat = "loseball";
}
}
if (who._stat == "pass") {
bounceBall();
if (who.rot == 1) {
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
if (who.team == 1) {
var _local5 = random(2);
if (_local5 == 1) {
if ((who.no + 1) < (2 + playersperteam)) {
passchosen = who.no + 1;
} else {
passchosen = who.no - 1;
}
} else if ((who.no - 1) > 2) {
passchosen = who.no - 1;
} else {
passchosen = who.no + 1;
}
} else {
var _local5 = random(2);
if (_local5 == 1) {
if ((who.no + 1) < (1 + (2 * playersperteam))) {
passchosen = who.no + 1;
} else {
passchosen = who.no - 1;
}
} else if ((who.no - 1) > (2 + playersperteam)) {
passchosen = who.no - 1;
} else {
passchosen = who.no + 1;
}
}
who.targx = game["player" + passchosen]._x;
who.targy = game["player" + passchosen]._y;
who.shootcount = 0;
who._stat = "runpass";
}
if (who._stat == "runpass") {
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
who.vx = playerspeed;
who.vy = 0;
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
who.shootcount++;
if (who.shootcount == passframes) {
if (_root.sunet == 1) {
var _local4 = random(3) + 1;
if (_root.soundmc2._currentframe == 1) {
_root.soundmc2.gotoAndPlay("ball" + _local4);
}
}
ptx = game["player" + passchosen]._x;
pty = game["player" + passchosen]._y;
ballx = game.ball._x;
bally = game.ball._y;
ang = Math.atan((bally - pty) / (ballx - ptx));
if (ptx < ballx) {
ang = ang + 3.14;
}
bvx = Math.cos(ang) * passspeed;
bvy = Math.sin(ang) * passspeed;
game.ball.vx = bvx;
game.ball.vy = bvy;
game.ball._stat = "free";
camTarg = game.ball;
camElast = camElastBall;
game["player" + passchosen]._stat = "scout";
who._stat = "loseball";
}
}
if (who._stat == "loseball") {
who.losecount = 0;
_root["arrows" + who.team].gotoAndStop(1);
who._stat = "runloseball";
who.anim.gotoAndStop(who.rot + 8);
}
if (who._stat == "runloseball") {
who.vx = 0;
who.vy = 0;
who.losecount++;
if (who.losecount > stuntime) {
who._stat = "defensive";
}
}
if (who._stat == "stay") {
}
}
function movePlayers() {
i = 1;
while (i <= (2 * playersperteam)) {
game["player" + i].xtemp = game["player" + i].xtemp + game["player" + i].vx;
game["player" + i].ytemp = game["player" + i].ytemp + game["player" + i].vy;
i++;
}
}
function moveBall() {
if (game.ball._stat == "free") {
game.ball.vx = game.ball.vx * friction;
game.ball.vy = game.ball.vy * friction;
game.ball.vx = Math.round(game.ball.vx * 100) / 100;
game.ball.vy = Math.round(game.ball.vy * 100) / 100;
if ((Math.abs(game.ball.vx) < 0.2) && (Math.abs(game.ball.vy) < 0.2)) {
game.ball.vx = 0;
game.ball.vy = 0;
}
game.ball.xtemp = game.ball.xtemp + game.ball.vx;
game.ball.ytemp = game.ball.ytemp + game.ball.vy;
}
}
function checkRoundCollisions() {
i = 1;
while (i <= 4) {
if (checkCollision(game["post" + i], game.ball)) {
bouncer.bounce(game["post" + i], game.ball);
}
i++;
}
i = 1;
while (i <= (2 * playersperteam)) {
j = i + 1;
while (j <= (2 * playersperteam)) {
if (checkCollision(game["player" + i], game["player" + j])) {
vx1 = Math.abs(game["player" + i].vx);
vy1 = Math.abs(game["player" + i].vy);
vx2 = Math.abs(game["player" + j].vx);
vy2 = Math.abs(game["player" + j].vy);
if ((vx1 <= vy1) && (vx2 <= vy2)) {
if (game["player" + i].xtemp < game["player" + j].xtemp) {
game["player" + i].xtemp = game["player" + i].xtemp - (playerspeed / 1.5);
game["player" + j].xtemp = game["player" + j].xtemp + (playerspeed / 1.5);
game["player" + i].targx = game["player" + i].targx - (playerspeed / 1.5);
game["player" + j].targx = game["player" + j].targx + (playerspeed / 1.5);
} else {
game["player" + i].xtemp = game["player" + i].xtemp + (playerspeed / 1.5);
game["player" + j].xtemp = game["player" + j].xtemp - (playerspeed / 1.5);
game["player" + i].targx = game["player" + i].targx + (playerspeed / 1.5);
game["player" + j].targx = game["player" + j].targx - (playerspeed / 1.5);
}
} else if (game["player" + i].ytemp < game["player" + j].ytemp) {
game["player" + i].ytemp = game["player" + i].ytemp - (playerspeed / 1.5);
game["player" + j].ytemp = game["player" + j].ytemp + (playerspeed / 1.5);
} else {
game["player" + i].ytemp = game["player" + i].ytemp + (playerspeed / 1.5);
game["player" + j].ytemp = game["player" + j].ytemp - (playerspeed / 1.5);
}
}
j++;
}
i++;
}
}
function checkWalls() {
if ((game.ball.xtemp + ballradius) > game.right._x) {
game.ball.xtemp = game.right._x - ballradius;
game.ball.vx = -Math.abs(game.ball.vx);
bounceBall();
} else if ((game.ball.xtemp - ballradius) < game.left._x) {
game.ball.xtemp = game.left._x + ballradius;
game.ball.vx = Math.abs(game.ball.vx);
bounceBall();
}
if ((game.ball.ytemp + ballradius) > game.bottom._y) {
if ((game.ball._x > game.post1._x) && (game.ball._x < game.post2._x)) {
setupGoal(2);
} else {
game.ball.ytemp = game.bottom._y - ballradius;
game.ball.vy = -Math.abs(game.ball.vy);
bounceBall();
}
} else if ((game.ball.ytemp - ballradius) < game.top._y) {
if ((game.ball._x > game.post1._x) && (game.ball._x < game.post2._x)) {
setupGoal(1);
} else {
game.ball.ytemp = game.top._y + ballradius;
game.ball.vy = Math.abs(game.ball.vy);
bounceBall();
}
}
i = 3;
while (i <= (2 * playersperteam)) {
if ((game["player" + i].xtemp + (ballradius + playerradius)) > game.right._x) {
game["player" + i].xtemp = game.right._x - (ballradius + playerradius);
game["player" + i].vx = -Math.abs(game["player" + i].vx);
} else if ((game["player" + i].xtemp - (ballradius + playerradius)) < game.left._x) {
game["player" + i].xtemp = game.left._x + (ballradius + playerradius);
game["player" + i].vx = Math.abs(game["player" + i].vx);
}
if ((game["player" + i].ytemp + (ballradius + playerradius)) > game.bottom._y) {
game["player" + i].ytemp = game.bottom._y - (ballradius + playerradius);
game["player" + i].ball.vy = -Math.abs(game["player" + i].vy);
} else if ((game["player" + i].ytemp - (ballradius + playerradius)) < game.top._y) {
game["player" + i].ytemp = game.top._y + (ballradius + playerradius);
game["player" + i].vy = Math.abs(game["player" + i].vy);
}
i++;
}
}
function renderPlayers() {
i = 1;
while (i <= (2 * playersperteam)) {
game["player" + i].xtemp = Math.round(game["player" + i].xtemp * 100) / 100;
game["player" + i].ytemp = Math.round(game["player" + i].ytemp * 100) / 100;
game["player" + i]._x = game["player" + i].xtemp;
game["player" + i]._y = game["player" + i].ytemp;
i++;
}
}
function renderBall() {
game.ball._x = game.ball.xtemp;
game.ball._y = game.ball.ytemp;
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
}
function checkCollision(b1, b2) {
var _local4 = b1.xtemp;
var _local2 = b2.xtemp;
var _local3 = b1.ytemp;
var _local1 = b2.ytemp;
var _local6 = b1._width / 2;
var _local5 = b2._width / 2;
var _local9 = Math.sqrt(((_local4 - _local2) * (_local4 - _local2)) + ((_local3 - _local1) * (_local3 - _local1)));
if (_local9 < (_local6 + _local5)) {
return(true);
}
return(false);
}
function moveCamera(targ) {
if (targ != game.ball) {
xtarg = ((-targ._x) + (Stage.width / 2)) - (20 * targ.vx);
ytarg = ((-targ._y) + (Stage.height / 2)) - (20 * targ.vy);
xcam = game._x;
ycam = game._y;
camvx = Math.round(xtarg - xcam) / camElast;
camvy = Math.round(ytarg - ycam) / camElast;
game._x = game._x + camvx;
game._y = game._y + camvy;
} else {
xtarg = (-targ._x) + (Stage.width / 2);
ytarg = (-targ._y) + (Stage.height / 2);
xcam = game._x;
ycam = game._y;
camvx = Math.round(xtarg - xcam) / camElast;
camvy = Math.round(ytarg - ycam) / camElast;
game._x = game._x + camvx;
game._y = game._y + camvy;
}
}
function setupGoal(whoScored) {
timermc.stop();
timermc.gotoAndStop(1);
if (_root.sunet == 1) {
var _local3 = random(2) + 1;
_root["s_gol" + _local3].start();
}
_root.scoredcount = 0;
_root.scoredcount2 = 0;
_root.replaycounter1 = 0;
_root.replaycounter2 = 0;
_root.scored = 1;
_root.scorerTeam = whoScored;
if (half == 1) {
_root["score" + scorerTeam]++;
} else if (scorerTeam == 2) {
_root.score1++;
} else {
_root.score2++;
}
scoremsg = (((((teamshort1 + " ") + score1) + " - ") + score2) + " ") + teamshort2;
messages.gotoAndPlay("goal");
game.player2.rot = 5;
game.player1.rot = 1;
if (game.player1._stat != "runjump") {
game.player1._stat = "stay";
}
if (game.player2._stat != "runjump") {
game.player2._stat = "stay";
}
if (whoScored == 1) {
game.ball.vy = -Math.abs(game.ball.vy);
i = 1;
while (i < playersperteam) {
game["player" + team1[i]].vx = 0;
game["player" + team1[i]].vy = 0;
game["player" + team2[i]].vx = 0;
game["player" + team2[i]].vy = 0;
delete game["player" + team1[i]].onEnterFrame;
delete game["player" + team2[i]].onEnterFrame;
var _local2 = random(3);
if (_local2 < 2) {
game["player" + team1[i]].anim.gotoAndStop(33 + random(2));
} else {
game["player" + team1[i]].anim.gotoAndStop(game["player" + team1[i]].rot + 8);
}
_local2 = random(3);
if (_local2 < 2) {
game["player" + team2[i]].anim.gotoAndStop(38 + random(2));
} else {
game["player" + team2[i]].anim.gotoAndStop(game["player" + team2[i]].rot + 8);
}
i++;
}
} else {
game.ball.vy = Math.abs(game.ball.vy);
i = 1;
while (i < playersperteam) {
game["player" + team1[i]].vx = 0;
game["player" + team1[i]].vy = 0;
game["player" + team2[i]].vx = 0;
game["player" + team2[i]].vy = 0;
delete game["player" + team1[i]].onEnterFrame;
delete game["player" + team2[i]].onEnterFrame;
var _local2 = random(2);
if (_local2 == 1) {
game["player" + team2[i]].anim.gotoAndStop(33 + random(2));
} else {
game["player" + team2[i]].anim.gotoAndStop(game["player" + team2[i]].rot + 8);
}
_local2 = random(2);
if (_local2 == 1) {
game["player" + team1[i]].anim.gotoAndStop(38 + random(2));
} else {
game["player" + team1[i]].anim.gotoAndStop(game["player" + team1[i]].rot + 8);
}
i++;
}
}
_root.scorer.anim.gotoAndStop(33 + random(2));
}
function ballInNet() {
if (scorerTeam == 1) {
if ((game.ball.xtemp - ballradius) < game.post1._x) {
game.ball.xtemp = game.post1._x + ballradius;
game.ball.vx = Math.abs(game.ball.vx) / 4;
} else if ((game.ball.xtemp + ballradius) > game.post2._x) {
game.ball.xtemp = game.post2._x - ballradius;
game.ball.vx = (-Math.abs(game.ball.vx)) / 4;
}
if (game.ball.ytemp < (game.post3._y - 20)) {
game.gate1.play();
game.ball.ytemp = game.post3._y - 20;
game.ball.vy = Math.abs(game.ball.vy) / 8;
nettrigx = game.ball.xtemp;
nettrigy = game.ball.ytemp;
}
} else {
if ((game.ball.xtemp - ballradius) < game.post1._x) {
game.ball.xtemp = game.post1._x + ballradius;
game.ball.vx = Math.abs(game.ball.vx) / 4;
} else if ((game.ball.xtemp + ballradius) > game.post2._x) {
game.ball.xtemp = game.post2._x - ballradius;
game.ball.vx = (-Math.abs(game.ball.vx)) / 4;
}
if (game.ball.ytemp > (game.post1._y + 20)) {
game.gate2.play();
game.ball.ytemp = game.post1._y + 20;
game.ball.vy = (-Math.abs(game.ball.vy)) / 8;
nettrigx = game.ball.xtemp;
nettrigy = game.ball.ytemp;
}
}
}
function bounceBall() {
game.umbra.play();
}
function setBallFrame() {
if (game.ball._stat == "free") {
var _local3 = Math.round(Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy)) * 2);
var _local4 = Math.atan(game.ball.vy / game.ball.vx);
var _local2 = Math.round(_local4 * 57.32);
if (game.ball.vx < 0) {
_local2 = _local2 + 180;
}
game.ball._rotation = _local2;
} else if (game.ball._stat == "player") {
var _local3 = Math.round(playerspeed / 2);
var _local1 = game["player" + game.ball.player].rot;
if (_local1 == 1) {
var _local2 = 0;
} else if (_local1 == 2) {
var _local2 = 45;
} else if (_local1 == 3) {
var _local2 = 90;
} else if (_local1 == 4) {
var _local2 = 135;
} else if (_local1 == 5) {
var _local2 = 180;
} else if (_local1 == 6) {
var _local2 = 225;
} else if (_local1 == 7) {
var _local2 = 270;
} else if (_local1 == 8) {
var _local2 = 315;
}
game.ball._rotation = _local2 - 90;
} else if (game.ball._stat == "keeper") {
var _local3 = 0;
} else {
var _local3 = Math.round(Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy)) * 2);
}
ballframe = ballframe + _local3;
if (ballframe > 36) {
ballframe = ballframe - 36;
}
if (ballframe > 36) {
ballframe = ballframe - 36;
}
if (ballframe > 36) {
ballframe = ballframe - 36;
}
game.ball.gotoAndStop(ballframe);
}
function getReplay() {
if (_tposx.length < replaytime) {
i = 1;
while (i <= 8) {
_root["_pposx" + i].push(game["player" + i]._x);
_root["_pposy" + i].push(game["player" + i]._y);
_root["_pframea" + i].push(game["player" + i].anim._currentframe);
_root["_pframeb" + i].push(game["player" + i].anim.inside._currentframe);
i++;
}
_bposx.push(game.ball._x);
_bposy.push(game.ball._y);
_brot.push(game.ball._rotation);
_bframe.push(game.ball._currentframe);
_tposx.push(game._x);
_tposy.push(game._y);
} else {
i = 1;
while (i <= 8) {
_root["_pposx" + i].shift();
_root["_pposy" + i].shift();
_root["_pframea" + i].shift();
_root["_pframeb" + i].shift();
i++;
}
_bposx.shift();
_bposy.shift();
_bframe.shift();
_tposx.shift();
_tposy.shift();
i = 1;
while (i <= 8) {
_root["_pposx" + i].push(game["player" + i]._x);
_root["_pposy" + i].push(game["player" + i]._y);
_root["_pframea" + i].push(game["player" + i].anim._currentframe);
_root["_pframeb" + i].push(game["player" + i].anim.inside._currentframe);
i++;
}
_bposx.push(game.ball._x);
_bposy.push(game.ball._y);
_brot.push(game.ball._rotation);
_bframe.push(game.ball._currentframe);
_tposx.push(game._x);
_tposy.push(game._y);
}
}
function displayReplay() {
_root.replaycounter1++;
if (_root.replaycounter1 == replayspeed) {
_root.replaycounter1 = 0;
_root.replaycounter2++;
i = 1;
while (i <= 8) {
game["player" + i]._x = _root["_pposx" + i][replaycounter2];
game["player" + i]._y = _root["_pposy" + i][replaycounter2];
game["player" + i].anim.gotoAndStop(_root["_pframea" + i][replaycounter2]);
game["player" + i].anim.inside.gotoAndStop(_root["_pframeb" + i][replaycounter2]);
i++;
}
game.ball._x = _bposx[replaycounter2];
game.ball._y = _bposy[replaycounter2];
game.ball._rotation = _brot[replaycounter2];
game.ball.gotoAndStop(_bframe[replaycounter2]);
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
game._x = _tposx[replaycounter2];
game._y = _tposy[replaycounter2];
if ((Math.round(game.ball._x) == Math.round(nettrigx)) && (Math.round(game.ball._y) == Math.round(nettrigy))) {
trace("anim net");
if (game.ball._y < 400) {
game.gate1.gotoAndPlay("replay");
} else {
game.gate2.gotoAndPlay("replay");
}
}
if ((Math.round(game.ball._x) == Math.round(shoottrigx)) && (Math.round(game.ball._y) == Math.round(shoottrigy))) {
trace("anim shoot");
replayspeed = replayspeedini + 6;
}
if (replayspeed == (replayspeedini + 6)) {
conttrig++;
if (conttrig == 8) {
replayspeed = replayspeedini;
}
}
if (replaycounter2 >= replaytime) {
_root.stat = "reset";
}
}
}
function traceStats() {
i = 1;
while (i <= 8) {
trace((i + " : ") + game["player" + i]._stat);
trace((i + " : function : ") + game["player" + i].funct);
i++;
}
trace("--------------------");
}
function step() {
if (s_muzica.getVolume() > 0) {
s_muzica.setVolume(s_muzica.getVolume() - 5);
}
if (stat == "idle") {
}
if (stat == "live") {
var _local3 = random(50);
if (_local3 == 0) {
if (_root.sunet == 1) {
var _local2 = random(3) + 1;
if (_root.soundmc._currentframe == 1) {
_root.soundmc.gotoAndPlay("crowd" + _local2);
}
}
}
moveCamera(camTarg);
movePlayers();
moveBall();
checkRoundCollisions();
if (scored == 0) {
checkWalls();
} else {
ballInNet();
if (_root.scoredcount < 24) {
_root.scoredcount++;
} else {
camTarg = _root.scorer;
_root.scoredcount2++;
if (_root.scoredcount2 > timetocheer) {
i = 1;
while (i <= 8) {
game["player" + i].highlightmc.gotoAndStop(1);
i++;
}
_root.stat = "replay";
conttrig = 0;
replayspeed = replayspeedini;
skiper.play();
arrows1.gotoAndStop(1);
arrows2.gotoAndStop(1);
replayer.play();
}
}
}
renderPlayers();
renderBall();
setBallFrame();
getReplay();
}
if (stat == "replay") {
displayReplay();
}
if (stat == "reset") {
_root.stat = "live";
timermc.play();
_root.scored = 0;
resetPlayers();
if (scorerTeam == 1) {
if (_root.sunet == 1) {
_root.s_arbitru3.start();
}
_root.game.ball.vy = -4;
} else {
if (_root.sunet == 1) {
_root.s_arbitru3.start();
}
_root.game.ball.vy = 4;
}
_root.bounceBall();
_root.gameStarted = true;
}
if (stat == "reset2") {
_root.stat = "live";
timermc.play();
_root.scored = 0;
resetPlayers();
if (whostarted == 2) {
_root.game.ball.vy = -4;
} else {
_root.game.ball.vy = 4;
}
_root.bounceBall();
_root.gameStarted = true;
}
}
stop();
soundmc.gotoAndStop(1);
startGame();
Instance of Symbol 707 MovieClip "timermc" in Frame 14
onClipEvent (load) {
this.ctime = 0;
}
Instance of Symbol 708 MovieClip in Frame 14
onClipEvent (enterFrame) {
_parent.step();
}
Instance of Symbol 709 MovieClip "bouncer" in Frame 14
onClipEvent (load) {
function bounce(clip, clip2) {
trace("frame:" + _root.soundmcx._currentframe);
_root.soundmc.gotoAndPlay("crowd" + srn);
if (_root.sunet == 1) {
var srn = (random(3) + 1);
if (_root.soundmc2._currentframe == 1) {
_root.soundmc2.gotoAndPlay("ball" + srn);
}
}
var _local5 = clip._name;
if (_local5.indexOf("player1") >= 0) {
if (_root.sunet == 1) {
var srn = (random(3) + 1);
if (_root.soundmcx._currentframe == 1) {
_root.soundmcx.gotoAndPlay("crowd" + srn);
}
}
}
if (_local5.indexOf("player2") >= 0) {
if (_root.sunet == 1) {
var srn = (random(3) + 1);
trace((_root.soundmc._currentframe + " ::: ") + srn);
if (_root.soundmcx._currentframe == 1) {
_root.soundmcx.gotoAndPlay("crowd" + srn);
}
}
}
if (_local5.indexOf("post") >= 0) {
if (_root.sunet == 1) {
var srn = (random(3) + 1);
if (_root.soundmcx._currentframe == 1) {
_root.soundmcx.gotoAndPlay("crowd" + srn);
}
}
}
var _local12 = Math.atan2(clip._y - clip2._y, clip._x - clip2._x);
this._rotation = (_local12 * 180) / Math.PI;
var _local7 = {x:clip2.vx * 10, y:clip2.vy * 10};
this.globalToLocal(_local7);
var _local9 = {x:_local7.x, y:0};
this.localToGlobal(_local9);
var _local8 = {x:clip.vx * 10, y:clip.vy * 10};
this.globalToLocal(_local8);
var _local6 = {x:_local8.x, y:0};
this.localToGlobal(_local6);
if ((_local7.x <= 0) && (_local8.x >= 0)) {
return(undefined);
}
var _local11 = (_local9.x - _local6.x) / 7;
var _local10 = (_local9.y - _local6.y) / 7;
clip2.vx = clip2.vx - _local11;
clip2.vy = clip2.vy - _local10;
}
}
Frame 15
_root.gotoAndStop("coperta");
Frame 16
score = 0;
score1 = 0;
score2 = 0;
teamshort1 = "LIV";
teamshort2 = "MIL";
teamlong1 = "LIVERPOOL";
teamlong2 = "MILAN";
playernames1 = ["C.BELLAMY", "S. GERRARD", "J.CARRAGHER"];
playernames2 = ["A.PIRLO", "KAKA", "F.INZAGHI"];
scoremsg = (((((teamshort1 + " ") + score1) + " - ") + score2) + " ") + teamshort2;
controller1 = "cpu";
controller2 = "cpu";
actcontroller1 = controller1;
actcontroller2 = controller2;
Frame 17
instrmc.gotoAndStop(_root.lang);
Frame 18
timermc.timelimit = (timelimitini = 9999999 + random(120));
stuntime = 16;
camElastPlayer = 8;
camElastBall = 16;
camElast = camElastPlayer;
playersperteam = 4;
playerspeed = 4;
playerspeed45 = Math.round(Math.sqrt((playerspeed * playerspeed) / 2) * 100) / 100;
fatigueini = 1;
linedup = 0;
friction = 0.97;
ballradius = 8;
playerradius = 10;
playerballdist = ballradius + playerradius;
gameStarted = false;
pointvariation = 70;
balldist = playerballdist + 5;
balldist45 = Math.round(Math.sqrt((balldist * balldist) / 2) * 100) / 100;
shootframes = 12;
passframes = 4;
changetime = 15;
fatigue = 0.9;
passlimit = 50;
passspeed = 12;
maxpassspeed = 10;
maxkbspeed = 8;
passrandom = 7;
scored = 0;
half = 1;
keepspeed1 = 3;
keepspeed2 = 8;
jumpframes1 = 18;
jumpframes2 = 25;
disttojump = 60;
keepertime = 72;
ballframe = 1;
stat = "live";
timetocheer = 60;
scoutcount = 0;
possesion1 = 0;
possesion2 = 0;
shots1 = 0;
shots2 = 0;
timetxt = "00:00 (1st)";
defensivex = [0, 0, 0, 260, 400, 530, 260, 397, 520];
defensivey = [0, 0, 0, 828, 847, 827, 261, 238, 261];
offensivex = [0, 0, 0, 210, 380, 580, 200, 390, 580];
offensivey = [0, 0, 0, 307, 327, 307, 771, 751, 771];
keeper1x = [0, 334, 394, 454];
keeper1y = [0, 958, 948, 958];
keeper2x = [0, 334, 394, 454];
keeper2y = [0, 148, 158, 148];
goal2x = [0, 324, 394, 464];
goal2y = [0, 983, 983, 983];
goal1x = [0, 324, 394, 464];
goal1y = [0, 103, 103, 103];
lineupx = [0, 0, 0, 240, 410, 580, 240, 390, 520];
lineupy = [0, 0, 0, 610, 653, 580, 490, 440, 460];
lineuprot = [0, 0, 0, 2, 1, 8, 4, 5, 6];
team1 = [1, 3, 4, 5];
team2 = [2, 6, 7, 8];
game.player1._type = "keeper";
game.player2._type = "keeper";
game.player1.no = 1;
game.player2.no = 2;
game.player1.xtemp = game.player1._x;
game.player2.xtemp = game.player2._x;
game.player1.ytemp = game.player1._y;
game.player2.ytemp = game.player2._y;
game.player1.vx = 0;
game.player1.vy = 0;
game.player2.vx = 0;
game.player2.vy = 0;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i]._type = "field";
game["player" + i]._stat = "lineup";
game["player" + i].vx = 0;
game["player" + i].vy = 0;
game["player" + i].rot = 7;
game["player" + i].xtemp = game["player" + i]._x;
game["player" + i].ytemp = game["player" + i]._y;
game["player" + i].no = i;
if (i < (2 + playersperteam)) {
game["player" + i].team = 1;
} else {
game["player" + i].team = 2;
}
i++;
}
i = 1;
while (i <= 4) {
game["post" + i].xtemp = game["post" + i]._x;
game["post" + i].ytemp = game["post" + i]._y;
i++;
}
game.ball._stat = "free";
game.ball.vx = 0;
game.ball.vy = 0;
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
i = 1;
while (i <= 8) {
_root["_pposx" + i] = new Array();
_root["_pposy" + i] = new Array();
_root["_pframea" + i] = new Array();
_root["_pframeb" + i] = new Array();
i++;
}
_bposx = new Array();
_bposy = new Array();
_bframe = new Array();
_brot = new Array();
_tposx = new Array();
_tposy = new Array();
replayspeedini = 2;
replaytime = 192;
function startGame() {
scorerTeam = 0;
game.tribune.vx = 0;
game.tribune.vy = 0;
camTarg = game.tribune;
camElast = camElastBall;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i].onEnterFrame = function () {
uncontWOB(this);
};
i++;
}
game.player1._stat = "stay";
game.player2._stat = "stay";
game.player1.onEnterFrame = function () {
keeperEF(game.player1);
};
game.player2.onEnterFrame = function () {
keeperEF(game.player2);
};
if (half == 1) {
game.player1.gotoAndStop(1);
i = 3;
while (i <= (1 + playersperteam)) {
game["player" + i].gotoAndStop(1);
i++;
}
game.player2.gotoAndStop(2);
i = playersperteam + 2;
while (i <= (2 * playersperteam)) {
game["player" + i].gotoAndStop(2);
i++;
}
} else {
game.player1.gotoAndStop(2);
i = 3;
while (i <= (1 + playersperteam)) {
game["player" + i].gotoAndStop(2);
i++;
}
game.player2.gotoAndStop(1);
i = playersperteam + 2;
while (i <= (2 * playersperteam)) {
game["player" + i].gotoAndStop(1);
i++;
}
}
game.player1.anim.gotoAndStop("kstay1");
game.player2.anim.gotoAndStop("kstay2");
game.player1._x = keeper1x[2];
game.player1._y = keeper1y[2];
game.player1.tempx = game.player1._x;
game.player1.tempy = game.player1._y;
game.player2._x = keeper2x[2];
game.player2._y = keeper2y[2];
game.player2.tempx = game.player2._x;
game.player2.tempy = game.player2._y;
messages.gotoAndPlay("begin");
}
function resetPlayers() {
i = 1;
while (i <= 8) {
game["player" + i].highlightmc.gotoAndStop(1);
i++;
}
game.player1._type = "keeper";
game.player2._type = "keeper";
game.player1.no = 1;
game.player2.no = 2;
game.player1.xtemp = game.player1._x;
game.player2.xtemp = game.player2._x;
game.player1.ytemp = game.player1._y;
game.player2.ytemp = game.player2._y;
game.player1.vx = 0;
game.player1.vy = 0;
game.player2.vx = 0;
game.player2.vy = 0;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i]._type = "field";
game["player" + i]._stat = "lineup";
game["player" + i].vx = 0;
game["player" + i].vy = 0;
game["player" + i].rot = 7;
game["player" + i].xtemp = game["player" + i]._x;
game["player" + i].ytemp = game["player" + i]._y;
game["player" + i].no = i;
if (i < (2 + playersperteam)) {
game["player" + i].team = 1;
} else {
game["player" + i].team = 2;
}
i++;
}
i = 1;
while (i <= 4) {
game["post" + i].xtemp = game["post" + i]._x;
game["post" + i].ytemp = game["post" + i]._y;
i++;
}
game.ball._stat = "free";
game.ball.vx = 0;
game.ball.vy = 0;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i].onEnterFrame = function () {
uncontWOB(this);
};
i++;
}
game.player1._stat = "stay";
game.player2._stat = "stay";
game.player1.onEnterFrame = function () {
keeperEF(game.player1);
};
game.player2.onEnterFrame = function () {
keeperEF(game.player2);
};
replayer.gotoAndStop(1);
skiper.play();
game.ball.xtemp = 400;
game.ball.ytemp = 550;
game.ball._x = 400;
game.ball._y = 550;
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i].xtemp = lineupx[game["player" + i].no] + 20;
game["player" + i].ytemp = lineupy[game["player" + i].no] + 20;
game["player" + i]._stat = "lineup";
i++;
}
stat = "live";
game.ball._stat = "free";
scoutchooser.play();
}
function chooseScout() {
if (game.ball._stat == "free") {
var _local4 = 10000;
var _local6 = game.ball._x;
var _local5 = game.ball._y;
i = 1;
while (i < playersperteam) {
var _local2 = game["player" + team1[i]]._x - _local6;
var _local1 = game["player" + team1[i]]._y - _local5;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 < _local4) {
if (((game["player" + team1[i]]._stat == "runscout") || (game["player" + team1[i]]._stat == "runstay")) || (game["player" + team1[i]]._stat == "runrun")) {
_local4 = _local3;
var chosen1 = team1[i];
}
}
i++;
}
_local4 = 10000;
i = 1;
while (i < playersperteam) {
var _local2 = game["player" + team2[i]]._x - _local6;
var _local1 = game["player" + team2[i]]._y - _local5;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 < _local4) {
if (((game["player" + team2[i]]._stat == "runscout") || (game["player" + team2[i]]._stat == "runstay")) || (game["player" + team2[i]]._stat == "runrun")) {
_local4 = _local3;
var chosen2 = team2[i];
}
}
i++;
}
delete game["player" + chosen1].onEnterFrame;
delete game["player" + chosen2].onEnterFrame;
game["player" + chosen1].onEnterFrame = function () {
uncontWOB(game["player" + chosen1]);
};
game["player" + chosen2].onEnterFrame = function () {
uncontWOB(game["player" + chosen2]);
};
game["player" + chosen1]._stat = "scout";
game["player" + chosen2]._stat = "scout";
}
if (game.ball._stat == "player") {
if (game.ball.team == 2) {
var _local4 = 10000;
var _local6 = game.ball._x;
var _local5 = game.ball._y;
i = 1;
while (i < playersperteam) {
var _local2 = game["player" + team1[i]]._x - _local6;
var _local1 = game["player" + team1[i]]._y - _local5;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 < _local4) {
if (((game["player" + team1[i]]._stat == "runscout") || (game["player" + team1[i]]._stat == "runstay")) || (game["player" + team1[i]]._stat == "runrun")) {
_local4 = _local3;
var chosen1 = team1[i];
}
}
i++;
}
game["player" + chosen1].onEnterFrame = function () {
uncontWOB(game["player" + chosen1]);
};
game["player" + chosen1]._stat = "scout";
i = 1;
while (i < playersperteam) {
if (game["player" + team1[i]]._stat != "scout") {
game["player" + team1[i]]._stat = "defensive";
}
i++;
}
} else {
var _local4 = 10000;
var _local6 = game.ball._x;
var _local5 = game.ball._y;
i = 1;
while (i < playersperteam) {
var _local2 = game["player" + team2[i]]._x - _local6;
var _local1 = game["player" + team2[i]]._y - _local5;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 < _local4) {
if (((game["player" + team2[i]]._stat == "runscout") || (game["player" + team2[i]]._stat == "runstay")) || (game["player" + team2[i]]._stat == "runrun")) {
_local4 = _local3;
var chosen2 = team2[i];
}
}
i++;
}
game["player" + chosen2]._stat = "scout";
game["player" + chosen2].onEnterFrame = function () {
uncontWOB(game["player" + chosen2]);
};
i = 1;
while (i < playersperteam) {
if (game["player" + team2[i]]._stat != "scout") {
game["player" + team2[i]]._stat = "defensive";
}
i++;
}
}
}
}
function keeperEF(who) {
if (who._stat == "stay") {
if (scored == 0) {
who.targx = _root[("keeper" + who.no) + "x"][2];
who.targy = _root[("keeper" + who.no) + "y"][2];
if (who.targx > who.xtemp) {
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.anim.gotoAndStop("krunleft" + who.no);
}
who._stat = "runstay";
} else {
who._stat = "idle";
who.vx = 0;
who.vy = 0;
if (_root.scorerTeam == who.no) {
who.anim.gotoAndStop(33 + random(2));
} else {
who.anim.gotoAndStop(38 + random(2));
}
}
}
if (who._stat == "runstay") {
if (who.targx > who.xtemp) {
who.vx = keepspeed1;
} else if (who.targx < who.xtemp) {
who.vx = -keepspeed1;
}
if (Math.abs(who.targx - who.xtemp) < keepspeed1) {
who.vx = 0;
}
if (who.targy > who.ytemp) {
who.vy = keepspeed1;
} else if (who.targy < who.ytemp) {
who.vy = -keepspeed1;
}
if (Math.abs(who.targy - who.ytemp) < keepspeed1) {
who.vy = 0;
}
if ((who.vy == 0) && (who.vx == 0)) {
who.anim.gotoAndStop("kstay" + who.no);
}
if (checkCollision(who, game.ball)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > maxkbspeed) {
bouncer.bounce(game["player" + who.no], game.ball);
} else {
who._stat = "ball";
}
}
if (who.no == 1) {
if (game.ball.ytemp > 700) {
who._stat = "topoint";
}
} else if (game.ball.ytemp < 400) {
who._stat = "topoint";
}
}
if (who._stat == "topoint") {
if (game.ball.xtemp < 290) {
whatpoint = 1;
} else if ((game.ball.xtemp >= 290) && (game.ball.xtemp <= 510)) {
whatpoint = 2;
} else if (game.ball.xtemp > 510) {
whatpoint = 3;
}
who.targx = _root[("keeper" + who.no) + "x"][whatpoint];
who.targy = _root[("keeper" + who.no) + "y"][whatpoint];
if (who.targx > who.xtemp) {
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.anim.gotoAndStop("krunleft" + who.no);
}
who._stat = "runtopoint";
}
if (who._stat == "runtopoint") {
if (game.ball.xtemp < 290) {
whatpoint = 1;
} else if ((game.ball.xtemp >= 290) && (game.ball.xtemp <= 510)) {
whatpoint = 2;
} else if (game.ball.xtemp > 510) {
whatpoint = 3;
}
who.targx = _root[("keeper" + who.no) + "x"][whatpoint];
who.targy = _root[("keeper" + who.no) + "y"][whatpoint];
if (who.targx > who.xtemp) {
who.vx = keepspeed1;
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.vx = -keepspeed1;
who.anim.gotoAndStop("krunleft" + who.no);
}
if (Math.abs(who.targx - who.xtemp) < keepspeed1) {
who.vx = 0;
}
if (who.targy > who.ytemp) {
who.vy = keepspeed1;
} else if (who.targy < who.ytemp) {
who.vy = -keepspeed1;
}
if (Math.abs(who.targy - who.ytemp) < keepspeed1) {
who.vy = 0;
}
if ((who.vy == 0) && (who.vx == 0)) {
who.anim.gotoAndStop("kstay" + who.no);
}
if (checkCollision(who, game.ball)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > maxkbspeed) {
bouncer.bounce(game["player" + who.no], game.ball);
} else {
who._stat = "ball";
}
}
if (who.no == 1) {
if (game.ball.ytemp < 700) {
who._stat = "stay";
}
} else if (game.ball.ytemp > 400) {
who._stat = "stay";
}
if (who.no == 1) {
if (game.ball.ytemp > 880) {
if ((game.ball.xtemp > 225) && (game.ball.xtemp < 575)) {
who._stat = "toball";
}
}
} else if (game.ball.ytemp < 220) {
if ((game.ball.xtemp > 225) && (game.ball.xtemp < 575)) {
who._stat = "toball";
}
}
}
if (who._stat == "toball") {
who.targx = game.ball.xtemp;
who.targy = game.ball.ytemp;
if (who.targx > who.xtemp) {
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.anim.gotoAndStop("krunleft" + who.no);
}
who._stat = "runtoball";
}
if (who._stat == "runtoball") {
who.targx = game.ball.xtemp;
who.targy = game.ball.ytemp;
if (who.targx > who.xtemp) {
who.vx = keepspeed1;
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.vx = -keepspeed1;
who.anim.gotoAndStop("krunleft" + who.no);
}
if (Math.abs(who.targx - who.xtemp) < keepspeed1) {
who.vx = 0;
}
if (who.targy > who.ytemp) {
who.vy = keepspeed1;
} else if (who.targy < who.ytemp) {
who.vy = -keepspeed1;
}
if (Math.abs(who.targy - who.ytemp) < keepspeed1) {
who.vy = 0;
}
if (checkCollision(who, game.ball)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > maxkbspeed) {
bouncer.bounce(game["player" + who.no], game.ball);
} else {
who._stat = "ball";
}
}
var _local5 = game.ball.xtemp - who.xtemp;
var _local4 = game.ball.ytemp - who.ytemp;
var _local3 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
if (who.no == 1) {
if (game.ball.ytemp < 880) {
who._stat = "stay";
}
} else if (game.ball.ytemp > 220) {
who._stat = "stay";
}
if (((_local3 > disttojump) && ((game.ball.xtemp + (3 * game.ball.vx)) > who.xtemp)) && (game)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > 8) {
if ((game.ball.xtemp > 225) && (game.ball.xtemp < 575)) {
if ((who.no == 1) && (game.ball.vy > 0)) {
whichdirection = "right";
who._stat = "jump";
} else if ((who.no == 2) && (game.ball.vy < 0)) {
whichdirection = "right";
who._stat = "jump";
}
}
}
} else if ((_local3 > disttojump) && ((game.ball.xtemp + (3 * game.ball.vx)) < who.xtemp)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > 8) {
if ((game.ball.xtemp > 225) && (game.ball.xtemp < 575)) {
if ((who.no == 1) && (game.ball.vy > 0)) {
whichdirection = "left";
who._stat = "jump";
} else if ((who.no == 2) && (game.ball.vy < 0)) {
whichdirection = "left";
who._stat = "jump";
}
}
}
}
}
if (who._stat == "jump") {
who.anim.gotoAndStop(("kjump" + whichdirection) + who.no);
if (whichdirection == "right") {
who.vx = keepspeed2;
} else {
who.vx = -keepspeed2;
}
who.jumpcounter = 0;
who.vy = 0;
who._stat = "runjump";
}
if (who._stat == "runjump") {
who.jumpcounter++;
if (who.jumpcounter == (jumpframes1 - 6)) {
who.vx = who.vx / 2;
}
if (who.jumpcounter == jumpframes1) {
who.vx = 0;
}
if (who.jumpcounter == jumpframes2) {
who._stat = "stay";
}
if (checkCollision(who, game.ball)) {
var _local6 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local6 > maxkbspeed) {
bouncer.bounce(game["player" + who.no], game.ball);
} else {
who._stat = "pickup";
}
}
}
if (who._stat == "pickup") {
arrows1.gotoAndStop(1);
arrows2.gotoAndStop(1);
game.ball._stat = "keeper";
scoutchooser.stop();
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i]._stat = "defensive";
i++;
}
who.vx = 0;
who.vy = 0;
game.ball.vx = 0;
game.ball.vy = 0;
pickupcounter = 0;
game.ball._x = who._x;
if (who.no == 1) {
game.ball._y = who._y - 16;
} else {
game.ball._y = who._y + 16;
}
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
if (whichdirection == "right") {
who.anim.gotoAndStop("kjumpright" + who.no);
who.anim.inside.gotoAndPlay("ridic");
} else {
who.anim.gotoAndStop("kjumpleft" + who.no);
who.anim.inside.gotoAndPlay("ridic");
}
who._stat = "runpickup";
}
if (who._stat == "runpickup") {
pickupcounter++;
if (pickupcounter >= 8) {
who._stat = "ball";
}
}
if (who._stat == "ball") {
i = 1;
while (i <= 8) {
game["player" + i].highlightmc.gotoAndStop(1);
i++;
}
arrows1.gotoAndStop(1);
arrows2.gotoAndStop(1);
game.ball._stat = "keeper";
scoutchooser.stop();
i = 3;
while (i <= (2 * playersperteam)) {
game["player" + i]._stat = "defensive";
i++;
}
who.keeptimer = 0;
who.targx = _root[("keeper" + who.no) + "x"][2];
who.targy = _root[("keeper" + who.no) + "y"][2];
if (who.targx > who.xtemp) {
who.anim.gotoAndStop("krunright" + who.no);
} else if (who.targx < who.xtemp) {
who.anim.gotoAndStop("krunleft" + who.no);
}
who._stat = "runball";
}
if (who._stat == "runball") {
camTarg = who;
if (who.targx > who.xtemp) {
who.vx = keepspeed1;
} else if (who.targx < who.xtemp) {
who.vx = -keepspeed1;
}
if (Math.abs(who.targx - who.xtemp) < keepspeed1) {
who.vx = 0;
}
if (who.targy > who.ytemp) {
who.vy = keepspeed1;
} else if (who.targy < who.ytemp) {
who.vy = -keepspeed1;
}
if (Math.abs(who.targy - who.ytemp) < keepspeed1) {
who.vy = 0;
}
if ((who.vy == 0) && (who.vx == 0)) {
who.anim.gotoAndStop("kstay" + who.no);
}
game.ball._x = who._x;
if (who.no == 1) {
game.ball._y = who._y - 16;
} else {
game.ball._y = who._y + 16;
}
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
who.keeptimer++;
if (who.keeptimer >= keepertime) {
who._stat = "pass";
}
}
if (who._stat == "pass") {
bounceBall();
scoutchooser.gotoAndPlay(1);
if (who.no == 1) {
passchosen = random(3) + 3;
} else {
passchosen = random(3) + 6;
}
ptx = game["player" + passchosen]._x;
pty = game["player" + passchosen]._y;
ballx = game.ball._x;
bally = game.ball._y;
ang = Math.atan((bally - pty) / (ballx - ptx));
if (ptx < ballx) {
ang = ang + 3.14;
}
bvx = Math.cos(ang) * (passspeed - 1);
bvy = Math.sin(ang) * (passspeed - 1);
game.ball.vx = bvx;
game.ball.vy = bvy;
game.ball.xtemp = game.ball.xtemp + (4 * bvx);
game.ball.ytemp = game.ball.ytemp + (4 * bvy);
game.ball._stat = "free";
camTarg = game.ball;
camElast = camElastBall;
game["player" + passchosen]._stat = "scout";
who._stat = "stay";
}
}
function uncontWOB(who) {
who.funct = "uncontWOB";
if (who._stat == "lineup") {
who.targx = lineupx[who.no];
who.targy = lineupy[who.no];
who._stat = "runlineup";
}
if (who._stat == "runlineup") {
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = lineuprot[who.no];
who.vx = 0;
who.vy = 0;
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
} else {
who._stat = "stay";
linedup++;
if (((linedup >= ((2 * playersperteam) - 2)) && (_root.scorerTeam == 0)) && (half == 1)) {
messages.gotoAndPlay("go");
camTarg = game.ball;
}
}
who.anim.gotoAndStop(who.rot + 8);
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
} else if (who.rot == 3) {
who.vx = playerspeed45;
who.vy = 0;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
}
}
}
if (who._stat == "scout") {
who._stat = "runscout";
scoutcounter = 2;
if ((who.team == 1) && (actcontroller1 == "human")) {
i = 1;
while (i <= playersperteam) {
game["player" + team1[i]].highlightmc.gotoAndStop(1);
i++;
}
who.highlightmc.gotoAndStop(2);
_root.contplayer = who.no;
} else if ((who.team == 2) && (actcontroller2 == "human")) {
i = 1;
while (i <= playersperteam) {
game["player" + team2[i]].highlightmc.gotoAndStop(1);
i++;
}
who.highlightmc.gotoAndStop(2);
_root.contplayer = who.no;
}
}
if (who._stat == "runscout") {
who.targx = game.ball._x;
who.targy = game.ball._y;
scoutcounter++;
if (scoutcounter == 3) {
scoutcounter = 0;
if (_root.contplayer != who.no) {
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) > playerballdist)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) > playerballdist)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) > playerballdist)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) > playerballdist)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
who.targrot = 7;
}
}
} else {
if (Key.isDown(38)) {
who.targrot = 1;
}
if (Key.isDown(39)) {
who.targrot = 3;
}
if (Key.isDown(40)) {
who.targrot = 5;
}
if (Key.isDown(37)) {
who.targrot = 7;
}
if (Key.isDown(39) && (Key.isDown(38))) {
who.targrot = 2;
}
if (Key.isDown(39) && (Key.isDown(40))) {
who.targrot = 4;
}
if (Key.isDown(37) && (Key.isDown(38))) {
who.targrot = 8;
}
if (Key.isDown(37) && (Key.isDown(40))) {
who.targrot = 6;
}
}
}
if ((Math.abs(who._x - who.targx) < playerballdist) && (Math.abs(who._y - who.targy) < playerballdist)) {
var _local2 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local2 < maxpassspeed) {
if (who.team == 1) {
i = 1;
while (i < playersperteam) {
if ((game["player" + team1[i]]._stat != "runloseball") && (game["player" + team1[i]].funct != "uncontWB")) {
game["player" + team1[i]]._stat = "offensive";
} else if (game["player" + team1[i]].funct == "uncontWB") {
game["player" + team1[i]]._stat = "defensive";
}
if (game["player" + team2[i]]._stat != "runloseball") {
game["player" + team2[i]]._stat = "defensive";
}
i++;
}
who.oldplayer = game.ball.player;
game.ball.team = 1;
game.ball.player = who.no;
} else {
i = 1;
while (i < playersperteam) {
if ((game["player" + team2[i]]._stat != "runloseball") && (game["player" + team2[i]].funct != "uncontWB")) {
game["player" + team2[i]]._stat = "offensive";
} else if (game["player" + team2[i]].funct == "uncontWB") {
game["player" + team2[i]]._stat = "defensive";
}
if (game["player" + team1[i]]._stat != "runloseball") {
game["player" + team1[i]]._stat = "defensive";
}
i++;
}
who.oldplayer = game.ball.player;
game.ball.team = 2;
game.ball.player = who.no;
}
if (game.ball._stat == "player") {
game["player" + who.oldplayer]._stat = "loseball";
}
game.ball._stat = "player";
camTarg = who;
camElast = camElastPlayer;
who.onEnterFrame = function () {
uncontWB(who);
};
} else {
bouncer.bounce(who, game.ball);
}
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
} else if (who.rot == 3) {
who.vx = playerspeed45;
who.vy = 0;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
}
}
}
if (who._stat == "offensive") {
who.targx = (offensivex[who.no] + pointvariation) - random(2 * pointvariation);
who.targy = (offensivey[who.no] + pointvariation) - random(2 * pointvariation);
who.changecounter = 0;
changetimeax = random(changetime) + 8;
who.gonefrom = "offense";
who._stat = "runrun";
}
if (who._stat == "defensive") {
who.targx = (defensivex[who.no] + pointvariation) - random(2 * pointvariation);
who.targy = (defensivey[who.no] + pointvariation) - random(2 * pointvariation);
who.changecounter = 0;
changetimeax = random(changetime) + 8;
who.gonefrom = "defense";
who._stat = "runrun";
}
if (who._stat == "runrun") {
who.changecounter++;
if (who.changecounter > changetimeax) {
who.changecounter = 0;
if (who.gonefrom == "offense") {
who._stat = "offensive";
} else {
who._stat = "defensive";
}
}
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if (game.ball._stat == "free") {
if ((Math.abs(who._x - game.ball._x) < playerballdist) && (Math.abs(who._y - game.ball._y) < playerballdist)) {
var _local2 = Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy));
if (_local2 < maxpassspeed) {
if (who.team == 1) {
i = 1;
while (i < playersperteam) {
if ((game["player" + team1[i]]._stat != "runloseball") && (game["player" + team1[i]].funct != "uncontWB")) {
game["player" + team1[i]]._stat = "offensive";
} else if (game["player" + team1[i]].funct == "uncontWB") {
game["player" + team1[i]]._stat = "defensive";
}
if (game["player" + team2[i]]._stat != "runloseball") {
game["player" + team2[i]]._stat = "defensive";
}
i++;
}
game.ball.team = 1;
game.ball.player = who.no;
} else {
i = 1;
while (i < playersperteam) {
if ((game["player" + team2[i]]._stat != "runloseball") && (game["player" + team2[i]].funct != "uncontWB")) {
game["player" + team2[i]]._stat = "offensive";
} else if (game["player" + team2[i]].funct == "uncontWB") {
game["player" + team2[i]]._stat = "defensive";
}
if (game["player" + team1[i]]._stat != "runloseball") {
game["player" + team1[i]]._stat = "defensive";
}
i++;
}
game.ball.team = 2;
game.ball.player = who.no;
}
game.ball._stat = "player";
camTarg = who;
camElast = camElastPlayer;
who._stat = "offensive";
who.onEnterFrame = function () {
uncontWB(who);
};
} else {
bouncer.bounce(who, game.ball);
}
}
}
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
if (who.gonefrom == "offense") {
who._stat = "offensive";
} else if (who._stat != "runscout") {
who._stat = "defensive";
}
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
} else if (who.rot == 3) {
who.vx = playerspeed45;
who.vy = 0;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
}
}
}
if (who._stat == "takeball") {
who._stat = "runtakeball";
}
if (who._stat == "cheer") {
who.anim.gotoAndStop(32 + random(2));
who._stat = "runcheer";
}
if (who._stat == "runcheer") {
}
if (who._stat == "cry") {
who.anim.gotoAndStop(38 + random(2));
who._stat = "runcry";
}
if (who._stat == "runcry") {
}
if (who._stat == "stay") {
who.anim.gotoAndStop(who.rot + 8);
who._stat = "runstay";
}
if (who._stat == "runstay") {
}
}
function uncontWB(who) {
who.funct = "uncontWB";
if (half == 1) {
if (who.team == 1) {
possesion1 = possesion1 + 1;
} else {
possesion2 = possesion2 + 1;
}
} else if (who.team == 1) {
possesion1 = possesion1 + 1;
} else {
possesion2 = possesion2 + 1;
}
if (who._stat == "offensive") {
if ((who.team == 1) && (actcontroller1 == "human")) {
i = 1;
while (i <= playersperteam) {
game["player" + team1[i]].highlightmc.gotoAndStop(1);
i++;
}
who.highlightmc.gotoAndStop(2);
_root.contplayer = who.no;
} else if ((who.team == 2) && (actcontroller2 == "human")) {
i = 1;
while (i <= playersperteam) {
game["player" + team2[i]].highlightmc.gotoAndStop(1);
i++;
}
who.highlightmc.gotoAndStop(2);
_root.contplayer = who.no;
}
who.changecounter = 0;
who.targx = (offensivex[who.no] + pointvariation) - random(2 * pointvariation);
who.targy = (offensivey[who.no] + pointvariation) - random(2 * pointvariation);
who.gonefrom = "offense";
who._stat = "runrun";
}
if (who._stat == "defensive") {
who._stat = "defensive";
who.onEnterFrame = function () {
_root.uncontWOB(who);
};
}
if (who._stat == "runrun") {
who.changecounter++;
if (who.changecounter > changetimeax) {
who.changecounter = 0;
if (who.gonefrom == "offense") {
who._stat = "offensive";
} else {
who._stat = "defensive";
}
}
if (who.team == 1) {
who.bx = game.ball._x;
who.by = game.ball._y;
i = 1;
while (i < playersperteam) {
who.px = game["player" + team2[i]]._x;
who.py = game["player" + team2[i]]._y;
who.pbd = Math.sqrt(((who.bx - who.px) * (who.bx - who.px)) + ((who.by - who.py) * (who.by - who.py)));
if (who.pbd < passlimit) {
if (who._y > who.py) {
var _local2 = random(passrandom);
} else {
var _local2 = random(passrandom + 8);
}
if (_local2 == 1) {
if (_root.contplayer != who.no) {
who._stat = "pass";
}
}
}
i++;
}
} else {
who.bx = game.ball._x;
who.by = game.ball._y;
i = 1;
while (i < playersperteam) {
who.px = game["player" + team1[i]]._x;
who.py = game["player" + team1[i]]._y;
who.pbd = Math.sqrt(((who.bx - who.px) * (who.bx - who.px)) + ((who.by - who.py) * (who.by - who.py)));
if (who.pbd < passlimit) {
if (who._y < who.py) {
var _local2 = random(passrandom);
} else {
var _local2 = random(passrandom + 8);
}
if (_local2 == 1) {
if (_root.contplayer != who.no) {
who._stat = "pass";
}
}
}
i++;
}
}
if (_root.contplayer != who.no) {
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
} else {
if (Key.isDown(38)) {
who.targrot = 1;
}
if (Key.isDown(39)) {
who.targrot = 3;
}
if (Key.isDown(40)) {
who.targrot = 5;
}
if (Key.isDown(37)) {
who.targrot = 7;
}
if (Key.isDown(39) && (Key.isDown(38))) {
who.targrot = 2;
}
if (Key.isDown(39) && (Key.isDown(40))) {
who.targrot = 4;
}
if (Key.isDown(37) && (Key.isDown(38))) {
who.targrot = 8;
}
if (Key.isDown(37) && (Key.isDown(40))) {
who.targrot = 6;
}
}
if (_root.contplayer != who.no) {
if (who.team == 1) {
if (who._y < who.targy) {
who._stat = "shoot";
}
} else if (who._y > who.targy) {
who._stat = "shoot";
}
}
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
if (_root.contplayer != who.no) {
who._stat = "shoot";
}
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
who.vx = playerspeed;
who.vy = 0;
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
who.vx = who.vx * fatigue;
who.vy = who.vy * fatigue;
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
}
if (_root.contplayer == who.no) {
if (Key.isDown(67)) {
who._stat = "shoot";
}
}
if (_root.contplayer == who.no) {
if (Key.isDown(88)) {
who._stat = "pass";
}
}
}
if (who._stat == "shoot") {
if (who.rot == 1) {
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
shootdirection = random(3) + 1;
who.targx = _root[("goal" + who.team) + "x"][shootdirection];
who.targy = _root[("goal" + who.team) + "y"][shootdirection];
who.shootcount = 0;
shootframeax = 0;
shootframe = random(8) + 7;
var _local5 = Math.sqrt(((who.targx - game.ball._x) * (who.targx - game.ball._x)) + ((who.targy - game.ball._y) * (who.targy - game.ball._y)));
var _local3 = shootframe + Math.round(_local5 / 5);
dff = _local3 - (2 * random(_local3 + 1));
if (who.anim._currentframe < 9) {
who.anim.gotoAndStop(who.anim._currentframe + 16);
} else {
who.anim.gotoAndStop(who.anim._currentframe + 8);
}
_root["arrows" + who.team].gotoAndStop(2);
who.targx = who.targx + dff;
who._stat = "runshoot";
}
if (who._stat == "runshoot") {
shoottrigx = game.ball.xtemp;
shoottrigy = game.ball.ytemp;
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
} else {
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot + 16);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
who.vx = playerspeed;
who.vy = 0;
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
}
_root["arrows" + who.team]["arrow" + shootdirection].gotoAndStop(2);
who.shootcount++;
if (shootframeax < shootframe) {
shootframeax++;
_root["arrows" + who.team].bar.gotoAndStop(shootframeax);
}
if (who.shootcount == shootframes) {
ptx = _root[("goal" + who.team) + "x"][shootdirection] + dff;
pty = _root[("goal" + who.team) + "y"][shootdirection];
ballx = game.ball._x;
bally = game.ball._y;
axptx = _root[("goal" + who.team) + "x"][2];
axpty = _root[("goal" + who.team) + "y"][2];
shootscore = Math.round(Math.sqrt(((axptx - ballx) * (axptx - ballx)) + ((axpty - bally) * (axpty - bally))) * 100);
if (half == 1) {
if (who.team == 1) {
shots1 = shots1 + 1;
} else {
shots2 = shots2 + 1;
}
} else if (who.team == 1) {
shots1 = shots1 + 1;
} else {
shots2 = shots2 + 1;
}
ang = Math.atan((bally - pty) / (ballx - ptx));
if (ptx < ballx) {
ang = ang + 3.14;
}
bvx = Math.cos(ang) * (shootframe + 16);
bvy = Math.sin(ang) * (shootframe + 16);
game.ball.vx = bvx;
game.ball.vy = bvy;
game.ball._stat = "free";
camTarg = game.ball;
camElast = camElastBall;
_root["arrows" + who.team].gotoAndStop(1);
_root.scorer = who;
who._stat = "loseball";
}
}
if (who._stat == "pass") {
bounceBall();
if (who.rot == 1) {
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
if (who.team == 1) {
var _local4 = random(2);
if (_local4 == 1) {
if ((who.no + 1) < (2 + playersperteam)) {
passchosen = who.no + 1;
} else {
passchosen = who.no - 1;
}
} else if ((who.no - 1) > 2) {
passchosen = who.no - 1;
} else {
passchosen = who.no + 1;
}
} else {
var _local4 = random(2);
if (_local4 == 1) {
if ((who.no + 1) < (1 + (2 * playersperteam))) {
passchosen = who.no + 1;
} else {
passchosen = who.no - 1;
}
} else if ((who.no - 1) > (2 + playersperteam)) {
passchosen = who.no - 1;
} else {
passchosen = who.no + 1;
}
}
who.targx = game["player" + passchosen]._x;
who.targy = game["player" + passchosen]._y;
who.shootcount = 0;
who._stat = "runpass";
}
if (who._stat == "runpass") {
if ((who._x > who.targx) && (who._y > who.targy)) {
who.targrot = 8;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if ((who._x < who.targx) && (who._y > who.targy)) {
who.targrot = 2;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 1;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x < who.targx) && (who._y < who.targy)) {
who.targrot = 4;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 3;
}
}
if ((who._x > who.targx) && (who._y < who.targy)) {
who.targrot = 6;
if ((Math.abs(who._x - who.targx) < playerspeed) && (Math.abs(who._y - who.targy) > playerspeed)) {
who.targrot = 5;
}
if ((Math.abs(who._x - who.targx) > playerspeed) && (Math.abs(who._y - who.targy) < playerspeed)) {
who.targrot = 7;
}
}
if (who.rot != who.targrot) {
if (who.rot > who.targrot) {
who.diffrot = who.rot - who.targrot;
if (who.diffrot > 4) {
who.rotpas = 1;
} else {
who.rotpas = -1;
}
} else {
who.diffrot = who.targrot - who.rot;
if (who.diffrot > 4) {
who.rotpas = -1;
} else {
who.rotpas = 1;
}
}
who.rot = who.rot + who.rotpas;
if (who.rot > 8) {
who.rot = who.rot - 8;
} else if (who.rot < 1) {
who.rot = who.rot + 8;
}
}
who.anim.gotoAndStop(who.rot);
if (who.rot == 1) {
who.vx = 0;
who.vy = -playerspeed;
game.ball._x = who._x;
game.ball._y = who._y - balldist;
} else if (who.rot == 2) {
who.vx = playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y - balldist45;
} else if (who.rot == 3) {
who.vx = playerspeed;
who.vy = 0;
game.ball._x = who._x + balldist;
game.ball._y = who._y;
} else if (who.rot == 4) {
who.vx = playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x + balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 5) {
who.vx = 0;
who.vy = playerspeed;
game.ball._x = who._x;
game.ball._y = who._y + balldist;
} else if (who.rot == 6) {
who.vx = -playerspeed45;
who.vy = playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y + balldist45;
} else if (who.rot == 7) {
who.vx = -playerspeed;
who.vy = 0;
game.ball._x = who._x - balldist;
game.ball._y = who._y;
} else if (who.rot == 8) {
who.vx = -playerspeed45;
who.vy = -playerspeed45;
game.ball._x = who._x - balldist45;
game.ball._y = who._y - balldist45;
}
game.ball.xtemp = game.ball._x;
game.ball.ytemp = game.ball._y;
who.shootcount++;
if (who.shootcount == passframes) {
ptx = game["player" + passchosen]._x;
pty = game["player" + passchosen]._y;
ballx = game.ball._x;
bally = game.ball._y;
ang = Math.atan((bally - pty) / (ballx - ptx));
if (ptx < ballx) {
ang = ang + 3.14;
}
bvx = Math.cos(ang) * passspeed;
bvy = Math.sin(ang) * passspeed;
game.ball.vx = bvx;
game.ball.vy = bvy;
game.ball._stat = "free";
camTarg = game.ball;
camElast = camElastBall;
game["player" + passchosen]._stat = "scout";
who._stat = "loseball";
}
}
if (who._stat == "loseball") {
who.losecount = 0;
_root["arrows" + who.team].gotoAndStop(1);
who._stat = "runloseball";
who.anim.gotoAndStop(who.rot + 8);
}
if (who._stat == "runloseball") {
who.vx = 0;
who.vy = 0;
who.losecount++;
if (who.losecount > stuntime) {
who._stat = "defensive";
}
}
if (who._stat == "stay") {
}
}
function movePlayers() {
i = 1;
while (i <= (2 * playersperteam)) {
game["player" + i].xtemp = game["player" + i].xtemp + game["player" + i].vx;
game["player" + i].ytemp = game["player" + i].ytemp + game["player" + i].vy;
i++;
}
}
function moveBall() {
if (game.ball._stat == "free") {
game.ball.vx = game.ball.vx * friction;
game.ball.vy = game.ball.vy * friction;
game.ball.vx = Math.round(game.ball.vx * 100) / 100;
game.ball.vy = Math.round(game.ball.vy * 100) / 100;
if ((Math.abs(game.ball.vx) < 0.2) && (Math.abs(game.ball.vy) < 0.2)) {
game.ball.vx = 0;
game.ball.vy = 0;
}
game.ball.xtemp = game.ball.xtemp + game.ball.vx;
game.ball.ytemp = game.ball.ytemp + game.ball.vy;
}
}
function checkRoundCollisions() {
i = 1;
while (i <= 4) {
if (checkCollision(game["post" + i], game.ball)) {
bouncer.bounce(game["post" + i], game.ball);
}
i++;
}
i = 1;
while (i <= (2 * playersperteam)) {
j = i + 1;
while (j <= (2 * playersperteam)) {
if (checkCollision(game["player" + i], game["player" + j])) {
vx1 = Math.abs(game["player" + i].vx);
vy1 = Math.abs(game["player" + i].vy);
vx2 = Math.abs(game["player" + j].vx);
vy2 = Math.abs(game["player" + j].vy);
if ((vx1 <= vy1) && (vx2 <= vy2)) {
if (game["player" + i].xtemp < game["player" + j].xtemp) {
game["player" + i].xtemp = game["player" + i].xtemp - (playerspeed / 1.5);
game["player" + j].xtemp = game["player" + j].xtemp + (playerspeed / 1.5);
game["player" + i].targx = game["player" + i].targx - (playerspeed / 1.5);
game["player" + j].targx = game["player" + j].targx + (playerspeed / 1.5);
} else {
game["player" + i].xtemp = game["player" + i].xtemp + (playerspeed / 1.5);
game["player" + j].xtemp = game["player" + j].xtemp - (playerspeed / 1.5);
game["player" + i].targx = game["player" + i].targx + (playerspeed / 1.5);
game["player" + j].targx = game["player" + j].targx - (playerspeed / 1.5);
}
} else if (game["player" + i].ytemp < game["player" + j].ytemp) {
game["player" + i].ytemp = game["player" + i].ytemp - (playerspeed / 1.5);
game["player" + j].ytemp = game["player" + j].ytemp + (playerspeed / 1.5);
} else {
game["player" + i].ytemp = game["player" + i].ytemp + (playerspeed / 1.5);
game["player" + j].ytemp = game["player" + j].ytemp - (playerspeed / 1.5);
}
}
j++;
}
i++;
}
}
function checkWalls() {
if ((game.ball.xtemp + ballradius) > game.right._x) {
game.ball.xtemp = game.right._x - ballradius;
game.ball.vx = -Math.abs(game.ball.vx);
bounceBall();
} else if ((game.ball.xtemp - ballradius) < game.left._x) {
game.ball.xtemp = game.left._x + ballradius;
game.ball.vx = Math.abs(game.ball.vx);
bounceBall();
}
if ((game.ball.ytemp + ballradius) > game.bottom._y) {
if ((game.ball._x > game.post1._x) && (game.ball._x < game.post2._x)) {
setupGoal(2);
} else {
game.ball.ytemp = game.bottom._y - ballradius;
game.ball.vy = -Math.abs(game.ball.vy);
bounceBall();
}
} else if ((game.ball.ytemp - ballradius) < game.top._y) {
if ((game.ball._x > game.post1._x) && (game.ball._x < game.post2._x)) {
setupGoal(1);
} else {
game.ball.ytemp = game.top._y + ballradius;
game.ball.vy = Math.abs(game.ball.vy);
bounceBall();
}
}
i = 3;
while (i <= (2 * playersperteam)) {
if ((game["player" + i].xtemp + (ballradius + playerradius)) > game.right._x) {
game["player" + i].xtemp = game.right._x - (ballradius + playerradius);
game["player" + i].vx = -Math.abs(game["player" + i].vx);
} else if ((game["player" + i].xtemp - (ballradius + playerradius)) < game.left._x) {
game["player" + i].xtemp = game.left._x + (ballradius + playerradius);
game["player" + i].vx = Math.abs(game["player" + i].vx);
}
if ((game["player" + i].ytemp + (ballradius + playerradius)) > game.bottom._y) {
game["player" + i].ytemp = game.bottom._y - (ballradius + playerradius);
game["player" + i].ball.vy = -Math.abs(game["player" + i].vy);
} else if ((game["player" + i].ytemp - (ballradius + playerradius)) < game.top._y) {
game["player" + i].ytemp = game.top._y + (ballradius + playerradius);
game["player" + i].vy = Math.abs(game["player" + i].vy);
}
i++;
}
}
function renderPlayers() {
i = 1;
while (i <= (2 * playersperteam)) {
game["player" + i].xtemp = Math.round(game["player" + i].xtemp * 100) / 100;
game["player" + i].ytemp = Math.round(game["player" + i].ytemp * 100) / 100;
game["player" + i]._x = game["player" + i].xtemp;
game["player" + i]._y = game["player" + i].ytemp;
i++;
}
}
function renderBall() {
game.ball._x = game.ball.xtemp;
game.ball._y = game.ball.ytemp;
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
}
function checkCollision(b1, b2) {
var _local4 = b1.xtemp;
var _local2 = b2.xtemp;
var _local3 = b1.ytemp;
var _local1 = b2.ytemp;
var _local6 = b1._width / 2;
var _local5 = b2._width / 2;
var _local9 = Math.sqrt(((_local4 - _local2) * (_local4 - _local2)) + ((_local3 - _local1) * (_local3 - _local1)));
if (_local9 < (_local6 + _local5)) {
return(true);
}
return(false);
}
function moveCamera(targ) {
if (targ != game.ball) {
xtarg = ((-targ._x) + (Stage.width / 2)) - (20 * targ.vx);
ytarg = ((-targ._y) + (Stage.height / 2)) - (20 * targ.vy);
xcam = game._x;
ycam = game._y;
camvx = Math.round(xtarg - xcam) / camElast;
camvy = Math.round(ytarg - ycam) / camElast;
game._x = game._x + camvx;
game._y = game._y + camvy;
} else {
xtarg = (-targ._x) + (Stage.width / 2);
ytarg = (-targ._y) + (Stage.height / 2);
xcam = game._x;
ycam = game._y;
camvx = Math.round(xtarg - xcam) / camElast;
camvy = Math.round(ytarg - ycam) / camElast;
game._x = game._x + camvx;
game._y = game._y + camvy;
}
}
function setupGoal(whoScored) {
timermc.stop();
timermc.gotoAndStop(1);
_root.scoredcount = 0;
_root.scoredcount2 = 0;
_root.replaycounter1 = 0;
_root.replaycounter2 = 0;
_root.scored = 1;
_root.scorerTeam = whoScored;
if (half == 1) {
_root["score" + scorerTeam]++;
} else if (scorerTeam == 2) {
_root.score1++;
} else {
_root.score2++;
}
scoremsg = (((((teamshort1 + " ") + score1) + " - ") + score2) + " ") + teamshort2;
messages.gotoAndPlay("goal");
game.player2.rot = 5;
game.player1.rot = 1;
if (game.player1._stat != "runjump") {
game.player1._stat = "stay";
}
if (game.player2._stat != "runjump") {
game.player2._stat = "stay";
}
if (whoScored == 1) {
game.ball.vy = -Math.abs(game.ball.vy);
i = 1;
while (i < playersperteam) {
game["player" + team1[i]].vx = 0;
game["player" + team1[i]].vy = 0;
game["player" + team2[i]].vx = 0;
game["player" + team2[i]].vy = 0;
delete game["player" + team1[i]].onEnterFrame;
delete game["player" + team2[i]].onEnterFrame;
var _local2 = random(3);
if (_local2 < 2) {
game["player" + team1[i]].anim.gotoAndStop(33 + random(2));
} else {
game["player" + team1[i]].anim.gotoAndStop(game["player" + team1[i]].rot + 8);
}
_local2 = random(3);
if (_local2 < 2) {
game["player" + team2[i]].anim.gotoAndStop(38 + random(2));
} else {
game["player" + team2[i]].anim.gotoAndStop(game["player" + team2[i]].rot + 8);
}
i++;
}
} else {
game.ball.vy = Math.abs(game.ball.vy);
i = 1;
while (i < playersperteam) {
game["player" + team1[i]].vx = 0;
game["player" + team1[i]].vy = 0;
game["player" + team2[i]].vx = 0;
game["player" + team2[i]].vy = 0;
delete game["player" + team1[i]].onEnterFrame;
delete game["player" + team2[i]].onEnterFrame;
var _local2 = random(2);
if (_local2 == 1) {
game["player" + team2[i]].anim.gotoAndStop(33 + random(2));
} else {
game["player" + team2[i]].anim.gotoAndStop(game["player" + team2[i]].rot + 8);
}
_local2 = random(2);
if (_local2 == 1) {
game["player" + team1[i]].anim.gotoAndStop(38 + random(2));
} else {
game["player" + team1[i]].anim.gotoAndStop(game["player" + team1[i]].rot + 8);
}
i++;
}
}
_root.scorer.anim.gotoAndStop(33 + random(2));
}
function ballInNet() {
if (scorerTeam == 1) {
if ((game.ball.xtemp - ballradius) < game.post1._x) {
game.ball.xtemp = game.post1._x + ballradius;
game.ball.vx = Math.abs(game.ball.vx) / 4;
} else if ((game.ball.xtemp + ballradius) > game.post2._x) {
game.ball.xtemp = game.post2._x - ballradius;
game.ball.vx = (-Math.abs(game.ball.vx)) / 4;
}
if (game.ball.ytemp < (game.post3._y - 20)) {
game.gate1.play();
game.ball.ytemp = game.post3._y - 20;
game.ball.vy = Math.abs(game.ball.vy) / 8;
nettrigx = game.ball.xtemp;
nettrigy = game.ball.ytemp;
}
} else {
if ((game.ball.xtemp - ballradius) < game.post1._x) {
game.ball.xtemp = game.post1._x + ballradius;
game.ball.vx = Math.abs(game.ball.vx) / 4;
} else if ((game.ball.xtemp + ballradius) > game.post2._x) {
game.ball.xtemp = game.post2._x - ballradius;
game.ball.vx = (-Math.abs(game.ball.vx)) / 4;
}
if (game.ball.ytemp > (game.post1._y + 20)) {
game.gate2.play();
game.ball.ytemp = game.post1._y + 20;
game.ball.vy = (-Math.abs(game.ball.vy)) / 8;
nettrigx = game.ball.xtemp;
nettrigy = game.ball.ytemp;
}
}
}
function bounceBall() {
game.umbra.play();
}
function setBallFrame() {
if (game.ball._stat == "free") {
var _local3 = Math.round(Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy)) * 2);
var _local4 = Math.atan(game.ball.vy / game.ball.vx);
var _local2 = Math.round(_local4 * 57.32);
if (game.ball.vx < 0) {
_local2 = _local2 + 180;
}
game.ball._rotation = _local2;
} else if (game.ball._stat == "player") {
var _local3 = Math.round(playerspeed / 2);
var _local1 = game["player" + game.ball.player].rot;
if (_local1 == 1) {
var _local2 = 0;
} else if (_local1 == 2) {
var _local2 = 45;
} else if (_local1 == 3) {
var _local2 = 90;
} else if (_local1 == 4) {
var _local2 = 135;
} else if (_local1 == 5) {
var _local2 = 180;
} else if (_local1 == 6) {
var _local2 = 225;
} else if (_local1 == 7) {
var _local2 = 270;
} else if (_local1 == 8) {
var _local2 = 315;
}
game.ball._rotation = _local2 - 90;
} else if (game.ball._stat == "keeper") {
var _local3 = 0;
} else {
var _local3 = Math.round(Math.sqrt((game.ball.vx * game.ball.vx) + (game.ball.vy * game.ball.vy)) * 2);
}
ballframe = ballframe + _local3;
if (ballframe > 36) {
ballframe = ballframe - 36;
}
if (ballframe > 36) {
ballframe = ballframe - 36;
}
if (ballframe > 36) {
ballframe = ballframe - 36;
}
game.ball.gotoAndStop(ballframe);
}
function getReplay() {
if (_tposx.length < replaytime) {
i = 1;
while (i <= 8) {
_root["_pposx" + i].push(game["player" + i]._x);
_root["_pposy" + i].push(game["player" + i]._y);
_root["_pframea" + i].push(game["player" + i].anim._currentframe);
_root["_pframeb" + i].push(game["player" + i].anim.inside._currentframe);
i++;
}
_bposx.push(game.ball._x);
_bposy.push(game.ball._y);
_brot.push(game.ball._rotation);
_bframe.push(game.ball._currentframe);
_tposx.push(game._x);
_tposy.push(game._y);
} else {
i = 1;
while (i <= 8) {
_root["_pposx" + i].shift();
_root["_pposy" + i].shift();
_root["_pframea" + i].shift();
_root["_pframeb" + i].shift();
i++;
}
_bposx.shift();
_bposy.shift();
_bframe.shift();
_tposx.shift();
_tposy.shift();
i = 1;
while (i <= 8) {
_root["_pposx" + i].push(game["player" + i]._x);
_root["_pposy" + i].push(game["player" + i]._y);
_root["_pframea" + i].push(game["player" + i].anim._currentframe);
_root["_pframeb" + i].push(game["player" + i].anim.inside._currentframe);
i++;
}
_bposx.push(game.ball._x);
_bposy.push(game.ball._y);
_brot.push(game.ball._rotation);
_bframe.push(game.ball._currentframe);
_tposx.push(game._x);
_tposy.push(game._y);
}
}
function displayReplay() {
_root.replaycounter1++;
if (_root.replaycounter1 == replayspeed) {
_root.replaycounter1 = 0;
_root.replaycounter2++;
i = 1;
while (i <= 8) {
game["player" + i]._x = _root["_pposx" + i][replaycounter2];
game["player" + i]._y = _root["_pposy" + i][replaycounter2];
game["player" + i].anim.gotoAndStop(_root["_pframea" + i][replaycounter2]);
game["player" + i].anim.inside.gotoAndStop(_root["_pframeb" + i][replaycounter2]);
i++;
}
game.ball._x = _bposx[replaycounter2];
game.ball._y = _bposy[replaycounter2];
game.ball._rotation = _brot[replaycounter2];
game.ball.gotoAndStop(_bframe[replaycounter2]);
game.umbra._x = game.ball._x;
game.umbra._y = game.ball._y + 4;
game._x = _tposx[replaycounter2];
game._y = _tposy[replaycounter2];
if ((Math.round(game.ball._x) == Math.round(nettrigx)) && (Math.round(game.ball._y) == Math.round(nettrigy))) {
trace("anim net");
if (game.ball._y < 400) {
game.gate1.gotoAndPlay("replay");
} else {
game.gate2.gotoAndPlay("replay");
}
}
if ((Math.round(game.ball._x) == Math.round(shoottrigx)) && (Math.round(game.ball._y) == Math.round(shoottrigy))) {
trace("anim shoot");
replayspeed = replayspeedini + 6;
}
if (replayspeed == (replayspeedini + 6)) {
conttrig++;
if (conttrig == 8) {
replayspeed = replayspeedini;
}
}
if (replaycounter2 >= replaytime) {
_root.stat = "reset";
}
}
}
function traceStats() {
i = 1;
while (i <= 8) {
trace((i + " : ") + game["player" + i]._stat);
trace((i + " : function : ") + game["player" + i].funct);
i++;
}
trace("--------------------");
}
function step() {
if (stat == "idle") {
}
if (stat == "live") {
moveCamera(camTarg);
movePlayers();
moveBall();
checkRoundCollisions();
if (scored == 0) {
checkWalls();
} else {
ballInNet();
if (_root.scoredcount < 24) {
_root.scoredcount++;
} else {
camTarg = _root.scorer;
_root.scoredcount2++;
if (_root.scoredcount2 > timetocheer) {
i = 1;
while (i <= 8) {
game["player" + i].highlightmc.gotoAndStop(1);
i++;
}
_root.stat = "replay";
conttrig = 0;
replayspeed = replayspeedini;
skiper.play();
arrows1.gotoAndStop(1);
arrows2.gotoAndStop(1);
replayer.play();
}
}
}
renderPlayers();
renderBall();
setBallFrame();
getReplay();
}
if (stat == "replay") {
displayReplay();
}
if (stat == "reset") {
_root.stat = "live";
timermc.play();
_root.scored = 0;
resetPlayers();
if (scorerTeam == 1) {
_root.game.ball.vy = -4;
} else {
_root.game.ball.vy = 4;
}
_root.bounceBall();
_root.gameStarted = true;
}
if (stat == "reset2") {
_root.stat = "live";
timermc.play();
_root.scored = 0;
resetPlayers();
if (whostarted == 2) {
_root.game.ball.vy = -4;
} else {
_root.game.ball.vy = 4;
}
_root.bounceBall();
_root.gameStarted = true;
}
}
stop();
startGame();
Instance of Symbol 707 MovieClip "timermc" in Frame 18
onClipEvent (load) {
this.ctime = 0;
}
Instance of Symbol 708 MovieClip in Frame 18
onClipEvent (enterFrame) {
_parent.step();
}
Instance of Symbol 709 MovieClip "bouncer" in Frame 18
onClipEvent (load) {
function bounce(clip, clip2) {
var _local10 = Math.atan2(clip._y - clip2._y, clip._x - clip2._x);
this._rotation = (_local10 * 180) / Math.PI;
var _local4 = {x:clip2.vx * 10, y:clip2.vy * 10};
this.globalToLocal(_local4);
var _local6 = {x:_local4.x, y:0};
this.localToGlobal(_local6);
var _local5 = {x:clip.vx * 10, y:clip.vy * 10};
this.globalToLocal(_local5);
var _local3 = {x:_local5.x, y:0};
this.localToGlobal(_local3);
if ((_local4.x <= 0) && (_local5.x >= 0)) {
return(undefined);
}
var _local9 = (_local6.x - _local3.x) / 7;
var _local8 = (_local6.y - _local3.y) / 7;
clip2.vx = clip2.vx - _local9;
clip2.vy = clip2.vy - _local8;
}
}
Frame 19
_root.gotoAndStop("coperta");
Frame 20
showads = true;
targetURL = "http://www.gamesheep.com/game/the-champions-07/";
v_gameid = "the-champions-07";
v_scorevar = _root.score;
v_color = "33CC33";
Frame 22
_root.gotoAndPlay(_currentframe - 1);
Frame 29
if (_root.lang == "rom") {
_root.locatie = _url;
if (_root.locatie.slice(0, 21) == "http://www.ejocuri.ro") {
play();
} else {
gotoAndPlay ("finad");
}
} else {
_root.locatie = _url;
if (_root.locatie.slice(0, 24) == "http://www.gamesheep.com") {
play();
} else {
gotoAndPlay ("finad");
}
}
Frame 31
gotoAndStop ("coperta");
Symbol 2 MovieClip Frame 1
this._visible = false;
Symbol 10 MovieClip Frame 1
stop();
if (_root.lang == "rom") {
gotoAndStop (2);
}
Symbol 11 MovieClip Frame 1
_root.stop();
var stageWidth = Stage.width;
var stageHeight = Stage.height;
var centerStageX = Math.round(stageWidth / 2);
var centerStageY = Math.round(stageHeight / 2);
this._x = centerStageX;
this._y = centerStageY;
Symbol 11 MovieClip Frame 3
xyb1 = _root.getBytesLoaded();
xyb2 = _root.getBytesTotal();
xytgFrame = Math.round((xyb1 / xyb2) * 100) + 1;
prelbar.gotoAndStop(xytgFrame);
Symbol 11 MovieClip Frame 5
if ((xyb1 > 40000) && (xyb2 > 50)) {
stop();
_root.play();
} else {
gotoAndPlay ("xloop1");
}
Symbol 14 MovieClip Frame 1
this._visible = false;
Symbol 17 Button
on (release) {
if (_root.lang == "eng") {
getURL ("http://www.gamesheep.com", "_blank");
} else {
getURL ("http://www.ejocuri.ro", "_blank");
}
}
Symbol 32 MovieClip Frame 10
this.gotoAndPlay(1);
Symbol 56 MovieClip Frame 33
stop();
Symbol 67 MovieClip Frame 1
stop();
Symbol 67 MovieClip Frame 102
stop();
_parent._parent.gotoAndPlay("loopi");
Symbol 67 MovieClip Frame 103
stop();
Symbol 67 MovieClip Frame 202
stop();
_parent._parent.gotoAndPlay("loopi");
Symbol 70 MovieClip Frame 14
stop();
Symbol 72 MovieClip Frame 1
_root.stop();
var stageWidth = Stage.width;
var stageHeight = Stage.height;
var centerStageX = Math.round(stageWidth / 2);
var centerStageY = Math.round(stageHeight / 2);
if (_root.lang == "rom") {
this._x = centerStageX;
this._y = centerStageY;
} else {
this._x = centerStageX;
this._y = centerStageY - 50;
}
Symbol 72 MovieClip Frame 3
xPos = _x;
yPos = _y;
backbuton._x = backbuton._x - xPos;
backbuton._y = backbuton._y - yPos;
var stageWidth = Stage.width;
var stageHeight = Stage.height;
var centerStageX = (stageWidth / 2);
var centerStageY = (stageHeight / 2);
backbuton._width = stageWidth;
backbuton._height = stageHeight;
xyb1 = _root.getBytesLoaded();
xyb2 = _root.getBytesTotal();
if (xyb1 >= xyb2) {
stop();
if (_root.lang == "eng") {
prelbar2.bar.gotoAndPlay(2);
} else {
prelbar2.bar.gotoAndPlay(104);
}
} else {
play();
}
Symbol 72 MovieClip Frame 4
xyb1 = _root.getBytesLoaded();
xyb2 = _root.getBytesTotal();
xytgFrame = Math.round((xyb1 / xyb2) * 100) + 1;
if (_root.lang == "eng") {
prelbar2.bar.gotoAndStop(xytgFrame);
} else {
prelbar2.bar.gotoAndStop(xytgFrame + 102);
}
Symbol 72 MovieClip Frame 6
if (xyb1 >= xyb2) {
play();
} else {
gotoAndPlay ("xloop2");
}
Symbol 72 MovieClip Frame 28
_root.play();
Symbol 76 MovieClip Frame 1
stop();
if (_root._lang == "rom") {
gotoAndStop (2);
}
Symbol 79 MovieClip Frame 1
this._visible = 0;
Symbol 82 MovieClip Frame 1
_root.stop();
this._x = -10000;
Symbol 82 MovieClip Frame 2
loader.loadMovie("ad.swf");
Symbol 82 MovieClip Frame 5
b1 = loader.getBytesLoaded();
b2 = loader.getBytesTotal();
if ((b1 >= b2) && (b1 > 50)) {
play();
} else {
gotoAndPlay ("loop");
}
Symbol 82 MovieClip Frame 6
loader._x = loader._x - Math.round(loader._width / 2);
loader._y = loader._y - Math.round(loader._height / 2);
if (_root._currentframe <= 10) {
if (_root.adtype == "preloader") {
loader.play();
} else {
stop();
_root.play();
}
} else if (_root.adtype == "preloader") {
stop();
_root.play();
} else {
loader.play();
}
Symbol 82 MovieClip Frame 7
stop();
var stageWidth = Stage.width;
var stageHeight = Stage.height;
var centerStageX = Math.round(stageWidth / 2);
var centerStageY = Math.round(stageHeight / 2);
this._x = centerStageX;
this._y = centerStageY;
Symbol 87 Button
on (release) {
play();
}
Symbol 88 Button
on (release) {
_root.vsubmit = false;
_root.gotoAndPlay("submitscore");
}
Symbol 89 Button
on (release) {
_root.gotoAndPlay("instruc");
}
Symbol 90 Button
on (release) {
if (_root.lang == "eng") {
getURL ("http://www.gamesheep.com", "_blank");
} else {
getURL ("http://www.ejocuri.ro", "_blank");
}
}
Symbol 91 Button
on (release) {
if (_root.lang == "eng") {
getURL ("http://www.gamesheep.com/free-games-for-website.php", "_blank");
} else {
getURL ("http://www.ejocuri.ro/jocuri-pentru-site.php", "_blank");
}
}
Symbol 109 MovieClip Frame 1
stop();
Symbol 109 MovieClip Frame 113
this.gotoAndStop(1);
Symbol 109 MovieClip Frame 307
this.gotoAndStop(1);
Symbol 109 MovieClip Frame 431
this.gotoAndStop(1);
Symbol 111 Button
on (release, keyPress "s") {
if (_root.sunet == 1) {
_root.sunet = 0;
} else {
_root.sunet = 1;
}
}
on (release, keyPress "S") {
if (_root.sunet == 1) {
_root.sunet = 0;
} else {
_root.sunet = 1;
}
}
Symbol 112 Button
on (release, keyPress "q") {
_root.gotoAndStop("coperta");
}
on (release, keyPress "Q") {
_root.gotoAndStop("coperta");
}
Symbol 113 Button
on (release, keyPress "m") {
if (_root.muzica == 1) {
_root.muzica = 0;
_root.s_muzica.stop();
} else {
_root.muzica = 1;
_root.s_muzica.start(0, 9999);
}
}
on (release, keyPress "M") {
if (_root.muzica == 1) {
_root.muzica = 0;
_root.s_muzica.stop();
} else {
_root.muzica = 1;
_root.s_muzica.start(0, 9999);
}
}
Symbol 117 MovieClip Frame 1
stop();
Symbol 117 MovieClip Frame 5
gotoAndStop (1);
Symbol 117 MovieClip Frame 9
gotoAndStop (1);
Symbol 117 MovieClip Frame 13
gotoAndStop (1);
Symbol 131 Button
on (release) {
controller1 = "human";
controller2 = "cpu";
gotoAndPlay ("play");
}
Symbol 132 Button
on (release) {
controller2 = "human";
controller1 = "cpu";
gotoAndPlay ("play");
}
Symbol 139 MovieClip Frame 1
stop();
Symbol 177 MovieClip Frame 1
stop();
Symbol 180 MovieClip Frame 1
stop();
Symbol 415 MovieClip Frame 1
stop();
Symbol 626 MovieClip Frame 1
stop();
Symbol 627 MovieClip Frame 1
stop();
Symbol 639 MovieClip Frame 1
stop();
Symbol 639 MovieClip Frame 10
gotoAndStop (1);
Symbol 639 MovieClip Frame 40
gotoAndStop (1);
Symbol 646 MovieClip Frame 1
stop();
Symbol 646 MovieClip Frame 10
gotoAndStop (1);
Symbol 646 MovieClip Frame 40
gotoAndStop (1);
Symbol 650 Button
on (keyPress "X") {
_parent.resetPlayers();
gotoAndPlay ("go");
}
on (keyPress "x") {
_parent.resetPlayers();
gotoAndPlay ("go");
}
Symbol 659 MovieClip Frame 2
rn = random(20);
if (rn == 1) {
stop();
_parent._parent.starter = 2;
_root.whostarted = 2;
_parent.play();
}
Symbol 659 MovieClip Frame 4
rn = random(20);
if (rn == 1) {
stop();
_parent._parent.starter = 1;
_root.whostarted = 1;
_parent.play();
}
Symbol 668 Button
on (keyPress "X") {
play();
}
on (keyPress "x") {
play();
}
Symbol 669 Button
on (release) {
play();
}
Symbol 678 Button
on (release) {
cod = 2;
play();
}
Symbol 679 Button
on (release) {
cod = 1;
play();
}
Symbol 690 MovieClip Frame 1
stop();
Symbol 690 MovieClip Frame 2
vstxt = (_root.teamlong1 + "\nvs\n") + _root.teamlong2;
play();
Symbol 690 MovieClip Frame 42
_parent.camTarg = _parent.game.ball;
Symbol 690 MovieClip Frame 44
stop();
Symbol 690 MovieClip Frame 46
_parent.camTarg = _parent.game.ball;
Symbol 690 MovieClip Frame 55
stop();
Symbol 690 MovieClip Frame 111
if (_root.sunet == 1) {
_root.s_arbitru1.start();
}
Symbol 690 MovieClip Frame 121
if (_parent.starter == 1) {
_parent.game.ball.vy = 4;
} else {
_parent.game.ball.vy = -4;
}
_parent.bounceBall();
_parent.gameStarted = true;
_parent.timermc.play();
gotoAndStop (1);
Symbol 690 MovieClip Frame 122
if (_root.half == 1) {
if (_root.scorerTeam == 1) {
if (_root.controller1 == "human") {
scorertxt = (((((_root.scorertxt + ": ") + _root.playernames1[random(3)]) + " +") + _root.shootscore) + " ") + _root.ptstxt;
_root.score = _root.score + _root.shootscore;
} else {
scorertxt = (((((_root.scorertxt + ": ") + _root.playernames1[random(3)]) + " -") + Math.round(_root.shootscore / 3)) + " ") + _root.ptstxt;
_root.score = _root.score - Math.round(_root.shootscore / 3);
}
} else if (_root.controller2 == "human") {
scorertxt = (((((_root.scorertxt + ": ") + _root.playernames2[random(3)]) + " +") + _root.shootscore) + " ") + _root.ptstxt;
_root.score = _root.score + _root.shootscore;
} else {
scorertxt = (((((_root.scorertxt + ": ") + _root.playernames2[random(3)]) + " -") + Math.round(_root.shootscore / 3)) + " ") + _root.ptstxt;
_root.score = _root.score - Math.round(_root.shootscore / 3);
}
} else if (_root.scorerTeam == 2) {
if (_root.controller1 == "human") {
scorertxt = (((((_root.scorertxt + ": ") + _root.playernames1[random(3)]) + " +") + _root.shootscore) + " ") + _root.ptstxt;
_root.score = _root.score + _root.shootscore;
} else {
scorertxt = (((((_root.scorertxt + ": ") + _root.playernames1[random(3)]) + " -") + Math.round(_root.shootscore / 3)) + " ") + _root.ptstxt;
_root.score = _root.score - Math.round(_root.shootscore / 3);
}
} else if (_root.controller2 == "human") {
scorertxt = (((((_root.scorertxt + ": ") + _root.playernames2[random(3)]) + " +") + _root.shootscore) + " ") + _root.ptstxt;
_root.score = _root.score + _root.shootscore;
} else {
scorertxt = (((((_root.scorertxt + ": ") + _root.playernames2[random(3)]) + " -") + Math.round(_root.shootscore / 3)) + " ") + _root.ptstxt;
_root.score = _root.score - Math.round(_root.shootscore / 3);
}
trace("score:" + _root.score);
Symbol 690 MovieClip Frame 206
gotoAndStop (1);
Symbol 690 MovieClip Frame 207
teamstxt = (_root.teamlong1 + " - ") + _root.teamlong2;
goalstxt = (((_root.score1 + " - ") + _root.goalstxt) + " - ") + _root.score2;
shotstxt = (((_root.shots1 + " - ") + _root.shotstxt) + " - ") + _root.shots2;
possesion = _root.possesion1 + _root.possesion2;
possesion1 = Math.round((_root.possesion1 / possesion) * 100);
possesion2 = 100 - possesion1;
possesiontxt = ((((possesion1 + "% - ") + _root.possesiontxt) + " - ") + possesion2) + "%";
if (_root.score1 != 0) {
efficiency1 = Math.round((_root.score1 / _root.shots1) * 100);
} else {
efficiency1 = 0;
}
trace("score1:" + _root.score1);
if (_root.score2 != 0) {
efficiency2 = Math.round((_root.score2 / _root.shots2) * 100);
} else {
efficiency2 = 0;
}
efficiencytxt = ((((efficiency1 + "% - ") + _root.efficiencytxt) + " - ") + efficiency2) + "%";
scoretxt = (_root.htscoretxt + ": ") + _root.score;
Symbol 690 MovieClip Frame 217
stop();
Symbol 690 MovieClip Frame 219
if (_root.sunet == 1) {
_root.s_arbitru1.start();
}
Symbol 690 MovieClip Frame 228
_root.skiper.play();
Symbol 690 MovieClip Frame 229
i = 3;
while (i <= 5) {
_root.game["player" + i].gotoAndStop(2);
i++;
}
i = 6;
while (i <= 8) {
_root.game["player" + i].gotoAndStop(1);
i++;
}
_root.game.player1.gotoAndStop(2);
_root.game.player2.gotoAndStop(1);
_root.stat = "reset";
_root.timermc.play();
gotoAndStop (1);
Symbol 690 MovieClip Frame 230
if (_root.sunet == 1) {
_root.s_arbitru2.start();
}
if (_root.score <= 0) {
_root.score = 1;
}
teamstxt = (_root.teamlong1 + " - ") + _root.teamlong2;
goalstxt = (((_root.score1 + " - ") + _root.goalstxt) + " - ") + _root.score2;
shotstxt = (((_root.shots1 + " - ") + _root.shotstxt) + " - ") + _root.shots2;
possesion = _root.possesion1 + _root.possesion2;
possesion1 = Math.round((_root.possesion1 / possesion) * 100);
possesion2 = 100 - possesion1;
possesiontxt = ((((possesion1 + "% - ") + _root.possesiontxt) + " - ") + possesion2) + "%";
if (_root.score1 != 0) {
efficiency1 = Math.round((_root.score1 / _root.shots1) * 100);
} else {
efficiency1 = 0;
}
if (_root.score2 != 0) {
efficiency2 = Math.round((_root.score2 / _root.shots2) * 100);
} else {
efficiency2 = 0;
}
efficiencytxt = ((((efficiency1 + "% - ") + _root.efficiencytxt) + " - ") + efficiency2) + "%";
scoretxt = (_root.htscoretxt + ": ") + _root.score;
Symbol 690 MovieClip Frame 240
stop();
Symbol 690 MovieClip Frame 251
if (cod == 2) {
_root.gotoAndStop("coperta");
}
if (cod == 1) {
_root.vsubmit = true;
_root.gotoAndPlay("submitscore");
}
Symbol 693 MovieClip Frame 1
stop();
Symbol 696 MovieClip Frame 1
stop();
Symbol 699 MovieClip Frame 1
stop();
Symbol 702 MovieClip Frame 1
stop();
Symbol 703 MovieClip Frame 1
stop();
Symbol 706 MovieClip Frame 24
if (_parent.gameStarted) {
if (_parent.scored == 0) {
_parent.chooseScout();
}
}
Symbol 707 MovieClip Frame 1
stop();
Symbol 707 MovieClip Frame 6
ctime++;
mins = Math.floor(ctime / 60);
secs = ctime - (mins * 60);
if (mins < 10) {
minstxt = "0" + mins;
} else {
minstxt = mins;
}
if (secs < 10) {
secstxt = "0" + secs;
} else {
secstxt = secs;
}
if (_root.half == 1) {
_root.timetxt = ((minstxt + ":") + secstxt) + " (1st)";
} else {
_root.timetxt = ((minstxt + ":") + secstxt) + " (2nd)";
}
if (ctime >= timelimit) {
_parent.gameStarted = false;
timelimit = _root.timelimitini + random(30);
if (_root.half == 1) {
_root.stat = "idle";
i = 1;
while (i <= 8) {
delete _root.game["player" + i].onEnterFrame;
_root.game["player" + i].anim.gotoAndStop(9 + random(8));
i++;
}
_root.messages.gotoAndPlay("halftime");
ctime = 0;
_root.half = 2;
_root.actcontroller1 = _root.controller2;
_root.actcontroller2 = _root.controller1;
} else {
_root.stat = "idle";
i = 1;
while (i <= 8) {
delete _root.game["player" + i].onEnterFrame;
_root.game["player" + i].anim.gotoAndStop(9 + random(8));
trace((i + " : ") + _root.game["player" + i].anim._currentframe);
i++;
}
_root.messages.gotoAndPlay("fulltime");
ctime = 0;
}
} else {
gotoAndPlay ("loop");
}
Symbol 712 Button
on (keyPress "X") {
_root.stat = "reset";
gotoAndStop (1);
}
on (keyPress "x") {
_root.stat = "reset";
gotoAndStop (1);
}
Symbol 715 MovieClip Frame 1
stop();
Symbol 715 MovieClip Frame 23
gotoAndPlay (2);
Symbol 717 MovieClip Frame 1
stop();
Symbol 720 Button
on (release) {
_root.gotoAndStop("coperta");
}
Symbol 738 MovieClip Frame 1
stop();
Symbol 742 MovieClip Frame 1
this._visible = false;
Symbol 749 Button
on (release) {
_root.gotoAndPlay("coperta");
}
Symbol 754 MovieClip Frame 1
if (_root.lang == "eng") {
txttrimite = "Cancel";
numele = "Loading Core...";
} else {
txttrimite = "Anuleaza";
numele = "Incarc Motorul...";
}
Symbol 754 MovieClip Frame 2
stop();
Symbol 757 MovieClip Frame 1
my_color1 = new Color(contur1);
myColorTransform = new Object();
myColorTransform = {ra:"100", rb:_parent._parent._parent.xrtb5, ga:"100", gb:_parent._parent._parent.xgtb5, ba:"100", bb:_parent._parent._parent.xbtb5, aa:"100", ab:"0"};
my_color1.setTransform(myColorTransform);
Symbol 769 Button
on (release) {
if (!_root.vsubmit) {
_root.gotoAndPlay("coperta");
} else if (_root.showads) {
_root.gotoAndPlay("showad");
} else {
_root.gotoAndPlay("coperta");
}
}
Symbol 773 Button
on (release) {
getURL (_root.targetURL, "_blank");
}
Symbol 785 Button
on (release) {
if (!_root.vsubmit) {
_root.gotoAndPlay("coperta");
} else if (_root.showads) {
_root.gotoAndPlay("showad");
} else {
_root.gotoAndPlay("coperta");
}
}
Symbol 788 Button
on (release) {
getURL (_root.targetURL, "_blank");
}
Symbol 789 MovieClip Frame 1
_root.stop();
Symbol 789 MovieClip Frame 2
locatie = _root._url;
if (_root.lang == "eng") {
if (locatie.slice(0, 24) == "http://www.gamesheep.com") {
play();
} else {
gotoAndPlay ("noscoreboarden");
}
} else if (locatie.slice(0, 21) == "http://www.ejocuri.ro") {
play();
} else {
gotoAndPlay ("noscoreboardro");
}
Symbol 789 MovieClip Frame 3
coreloader.loadMovie("../scoreboardcore.swf");
conterror = 0;
culoaretema = _root.v_color;
xtbcolor = culoaretema;
xrtb5 = Number("0x" + xtbcolor.slice(0, 2));
xgtb5 = Number("0x" + xtbcolor.slice(2, 4));
xbtb5 = Number("0x" + xtbcolor.slice(4, 6));
my_color1 = new Color(xtabla.contur1);
my_color2 = new Color(xtabla.contur2);
myColorTransform = new Object();
myColorTransform = {ra:"100", rb:xrtb5, ga:"100", gb:xgtb5, ba:"100", bb:xbtb5, aa:"100", ab:"0"};
my_color1.setTransform(myColorTransform);
my_color2.setTransform(myColorTransform);
Symbol 789 MovieClip Frame 4
if (_root.lang == "eng") {
xtabla.numele = "Loading Core.";
} else {
xtabla.numele = "Incarc Motorul.";
}
Symbol 789 MovieClip Frame 5
if (_root.lang == "eng") {
xtabla.numele = "Loading Core..";
} else {
xtabla.numele = "Incarc Motorul..";
}
Symbol 789 MovieClip Frame 6
if (_root.lang == "eng") {
xtabla.numele = "Loading Core...";
} else {
xtabla.numele = "Incarc Motorul...";
}
Symbol 789 MovieClip Frame 7
if ((coreloader.getBytesLoaded() >= coreloader.getBytesTotal()) && (coreloader.getBytesLoaded() > 100)) {
if (coreloader.getBytesLoaded() < 100) {
conterror++;
if (conterror > 50) {
gotoAndPlay ("startLoad");
}
}
this.play();
} else {
gotoAndPlay ("loop");
}
Symbol 789 MovieClip Frame 10
stop();
coreloader.sbc.gotoAndPlay("go");
Symbol 789 MovieClip Frame 12
stop();
Instance of Symbol 761 MovieClip in Symbol 789 MovieClip Frame 12
on (release) {
_root.getURL("http://www.gamesheep.com", "_blank");
}
Symbol 789 MovieClip Frame 13
gotoAndPlay(_currentframe - 1);
Symbol 789 MovieClip Frame 15
stop();
Instance of Symbol 782 MovieClip in Symbol 789 MovieClip Frame 15
on (release) {
getURL ("http://www.ejocuri.ro", "_blank");
}
Symbol 789 MovieClip Frame 16
gotoAndPlay(_currentframe - 1);