Frame 2
if (_root.gamezhero == undefined) {
System.security.allowDomain("gamezhero.com", "www.gamezhero.com", "files.gamezhero.com");
_root.createEmptyMovieClip("gamezhero", 100000);
_root.gamezhero.loadMovie("http://files.gamezhero.com/flash/gamezhero2.swf?x=-120&y=-120&from=4nationstournamen&scale=100&t=1131695977671");
}
Stage.showMenu = false;
_focusrect = false;
stop();
this.onEnterFrame = function () {
Loader.verify();
};
Instance of Symbol 9 MovieClip "Loader" in Frame 2
onClipEvent (load) {
function verify() {
var _local2 = _parent.getBytesLoaded();
if (_local2 >= TotalBytes) {
_parent.gotoAndStop("Init");
} else {
Percent = Math.round((_local2 / TotalBytes) * 100);
_parent.LoadingBar.percent_txt.text = String(Percent + "%");
_parent.LoadingBar.percent0_txt.text = String(Percent + "%");
}
}
var TotalBytes = _parent.getBytesTotal();
var Percent = 0;
}
Frame 10
fscommand ("trapallkeys", true);
_global.Main_Pack_TimeLine = this;
gotoAndStop ("Menu");
Instance of Symbol 37 MovieClip "ControlHS" in Frame 10
onClipEvent (load) {
function getScores() {
if (G_TestHighScore == true) {
}
if (gProxyObj == undefined) {
if (G_TestHighScore == true) {
}
listScores();
} else {
if (G_TestHighScore == true) {
}
gProxyObj.getScores(cbFunc2);
}
}
function submitScore(theScore) {
if (G_TestHighScore == true) {
}
gProxyObj.submitScore(theScore, cbFunc);
}
function initHiScores() {
if (G_TestHighScore == true) {
}
gProxyObj.setGame_Id("av_tournament");
}
function getScoreString() {
var _local5 = "Oops! The high score list isn't available right now!";
var _local8 = 50;
if (gProxyObj != undefined) {
var _local7 = gProxyObj.getScoreCount();
if (_local7 > 0) {
var _local1;
var _local6;
var _local3;
var _local4;
_local5 = "";
_local1 = 0;
while (_local1 < _local7) {
_local6 = gProxyObj.getScoreItem(_local1);
_local3 = _local6[0];
_local4 = fStyleNumber(_local6[1]);
spaceNb = ((_local8 - _local3.length) - _local4.length) - 4;
spaceTXT = "";
var _local2 = 0;
while (_local2 < spaceNb) {
spaceTXT = spaceTXT + " ";
_local2++;
}
if (_local1 < 9) {
_local5 = _local5 + ((((((_local1 + 1) + " ") + _local3) + spaceTXT) + _local4) + newline);
} else if (_local1 < 99) {
_local5 = _local5 + ((((((_local1 + 1) + " ") + _local3) + spaceTXT) + _local4) + newline);
} else {
_local5 = _local5 + ((((((_local1 + 1) + " ") + _local3) + spaceTXT) + _local4) + newline);
}
_local1++;
}
} else {
_local5 = "Whoops, the high scores seem to have escaped!";
}
}
if (G_TestHighScore == true) {
}
return(_local5);
}
function listScores() {
if (G_TestHighScore == true) {
}
_parent.txt_highScore.text = getScoreString();
}
function cbFunc(thisBool) {
if (thisBool) {
listScores();
} else {
if (G_TestHighScore == true) {
}
_parent.txt_highScore.text = "Oops! The high score list isn\u2019t available right now!";
}
}
function cbFunc2(thisBool) {
if (thisBool) {
listScores();
} else {
_parent.txt_highScore.text = "Oops! The high score list isn\u2019t available right now!";
}
}
function fStyleNumber(_nNumber, _nMinimumChar) {
_sNumber = String(_nNumber);
_sNewString = "";
_nlength = _sNumber.length;
_nlength = _nlength / 3;
if (_nlength <= 1) {
_sNewNumber = _sNumber;
if (_sNewNumber.length < _nMinimumChar) {
_sNewNumber = "0" + _sNewNumber;
}
return(_sNewNumber);
}
_nLoop = _nlength;
while (_nLoop > 1) {
_sNewString = (" " + _sNumber.substr(-3)) + _sNewString;
_sNumber = _sNumber.substr(0, -3);
_nLoop--;
}
_sNewNumber = _sNumber + _sNewString;
if (_sNewNumber.length < _nMinimumChar) {
_sNewNumber = "0" + _sNewNumber;
}
return(_sNewNumber);
}
_global.HS = this;
var G_ShowHighScore = true;
var G_TestHighScore = false;
if (G_TestHighScore == true) {
gProxyObj.setServer("www.nick.com");
gProxyObj.setScreenName("Terminator2007");
gProxyObj.setIsLoggedIn(true);
}
}
Instance of Symbol 76 MovieClip "SoundControler" in Frame 10
onClipEvent (load) {
function ToMute() {
_global.Muted = true;
this.onEnterFrame = function () {
if (SetVolumePack > 0) {
SetVolumePack = SetVolumePack - 5;
packMusic.setVolume(SetVolumePack);
}
if (SetVolumeInG > 0) {
SetVolumeInG = SetVolumeInG - 5;
gameMusic.setVolume(SetVolumeInG);
}
if ((SetVolumePack == 0) && (SetVolumeInG == 0)) {
delete onEnterFrame;
}
};
}
function UnMute() {
_global.Muted = false;
this.onEnterFrame = function () {
if ((SetVolumePack < GameAndPackVolume) && (musicIn == "Packaging")) {
SetVolumePack = SetVolumePack + 5;
packMusic.setVolume(SetVolumePack);
}
if ((SetVolumeInG < GameAndPackVolume) && (musicIn == "InGame")) {
SetVolumeInG = SetVolumeInG + 5;
gameMusic.setVolume(SetVolumeInG);
}
if ((SetVolumePack == GameAndPackVolume) || (SetVolumeInG == GameAndPackVolume)) {
delete onEnterFrame;
}
};
}
function SwitchToPack() {
if (musicIn != "Packaging") {
packMusic.start(0, 1000000);
musicIn = "Packaging";
if (!_global.Muted) {
this.onEnterFrame = function () {
if (SetVolumePack < GameAndPackVolume) {
SetVolumePack = SetVolumePack + 5;
packMusic.setVolume(SetVolumePack);
}
if (SetVolumeInG > 0) {
SetVolumeInG = SetVolumeInG - 5;
gameMusic.setVolume(SetVolumeInG);
}
if ((SetVolumePack >= GameAndPackVolume) && (SetVolumeInG <= 0)) {
gameMusic.stop();
delete onEnterFrame;
}
};
}
}
}
function SwitchToInGame() {
if (musicIn != "InGame") {
gameMusic.start(0, 1000000);
musicIn = "InGame";
if (!_global.Muted) {
this.onEnterFrame = function () {
if (SetVolumeInG < GameAndPackVolume) {
SetVolumeInG = SetVolumeInG + 5;
gameMusic.setVolume(SetVolumeInG);
}
if (SetVolumePack > 0) {
SetVolumePack = SetVolumePack - 5;
packMusic.setVolume(SetVolumePack);
}
if ((SetVolumeInG >= GameAndPackVolume) && (SetVolumePack <= 0)) {
packMusic.stop();
delete onEnterFrame;
}
};
}
}
}
function PlayASound(WitchSound, nVolume, nloop) {
eval (WitchSound).stop();
if (nloop == undefined) {
nloop = 1;
}
if (nVolume == undefined) {
nVolume = 100;
}
if (!_global.Muted) {
nVolume = fCheckSoundMutable(WitchSound, nVolume, enterFrame.isGamePaused());
if (eval (WitchSound + "Nb") == 1) {
eval (WitchSound).start(0, nloop);
eval (WitchSound).setVolume(nVolume);
} else {
nbr = random(eval (WitchSound + "Nb")) + 1;
eval (WitchSound + nbr).start(0, nloop);
eval (WitchSound + nbr).setVolume(nVolume);
}
}
}
function SetVolume(WitchSound, Vol) {
eval (WitchSound).setVolume(Vol);
}
function fCheckSoundMutable(P_sSound, P_nVolume, P_bPaused) {
if (P_bPaused) {
switch (P_sSound) {
case "Bonus_Bad" :
case "Bonus_Good" :
case "Pack_Eau" :
case "Pack_Feu" :
case "Pack_Terre" :
case "Pack_Air" :
case "NewRound" :
case "Loose" :
case "Goal" :
case "Pop_Up" :
return(P_nVolume);
}
return(0);
}
return(P_nVolume);
}
_global.S = this;
_global.Muted = false;
var SetVolumeInG;
var SetVolumePack;
var musicIn;
this.createEmptyMovieClip("packMusic", 1000);
packMusic = new Sound("packMusic");
packMusic.attachSound("packMusic");
this.createEmptyMovieClip("gameMusic", 2000);
gameMusic = new Sound("gameMusic");
gameMusic.attachSound("gameMusic");
GameAndPackVolume = 40;
SetVolumePack = 0;
SetVolumeInG = 0;
musicIn = "";
packMusic.setVolume(SetVolumePack);
gameMusic.setVolume(SetVolumeInG);
this.createEmptyMovieClip("Bonus_Bad", 3);
Bonus_Bad = new Sound("Bonus_Bad");
Bonus_Bad.attachSound("Bonus_Bad.wav");
Bonus_BadNb = 1;
this.createEmptyMovieClip("Bonus_Good", 4);
Bonus_Good = new Sound("Bonus_Good");
Bonus_Good.attachSound("Bonus_Good.wav");
Bonus_GoodNb = 1;
this.createEmptyMovieClip("Pack_Eau", 5);
Pack_Eau = new Sound("Pack_Eau");
Pack_Eau.attachSound("Pack_Eau.wav");
Pack_EauNb = 1;
this.createEmptyMovieClip("Pack_Feu", 6);
Pack_Feu = new Sound("Pack_Feu");
Pack_Feu.attachSound("Pack_Feu.wav");
Pack_FeuNb = 1;
this.createEmptyMovieClip("Pack_Terre", 7);
Pack_Terre = new Sound("Pack_Terre");
Pack_Terre.attachSound("Pack_Terre.wav");
Pack_TerreNb = 1;
this.createEmptyMovieClip("Pack_Air", 8);
Pack_Air = new Sound("Pack_Air");
Pack_Air.attachSound("Pack_Air.wav");
Pack_AirNb = 1;
this.createEmptyMovieClip("NewRound", 9);
NewRound = new Sound("NewRound");
NewRound.attachSound("NewRound.wav");
NewRoundNb = 1;
this.createEmptyMovieClip("Loose", 10);
Loose = new Sound("Loose");
Loose.attachSound("Loose.wav");
LooseNb = 1;
this.createEmptyMovieClip("Goal", 11);
Goal = new Sound("Goal");
Goal.attachSound("Goal.wav");
GoalNb = 1;
this.createEmptyMovieClip("Rock_Enter", 12);
Rock_Enter = new Sound("Rock_Enter");
Rock_Enter.attachSound("Rock_Enter.wav");
Rock_EnterNb = 1;
this.createEmptyMovieClip("Rock_Falls", 13);
Rock_Falls = new Sound("Rock_Falls");
Rock_Falls.attachSound("Rock_Falls.wav");
Rock_FallsNb = 1;
this.createEmptyMovieClip("TeleportEnter", 14);
TeleportEnter = new Sound("TeleportEnter");
TeleportEnter.attachSound("TeleportEnter.wav");
TeleportEnterNb = 1;
this.createEmptyMovieClip("TeleportExit", 15);
TeleportExit = new Sound("TeleportExit");
TeleportExit.attachSound("TeleportExit.wav");
TeleportExitNb = 1;
this.createEmptyMovieClip("FireArcSnd", 16);
FireArcSnd = new Sound("FireArcSnd");
FireArcSnd.attachSound("FireArc.wav");
FireArcSndNb = 1;
this.createEmptyMovieClip("CoupFouet", 17);
CoupFouet = new Sound("CoupFouet");
CoupFouet.attachSound("Fouet.wav");
CoupFouetNb = 1;
this.createEmptyMovieClip("PikesSnd", 18);
PikesSnd = new Sound("PikesSnd");
PikesSnd.attachSound("Pikes.wav");
PikesSndNb = 1;
this.createEmptyMovieClip("Hurt_Ice", 19);
Hurt_Ice = new Sound("Hurt_Ice");
Hurt_Ice.attachSound("Hurt_Ice.wav");
Hurt_IceNb = 1;
this.createEmptyMovieClip("Field_Fire", 20);
Field_Fire = new Sound("Field_Fire");
Field_Fire.attachSound("Field_Fire.wav");
Field_FireNb = 1;
this.createEmptyMovieClip("Flame_Expansion", 21);
Flame_Expansion = new Sound("Flame_Expansion");
Flame_Expansion.attachSound("Flame_Expansion.wav");
Flame_ExpansionNb = 1;
this.createEmptyMovieClip("Flame_Watered", 22);
Flame_Watered = new Sound("Flame_Watered");
Flame_Watered.attachSound("Flame_Watered.wav");
Flame_WateredNb = 1;
this.createEmptyMovieClip("Field_Stone", 23);
Field_Stone = new Sound("Field_Stone");
Field_Stone.attachSound("Field_Stone.wav");
Field_StoneNb = 1;
this.createEmptyMovieClip("Field_Wind", 24);
Field_Wind = new Sound("Field_Wind");
Field_Wind.attachSound("Field_Wind.wav");
Field_WindNb = 1;
this.createEmptyMovieClip("Field_Water", 25);
Field_Water = new Sound("Field_Water");
Field_Water.attachSound("Field_Water.wav");
Field_WaterNb = 1;
this.createEmptyMovieClip("Tornado_Release", 26);
Tornado_Release = new Sound("Tornado_Release");
Tornado_Release.attachSound("Tornado_Release.wav");
Tornado_ReleaseNb = 1;
this.createEmptyMovieClip("Tornado_Catch", 27);
Tornado_Catch = new Sound("Tornado_Catch");
Tornado_Catch.attachSound("Tornado_Catch.wav");
Tornado_CatchNb = 1;
this.createEmptyMovieClip("Pop_Up", 28);
Pop_Up = new Sound("Pop_Up");
Pop_Up.attachSound("Pop_Up.wav");
Pop_UpNb = 1;
this.createEmptyMovieClip("Clic1", 29);
Clic1 = new Sound("Clic1");
Clic1.attachSound("Clic1.wav");
Clic1Nb = 1;
this.createEmptyMovieClip("Clic2", 30);
Clic2 = new Sound("Clic2");
Clic2.attachSound("Clic2.wav");
Clic2Nb = 1;
this.createEmptyMovieClip("Hurt1", 31);
Hurt1 = new Sound("Hurt1");
Hurt1.attachSound("Hurt1.wav");
this.createEmptyMovieClip("Hurt2", 32);
Hurt2 = new Sound("Hurt2");
Hurt2.attachSound("Hurt2.wav");
this.createEmptyMovieClip("Hurt3", 33);
Hurt3 = new Sound("Hurt3");
Hurt3.attachSound("Hurt3.wav");
HurtNb = 3;
this.createEmptyMovieClip("Gust1", 34);
Gust1 = new Sound("Gust1");
Gust1.attachSound("Gust1.wav");
this.createEmptyMovieClip("Gust2", 35);
Gust2 = new Sound("Gust2");
Gust2.attachSound("Gust2.wav");
this.createEmptyMovieClip("Gust3", 36);
Gust3 = new Sound("Gust3");
Gust3.attachSound("Gust1.wav");
GustNb = 3;
}
Frame 19
_global.HS.initHiScores();
_global.S.SwitchToPack();
stop();
Instance of Symbol 865 MovieClip "Instructions" in Frame 19
onClipEvent (load) {
_global.InstructionsScreen = this;
_visible = false;
}
Frame 25
function air_2P_Click() {
if ((p1Nation == "") || (p2Nation == "")) {
if ((p1Nation != "Air") && (p2Nation != "Air")) {
if (p1Nation == "") {
p1Nation = "Air";
air_mc.gotoAndStop("P1");
_global.S.PlayASound("Clic2", 40);
} else if (p2Nation == "") {
p2Nation = "Air";
air_mc.gotoAndStop("P2");
_global.S.PlayASound("Clic2", 40);
}
} else if (p1Nation == "Air") {
if (p2Nation == "") {
p1Nation = "";
p2Nation = "Air";
air_mc.gotoAndStop("P2");
_global.S.PlayASound("Clic2", 40);
}
} else if (p2Nation == "Air") {
p2Nation = "";
air_mc.gotoAndStop("Empty");
_global.S.PlayASound("Clic2", 40);
}
} else {
if (p1Nation == "Air") {
p1Nation = "";
} else if (p2Nation == "Air") {
p2Nation = "";
}
air_mc.gotoAndStop("Empty");
_global.S.PlayASound("Clic2", 40);
}
}
function water_2P_Click() {
if ((p1Nation == "") || (p2Nation == "")) {
if ((p1Nation != "Water") && (p2Nation != "Water")) {
if (p1Nation == "") {
p1Nation = "Water";
water_mc.gotoAndStop("P1");
_global.S.PlayASound("Clic2", 40);
} else if (p2Nation == "") {
p2Nation = "Water";
water_mc.gotoAndStop("P2");
_global.S.PlayASound("Clic2", 40);
}
} else if (p1Nation == "Water") {
if (p2Nation == "") {
p1Nation = "";
p2Nation = "Water";
water_mc.gotoAndStop("P2");
_global.S.PlayASound("Clic2", 40);
}
} else if (p2Nation == "Water") {
p2Nation = "";
water_mc.gotoAndStop("Empty");
_global.S.PlayASound("Clic2", 40);
}
} else {
if (p1Nation == "Water") {
p1Nation = "";
} else if (p2Nation == "Water") {
p2Nation = "";
}
water_mc.gotoAndStop("Empty");
_global.S.PlayASound("Clic2", 40);
}
}
function fire_2P_Click() {
if ((p1Nation == "") || (p2Nation == "")) {
if ((p1Nation != "Fire") && (p2Nation != "Fire")) {
if (p1Nation == "") {
p1Nation = "Fire";
fire_mc.gotoAndStop("P1");
_global.S.PlayASound("Clic2", 40);
} else if (p2Nation == "") {
p2Nation = "Fire";
fire_mc.gotoAndStop("P2");
_global.S.PlayASound("Clic2", 40);
}
} else if (p1Nation == "Fire") {
if (p2Nation == "") {
p1Nation = "";
p2Nation = "Fire";
fire_mc.gotoAndStop("P2");
_global.S.PlayASound("Clic2", 40);
}
} else if (p2Nation == "Fire") {
p2Nation = "";
fire_mc.gotoAndStop("Empty");
_global.S.PlayASound("Clic2", 40);
}
} else {
if (p1Nation == "Fire") {
p1Nation = "";
} else if (p2Nation == "Fire") {
p2Nation = "";
}
fire_mc.gotoAndStop("Empty");
_global.S.PlayASound("Clic2", 40);
}
}
function earth_2P_Click() {
if ((p1Nation == "") || (p2Nation == "")) {
if ((p1Nation != "Earth") && (p2Nation != "Earth")) {
if (p1Nation == "") {
p1Nation = "Earth";
earth_mc.gotoAndStop("P1");
_global.S.PlayASound("Clic2", 40);
} else if (p2Nation == "") {
p2Nation = "Earth";
earth_mc.gotoAndStop("P2");
_global.S.PlayASound("Clic2", 40);
}
} else if (p1Nation == "Earth") {
if (p2Nation == "") {
p1Nation = "";
p2Nation = "Earth";
earth_mc.gotoAndStop("P2");
_global.S.PlayASound("Clic2", 40);
}
} else if (p2Nation == "Earth") {
p2Nation = "";
earth_mc.gotoAndStop("Empty");
_global.S.PlayASound("Clic2", 40);
}
} else {
if (p1Nation == "Earth") {
p1Nation = "";
} else if (p2Nation == "Earth") {
p2Nation = "";
}
earth_mc.gotoAndStop("Empty");
_global.S.PlayASound("Clic2", 40);
}
}
function setNation(type) {
_global.S.PlayASound("Clic2", 40);
p1Nation = type;
switch (type) {
case "Air" :
mcCharacter.air_character.enabled = false;
mcCharacter.air_character.useHandCursor = false;
mcCharacter.water_character.enabled = true;
mcCharacter.water_character.useHandCursor = true;
mcCharacter.fire_character.enabled = true;
mcCharacter.fire_character.useHandCursor = true;
mcCharacter.earth_character.enabled = true;
mcCharacter.earth_character.useHandCursor = true;
air_mc.gotoAndStop("C");
water_mc.gotoAndStop("Empty");
fire_mc.gotoAndStop("Empty");
earth_mc.gotoAndStop("Empty");
break;
case "Water" :
mcCharacter.air_character.enabled = true;
mcCharacter.air_character.useHandCursor = true;
mcCharacter.water_character.enabled = false;
mcCharacter.water_character.useHandCursor = false;
mcCharacter.fire_character.enabled = true;
mcCharacter.fire_character.useHandCursor = true;
mcCharacter.earth_character.enabled = true;
mcCharacter.earth_character.useHandCursor = true;
air_mc.gotoAndStop("Empty");
water_mc.gotoAndStop("C");
fire_mc.gotoAndStop("Empty");
earth_mc.gotoAndStop("Empty");
break;
case "Fire" :
mcCharacter.air_character.enabled = true;
mcCharacter.air_character.useHandCursor = true;
mcCharacter.water_character.enabled = true;
mcCharacter.water_character.useHandCursor = true;
mcCharacter.fire_character.enabled = false;
mcCharacter.fire_character.useHandCursor = false;
mcCharacter.earth_character.enabled = true;
mcCharacter.earth_character.useHandCursor = true;
air_mc.gotoAndStop("Empty");
water_mc.gotoAndStop("Empty");
fire_mc.gotoAndStop("C");
earth_mc.gotoAndStop("Empty");
break;
case "Earth" :
mcCharacter.air_character.enabled = true;
mcCharacter.air_character.useHandCursor = true;
mcCharacter.water_character.enabled = true;
mcCharacter.water_character.useHandCursor = true;
mcCharacter.fire_character.enabled = true;
mcCharacter.fire_character.useHandCursor = true;
mcCharacter.earth_character.enabled = false;
mcCharacter.earth_character.useHandCursor = false;
air_mc.gotoAndStop("Empty");
water_mc.gotoAndStop("Empty");
fire_mc.gotoAndStop("Empty");
earth_mc.gotoAndStop("C");
}
}
stop();
p1Nation = "";
p2Nation = "";
gameTwoPlayers = TournamentControler.isGameTwoPlayers();
Frame 32
stop();
TournamentControler.assignMainTimeLine(this);
TournamentControler.fBlockHUDBtn(true);
Frame 41
_global.S.SwitchToInGame();
TournamentControler.assignMainTimeLine(this);
TournamentControler.assignScene(this.game_mc);
TournamentControler.fBlockHUDBtn(true);
ScoreAndHud.assignHud(this.hud_mc);
TournamentControler.beginTournament();
Instance of Symbol 1138 MovieClip "key_ctrl" in Frame 41
onClipEvent (keyDown) {
if (!enterFrame.isGamePaused()) {
switch (Key.getCode()) {
case 37 :
if (!_global.C.keyPress1_Left) {
_global.C.keyPress1_Left = true;
_global.C.keyChange(1);
}
break;
case 39 :
if (!_global.C.keyPress1_Right) {
_global.C.keyPress1_Right = true;
_global.C.keyChange(1);
}
break;
case 38 :
if (!_global.C.keyPress1_Up) {
_global.C.keyPress1_Up = true;
_global.C.keyChange(1);
}
break;
case 40 :
if (!_global.C.keyPress1_Down) {
_global.C.keyPress1_Down = true;
_global.C.keyChange(1);
}
break;
case 189 :
if (!_global.C.keyPress1_Offense) {
_global.C.keyPress1_Offense = true;
_global.C.keyChange(1);
}
break;
case 187 :
if (!_global.C.keyPress1_Defense) {
_global.C.keyPress1_Defense = true;
_global.C.keyChange(1);
}
break;
case 65 :
if (!_global.C.keyPress2_Left) {
_global.C.keyPress2_Left = true;
_global.C.keyChange(2);
}
break;
case 68 :
if (!_global.C.keyPress2_Right) {
_global.C.keyPress2_Right = true;
_global.C.keyChange(2);
}
break;
case 87 :
if (!_global.C.keyPress2_Up) {
_global.C.keyPress2_Up = true;
_global.C.keyChange(2);
}
break;
case 83 :
if (!_global.C.keyPress2_Down) {
_global.C.keyPress2_Down = true;
_global.C.keyChange(2);
}
break;
case 49 :
if (!_global.C.keyPress2_Offense) {
_global.C.keyPress2_Offense = true;
_global.C.keyChange(2);
}
break;
case 50 :
if (_global.C.keyPress2_Defense) {
break;
}
_global.C.keyPress2_Defense = true;
_global.C.keyChange(2);
}
}
}
onClipEvent (keyUp) {
switch (Key.getCode()) {
case 37 :
if (_global.C.keyPress1_Left) {
_global.C.keyPress1_Left = false;
_global.C.keyChange(1);
}
break;
case 39 :
if (_global.C.keyPress1_Right) {
_global.C.keyPress1_Right = false;
_global.C.keyChange(1);
}
break;
case 38 :
if (_global.C.keyPress1_Up) {
_global.C.keyPress1_Up = false;
_global.C.keyChange(1);
}
break;
case 40 :
if (_global.C.keyPress1_Down) {
_global.C.keyPress1_Down = false;
_global.C.keyChange(1);
}
break;
case 189 :
if (_global.C.keyPress1_Offense) {
_global.C.keyPress1_Offense = false;
_global.C.keyChange(1);
}
break;
case 187 :
if (_global.C.keyPress1_Defense) {
_global.C.keyPress1_Defense = false;
_global.C.keyChange(1);
}
break;
case 65 :
if (_global.C.keyPress2_Left) {
_global.C.keyPress2_Left = false;
_global.C.keyChange(2);
}
break;
case 68 :
if (_global.C.keyPress2_Right) {
_global.C.keyPress2_Right = false;
_global.C.keyChange(2);
}
break;
case 87 :
if (_global.C.keyPress2_Up) {
_global.C.keyPress2_Up = false;
_global.C.keyChange(2);
}
break;
case 83 :
if (_global.C.keyPress2_Down) {
_global.C.keyPress2_Down = false;
_global.C.keyChange(2);
}
break;
case 49 :
if (_global.C.keyPress2_Offense) {
_global.C.keyPress2_Offense = false;
_global.C.keyChange(2);
}
break;
case 50 :
if (_global.C.keyPress2_Defense) {
_global.C.keyPress2_Defense = false;
_global.C.keyChange(2);
}
break;
case 32 :
_global.C.toggleInitialShot();
}
}
Instance of Symbol 1140 MovieClip "ef_ctrl" in Frame 41
onClipEvent (enterFrame) {
enterFrame.onEnterFrame();
}
Frame 48
TournamentControler.zoneCleaned();
Frame 61
this.gotoAndStop(_global.AFTERCLEAN_MARKER);
Frame 69
function submitScore() {
_global.HS.submitScore(_global.SCORE_TO_SUBMIT);
submit_btn._visible = false;
}
stop();
char_mc.gotoAndStop(_global.SCORE_CHAR_TO_SHOW);
points_txt.text = mathLib.styleNumber(_global.SCORE_TO_SUBMIT);
submit_btn._visible = false;
if (_global.gProxyObj.getIsLoggedIn()) {
submit_btn._visible = true;
}
if (_global.SCORE_AUTO_SUBMIT) {
submitScore();
} else {
_global.HS.getScores();
}
Instance of Symbol 1261 MovieClip "ControlScroll" in Frame 69
onClipEvent (load) {
scrollUp = false;
scrollDown = false;
}
onClipEvent (enterFrame) {
if (scrollUp == true) {
_parent.txt_highScore.scroll--;
} else if (scrollDown == true) {
_parent.txt_highScore.scroll++;
}
}
Symbol 82 MovieClip [Anim_Goal] Frame 30
ScoreAndHud.fSetLevelOver("Empty");
Symbol 103 MovieClip Frame 11
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 104 MovieClip [Attack_Air] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 119 MovieClip Frame 1
this.gotoAndStop(_global.MapType);
stop();
Symbol 119 MovieClip Frame 6
stop();
Symbol 119 MovieClip Frame 11
stop();
Symbol 119 MovieClip Frame 16
stop();
Symbol 124 MovieClip Frame 13
stop();
Symbol 128 MovieClip [Attack_Earth] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 128 MovieClip [Attack_Earth] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "flyHit_mc" in Symbol 128 MovieClip [Attack_Earth] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 128 MovieClip [Attack_Earth] Frame 5
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 128 MovieClip [Attack_Earth] Frame 5
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "flyHit_mc" in Symbol 128 MovieClip [Attack_Earth] Frame 5
onClipEvent (load) {
this._alpha = 0;
}
Symbol 128 MovieClip [Attack_Earth] Frame 10
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 128 MovieClip [Attack_Earth] Frame 10
onClipEvent (load) {
this._alpha = 0;
}
Symbol 129 MovieClip [Attack_Fire] Frame 1
stop();
Symbol 129 MovieClip [Attack_Fire] Frame 2
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 129 MovieClip [Attack_Fire] Frame 2
onClipEvent (load) {
this._alpha = 0;
}
Symbol 129 MovieClip [Attack_Fire] Frame 12
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 129 MovieClip [Attack_Fire] Frame 12
onClipEvent (load) {
this._alpha = 0;
}
Symbol 129 MovieClip [Attack_Fire] Frame 22
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 129 MovieClip [Attack_Fire] Frame 22
onClipEvent (load) {
this._alpha = 0;
}
Symbol 132 MovieClip Frame 11
stop();
Symbol 141 MovieClip Frame 1
stop();
acceleration_mc.gotoAndStop("Stop");
Symbol 141 MovieClip Frame 5
stop();
Instance of Symbol 97 MovieClip "TR_mc" in Symbol 142 MovieClip [Ball] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "BR_mc" in Symbol 142 MovieClip [Ball] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "BL_mc" in Symbol 142 MovieClip [Ball] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "TL_mc" in Symbol 142 MovieClip [Ball] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 148 MovieClip Frame 1
if (pf == undefined) {
APE(this, 1);
}
Symbol 148 MovieClip Frame 11
stop();
Symbol 154 MovieClip Frame 1
if (pf == undefined) {
APE(this, 1);
}
Symbol 154 MovieClip Frame 11
stop();
Symbol 160 MovieClip Frame 1
if (pf == undefined) {
APE(this, 1);
}
Symbol 160 MovieClip Frame 11
stop();
Symbol 171 MovieClip [Bonus_Air] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 171 MovieClip [Bonus_Air] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 171 MovieClip [Bonus_Air] Frame 2
stop();
Symbol 171 MovieClip [Bonus_Air] Frame 6
stop();
Symbol 171 MovieClip [Bonus_Air] Frame 12
stop();
Symbol 177 MovieClip [Bonus_Earth] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 177 MovieClip [Bonus_Earth] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 177 MovieClip [Bonus_Earth] Frame 2
stop();
Symbol 177 MovieClip [Bonus_Earth] Frame 6
stop();
Symbol 177 MovieClip [Bonus_Earth] Frame 12
stop();
Symbol 187 MovieClip [Bonus_Fire] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 187 MovieClip [Bonus_Fire] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 187 MovieClip [Bonus_Fire] Frame 2
stop();
Symbol 187 MovieClip [Bonus_Fire] Frame 6
stop();
Symbol 187 MovieClip [Bonus_Fire] Frame 12
stop();
Symbol 193 MovieClip [Bonus_Momo] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 193 MovieClip [Bonus_Momo] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 193 MovieClip [Bonus_Momo] Frame 2
stop();
Symbol 193 MovieClip [Bonus_Momo] Frame 6
stop();
Symbol 193 MovieClip [Bonus_Momo] Frame 12
stop();
Symbol 203 MovieClip [Bonus_Water] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 203 MovieClip [Bonus_Water] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 203 MovieClip [Bonus_Water] Frame 2
stop();
Symbol 203 MovieClip [Bonus_Water] Frame 6
stop();
Symbol 203 MovieClip [Bonus_Water] Frame 12
stop();
Instance of Symbol 97 MovieClip "magma_mc" in Symbol 217 MovieClip [Field_Fire] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 234 MovieClip [Stone] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 234 MovieClip [Stone] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 234 MovieClip [Stone] Frame 2
stop();
Symbol 234 MovieClip [Stone] Frame 7
stop();
Instance of Symbol 97 MovieClip "energyHit_mc" in Symbol 234 MovieClip [Stone] Frame 7
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 234 MovieClip [Stone] Frame 7
onClipEvent (load) {
this._alpha = 0;
}
Symbol 234 MovieClip [Stone] Frame 12
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 234 MovieClip [Stone] Frame 12
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "quickSands_mc" in Symbol 235 MovieClip [Field_Earth] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 241 MovieClip [Defense_Air] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 290 MovieClip Frame 65
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 309 MovieClip [Defense_Fire] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 309 MovieClip [Defense_Fire] Frame 3
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 309 MovieClip [Defense_Fire] Frame 15
onClipEvent (load) {
this._alpha = 0;
}
Symbol 309 MovieClip [Defense_Fire] Frame 21
stop();
Symbol 325 MovieClip [FieldWind] Frame 1
stop();
Symbol 381 MovieClip Frame 7
stop();
Symbol 382 MovieClip [Flame] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 382 MovieClip [Flame] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 382 MovieClip [Flame] Frame 7
stop();
Symbol 382 MovieClip [Flame] Frame 11
stop();
Symbol 382 MovieClip [Flame] Frame 19
stop();
Symbol 382 MovieClip [Flame] Frame 25
stop();
Symbol 382 MovieClip [Flame] Frame 33
stop();
Symbol 382 MovieClip [Flame] Frame 44
stop();
Symbol 400 MovieClip Frame 1
stop();
Symbol 400 MovieClip Frame 10
stop();
Symbol 400 MovieClip Frame 20
stop();
Symbol 400 MovieClip Frame 29
stop();
Symbol 408 MovieClip Frame 1
stop();
Symbol 408 MovieClip Frame 6
stop();
Symbol 408 MovieClip Frame 11
stop();
Symbol 476 MovieClip Frame 22
gotoAndPlay ("Loop");
Symbol 476 MovieClip Frame 36
gotoAndPlay ("LoopBall");
Symbol 476 MovieClip Frame 49
stop();
Symbol 490 MovieClip Frame 1
stop();
Symbol 490 MovieClip Frame 10
stop();
Symbol 490 MovieClip Frame 20
stop();
Symbol 490 MovieClip Frame 30
stop();
Symbol 490 MovieClip Frame 41
stop();
Symbol 490 MovieClip Frame 51
stop();
Symbol 497 MovieClip Frame 24
this.gotoAndPlay("Move");
Symbol 497 MovieClip Frame 40
this.gotoAndPlay("MoveIce");
Symbol 519 MovieClip [Player_Air] Frame 1
stop();
Instance of Symbol 97 MovieClip "paddleDeploy_mc" in Symbol 519 MovieClip [Player_Air] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "paddleHit_mc" in Symbol 519 MovieClip [Player_Air] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "playerHit_mc" in Symbol 519 MovieClip [Player_Air] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 519 MovieClip [Player_Air] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 519 MovieClip [Player_Air] Frame 10
stop();
Symbol 519 MovieClip [Player_Air] Frame 20
stop();
Symbol 519 MovieClip [Player_Air] Frame 30
stop();
Symbol 519 MovieClip [Player_Air] Frame 40
stop();
Symbol 548 MovieClip Frame 10
stop();
Symbol 557 MovieClip Frame 1
stop();
Symbol 557 MovieClip Frame 10
stop();
Symbol 557 MovieClip Frame 16
stop();
Symbol 557 MovieClip Frame 24
stop();
Symbol 557 MovieClip Frame 32
stop();
Symbol 557 MovieClip Frame 41
stop();
Symbol 560 MovieClip Frame 24
gotoAndPlay ("Move");
Symbol 560 MovieClip Frame 40
gotoAndPlay ("MoveIce");
Symbol 560 MovieClip Frame 41
stop();
Symbol 585 MovieClip [Player_Earth] Frame 1
stop();
Instance of Symbol 97 MovieClip "paddleDeploy_mc" in Symbol 585 MovieClip [Player_Earth] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "paddleHit_mc" in Symbol 585 MovieClip [Player_Earth] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "playerHit_mc" in Symbol 585 MovieClip [Player_Earth] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 585 MovieClip [Player_Earth] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 585 MovieClip [Player_Earth] Frame 11
stop();
Symbol 585 MovieClip [Player_Earth] Frame 20
stop();
Symbol 585 MovieClip [Player_Earth] Frame 30
stop();
Symbol 585 MovieClip [Player_Earth] Frame 40
stop();
Symbol 585 MovieClip [Player_Earth] Frame 50
stop();
Symbol 632 MovieClip Frame 1
stop();
Symbol 632 MovieClip Frame 10
stop();
Symbol 632 MovieClip Frame 20
stop();
Symbol 632 MovieClip Frame 30
stop();
Symbol 632 MovieClip Frame 37
stop();
Symbol 632 MovieClip Frame 45
stop();
Symbol 637 MovieClip Frame 25
this.gotoAndPlay("Move");
Symbol 637 MovieClip Frame 42
this.gotoAndPlay("MoveIce");
Symbol 637 MovieClip Frame 43
stop();
Symbol 655 MovieClip [Player_Fire] Frame 1
stop();
Instance of Symbol 97 MovieClip "paddleDeploy_mc" in Symbol 655 MovieClip [Player_Fire] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "paddleHit_mc" in Symbol 655 MovieClip [Player_Fire] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "playerHit_mc" in Symbol 655 MovieClip [Player_Fire] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 655 MovieClip [Player_Fire] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 655 MovieClip [Player_Fire] Frame 11
stop();
Symbol 655 MovieClip [Player_Fire] Frame 21
stop();
Symbol 655 MovieClip [Player_Fire] Frame 31
stop();
Symbol 710 MovieClip Frame 1
stop();
Instance of Symbol 707 MovieClip "fouet_mc" in Symbol 720 MovieClip Frame 1
onClipEvent (load) {
this.hit_mc.swapDepths(1);
this.hit_mc.removeMovieClip();
this._alpha = 0;
}
Symbol 731 MovieClip Frame 1
stop();
Symbol 731 MovieClip Frame 10
stop();
Symbol 731 MovieClip Frame 20
stop();
Symbol 731 MovieClip Frame 30
stop();
Symbol 731 MovieClip Frame 41
stop();
Symbol 731 MovieClip Frame 51
stop();
Symbol 738 MovieClip Frame 24
gotoAndPlay ("Move");
Symbol 738 MovieClip Frame 48
gotoAndPlay ("MoveIce");
Symbol 752 MovieClip [Player_Water] Frame 1
stop();
Instance of Symbol 97 MovieClip "paddleDeploy_mc" in Symbol 752 MovieClip [Player_Water] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "paddleHit_mc" in Symbol 752 MovieClip [Player_Water] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "playerHit_mc" in Symbol 752 MovieClip [Player_Water] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 752 MovieClip [Player_Water] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 752 MovieClip [Player_Water] Frame 11
stop();
Symbol 752 MovieClip [Player_Water] Frame 21
stop();
Symbol 752 MovieClip [Player_Water] Frame 31
stop();
Symbol 775 MovieClip [Spike] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 775 MovieClip [Spike] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 775 MovieClip [Spike] Frame 6
stop();
Symbol 775 MovieClip [Spike] Frame 11
stop();
Symbol 778 MovieClip [SpikeBreak] Frame 13
stop();
Symbol 782 MovieClip [Tornado] Frame 1
stop();
Instance of Symbol 97 MovieClip "hit_mc" in Symbol 782 MovieClip [Tornado] Frame 1
onClipEvent (load) {
this._alpha = 0;
}
Symbol 782 MovieClip [Tornado] Frame 6
stop();
Symbol 782 MovieClip [Tornado] Frame 11
stop();
Symbol 1268 MovieClip [__Packages.enterFrame] Frame 0
class enterFrame
{
function enterFrame () {
}
static function addListener(o) {
listeners.push(o);
}
static function addSpecialListener(o) {
noPauseListeners.push(o);
}
static function removeListener(o) {
for (var _local2 in listeners) {
if (listeners[_local2] == o) {
delete listeners[_local2];
}
}
for (var _local2 in noPauseListeners) {
if (noPauseListeners[_local2] == o) {
delete noPauseListeners[_local2];
}
}
}
static function removeAllListeners() {
for (var _local1 in listeners) {
delete listeners[_local1];
}
listeners = new Array();
for (var _local1 in noPauseListeners) {
delete noPauseListeners[_local1];
}
noPauseListeners = new Array();
}
static function onEnterFrame() {
if (!gamePaused) {
for (var _local1 in listeners) {
listeners[_local1].onEnterFrame();
}
}
for (var _local1 in noPauseListeners) {
noPauseListeners[_local1].onEnterFrame();
}
}
static function togglePause(state) {
gamePaused = state;
if (state == true) {
_global.C.fPausePlayer();
} else {
_global.C.fUnPausePlayer();
}
}
static function isGamePaused(state) {
return(gamePaused);
}
static var listeners = new Array();
static var noPauseListeners = new Array();
static var gamePaused = false;
}
Symbol 1269 MovieClip [__Packages.ScoreAndHud] Frame 0
class ScoreAndHud
{
static var HUD_mc, scoreCalculation, HUD_type;
function ScoreAndHud () {
}
static function newMatch() {
HUD_mc.points1_txt.text = "0";
HUD_mc.points2_txt.text = "0";
HUD_mc.energy1_mc.gotoAndStop(1);
HUD_mc.energy2_mc.gotoAndStop(1);
}
static function onEnterFrame() {
var _local2 = 1;
while (_local2 <= 2) {
var _local4 = Math.floor(101 - ScoreAndHud[("player" + _local2) + "Energy"]);
var _local3 = HUD_mc[("energy" + _local2) + "_mc"]._currentframe;
var _local7 = _local4 - _local3;
if (_local7 != 0) {
var _local5 = Math.floor(_local7 / ENERGY_RATE_DIVIDER);
if (Math.abs(_local5) < ENERGY_RATE_MIN) {
if (_local7 < 0) {
_local5 = -ENERGY_RATE_MIN;
} else {
_local5 = ENERGY_RATE_MIN;
}
} else if (Math.abs(_local5) > ENERGY_RATE_MAX) {
if (_local7 < 0) {
_local5 = -ENERGY_RATE_MAX;
} else {
_local5 = ENERGY_RATE_MAX;
}
}
var _local1 = _local3 + _local5;
if (_local1 < 1) {
_local1 = 1;
}
if (_local1 > 101) {
_local1 = 101;
}
HUD_mc[("energy" + _local2) + "_mc"].gotoAndStop(_local1);
}
_local2++;
}
var _local9 = totalScore;
var _local8 = Number(HUD_mc.score_txt.text);
var _local7 = _local9 - _local8;
if (_local7 != 0) {
var _local5 = Math.floor(_local7 / SCORE_RATE_DIVIDER);
if (Math.abs(_local5) < SCORE_RATE_MIN) {
if (_local7 < 0) {
_local5 = -SCORE_RATE_MIN;
} else {
_local5 = SCORE_RATE_MIN;
}
} else if (Math.abs(_local5) > SCORE_RATE_MAX) {
if (_local7 < 0) {
_local5 = -SCORE_RATE_MAX;
} else {
_local5 = SCORE_RATE_MAX;
}
}
var _local6 = _local8 + _local5;
if ((_local5 > 0) && (_local6 > totalScore)) {
_local6 = totalScore;
}
if ((_local5 < 0) && (_local6 < totalScore)) {
_local6 = totalScore;
}
HUD_mc.score_txt.text = _local6;
}
}
static function workWithScore(use) {
scoreCalculation = use;
HUD_mc.score_txt._visible = scoreCalculation;
}
static function assignHud(hud_mc) {
HUD_mc = hud_mc;
HUD_mc.onEnterFrame = function () {
ScoreAndHud.onEnterFrame();
};
}
static function setPlayerEnergy(player, energy) {
if (player == 1) {
player1Energy = energy;
} else {
player2Energy = energy;
}
}
static function setMatchPoint(player, points) {
HUD_mc[("points" + player) + "_txt"].text = points;
}
static function setNation(player, type) {
HUD_mc[("logo" + player) + "_mc"].gotoAndStop(type);
}
static function roundWon(player, round) {
HUD_mc[((("round" + player) + "_") + round) + "_mc"].gotoAndStop("Won");
var _local1 = ((player == 1) ? 2 : 1);
HUD_mc[((("round" + _local1) + "_") + round) + "_mc"].gotoAndStop("Lose");
}
static function clearRoundTokens() {
var _local2 = 1;
while (_local2 <= 2) {
var _local1 = 1;
while (_local1 <= 2) {
HUD_mc[((("round" + _local2) + "_") + _local1) + "_mc"].gotoAndStop("Empty");
_local1++;
}
_local2++;
}
}
static function addPoints(qty) {
if (qty < 0) {
qty = 0;
}
totalScore = totalScore + qty;
if (totalScore < 0) {
totalScore = 0;
}
}
static function returnScore() {
return(totalScore);
}
static function clearAll() {
totalScore = 0;
clearRoundTokens();
setMatchPoint(1, 0);
setMatchPoint(2, 0);
}
static function fSetLevelOver(P_sLevelType, P_bSet) {
if (P_sLevelType == "Empty") {
HUD_mc.mcLevelOver.gotoAndStop(P_sLevelType);
} else {
if (P_bSet) {
HUD_type = P_sLevelType;
}
HUD_mc.mcLevelOver.gotoAndStop(HUD_type);
}
}
static var ENERGY_RATE_MIN = 1;
static var ENERGY_RATE_MAX = 2;
static var ENERGY_RATE_DIVIDER = 10;
static var SCORE_RATE_MIN = 1;
static var SCORE_RATE_MAX = 75;
static var SCORE_RATE_DIVIDER = 15;
static var totalScore = 0;
static var player1Energy = 100;
static var player2Energy = 100;
}
Symbol 1270 MovieClip [__Packages.TournamentControler] Frame 0
class TournamentControler
{
static var gameTwoPlayers, timeLine_mc, scene_mc, matchNum, roundNum, remainingOpponents, gameControler;
function TournamentControler () {
}
static function getWinner() {
if (p1_roundWon == 2) {
return(player1Avatar);
}
return(player2Avatar);
}
static function isGameTwoPlayers() {
return(gameTwoPlayers);
}
static function setGameTwoPlayers(l_twoPlayers) {
gameTwoPlayers = l_twoPlayers;
}
static function setPlayer1(l_avatar) {
player1Avatar = l_avatar;
}
static function returnPlayer1Avatar() {
return(player1Avatar);
}
static function returnPlayer2Avatar() {
return(player2Avatar);
}
static function setPlayer2(l_avatar) {
player2Avatar = l_avatar;
}
static function assignMainTimeLine(l_tl_mc) {
timeLine_mc = l_tl_mc;
}
static function assignScene(l_scene_mc) {
scene_mc = l_scene_mc;
}
static function beginTournament() {
scene_mc.gotoAndStop("Game");
ScoreAndHud.workWithScore(!gameTwoPlayers);
ScoreAndHud.clearRoundTokens();
if (!gameTwoPlayers) {
matchNum = 1;
roundNum = 1;
remainingOpponents = new Array("Fire", "Water", "Air", "Earth");
createFirstMatch();
} else {
roundNum = 1;
mapType = player1Avatar;
}
clearAll("GameAfterClean");
}
static function createFirstMatch() {
var _local1 = 0;
while (_local1 < remainingOpponents.length) {
if (remainingOpponents[_local1] == player1Avatar) {
remainingOpponents.splice(_local1, 1);
}
_local1++;
}
var _local2 = mathLib.randomRange(0, remainingOpponents.length - 1);
player2Avatar = remainingOpponents[_local2];
_local1 = 0;
while (_local1 < remainingOpponents.length) {
if (remainingOpponents[_local1] == player2Avatar) {
remainingOpponents.splice(_local1, 1);
}
_local1++;
}
mapType = player1Avatar;
}
static function endRound(l_winner) {
if (l_winner == 1) {
p1_roundWon++;
} else {
p2_roundWon++;
}
if (roundNum == 1) {
ScoreAndHud.roundWon(l_winner, 1);
nextRound();
} else if (roundNum == 2) {
if ((p1_roundWon < 2) && (p2_roundWon < 2)) {
ScoreAndHud.roundWon(l_winner, 2);
nextRound();
} else {
ScoreAndHud.roundWon(l_winner, 2);
nextOpponent();
}
} else {
nextOpponent();
}
}
static function PauseGame() {
gameControler.PauseGame(true);
}
static function UnpauseGame() {
gameControler.PauseGame(false);
}
static function nextRound() {
roundNum++;
ScoreAndHud.setMatchPoint(1, 0);
ScoreAndHud.setMatchPoint(2, 0);
if (roundNum == 2) {
mapType = player2Avatar;
} else if (roundNum == 3) {
var _local1 = new Array("Fire", "Water", "Air", "Earth");
var _local2 = 0;
while (_local2 < _local1.length) {
if (_local1[_local2] == player1Avatar) {
_local1.splice(_local2, 1);
}
_local2++;
}
_local2 = 0;
while (_local2 < _local1.length) {
if (_local1[_local2] == player2Avatar) {
_local1.splice(_local2, 1);
}
_local2++;
}
var _local3 = mathLib.randomRange(0, _local1.length - 1);
mapType = _local1[_local3];
}
clearAll("GameAfterClean");
}
static function clearAll(marker) {
gameControler.deleteAll();
gameControler = null;
delete gameControler;
_global.AFTERCLEAN_MARKER = marker;
timeLine_mc.gotoAndStop("ClearZone");
}
static function zoneCleaned() {
gameControler = new GameControler(scene_mc);
gameControler.setMatch(gameTwoPlayers, mapType, player1Avatar, player2Avatar);
if (roundNum == 1) {
explainMatch();
} else {
gameControler.startMatch();
}
}
static function returnOkFromExplain() {
timeLine_mc.explain_mc.gotoAndStop("EMPTY");
gameControler.startMatch();
}
static function explainMatch() {
timeLine_mc.explain_mc.gotoAndStop("POP-UP");
timeLine_mc.explain_mc.VsPanel.P1.gotoAndStop(player1Avatar);
timeLine_mc.explain_mc.VsPanel.P2.gotoAndStop(player2Avatar);
}
static function nextOpponent() {
if (!gameTwoPlayers) {
if (p1_roundWon >= 2) {
if (matchNum < 3) {
matchNum++;
roundNum = 1;
p1_roundWon = 0;
p2_roundWon = 0;
ScoreAndHud.setMatchPoint(1, 0);
ScoreAndHud.setMatchPoint(2, 0);
ScoreAndHud.clearRoundTokens();
var _local2 = mathLib.randomRange(0, remainingOpponents.length - 1);
player2Avatar = remainingOpponents[_local2];
var _local1 = 0;
while (_local1 < remainingOpponents.length) {
if (remainingOpponents[_local1] == player2Avatar) {
remainingOpponents.splice(_local1, 1);
}
_local1++;
}
mapType = player1Avatar;
clearAll("GameAfterClean");
} else {
gameControler.endGame();
enterFrame.togglePause(true);
timeLine_mc.winlose_mc.gotoAndStop("WIN");
}
} else {
gameControler.endGame();
enterFrame.togglePause(true);
timeLine_mc.winlose_mc.gotoAndStop("LOSE");
}
} else {
gameControler.endGame();
enterFrame.togglePause(true);
timeLine_mc.winlose_mc.gotoAndStop("2P-END");
}
}
static function returnMatchNum() {
return(matchNum);
}
static function returnRoundNum() {
return(roundNum);
}
static function submitScore() {
matchNum = 1;
roundNum = 1;
p1_roundWon = 0;
p2_roundWon = 0;
_global.SCORE_TO_SUBMIT = ScoreAndHud.returnScore();
_global.SCORE_AUTO_SUBMIT = true;
_global.SCORE_CHAR_TO_SHOW = player1Avatar;
ScoreAndHud.clearAll();
clearAll("GameAfterClean");
}
static function viewScore() {
matchNum = 1;
roundNum = 1;
p1_roundWon = 0;
p2_roundWon = 0;
_global.SCORE_TO_SUBMIT = ScoreAndHud.returnScore();
_global.SCORE_AUTO_SUBMIT = false;
_global.SCORE_CHAR_TO_SHOW = player1Avatar;
ScoreAndHud.clearAll();
clearAll("GameAfterClean");
}
static function fGetQuitPopup() {
timeLine_mc.quit_mc.gotoAndStop("POP-UP");
}
static function fQuitGame() {
matchNum = 1;
roundNum = 1;
p1_roundWon = 0;
p2_roundWon = 0;
if (gameTwoPlayers == false) {
_global.SCORE_TO_SUBMIT = ScoreAndHud.returnScore();
_global.SCORE_AUTO_SUBMIT = false;
_global.SCORE_CHAR_TO_SHOW = player1Avatar;
ScoreAndHud.clearAll();
clearAll("GameAfterClean");
} else {
ScoreAndHud.clearAll();
clearAll("Menu");
}
ScoreAndHud.clearAll();
clearAll("GameAfterClean");
}
static function fBlockHUDBtn(P_bBlock) {
if (P_bBlock) {
timeLine_mc.hud_mcBtn.gotoAndStop(2);
} else {
timeLine_mc.hud_mcBtn.gotoAndStop(1);
}
}
static function exitTournament() {
matchNum = 1;
roundNum = 1;
p1_roundWon = 0;
p2_roundWon = 0;
ScoreAndHud.clearAll();
clearAll("Menu");
}
static var mapType = "NOSET";
static var player1Avatar = "NOSET";
static var player2Avatar = "NOSET";
static var p1_roundWon = 0;
static var p2_roundWon = 0;
}
Symbol 1271 MovieClip [__Packages.GameControler] Frame 0
class GameControler
{
var scene_mc, map, ballPossessor, player1, player2, player2Type, ball;
function GameControler (scene_mc) {
this.scene_mc = scene_mc;
ScoreAndHud.newMatch();
enterFrame.togglePause(true);
_global.C = this;
}
function setMatch(l_twoPlayers, l_mapType, l_p1Type, l_p2Type) {
switch (l_mapType) {
case "Fire" :
map = new FireMap(scene_mc);
break;
case "Earth" :
map = new EarthMap(scene_mc);
break;
case "Air" :
map = new AirMap(scene_mc);
break;
case "Water" :
map = new WaterMap(scene_mc);
}
ballPossessor = mathLib.randomRange(1, 2);
player1 = new HumanPlayer(scene_mc, 1, l_p1Type);
ScoreAndHud.setNation(1, l_p1Type);
ScoreAndHud.fSetLevelOver(l_mapType, true);
ScoreAndHud.fSetLevelOver("Empty");
_global.twoPlayersGame = l_twoPlayers;
if (l_twoPlayers) {
player2 = new HumanPlayer(scene_mc, 2, l_p2Type);
player2Type = "Human";
} else {
player2 = new ComputerPlayer(scene_mc, 2, l_p2Type);
player2Type = "Computer";
}
ScoreAndHud.setNation(2, l_p2Type);
ball = new Ball(scene_mc);
enterFrame.addSpecialListener(this);
}
function PauseGame(p_State) {
enterFrame.togglePause(p_State);
}
function startMatch() {
_global.S.PlayASound("NewRound", 100, 1);
newRound();
showRoundNumber();
ScoreAndHud.fSetLevelOver(null);
timePoints = Configs.PTS_TIME_START;
}
function onEnterFrame() {
checkEndRound();
timePoints--;
}
function checkEndRound() {
if (showGoalCountDown != -1) {
showGoalCountDown++;
if (showGoalCountDown == MAKE_PAUSE) {
enterFrame.togglePause(true);
} else if (showGoalCountDown == SWAP_BETWEEN_ROUND) {
endRound();
if (P2Score >= POINT_REQUIRED_TO_WIN) {
TournamentControler.endRound(2);
enterFrame.togglePause(true);
} else if (P1Score >= POINT_REQUIRED_TO_WIN) {
TournamentControler.endRound(1);
enterFrame.togglePause(true);
calculateTimePoints();
} else {
switchPossessor();
newRound();
}
} else if (showGoalCountDown >= (SWAP_BETWEEN_ROUND + 10)) {
showGoalCountDown = -1;
if (!gameEnded) {
showPlayBall();
}
}
}
if (showRoundNumberCountDown != -1) {
showRoundNumberCountDown++;
if (showRoundNumberCountDown >= SEE_ROUND_NUMBER) {
showRoundNumberCountDown = -1;
showPlayBall();
}
}
if (showPlayBallCountDown != -1) {
showPlayBallCountDown++;
if (showPlayBallCountDown >= SEE_PLAY_BALL_NUMBER) {
showPlayBallCountDown = -1;
enterFrame.togglePause(false);
TournamentControler.fBlockHUDBtn(false);
keyChange(1);
keyChange(2);
}
}
}
function keyChange(playerNum) {
if (playerNum == 1) {
player1.keyChange();
} else if (playerNum == 2) {
if (player2Type == "Human") {
player2.keyChange();
}
}
}
function toggleInitialShot() {
if (!enterFrame.isGamePaused()) {
if (ballPossessor == 2) {
if (player2Type != "Computer") {
_global["P" + ballPossessor].launchBall();
}
} else {
_global["P" + ballPossessor].launchBall();
}
}
}
function goal(net) {
if (net == 1) {
P2Score++;
ScoreAndHud.setMatchPoint(2, P2Score);
ScoreAndHud.addPoints(Configs.PTS_BE_SCORED);
} else {
P1Score++;
ScoreAndHud.setMatchPoint(1, P1Score);
ScoreAndHud.addPoints(Configs.PTS_SCORES_GOAL);
}
showGoal();
TournamentControler.fBlockHUDBtn(true);
}
function endRound() {
_global.B.endRound();
_global.P1.endRound();
_global.P2.endRound();
_global.M.endRound();
keyPress1_Left = false;
keyPress1_Right = false;
keyPress1_Up = false;
keyPress1_Down = false;
keyPress1_Offense = false;
keyPress1_Defense = false;
keyPress2_Left = false;
keyPress2_Right = false;
keyPress2_Up = false;
keyPress2_Down = false;
keyPress2_Offense = false;
keyPress2_Defense = false;
}
function newRound() {
this["player" + ballPossessor].getBallPossession();
player1.newRound();
player2.newRound();
var _local2 = this["player" + ballPossessor].returnCoord();
ball.newRound(_local2.x, _local2.y, ballPossessor);
ScoreAndHud.fSetLevelOver(null);
}
function switchPossessor() {
ballPossessor = ((ballPossessor == 1) ? 2 : 1);
}
function showPlayBall() {
showPlayBallCountDown = 0;
var _local3 = scene_mc._parent.textFlash_mc.attachMovie("Anim_PlayBall", "anim_playball_mc", scene_mc.getNextHighestDepth());
_local3._x = _global.M.returnCenterPoint().x;
_local3._y = MESSAGES_VERT_CENTER;
new DisposableMC(_local3, SEE_PLAY_BALL_NUMBER);
}
function showGoal() {
_global.S.PlayASound("Goal", 100, 1);
showGoalCountDown = 0;
var _local3 = scene_mc._parent.textFlash_mc.attachMovie("Anim_Goal", "anim_goal_mc", scene_mc.getNextHighestDepth());
_local3._x = _global.M.returnCenterPoint().x;
_local3._y = MESSAGES_VERT_CENTER;
new DisposableMC(_local3, SWAP_BETWEEN_ROUND);
}
function showRoundNumber() {
showRoundNumberCountDown = 0;
var _local3 = scene_mc._parent.textFlash_mc.attachMovie("Anim_RoundNumber", "anim_round_mc", scene_mc.getNextHighestDepth());
_local3._x = _global.M.returnCenterPoint().x;
_local3._y = MESSAGES_VERT_CENTER;
_local3.text_mc.gotoAndStop(TournamentControler.returnRoundNum());
new DisposableMC(_local3, SEE_ROUND_NUMBER);
}
function calculateTimePoints() {
timePoints = ((timePoints < 0) ? 0 : (timePoints));
ScoreAndHud.addPoints(timePoints);
}
function endGame() {
gameEnded = true;
}
function deleteAll() {
showGoalCountDown = -1;
showPlayBallCountDown = -1;
showRoundNumberCountDown = -1;
_global.B.deleteAll();
_global.P1.deleteAll();
_global.P2.deleteAll();
_global.M.deleteAll();
_global.C = null;
_global.B = null;
_global.P1 = null;
_global.P2 = null;
_global.M = null;
delete _global.C;
delete _global.B;
delete _global.P1;
delete _global.P2;
delete _global.M;
player1 = null;
player2 = null;
map = null;
ball = null;
delete player1;
delete player2;
delete map;
delete ball;
}
static var POINT_REQUIRED_TO_WIN = 5;
static var MAKE_PAUSE = 48;
static var SWAP_BETWEEN_ROUND = 55;
static var SEE_ROUND_NUMBER = 45;
static var SEE_PLAY_BALL_NUMBER = 55;
static var MESSAGES_VERT_CENTER = 160;
var keyPress1_Left = false;
var keyPress1_Right = false;
var keyPress1_Up = false;
var keyPress1_Down = false;
var keyPress1_Offense = false;
var keyPress1_Defense = false;
var keyPress2_Left = false;
var keyPress2_Right = false;
var keyPress2_Up = false;
var keyPress2_Down = false;
var keyPress2_Offense = false;
var keyPress2_Defense = false;
var P1Score = 0;
var P2Score = 0;
var timePoints = 0;
var showGoalCountDown = -1;
var showRoundNumberCountDown = -1;
var showPlayBallCountDown = -1;
var gameEnded = false;
}
Symbol 1272 MovieClip [__Packages.Ball] Frame 0
class Ball
{
var scene_mc, my_mc, isActive, visualState, playerNum, angle, speed, fireTimeRemaining;
function Ball (scene_mc) {
this.scene_mc = scene_mc;
my_mc = this.scene_mc.attachMovie("Ball", "ball_mc", this.scene_mc.getNextHighestDepth());
isActive = false;
visualState = "Idle";
my_mc.ball_mc.gotoAndStop("Idle");
my_mc._visible = false;
my_mc._xscale = -100;
_global.B = this;
enterFrame.addListener(this);
}
function newRound(playerX, playerY, playerNum) {
this.playerNum = playerNum;
inGoalMove = false;
checkAngle();
visualState = "Idle";
my_mc.ball_mc.gotoAndStop("Idle");
my_mc._visible = false;
playerMoves(playerX, playerY);
stuckInPlayerHistory[0] = false;
stuckInPlayerHistory[1] = false;
stuckInPlayerHistory[2] = false;
stuckInBoundariesHistory[0] = false;
stuckInBoundariesHistory[1] = false;
stuckInBoundariesHistory[2] = false;
stuckInEnvironementHistory[0] = false;
stuckInEnvironementHistory[1] = false;
stuckInEnvironementHistory[2] = false;
}
function launchBall() {
if (!isActive) {
_global.BallLaunched = true;
isActive = true;
my_mc._visible = true;
if (playerNum == 1) {
angle = (90 + Math.floor(Math.random() * 40)) - 20;
} else {
angle = (270 + Math.floor(Math.random() * 40)) - 20;
}
checkAngle();
speed = MINIMUM_SPEED;
}
}
function playerMoves(x, y) {
if (!isActive) {
my_mc._y = y - 36;
if (playerNum == 1) {
my_mc._x = x + 35;
} else {
my_mc._x = x - 35;
}
}
}
function onEnterFrame() {
if (isActive) {
angle = mathLib.angleClean(angle);
affectSpeed();
var _local2 = Math.sin(mathLib.deg2rad(angle)) * speed;
var _local3 = Math.cos(mathLib.deg2rad(angle)) * speed;
var _local8 = new Object();
var _local5 = false;
var _local4 = false;
var _local6 = false;
var _local7 = false;
if (!inGoalMove) {
_local5 = checkPaddles(my_mc._x + _local2, my_mc._y + _local3);
_local4 = checkBoundaries(my_mc._x + _local2, my_mc._y + _local3);
_local6 = checkPlayers(my_mc._x + _local2, my_mc._y + _local3);
_local7 = checkEnvironementBlock(my_mc._x + _local2, my_mc._y + _local3);
} else {
checkGoalLimits();
}
if ((((!_local5) && (!_local4)) && (!_local6)) && (!_local7)) {
my_mc._x = my_mc._x + _local2;
my_mc._y = my_mc._y + _local3;
}
checkEnvironementContact();
checkFireState();
}
updateDepth();
}
function updateDepth() {
my_mc.swapDepths(15 + ((Math.floor(my_mc._y) * 1000) + my_mc._x));
}
function checkGoalLimits() {
if (((angle > 95) || (angle < 85)) || ((angle > 275) || (angle < 265))) {
if (my_mc._y < _global.M.returnGoalLimits().top) {
angle = 180 - angle;
my_mc._y = _global.M.returnGoalLimits().top + 15;
checkAngle();
} else if (my_mc._y > _global.M.returnGoalLimits().bottom) {
angle = 180 - angle;
my_mc._y = _global.M.returnGoalLimits().bottom - 15;
checkAngle();
}
}
}
function checkFireState() {
if ((visualState = "Feu")) {
fireTimeRemaining--;
if (fireTimeRemaining <= 0) {
visualState = "Idle";
my_mc.ball_mc.gotoAndStop("Idle");
}
}
}
function checkEnvironementBlock(x, y) {
var _local3 = _global.M.isClearPathBall(x, y, angle);
stuckInEnvironementHistory[0] = stuckInEnvironementHistory[1];
stuckInEnvironementHistory[1] = stuckInEnvironementHistory[2];
stuckInEnvironementHistory[2] = !_local3.ok;
if ((stuckInEnvironementHistory[0] && (stuckInEnvironementHistory[1])) && (stuckInEnvironementHistory[2])) {
trace("STUCK ENV");
angle = _global.M.angleToCenter(x, y);
checkAngle();
var _local4 = Math.sin(mathLib.deg2rad(angle)) * speed;
var _local5 = Math.cos(mathLib.deg2rad(angle)) * speed;
my_mc._x = my_mc._x + _local4;
my_mc._y = my_mc._y + _local5;
} else if (!_local3.ok) {
angle = mathLib.angleClean(_local3.angle);
checkAngle();
}
return(!_local3.ok);
}
function checkEnvironementContact() {
var _local3 = my_mc.getBounds(scene_mc);
var _local5 = (_local3.xMin + _local3.xMax) / 2;
var _local4 = (_local3.yMin + _local3.yMax) / 2;
_global.M.doCheckEnvironementContactBall(_local5, _local4, this);
}
function setInFire() {
if (visualState == "Idle") {
visualState = "Feu";
my_mc.ball_mc.gotoAndStop("Feu");
fireTimeRemaining = mathLib.randomRange(IN_FIRE_MIN_FRAMES, IN_FIRE_MAX_FRAMES);
speed = speed + IN_FIRE_SPEED_ADD;
}
}
function endRound() {
_global.BallLaunched = false;
isActive = false;
my_mc._visible = false;
}
function affectSpeed() {
if (visualState != "Feu") {
speed = speed - AIR_FRICTION;
} else {
speed = speed - IN_FIRE_FRICTION;
}
if (speed > ABSOLUTE_MAX_SPEED) {
speed = ABSOLUTE_MAX_SPEED;
}
if (speed < MINIMUM_SPEED) {
speed = MINIMUM_SPEED;
}
}
function visualSpeedDemonstration() {
if (speed > MINIMUM_SPEED) {
var _local3 = speed - MINIMUM_SPEED;
var _local2 = Math.floor(((MAXIMUM_HIGH_SPEED_DELTA * 10) / _local3) / 10);
my_mc.ball_mc.acceleration_mc.gotoAndPlay(_local2);
}
}
function checkBoundaries(x, y) {
var _local11 = true;
var _local16 = _global.M.isInbound(x, null, "Ball");
var _local7 = angle - 180;
var _local8 = angle;
var _local18;
var _local19;
var _local17 = false;
if (!_local16) {
if (!_global.M.checkGoal(x, y)) {
var _local14 = false;
angle = mathLib.angleClean(angle);
if (x > _global.M.returnBounds().right) {
if ((angle >= 0) && (angle <= 180)) {
_local14 = true;
}
} else if (x < _global.M.returnBounds().left) {
if ((angle >= 180) && (angle <= 360)) {
_local14 = true;
}
}
if (_local14) {
_local8 = mathLib.angleReflectVertical(_local8);
_local8 = mathLib.angleClean(_local8);
}
} else {
_local17 = true;
inGoalMove = true;
}
} else {
var _local15 = _global.M.isInbound(null, y, "Ball");
if (!_local15) {
var _local14 = false;
angle = mathLib.angleClean(angle);
if (y > _global.M.returnBounds().bottom) {
if ((angle <= 90) || (angle >= 270)) {
_local14 = true;
}
} else if (y < _global.M.returnBounds().top) {
if ((angle <= 270) && (angle > 90)) {
_local14 = true;
}
}
if (_local14) {
_local8 = 180 - _local8;
_local8 = mathLib.angleClean(_local8);
}
}
}
if (!_local17) {
if ((!_local16) || (!_local15)) {
_local11 = false;
}
if (!_local11) {
var _local4 = x;
var _local3 = y;
var _local5 = false;
var _local10 = 0;
var _local6 = 1;
while ((!_local5) && ((_local10++) < 50)) {
_local4 = _local4 + (Math.sin(mathLib.deg2rad(_local7)) * _local6);
_local3 = _local3 + (Math.cos(mathLib.deg2rad(_local7)) * _local6);
_local5 = _global.M.isInbound(_local4, _local3, "Ball");
}
_local18 = _local4;
_local19 = _local3;
}
stuckInBoundariesHistory[0] = stuckInBoundariesHistory[1];
stuckInBoundariesHistory[1] = stuckInBoundariesHistory[2];
stuckInBoundariesHistory[2] = !_local11;
if ((stuckInBoundariesHistory[0] && (stuckInBoundariesHistory[1])) && (stuckInBoundariesHistory[2])) {
trace("STUCK BOUNDS");
angle = _global.M.angleToCenter(x, y);
var _local9 = _global.M.returnBounds();
if (my_mc._x < _local9.left) {
my_mc._x = _local9.left + (my_mc._width + (my_mc._width / 2));
}
if (my_mc._x > _local9.right) {
my_mc._x = _local9.right - (my_mc._width + (my_mc._width / 2));
}
if (my_mc._y < (_local9.top - 50)) {
my_mc._y = (_local9.top - 50) + (my_mc._height + (my_mc._height / 2));
}
if (my_mc._y > _local9.bottom) {
my_mc._y = _local9.bottom - (my_mc._height + (my_mc._height / 2));
}
} else if (!_local11) {
angle = mathLib.angleClean(_local8);
checkAngle();
my_mc._x = _local18;
my_mc._y = _local19;
}
return(!_local11);
}
return(false);
}
function checkAngle() {
my_mc.ball_mc._rotation = angle + 90;
}
function checkPaddles(x, y) {
var _local6 = false;
var _local4 = _global.P1.hitPaddle(x, y, angle);
if (_local4.hit) {
_global.S.PlayASound("Hurt", 40, 1);
_local6 = true;
playerNum = 1;
my_mc._x = _local4.x + (_local4.hSpeed * 2);
my_mc._y = _local4.y;
angle = _local4.angle;
checkAngle();
speed = speed + (_local4.hSpeed + PADDLE_HIT_ACCELERATION);
visualSpeedDemonstration();
if (visualState == "Feu") {
var _local5 = scene_mc.attachMovie("BallImpacts", "ball_impact_mc", scene_mc.getNextHighestDepth());
_local5.gotoAndStop("Feu");
_local5._x = my_mc._x;
_local5._y = my_mc._y;
new DisposableMC(_local5, 11);
}
} else {
var _local3 = _global.P2.hitPaddle(x, y, angle);
if (_local3.hit) {
_global.S.PlayASound("Hurt", 40, 1);
_local6 = true;
playerNum = 2;
my_mc._x = _local3.x + (_local3.hSpeed * 2);
my_mc._y = _local3.y;
angle = _local3.angle;
checkAngle();
speed = speed + ((_local3.hSpeed * -1) + PADDLE_HIT_ACCELERATION);
visualSpeedDemonstration();
if (visualState == "Feu") {
var _local5 = scene_mc.attachMovie("BallImpacts", "ball_impact_mc", scene_mc.getNextHighestDepth());
_local5.gotoAndStop("Feu");
_local5._x = my_mc._x;
_local5._y = my_mc._y;
_local5._xscale = -100;
new DisposableMC(_local5, 11);
}
}
}
return(_local6);
}
function checkPlayers(x, y) {
var _local3 = false;
var _local5 = _global.P1.hitPlayer(x, y, angle, speed, "Ball");
var _local7;
var _local6;
var _local8;
if (_local5.hit) {
_local3 = true;
_local6 = _local5.x;
_local8 = _local5.y;
_local7 = _local5.angle;
} else {
var _local4 = _global.P2.hitPlayer(x, y, angle, speed, "Ball");
if (_local4.hit) {
_local3 = true;
_local6 = _local4.x;
_local8 = _local4.y;
_local7 = _local4.angle;
}
}
stuckInPlayerHistory[0] = stuckInPlayerHistory[1];
stuckInPlayerHistory[1] = stuckInPlayerHistory[2];
stuckInPlayerHistory[2] = _local3;
if ((stuckInPlayerHistory[0] && (stuckInPlayerHistory[1])) && (stuckInPlayerHistory[2])) {
trace("STUCK PLAYER");
angle = _global.M.angleToCenter(x, y);
checkAngle();
var _local9 = Math.sin(mathLib.deg2rad(angle)) * speed;
var _local10 = Math.cos(mathLib.deg2rad(angle)) * speed;
my_mc._x = my_mc._x + _local9;
my_mc._y = my_mc._y + _local10;
} else if (_local3) {
angle = _local7;
checkAngle();
my_mc._x = _local6;
my_mc._y = _local8;
}
return(_local3);
}
function returnDirection() {
if (mathLib.angleClean(angle) <= 180) {
return(2);
}
return(1);
}
function returnPossessor() {
return(playerNum);
}
function returnCoord() {
var _local2 = new Object();
_local2.x = my_mc._x;
_local2.y = my_mc._y;
return(_local2);
}
function pauseAndHide() {
isActive = false;
my_mc._visible = false;
}
function changePosAngleAndSpeed(x, y, angle, speed) {
my_mc._x = x;
my_mc._y = y;
this.angle = angle;
this.speed = speed;
visualState = "Idle";
my_mc.ball_mc.gotoAndStop("Idle");
checkAngle();
}
function moveAgain() {
isActive = true;
my_mc._visible = true;
}
function returnAngle() {
return(angle);
}
function returnCornersMcs() {
var _local2 = new Object();
_local2.TR = my_mc.TR_mc;
_local2.TL = my_mc.TL_mc;
_local2.BR = my_mc.BR_mc;
_local2.BL = my_mc.BL_mc;
return(_local2);
}
function returnIsActive() {
return(isActive);
}
function waveHit() {
if (my_mc._x < _global.M.returnCenterPoint().x) {
angle = 270;
} else {
angle = 90;
}
checkAngle();
}
function deleteAll() {
enterFrame.removeListener(this);
my_mc.swapDepths(1);
my_mc.removeMovieClip();
my_mc = null;
delete my_mc;
scene_mc = null;
delete scene_mc;
_global.B = null;
}
static var MINIMUM_SPEED = 8;
static var ABSOLUTE_MAX_SPEED = 25;
static var AIR_FRICTION = 0.5;
static var IN_FIRE_FRICTION = 0.3;
static var IN_FIRE_MIN_FRAMES = 30;
static var IN_FIRE_MAX_FRAMES = 150;
static var IN_FIRE_SPEED_ADD = 10;
static var MAXIMUM_HIGH_SPEED_DELTA = 30;
static var PADDLE_HIT_ACCELERATION = 8;
static var CORNER_TOLERANCE = 10;
var inGoalMove = false;
var stuckInPlayerHistory = new Array();
var stuckInBoundariesHistory = new Array();
var stuckInEnvironementHistory = new Array();
}
Symbol 1273 MovieClip [__Packages.mathLib] Frame 0
class mathLib
{
function mathLib () {
}
static function deg2rad(deg) {
return(deg * 0.0174532925199433 /* Math.PI/180 */);
}
static function rad2deg(rad) {
return((rad * 180) / Math.PI);
}
static function angleReflectVertical(angle) {
var _local2 = 0;
angle = angleClean(angle);
if ((angle > 0) && (angle < 90)) {
_local2 = 360 - angle;
} else if ((angle > 90) && (angle < 180)) {
_local2 = 180 + (180 - angle);
} else if ((angle > 180) && (angle < 270)) {
_local2 = 180 - (angle - 180);
} else if ((angle > 270) && (angle < 360)) {
_local2 = 360 - angle;
} else {
_local2 = angle - 180;
}
return(_local2);
}
static function angleClean(angle) {
var _local1 = 0;
_local1 = angle % 360;
if (angle < 0) {
_local1 = 360 + angle;
} else {
_local1 = angle;
}
return(_local1);
}
static function randomRange(a, b) {
var _local1 = a + Math.floor(Math.random() * ((b + 1) - a));
return(_local1);
}
static function styleNumber(l_nNumber, l_nMinimumChar) {
var _local6 = false;
var _local1 = String(l_nNumber);
var _local7 = _local1;
do {
if (_local1.length < l_nMinimumChar) {
_local6 = true;
_local7 = "0" + _local7;
}
} while (_local7.length < l_nMinimumChar);
_local1 = _local7;
var _local3 = "";
var _local5 = _local1.length;
_local5 = _local5 / 3;
if (_local5 <= 1) {
return(_local1);
}
var _local2 = _local5;
while (_local2 > 1) {
_local3 = (" " + _local1.substr(-3)) + _local3;
_local1 = _local1.substr(0, -3);
_local2--;
}
_local7 = _local1 + _local3;
return(_local7);
}
}
Symbol 1274 MovieClip [__Packages.DisposableMC] Frame 0
class DisposableMC
{
var my_mc, dieTime;
function DisposableMC (my_mc, dieTime) {
this.my_mc = my_mc;
this.dieTime = dieTime;
enterFrame.addSpecialListener(this);
}
function onEnterFrame() {
dieTime--;
if (dieTime <= 0) {
die();
}
}
function die() {
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
}
Symbol 1275 MovieClip [__Packages.HumanPlayer] Frame 0
class HumanPlayer
{
var player, avatar, playerNum, offenseToggle, defenseToggle;
function HumanPlayer (scene_mc, playerNum, avatar) {
switch (avatar) {
case "Fire" :
player = new FirePlayer(scene_mc, playerNum, this);
break;
case "Water" :
player = new WaterPlayer(scene_mc, playerNum, this);
break;
case "Air" :
player = new AirPlayer(scene_mc, playerNum, this);
break;
case "Earth" :
player = new EarthPlayer(scene_mc, playerNum, this);
}
this.avatar = avatar;
this.playerNum = playerNum;
}
function keyChange() {
var _local8 = _global.C[("keyPress" + playerNum) + "_Left"];
var _local5 = _global.C[("keyPress" + playerNum) + "_Right"];
var _local7 = _global.C[("keyPress" + playerNum) + "_Up"];
var _local6 = _global.C[("keyPress" + playerNum) + "_Down"];
if (_global.C[("keyPress" + playerNum) + "_Offense"] && (!offenseToggle)) {
pressOffense();
offenseToggle = true;
} else if ((!_global.C[("keyPress" + playerNum) + "_Offense"]) && (offenseToggle)) {
releaseOffense();
offenseToggle = false;
}
if (_global.C[("keyPress" + playerNum) + "_Defense"] && (!defenseToggle)) {
pressDefense();
defenseToggle = true;
} else if ((!_global.C[("keyPress" + playerNum) + "_Defense"]) && (defenseToggle)) {
releaseDefense();
defenseToggle = false;
}
var _local3 = "yIdle";
var _local4 = "xIdle";
if (_local8) {
_local4 = "MoveLeft";
}
if (_local5) {
_local4 = "MoveRight";
}
if (_local7) {
_local3 = "MoveUp";
}
if (_local6) {
_local3 = "MoveDown";
}
player.changeXMoveState(_local4);
player.changeYMoveState(_local3);
}
function returnCoord() {
return(player.returnCoord());
}
function launchBall() {
player.launchBall();
}
function getBallPossession() {
player.getBallPossession();
}
function endRound() {
player.endRound();
}
function newRound() {
player.newRound();
}
function hitPaddle(x, y, hitAngle) {
return(player.hitPaddle(x, y, hitAngle));
}
function pressOffense() {
player.pressOffense();
}
function pressDefense() {
player.pressDefense();
}
function releaseOffense() {
player.releaseOffense();
}
function releaseDefense() {
player.releaseDefense();
}
}
Symbol 1276 MovieClip [__Packages.Player] Frame 0
class Player
{
var scene_mc, playerNum, avatar, launchedBall, upperPlayer, controlInterface, specialMove, specialMoveNoWalk, xMoveState, yMoveState, maxSpeedH, maxSpeedV, decelH, decelV, accelH, accelV, stopFactorH, stopFactorV, energy, my_mc, LEGS_currentState, inHurtCountDown, inBounce, inBounceCountDown, inPaddleHit, inPaddleDeployement, waveHitCountDown, paddleDeployementTime, paddleHitCountDown, paddleDeployed, B_futureState, UB_futureState, UB_currentState, possesesBall, inServiceMotion, serviceMotionTime;
function Player (scene_mc, playerNum, avatar, upperPlayer, controlInterface) {
this.scene_mc = scene_mc;
this.playerNum = playerNum;
this.avatar = avatar;
launchedBall = false;
this.upperPlayer = upperPlayer;
this.controlInterface = controlInterface;
specialMove = false;
specialMoveNoWalk = false;
xMoveState = "xIdle";
yMoveState = "yIdle";
maxSpeedH = SPEED_MAX_H;
maxSpeedV = SPEED_MAX_V;
if ((this.avatar != "Water") && (_global.MapType == "Water")) {
decelH = SPEED_DECEL_H_ICE;
decelV = SPEED_DECEL_V_ICE;
accelH = SPEED_ACCEL_H_ICE;
accelV = SPEED_ACCEL_V_ICE;
stopFactorH = STOP_FACTOR_H_ICE;
stopFactorV = STOP_FACTOR_V_ICE;
} else {
decelH = SPEED_DECEL_H;
decelV = SPEED_DECEL_V;
accelH = SPEED_ACCEL_H;
accelV = SPEED_ACCEL_V;
stopFactorH = STOP_FACTOR_H;
stopFactorV = STOP_FACTOR_V;
}
energy = 100;
ScoreAndHud.setPlayerEnergy(this.playerNum, energy);
hSpeed = 0;
vSpeed = 0;
_global["P" + this.playerNum] = this;
enterFrame.addListener(this);
}
function setUpPosition() {
changePos();
my_mc.qs_mc._visible = false;
my_mc.gotoAndStop("IdleMove");
LEGS_currentState = "Idle";
my_mc.player_mc.gotoAndStop("Idle");
}
function changePos() {
if (playerNum == 1) {
my_mc._x = 80;
} else {
my_mc._x = 520;
my_mc._xscale = -100;
}
my_mc._y = 200;
updateDepth();
}
function doVisualDefense() {
my_mc.player_mc.upperBody_mc.gotoAndStop("Defense");
UB_futureStateChange(Configs[avatar + "_Frames_Defense"], "Idle");
}
function doVisualAttack() {
my_mc.player_mc.upperBody_mc.gotoAndStop("Attack");
UB_futureStateChange(Configs[avatar + "_Frames_Attack"], "Idle");
}
function newRound() {
hSpeed = 0;
vSpeed = 0;
inHurt = false;
inHurtCountDown = -1;
inBounce = false;
inBounceCountDown = -1;
inPaddleHit = false;
inPaddleDeployement = false;
waveHitCountDown = -1;
paddleDeployementTime = -1;
paddleHitCountDown = -1;
specialMove = false;
specialMoveNoWalk = false;
paddleDeployed = false;
energy = energy + 50;
ScoreAndHud.setPlayerEnergy(playerNum, energy);
setUpPosition();
changeVisualMoveState();
controlInterface.keyChange();
controlInterface.doNewRound();
}
function B_futureStateChange(frames, state) {
B_stateChangeCountdown = frames - 1;
B_futureState = state;
}
function UB_futureStateChange(frames, state) {
UB_stateChangeCountdown = frames - 1;
UB_futureState = state;
}
function checkForStateChange() {
if (UB_stateChangeCountdown != -1) {
if (UB_stateChangeCountdown <= 0) {
UB_currentState = UB_futureState;
if (!specialMove) {
my_mc.player_mc.upperBody_mc.gotoAndStop(UB_futureState);
}
if (possesesBall) {
my_mc.player_mc.upperBody_mc.gotoAndStop("Service");
}
UB_stateChangeCountdown = -1;
} else {
UB_stateChangeCountdown--;
}
}
if (B_stateChangeCountdown != -1) {
if (B_stateChangeCountdown <= 0) {
if (!specialMove) {
if (B_futureState == "Idle") {
my_mc.gotoAndStop("IdleMove");
LEGS_currentState = "Idle";
my_mc.player_mc.gotoAndStop("Idle");
} else if (B_futureState == "Move") {
my_mc.gotoAndStop("IdleMove");
LEGS_currentState = "Move";
if (_global.MapType != "Water") {
my_mc.player_mc.gotoAndPlay("Move");
} else {
my_mc.player_mc.gotoAndPlay("MoveIce");
}
} else {
my_mc.gotoAndStop(B_futureState);
}
if (possesesBall) {
my_mc.player_mc.upperBody_mc.gotoAndStop("Service");
}
}
B_stateChangeCountdown = -1;
} else {
B_stateChangeCountdown--;
}
}
}
function checkServiceMotion() {
if (inServiceMotion) {
serviceMotionTime++;
if (serviceMotionTime == Configs[avatar + "_Time_Service"]) {
_global.B.launchBall();
} else if (serviceMotionTime == Configs[avatar + "_Idle_Time_Service"]) {
inServiceMotion = false;
}
}
}
function checkInPaddleDeployment() {
if (inPaddleDeployement) {
paddleDeployementTime--;
if (paddleDeployementTime <= 0) {
inPaddleDeployement = false;
}
}
}
function checkInPaddleHit() {
if (inPaddleHit) {
paddleHitCountDown--;
if (paddleHitCountDown <= 0) {
inPaddleHit = false;
}
}
}
function checkInHurt() {
if (inHurt) {
inHurtCountDown--;
if (inHurtCountDown <= 0) {
inHurt = false;
controlInterface.keyChange();
}
}
}
function checkWaveHit() {
if (waveHitCountDown > 0) {
waveHitCountDown--;
if (playerNum == 1) {
hSpeed = -maxSpeedH;
xMoveState = "MoveLeft";
} else {
hSpeed = maxSpeedH;
xMoveState = "MoveRight";
}
if (waveHitCountDown == 0) {
xMoveState = "xIdle";
controlInterface.keyChange();
}
}
}
function checkInBounce() {
if (inBounce) {
inBounceCountDown--;
if (inBounceCountDown <= 0) {
inBounce = false;
if (!specialMove) {
my_mc.player_mc.upperBody_mc.gotoAndStop("Shield");
my_mc.player_mc.upperBody_mc.UB_Shield_mc.gotoAndPlay("Open");
paddleDeployementTime = Configs[avatar + "_Frames_Shield"] - Configs[avatar + "_Frame_Shield_Open"];
UB_futureStateChange(Configs[avatar + "_Frames_Shield"] - Configs[avatar + "_Frame_Shield_Open"], "Idle");
}
}
}
}
function onEnterFrame() {
this[xMoveState]();
this[yMoveState]();
checkForStateChange();
checkServiceMotion();
checkInPaddleHit();
checkInPaddleDeployment();
checkInHurt();
checkInBounce();
checkWaveHit();
if ((_global.MapType == "Air") && (avatar != "Air")) {
if (_global.FIELD_WIND_ANGLE != null) {
fieldWind(_global.FIELD_WIND_ANGLE);
}
}
doCheckEnvironementContact();
if (possesesBall) {
my_mc.player_mc.upperBody_mc.gotoAndStop("Service");
}
if (possesesBall || (inServiceMotion)) {
_global.B.playerMoves(my_mc._x, my_mc._y);
}
updateDepth();
}
function returnCoord() {
return({x:my_mc._x, y:my_mc._y});
}
function doCheckEnvironementContact() {
var _local3 = getFootsPosition("Current");
_global.M.doCheckEnvironementContactPlayer(_local3.x, _local3.y, avatar, this);
}
function hitPaddle(x, y, hitAngle) {
if (!specialMove) {
if (my_mc.paddleDeploy_mc.hitTest(x, y)) {
if (!inPaddleDeployement) {
UB_futureStateChange(Configs[avatar + "_Frames_Shield"], "Idle");
UB_currentState = "Shield";
my_mc.player_mc.upperBody_mc.gotoAndStop("Shield");
paddleDeployementTime = Configs[avatar + "_Frames_Shield"];
inPaddleDeployement = true;
} else if (my_mc.player_mc.upperBody_mc.UB_Shield_mc._currentframe > Configs[avatar + "_Frame_Shield_Open"]) {
paddleDeployementTime = Configs[avatar + "_Frames_Shield"] - Configs[avatar + "_Frame_Shield_Open"];
my_mc.player_mc.upperBody_mc.UB_Shield_mc.gotoAndPlay("Open");
UB_futureStateChange(Configs[avatar + "_Frames_Shield"] - Configs[avatar + "_Frame_Shield_Open"], "Idle");
}
}
var _local3 = new Object();
_local3.hit = false;
if ((!inServiceMotion) && (!inPaddleHit)) {
if (my_mc.paddleHit_mc.hitTest(x, y)) {
my_mc.player_mc.upperBody_mc.gotoAndStop("Bounce");
inBounce = true;
inBounceCountDown = Configs[avatar + "_Frames_Shield_Bounce"];
inPaddleHit = true;
paddleHitCountDown = 10;
_local3.hit = true;
var _local8 = true;
var _local7 = 1;
var _local10 = my_mc.paddleHit_mc.getBounds(_global.SCENE);
if (playerNum == 1) {
if (x < ((_local10.xMin + _local10.xMax) / 2)) {
var _local4 = 270 + mathLib.randomRange(-20, 20);
var _local5 = _local10.xMax;
var _local6 = y;
} else {
var _local4 = hitAngle - 180;
var _local5 = x;
var _local6 = y;
}
} else if (x > ((_local10.xMin + _local10.xMax) / 2)) {
var _local4 = 90 + mathLib.randomRange(-20, 20);
var _local5 = _local10.xMin;
var _local6 = y;
} else {
var _local4 = hitAngle - 180;
var _local5 = x;
var _local6 = y;
}
var _local9 = 0;
while (_local8 && ((_local9++) < 50)) {
var _local5 = _local5 + (Math.sin(mathLib.deg2rad(_local4)) * _local7);
var _local6 = _local6 + (Math.cos(mathLib.deg2rad(_local4)) * _local7);
if (!my_mc.paddleHit_mc.hitTest(_local5, _local6)) {
_local8 = false;
}
}
_local3.hSpeed = hSpeed;
_local3.x = _local5;
_local3.y = _local6;
var _local15 = my_mc.paddleHit_mc.getBounds(scene_mc);
var _local13 = ((_local15.yMin + _local15.yMax) / 2) - y;
if (playerNum == 1) {
_local13 = _local13 * -1;
}
if (((_local13 < (my_mc.paddleHit_mc._height * 0.3)) && (Math.abs(hitAngle - 180) > 10)) && (Math.abs(hitAngle) > 10)) {
_local3.angle = mathLib.angleClean(mathLib.angleReflectVertical(hitAngle)) + (_local13 / REFLECT_ANGLE);
} else {
var _local4 = mathLib.angleClean(_local4);
if ((_local4 > 0) && (_local4 < 90)) {
_local4 = 45;
} else if ((_local4 > 90) && (_local4 < 180)) {
_local4 = 135;
} else if ((_local4 > 180) && (_local4 < 270)) {
_local4 = 225;
} else if ((_local4 > 270) && (_local4 < 360)) {
_local4 = 315;
} else if (playerNum == 1) {
_local4 = 90;
} else {
_local4 = 270;
}
_local3.angle = _local4;
}
}
}
_local3.angle = mathLib.angleClean(_local3.angle);
if (playerNum == 1) {
if ((_local3.angle > 0) && (_local3.angle < 15)) {
_local3.angle = 15;
} else if ((_local3.angle > 165) && (_local3.angle < 180)) {
_local3.angle = 165;
} else if ((_local3.angle < 360) && (_local3.angle > 180)) {
_local3.angle = 90 + mathLib.randomRange(-20, 20);
}
} else if ((_local3.angle < 360) && (_local3.angle > 345)) {
_local3.angle = 345;
} else if ((_local3.angle > 180) && (_local3.angle < 195)) {
_local3.angle = 195;
} else if ((_local3.angle < 180) && (_local3.angle > 0)) {
_local3.angle = 270 + mathLib.randomRange(-20, 20);
}
_local3.angle = _local3.angle + mathLib.randomRange(-REFLECT_RANDOMNESS, REFLECT_RANDOMNESS);
return(_local3);
}
return({hit:false});
}
function hitPlayer(x, y, hitAngle, speed, context) {
var _local2 = new Object();
_local2.hit = false;
if (!specialMove) {
if (my_mc.playerHit_mc.hitTest(x, y)) {
_local2.hit = true;
if (context == "Ball") {
_local2.x = x;
_local2.y = y;
sufferBallHit(hitAngle, speed);
_local2.angle = (hitAngle - 180) + (Math.random(HIT_PLAYER_RANDOMNESS) - (HIT_PLAYER_RANDOMNESS / 2));
_local2.angle = mathLib.angleClean(_local2.angle);
if (playerNum == 1) {
if ((_local2.angle > 0) && (_local2.angle < 15)) {
_local2.angle = 15;
} else if ((_local2.angle > 165) && (_local2.angle < 180)) {
_local2.angle = 165;
} else if ((_local2.angle < 360) && (_local2.angle > 180)) {
_local2.angle = 90 + mathLib.randomRange(-20, 20);
}
} else if ((_local2.angle < 360) && (_local2.angle > 345)) {
_local2.angle = 345;
} else if ((_local2.angle > 180) && (_local2.angle < 195)) {
_local2.angle = 195;
} else if ((_local2.angle < 180) && (_local2.angle > 0)) {
_local2.angle = 270 + mathLib.randomRange(-20, 20);
}
}
}
}
return(_local2);
}
function endRound() {
my_mc.gotoAndStop("IdleMove");
LEGS_currentState = "Idle";
my_mc.player_mc.gotoAndStop("Idle");
my_mc.player_mc.upperBody_mc.gotoAndStop("Idle");
upperPlayer.stopSpecialMove();
setUpPosition();
launchedBall = false;
}
function launchBall() {
if (possesesBall) {
possesesBall = false;
launchedBall = true;
serviceMotionTime = 0;
inServiceMotion = true;
xMoveState = "xIdle";
yMoveState = "yIdle";
B_futureStateChange(Configs[avatar + "_Frames_Service"], "Idle");
my_mc.gotoAndStop("Service");
}
}
function getBallPossession() {
possesesBall = true;
}
function changeXMoveState(l_state) {
if ((!inServiceMotion) && (!inHurt)) {
xMoveState = l_state;
changeVisualMoveState();
}
}
function changeYMoveState(l_state) {
if ((!inServiceMotion) && (!inHurt)) {
yMoveState = l_state;
changeVisualMoveState();
}
}
function changeVisualMoveState() {
if (!specialMoveNoWalk) {
if ((xMoveState == "xIdle") && (yMoveState == "yIdle")) {
if (LEGS_currentState != "Idle") {
my_mc.gotoAndStop("IdleMove");
LEGS_currentState = "Idle";
my_mc.player_mc.gotoAndStop("Idle");
}
} else if (LEGS_currentState != "Move") {
my_mc.gotoAndStop("IdleMove");
LEGS_currentState = "Move";
if (_global.MapType != "Water") {
my_mc.player_mc.gotoAndPlay("Move");
} else {
my_mc.player_mc.gotoAndPlay("MoveIce");
}
}
if (possesesBall) {
my_mc.player_mc.upperBody_mc.gotoAndStop("Service");
}
}
}
function sufferBallHit(angle, speed) {
if (!inHurt) {
my_mc._x = my_mc._x + (Math.sin(mathLib.deg2rad(angle)) * speed);
my_mc._y = my_mc._y + (Math.cos(mathLib.deg2rad(angle)) * speed);
energy = energy - 15;
_global.S.PlayASound("Hurt", 100, 1);
}
inHurt = true;
inHurtCountDown = Configs[avatar + "_Time_Hurt"];
vSpeed = 0;
hSpeed = 0;
if (specialMove) {
upperPlayer.stopSpecialMove();
}
my_mc.gotoAndStop("Hurt");
B_futureStateChange(Configs[avatar + "_Frames_Hurt"], "Idle");
}
function xIdle() {
hSpeed = hSpeed / decelH;
if (Math.abs(hSpeed) < 0.1) {
hSpeed = 0;
}
if (hSpeed != 0) {
var _local4 = true;
var _local3 = getFootsPosition("Future").x;
if (_local3 < _global.M.returnBounds().left) {
_local4 = false;
} else if (_local3 > _global.M.returnBounds().right) {
_local4 = false;
}
if (playerNum == 2) {
if (_local3 < _global.M.returnCenterPoint().x) {
_local4 = false;
}
} else if (_local3 > _global.M.returnCenterPoint().x) {
_local4 = false;
}
if ((!hObstaclesCheck(_local3)) || (!_local4)) {
hSpeed = 0;
} else {
move();
}
}
}
function yIdle() {
vSpeed = vSpeed / decelV;
if (Math.abs(vSpeed) < 0.1) {
vSpeed = 0;
}
if (vSpeed != 0) {
var _local4 = true;
var _local3 = getFootsPosition("Future").y;
if (_local3 < _global.M.returnBounds().top) {
_local4 = false;
} else if (_local3 > _global.M.returnBounds().bottom) {
_local4 = false;
}
if ((!vObstaclesCheck(_local3)) || (!_local4)) {
vSpeed = 0;
} else {
move();
}
}
}
function MoveLeft() {
if (Math.abs(hSpeed) < maxSpeedH) {
hSpeed = hSpeed - accelH;
} else if (hSpeed > 0) {
hSpeed = hSpeed / stopFactorH;
}
if (Math.abs(vSpeed) != 0) {
var _local6 = Math.sqrt((vSpeed * vSpeed) + (hSpeed * hSpeed));
var _local5 = (maxSpeedH + maxSpeedV) / 4;
if (_local6 > _local5) {
if (Math.abs(hSpeed) > _local5) {
hSpeed = -_local5;
}
}
}
var _local4 = true;
var _local3 = getFootsPosition("Future").x;
if (_local3 < _global.M.returnBounds().left) {
_local4 = false;
} else if ((_local3 > _global.M.returnBounds().right) && (hSpeed > 0)) {
_local4 = false;
}
if (playerNum == 2) {
if ((_local3 < _global.M.returnCenterPoint().x) && (hSpeed < 0)) {
_local4 = false;
}
} else if ((_local3 > _global.M.returnCenterPoint().x) && (hSpeed > 0)) {
_local4 = false;
}
if ((!hObstaclesCheck(_local3)) || (!_local4)) {
hSpeed = 0;
} else {
move();
}
}
function MoveRight() {
if (hSpeed < maxSpeedH) {
if (hSpeed < 0) {
hSpeed = hSpeed / stopFactorH;
}
hSpeed = hSpeed + accelH;
}
if (Math.abs(vSpeed) != 0) {
var _local6 = Math.sqrt((vSpeed * vSpeed) + (hSpeed * hSpeed));
var _local5 = (maxSpeedH + maxSpeedV) / 4;
if (_local6 > _local5) {
if (Math.abs(hSpeed) > _local5) {
hSpeed = _local5;
}
}
}
var _local4 = true;
var _local3 = getFootsPosition("Future").x;
if (_local3 > _global.M.returnBounds().right) {
_local4 = false;
} else if ((_local3 < _global.M.returnBounds().left) && (hSpeed < 0)) {
_local4 = false;
}
if (playerNum == 1) {
if ((_local3 > _global.M.returnCenterPoint().x) && (hSpeed > 0)) {
_local4 = false;
}
} else if ((_local3 < _global.M.returnCenterPoint().x) && (hSpeed < 0)) {
_local4 = false;
}
if ((!hObstaclesCheck(_local3)) || (!_local4)) {
hSpeed = 0;
} else {
move();
}
}
function hObstaclesCheck(l_anticipatedX) {
var _local5 = _global.M.isClearPathPlayer(l_anticipatedX, getFootsPosition("Future").y, avatar, this).pathClear;
if (!_local5) {
var _local3 = _global.M.isClearPathPlayer(getFootsPosition("Current").x, getFootsPosition("Current").y, null, null);
var _local6 = _local3.pathClear;
if (_local6) {
hStuckHistory--;
if (hStuckHistory < 0) {
hStuckHistory = 0;
}
} else {
hStuckHistory++;
if (hStuckHistory > 3) {
var _local4 = _local3.mc.getBounds(_global.SCENE);
var _local8 = (_local4.xMin + _local4.xMax) / 2;
var _local7 = my_mc._x - _local8;
if (_local7 < 0) {
if (playerNum == 1) {
if ((my_mc._x - 3) > _global.M.returnBounds().left) {
my_mc._x = my_mc._x - 3;
}
}
} else if ((my_mc._x + 3) > _global.M.returnBounds().right) {
my_mc._x = my_mc._x + 3;
}
}
}
}
return(_local5);
}
function MoveUp() {
if (Math.abs(vSpeed) < maxSpeedV) {
vSpeed = vSpeed - accelV;
} else if (vSpeed > 0) {
vSpeed = vSpeed / stopFactorV;
}
if (Math.abs(hSpeed) != 0) {
var _local6 = Math.sqrt((vSpeed * vSpeed) + (hSpeed * hSpeed));
var _local5 = (maxSpeedH + maxSpeedV) / 4;
if (_local6 > _local5) {
if (Math.abs(vSpeed) > _local5) {
vSpeed = -_local5;
}
}
}
var _local4 = true;
var _local3 = getFootsPosition("Future").y;
if (_local3 < _global.M.returnBounds().top) {
_local4 = false;
} else if (_local3 > _global.M.returnBounds().bottom) {
_local4 = false;
}
if ((!vObstaclesCheck(_local3)) || (!_local4)) {
vSpeed = 0;
} else {
move();
}
}
function MoveDown() {
if (vSpeed < maxSpeedV) {
if (vSpeed < 0) {
vSpeed = vSpeed / stopFactorV;
}
vSpeed = vSpeed + accelV;
}
if (Math.abs(hSpeed) != 0) {
var _local6 = Math.sqrt((vSpeed * vSpeed) + (hSpeed * hSpeed));
var _local5 = (maxSpeedH + maxSpeedV) / 4;
if (_local6 > _local5) {
if (Math.abs(vSpeed) > _local5) {
vSpeed = _local5;
}
}
}
var _local4 = true;
var _local3 = getFootsPosition("Future").y;
if (_local3 > _global.M.returnBounds().bottom) {
_local4 = false;
} else if (_local3 < _global.M.returnBounds().top) {
_local4 = false;
}
if ((!vObstaclesCheck(_local3)) || (!_local4)) {
vSpeed = 0;
} else {
move();
}
}
function vObstaclesCheck(l_anticipatedY) {
var _local5 = _global.M.isClearPathPlayer(getFootsPosition("Future").x, l_anticipatedY, avatar, this).pathClear;
if (!_local5) {
var _local3 = _global.M.isClearPathPlayer(getFootsPosition("Current").x, getFootsPosition("Current").y, null, null);
var _local6 = _local3.pathClear;
if (_local6) {
vStuckHistory--;
if (vStuckHistory < 0) {
vStuckHistory = 0;
}
} else {
vStuckHistory++;
if (vStuckHistory > 3) {
var _local4 = _local3.mc.getBounds(_global.SCENE);
var _local7 = (_local4.yMin + _local4.yMax) / 2;
var _local8 = my_mc._y - _local7;
if (_local8 < 0) {
if ((my_mc._y - 3) > _global.M.returnBounds().top) {
my_mc._y = my_mc._y - 3;
}
} else if ((my_mc._y + 3) < _global.M.returnBounds().bottom) {
my_mc._y = my_mc._y + 3;
}
}
}
}
return(_local5);
}
function returnFootsBounds() {
var _local2 = my_mc.hit_mc.getBounds(scene_mc);
_local2.mcRef = my_mc.hit_mc;
return(_local2);
}
function getFootsPosition(l_context) {
var _local2 = my_mc.hit_mc.getBounds(scene_mc);
var _local5 = ((l_context == "Future") ? (vSpeed) : 0);
var _local6 = ((l_context == "Future") ? (hSpeed) : 0);
var _local4 = ((_local2.yMax + _local2.yMin) / 2) + _local5;
if (vSpeed > 0) {
_local4 = _local4 + (my_mc.hit_mc._height / 2);
} else {
_local4 = _local4 - (my_mc.hit_mc._height / 2);
}
var _local3 = ((_local2.xMax + _local2.xMin) / 2) + _local6;
if (hSpeed > 0) {
_local3 = _local3 + (my_mc.hit_mc._width / 2);
} else {
_local3 = _local3 - (my_mc.hit_mc._width / 2);
}
return({x:_local3, y:_local4});
}
function move() {
if ((!inHurt) && (!specialMoveNoWalk)) {
my_mc._x = my_mc._x + hSpeed;
my_mc._y = my_mc._y + vSpeed;
}
}
function updateDepth() {
my_mc.swapDepths((10 + playerNum) + ((Math.floor(my_mc._y) * 1000) + my_mc._x));
}
function energyLose(qty) {
energy = energy - qty;
}
function energyFill(qty) {
energy = energy + qty;
}
function sufferIce(x, y) {
inHurt = true;
inHurtCountDown = Configs[avatar + "_Time_Hurt"];
vSpeed = 0;
hSpeed = 0;
energy = energy - 20;
if (specialMove) {
upperPlayer.stopSpecialMove();
}
_global.S.PlayASound("Hurt_Ice", 40, 1);
changeXMoveState("xIdle");
changeYMoveState("yIdle");
LEGS_currentState = "Hurt";
inHurt = true;
inHurtCountDown = Configs[avatar + "_Time_Hurt_Ice"];
my_mc.gotoAndStop("HurtIce");
B_futureStateChange(Configs[avatar + "_Frames_Hurt_Ice"], "Idle");
}
function sufferBurn(x, y, magma) {
var _local9 = my_mc._x - x;
var _local8 = my_mc._y - y;
if (!magma) {
var _local7 = Math.atan2(_local8, _local9);
} else {
var _local7 = _global.M.angleToCenter() - 180;
}
changeXMoveState("xIdle");
changeYMoveState("yIdle");
LEGS_currentState = "Hurt";
if (!inHurt) {
if (!magma) {
var _local3 = Math.sin(_local7) * 15;
var _local5 = Math.cos(_local7) * 15;
if (Math.abs(_local3) < 5) {
if (_local3 < 0) {
_local3 = -5;
} else {
_local3 = 5;
}
}
if (Math.abs(_local5) < 5) {
if (_local5 < 0) {
_local5 = -5;
} else {
_local5 = 5;
}
}
} else {
if (playerNum == 1) {
var _local3 = -20;
} else {
var _local3 = 20;
}
var _local5 = 0;
}
var _local4 = false;
var _local6 = false;
if (_local3 > 0) {
if (playerNum == 1) {
if ((my_mc._x + _local3) < _global.M.returnCenterPoint().x) {
_local4 = true;
}
} else if ((my_mc._x + _local3) < _global.M.returnBounds().right) {
_local4 = true;
}
} else if (playerNum == 2) {
if ((my_mc._x + _local3) > _global.M.returnCenterPoint().x) {
_local4 = true;
}
} else if ((my_mc._x + _local3) > _global.M.returnBounds().left) {
_local4 = true;
}
if (_local5 > 0) {
if ((my_mc._y + _local5) < _global.M.returnBounds().bottom) {
_local6 = true;
}
} else if ((my_mc._y + _local5) > _global.M.returnBounds().top) {
_local6 = true;
}
if (_local4) {
my_mc._x = my_mc._x + _local3;
}
if (_local6) {
my_mc._y = my_mc._y + _local5;
}
inHurt = true;
inHurtCountDown = Configs[avatar + "_Time_Hurt"];
energy = energy - 20;
_global.S.PlayASound("Hurt", 100, 1);
}
vSpeed = 0;
hSpeed = 0;
if (specialMove) {
upperPlayer.stopSpecialMove();
}
my_mc.gotoAndStop("Hurt");
B_futureStateChange(Configs[avatar + "_Frames_Hurt"], "Idle");
}
function sufferHit(x, y) {
var _local9 = x - my_mc._x;
var _local8 = y - my_mc._y;
var _local7 = Math.atan2(_local8, _local9);
changeXMoveState("xIdle");
changeYMoveState("yIdle");
LEGS_currentState = "Hurt";
if (!inHurt) {
var _local3 = Math.sin(_local7) * 15;
var _local5 = Math.cos(_local7) * 15;
var _local4 = false;
var _local6 = false;
if (_local3 > 0) {
if (playerNum == 1) {
if ((my_mc._x + _local3) < _global.M.returnCenterPoint().x) {
_local4 = true;
}
} else if ((my_mc._x + _local3) < _global.M.returnBounds().right) {
_local4 = true;
}
} else if (playerNum == 2) {
if ((my_mc._x + _local3) > _global.M.returnCenterPoint().x) {
_local4 = true;
}
} else if ((my_mc._x + _local3) > _global.M.returnBounds().left) {
_local4 = true;
}
if (_local5 > 0) {
if ((my_mc._y + _local5) < _global.M.returnBounds().bottom) {
_local6 = true;
}
} else if ((my_mc._y + _local5) > _global.M.returnBounds().top) {
_local6 = true;
}
if (_local4) {
my_mc._x = my_mc._x + _local3;
}
if (_local6) {
my_mc._y = my_mc._y + _local5;
}
energy = energy - 15;
_global.S.PlayASound("Hurt", 100, 1);
}
inHurt = true;
inHurtCountDown = Configs[avatar + "_Time_Hurt"];
vSpeed = 0;
hSpeed = 0;
if (specialMove) {
upperPlayer.stopSpecialMove();
}
my_mc.gotoAndStop("Hurt");
B_futureStateChange(Configs[avatar + "_Frames_Hurt"], "Idle");
}
function quickSandsQuit() {
my_mc.qs_mc._visible = false;
maxSpeedH = SPEED_MAX_H;
maxSpeedV = SPEED_MAX_V;
}
function quickSandsEnter(speed) {
my_mc.qs_mc._visible = true;
maxSpeedH = speed;
maxSpeedV = speed;
}
function returnPlayerAvatar() {
return(avatar);
}
function returnPlayerNum() {
return(playerNum);
}
function fieldWind(angle) {
var _local9 = 1.5;
var _local8 = Math.cos(mathLib.deg2rad(angle)) * _local9;
var _local7 = Math.sin(mathLib.deg2rad(angle)) * _local9;
var _local3 = true;
var _local4 = my_mc._x + _local8;
if (_local4 < _global.M.returnBounds().left) {
_local3 = false;
my_mc._x = _global.M.returnBounds().left;
} else if (_local4 > _global.M.returnBounds().right) {
_local3 = false;
my_mc._x = _global.M.returnBounds().right;
}
if (playerNum == 2) {
if (_local4 < _global.M.returnCenterPoint().x) {
_local3 = false;
my_mc._x = _global.M.returnCenterPoint().x;
}
} else if (_local4 > _global.M.returnCenterPoint().x) {
_local3 = false;
my_mc._x = _global.M.returnCenterPoint().x;
}
if (hObstaclesCheck(_local4) && (_local3)) {
my_mc._x = my_mc._x + _local8;
}
var _local5 = true;
var _local6 = my_mc._y + _local7;
if (_local6 < _global.M.returnBounds().top) {
_local5 = false;
my_mc._y = _global.M.returnBounds().top + 1;
} else if (_local6 > _global.M.returnBounds().bottom) {
_local5 = false;
my_mc._y = _global.M.returnBounds().bottom - 1;
}
if (hObstaclesCheck(_local6) && (_local5)) {
my_mc._y = my_mc._y + _local7;
}
}
function waveHit() {
waveHitCountDown = 15;
}
function deleteAll() {
enterFrame.removeListener(this);
my_mc.swapDepths(1);
my_mc.removeMovieClip();
scene_mc = null;
upperPlayer.UP_deleteAll();
controlInterface.CI_deleteAll();
upperPlayer = null;
delete upperPlayer;
controlInterface = null;
delete controlInterface;
_global["P" + playerNum] = null;
delete _global["P" + playerNum];
}
static var SPEED_MAX_H = 4;
static var SPEED_ACCEL_H = 0.5;
static var SPEED_ACCEL_H_ICE = 0.1;
static var SPEED_DECEL_H = 2;
static var SPEED_DECEL_H_ICE = 1.05;
static var STOP_FACTOR_H = 2;
static var STOP_FACTOR_H_ICE = 1.1;
static var STOP_FACTOR_HIT_H = 4;
static var SPEED_MAX_V = 4;
static var SPEED_ACCEL_V = 0.5;
static var SPEED_ACCEL_V_ICE = 0.1;
static var SPEED_DECEL_V = 2;
static var SPEED_DECEL_V_ICE = 1.05;
static var STOP_FACTOR_V = 2;
static var STOP_FACTOR_V_ICE = 1.1;
static var STOP_FACTOR_HIT_V = 4;
static var REFLECT_ANGLE = 2;
static var REFLECT_RANDOMNESS = 3;
static var HIT_PLAYER_RANDOMNESS = 50;
var hSpeed = 0;
var hStuckHistory = 0;
var vSpeed = 0;
var vStuckHistory = 0;
var UB_stateChangeCountdown = -1;
var B_stateChangeCountdown = -1;
var inHurt = false;
}
Symbol 1277 MovieClip [__Packages.Configs] Frame 0
class Configs
{
function Configs () {
}
static var PTS_MOMO = 2500;
static var PTS_BONUS_GOOD = 250;
static var PTS_BONUS_BAD = -100;
static var PTS_SCORES_GOAL = 500;
static var PTS_BE_SCORED = -500;
static var PTS_TIME_START = 10000;
static var Fire_Frames_Shield = 21;
static var Fire_Frame_Shield_Open = 6;
static var Fire_Frames_Shield_Bounce = 9;
static var Fire_Frames_Attack = 38;
static var Fire_Frames_Defense = 23;
static var Fire_Frames_Hurt_Fire = 0;
static var Fire_Time_Hurt_Fire = 0;
static var Fire_Frames_Hurt_Ice = 66;
static var Fire_Time_Hurt_Ice = 66;
static var Fire_Frames_Hurt = 24;
static var Fire_Time_Hurt = 24;
static var Fire_Frames_Service = 33;
static var Fire_Time_Service = 18;
static var Fire_Idle_Time_Service = 35;
static var Air_Frames_Shield = 18;
static var Air_Frame_Shield_Open = 6;
static var Air_Frames_Shield_Bounce = 9;
static var Air_Frames_Attack = 20;
static var Air_Frames_Defense = 49;
static var Air_Frames_Hurt_Fire = 24;
static var Air_Time_Hurt_Fire = 24;
static var Air_Frames_Hurt_Ice = 66;
static var Air_Time_Hurt_Ice = 66;
static var Air_Frames_Hurt = 24;
static var Air_Time_Hurt = 24;
static var Air_Frames_Service = 33;
static var Air_Time_Service = 18;
static var Air_Idle_Time_Service = 35;
static var Water_Frames_Shield = 23;
static var Water_Frame_Shield_Open = 5;
static var Water_Frames_Shield_Bounce = 9;
static var Water_Frames_Attack = 49;
static var Water_Frames_Defense = 45;
static var Water_Frames_Hurt_Fire = 24;
static var Water_Time_Hurt_Fire = 23;
static var Water_Frames_Hurt_Ice = 0;
static var Water_Time_Hurt_Ice = 0;
static var Water_Frames_Hurt = 24;
static var Water_Time_Hurt = 24;
static var Water_Frames_Service = 33;
static var Water_Time_Service = 18;
static var Water_Idle_Time_Service = 35;
static var Earth_Frames_Shield = 23;
static var Earth_Frame_Shield_Open = 6;
static var Earth_Frames_Shield_Bounce = 9;
static var Earth_Frames_Attack = 49;
static var Earth_Frames_Defense = 45;
static var Earth_Frames_Hurt_Fire = 24;
static var Earth_Time_Hurt_Fire = 24;
static var Earth_Frames_Hurt_Ice = 66;
static var Earth_Time_Hurt_Ice = 66;
static var Earth_Frames_Hurt = 24;
static var Earth_Time_Hurt = 24;
static var Earth_Frames_Service = 33;
static var Earth_Time_Service = 18;
static var Earth_Idle_Time_Service = 35;
}
Symbol 1278 MovieClip [__Packages.FirePlayer] Frame 0
class FirePlayer extends Player
{
var my_mc, scene_mc, playerNum, setUpPosition, fireWall, fireArcWaitTime, privateEFListener, energy, possesesBall, inServiceMotion, inHurt, doVisualAttack, doVisualDefense;
function FirePlayer (scene_mc, playerNum, controlInterface) {
super(scene_mc, playerNum, "Fire", this, controlInterface);
my_mc = this.scene_mc.attachMovie("Player_Fire", "player" + this.playerNum, 10 + this.playerNum);
setUpPosition();
fireWall = null;
fireArcWaitTime = -1;
privateEFListener = new Object();
privateEFListener.owner = this;
privateEFListener.onEnterFrame = function () {
this.owner.privateEF();
};
enterFrame.addListener(privateEFListener);
}
function privateEF() {
if (fireWall != null) {
energy = energy - FIRE_WALL_ENERGY_RATE;
if (energy < FIRE_WALL_ENERGY_RATE) {
releaseOffense();
}
}
fireArcWaitTime--;
energy = energy + ENERGY_REFILL_RATE;
if (energy > 100) {
energy = 100;
}
if (energy < 0) {
energy = 0;
}
ScoreAndHud.setPlayerEnergy(playerNum, energy);
}
function pressOffense() {
if ((((!possesesBall) && (!inServiceMotion)) && (!inHurt)) && (_global.BallLaunched)) {
if ((fireWall == null) && (energy > FIRE_WALL_ENERGY_ONESHOT)) {
doVisualAttack();
var _local3 = scene_mc.attachMovie("Attack_Fire", "fireWall_mc", scene_mc.getNextHighestDepth());
_local3._x = _global.M.returnCenterPoint().x;
_local3._y = _global.M.returnCenterPoint().y;
energy = energy - FIRE_WALL_ENERGY_ONESHOT;
fireWall = new FireWall(_local3, playerNum, scene_mc);
}
}
}
function pressDefense() {
if ((((!possesesBall) && (!inServiceMotion)) && (!inHurt)) && (_global.BallLaunched)) {
if ((fireArcWaitTime <= 0) && (energy >= FIRE_ARC_ENERGY)) {
doVisualDefense();
castArc();
energy = energy - FIRE_ARC_ENERGY;
fireArcWaitTime = FIRE_ARC_WAIT_TIME;
}
}
}
function releaseOffense() {
if (fireWall != null) {
fireWall.stopConsume();
fireWall = null;
}
}
function releaseDefense() {
}
function castArc() {
fireArcNum++;
var _local3 = scene_mc.attachMovie("Defense_Fire", ("fireArc" + fireArcNum) + "_mc", scene_mc.getNextHighestDepth());
_local3._visible = false;
var _local6 = Math.abs(my_mc._x - _global.B.returnCoord().x);
var _local5;
if (_local6 < FIRE_ARC_MAX_HORZ_DIST) {
_local5 = _local6 - BALL_DIST_TO_TAKE;
} else {
_local5 = FIRE_ARC_MAX_HORZ_DIST;
}
if (playerNum == 1) {
var _local4 = my_mc._x + _local5;
if (_local4 > _global.M.returnCenterPoint().x) {
_local4 = _global.M.returnCenterPoint().x;
}
if (_local4 < my_mc._x) {
_local4 = my_mc._x;
}
_local3._xscale = -100;
} else {
var _local4 = my_mc._x - _local5;
if (_local4 < _global.M.returnCenterPoint().x) {
_local4 = _global.M.returnCenterPoint().x;
}
if (_local4 > my_mc._x) {
_local4 = my_mc._x;
}
}
_local3._x = _local4;
_local3._y = _global.B.returnCoord().y;
new FireArc(_local3, playerNum);
}
function UP_deleteAll() {
enterFrame.removeListener(privateEFListener);
fireWall = null;
privateEFListener = null;
}
static var ENERGY_REFILL_RATE = 0.1;
static var FIRE_ARC_ENERGY = 20;
static var FIRE_ARC_MAX_HORZ_DIST = 100;
static var FIRE_ARC_WAIT_TIME = 50;
static var BALL_DIST_TO_TAKE = 15;
static var FIRE_WALL_ENERGY_ONESHOT = 20;
static var FIRE_WALL_ENERGY_RATE = 0.4;
var fireArcNum = 0;
}
Symbol 1279 MovieClip [__Packages.StageObject] Frame 0
class StageObject
{
var upperRef, my_mc, hit_mc;
function StageObject (my_mc, hit_mc, upperRef) {
this.upperRef = upperRef;
this.my_mc = my_mc;
this.hit_mc = hit_mc;
this.my_mc._visible = true;
_global.M.addStageElement(this);
}
function updateDepth(l_optModif) {
if (l_optModif != undefined) {
var _local2 = l_optModif;
} else {
var _local2 = 0;
}
var _local3 = (13 + ((Math.floor(my_mc._y) * 1000) + my_mc._x)) + _local2;
my_mc.swapDepths(_local3);
}
function removeFromStage() {
_global.M.removeStageElement(this);
}
function returnCoord() {
var _local2 = new Object();
_local2.x = my_mc._x;
_local2.y = my_mc._y;
return(_local2);
}
function isTimeToProbeBlock() {
return(true);
}
function isTimeToProbeAffect() {
probeTimerAffect++;
if (probeTimerAffect >= probeIntervalAffect) {
probeTimerAffect = 0;
return(true);
}
return(false);
}
function returnFieldSide() {
var _local4;
var _local3 = my_mc.getBounds(_global.SCENE);
if (_local3.xMin <= _global.M.returnCenterPoint().x) {
_local4 = 1;
if (_local3.xMax >= _global.M.returnCenterPoint().x) {
_local4 = 0;
}
} else if (_local3.xMax >= _global.M.returnCenterPoint().x) {
_local4 = 2;
if (_local3.xMin <= _global.M.returnCenterPoint().x) {
_local4 = 0;
}
}
return(_local4);
}
var probeIntervalBlock = 0;
var probeIntervalAffect = 0;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
}
Symbol 1280 MovieClip [__Packages.FireWall] Frame 0
class FireWall extends StageObject
{
var affectPlayer, affectBall, blockPlayer, blockBall, scene_mc, playerNum, flames, updateDepth, my_mc, removeFromStage;
function FireWall (my_mc, playerNum, scene_mc) {
super(my_mc, my_mc.hit_mc, this);
affectPlayer = false;
affectBall = false;
blockPlayer = false;
blockBall = false;
this.scene_mc = scene_mc;
this.playerNum = playerNum;
flames = new Array();
_global.S.PlayASound("Field_Fire", 100, 1);
doStage1();
updateDepth();
enterFrame.addListener(this);
}
function onEnterFrame() {
timeElapsed++;
if (timeElapsed == STAGE_2) {
doStage2();
} else if (timeElapsed == STAGE_3) {
doStage3();
} else if (timeElapsed == STAGE_4) {
doStage4();
}
}
function stopConsume() {
for (var _local2 in flames) {
flames[_local2].setFallTime(mathLib.randomRange(FLAME_FALL_MIN, FLAME_FALL_MAX));
delete flames[_local2];
}
flames = new Array();
die();
}
function doStage1() {
createFlame(_global.M.returnCenterPoint().x, _global.M.returnCenterPoint().y);
}
function doStage2() {
createFlame(_global.M.returnCenterPoint().x + mathLib.randomRange(-FLAME_HORZ_RANDOM, FLAME_HORZ_RANDOM), _global.M.returnCenterPoint().y - FLAME_VERT_SEPARATION);
createFlame(_global.M.returnCenterPoint().x + mathLib.randomRange(-FLAME_HORZ_RANDOM, FLAME_HORZ_RANDOM), _global.M.returnCenterPoint().y + FLAME_VERT_SEPARATION);
}
function doStage3() {
_global.P2.COMP_fireWallStage3();
createFlame(_global.M.returnCenterPoint().x + (mathLib.randomRange(-FLAME_HORZ_RANDOM, FLAME_HORZ_RANDOM) * 2), _global.M.returnCenterPoint().y - (FLAME_VERT_SEPARATION * 2));
createFlame(_global.M.returnCenterPoint().x + (mathLib.randomRange(-FLAME_HORZ_RANDOM, FLAME_HORZ_RANDOM) * 2), _global.M.returnCenterPoint().y + (FLAME_VERT_SEPARATION * 2));
}
function doStage4() {
createFlame(_global.M.returnCenterPoint().x + (mathLib.randomRange(-FLAME_HORZ_RANDOM, FLAME_HORZ_RANDOM) * 2), _global.M.returnCenterPoint().y - (FLAME_VERT_SEPARATION * 3));
createFlame(_global.M.returnCenterPoint().x + (mathLib.randomRange(-FLAME_HORZ_RANDOM, FLAME_HORZ_RANDOM) * 2), _global.M.returnCenterPoint().y + (FLAME_VERT_SEPARATION * 3));
}
function createFlame(x, y) {
flameNum++;
var _local2 = scene_mc.attachMovie("Flame", ("flame_FW_" + flameNum) + "_mc", scene_mc.getNextHighestDepth());
_local2._visible = false;
_local2._x = x;
_local2._y = y;
_local2 = new Flame(_local2, -1, false, true);
flames.push(_local2);
}
function ballReflectAngle(x, y, hitAngle) {
_global.B.setInFire();
var _local3 = hitAngle - 180;
var _local5 = _local3;
var _local4 = my_mc._y - y;
_local4 = _local4 * -1;
if (((_local4 < (my_mc.hit_mc._height * 0.3)) && (Math.abs(hitAngle - 180) > 10)) && (Math.abs(hitAngle) > 10)) {
_local5 = mathLib.angleClean(mathLib.angleReflectVertical(hitAngle)) + (_local4 / REFLECT_ANGLE);
} else {
_local3 = mathLib.angleClean(_local3);
if ((_local3 > 0) && (_local3 < 90)) {
_local3 = 45;
} else if ((_local3 > 90) && (_local3 < 180)) {
_local3 = 135;
} else if ((_local3 > 180) && (_local3 < 270)) {
_local3 = 225;
} else if ((_local3 > 270) && (_local3 < 360)) {
_local3 = 315;
} else if (playerNum == 1) {
_local3 = 90;
} else {
_local3 = 270;
}
_local5 = _local3;
}
return(_local5);
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
static var REFLECT_ANGLE = 15;
static var STAGE_2 = 21;
static var STAGE_3 = 35;
static var STAGE_4 = 60;
static var FLAME_VERT_SEPARATION = 36;
static var FLAME_HORZ_RANDOM = 5;
static var FLAME_FALL_MIN = 15;
static var FLAME_FALL_MAX = 70;
var elementType = "FireWall";
var probeIntervalBlock = -1;
var probeIntervalAffect = -1;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var timeElapsed = 0;
var flameNum = 0;
}
Symbol 1281 MovieClip [__Packages.Flame] Frame 0
class Flame extends StageObject
{
var my_mc, rechargeHealth, affectPlayer, affectBall, blockPlayer, blockBall, updateDepth, futureState, removeFromStage;
function Flame (my_mc, fallTime, rechargeHealth, blockBall) {
super(my_mc, my_mc.hit_mc);
this.fallTime = fallTime;
this.my_mc.gotoAndStop("Rise");
futureStateChange(RAISE_FRAMES, "Idle");
this.rechargeHealth = rechargeHealth;
affectPlayer = true;
affectBall = true;
blockPlayer = false;
if (blockBall) {
this.blockBall = true;
} else {
this.blockBall = false;
}
updateDepth();
enterFrame.addListener(this);
}
function setFallTime(fTime) {
fallTime = fTime;
}
function onEnterFrame() {
checkForStateChange();
if (fallTime != -1) {
fallTime--;
if (fallTime <= 0) {
fall();
fallTime = -1;
}
}
if (backSmallTime != -1) {
backSmallTime--;
if (backSmallTime <= 0) {
backSmall();
backSmallTime = -1;
}
}
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
updateDepth();
}
function doBlockPlayer(l_playerType) {
if (l_playerType == "Fire") {
return(false);
}
return(true);
}
function ballReflectAngle(x, y, hitAngle) {
_global.B.setInFire();
return(mathLib.angleReflectVertical(hitAngle));
}
function doAffectBall(l_oBall) {
l_oBall.setInFire();
}
function doAffectPlayer(l_playerType, l_oPlayer) {
if (l_playerType == "Fire") {
if (rechargeHealth) {
l_oPlayer.energyFill(REFILL_RATE);
}
} else {
hurtTimes++;
l_oPlayer.sufferBurn(my_mc._x, my_mc._y);
fall();
}
}
function futureStateChange(frames, state) {
stateChangeCountdown = frames - 1;
futureState = state;
}
function checkForStateChange() {
if (stateChangeCountdown != -1) {
if (stateChangeCountdown <= 0) {
my_mc.gotoAndStop(futureState);
stateChangeCountdown = -1;
} else {
stateChangeCountdown--;
}
}
}
function fall() {
my_mc.gotoAndStop("Fall");
dieTime = FALL_FRAMES;
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
function backSmall() {
my_mc.gotoAndStop("BackToIdle");
futureStateChange(7, "Idle");
}
function airGrow() {
if (backSmallTime == -1) {
_global.S.PlayASound("Flame_Expansion", 100, 1);
fallTime = fallTime + 200;
backSmallTime = 176;
my_mc.gotoAndStop("GrowByAir");
futureStateChange(26, "BigIdle");
}
}
function waterFall() {
if (dieTime == -1) {
_global.S.PlayASound("Flame_Watered", 100, 1);
my_mc.gotoAndStop("ExtinctByWater");
dieTime = FALL_WATER_FRAMES;
}
}
static var RAISE_FRAMES = 7;
static var FALL_FRAMES = 7;
static var FALL_WATER_FRAMES = 27;
static var REFILL_RATE = 1;
var elementType = "Flame";
var probeIntervalBlock = 3;
var probeIntervalAffect = 5;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var backSmallTime = -1;
var fallTime = -1;
var dieTime = -1;
var hurtTimes = 0;
var stateChangeCountdown = -1;
}
Symbol 1282 MovieClip [__Packages.FireArc] Frame 0
class FireArc extends StageObject
{
var playerNum, dieTime, affectPlayer, affectBall, blockPlayer, blockBall, updateDepth, my_mc, removeFromStage;
function FireArc (my_mc, playerNum) {
super(my_mc, my_mc.hit_mc, this);
_global.S.PlayASound("FireArcSnd", 100, 1);
this.playerNum = playerNum;
dieTime = LIFE_FRAMES;
affectPlayer = false;
affectBall = true;
blockPlayer = false;
blockBall = true;
updateDepth();
enterFrame.addListener(this);
}
function onEnterFrame() {
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
}
function doAffectBall(l_oBall) {
l_oBall.setInFire();
}
function ballReflectAngle(x, y, hitAngle) {
_global.B.setInFire();
blockBall = false;
var _local3 = hitAngle - 180;
var _local5 = _local3;
var _local4 = my_mc._y - y;
_local4 = _local4 * -1;
if (((_local4 < (my_mc.hit_mc._height * 0.3)) && (Math.abs(hitAngle - 180) > 10)) && (Math.abs(hitAngle) > 10)) {
_local5 = mathLib.angleClean(mathLib.angleReflectVertical(hitAngle)) + (_local4 / REFLECT_ANGLE);
} else {
_local3 = mathLib.angleClean(_local3);
if ((_local3 > 0) && (_local3 < 90)) {
_local3 = 45;
} else if ((_local3 > 90) && (_local3 < 180)) {
_local3 = 135;
} else if ((_local3 > 180) && (_local3 < 270)) {
_local3 = 225;
} else if ((_local3 > 270) && (_local3 < 360)) {
_local3 = 315;
} else if (playerNum == 1) {
_local3 = 90;
} else {
_local3 = 270;
}
_local5 = _local3;
}
return(_local5);
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
static var LIFE_FRAMES = 21;
var elementType = "FireArc";
var probeIntervalBlock = 2;
var probeIntervalAffectAffect = 2;
var probeTimerBlock = 0;
var probeTimerAffectAffect = 0;
static var REFLECT_ANGLE = 2;
}
Symbol 1283 MovieClip [__Packages.WaterPlayer] Frame 0
class WaterPlayer extends Player
{
var my_mc, scene_mc, playerNum, setUpPosition, fouet, iceProtection, privateEFListener, energy, possesesBall, inServiceMotion, inHurt, doVisualAttack, specialMove, doVisualDefense;
function WaterPlayer (scene_mc, playerNum, controlInterface) {
super(scene_mc, playerNum, "Water", this, controlInterface);
my_mc = this.scene_mc.attachMovie("Player_Water", "player" + this.playerNum, 10 + this.playerNum);
setUpPosition();
fouet = null;
iceProtection = null;
privateEFListener = new Object();
privateEFListener.owner = this;
privateEFListener.onEnterFrame = function () {
this.owner.privateEF();
};
enterFrame.addListener(privateEFListener);
}
function stopSpecialMove() {
releaseOffense(false);
}
function privateEF() {
if (iceProtection != null) {
energy = energy - ICE_PROTECTION_ENERGY_RATE;
if (energy < ICE_PROTECTION_ENERGY_RATE) {
releaseDefense();
}
}
energy = energy + ENERGY_REFILL_RATE;
if (energy > 100) {
energy = 100;
}
if (energy < 0) {
energy = 0;
}
ScoreAndHud.setPlayerEnergy(playerNum, energy);
}
function pressOffense() {
if ((((((fouet == null) && (!possesesBall)) && (!inServiceMotion)) && (!inHurt)) && (energy > FOUET_ENERGY_ONESHOT)) && (_global.BallLaunched)) {
doVisualAttack();
specialMove = true;
energy = energy - FOUET_ENERGY_ONESHOT;
fouet = new Fouet(my_mc.player_mc.upperBody_mc.attack_mc.fouet_mc, playerNum, this);
}
}
function pressDefense() {
if (((((!possesesBall) && (!inServiceMotion)) && (!inHurt)) && (!specialMove)) && (_global.BallLaunched)) {
if ((iceProtection == null) && (energy > ICE_PROTECTION_ENERGY_ONESHOT)) {
doVisualDefense();
var _local3 = scene_mc.attachMovie("Defense_Water", "iceWall_mc", scene_mc.getNextHighestDepth());
if (playerNum == 1) {
_local3._x = _global.M.returnBounds().left - 85;
} else {
_local3._x = _global.M.returnBounds().right + 85;
_local3._xscale = -100;
}
_local3._y = _global.M.returnCenterPoint().y;
energy = energy - ICE_PROTECTION_ENERGY_ONESHOT;
iceProtection = new IceProtection(_local3, playerNum, scene_mc);
}
}
}
function releaseOffense(l_changeVisual) {
}
function fouetEnd() {
fouet = null;
specialMove = false;
}
function releaseDefense() {
if (iceProtection != null) {
iceProtection.stopGrow();
iceProtection = null;
}
}
function UP_deleteAll() {
enterFrame.removeListener(privateEFListener);
fouet = null;
iceProtection = null;
privateEFListener = null;
}
static var ENERGY_REFILL_RATE = 0.1;
static var FOUET_ENERGY_ONESHOT = 20;
static var ICE_PROTECTION_ENERGY_ONESHOT = 25;
static var ICE_PROTECTION_ENERGY_RATE = 0.5;
}
Symbol 1284 MovieClip [__Packages.IceProtection] Frame 0
class IceProtection extends StageObject
{
var affectPlayer, affectBall, blockPlayer, blockBall, scene_mc, playerNum, my_mc, xRefPos, spikes, updateDepth, removeFromStage;
function IceProtection (my_mc, playerNum, scene_mc) {
super(my_mc, my_mc, this);
affectPlayer = false;
affectBall = false;
blockPlayer = false;
blockBall = true;
this.scene_mc = scene_mc;
this.playerNum = playerNum;
if (this.playerNum == 1) {
this.my_mc._x = this.my_mc._x + 20;
} else {
this.my_mc._x = this.my_mc._x - 20;
}
xRefPos = this.my_mc._x;
spikes = new Array();
doStage1();
updateDepth();
enterFrame.addListener(this);
}
function onEnterFrame() {
timeElapsed++;
if (timeElapsed == STAGE_2) {
doStage2();
} else if (timeElapsed == STAGE_3) {
doStage3();
}
}
function stopGrow() {
for (var _local2 in spikes) {
spikes[_local2].setFallTime(mathLib.randomRange(SPIKE_FALL_MIN, SPIKE_FALL_MAX));
delete spikes[_local2];
}
spikes = new Array();
die();
}
function doStage1() {
my_mc.gotoAndStop("FirstStage");
if (playerNum == 1) {
var _local3 = xRefPos + SPIKE_HORZ_SEPARATION;
} else {
var _local3 = xRefPos - SPIKE_HORZ_SEPARATION;
}
createSpike(_local3, _global.M.returnCenterPoint().y);
}
function doStage2() {
my_mc.gotoAndStop("SecondStage");
var _local3 = xRefPos;
createSpike(_local3 + mathLib.randomRange(-SPIKE_HORZ_RANDOM, SPIKE_HORZ_RANDOM), _global.M.returnCenterPoint().y - SPIKE_VERT_SEPARATION);
createSpike(_local3 + mathLib.randomRange(-SPIKE_HORZ_RANDOM, SPIKE_HORZ_RANDOM), _global.M.returnCenterPoint().y + SPIKE_VERT_SEPARATION);
}
function doStage3() {
my_mc.gotoAndStop("ThirdStage");
if (playerNum == 1) {
var _local3 = xRefPos - SPIKE_HORZ_SEPARATION;
} else {
var _local3 = xRefPos + SPIKE_HORZ_SEPARATION;
}
createSpike(_local3 + (mathLib.randomRange(-SPIKE_HORZ_RANDOM, SPIKE_HORZ_RANDOM) * 2), _global.M.returnCenterPoint().y - (SPIKE_VERT_SEPARATION * 2));
createSpike(_local3 + (mathLib.randomRange(-SPIKE_HORZ_RANDOM, SPIKE_HORZ_RANDOM) * 2), _global.M.returnCenterPoint().y + (SPIKE_VERT_SEPARATION * 2));
}
function createSpike(x, y) {
spikeNum++;
var _local2 = scene_mc.attachMovie("Spike", ("spike_IP_" + spikeNum) + "_mc", scene_mc.getNextHighestDepth());
_local2._visible = false;
_local2._x = x;
if (playerNum == 1) {
_local2._x = _local2._x + SPIKE_HORZ_START;
} else {
_local2._x = _local2._x - SPIKE_HORZ_START;
}
_local2._xscale = 50;
_local2._yscale = 50;
_local2._y = y;
var _local3 = new Spike(_local2, -1, false);
spikes.push(_local3);
}
function ballReflectAngle(x, y, hitAngle) {
var _local2 = hitAngle - 180;
var _local4 = _local2;
var _local3 = my_mc._y - y;
_local3 = _local3 * -1;
if (((_local3 < (my_mc.hit_mc._height * 0.3)) && (Math.abs(hitAngle - 180) > 10)) && (Math.abs(hitAngle) > 10)) {
_local4 = mathLib.angleClean(mathLib.angleReflectVertical(hitAngle)) + (_local3 / REFLECT_ANGLE);
} else {
_local2 = mathLib.angleClean(_local2);
if ((_local2 > 0) && (_local2 < 90)) {
_local2 = 45;
} else if ((_local2 > 90) && (_local2 < 180)) {
_local2 = 135;
} else if ((_local2 > 180) && (_local2 < 270)) {
_local2 = 225;
} else if ((_local2 > 270) && (_local2 < 360)) {
_local2 = 315;
} else if (playerNum == 1) {
_local2 = 90;
} else {
_local2 = 270;
}
_local4 = _local2;
}
return(_local4);
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
static var REFLECT_ANGLE = 2;
static var STAGE_2 = 10;
static var STAGE_3 = 20;
static var SPIKE_VERT_SEPARATION = 22;
static var SPIKE_HORZ_SEPARATION = 15;
static var SPIKE_HORZ_START = 85;
static var SPIKE_HORZ_RANDOM = 0;
static var SPIKE_FALL_MIN = 15;
static var SPIKE_FALL_MAX = 70;
var elementType = "IceProtection";
var probeIntervalBlock = 0;
var probeIntervalAffect = -1;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var timeElapsed = 0;
var spikeNum = 0;
}
Symbol 1285 MovieClip [__Packages.Spike] Frame 0
class Spike extends StageObject
{
var my_mc, inShape, affectPlayer, affectBall, blockPlayer, blockBall, updateDepth, futureState, removeFromStage;
function Spike (my_mc, fallTime, affectPlayer) {
super(my_mc, my_mc.hit_mc, this);
this.fallTime = fallTime;
_global.S.PlayASound("PikesSnd", 100, 1);
this.my_mc.gotoAndStop("Rise");
futureStateChange(RAISE_FRAMES, "Idle");
inShape = true;
this.affectPlayer = affectPlayer;
affectBall = false;
blockPlayer = true;
blockBall = true;
updateDepth();
enterFrame.addListener(this);
}
function setFallTime(fTime) {
fallTime = fTime;
}
function onEnterFrame() {
checkForStateChange();
if (fallTime != -1) {
fallTime--;
if (fallTime <= 0) {
fall();
fallTime = -1;
}
}
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
updateDepth();
}
function doBlockPlayer(l_playerType) {
return(true);
}
function doAffectPlayer(l_playerType, l_oPlayer) {
if (l_playerType == "Water") {
l_oPlayer.energyFill(REFILL_RATE);
} else {
l_oPlayer.sufferIce(my_mc._x, my_mc._y);
}
}
function futureStateChange(frames, state) {
stateChangeCountdown = frames - 1;
futureState = state;
}
function checkForStateChange() {
if (stateChangeCountdown != -1) {
if (stateChangeCountdown <= 0) {
my_mc.gotoAndStop(futureState);
stateChangeCountdown = -1;
} else {
stateChangeCountdown--;
}
}
}
function fall() {
if (dieTime == -1) {
my_mc.gotoAndStop("Fall");
dieTime = FALL_FRAMES;
}
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
function explode() {
if (inShape) {
_global.S.PlayASound("Hurt_Ice", 40, 1);
var _local3 = my_mc.attachMovie("SpikeBreak", "break_mc", my_mc.getNextHighestDepth());
inShape = false;
fall();
}
}
function ballReflectAngle(x, y, hitAngle) {
return((hitAngle - 180) + mathLib.randomRange(-HIT_RANDOMNESS, HIT_RANDOMNESS));
}
static var REFLECT_ANGLE = 2;
static var RAISE_FRAMES = 7;
static var FALL_FRAMES = 7;
static var REFILL_RATE = 1;
static var HIT_RANDOMNESS = 35;
var elementType = "Spike";
var probeIntervalBlock = 1;
var probeIntervalAffect = 0;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var fallTime = -1;
var dieTime = -1;
var stateChangeCountdown = -1;
}
Symbol 1286 MovieClip [__Packages.Fouet] Frame 0
class Fouet extends StageObject
{
var playerNum, controler, framesElapsed, moveState, dieTime, affectPlayer, affectBall, blockPlayer, blockBall, affectElements, updateDepth, my_mc, removeFromStage;
function Fouet (my_mc, playerNum, controler) {
super(my_mc, my_mc.hit_mc, this);
this.playerNum = playerNum;
this.controler = controler;
_global.S.PlayASound("CoupFouet", 100, 1);
framesElapsed = 0;
moveState = "Go";
dieTime = LIFE_FRAMES_FOUET;
affectPlayer = true;
affectBall = false;
blockPlayer = false;
blockBall = false;
affectElements = true;
updateDepth();
enterFrame.addListener(this);
}
function onEnterFrame() {
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
}
function doAffectPlayer(l_playerType, l_oPlayer) {
if (l_playerType != "Water") {
l_oPlayer.sufferIce(my_mc._x, my_mc._y);
die();
waterDrops();
}
}
function waterDrops() {
var _local2 = my_mc._parent.eclats_mc;
my_mc.stop();
my_mc._visible = false;
_local2.stop();
for (var _local3 in _local2) {
if (_local2[_local3]._parent == _local2) {
_local2[_local3].gotoAndPlay(mathLib.randomRange(2, 5));
}
}
}
function die() {
controler.fouetEnd();
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
function doAffectElement(l_element) {
if (l_element.elementType == "Rock") {
l_element.explode();
die();
waterDrops();
} else if (l_element.elementType == "Flame") {
l_element.waterFall();
die();
waterDrops();
}
}
static var LIFE_FRAMES_FOUET = 45;
var elementType = "Fouet";
var probeIntervalBlock = 0;
var probeIntervalAffect = 1;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
}
Symbol 1287 MovieClip [__Packages.AirPlayer] Frame 0
class AirPlayer extends Player
{
var my_mc, scene_mc, playerNum, setUpPosition, tornado, privateEFListener, energy, specialMove, windGustWaitTime, possesesBall, inServiceMotion, inHurt, doVisualAttack, controlInterface;
function AirPlayer (scene_mc, playerNum, controlInterface) {
super(scene_mc, playerNum, "Air", this, controlInterface);
my_mc = this.scene_mc.attachMovie("Player_Air", "player" + this.playerNum, 10 + this.playerNum);
setUpPosition();
tornado = null;
privateEFListener = new Object();
privateEFListener.owner = this;
privateEFListener.onEnterFrame = function () {
this.owner.privateEF();
};
enterFrame.addListener(privateEFListener);
}
function stopSpecialMove() {
releaseDefense(false);
}
function privateEF() {
energy = energy + ENERGY_REFILL_RATE;
if (energy > 100) {
energy = 100;
}
if (energy < 0) {
energy = 0;
}
if (tornado != null) {
energy = energy - TORNADO_ENERGY_RATE;
tornado.playerMoves(my_mc._x, my_mc._y);
if (energy < TORNADO_ENERGY_RATE) {
releaseDefense();
}
my_mc.gotoAndStop("IdleMove");
my_mc.player_mc.upperBody_mc.gotoAndStop("Defense");
}
if (tornadoFallTime != -1) {
tornadoFallTime--;
if (tornadoFallTime <= 0) {
my_mc.player_mc.upperBody_mc.gotoAndStop("Idle");
tornadoFallTime = -1;
specialMove = false;
}
}
windGustWaitTime--;
ScoreAndHud.setPlayerEnergy(playerNum, energy);
}
function pressOffense() {
if ((((!possesesBall) && (!inServiceMotion)) && (!inHurt)) && (_global.BallLaunched)) {
if ((windGustWaitTime <= 0) && (energy >= WIND_GUST_ENERGY)) {
doVisualAttack();
castGust();
energy = energy - WIND_GUST_ENERGY;
windGustWaitTime = WIND_GUST_WAIT_TIME;
}
}
}
function pressDefense() {
if ((((!possesesBall) && (!inServiceMotion)) && (!inHurt)) && (_global.BallLaunched)) {
if ((tornado == null) && (energy > TORNADO_ENERGY_ONESHOT)) {
specialMove = true;
my_mc.gotoAndStop("IdleMove");
my_mc.player_mc.upperBody_mc.gotoAndStop("Defense");
var _local3 = scene_mc.attachMovie("Defense_Air", "playerTornado_mc", scene_mc.getNextHighestDepth());
if (playerNum == 1) {
_local3._x = my_mc._x + 30;
} else {
_local3._x = my_mc._x - 30;
}
_local3._y = my_mc._y;
energy = energy - TORNADO_ENERGY_ONESHOT;
tornado = new PlayerTornado(_local3, playerNum, this);
}
}
}
function releaseOffense() {
}
function releaseDefense(l_changeVisual) {
if (tornado != null) {
tornadoFallTime = TORNADO_FALL_TIME;
if (l_changeVisual != false) {
my_mc.player_mc.upperBody_mc.UB_Tornado_mc.gotoAndPlay("End");
}
tornado.stopBlow();
tornado = null;
}
}
function doAirTornadoTrapBall() {
controlInterface.COMP_AirTornadoTrapBall();
my_mc.player_mc.upperBody_mc.UB_Tornado_mc.gotoAndPlay("LoopBall");
}
function castGust() {
var _local4 = false;
if (playerNum == 1) {
if (_global.B.returnCoord().x > (my_mc._x + 20)) {
_local4 = true;
}
} else if (_global.B.returnCoord().x < (my_mc._x - 20)) {
_local4 = true;
}
if (_local4) {
windGustNum++;
var _local3 = scene_mc.attachMovie("Attack_Air", ("windGust" + windGustNum) + "_mc", scene_mc.getNextHighestDepth());
_local3._visible = false;
var _local5 = ((playerNum == 1) ? -5 : 5);
_local3._x = _global.B.returnCoord().x - _local5;
_local3._y = my_mc._y;
if (playerNum == 1) {
_local3._xscale = -100;
}
new WindGust(_local3, playerNum);
}
}
function UP_deleteAll() {
enterFrame.removeListener(privateEFListener);
privateEFListener = null;
}
static var ENERGY_REFILL_RATE = 0.1;
static var TORNADO_ENERGY_ONESHOT = 15;
static var TORNADO_ENERGY_RATE = 0.3;
static var WIND_GUST_ENERGY = 10;
static var WIND_GUST_WAIT_TIME = 25;
static var TORNADO_FALL_TIME = 12;
var windGustNum = 0;
var tornadoFallTime = -1;
}
Symbol 1288 MovieClip [__Packages.PlayerTornado] Frame 0
class PlayerTornado extends StageObject
{
var affectPlayer, affectBall, blockPlayer, blockBall, affectElements, my_mc, playerNum, playerRef, trappedBall, rejectAngle, removeFromStage;
function PlayerTornado (my_mc, playerNum, playerRef) {
super(my_mc, my_mc.hit_mc, this);
affectPlayer = false;
affectBall = true;
blockPlayer = false;
blockBall = false;
affectElements = true;
this.my_mc.meter_mc._visible = false;
this.playerNum = playerNum;
this.playerRef = playerRef;
trappedBall = null;
}
function onEnterFrame() {
rejectAngle = mathLib.angleClean(rejectAngle + rejectAngleChange);
if (rejectAngle > 135) {
rejectAngle = 135;
rejectAngleChange = -5;
} else if (rejectAngle < 45) {
rejectAngle = 45;
rejectAngleChange = 5;
}
if (playerNum == 2) {
my_mc.meter_mc.gotoAndStop((rejectAngle - 45) + 1);
} else {
my_mc.meter_mc.gotoAndStop(90 - ((rejectAngle - 45) + 1));
}
if (trappedBall != null) {
tornadoSound--;
if (tornadoSound <= 0) {
_global.S.PlayASound("Tornado_Catch", 100, 1);
tornadoSound = 10;
}
}
}
function stopBlow() {
if (trappedBall != null) {
if (playerNum == 2) {
rejectAngle = rejectAngle - 180;
}
var _local3 = playerRef.returnCoord().x + (Math.sin(mathLib.deg2rad(mathLib.angleClean(rejectAngle))) * OUT_DIST);
var _local4 = playerRef.returnCoord().y + (Math.cos(mathLib.deg2rad(mathLib.angleClean(rejectAngle))) * OUT_DIST);
if (_local3 < MIN_X_DIST) {
_local3 = MIN_X_DIST;
}
_global.COMPUTER_PLAYER_MANAGER.ballExitTornado("Player");
trappedBall.changePosAngleAndSpeed(_local3, _local4, mathLib.angleClean(rejectAngle), REJECT_SPEED);
trappedBall.moveAgain();
_global.S.PlayASound("Tornado_Release", 100, 1);
}
die();
}
function doAffectBall(l_oBall) {
my_mc.meter_mc._visible = true;
_global.S.PlayASound("Tornado_Catch", 100, 1);
if (playerNum == 2) {
my_mc.meter_mc._xscale = -100;
}
rejectAngle = mathLib.randomRange(45, 135);
trappedBall = l_oBall;
enterFrame.addListener(this);
_global.COMPUTER_PLAYER_MANAGER.ballEnterTornado("Player");
l_oBall.pauseAndHide();
playerRef.doAirTornadoTrapBall();
}
function playerMoves(x, y) {
if (playerNum == 1) {
my_mc._x = x + 30;
} else {
my_mc._x = x - 30;
}
my_mc._y = y;
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
function doAffectElement(l_element) {
if (l_element.elementType == "Flame") {
l_element.airGrow();
}
}
static var REJECT_SPEED = 12;
static var OUT_DIST = 50;
static var MIN_X_DIST = 15;
var elementType = "PlayerTornado";
var probeIntervalBlock = 0;
var probeIntervalAffect = 1;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var rejectAngleChange = 5;
var fallTime = -1;
var tornadoSound = 10;
}
Symbol 1289 MovieClip [__Packages.WindGust] Frame 0
class WindGust extends StageObject
{
var playerNum, dieTime, affectPlayer, affectBall, blockPlayer, blockBall, affectElements, updateDepth, my_mc, removeFromStage;
function WindGust (my_mc, playerNum) {
super(my_mc, my_mc.hit_mc, this);
_global.S.PlayASound("Gust", 100, 1);
this.playerNum = playerNum;
dieTime = LIFE_FRAMES;
affectPlayer = false;
affectBall = false;
blockPlayer = false;
blockBall = true;
affectElements = true;
updateDepth();
enterFrame.addListener(this);
}
function onEnterFrame() {
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
}
function ballReflectAngle(x, y, hitAngle) {
blockBall = false;
var _local6 = false;
if (playerNum == 1) {
if ((mathLib.angleClean(hitAngle) > 180) && (mathLib.angleClean(hitAngle) < 360)) {
_local6 = true;
}
} else if ((mathLib.angleClean(hitAngle) > 0) && (mathLib.angleClean(hitAngle) < 180)) {
_local6 = true;
}
if (_local6) {
var _local3 = hitAngle - 180;
var _local2 = _local3;
var _local5 = my_mc._y - y;
_local5 = _local5 * -1;
if (((_local5 < (my_mc.hit_mc._height * 0.3)) && (Math.abs(hitAngle - 180) > 10)) && (Math.abs(hitAngle) > 10)) {
_local2 = mathLib.angleClean(mathLib.angleReflectVertical(hitAngle)) + (_local5 / REFLECT_ANGLE);
} else {
_local3 = mathLib.angleClean(_local3);
if ((_local3 > 0) && (_local3 < 90)) {
_local3 = 45;
} else if ((_local3 > 90) && (_local3 < 180)) {
_local3 = 135;
} else if ((_local3 > 180) && (_local3 < 270)) {
_local3 = 225;
} else if ((_local3 > 270) && (_local3 < 360)) {
_local3 = 315;
} else if (playerNum == 1) {
_local3 = 90;
} else {
_local3 = 270;
}
_local2 = _local3;
_local2 = mathLib.angleClean(_local2);
if (playerNum == 1) {
if ((_local2 > 0) && (_local2 < 45)) {
_local2 = 45;
} else if ((_local2 > 135) && (_local2 < 180)) {
_local2 = 135;
} else if ((_local2 < 360) && (_local2 > 180)) {
_local2 = 90 + mathLib.randomRange(-10, 10);
}
} else if ((_local2 < 360) && (_local2 > 315)) {
_local2 = 315;
} else if ((_local2 > 180) && (_local2 < 165)) {
_local2 = 165;
} else if ((_local2 < 180) && (_local2 > 0)) {
_local2 = 270 + mathLib.randomRange(-10, 10);
}
}
_local2 = mathLib.angleClean(_local2);
if (playerNum == 1) {
if ((_local2 > 0) && (_local2 < 75)) {
_local2 = 75;
} else if ((_local2 > 105) && (_local2 < 180)) {
_local2 = 105;
}
} else if ((_local2 < 360) && (_local2 > 285)) {
_local2 = 285;
} else if ((_local2 > 180) && (_local2 < 255)) {
_local2 = 255;
}
} else {
var _local2 = hitAngle;
}
return(_local2);
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
function doAffectElement(l_element) {
if (l_element.elementType == "Flame") {
l_element.airGrow();
}
}
static var LIFE_FRAMES = 11;
static var REFLECT_ANGLE = 1;
var elementType = "WindGust";
var probeIntervalBlock = 3;
var probeIntervalAffect = 0;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
}
Symbol 1290 MovieClip [__Packages.EarthPlayer] Frame 0
class EarthPlayer extends Player
{
var my_mc, scene_mc, playerNum, setUpPosition, rock, trowedRock, privateEFListener, energy, specialMove, specialMoveNoWalk, LEGS_currentState, controlInterface, changePos, possesesBall, inServiceMotion, inHurt, doVisualAttack, hSpeed, vSpeed;
function EarthPlayer (scene_mc, playerNum, controlInterface) {
super(scene_mc, playerNum, "Earth", this, controlInterface);
my_mc = this.scene_mc.attachMovie("Player_Earth", "player" + this.playerNum, 10 + this.playerNum);
my_mc._xscale = 90;
my_mc._yscale = 90;
setUpPosition();
rock = null;
trowedRock = false;
privateEFListener = new Object();
privateEFListener.owner = this;
privateEFListener.onEnterFrame = function () {
this.owner.privateEF();
};
enterFrame.addListener(privateEFListener);
}
function stopSpecialMove() {
releaseOffense(false);
}
function privateEF() {
energy = energy + ENERGY_REFILL_RATE;
if (energy > 100) {
energy = 100;
}
if (energy < 0) {
energy = 0;
}
ugTravel();
ugGoingUp();
rockLift();
handsFall();
if (rock != null) {
if (trowedRock) {
energy = energy - ROCK_ENERGY_RATE;
if (energy < ROCK_ENERGY_RATE) {
releaseOffense();
}
}
rock.setPositionFromPlayer(my_mc._x, my_mc._y);
}
ScoreAndHud.setPlayerEnergy(playerNum, energy);
}
function rockLift() {
if (rockLiftCountDown != -1) {
rockLiftCountDown--;
if (rockLiftCountDown <= 0) {
rockLiftCountDown = -1;
doThrowRock();
}
}
}
function handsFall() {
if (handsFallCountDown != -1) {
handsFallCountDown--;
if (handsFallCountDown <= 0) {
handsFallCountDown = -1;
my_mc.player_mc.upperBody_mc.gotoAndStop("Idle");
}
}
}
function doThrowRock() {
my_mc.player_mc.upperBody_mc.gotoAndStop("TrowRock");
trowedRock = true;
rock.throwRock();
}
function ugGoingUp() {
if (underGroundGoingUpCountDown != -1) {
underGroundGoingUpCountDown--;
if (underGroundGoingUpCountDown <= 0) {
specialMove = false;
specialMoveNoWalk = false;
underGroundGoingUpCountDown = -1;
LEGS_currentState = "EARTH_DEFENSE";
controlInterface.keyChange();
}
}
}
function ugTravel() {
if (underGroundTravelCountDown != -1) {
underGroundTravelCountDown--;
if (underGroundTravelCountDown <= 0) {
changePos();
_global.S.PlayASound("TeleportExit", 100, 1);
my_mc.defense_mc.play();
underGroundGoingUpCountDown = UG_TOTAL - UG_TRAVEL_TIME;
}
}
}
function pressOffense() {
if ((((((rock == null) && (!possesesBall)) && (!inServiceMotion)) && (!inHurt)) && (energy > ROCK_ENERGY_SHOT)) && (_global.BallLaunched)) {
energy = energy - ROCK_ENERGY_SHOT;
doVisualAttack();
trowedRock = false;
rockNum++;
var _local3 = scene_mc.attachMovie("Attack_Earth", ("rock" + rockNum) + "_mc", scene_mc.getNextHighestDepth());
if (playerNum == 2) {
_local3._xscale = -100;
}
rock = new Rock(_local3, playerNum, this);
rock.setPositionFromPlayer(my_mc._x, my_mc._y);
specialMove = true;
rockLiftCountDown = ROCK_LIFT;
}
}
function pressDefense() {
if ((((((!possesesBall) && (!inServiceMotion)) && (!inHurt)) && (energy > UG_ENERGY_SHOT)) && (!specialMove)) && (_global.BallLaunched)) {
energy = energy - UG_ENERGY_SHOT;
_global.S.PlayASound("TeleportEnter", 100, 1);
my_mc.gotoAndStop("Defense");
LEGS_currentState = "EARTH_DEFENSE";
hSpeed = 0;
vSpeed = 0;
specialMove = true;
specialMoveNoWalk = true;
underGroundTravelCountDown = UG_TRAVEL_TIME;
}
}
function fromRockFall() {
releaseOffense();
}
function releaseOffense(volontaire) {
if (volontaire != false) {
if (trowedRock) {
rock.fall();
if (((!possesesBall) && (!inServiceMotion)) && (!inHurt)) {
my_mc.player_mc.upperBody_mc.throwRock_mc.play();
handsFallCountDown = HANDS_FALL;
}
} else {
rockLiftCountDown = -1;
if (my_mc.player_mc.upperBody_mc.rockLift_mc._currentframe >= 14) {
rock.prematurateFall();
} else {
rock.prematurateDie();
energy = energy + ROCK_ENERGY_SHOT;
}
if (((!possesesBall) && (!inServiceMotion)) && (!inHurt)) {
my_mc.player_mc.upperBody_mc.gotoAndStop("Idle");
}
}
rock = null;
trowedRock = false;
specialMove = false;
} else {
if (trowedRock) {
rock.fall();
} else if (my_mc.player_mc.upperBody_mc.rockLift_mc._currentframe >= 14) {
rock.prematurateFall();
} else {
rock.prematurateDie();
energy = energy + ROCK_ENERGY_SHOT;
}
rock = null;
trowedRock = false;
specialMove = false;
}
}
function releaseDefense(l_changeVisual) {
}
function UP_deleteAll() {
enterFrame.removeListener(privateEFListener);
rock = null;
privateEFListener = null;
}
static var ENERGY_REFILL_RATE = 0.1;
static var UG_TRAVEL_TIME = 12;
static var UG_TOTAL = 19;
static var UG_ENERGY_SHOT = 20;
static var ROCK_LIFT = 20;
static var ROCK_ENERGY_SHOT = 15;
static var ROCK_ENERGY_RATE = 0.8;
static var HANDS_FALL = 5;
var underGroundTravelCountDown = -1;
var underGroundGoingUpCountDown = -1;
var rockNum = 0;
var rockLiftCountDown = -1;
var handsFallCountDown = -1;
}
Symbol 1291 MovieClip [__Packages.Rock] Frame 0
class Rock extends StageObject
{
var my_mc, inShape, throwMotion, throwVertSpeed, playerNum, playerObj, affectPlayer, affectBall, blockPlayer, blockBall, blockAny, affectElements, updateDepth, falling, fallingCountDown, flySpeed, removeFromStage;
function Rock (my_mc, playerNum, playerObj) {
super(my_mc, my_mc.hit_mc, this);
_global.S.PlayASound("Rock_Enter", 100, 1);
this.my_mc._visible = false;
inShape = true;
throwMotion = false;
throwVertSpeed = 0;
explosionTime = LIFE_FRAMES;
this.playerNum = playerNum;
this.playerObj = playerObj;
affectPlayer = false;
affectBall = false;
blockPlayer = false;
blockBall = false;
blockAny = false;
affectElements = false;
updateDepth();
enterFrame.addListener(this);
}
function onEnterFrame() {
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
if (explosionTime != -1) {
explosionTime--;
if (explosionTime <= 0) {
dieTime = EXPLOSION_FRAMES;
my_mc.gotoAndStop("Break");
explosionTime = -1;
}
}
if (falling) {
fallingCountDown--;
if (fallingCountDown <= 0) {
falling = false;
throwMotion = false;
}
my_mc._y = my_mc._y + FALLING_VERT_SPEED;
flySpeed = flySpeed - FALLING_SPEED_ATTENUATION;
if (flySpeed <= 0) {
flySpeed = 0;
}
}
if (throwMotion) {
var _local6 = ((playerNum == 1) ? (flySpeed) : (-flySpeed));
var _local4 = _global.M.returnBounds();
var _local3 = my_mc._x + _local6;
if (((_local3 - (my_mc._width / 2)) > (_local4.left + 2)) && ((_local3 + (my_mc._width / 2)) < (_local4.right - 2))) {
var _local5 = my_mc.flyHit_mc.getBounds(_global.SCENE);
if (_global.M.isClearPathAny(_local3, _local5.yMin, this) && (_global.M.isClearPathAny(_local3, _local5.yMax, this))) {
my_mc._x = _local3;
} else if (!falling) {
playerObj.fromRockFall();
} else {
flySpeed = 0;
my_mc._x = my_mc._x - ((playerNum == 1) ? 20 : -20);
}
} else {
playerObj.fromRockFall();
}
}
updateDepth();
}
function setPositionFromPlayer(x, y) {
var _local6 = ((playerNum == 1) ? 30 : -30);
var _local3 = -8;
if (!throwMotion) {
my_mc._x = x + _local6;
my_mc._y = y + _local3;
} else {
if ((y + _local3) > (my_mc._y + 2)) {
throwVertSpeed = throwVertSpeed + FLY_VERT_ACCEL;
if (throwVertSpeed > FLY_VERT_SPEED) {
throwVertSpeed = FLY_VERT_SPEED;
}
} else if ((y + _local3) < (my_mc._y - 2)) {
throwVertSpeed = throwVertSpeed - FLY_VERT_ACCEL;
if (throwVertSpeed < (-FLY_VERT_SPEED)) {
throwVertSpeed = -FLY_VERT_SPEED;
}
}
var _local5 = _global.M.returnBounds();
var _local4 = my_mc._y + throwVertSpeed;
if ((_local4 > _local5.top) && (_local4 < _local5.bottom)) {
my_mc._y = _local4;
} else {
playerObj.fromRockFall();
}
}
}
function throwRock() {
affectPlayer = true;
blockPlayer = true;
blockBall = true;
blockAny = true;
affectElements = true;
my_mc._visible = true;
my_mc.gotoAndStop("Fly");
flySpeed = FLY_HORZ_SPEED;
throwMotion = true;
}
function fall() {
my_mc._visible = true;
affectPlayer = false;
blockPlayer = true;
blockBall = true;
blockAny = true;
affectElements = true;
_global.S.PlayASound("Rock_Falls", 60, 1);
my_mc.gotoAndStop("Land");
fallingCountDown = FALLING_FRAMES;
falling = true;
}
function doBlockPlayer(l_type) {
return(true);
}
function doAffectPlayer(l_playerType, l_oPlayer) {
l_oPlayer.sufferHit(my_mc._x, my_mc._y);
playerObj.fromRockFall();
}
function ballReflectAngle(x, y, hitAngle) {
ballReflectCount++;
if (ballReflectCount == 5) {
explode();
}
var _local4;
var _local14 = my_mc._y - y;
_local14 = _local14 * -1;
var _local3 = my_mc.hit_mc.getBounds(_global.SCENE);
var _local9 = _global.B.returnCornersMcs();
var _local8 = false;
var _local11 = false;
var _local10 = false;
var _local7 = false;
var _local12 = _local9.TR.getBounds(_global.SCENE);
var _local17 = (_local12.xMin + _local12.xMax) / 2;
var _local16 = (_local12.yMin + _local12.yMax) / 2;
if (_local17 > _local3.xMin) {
if (_local17 < _local3.xMax) {
if (_local16 > _local3.yMin) {
if (_local16 < _local3.yMax) {
_local8 = true;
}
}
}
}
var _local5 = _local9.TL.getBounds(_global.SCENE);
var _local15 = (_local5.xMin + _local5.xMax) / 2;
var _local26 = (_local5.yMin + _local5.yMax) / 2;
if (_local15 > _local3.xMin) {
if (_local15 < _local3.xMax) {
if (_local26 > _local3.yMin) {
if (_local26 < _local3.yMax) {
_local11 = true;
}
}
}
}
var _local13 = _local9.BR.getBounds(_global.SCENE);
var _local21 = (_local13.xMin + _local13.xMax) / 2;
var _local20 = (_local13.yMin + _local13.yMax) / 2;
if (_local21 > _local3.xMin) {
if (_local21 < _local3.xMax) {
if (_local20 > _local3.yMin) {
if (_local20 < _local3.yMax) {
_local10 = true;
}
}
}
}
var _local6 = _local9.BL.getBounds(_global.SCENE);
var _local19 = (_local6.xMin + _local6.xMax) / 2;
var _local18 = (_local6.yMin + _local6.yMax) / 2;
if (_local19 > _local3.xMin) {
if (_local19 < _local3.xMax) {
if (_local18 > _local3.yMin) {
if (_local18 < _local3.yMax) {
_local7 = true;
}
}
}
}
var _local23 = false;
var _local24 = false;
var _local25 = false;
var _local22 = false;
if (_local8 && (_local11)) {
_local23 = true;
}
if (_local10 && (_local7)) {
_local24 = true;
}
if (_local8 && (_local10)) {
_local22 = true;
}
if (_local11 && (_local7)) {
_local25 = true;
}
if (_local22 || (_local25)) {
_local4 = mathLib.angleClean(mathLib.angleReflectVertical(hitAngle)) + (_local14 / REFLECT_ANGLE);
} else if (_local23 || (_local24)) {
_local4 = 180 - hitAngle;
} else if (_local7) {
_local4 = 135;
} else if (_local11) {
_local4 = 45;
} else if (_local10) {
_local4 = 225;
} else if (_local8) {
_local4 = 315;
} else {
_local4 = mathLib.randomRange(1, 360);
}
return(_local4);
}
function prematurateFall() {
fall();
}
function prematurateDie() {
die();
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
function doAffectElement(l_element) {
if (l_element.elementType == "Spike") {
l_element.explode();
}
}
function explode() {
if (inShape) {
if (throwMotion) {
playerObj.fromRockFall();
} else {
explosionTime = 0;
inShape = false;
fall();
}
}
}
static var LIFE_FRAMES = 270;
static var EXPLOSION_FRAMES = 12;
static var FLY_VERT_ACCEL = 0.1;
static var FLY_VERT_SPEED = 4;
static var FLY_HORZ_SPEED = 8;
static var FALLING_FRAMES = 15;
static var FALLING_SPEED_ATTENUATION = 0.1;
static var FALLING_VERT_SPEED = 0.3;
static var REFLECT_ANGLE = 5;
var elementType = "Rock";
var probeIntervalBlock = 1;
var probeIntervalAffect = 3;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var dieTime = -1;
var explosionTime = -1;
var ballReflectCount = 0;
}
Symbol 1292 MovieClip [__Packages.MapManager] Frame 0
class MapManager
{
var scene_mc, stageElements, background_mc, privateEFListener, bonusesNum, bonusesCountDown;
function MapManager (scene_mc, l_context) {
this.scene_mc = scene_mc;
_global.SCENE = scene_mc;
_global.MapType = l_context;
stageElements = new Array();
_global.M = this;
setNextBonusTime();
background_mc = this.scene_mc.attachMovie("Field_" + l_context, "background_mc", 1);
background_mc._x = 0;
background_mc._y = 0;
privateEFListener = new Object();
privateEFListener.owner = this;
privateEFListener.onEnterFrame = function () {
this.owner.privateEF();
};
enterFrame.addListener(privateEFListener);
}
function generateBonus() {
bonusesNum++;
var _local9 = new Array();
_local9.push(_global.P1.returnPlayerAvatar());
_local9.push(_global.P1.returnPlayerAvatar());
_local9.push(_global.P2.returnPlayerAvatar());
_local9.push(_global.P2.returnPlayerAvatar());
if (!_global.twoPlayersGame) {
_local9.push("Momo");
}
var _local11 = _local9[mathLib.randomRange(0, _local9.length - 1)];
var _local10 = scene_mc.attachMovie("Bonus_" + _local11, ("bonus_" + bonusesNum) + "_mc", scene_mc.getNextHighestDepth());
_local10._visible = false;
var _local12 = mathLib.randomRange(BONUS_FALL_MIN, BONUS_FALL_MAX);
var _local8 = true;
var _local4;
var _local5;
while (_local8) {
_local4 = mathLib.randomRange(_global.M.returnBounds().left, _global.M.returnBounds().right);
_local5 = mathLib.randomRange(_global.M.returnBounds().top, _global.M.returnBounds().bottom);
var _local7 = true;
var _local6 = true;
var _local3 = _global.P1.returnFootsBounds();
if ((_local3.xMin > _local4) || (_local3.xMax < _local4)) {
if ((_local3.yMin > _local5) || (_local3.yMax < _local5)) {
_local7 = false;
}
}
_local3 = _global.P2.returnFootsBounds();
if ((_local3.xMin > _local4) || (_local3.xMax < _local4)) {
if ((_local3.yMin > _local5) || (_local3.yMax < _local5)) {
_local6 = false;
}
}
if ((!_local7) && (!_local6)) {
_local8 = false;
}
}
_local10._x = _local4;
_local10._y = _local5;
new Bonus(_local10, _local12, _local11);
}
function setNextBonusTime() {
bonusesCountDown = mathLib.randomRange(BONUS_POP_MIN, BONUS_POP_MAX);
}
function privateEF() {
if ((bonusesCountDown != -1) && (_global.BallLaunched)) {
bonusesCountDown--;
if (bonusesCountDown <= 0) {
generateBonus();
bonusesCountDown = -1;
setNextBonusTime();
}
}
checkEnvironementAction();
}
function checkEnvironementAction() {
var _local3 = true;
for (var _local4 in stageElements) {
if (_local3) {
if (stageElements[_local4].affectElements) {
for (var _local2 in stageElements) {
if (stageElements[_local4].isTimeToProbeAffect()) {
if (stageElements[_local4].hit_mc.hitTest(stageElements[_local2].hit_mc)) {
stageElements[_local4].doAffectElement(stageElements[_local2]);
}
}
}
}
}
}
}
function isClearPathAny(x, y, askObj) {
var _local2 = true;
for (var _local4 in stageElements) {
if (_local2) {
if (stageElements[_local4].blockAny && (stageElements[_local4] != askObj)) {
if (stageElements[_local4].isTimeToProbeBlock()) {
if (stageElements[_local4].hit_mc.hitTest(x, y)) {
_local2 = false;
}
}
}
}
}
return(_local2);
}
function isClearPathPlayer(x, y, l_avatar, l_oPlayer) {
var _local2 = true;
var _local3;
for (var _local6 in stageElements) {
if (_local2) {
if (stageElements[_local6].blockPlayer) {
if (stageElements[_local6].isTimeToProbeBlock()) {
if (stageElements[_local6].hit_mc.hitTest(x, y)) {
if (stageElements[_local6].doBlockPlayer(l_avatar, l_oPlayer)) {
_local2 = false;
_local3 = stageElements[_local6].hit_mc;
}
}
}
}
}
}
return({pathClear:_local2, mc:_local3});
}
function isClearPathBall(x, y, angle) {
var _local2 = true;
for (var _local7 in stageElements) {
if (_local2) {
if (stageElements[_local7].blockBall) {
if (stageElements[_local7].isTimeToProbeBlock()) {
if (stageElements[_local7].hit_mc.hitTest(x, y)) {
_local2 = false;
var _local3 = stageElements[_local7].ballReflectAngle(x, y, angle);
}
}
}
}
}
var _local8 = new Object();
_local8.ok = _local2;
if (!_local2) {
_local8.angle = _local3;
}
return(_local8);
}
function doCheckEnvironementContactPlayer(x, y, l_avatar, l_oPlayer) {
var _local2 = true;
for (var _local5 in stageElements) {
if (_local2) {
if (stageElements[_local5].affectPlayer) {
if (stageElements[_local5].isTimeToProbeAffect()) {
if (stageElements[_local5].hit_mc.hitTest(x, y)) {
stageElements[_local5].doAffectPlayer(l_avatar, l_oPlayer);
_local2 = false;
}
}
}
}
}
}
function doCheckEnvironementContactBall(x, y, l_oBall) {
var _local2 = true;
for (var _local4 in stageElements) {
if (_local2) {
if (stageElements[_local4].affectBall) {
if (stageElements[_local4].isTimeToProbeAffect()) {
if (stageElements[_local4].hit_mc.hitTest(x, y)) {
stageElements[_local4].doAffectBall(l_oBall);
_local2 = false;
}
}
}
}
}
}
function removeStageElement(l_element) {
var _local2 = false;
for (var _local3 in stageElements) {
if (!_local2) {
if (stageElements[_local3] == l_element) {
delete stageElements[_local3];
_local2 = true;
}
}
}
}
function addStageElement(l_element) {
stageElements.push(l_element);
}
function returnGoalLimits() {
return({top:NET_TOP, bottom:NET_BOTTOM});
}
function returnCenterPoint() {
return(CENTER_POINT);
}
function returnBounds() {
var _local1 = new Object();
_local1.left = LIMIT_LEFT;
_local1.right = LIMIT_RIGHT;
_local1.top = LIMIT_TOP;
_local1.bottom = LIMIT_BOTTOM;
return(_local1);
}
function isInbound(x, y, ballContext) {
var _local1;
_local1 = true;
if (x != null) {
if ((x < LIMIT_LEFT) || (x > LIMIT_RIGHT)) {
_local1 = false;
}
}
if (y != null) {
var _local2 = ((ballContext == "Ball") ? 30 : 0);
if ((y < (LIMIT_TOP - _local2)) || (y > LIMIT_BOTTOM)) {
_local1 = false;
}
}
return(_local1);
}
function angleToCenter(x, y) {
var _local1;
if (x < CENTER_POINT.x) {
if (y < CENTER_POINT.y) {
_local1 = 45;
} else {
_local1 = 135;
}
} else if (y < CENTER_POINT.y) {
_local1 = 315;
} else {
_local1 = 225;
}
_local1 = _local1 + (random(20) - 10);
return(_local1);
}
function checkGoal(x, y) {
if ((y > NET_TOP) && (y < NET_BOTTOM)) {
if (x < LIMIT_LEFT) {
_global.C.goal(1);
return(true);
}
if (x > LIMIT_RIGHT) {
_global.C.goal(2);
return(true);
}
return(undefined);
}
return(false);
}
function endRound() {
for (var _local2 in stageElements) {
stageElements[_local2].die();
}
}
function returnStageElements() {
return(stageElements);
}
function MM_deleteAll() {
for (var _local3 in stageElements) {
stageElements[_local3].die();
stageElements[_local3] = null;
delete stageElements[_local3];
}
stageElements = new Array();
stageElements = null;
delete stageElements;
_global.SCENE = null;
delete _global.SCENE;
scene_mc = null;
background_mc.removeMovieClip();
background_mc = null;
delete background_mc;
enterFrame.removeListener(privateEFListener);
privateEFListener = null;
delete privateEFListener;
}
static var BONUS_POP_MIN = 180;
static var BONUS_POP_MAX = 300;
static var BONUS_FALL_MIN = 120;
static var BONUS_FALL_MAX = 360;
static var NET_TOP = 145;
static var NET_BOTTOM = 230;
static var LIMIT_TOP = 80;
static var LIMIT_BOTTOM = 295;
static var LIMIT_LEFT = 50;
static var LIMIT_RIGHT = 550;
static var CENTER_POINT = {x:300, y:200};
}
Symbol 1293 MovieClip [__Packages.Bonus] Frame 0
class Bonus extends StageObject
{
var bonusType, my_mc, affectPlayer, affectBall, blockPlayer, blockBall, updateDepth, futureState, removeFromStage;
function Bonus (my_mc, fallTime, bonusType) {
super(my_mc, my_mc.hit_mc, this);
this.fallTime = fallTime;
this.bonusType = bonusType;
this.my_mc.gotoAndStop("Apear");
futureStateChange(RAISE_FRAMES, "Idle");
affectPlayer = true;
affectBall = true;
blockPlayer = false;
blockBall = false;
enterFrame.addListener(this);
}
function onEnterFrame() {
checkForStateChange();
if (fallTime != -1) {
fallTime--;
if (fallTime <= 0) {
fall();
fallTime = -1;
}
}
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
updateDepth(-99);
}
function doAffectBall(l_oBall) {
if (bonusType != "Momo") {
if (_global["P" + l_oBall.returnPossessor()].returnPlayerAvatar() == bonusType) {
_global.S.PlayASound("Bonus_Good", 100, 1);
_global["P" + l_oBall.returnPossessor()].energyFill(REFILL_SHOT);
if (l_oBall.returnPossessor() == 1) {
ScoreAndHud.addPoints(Configs.PTS_BONUS_GOOD);
}
} else {
_global.S.PlayASound("Bonus_Bad", 100, 1);
_global["P" + l_oBall.returnPossessor()].energyLose(LOSE_SHOT);
if (l_oBall.returnPossessor() == 1) {
ScoreAndHud.addPoints(Configs.PTS_BONUS_BAD);
}
}
} else if (l_oBall.returnPossessor() == 1) {
ScoreAndHud.addPoints(Configs.PTS_MOMO);
}
fall();
}
function doAffectPlayer(l_playerType, l_oPlayer) {
if (bonusType != "Momo") {
if (l_playerType == bonusType) {
_global.S.PlayASound("Bonus_Good", 100, 1);
l_oPlayer.energyFill(REFILL_SHOT);
if (l_oPlayer.returnPlayerNum() == 1) {
ScoreAndHud.addPoints(Configs.PTS_BONUS_GOOD);
}
} else {
_global.S.PlayASound("Bonus_Bad", 100, 1);
l_oPlayer.energyLose(LOSE_SHOT);
if (l_oPlayer.returnPlayerNum() == 1) {
ScoreAndHud.addPoints(Configs.PTS_BONUS_BAD);
}
}
} else {
_global.S.PlayASound("Bonus_Good", 100, 1);
if (l_oPlayer.returnPlayerNum() == 1) {
ScoreAndHud.addPoints(Configs.PTS_MOMO);
}
}
fall();
}
function futureStateChange(frames, state) {
stateChangeCountdown = frames - 1;
futureState = state;
}
function checkForStateChange() {
if (stateChangeCountdown != -1) {
if (stateChangeCountdown <= 0) {
my_mc.gotoAndStop(futureState);
stateChangeCountdown = -1;
} else {
stateChangeCountdown--;
}
}
}
function disapear() {
if (dieTime == -1) {
fall();
} else {
die();
}
}
function fall() {
affectBall = false;
affectPlayer = false;
my_mc.gotoAndStop("Disapear");
dieTime = FALL_FRAMES;
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
static var RAISE_FRAMES = 14;
static var FALL_FRAMES = 18;
static var REFILL_SHOT = 100;
static var LOSE_SHOT = 25;
var elementType = "Bonus";
var probeIntervalBlock = 0;
var probeIntervalAffect = 5;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var fallTime = -1;
var dieTime = -1;
var stateChangeCountdown = -1;
}
Symbol 1294 MovieClip [__Packages.FireMap] Frame 0
class FireMap extends MapManager
{
var magma, background_mc, flameCountDown, scene_mc, MM_deleteAll;
function FireMap (scene_mc) {
super(scene_mc, "Fire");
magma = new Magma(background_mc.magma_mc);
flameCountDown = mathLib.randomRange(FLAME_BURST_MIN_TIME, FLAME_BURST_MAX_TIME);
enterFrame.addListener(this);
}
function onEnterFrame() {
if (_global.BallLaunched) {
doFlames();
}
}
function doFlames() {
flameCountDown--;
if (flameCountDown <= 0) {
generateFlame();
flameCountDown = mathLib.randomRange(FLAME_BURST_MIN_TIME, FLAME_BURST_MAX_TIME);
}
}
function generateFlame() {
flameNum++;
var _local3 = scene_mc.attachMovie("Flame", ("flame_" + flameNum) + "_mc", scene_mc.getNextHighestDepth());
_local3._visible = false;
_local3._x = _global.M.returnBounds().left + Math.floor(Math.random() * ((_global.M.returnBounds().right + 1) - _global.M.returnBounds().left));
_local3._y = _global.M.returnBounds().top + Math.floor(Math.random() * ((_global.M.returnBounds().bottom + 1) - _global.M.returnBounds().top));
var _local4 = mathLib.randomRange(FLAME_BURST_FALL_MIN_TIME, FLAME_BURST_FALL_MAX_TIME);
new Flame(_local3, _local4, true);
}
function deleteAll() {
enterFrame.removeListener(this);
magma = null;
delete magma;
MM_deleteAll();
}
static var FLAME_BURST_MIN_TIME = 100;
static var FLAME_BURST_MAX_TIME = 500;
static var FLAME_BURST_FALL_MIN_TIME = 90;
static var FLAME_BURST_FALL_MAX_TIME = 300;
var flameNum = 0;
}
Symbol 1295 MovieClip [__Packages.Magma] Frame 0
class Magma extends StageObject
{
var affectPlayer, affectBall, blockPlayer, blockBall, my_mc;
function Magma (my_mc) {
super(my_mc, my_mc, this);
affectPlayer = true;
affectBall = false;
blockPlayer = false;
blockBall = false;
}
function doAffectPlayer(l_playerType, l_oPlayer) {
if (l_playerType == "Fire") {
l_oPlayer.energyFill(REFILL_RATE);
} else {
l_oPlayer.sufferBurn(my_mc._x, l_oPlayer.returnCoord().y, true);
}
}
static var REFILL_RATE = 0.2;
var elementType = "Magma";
var probeIntervalBlock = 0;
var probeIntervalAffect = 1;
var probeTimerBlock = 0;
var probeTimerAffect = 1;
}
Symbol 1296 MovieClip [__Packages.EarthMap] Frame 0
class EarthMap extends MapManager
{
var quickSands, background_mc, stoneCountDown, scene_mc, MM_deleteAll;
function EarthMap (scene_mc) {
super(scene_mc, "Earth");
initStones();
quickSands = new QuickSands(background_mc.quickSands_mc);
stoneCountDown = mathLib.randomRange(STONE_BURST_MIN_TIME, STONE_BURST_MAX_TIME);
enterFrame.addListener(this);
}
function onEnterFrame() {
doStones();
}
function doStones() {
if ((stoneCountDown != -1) && (_global.BallLaunched)) {
stoneCountDown--;
if (stoneCountDown <= 0) {
stoneCountDown = -1;
generateStone();
}
}
}
function generateStone() {
var _local10 = mathLib.randomRange(STONE_BURST_FALL_MIN_TIME, STONE_BURST_FALL_MAX_TIME);
var _local8 = true;
var _local9 = true;
while (_local8 || (_local9)) {
var _local5 = mathLib.randomRange(1, 2);
var _local7 = mathLib.randomRange(1, 9);
var _local6 = scene_mc[((("stone_" + _local5) + "_") + _local7) + "_mc"];
var _local3 = _local6.getBounds(scene_mc);
var _local4 = _global["P" + _local5].returnFootsBounds();
if ((_local4.xMin > _local3.xMax) || (_local4.xMax < _local3.xMin)) {
if ((_local4.yMin > _local3.yMax) || (_local4.yMax < _local3.yMin)) {
_local8 = false;
}
}
if ((_global.B.returnCoord().x > _local3.xMax) || (_global.B.returnCoord().x < _local3.xMin)) {
if ((_global.B.returnCoord().y > _local3.yMax) || (_global.B.returnCoord().y < _local3.yMin)) {
_local9 = false;
}
}
}
new Stone(_local6, _local10, this, _local5);
}
function stoneFallen() {
stoneCountDown = mathLib.randomRange(STONE_BURST_MIN_TIME, STONE_BURST_MAX_TIME);
}
function initStones() {
var _local3 = 1;
while (_local3 <= 2) {
var _local2 = 1;
while (_local2 <= 9) {
var _local4 = background_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"]._x;
var _local5 = background_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"]._y;
background_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"].swapDepths(1040000);
background_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"].removeMovieClip();
scene_mc.attachMovie("Stone", ((("stone_" + _local3) + "_") + _local2) + "_mc", scene_mc.getNextHighestDepth());
if (_local3 == 2) {
scene_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"]._xscale = -100;
}
scene_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"]._x = _local4;
scene_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"]._y = _local5;
scene_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"]._visible = false;
_local2++;
}
_local3++;
}
}
function deleteAll() {
enterFrame.removeListener(this);
var _local3 = 1;
while (_local3 <= 2) {
var _local2 = 1;
while (_local2 <= 9) {
scene_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"].swapDepths(1);
scene_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"].removeMovieClip();
scene_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"] = null;
delete scene_mc[((("stone_" + _local3) + "_") + _local2) + "_mc"];
_local2++;
}
_local3++;
}
quickSands = null;
MM_deleteAll();
}
static var STONE_BURST_MIN_TIME = 10;
static var STONE_BURST_MAX_TIME = 50;
static var STONE_BURST_FALL_MIN_TIME = 30;
static var STONE_BURST_FALL_MAX_TIME = 300;
}
Symbol 1297 MovieClip [__Packages.QuickSands] Frame 0
class QuickSands extends StageObject
{
var affectPlayer, affectBall, blockPlayer, blockBall;
function QuickSands (my_mc) {
super(my_mc, my_mc, this);
affectPlayer = true;
affectBall = false;
blockPlayer = false;
blockBall = false;
enterFrame.addListener(this);
}
function onEnterFrame() {
var _local2 = 1;
while (_local2 <= 2) {
this[("p" + _local2) + "In"]--;
_local2++;
}
checkQS();
}
function checkQS() {
var _local3 = 1;
while (_local3 <= 2) {
if (this[("p" + _local3) + "In"] == 0) {
_global["P" + _local3].quickSandsQuit();
}
_local3++;
}
}
function doAffectPlayer(l_playerType, l_oPlayer) {
if (l_playerType == "Earth") {
l_oPlayer.energyFill(REFILL_RATE);
} else {
if (this[("p" + l_oPlayer.returnPlayerNum()) + "In"] <= 0) {
l_oPlayer.quickSandsEnter(MAX_WALK_SPEED);
}
this[("p" + l_oPlayer.returnPlayerNum()) + "In"] = 5;
}
}
static var REFILL_RATE = 0.2;
static var MAX_WALK_SPEED = 1;
var elementType = "QuickSands";
var probeIntervalBlock = 0;
var probeIntervalAffect = 0;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var p1In = -1;
var p2In = -1;
}
Symbol 1298 MovieClip [__Packages.Stone] Frame 0
class Stone extends StageObject
{
var mapManager, mapSide, my_mc, affectPlayer, affectBall, blockPlayer, blockBall, blockAny, affectElements, updateDepth, futureState, removeFromStage;
function Stone (my_mc, fallTime, mapManager, mapSide) {
super(my_mc, my_mc.hit_mc, this);
this.fallTime = fallTime;
this.mapManager = mapManager;
this.mapSide = mapSide;
this.my_mc._visible = true;
_global.S.PlayASound("Field_Stone", 100, 1);
this.my_mc.gotoAndStop("Rise");
futureStateChange(RAISE_FRAMES, "Idle");
affectPlayer = false;
affectBall = false;
blockPlayer = true;
blockBall = true;
blockAny = true;
affectElements = true;
updateDepth();
enterFrame.addListener(this);
}
function setFallTime(fTime) {
fallTime = fTime;
}
function onEnterFrame() {
checkForStateChange();
if (fallTime != -1) {
fallTime--;
if (fallTime <= 0) {
fall();
fallTime = -1;
}
}
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
checkAffectedPlayer();
}
function checkAffectedPlayer() {
if (affectedPlayer != null) {
if (affectedPlayer.returnFootsBounds().mcRef.hitTest(my_mc.energyHit_mc)) {
affectedPlayer.energyFill(REFILL_RATE);
} else {
affectedPlayer = null;
}
}
}
function doBlockPlayer(l_playerType, l_oPlayer) {
if (l_playerType == "Earth") {
affectedPlayer = l_oPlayer;
}
return(true);
}
function ballReflectAngle(x, y, hitAngle) {
ballReflectCount++;
if (ballReflectCount == 5) {
fall();
}
var _local4;
var _local14 = my_mc._y - y;
_local14 = _local14 * -1;
var _local3 = my_mc.hit_mc.getBounds(_global.SCENE);
var _local9 = _global.B.returnCornersMcs();
var _local8 = false;
var _local11 = false;
var _local10 = false;
var _local7 = false;
var _local12 = _local9.TR.getBounds(_global.SCENE);
var _local17 = (_local12.xMin + _local12.xMax) / 2;
var _local16 = (_local12.yMin + _local12.yMax) / 2;
if (_local17 > _local3.xMin) {
if (_local17 < _local3.xMax) {
if (_local16 > _local3.yMin) {
if (_local16 < _local3.yMax) {
_local8 = true;
}
}
}
}
var _local5 = _local9.TL.getBounds(_global.SCENE);
var _local15 = (_local5.xMin + _local5.xMax) / 2;
var _local26 = (_local5.yMin + _local5.yMax) / 2;
if (_local15 > _local3.xMin) {
if (_local15 < _local3.xMax) {
if (_local26 > _local3.yMin) {
if (_local26 < _local3.yMax) {
_local11 = true;
}
}
}
}
var _local13 = _local9.BR.getBounds(_global.SCENE);
var _local21 = (_local13.xMin + _local13.xMax) / 2;
var _local20 = (_local13.yMin + _local13.yMax) / 2;
if (_local21 > _local3.xMin) {
if (_local21 < _local3.xMax) {
if (_local20 > _local3.yMin) {
if (_local20 < _local3.yMax) {
_local10 = true;
}
}
}
}
var _local6 = _local9.BL.getBounds(_global.SCENE);
var _local19 = (_local6.xMin + _local6.xMax) / 2;
var _local18 = (_local6.yMin + _local6.yMax) / 2;
if (_local19 > _local3.xMin) {
if (_local19 < _local3.xMax) {
if (_local18 > _local3.yMin) {
if (_local18 < _local3.yMax) {
_local7 = true;
}
}
}
}
var _local23 = false;
var _local24 = false;
var _local25 = false;
var _local22 = false;
if (_local8 && (_local11)) {
_local23 = true;
}
if (_local10 && (_local7)) {
_local24 = true;
}
if (_local8 && (_local10)) {
_local22 = true;
}
if (_local11 && (_local7)) {
_local25 = true;
}
if (_local22 || (_local25)) {
_local4 = mathLib.angleClean(mathLib.angleReflectVertical(hitAngle)) + (_local14 / REFLECT_ANGLE);
} else if (_local23 || (_local24)) {
_local4 = 180 - hitAngle;
} else if (_local7) {
_local4 = 135;
} else if (_local11) {
_local4 = 45;
} else if (_local10) {
_local4 = 225;
} else if (_local8) {
_local4 = 315;
} else {
_local4 = _global.M.angleToCenter(x, y);
}
return(_local4);
}
function futureStateChange(frames, state) {
stateChangeCountdown = frames - 1;
futureState = state;
}
function checkForStateChange() {
if (stateChangeCountdown != -1) {
if (stateChangeCountdown <= 0) {
if (futureState == "Idle") {
affectElements = false;
}
my_mc.gotoAndStop(futureState);
stateChangeCountdown = -1;
} else {
stateChangeCountdown--;
}
}
}
function fall() {
_global.S.PlayASound("Field_Stone", 100, 1);
my_mc.gotoAndStop("Fall");
dieTime = FALL_FRAMES;
}
function die() {
mapManager.stoneFallen();
removeFromStage();
my_mc._visible = false;
enterFrame.removeListener(this);
}
function doAffectElement(l_element) {
if (l_element.elementType == "Spike") {
l_element.explode();
}
if (l_element.elementType == "Bonus") {
l_element.disapear();
}
if (l_element.elementType == "Rock") {
l_element.explode();
}
}
static var RAISE_FRAMES = 9;
static var FALL_FRAMES = 9;
static var REFLECT_ANGLE = 5;
static var REFILL_RATE = 1;
var elementType = "Stone";
var probeIntervalBlock = 1;
var probeIntervalAffect = 3;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var affectedPlayer = null;
var fallTime = -1;
var dieTime = -1;
var stateChangeCountdown = -1;
var ballReflectCount = 0;
}
Symbol 1299 MovieClip [__Packages.AirMap] Frame 0
class AirMap extends MapManager
{
var tornadoCountDown, windRep, scene_mc, fieldWind, MM_deleteAll;
function AirMap (scene_mc) {
super(scene_mc, "Air");
tornadoCountDown = mathLib.randomRange(TORNADO_BURST_MIN_TIME, TORNADO_BURST_MAX_TIME);
windRep = this.scene_mc.attachMovie("FieldWind", "fieldWind_mc", 1048250);
windRep._visible = false;
windRep._x = _global.M.returnCenterPoint().x;
windRep._y = _global.M.returnCenterPoint().y;
fieldWind = new FieldWind(windRep);
enterFrame.addListener(this);
}
function onEnterFrame() {
if (_global.BallLaunched) {
doTornados();
}
}
function doTornados() {
tornadoCountDown--;
if (tornadoCountDown <= 0) {
generateTornado();
tornadoCountDown = mathLib.randomRange(TORNADO_BURST_MIN_TIME, TORNADO_BURST_MAX_TIME);
}
}
function generateTornado() {
tornadoNum++;
var _local3 = scene_mc.attachMovie("Tornado", ("tornado_" + tornadoNum) + "_mc", scene_mc.getNextHighestDepth());
_local3._visible = false;
_local3._x = _global.M.returnBounds().left + Math.floor(Math.random() * ((_global.M.returnBounds().right + 1) - _global.M.returnBounds().left));
_local3._y = _global.M.returnBounds().top + Math.floor(Math.random() * ((_global.M.returnBounds().bottom + 1) - _global.M.returnBounds().top));
var _local4 = mathLib.randomRange(TORNADO_BURST_FALL_MIN_TIME, TORNADO_BURST_FALL_MAX_TIME);
new Tornado(_local3, _local4, true);
}
function deleteAll() {
enterFrame.removeListener(this);
windRep.swapDepths(1);
windRep.removeMovieClip();
windRep = null;
delete windRep;
fieldWind = null;
delete fieldWind;
MM_deleteAll();
}
static var TORNADO_BURST_MIN_TIME = 150;
static var TORNADO_BURST_MAX_TIME = 300;
static var TORNADO_BURST_FALL_MIN_TIME = 35;
static var TORNADO_BURST_FALL_MAX_TIME = 110;
var tornadoNum = 0;
}
Symbol 1300 MovieClip [__Packages.FieldWind] Frame 0
class FieldWind extends StageObject
{
var my_mc, affectPlayer, affectBall, blockPlayer, blockBall, angle;
function FieldWind (my_mc) {
super(my_mc, null, this);
this.my_mc._xscale = 240;
this.my_mc._yscale = 240;
this.my_mc._visible = false;
this.my_mc._alpha = 100;
decideNextChange();
_global.FIELD_WIND_ANGLE = null;
affectPlayer = false;
affectBall = false;
blockPlayer = false;
blockBall = false;
enterFrame.addListener(this);
}
function doChange() {
angle = mathLib.randomRange(1, 360);
_global.S.PlayASound("Field_Wind", 100, 1);
_global.FIELD_WIND_ANGLE = angle;
my_mc._rotation = angle;
_global.S.PlayASound("Field_Wind", 100, 1);
my_mc._visible = true;
my_mc.gotoAndPlay(2);
fallTime = FRAMES;
}
function decideNextChange() {
nextChangeTime = mathLib.randomRange(CHANGE_TIME_MIN, CHANGE_TIME_MAX);
}
function onEnterFrame() {
if (_global.BallLaunched) {
if (fallTime != -1) {
fallTime--;
if (fallTime <= 0) {
my_mc._visible = false;
my_mc.gotoAndStop(1);
fallTime = -1;
decideNextChange();
}
}
if (nextChangeTime != -1) {
nextChangeTime--;
if (nextChangeTime <= 0) {
doChange();
nextChangeTime = -1;
}
}
} else {
my_mc._visible = false;
my_mc.gotoAndStop(1);
fallTime = -1;
_global.FIELD_WIND_ANGLE = null;
}
}
static var FRAMES = 26;
static var CHANGE_TIME_MIN = 210;
static var CHANGE_TIME_MAX = 900;
var elementType = "FieldWind";
var probeIntervalBlock = 0;
var probeIntervalAffect = 0;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var fallTime = -1;
var nextChangeTime = -1;
}
Symbol 1301 MovieClip [__Packages.Tornado] Frame 0
class Tornado extends StageObject
{
var trappedBall, my_mc, affectPlayer, affectBall, blockPlayer, blockBall, affectElements, updateDepth, futureState, removeFromStage;
function Tornado (my_mc, fallTime) {
super(my_mc, my_mc.hit_mc, this);
trappedBall = null;
this.fallTime = fallTime;
this.my_mc.ball_mc._visible = false;
this.my_mc.gotoAndStop("Rise");
futureStateChange(RAISE_FRAMES, "Idle");
affectPlayer = true;
affectBall = false;
blockPlayer = false;
blockBall = false;
affectElements = true;
updateDepth();
enterFrame.addListener(this);
}
function setFallTime(fTime) {
fallTime = fTime;
}
function onEnterFrame() {
checkForStateChange();
if (fallTime != -1) {
fallTime--;
if (fallTime <= 0) {
releaseBall();
fall();
fallTime = -1;
}
}
if (trappedBall != null) {
tornadoSound--;
if (tornadoSound <= 0) {
_global.S.PlayASound("Tornado_Catch", 100, 1);
tornadoSound = 10;
}
}
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
}
function doAffectBall(l_oBall) {
if (fallTime != -1) {
_global.S.PlayASound("Tornado_Catch", 100, 1);
trappedBall = l_oBall;
my_mc.ball_mc._visible = true;
_global.COMPUTER_PLAYER_MANAGER.ballEnterTornado("Field");
l_oBall.pauseAndHide();
if (fallTime > 60) {
fallTime = 60;
}
}
}
function releaseBall() {
if (trappedBall != null) {
_global.S.PlayASound("Tornado_Release", 100, 1);
var _local6 = mathLib.randomRange(1, 2);
if (_local6 == 1) {
var _local3 = mathLib.randomRange(45, 135);
} else {
var _local3 = mathLib.randomRange(225, 315);
}
my_mc.ball_mc._visible = false;
var _local4 = my_mc._x + (Math.sin(mathLib.deg2rad(mathLib.angleClean(_local3))) * OUT_DIST);
var _local5 = (my_mc._y - 15) + (Math.cos(mathLib.deg2rad(mathLib.angleClean(_local3))) * OUT_DIST);
if (_local4 < MIN_X_DIST) {
_local4 = MIN_X_DIST;
}
_global.COMPUTER_PLAYER_MANAGER.ballExitTornado("Field");
trappedBall.changePosAngleAndSpeed(_local4, _local5, mathLib.angleClean(_local3), REJECT_SPEED);
trappedBall.moveAgain();
trappedBall = null;
}
}
function doAffectPlayer(l_playerType, l_oPlayer) {
if (l_playerType == "Air") {
l_oPlayer.energyFill(REFILL_RATE);
}
}
function futureStateChange(frames, state) {
stateChangeCountdown = frames - 1;
futureState = state;
}
function checkForStateChange() {
if (stateChangeCountdown != -1) {
if (stateChangeCountdown <= 0) {
if (futureState == "Idle") {
affectBall = true;
}
my_mc.gotoAndStop(futureState);
stateChangeCountdown = -1;
} else {
stateChangeCountdown--;
}
}
}
function fall() {
my_mc.gotoAndStop("Fall");
dieTime = FALL_FRAMES;
affectBall = false;
}
function die() {
removeFromStage();
my_mc.removeMovieClip();
enterFrame.removeListener(this);
}
function doAffectElement(l_element) {
if (l_element.elementType == "Flame") {
l_element.airGrow();
}
}
static var RAISE_FRAMES = 15;
static var FALL_FRAMES = 17;
static var REFILL_RATE = 1;
static var REJECT_SPEED = 12;
static var OUT_DIST = 5;
static var MIN_X_DIST = 15;
var elementType = "Tornado";
var probeIntervalBlock = 0;
var probeIntervalAffect = 6;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var fallTime = -1;
var dieTime = -1;
var tornadoSound = 10;
var stateChangeCountdown = -1;
}
Symbol 1302 MovieClip [__Packages.WaterMap] Frame 0
class WaterMap extends MapManager
{
var background_mc, scene_mc, wave, MM_deleteAll;
function WaterMap (scene_mc) {
super(scene_mc, "Water");
var _local3 = background_mc.wave_mc._x;
var _local4 = background_mc.wave_mc._y;
background_mc.wave_mc.swapDepths(1040000);
background_mc.wave_mc.removeMovieClip();
this.scene_mc.attachMovie("WaterWave", "wave_mc", 1045000);
this.scene_mc.wave_mc._x = _local3;
this.scene_mc.wave_mc._y = _local4;
this.scene_mc.wave_mc._visible = false;
wave = new Wave(this.scene_mc.wave_mc, this);
waveCountDown = mathLib.randomRange(WAVE_BURST_MIN_TIME, WAVE_BURST_MAX_TIME);
enterFrame.addListener(this);
}
function onEnterFrame() {
doWave();
}
function doWave() {
if ((waveCountDown != -1) && (_global.BallLaunched)) {
waveCountDown--;
if (waveCountDown <= 0) {
generateWave();
waveCountDown = -1;
}
}
}
function waveEnded() {
waveCountDown = mathLib.randomRange(WAVE_BURST_MIN_TIME, WAVE_BURST_MAX_TIME);
}
function generateWave() {
wave.launch();
}
function deleteAll() {
enterFrame.removeListener(this);
scene_mc.wave_mc.swapDepths(1);
scene_mc.wave_mc.removeMovieClip();
scene_mc.wave_mc = null;
delete scene_mc.wave_mc;
wave = null;
delete wave;
MM_deleteAll();
}
static var WAVE_BURST_MIN_TIME = 300;
static var WAVE_BURST_MAX_TIME = 900;
var waveCountDown = -1;
}
Symbol 1303 MovieClip [__Packages.Wave] Frame 0
class Wave extends StageObject
{
var my_mc, controler, affectPlayer, affectBall, blockPlayer, blockBall, affectElements;
function Wave (my_mc, controler) {
super(my_mc, my_mc.wave_mc.hit_mc, this);
this.my_mc._visible = false;
this.controler = controler;
affectPlayer = false;
affectBall = false;
blockPlayer = false;
blockBall = false;
affectElements = false;
}
function onEnterFrame() {
if (dieTime != -1) {
dieTime--;
if (dieTime <= 0) {
die();
dieTime = -1;
}
}
}
function launch() {
enterFrame.addListener(this);
affectPlayer = true;
affectBall = false;
affectElements = true;
_global.S.PlayASound("Field_Water", 100, 1);
my_mc._visible = true;
my_mc.wave_mc.gotoAndPlay(3);
dieTime = LIFE_FRAMES;
}
function doAffectPlayer(l_playerType, l_oPlayer) {
if (l_playerType == "Water") {
l_oPlayer.energyFill(REFILL_RATE);
}
l_oPlayer.waveHit();
}
function doAffectBall(l_oBall) {
l_oBall.waveHit();
}
function die() {
my_mc.wave_mc.gotoAndStop(1);
controler.waveEnded();
my_mc._visible = false;
affectBall = false;
affectPlayer = false;
affectElements = false;
enterFrame.removeListener(this);
}
function doAffectElement(l_element) {
if (l_element.elementType == "Flame") {
l_element.waterFall();
}
}
static var REFILL_RATE = 10;
static var LIFE_FRAMES = 64;
var elementType = "Wave";
var probeIntervalBlock = 0;
var probeIntervalAffect = 1;
var probeTimerBlock = 0;
var probeTimerAffect = 0;
var dieTime = -1;
}
Symbol 1304 MovieClip [__Packages.ComputerPlayer] Frame 0
class ComputerPlayer
{
var player, avatar, playerNum, targetPosition, ballSpeed, checkTargetPositionValidityCountDown, mindState, servicePositionChoosed, goodSpotChoosed, agressiveBehaviour, defensiveBehaviour, trackingDumbness;
function ComputerPlayer (scene_mc, playerNum, avatar) {
switch (avatar) {
case "Fire" :
player = new FirePlayer(scene_mc, playerNum, this);
break;
case "Water" :
player = new WaterPlayer(scene_mc, playerNum, this);
break;
case "Air" :
player = new AirPlayer(scene_mc, playerNum, this);
break;
case "Earth" :
player = new EarthPlayer(scene_mc, playerNum, this);
}
this.avatar = avatar;
this.playerNum = playerNum;
targetPosition = new Object();
ballSpeed = new Object();
targetPosition.x = player.returnCoord().x;
targetPosition.y = player.returnCoord().y;
ballSpeed.horz = 0;
ballSpeed.vert = 0;
ballSpeed.oldX = 0;
ballSpeed.oldY = 0;
castingInterval = CAST_CHECK_INTERVAL;
checkTargetPositionValidityCountDown = TARGET_VALIDITY_TIME;
_global.COMPUTER_PLAYER_MANAGER = this;
enterFrame.addListener(this);
}
function onEnterFrame() {
if (mindState == "ServiceBall") {
if (!servicePositionChoosed) {
chooseRandomServicePosition();
} else if (targetPosition.acheived) {
player.launchBall();
mindState = "FindGoodSpot";
} else {
validateChoosenServiceSpot();
}
goodSpotChoosed = false;
} else if (_global.B.returnIsActive()) {
if (_global.B.returnDirection() == playerNum) {
trackBall();
mindState = "TrackingBall";
goodSpotChoosed = false;
} else {
if (mindState == "TrackingBall") {
mindState = "Nothing";
}
chooseStateBallGoingAway();
}
} else if (needTrackPlayer) {
trackPlayer();
mindState = "TrackingPlayer";
} else if (servicePlayerWatch) {
watchPlayerAtService();
mindState = "watchingPlayer";
} else {
if (mindState == "TrackingBall") {
mindState = "Nothing";
}
if ((!goodSpotChoosed) && (mindState == "Nothing")) {
chooseGoodSpot();
}
}
checkTargetPositionValidity();
calculateBallSpeed();
checkVisualIdiocies();
checkFieldSpecial();
castingInterval--;
if (castingInterval <= 0) {
castingInterval = CAST_CHECK_INTERVAL;
if (mindState != "FindGoodSpot") {
if (mindState != "ServiceBall") {
doCastStuff();
}
}
}
if (trackPlayerForWhip) {
trackPlayerForWhipCountDown--;
if (trackPlayerForWhipCountDown <= 0) {
trackPlayerForWhip = false;
}
trackPlayer();
}
if (trackPlayerForRock) {
trackPlayerForRockCountDown--;
if (trackPlayerForRockCountDown <= 0) {
trackPlayerForRock = false;
}
trackPlayer();
}
waterWhipInterval--;
checkPosition();
checkCastedStuff();
}
function calculateBallSpeed() {
ballSpeed.horz = _global.B.returnCoord().x - ballSpeed.oldX;
ballSpeed.vert = _global.B.returnCoord().y - ballSpeed.oldY;
ballSpeed.oldX = _global.B.returnCoord().x;
ballSpeed.oldY = _global.B.returnCoord().y;
}
function chooseStateBallGoingAway() {
if ((_global.B.returnCoord().x + 20) < player.returnCoord().x) {
if ((!goodSpotChoosed) && (mindState == "Nothing")) {
chooseGoodSpot();
}
} else {
escapeBall();
}
}
function doCastStuff() {
switch (avatar) {
case "Fire" :
if (!firePlayerAttackActive) {
if (_global.B.returnDirection() != playerNum) {
if (_global.B.returnCoord().x < (_global.M.returnCenterPoint().x + 150)) {
if (Math.abs(_global.M.returnCenterPoint().x - _global.B.returnCoord().x) > 50) {
if ((mathLib.randomRange(1, 100) < FIRE_DO_WALL) && (player.energy > 50)) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
player.pressOffense();
firePlayerAttackActive = true;
firePlayerAttackCountDown = mathLib.randomRange(FIRE_OFF_MIN, FIRE_OFF_MAX);
}
}
}
}
}
}
if ((_global.B.returnDirection() == playerNum) && (_global.B.returnCoord().x < player.returnCoord().x)) {
if ((Math.abs(_global.B.returnCoord().x - player.returnCoord().x) < FirePlayer.FIRE_ARC_MAX_HORZ_DIST) && (Math.abs(_global.B.returnCoord().x - player.returnCoord().x) > 50)) {
if (mathLib.randomRange(1, 100) < FIRE_ARC_ATTACK) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
player.pressDefense();
}
}
}
}
break;
case "Water" :
var _local7 = false;
if ((_global.B.returnDirection() != playerNum) && (mindState != "ServiceBall")) {
var _local3 = _global.M.returnStageElements();
var _local6 = true;
var _local9 = 10;
var _local12 = 275;
var _local10 = _local12 / _local9;
var _local4 = 1;
while (_local4 <= _local9) {
var _local5 = player.returnCoord().x - (_local4 * _local10);
for (var _local8 in _local3) {
if (_local6) {
if (_local3[_local8].hit_mc.hitTest(_local5, player.returnCoord().y)) {
if ((_local3[_local8].elementType == "Flame") || (_local3[_local8].elementType == "Rock")) {
if ((_local3[_local8].returnFieldSide() == 0) || (_local3[_local8].returnFieldSide() == 2)) {
if (mathLib.randomRange(1, 100) < WATER_WHIP_OBJECTS) {
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
_local7 = true;
}
}
_local6 = false;
} else {
if (mathLib.randomRange(1, 100) < WATER_WHIP_OBJECTS_OTHER_SIDE) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
}
}
_local6 = false;
}
}
} else if (_global.P1.hitPlayer(_local5, player.returnCoord().y).hit) {
if (mathLib.randomRange(1, 100) < WATER_WHIP_OPPONENT) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
trackPlayerForWhip = true;
trackPlayerForWhipCountDown = PLAYER_TRACK_FOR_WHIP;
}
}
_local6 = false;
}
}
}
_local4++;
}
}
if (_local7 && (waterWhipInterval <= 0)) {
player.pressOffense();
waterWhipInterval = WATER_WHIP_INTERVAL;
targetPosition.x = player.returnCoord().x;
targetPosition.y = player.returnCoord().y;
targetPosition.acheived = true;
}
break;
case "Air" :
_local7 = false;
if (_global.B.returnIsActive()) {
if (Math.abs(_global.B.returnCoord().y - player.returnCoord().y) < 40) {
if (_global.B.returnCoord().x < (player.returnCoord().x - 150)) {
if (_global.B.returnDirection() == playerNum) {
if (_global.P1.returnCoord().x > _global.B.returnCoord().x) {
if (mathLib.randomRange(1, 100) < AIR_GUST_BEHIND_OPPONENT) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
}
}
} else if ((_global.P1.returnCoord().x + 100) > _global.B.returnCoord().x) {
if (mathLib.randomRange(1, 100) < AIR_GUST_RIGHT_IN_FACE_OPPONENT) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
}
}
} else if (mathLib.randomRange(1, 100) < AIR_GUST_NORMAL) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
}
}
}
}
}
}
if (_local7) {
player.pressOffense();
}
if ((airPlayerDefenseActive && (airDefGoodSpotChoosed)) && (targetPosition.acheived)) {
player.releaseDefense();
} else {
_local7 = false;
if ((_global.B.returnDirection() != playerNum) && (_global.B.returnCoord().x > player.returnCoord().x)) {
var _local13 = (_global.B.returnCoord().y - player.returnCoord().y) - VERT_DIST_CENTER_BALL;
var _local11 = _global.B.returnCoord().x - player.returnCoord().x;
if ((Math.abs(_local11) < 60) && (Math.abs(_local13) < 40)) {
if (mathLib.randomRange(1, 100) < AIR_DEF_CATCH_WHEN_LOSE_BALL) {
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
_local7 = true;
}
}
}
} else if (((_global.B.returnDirection() == playerNum) && ((player.returnCoord().x + 100) > _global.M.returnBounds().right)) && (_global.B.returnCoord().x > player.returnCoord().x)) {
if (mathLib.randomRange(1, 100) < AIR_DEF_CATCH_BEHIND) {
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
_local7 = true;
}
}
} else if (((_global.B.returnDirection() == playerNum) && (Math.abs(_global.B.returnCoord().y - player.returnCoord().y) < 85)) && ((player.returnCoord().x - _global.B.returnCoord().x) < 100)) {
if (mathLib.randomRange(1, 100) < AIR_DEF_CATCH_IN_FRONT) {
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
_local7 = true;
}
}
}
if (_local7) {
player.pressDefense();
mindState = "AIR_DEF";
airPlayerDefenseActive = true;
airPlayerDefenseCountDown = mathLib.randomRange(AIR_DEF_MIN, AIR_DEF_MAX);
}
}
break;
case "Earth" :
if (!((!earthPlayerAttackActive) && (mindState != "ServiceBall"))) {
break;
}
_local7 = false;
if (_global.B.returnDirection() == playerNum) {
break;
}
var _local6 = true;
var _local9 = 20;
var _local12 = player.returnCoord().x - _global.M.returnBounds().left;
var _local10 = _local12 / _local9;
var _local4 = 1;
while (_local4 <= _local9) {
var _local5 = player.returnCoord().x - (_local4 * _local10);
if (_local6) {
if (_global.P1.hitPlayer(_local5, player.returnCoord().y).hit) {
if ((mathLib.randomRange(1, 100) < EARTH_ROCK_OPPONENT) && (player.energy > 35)) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
trackPlayerForRock = true;
trackPlayerForRockCountDown = PLAYER_TRACK_FOR_ROCK;
}
}
_local6 = false;
}
}
_local4++;
}
if (!_local7) {
if (Math.abs(_global.B.returnCoord().y - player.returnCoord().y) < 30) {
if (Math.abs(_global.B.returnCoord().y - player.returnCoord().y) > 100) {
if (ballSpeed.horz < 0.5) {
if (mathLib.randomRange(1, 100) < EARTH_ROCK_BALL_NEAR) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
}
}
}
} else if (mathLib.randomRange(1, 100) < EARTH_ROCK_BALL) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
}
}
}
}
if (!_local7) {
if (mathLib.randomRange(1, 100) < EARTH_ROCK_NO_REASON) {
if (mathLib.randomRange(1, 100) <= agressiveBehaviour) {
_local7 = true;
}
}
}
if (!_local7) {
break;
}
player.pressOffense();
mindState = "ROCK_DEF";
earthPlayerAttackActive = true;
earthPlayerAttackCountDown = mathLib.randomRange(EARTH_OFF_MIN, EARTH_OFF_MAX);
}
}
function checkCastedStuff() {
if (firePlayerAttackActive) {
firePlayerAttackCountDown--;
if (_global.B.returnCoord().x > (_global.M.returnCenterPoint().x + 10)) {
firePlayerAttackCountDown = -1;
}
firePlayerAttackCountDown--;
if (firePlayerAttackCountDown <= 0) {
firePlayerAttackActive = false;
player.releaseOffense();
}
}
if (waterPlayerDefenseActive) {
waterPlayerDefenseCountDown--;
if (_global.B.returnDirection() != playerNum) {
waterPlayerDefenseCountDown--;
if (waterPlayerDefenseCountDown <= 0) {
waterPlayerDefenseActive = false;
player.releaseDefense();
}
}
}
if (airPlayerDefenseActive) {
airPlayerDefenseCountDown--;
if (airPlayerDefenseCountDown <= 0) {
airPlayerDefenseActive = false;
player.releaseDefense();
}
}
if (earthPlayerAttackActive) {
earthPlayerAttackCountDown--;
if (_global.B.returnDirection() == playerNum) {
if (Math.abs(_global.B.returnCoord().x - player.returnCoord().x) < 150) {
earthPlayerAttackCountDown = -1;
}
earthPlayerAttackCountDown = earthPlayerAttackCountDown - 3;
}
if (earthPlayerAttackCountDown <= 0) {
earthPlayerAttackActive = false;
player.releaseOffense();
}
}
}
function checkFieldSpecial() {
if (_global.MapType == "Air") {
var _local3 = targetPosition.y - player.returnCoord().y;
var _local4 = targetPosition.x - player.returnCoord().x;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > 40) {
targetPosition.acheived = false;
}
}
}
function checkTargetPositionValidity() {
checkTargetPositionValidityCountDown--;
if (checkTargetPositionValidityCountDown <= 0) {
checkTargetPositionValidityCountDown = TARGET_VALIDITY_TIME;
var _local6 = true;
var _local9 = targetPosition.y - player.returnCoord().y;
var _local10 = targetPosition.x - player.returnCoord().x;
var _local8 = Math.sqrt((_local9 * _local9) + (_local10 * _local10));
if (_local8 < (TARGET_VALIDITY_ITERATION * TARGET_VALIDITY_ITERATION_NUM)) {
if (_local8 < TARGET_VALIDITY_ITERATION) {
var _local3 = 0;
} else {
var _local3 = Math.floor(_local8 / TARGET_VALIDITY_ITERATION);
}
} else {
var _local3 = TARGET_VALIDITY_ITERATION_NUM;
}
var _local7 = Math.atan2(_local9, _local10);
if (_local3 == 0) {
_local6 = testPointForWalking(targetPosition.x, targetPosition.y);
} else {
var _local2 = 1;
while (_local2 <= _local3) {
if (_local6) {
var _local5;
var _local4;
_local5 = player.returnCoord().x + (Math.cos(_local7) * (TARGET_VALIDITY_ITERATION * _local3));
_local4 = player.returnCoord().y + (Math.sin(_local7) * (TARGET_VALIDITY_ITERATION * _local3));
_local6 = testPointForWalking(_local5, _local4);
}
_local2++;
}
}
if (!_local6) {
pathBlocked();
}
}
}
function pathBlocked() {
switch (mindState) {
case "TrackingBall" :
targetPosition.acheived = loosingBall(true);
break;
case "ServiceBall" :
forceService();
break;
case "protectGoal" :
targetPosition.acheived = loosingBall(true);
break;
case "FindGoodSpot" :
chooseGoodSpot();
break;
default :
targetPosition.acheived = true;
}
}
function forceService() {
player.launchBall();
mindState = "FindGoodSpot";
}
function loosingBall(blocked) {
var _local3 = true;
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
switch (avatar) {
case "Fire" :
var _local5 = player.returnCoord().x - _global.B.returnCoord().x;
if ((_local5 > 0) && (_local5 < FirePlayer.FIRE_ARC_MAX_HORZ_DIST)) {
player.pressDefense();
} else {
protectGoal();
}
_local3 = false;
break;
case "Earth" :
if (!blocked) {
if (Math.abs(player.returnCoord().x - _global.B.returnCoord().x) < (LOOSING_BALL_X_TRIGGER * 6)) {
var _local4 = false;
if (player.returnCoord().y > _global.M.returnCenterPoint().y) {
if (_global.B.returnCoord().y < player.returnCoord().y) {
_local4 = true;
}
} else if (player.returnCoord().y < _global.M.returnCenterPoint().y) {
if (_global.B.returnCoord().y > player.returnCoord().y) {
_local4 = true;
}
}
if (_local4) {
if (Math.abs(player.returnCoord().y - _global.B.returnCoord().y) > 35) {
if (Math.abs(player.returnCoord().y - _global.M.returnCenterPoint().y) > 50) {
player.pressDefense();
} else {
protectGoal();
}
} else {
protectGoal();
}
} else {
protectGoal();
}
} else {
protectGoal();
}
} else if (Math.abs(player.returnCoord().y - _global.M.returnCenterPoint().y) > 35) {
if (Math.abs(player.returnCoord().x - _global.M.returnBounds().right) > 20) {
player.pressDefense();
} else {
protectGoal();
}
} else {
protectGoal();
}
_local3 = false;
break;
case "Water" :
_local5 = _global.M.returnBounds().right - _global.B.returnCoord().x;
if (_local5 > 75) {
player.pressDefense();
waterPlayerDefenseActive = true;
waterPlayerDefenseCountDown = mathLib.randomRange(WATER_DEF_MIN, WATER_DEF_MAX);
}
_local3 = true;
}
}
return(_local3);
}
function testPointForWalking(x, y) {
var _local4 = _global.M.returnStageElements();
var _local7 = new Array();
var _local5 = new Array();
for (var _local10 in _local4) {
if (_local4[_local10].blockPlayer) {
var _local6 = _local4[_local10].returnFieldSide();
if ((_local6 == 0) || (_local6 == 2)) {
_local7.push(_local4[_local10]);
}
}
if (_local4[_local10].affectPlayer) {
var _local6 = _local4[_local10].returnFieldSide();
if ((_local6 == 0) || (_local6 == 2)) {
_local5.push(_local4[_local10]);
}
}
}
var _local3 = true;
for (var _local10 in _local7) {
if (_local3) {
if (_local7[_local10].hit_mc.hitTest(x, y)) {
_local3 = false;
}
}
}
if (_local3) {
for (var _local10 in _local5) {
if (_local3) {
if (_local5[_local10].hit_mc.hitTest(x, y)) {
switch (_local5[_local10].elementType) {
case "Flame" :
if (avatar != "Fire") {
_local3 = false;
}
break;
case "Fouet" :
_local3 = false;
break;
case "Magma" :
if (avatar != "Fire") {
_local3 = false;
}
break;
case "Bonus" :
if (avatar != _local5[_local10].bonusType) {
if (mathLib.randomRange(1, 100) > BAD_BONUS_TAKE) {
_local3 = false;
}
}
break;
case "QuickSands" :
if (avatar == "Earth") {
break;
}
if (mathLib.randomRange(1, 100) <= GOES_IN_QUICKSAND) {
break;
}
_local3 = false;
}
}
}
}
}
return(_local3);
}
function checkVisualIdiocies() {
if (!targetPosition.acheived) {
if (targetPosition.x > _global.M.returnBounds().right) {
targetPosition.x = _global.M.returnBounds().right - 5;
} else if (targetPosition.x < _global.M.returnCenterPoint().x) {
targetPosition.x = _global.M.returnCenterPoint().x + 5;
}
if (targetPosition.y > _global.M.returnBounds().bottom) {
targetPosition.y = _global.M.returnBounds().bottom - 5;
} else if (targetPosition.y < _global.M.returnBounds().top) {
targetPosition.y = _global.M.returnBounds().top + 5;
}
}
}
function protectGoal() {
if ((Math.abs((player.returnCoord().x - _global.M.returnBounds().right) - 20) > 5) && (Math.abs((player.returnCoord().y - _global.M.returnCenterPoint().y) + VERT_DIST_CENTER_BALL) > 5)) {
mindState = "ProtectGoal";
targetPosition.x = _global.M.returnBounds().right - 20;
targetPosition.y = _global.M.returnCenterPoint().y + VERT_DIST_CENTER_BALL;
targetPosition.acheived = false;
goodSpotChoosed = true;
} else {
mindState = "Nothing";
}
}
function airDefFindGoodSpot() {
if (((_global.MapType == avatar) || (_global.MapType == "Water")) || (_global.MapType == "Air")) {
var _local7 = _global.M.returnCenterPoint().x + 25;
} else {
var _local7 = _global.M.returnCenterPoint().x + 125;
}
var _local5 = _global.M.returnBounds().right - 25;
var _local8 = _global.M.returnBounds().top + 25;
var _local6 = _global.M.returnBounds().bottom - 25;
var _local4 = mathLib.randomRange(_local7, _local5);
var _local3 = mathLib.randomRange(_local8, _local6);
targetPosition.x = _local4;
targetPosition.y = _local3;
targetPosition.acheived = false;
airDefGoodSpotChoosed = true;
}
function chooseGoodSpotForReceiveService() {
if (((_global.MapType == avatar) || (_global.MapType == "Water")) || (_global.MapType == "Air")) {
var _local7 = _global.M.returnCenterPoint().x + 25;
} else {
var _local7 = _global.M.returnCenterPoint().x + 125;
}
var _local5 = _global.M.returnBounds().right - 25;
var _local8 = _global.M.returnBounds().top + 100;
var _local6 = _global.M.returnBounds().bottom - 100;
var _local4 = mathLib.randomRange(_local7, _local5);
var _local3 = mathLib.randomRange(_local8, _local6);
targetPosition.x = _local4;
targetPosition.y = _local3;
targetPosition.acheived = false;
}
function chooseGoodSpot() {
if (player.energy < 80) {
if ((mindState != "TrackingBall") && (mindState != "GoodSpotAcheived")) {
if (((_global.MapType == avatar) || (_global.MapType == "Water")) || (_global.MapType == "Air")) {
var _local14 = _global.M.returnCenterPoint().x + 25;
} else {
var _local14 = _global.M.returnCenterPoint().x + 125;
}
var _local12 = _global.M.returnBounds().right - 25;
var _local15 = _global.M.returnBounds().top + 25;
var _local13 = _global.M.returnBounds().bottom - 25;
var _local5 = _global.M.returnStageElements();
var _local4 = new Array();
for (var _local9 in _local5) {
if (_local5[_local9].affectPlayer) {
var _local6 = _local5[_local9].returnFieldSide();
if ((_local6 == 0) || (_local6 == 2)) {
_local4.push({rndNum:mathLib.randomRange(1, 9999999999), obj:_local5[_local9]});
}
}
}
_local4.sortOn("rndNum");
var _local3 = true;
for (var _local9 in _local4) {
if (_local3) {
switch (_local4[_local9].obj.elementType) {
case "Flame" :
if (avatar == "Fire") {
_local3 = false;
}
break;
case "Stone" :
if (avatar == "Earth") {
_local3 = false;
}
break;
case "Magma" :
if (avatar == "Fire") {
if (mathLib.randomRange(1, 100) < FIRE_HEAD_TO_MAGMA) {
_local3 = false;
}
}
break;
case "Bonus" :
if (avatar == _local4[_local9].obj.bonusType) {
_local3 = false;
}
break;
case "QuickSands" :
if (avatar == "Earth") {
if (mathLib.randomRange(1, 100) < EARTH_HEAD_TO_QUICKSANDS) {
_local3 = false;
}
}
break;
case "Tornado" :
if (avatar != "Air") {
break;
}
_local3 = false;
}
if (!_local3) {
if (mathLib.randomRange(1, 100) < ((100 - player.energy) + MOVE_TO_GET_ENERGY_ADDITION)) {
mindState = "FindGoodSpot";
targetPosition.x = _local4[_local9].obj.returnCoord().x;
targetPosition.y = _local4[_local9].obj.returnCoord().y;
targetPosition.acheived = false;
goodSpotChoosed = true;
}
}
}
}
if (_local3) {
var _local11 = mathLib.randomRange(_local14, _local12);
var _local10 = mathLib.randomRange(_local15, _local13);
targetPosition.x = _local11;
targetPosition.y = _local10;
targetPosition.acheived = false;
goodSpotChoosed = true;
}
}
}
}
function chooseRandomServicePosition() {
if (((_global.MapType == avatar) || (_global.MapType == "Water")) || (_global.MapType == "Air")) {
var _local7 = _global.M.returnCenterPoint().x + 25;
} else {
var _local7 = _global.M.returnCenterPoint().x + 125;
}
var _local5 = _global.M.returnBounds().right - 25;
var _local8 = _global.M.returnBounds().top + 25;
var _local6 = _global.M.returnBounds().bottom - 25;
var _local4 = mathLib.randomRange(_local7, _local5);
var _local3 = mathLib.randomRange(_local8, _local6);
targetPosition.x = _local4;
targetPosition.y = _local3;
targetPosition.acheived = false;
servicePositionChoosed = true;
}
function escapeBall() {
var _local3 = _global.B.returnCoord().y - player.returnCoord().y;
var _local4 = _global.B.returnCoord().x - player.returnCoord().x;
if (player.returnCoord().y > _global.M.returnCenterPoint().y) {
targetPosition.y = player.returnCoord().y - _local3;
} else {
targetPosition.y = player.returnCoord().y + _local3;
}
if (_local4 > 0) {
if (_local4 > 40) {
targetPosition.x = player.returnCoord().x + 50;
} else if (Math.abs(_local3) < 30) {
targetPosition.x = player.returnCoord().x - 20;
}
}
}
function validateChoosenServiceSpot() {
var _local3 = Math.abs(_global.P1.returnCoord().x - player.returnCoord().x);
if (_local3 < 150) {
targetPosition.x = player.returnCoord().x + 15;
}
}
function watchPlayerAtService() {
var _local3 = (_global.P1.returnCoord().y - player.returnCoord().y) - VERT_DIST_CENTER_BALL;
var _local4 = Math.abs(_global.P1.returnCoord().x - player.returnCoord().x);
if ((_local3 > 80) || (_local3 < -80)) {
targetPosition.acheived = false;
targetPosition.y = _global.P1.returnCoord().y;
}
if (_local4 < 100) {
targetPosition.acheived = false;
targetPosition.x = player.returnCoord().x + 15;
}
}
function trackPlayer() {
var _local3 = (_global.P1.returnCoord().y - player.returnCoord().y) - VERT_DIST_CENTER_BALL;
var _local4 = Math.abs(_global.P1.returnCoord().x - player.returnCoord().x);
if ((_local3 > 10) || (_local3 < -10)) {
targetPosition.acheived = false;
targetPosition.y = _global.P1.returnCoord().y;
}
if (_local4 < 100) {
targetPosition.acheived = false;
targetPosition.x = player.returnCoord().x + 15;
}
}
function trackBall() {
if (mindState != "protectGoal") {
var _local4 = (_global.B.returnCoord().y - player.returnCoord().y) - VERT_DIST_CENTER_BALL;
var _local3 = _global.B.returnCoord().x - player.returnCoord().x;
if (ballSpeed.vert > (ballSpeed.horz * 0.8)) {
protectGoal();
} else {
if ((Math.abs(_local4 + VERT_DIST_CENTER_BALL) > LOOSING_BALL_Y_TRIGGER) && (Math.abs(_local3) < LOOSING_BALL_X_TRIGGER)) {
loosingBall();
} else if ((Math.abs((_local4 / 2) + VERT_DIST_CENTER_BALL) > (LOOSING_BALL_Y_TRIGGER / 2)) && (Math.abs(_local3 / 2) < (LOOSING_BALL_X_TRIGGER / 2))) {
loosingBall();
}
targetPosition.acheived = false;
var _local5 = (_local3 / ballSpeed.horz) * (-ballSpeed.vert);
targetPosition.y = (_global.B.returnCoord().y + _local5) + VERT_DIST_CENTER_BALL;
targetPosition.x = targetPosition.x + (random(trackingDumbness * 2) - trackingDumbness);
targetPosition.y = targetPosition.y + (random(trackingDumbness * 2) - trackingDumbness);
if (_local3 < -15) {
if (_local3 < -100) {
if (mathLib.randomRange(1, 100) <= APPROCH_TO_TAKE_BALL) {
targetPosition.x = _global.M.returnCenterPoint().x + 150;
}
} else if (_local3 > -30) {
targetPosition.x = _global.M.returnBounds().right - 25;
}
} else {
targetPosition.x = _global.B.returnCoord().x + 50;
if (player.returnCoord().y > _global.B.returnCoord().y) {
if (player.returnCoord().y < _global.M.returnCenterPoint().y) {
targetPosition.y = _global.B.returnCoord().y + 50;
} else {
targetPosition.y = _global.B.returnCoord().y - 50;
}
} else if (player.returnCoord().y < _global.M.returnCenterPoint().y) {
targetPosition.y = _global.B.returnCoord().y - 50;
} else {
targetPosition.y = _global.B.returnCoord().y + 50;
}
}
}
}
}
function checkPosition() {
if (!targetPosition.acheived) {
var _local2 = targetPosition.y - player.returnCoord().y;
var _local3 = targetPosition.x - player.returnCoord().x;
if (_local2 < -3) {
player.changeYMoveState("MoveUp");
} else if (_local2 > 3) {
player.changeYMoveState("MoveDown");
} else {
player.changeYMoveState("yIdle");
}
if (_local3 < -3) {
player.changeXMoveState("MoveLeft");
} else if (_local3 > 3) {
player.changeXMoveState("MoveRight");
} else {
player.changeXMoveState("xIdle");
}
if ((Math.abs(_local3) < 5) && (Math.abs(_local2) < 5)) {
if (mindState == "FindGoodSpot") {
mindState = "GoodSpotAcheived";
}
targetPosition.acheived = true;
}
} else {
player.changeXMoveState("xIdle");
player.changeYMoveState("yIdle");
}
}
function ballExitTornado(l_type) {
if (l_type != "Field") {
needTrackPlayer = false;
}
}
function ballEnterTornado(l_type) {
if (l_type == "Field") {
if (_global.B.returnCoord().x > _global.M.returnCenterPoint().x) {
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
targetPosition.acheived = false;
targetPosition.x = _global.M.returnBounds().right - (((_global.M.returnBounds().right - 20) - _global.B.returnCoord().x) / 2);
targetPosition.y = (_global.M.returnCenterPoint().y - ((_global.M.returnCenterPoint().y - _global.B.returnCoord().y) / 2)) + VERT_DIST_CENTER_BALL;
}
} else if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
protectGoal();
}
} else if (!airPlayerDefenseActive) {
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
needTrackPlayer = true;
}
}
}
function returnCoord() {
return(player.returnCoord());
}
function getBallPossession() {
mindState = "ServiceBall";
servicePositionChoosed = false;
player.getBallPossession();
}
function endRound() {
player.endRound();
targetPosition.x = player.returnCoord().x;
targetPosition.y = player.returnCoord().y;
targetPosition.acheived = true;
}
function newRound() {
player.newRound();
switch (TournamentControler.returnMatchNum()) {
case 1 :
trackingDumbness = TRACKING_DUMBNESS_LEVEL_1;
switch (avatar) {
case "Fire" :
agressiveBehaviour = FIRE_AGRESSIVITY_LEVEL_1;
defensiveBehaviour = FIRE_DEFENSIVITY_LEVEL_1;
break;
case "Water" :
agressiveBehaviour = WATER_AGRESSIVITY_LEVEL_1;
defensiveBehaviour = WATER_DEFENSIVITY_LEVEL_1;
break;
case "Air" :
agressiveBehaviour = AIR_AGRESSIVITY_LEVEL_1;
defensiveBehaviour = AIR_DEFENSIVITY_LEVEL_1;
break;
case "Earth" :
agressiveBehaviour = EARTH_AGRESSIVITY_LEVEL_1;
defensiveBehaviour = EARTH_DEFENSIVITY_LEVEL_1;
}
break;
case 2 :
trackingDumbness = TRACKING_DUMBNESS_LEVEL_2;
switch (avatar) {
case "Fire" :
agressiveBehaviour = FIRE_AGRESSIVITY_LEVEL_2;
defensiveBehaviour = FIRE_DEFENSIVITY_LEVEL_2;
break;
case "Water" :
agressiveBehaviour = WATER_AGRESSIVITY_LEVEL_2;
defensiveBehaviour = WATER_DEFENSIVITY_LEVEL_2;
break;
case "Air" :
agressiveBehaviour = AIR_AGRESSIVITY_LEVEL_2;
defensiveBehaviour = AIR_DEFENSIVITY_LEVEL_2;
break;
case "Earth" :
agressiveBehaviour = EARTH_AGRESSIVITY_LEVEL_2;
defensiveBehaviour = EARTH_DEFENSIVITY_LEVEL_2;
}
break;
case 3 :
trackingDumbness = TRACKING_DUMBNESS_LEVEL_2;
switch (avatar) {
case "Fire" :
agressiveBehaviour = FIRE_AGRESSIVITY_LEVEL_3;
defensiveBehaviour = FIRE_DEFENSIVITY_LEVEL_3;
break;
case "Water" :
agressiveBehaviour = WATER_AGRESSIVITY_LEVEL_3;
defensiveBehaviour = WATER_DEFENSIVITY_LEVEL_3;
break;
case "Air" :
agressiveBehaviour = AIR_AGRESSIVITY_LEVEL_3;
defensiveBehaviour = AIR_DEFENSIVITY_LEVEL_3;
break;
case "Earth" :
agressiveBehaviour = EARTH_AGRESSIVITY_LEVEL_3;
defensiveBehaviour = EARTH_DEFENSIVITY_LEVEL_3;
}
}
if (mindState != "ServiceBall") {
if (mathLib.randomRange(1, 100) <= CHANGE_POSITION_RECEIVE_SERVICE) {
chooseGoodSpotForReceiveService();
}
if (mathLib.randomRange(1, 100) <= WATCH_PLAYER_SERVICE) {
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
servicePlayerWatch = true;
}
} else if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
servicePlayerWatch = false;
}
}
}
function hitPaddle(x, y, hitAngle) {
return(player.hitPaddle(x, y, hitAngle));
}
function COMP_fireWallStage3() {
if (avatar == "Water") {
if (mathLib.randomRange(1, 100) < WATER_CAST_WALL_FIREWALL) {
if (mathLib.randomRange(1, 100) <= defensiveBehaviour) {
player.pressDefense();
waterPlayerDefenseActive = true;
waterPlayerDefenseCountDown = mathLib.randomRange(WATER_DEF_MIN, WATER_DEF_MAX);
}
}
}
}
function COMP_AirTornadoTrapBall() {
airPlayerDefenseCountDown = AIR_DEF_MAX_HOLD;
airDefFindGoodSpot();
}
function doNewRound() {
player.releaseDefense();
player.releaseOffense();
player.LEGS_currentState = "COMP_RESET";
player.changeXMoveState("xIdle");
player.changeYMoveState("yIdle");
}
function CI_deleteAll() {
enterFrame.removeListener(this);
_global.COMPUTER_PLAYER_MANAGER = null;
delete _global.COMPUTER_PLAYER_MANAGER;
player = null;
delete player;
}
static var CHANGE_POSITION_RECEIVE_SERVICE = 50;
static var WATCH_PLAYER_SERVICE = 60;
static var BAD_BONUS_TAKE = 60;
static var GOES_IN_QUICKSAND = 30;
static var MOVE_TO_GET_ENERGY_ADDITION = 10;
static var LOOSING_BALL_X_TRIGGER = 20;
static var LOOSING_BALL_Y_TRIGGER = 80;
static var APPROCH_TO_TAKE_BALL = 30;
static var TARGET_VALIDITY_TIME = 10;
static var TARGET_VALIDITY_ITERATION = 10;
static var TARGET_VALIDITY_ITERATION_NUM = 5;
static var VERT_DIST_CENTER_BALL = 25;
var servicePlayerWatch = false;
var needTrackPlayer = false;
static var TRACKING_DUMBNESS_LEVEL_1 = 65;
static var TRACKING_DUMBNESS_LEVEL_2 = 35;
static var TRACKING_DUMBNESS_LEVEL_3 = 0;
static var FIRE_AGRESSIVITY_LEVEL_1 = 5;
static var FIRE_AGRESSIVITY_LEVEL_2 = 50;
static var FIRE_AGRESSIVITY_LEVEL_3 = 100;
static var FIRE_DEFENSIVITY_LEVEL_1 = 5;
static var FIRE_DEFENSIVITY_LEVEL_2 = 50;
static var FIRE_DEFENSIVITY_LEVEL_3 = 100;
static var WATER_AGRESSIVITY_LEVEL_1 = 10;
static var WATER_AGRESSIVITY_LEVEL_2 = 50;
static var WATER_AGRESSIVITY_LEVEL_3 = 100;
static var WATER_DEFENSIVITY_LEVEL_1 = 15;
static var WATER_DEFENSIVITY_LEVEL_2 = 50;
static var WATER_DEFENSIVITY_LEVEL_3 = 100;
static var AIR_AGRESSIVITY_LEVEL_1 = 5;
static var AIR_AGRESSIVITY_LEVEL_2 = 50;
static var AIR_AGRESSIVITY_LEVEL_3 = 100;
static var AIR_DEFENSIVITY_LEVEL_1 = 10;
static var AIR_DEFENSIVITY_LEVEL_2 = 50;
static var AIR_DEFENSIVITY_LEVEL_3 = 100;
static var EARTH_AGRESSIVITY_LEVEL_1 = 5;
static var EARTH_AGRESSIVITY_LEVEL_2 = 50;
static var EARTH_AGRESSIVITY_LEVEL_3 = 100;
static var EARTH_DEFENSIVITY_LEVEL_1 = 20;
static var EARTH_DEFENSIVITY_LEVEL_2 = 50;
static var EARTH_DEFENSIVITY_LEVEL_3 = 100;
static var CAST_CHECK_INTERVAL = 8;
var castingInterval = 0;
var waterPlayerDefenseActive = false;
var waterPlayerDefenseCountDown = 0;
var trackPlayerForWhipCountDown = 0;
var trackPlayerForWhip = false;
static var PLAYER_TRACK_FOR_WHIP = 35;
static var WATER_DEF_MIN = 25;
static var WATER_DEF_MAX = 55;
static var WATER_CAST_WALL_FIREWALL = 65;
static var WATER_WHIP_OBJECTS = 65;
static var WATER_WHIP_OBJECTS_OTHER_SIDE = 35;
static var WATER_WHIP_OPPONENT = 140;
var waterWhipInterval = 0;
static var WATER_WHIP_INTERVAL = 35;
var airPlayerDefenseActive = false;
var airPlayerDefenseCountDown = 0;
var airDefGoodSpotChoosed = false;
static var AIR_DEF_MIN = 10;
static var AIR_DEF_MAX = 35;
static var AIR_DEF_MAX_HOLD = 80;
static var AIR_DEF_CATCH_IN_FRONT = 20;
static var AIR_DEF_CATCH_BEHIND = 50;
static var AIR_DEF_CATCH_WHEN_LOSE_BALL = 55;
static var AIR_GUST_NORMAL = 55;
static var AIR_GUST_BEHIND_OPPONENT = 20;
static var AIR_GUST_RIGHT_IN_FACE_OPPONENT = 10;
var earthPlayerAttackActive = false;
var earthPlayerAttackCountDown = 0;
var trackPlayerForRockCountDown = 0;
var trackPlayerForRock = false;
static var EARTH_OFF_MIN = 25;
static var EARTH_OFF_MAX = 55;
static var PLAYER_TRACK_FOR_ROCK = 35;
static var EARTH_ROCK_NO_REASON = 15;
static var EARTH_ROCK_BALL = 20;
static var EARTH_ROCK_BALL_NEAR = 10;
static var EARTH_ROCK_OPPONENT = 15;
static var EARTH_HEAD_TO_QUICKSANDS = 40;
var firePlayerAttackActive = false;
var firePlayerAttackCountDown = 0;
static var FIRE_OFF_MIN = 25;
static var FIRE_OFF_MAX = 120;
static var FIRE_DO_WALL = 10;
static var FIRE_ARC_ATTACK = 40;
static var FIRE_HEAD_TO_MAGMA = 40;
}
Symbol 5 Button
on (keyPress "<Left>") {
return(undefined);
}
on (keyPress "<Right>") {
return(undefined);
}
on (keyPress "<Up>") {
return(undefined);
}
on (keyPress "<Down>") {
return(undefined);
}
Symbol 76 MovieClip Frame 1
stop();
Symbol 799 Button
on (release) {
_global.S.PlayASound("Clic1", 40);
_global.InstructionsScreen.gotoAndStop(1);
_global.InstructionsScreen._visible = true;
}
Symbol 801 Button
on (release) {
playMode_mc.gotoAndStop("PopUp");
_global.S.PlayASound("Clic1", 40);
}
Symbol 815 Button
on (release) {
TournamentControler.setGameTwoPlayers(true);
gotoAndStop ("2P");
_global.S.PlayASound("Clic2", 40);
}
Symbol 819 Button
on (release) {
TournamentControler.setGameTwoPlayers(false);
gotoAndStop ("1P");
_global.S.PlayASound("Clic2", 40);
}
Symbol 826 Button
on (release) {
_global.Main_Pack_TimeLine.gotoAndStop("Choose");
_global.S.PlayASound("Clic1", 40);
}
Symbol 827 Button
on (release) {
TournamentControler.setGameTwoPlayers(true);
gotoAndStop ("2P");
}
Symbol 829 Button
on (release) {
TournamentControler.setGameTwoPlayers(false);
gotoAndStop ("1P");
}
Symbol 830 MovieClip Frame 1
stop();
choosed = false;
gotoAndStop ("1P");
TournamentControler.setGameTwoPlayers(false);
Symbol 830 MovieClip Frame 9
stop();
choosed = true;
Symbol 830 MovieClip Frame 21
stop();
choosed = true;
Symbol 833 MovieClip Frame 1
stop();
Symbol 833 MovieClip Frame 2
stop();
EmptyBtn.useHandCursor = false;
catch_btn.useHandCursor = false;
Symbol 837 Button
on (release) {
nextFrame();
_global.S.PlayASound("Clic1", 40);
}
Symbol 855 Button
on (release) {
prevFrame();
_global.S.PlayASound("Clic1", 40);
}
Symbol 864 Button
on (release) {
this._visible = false;
TournamentControler.UnpauseGame();
_global.S.PlayASound("Clic1", 40);
}
Symbol 865 MovieClip Frame 1
EmptyBtn.useHandCursor = false;
stop();
Symbol 912 Button
on (rollOver) {
_global.S.SetVolume("Pack_Eau", 80);
_global.S.SetVolume("Pack_Feu", 80);
_global.S.SetVolume("Pack_Terre", 80);
_global.S.SetVolume("Pack_Air", 100);
_global.S.PlayASound("Pack_Air", 100);
}
on (release) {
if (_parent.gameTwoPlayers) {
_parent.air_2P_Click();
} else if (_parent.air_mc._currentframe == 1) {
_parent.setNation("Air");
}
}
Symbol 923 Button
on (rollOver) {
_global.S.SetVolume("Pack_Eau", 100);
_global.S.SetVolume("Pack_Feu", 80);
_global.S.SetVolume("Pack_Terre", 80);
_global.S.SetVolume("Pack_Air", 80);
_global.S.PlayASound("Pack_Eau", 100);
}
on (release) {
if (_parent.gameTwoPlayers) {
_parent.water_2P_Click();
} else if (_parent.water_mc._currentframe == 1) {
_parent.setNation("Water");
}
}
Symbol 930 Button
on (rollOver) {
_global.S.SetVolume("Pack_Eau", 80);
_global.S.SetVolume("Pack_Feu", 100);
_global.S.SetVolume("Pack_Terre", 80);
_global.S.SetVolume("Pack_Air", 80);
_global.S.PlayASound("Pack_Feu", 100);
}
on (release) {
if (_parent.gameTwoPlayers) {
_parent.fire_2P_Click();
} else if (_parent.fire_mc._currentframe == 1) {
_parent.setNation("Fire");
}
}
Symbol 945 Button
on (rollOver) {
_global.S.SetVolume("Pack_Eau", 80);
_global.S.SetVolume("Pack_Feu", 80);
_global.S.SetVolume("Pack_Terre", 100);
_global.S.SetVolume("Pack_Air", 80);
_global.S.PlayASound("Pack_Terre", 100);
}
on (release) {
if (_parent.gameTwoPlayers) {
_parent.earth_2P_Click();
} else if (_parent.earth_mc._currentframe == 1) {
_parent.setNation("Earth");
}
}
Symbol 947 Button
on (release) {
if (p1Nation != "") {
_global.S.PlayASound("Clic1", 40);
if (gameTwoPlayers) {
if (p2Nation != "") {
TournamentControler.setPlayer1(p1Nation);
TournamentControler.setPlayer2(p2Nation);
gotoAndStop ("Game");
}
} else {
TournamentControler.setPlayer1(p1Nation);
useTuto_mc.gotoAndStop("PopUp");
useTuto_mc.useTuto_mc.master_mc.gotoAndStop(p1Nation);
}
}
}
Symbol 952 MovieClip Frame 1
stop();
Symbol 952 MovieClip Frame 2
stop();
Symbol 952 MovieClip Frame 3
stop();
Symbol 952 MovieClip Frame 4
stop();
Symbol 975 MovieClip Frame 1
stop();
this.gotoAndStop(TournamentControler.returnPlayer1Avatar());
Symbol 981 Button
on (release) {
_global.Main_Pack_TimeLine.gotoAndStop("Game");
_global.S.PlayASound("Clic1", 40);
}
Symbol 986 Button
on (release) {
_global.Main_Pack_TimeLine.gotoAndStop("Tutorial");
_global.S.PlayASound("Clic1", 40);
}
Symbol 988 MovieClip Frame 1
stop();
Symbol 988 MovieClip Frame 2
stop();
catch_btn.useHandCursor = false;
Symbol 1021 Button
on (release) {
_global.Main_Pack_TimeLine.gotoAndStop("Game");
_global.S.PlayASound("Clic1", 40);
}
Symbol 1022 MovieClip Frame 1
stop();
Symbol 1051 MovieClip Frame 1
stop();
Symbol 1063 MovieClip Frame 95
stop();
Symbol 1083 MovieClip Frame 21
stop();
Symbol 1088 MovieClip Frame 1
stop();
Symbol 1096 MovieClip Frame 65
stop();
Symbol 1110 MovieClip Frame 1
stop();
Symbol 1111 MovieClip Frame 1
stop();
this.gotoAndStop(TournamentControler.returnPlayer1Avatar());
Symbol 1123 Button
on (release) {
_global.S.PlayASound("Clic1", 40);
TournamentControler.PauseGame();
_global.InstructionsScreen.gotoAndStop(1);
_global.InstructionsScreen._visible = true;
}
Symbol 1126 Button
on (release) {
_global.S.PlayASound("Clic2", 40);
if (_global.Muted) {
_global.S.UnMute();
} else {
_global.S.ToMute();
}
}
Symbol 1133 Button
on (release) {
_global.S.PlayASound("Clic1", 40);
TournamentControler.PauseGame();
TournamentControler.fGetQuitPopup();
}
Symbol 1134 Button
on (release) {
_global.S.PlayASound("Clic1", 40);
if (_global.Muted) {
_global.S.UnMute();
} else {
_global.S.ToMute();
}
}
Symbol 1135 MovieClip Frame 2
stop();
Symbol 1166 MovieClip Frame 1
stop();
Symbol 1171 Button
on (release) {
TournamentControler.returnOkFromExplain();
_global.S.PlayASound("Clic1", 40);
}
Symbol 1172 MovieClip Frame 1
stop();
Symbol 1172 MovieClip Frame 2
stop();
Instance of Symbol 1169 MovieClip "VsPanel" in Symbol 1172 MovieClip Frame 2
onClipEvent (keyUp) {
TournamentControler.returnOkFromExplain();
}
Instance of Symbol 1184 MovieClip in Symbol 1188 MovieClip Frame 1
onClipEvent (load) {
switch (TournamentControler.returnPlayer2Avatar()) {
case "Earth" :
this.gotoAndStop(2);
break;
case "Water" :
this.gotoAndStop(4);
break;
case "Air" :
this.gotoAndStop(1);
break;
case "Fire" :
this.gotoAndStop(3);
}
}
Symbol 1196 Button
on (release) {
TournamentControler.exitTournament();
_global.S.PlayASound("Clic1", 40);
}
Instance of Symbol 1213 MovieClip in Symbol 1217 MovieClip Frame 1
onClipEvent (load) {
switch (TournamentControler.returnPlayer1Avatar()) {
case "Earth" :
this.gotoAndStop(2);
break;
case "Water" :
this.gotoAndStop(4);
break;
case "Air" :
this.gotoAndStop(1);
break;
case "Fire" :
this.gotoAndStop(3);
}
}
Symbol 1218 Button
on (release) {
TournamentControler.exitTournament();
_global.S.PlayASound("Clic1", 40);
}
Instance of Symbol 1184 MovieClip in Symbol 1219 MovieClip Frame 1
onClipEvent (load) {
switch (TournamentControler.getWinner()) {
case "Earth" :
this.gotoAndStop(2);
break;
case "Water" :
this.gotoAndStop(4);
break;
case "Air" :
this.gotoAndStop(1);
break;
case "Fire" :
this.gotoAndStop(3);
}
}
Symbol 1220 MovieClip Frame 1
stop();
Symbol 1220 MovieClip Frame 2
submit_btn._visible = false;
if (_global.gProxyObj.getIsLoggedIn()) {
submit_btn._visible = true;
}
if (_global.HS.G_ShowHighScore == false) {
submit_btn._visible = false;
view_btn._visible = false;
}
stop();
Symbol 1220 MovieClip Frame 3
stop();
play_mc.onRelease = function () {
TournamentControler.exitTournament();
};
Symbol 1220 MovieClip Frame 4
stop();
play_mc.onRelease = function () {
TournamentControler.exitTournament();
};
Symbol 1223 Button
on (release) {
TournamentControler.fQuitGame();
_global.S.PlayASound("Clic1", 40);
}
Symbol 1224 Button
on (release) {
this.gotoAndStop("EMPTY");
TournamentControler.UnpauseGame();
_global.S.PlayASound("Clic1", 40);
}
Symbol 1227 MovieClip Frame 1
stop();
Symbol 1227 MovieClip Frame 2
stop();
btnBlocker.useHandCursor = false;
Symbol 1243 Button
on (press) {
ControlScroll.scrollDown = true;
}
on (release, releaseOutside) {
ControlScroll.scrollDown = false;
}
Symbol 1258 Button
on (press) {
ControlScroll.scrollUp = true;
}
on (release, releaseOutside) {
ControlScroll.scrollUp = false;
}
Symbol 1267 Button
on (release) {
_global.SCORE_TO_SUBMIT = null;
_global.SCORE_AUTO_SUBMIT = null;
_global.SCORE_CHAR_TO_SHOW = null;
delete _global.SCORE_TO_SUBMIT;
delete _global.SCORE_AUTO_SUBMIT;
delete _global.SCORE_CHAR_TO_SHOW;
gotoAndStop ("Menu");
_global.S.PlayASound("Clic1", 40);
}