Frame 1
function chooseGameEndProcedure() {
if (tKey == undefined) {
tKey = "sjri5jf85jdor560";
}
gameEndSubmitUrl = "http://freeplay.gamedek.com/gameend.aspx";
if (params == undefined) {
myVariables.load("config.txt");
} else {
decryptParams(params);
crypto = 2;
}
}
function t_fLoadGameEnd() {
mcResign.removeMovieClip();
mcGameOver.removeMovieClip();
if (mcGameEnd != undefined) {
mcGameEnd.removeMovieClip();
}
endContainer.createEmptyMovieClip("mcGameEnd", 100);
endContainer.createEmptyMovieClip("mcGameEndBack", 99);
with (endContainer.mcGameEndBack) {
var backColor = 0;
beginFill(backColor, 100);
lineStyle(1, backColor, 100);
moveTo(0, 0);
lineTo(g_numGameWidth, 0);
lineTo(g_numGameWidth, g_numGameHeight);
lineTo(0, g_numGameHeight);
lineTo(0, 0);
endFill();
}
if (freeplayid != undefined) {
downloadURL = downloadURL + affiliateId;
}
trace(endURL);
var endUrlArray = new Array();
endUrlArray = endURL.split(".");
var subString = endUrlArray[endUrlArray.length - 1];
if ((subString == "aspx") || (subString == "html")) {
getURL (endURL, "_self");
} else {
trace("inside and loading" + endURL);
endContainer.loadMovie(endURL);
endContainer.playAgain = playAgain;
}
}
function postGameLog() {
if (gameLogEnabled == 1) {
var _local1 = new LoadVars();
var _local2 = TEAEncrypt((("freeplayid=" + freeplayid) + "&gameLog=") + gameLog, tKey);
_local1.params = _local2;
_local1.sendAndLoad(gameEndSubmitUrl, result_lv, "POST");
gameLog = "";
}
}
function addToLog(myAddition) {
if (gameLogEnabled == 1) {
gameLog = gameLog + myAddition;
}
}
function trc(theString) {
trace((theString + ": ") + eval (theString));
}
function TEAEncrypt(src, key) {
var _local2 = charsToLongs(strToChars(src));
var k = charsToLongs(strToChars(key));
var n = _local2.length;
if (n == 0) {
return("");
}
if (n == 1) {
_local2[n++] = 0;
}
var _local3 = _local2[n - 1];
var y = _local2[0];
var delta = 2654435769;
var max32 = 4294967295;
var mx;
var e;
var q = Math.floor(6 + (52 / n));
var sum = 0;
var sum2 = 0;
while ((q--) > 0) {
sum = sum + delta;
sum = sum >>> 0;
e = (sum >>> 2) & 3;
var _local1 = 0;
while (_local1 < (n - 1)) {
y = _local2[_local1 + 1];
mx = (((_local3 >>> 5) ^ (y << 2)) + ((y >>> 3) ^ (_local3 << 4))) ^ ((sum ^ y) + (k[(_local1 & 3) ^ e] ^ _local3));
mx = mx >>> 0;
_local2[_local1] = _local2[_local1] + mx;
_local2[_local1] = _local2[_local1] >>> 0;
_local3 = _local2[_local1];
_local1++;
}
y = _local2[0];
mx = (((_local3 >>> 5) ^ (y << 2)) + ((y >>> 3) ^ (_local3 << 4))) ^ ((sum ^ y) + (k[(_local1 & 3) ^ e] ^ _local3));
mx = mx >>> 0;
_local2[n - 1] = _local2[n - 1] + mx;
_local2[n - 1] = _local2[n - 1] >>> 0;
_local3 = _local2[n - 1];
}
return(charsToHex(longsToChars(_local2)));
}
function TEADecrypt(src, key) {
var v = charsToLongs(hexToChars(src));
var k = charsToLongs(strToChars(key));
var n = v.length;
if (n == 0) {
return("");
}
var _local2 = v[n - 1];
var _local3 = v[0];
var delta = 2654435769;
var mx;
var e;
var q = Math.floor(6 + (52 / n));
var sum = (q * delta);
while (sum != 0) {
e = (sum >>> 2) & 3;
var _local1 = n - 1;
while (_local1 > 0) {
_local2 = v[_local1 - 1];
mx = (((_local2 >>> 5) ^ (_local3 << 2)) + ((_local3 >>> 3) ^ (_local2 << 4))) ^ ((sum ^ _local3) + (k[(_local1 & 3) ^ e] ^ _local2));
_local3 = (v[_local1] = v[_local1] - mx);
_local1--;
}
_local2 = v[n - 1];
mx = (((_local2 >>> 5) ^ (_local3 << 2)) + ((_local3 >>> 3) ^ (_local2 << 4))) ^ ((sum ^ _local3) + (k[(_local1 & 3) ^ e] ^ _local2));
_local3 = (v[0] = v[0] - mx);
sum = sum - delta;
}
return(charsToStr(longsToChars(v)));
}
function charsToLongs(chars) {
var _local2 = chars;
var _local3 = new Array(Math.ceil(_local2.length / 4));
var _local1 = 0;
while (_local1 < _local3.length) {
_local3[_local1] = ((_local2[_local1 * 4] + (_local2[(_local1 * 4) + 1] << 8)) + (_local2[(_local1 * 4) + 2] << 16)) + (_local2[(_local1 * 4) + 3] << 24);
_local1++;
}
return(_local3);
}
function longsToChars(longs) {
var _local2 = longs;
var _local3 = new Array();
var _local1 = 0;
while (_local1 < _local2.length) {
_local3.push(_local2[_local1] & 255, (_local2[_local1] >>> 8) & 255, (_local2[_local1] >>> 16) & 255, (_local2[_local1] >>> 24) & 255);
_local1++;
}
return(_local3);
}
function charsToHex(chars) {
var _local2 = chars;
var result = new String("");
var _local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
var _local1 = 0;
while (_local1 < _local2.length) {
result = result + (_local3[_local2[_local1] >> 4] + _local3[_local2[_local1] & 15]);
_local1++;
}
return(result);
}
function hexToChars(hex) {
var _local2 = hex;
var _local3 = new Array();
var _local1 = ((_local2.substr(0, 2) == "0x") ? 2 : 0);
while (_local1 < _local2.length) {
_local3.push(parseInt(_local2.substr(_local1, 2), 16));
_local1 = _local1 + 2;
}
return(_local3);
}
function charsToStr(chars) {
var _local2 = chars;
var _local3 = new String("");
var _local1 = 0;
while (_local1 < _local2.length) {
_local3 = _local3 + String.fromCharCode(_local2[_local1]);
_local1++;
}
return(_local3);
}
function strToChars(str) {
var _local2 = str;
var _local3 = new Array();
var _local1 = 0;
while (_local1 < _local2.length) {
_local3.push(_local2.charCodeAt(_local1));
_local1++;
}
return(_local3);
}
function decryptParams(myParams) {
decPar = TEADecrypt(myParams, tKey);
arrayOfVars = new Array();
arrayOfVars = decPar.split("&");
count = 0;
while (count < arrayOfVars.length) {
varHolder = new Array();
varHolder = arrayOfVars[count].split("=");
Set(varHolder[0], varHolder[1]);
count++;
}
}
function createSound(soundName) {
sndCont.createEmptyMovieClip(soundName, numSounds);
Set(soundName, new Sound(eval ("sndCont." + soundName)));
eval (soundName).attachSound(soundName);
numSounds++;
}
_quality = "BEST";
_root.menu.hide();
fscommand ("showmenu", "false");
System.security.allowDomain(domainToAllow);
System.security.allowDomain("http://freeplay.gamedek.com/");
var crypto = 0;
var gameLog = "";
myVariables = new LoadVars();
myVariables.onLoad = function (success) {
if (success) {
crypto = 1;
_root.decryptParams(this.params);
trace(endURL);
} else {
crypto = 0;
}
};
_root.xmlGameEnd = new XML();
_root.xmlGameEnd.onLoad = function (success) {
var _local1 = _root;
if (success) {
_local1.decryptParams(this.firstChild.firstChild.nodeValue);
_local1.endURL = _local1.gameEndUrl;
_local1.t_fLoadGameEnd();
delete this.onLoad;
}
};
var result_lv = new LoadVars();
result_lv.onLoad = function (success) {
if (success) {
trace("whatAmI" + this);
} else {
trace("Error receiving from server.");
}
};
chooseGameEndProcedure();
stop();
numSounds = 5;
globalSound = new Sound();
createSound("buttonSound");
createSound("refereeSound");
refereeSound.setVolume(60);
createSound("hitSound");
createSound("hitWallSound");
hitWallSound.setVolume(50);
createSound("hitsNetSound");
hitsNetSound.setVolume(10);
createSound("oohSound");
oohSound.setVolume(60);
createSound("applauseSound");
createSound("beepSound");
createSound("thunderSound");
createSound("endGameWhistle");
endGameWhistle.setVolume(60);
Instance of Symbol 15 MovieClip in Frame 1
/* no clip actions */
Instance of Symbol 25 MovieClip "sndCont" in Frame 1
onClipEvent (keyDown) {
_root.pressKey(Key.getCode());
}
onClipEvent (enterFrame) {
if (_root.blnGameOn) {
var date_str:String = ((((_root.today_date.getDate() + "/") + (_root.today_date.getMonth() + 1)) + "/") + _root.today_date.getFullYear());
_root.time = _root.time + (1 / _root.frameRate);
var minutes = 0;
minutes = Math.floor(_root.time / 60);
var seconds1 = Math.floor((_root.time % 60) / 10);
var seconds0 = Math.floor(_root.time % 10);
_root.date.text = date_str;
_root.mintime.text = minutes;
_root.sec1time.text = seconds1;
if ((seconds0 != _root.sec0time.text) && (_root.points > 0)) {
_root.points--;
}
_root.sec0time.text = seconds0;
}
}
Frame 3
function pressRadioButton(rbName) {
var _local1 = _root;
var _local2 = rbName;
if (_local2 == "mcMode1") {
_local1.gameMode = 1;
_local1.mcMode2.gotoAndStop("lblNoCheck");
_local1.mcMode3.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcMode2") {
_local1.gameMode = 2;
_local1.mcMode1.gotoAndStop("lblNoCheck");
_local1.mcMode3.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcMode3") {
_local1.gameMode = 3;
_local1.mcMode1.gotoAndStop("lblNoCheck");
_local1.mcMode2.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcMouseCtrl") {
_local1.blnMouseControl = true;
_local1.mcKeyboardCtrl.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcKeyboardCtrl") {
_local1.blnMouseControl = false;
_local1.mcMouseCtrl.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcLevel1") {
_local1.userLevel = 3;
_local1.mcLevel2.gotoAndStop("lblNoCheck");
_local1.mcLevel3.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcLevel2") {
_local1.userLevel = 2;
_local1.mcLevel1.gotoAndStop("lblNoCheck");
_local1.mcLevel3.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcLevel3") {
_local1.userLevel = 1;
_local1.mcLevel2.gotoAndStop("lblNoCheck");
_local1.mcLevel1.gotoAndStop("lblNoCheck");
}
if (_local1.gameMode == 1) {
_local1.mcMode1.gotoAndStop("lblCheck");
} else if (_local1.gameMode == 2) {
_local1.mcMode2.gotoAndStop("lblCheck");
} else if (_local1.gameMode == 3) {
_local1.mcMode3.gotoAndStop("lblCheck");
}
if (_local1.userLevel == 1) {
_local1.mcLevel3.gotoAndStop("lblCheck");
} else if (_local1.userLevel == 2) {
_local1.mcLevel2.gotoAndStop("lblCheck");
} else if (_local1.userLevel == 3) {
_local1.mcLevel1.gotoAndStop("lblCheck");
}
if (blnMouseControl) {
_local1.mcMouseCtrl.gotoAndStop("lblCheck");
} else {
_local1.mcKeyboardCtrl.gotoAndStop("lblCheck");
}
}
stop();
pBVV = 2;
pYou = 1;
gameMode = 1;
userLevel = 3;
blnMouseControl = true;
pressRadioButton();
Frame 10
function g_fSetGameSize(a_numWidth, a_numHeight) {
g_numGameWidth = a_numWidth;
g_numGameHeight = a_numHeight;
}
function playAgain() {
gotoAndStop ("settings");
}
g_fSetGameSize(640, 480);
endContainer.playAgain = function () {
_root.playAgain();
};
function Vector2d(ax, ay) {
this.x = ax;
this.y = ay;
}
function Add(v1, v2) {
return(new Vector2d(v1.x + v2.x, v1.y + v2.y));
}
function Sub(v1, v2) {
return(new Vector2d(v1.x - v2.x, v1.y - v2.y));
}
function Nrm(v) {
var _local1 = v;
return(Math.sqrt((_local1.x * _local1.x) + (_local1.y * _local1.y)));
}
function Normz(v) {
var _local1 = v;
return(new Vector2d(_local1.x / Nrm(_local1), _local1.y / Nrm(_local1)));
}
function Mul(num, v) {
return(new Vector2d(num * v.x, num * v.y));
}
function Scal(v1, v2) {
return((v1.x * v2.x) + (v1.y * v2.y));
}
function RtoD(x) {
return((x * 180) / Math.PI);
}
function DtoR(x) {
return((x * Math.PI) / 180);
}
function initialize() {
var _local1 = _root;
_local1.mcOptions._visible = false;
_local1.mcLeaveGame._visible = false;
_local1.mcGameOver._visible = false;
faul_f = "";
pnts1 = (pnts2 = 0);
sets1 = (sets2 = 0);
blnStop = (blnBallLost = false);
newTrajectory = false;
blnFirstHit = false;
p1.serving = true;
p2.serving = false;
displayScore();
}
function playerBound(v) {
var _local1 = this;
var _local2 = new Vector2d(v.x, v.y);
if ((_local1.speed.y >= 0) && (_local2.y > (((yFloor - pengHeight) + Rh) - 10))) {
_local1.speed.y = 0;
_local2.y = ((yFloor - pengHeight) + Rh) - 10;
_local1.state = true;
}
if ((_local1.speed.x <= 0) && (_local2.x <= (_local1.leftBound + Rh))) {
_local1.speed.x = 0;
_local2.x = _local1.leftBound + Rh;
} else if ((_local1.speed.x >= 0) && (_local2.x >= (_local1.rightBound - Rh))) {
_local1.speed.x = 0;
_local2.x = _local1.rightBound - Rh;
}
return(_local2);
}
function ballBound(v) {
var _local2 = this;
var _local1 = new Vector2d(v.x, v.y);
var _local3 = false;
if ((_local2.speed.x < 0) && (_local1.x <= Rb)) {
_local2.speed.x = _local2.speed.x * -1;
hitWallSound.start();
_local1.x = Rb;
_local3 = true;
} else if ((_local2.speed.x > 0) && (_local1.x >= (630 - Rb))) {
_local2.speed.x = _local2.speed.x * -1;
hitWallSound.start();
_local1.x = 630 - Rb;
_local3 = true;
} else if ((_local2.speed.y < 0) && (_local1.y <= Rb)) {
_local2.speed.y = _local2.speed.y * -1;
hitWallSound.start();
_local1.y = Rb;
_local3 = true;
} else if ((((_local2.speed.x > 0) && (_local2.crd.x <= (311 - Rb))) && (_local1.x > (311 - Rb))) && (_local1.y > netTop.y)) {
_local2.speed.x = _local2.speed.x * -1;
hitsNetSound.start();
_local1.x = 311 - Rb;
_local3 = true;
} else if ((((_local2.speed.x < 0) && (_local2.crd.x >= (328 + Rb))) && (_local1.x < (328 + Rb))) && (_local1.y > netTop.y)) {
_local2.speed.x = _local2.speed.x * -1;
hitsNetSound.start();
_local1.x = 328 + Rb;
_local3 = true;
} else if ((_local2.speed.y > 0) && (_local1.y > (yFloor - Rb))) {
_local1.y = yFloor - Rb;
_local3 = true;
if (!blnBallLost) {
hitSound.setPan((50 * (_local2.crd.x - netTop.x)) / netTop.x);
hitWallSound.start();
if (_local1.x < netTop.x) {
faul("p1");
} else {
faul("p2");
}
} else {
_local2.speed.y = _local2.speed.y * -0.5;
}
}
if ((((_local1.x <= ((netTop.x + Rb) + 14)) && (_local1.x >= ((netTop.x - Rb) - 14))) && (_local1.y >= ((netTop.y - Rb) - 14))) && (_local1.y < netTop.y)) {
var v1 = Sub(_local1, netTop);
var v1_n = Normz(v1);
var spd_n = Normz(_local2.speed);
if ((Nrm(v1) <= (Rb + 14)) && ((Scal(spd_n, v1_n) < 0) || (Nrm(_local2.speed) == 0))) {
_local2.speed = Mul(Nrm(_local2.speed), Sub(spd_n, Mul(2 * Scal(spd_n, v1_n), v1_n)));
_local3 = true;
hitsNetSound.start();
}
}
if (_local3) {
_local2.speed = Mul(kElasti, _local2.speed);
newTrajectory = true;
}
return(_local1);
}
function faul(a) {
var _local1 = _root;
var _local2 = a;
if (_local2 == "p1") {
if (p2.serving) {
beepSound.start(0, 1);
pnts2++;
if (pBVV == 2) {
totalPoints = totalPoints - (20 * (4 - _local1.userLevel));
oohSound.start(0, 1);
} else {
totalPoints = totalPoints + (100 * (4 - _local1.userLevel));
rejoicing();
}
checkPoints();
} else {
if (pBVV == 2) {
oohSound.start(0, 1);
} else {
rejoicing();
}
p2.serving = true;
p1.serving = false;
}
} else if (_local2 == "p2") {
if (p1.serving) {
beepSound.start(0, 1);
pnts1++;
if (pBVV == 1) {
totalPoints = totalPoints - (20 * (4 - _local1.userLevel));
oohSound.start(0, 1);
} else {
totalPoints = totalPoints + (100 * (4 - _local1.userLevel));
rejoicing();
}
checkPoints();
} else {
if (pBVV == 1) {
oohSound.start(0, 1);
} else {
rejoicing();
}
p1.serving = true;
p2.serving = false;
}
}
faul_f = _local2;
blnBallLost = true;
}
function restart() {
eval ("player" + pBVV).gotoAndStop(2);
eval ("player" + pYou).gotoAndStop(1);
if (!p1.auto) {
strPlayer = "p1";
} else if (!p2.auto) {
strPlayer = "p2";
} else {
strPlayer = "";
}
p1.touch = (p2.touch = 0);
p1.state = (p2.state = false);
p1.move(startP1);
p2.move(startP2);
p1.mStop();
p2.mStop();
p1.syn();
p2.syn();
b1.speed = new Vector2d(0, 0);
b1.moveState = false;
if (p1.serving) {
b1.move(startBall1);
} else if (p2.serving) {
b1.move(startBall2);
}
b1.syn();
faul_f = "";
blnBallLost = false;
blnFirstHit = true;
timeWaiting = 0;
refereeSound.start(0, 1);
}
function autoGo(dt, pl) {
if (blnBallLost) {
pl.mStop();
return(undefined);
}
if (pl.serving && (!b1.moveState)) {
pl.mStop();
pl.mJump();
return(undefined);
}
if (newTrajectory) {
controlPoint = new Vector2D(0, 0);
controlPoint = calcTrajectory(dt);
newPos = controlPoint.x;
if (userLevel == 2) {
newPos = newPos + (random(30) - 15);
} else if (userLevel == 3) {
newPos = newPos + (random(80) - 40);
}
newTrajectory = false;
}
if ((newPos < (pl.rightBound + Rh)) && (newPos > (pl.leftBound - Rh))) {
if (pl.state && (pl.crd.x != newPos)) {
var dx = (dt * (pengSpeed + ((pengSpeed * Math.abs(pl.crd.x - newPos)) / (pl.rightBound - pl.leftBound))));
if (Math.abs(pl.crd.x - newPos) <= dx) {
pl.crd.x = newPos;
} else if (pl.crd.x < newPos) {
pl.crd.x = pl.crd.x + dx;
} else {
pl.crd.x = pl.crd.x - dx;
}
eval (pl.name).body.play();
}
}
if (Nrm(Sub(pl.crd, b1.crd)) < (Rh + (2 * Rb))) {
if ((((pl.crd.x > (b1.crd.x + Rb)) && (b1.speed.y > 0)) && (pl.crd.y > (b1.crd.y + Rb))) && (Nrm(b1.speed) < 300)) {
pl.mJump();
}
}
}
function calcTrajectory(tic) {
var _local3 = this;
var _local1 = new Vector2D(b1.crd.x, b1.crd.y);
var _local2 = new Vector2D(b1.speed.x, b1.speed.y);
while (_local1.y < (yFloor - pengHeight)) {
_local2 = Add(_local2, Mul(3 * tic, accel2));
_local1 = Add(_local1, Mul(3 * tic, _local2));
if ((_local2.x < 0) && (_local1.x <= Rb)) {
_local1.x = Rb;
break;
}
if ((_local2.x > 0) && (_local1.x >= (630 - Rb))) {
_local1.x = 630 - Rb;
break;
}
if ((_local2.y < 0) && (_local1.y <= Rb)) {
_local1.y = Rb;
break;
}
if ((((_local2.x > 0) && (_local1.x >= (311 - Rb))) && (_local1.x < 328)) && (_local1.y > netTop.y)) {
_local1.x = 311 - Rb;
break;
}
if ((((_local2.x < 0) && (_local1.x > 311)) && (_local1.x <= (328 + Rb))) && (_local1.y > netTop.y)) {
_local1.x = 328 + Rb;
break;
}
if ((_local2.y > 0) && (_local1.y > (yFloor - pengHeight))) {
_local1.y = yFloor - pengHeight;
ballAngle = Math.atan2(_local2.y, _local2.x);
netAngle = Math.atan2(_local1.y - (netTop.y - Rb), _local1.x - netTop.x);
_local1.x = _local1.x + (((Rh * Math.sin(ballAngle - netAngle)) * 2) / 3);
break;
}
if ((((_local1.x <= ((netTop.x + Rb) + 14)) && (_local1.x >= ((netTop.x - Rb) - 14))) && (_local1.y >= ((netTop.y - Rb) - 14))) && (_local1.y < netTop.y)) {
if ((Nrm(v1) <= (Rb + 14)) && ((Scal(spd_n, v1_n) < 0) || (Nrm(_local3.speed) == 0))) {
var v1 = Sub(_local1, netTop);
var v1_n = Normz(v1);
var spd_n = Normz(_local2);
if ((Nrm(v1) <= (Rb + 14)) && ((Scal(spd_n, v1_n) < 0) || (Nrm(_local2) == 0))) {
_local3.speed = Mul(Nrm(_local2), Sub(spd_n, Mul(2 * Scal(spd_n, v1_n), v1_n)));
break;
}
}
}
}
return(_local1);
}
function mainLoop() {
if (!blnStop) {
if (blnMouseControl) {
myMouseMove();
} else {
myPressKeys();
}
dt = default_tiker.tik();
p1.winking(dt);
p2.winking(dt);
if (blnBallLost) {
timeWaiting = timeWaiting + dt;
if (timeWaiting > timePause) {
restart();
}
}
while (dt > tQ) {
p1.think(tQ);
p2.think(tQ);
p1.syn();
p2.syn();
b1.think(tQ);
b1.syn();
dt = dt - tQ;
}
p1.think(dt);
p2.think(dt);
p1.syn();
p2.syn();
b1.think(dt);
b1.syn();
b1.rotate();
} else {
dt = default_tiker.tik();
}
}
function myPressKeys() {
if (Key.isDown(37)) {
eval (strPlayer).mLeft();
} else if (Key.isDown(39)) {
eval (strPlayer).mRight();
} else {
eval (strPlayer).speed.x = 0;
}
if (Key.isDown(32)) {
eval (strPlayer).mJump();
}
}
function myMouseMove() {
if ((((_ymouse > 0) && (_ymouse < 430)) && (eval (strPlayer).state)) && (!blnStop)) {
var xPosition = eval (eval (strPlayer).name)._x;
if ((_xmouse - xPosition) > 10) {
eval (strPlayer).mRight();
eval (strPlayer).speed.x = eval (strPlayer).speed.x + ((pengSpeed * (_xmouse - xPosition)) / netTop.x);
return(undefined);
}
if ((xPosition - _xmouse) > 10) {
eval (strPlayer).mLeft();
eval (strPlayer).speed.x = eval (strPlayer).speed.x + ((pengSpeed * (_xmouse - xPosition)) / netTop.x);
return(undefined);
}
eval (strPlayer).speed.x = 0;
}
}
function myMouseUp() {
if (((((_ymouse > 0) && (_ymouse < 430)) && (eval (strPlayer).state)) && (!blnStop)) && (blnMouseControl)) {
eval (strPlayer).mJump();
}
}
function pressStop() {
blnStop = !blnStop;
if (blnStop) {
_root.mcStop.gotoAndStop("lblPlay");
} else {
_root.mcStop.gotoAndStop("lblStop");
}
}
function checkPoints() {
var _local2;
var _local1;
if (gameMode == 1) {
_local2 = 7;
_local1 = 1;
} else if (gameMode == 2) {
_local2 = 7;
_local1 = 3;
} else if (gameMode == 3) {
_local2 = 7;
_local1 = 5;
}
if ((pnts1 >= _local2) && ((pnts1 - pnts2) > 1)) {
pnts1 = (pnts2 = 0);
sets1++;
if ((sets1 == _local1) || ((sets1 - sets2) >= Math.ceil(_local1 / 2))) {
if (pBVV == 1) {
_root.pressStop();
thunderSound.start();
evilSky.play();
} else {
gameOver(p1);
}
} else {
refereeSound.start(0, 3);
changePositions();
}
}
if ((pnts2 >= _local2) && ((pnts2 - pnts1) > 1)) {
pnts1 = (pnts2 = 0);
sets2++;
if ((sets2 == _local1) || ((sets2 - sets1) >= Math.ceil(_local1 / 2))) {
if (pBVV == 2) {
_root.pressStop();
thunderSound.start();
evilSky.play();
} else {
gameOver(p2);
}
} else {
changePositions();
}
}
displayScore();
}
function changePositions() {
var sets;
p1.auto = !p1.auto;
p2.auto = !p2.auto;
p1.serving = !p1.serving;
p2.serving = !p2.serving;
sets = sets1;
sets1 = sets2;
sets2 = sets;
sets = pBVV;
pBVV = pYou;
pYou = sets;
trace("bbvv" + pBVV);
trace("pyou" + pYou);
eval ("player" + pBVV).gotoAndStop(2);
eval ("player" + pYou).gotoAndStop(1);
}
function headsCrd() {
p1.getHeadCrd();
p2.getHeadCrd();
}
function setOptions() {
var _local1 = _root;
_local1.mcOptions.faderSpeed.knob._x = pengSpeed - 100;
_local1.mcOptions.faderJump.knob._x = (Math.abs(jSpeed.y) * 2) - 300;
_local1.mcOptions.faderSound.knob._x = globalSound.getVolume() * 2;
}
function getOptions() {
var _local1 = _root;
pengSpeed = _local1.mcOptions.faderSpeed.knob._x + 100;
jSpeed.y = -0.5 * (_local1.mcOptions.faderJump.knob._x + 300);
globalSound.setVolume(Math.round(_local1.mcOptions.faderSound.knob._x * 0.5));
}
function pressOptions() {
var _local1 = _root;
_local1.pressStop();
_local1.pressRadioButton("");
_local1.setOptions();
_local1.mcOptions._visible = true;
}
function pressLeaveGame() {
_root.pressStop();
_root.mcLeaveGame._visible = true;
}
function gameOver(pl) {
var _local1 = _root;
endGameWhistle.start();
if (!pl.auto) {
_local1.strGameOver = "You win!!!";
_local1.pressStop();
} else {
_local1.strGameOver = "You lost!";
}
_local1.mcGameOver._visible = true;
}
function pressRadioButton(rbName) {
var _local1 = _root;
var _local2 = rbName;
if (_local2 == "mcMode1") {
_local1.gameMode = 1;
_local1.mcOptions.mcMode2.gotoAndStop("lblNoCheck");
_local1.mcOptions.mcMode3.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcMode2") {
_local1.gameMode = 2;
_local1.mcOptions.mcMode1.gotoAndStop("lblNoCheck");
_local1.mcOptions.mcMode3.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcMode3") {
_local1.gameMode = 3;
_local1.mcOptions.mcMode1.gotoAndStop("lblNoCheck");
_local1.mcOptions.mcMode2.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcMouseCtrl") {
_local1.blnMouseControl = true;
_local1.mcOptions.mcKeyboardCtrl.gotoAndStop("lblNoCheck");
} else if (_local2 == "mcKeyboardCtrl") {
_local1.blnMouseControl = false;
_local1.mcOptions.mcMouseCtrl.gotoAndStop("lblNoCheck");
}
if (_local1.gameMode == 1) {
_local1.mcOptions.mcMode1.gotoAndStop("lblCheck");
} else if (_local1.gameMode == 2) {
_local1.mcOptions.mcMode2.gotoAndStop("lblCheck");
} else if (_local1.gameMode == 3) {
_local1.mcOptions.mcMode3.gotoAndStop("lblCheck");
}
if (blnMouseControl) {
_local1.mcOptions.mcMouseCtrl.gotoAndStop("lblCheck");
} else {
_local1.mcOptions.mcKeyboardCtrl.gotoAndStop("lblCheck");
}
}
function rejoicing() {
var _local1 = _root;
applauseSound.start(0, 1);
_local1.mcChuk1.gotoAndPlay(Math.floor(Math.random() * 55));
_local1.mcChuk2.gotoAndPlay(Math.floor(Math.random() * 40));
_local1.mcChuk3.gotoAndPlay(Math.floor(Math.random() * 40));
_local1.mcChuk4.gotoAndPlay(Math.floor(Math.random() * 55));
_local1.mcChuk5.gotoAndPlay(Math.floor(Math.random() * 55));
_local1.mcChuk6.gotoAndPlay(Math.floor(Math.random() * 40));
}
function displayScore() {
var _local1 = _root;
_local1.mcPoints21.gotoAndStop(Math.floor(pnts2 / 10) + 1);
_local1.mcPoints22.gotoAndStop((pnts2 % 10) + 1);
_local1.mcPoints11.gotoAndStop(Math.floor(pnts1 / 10) + 1);
_local1.mcPoints12.gotoAndStop((pnts1 % 10) + 1);
_local1.mcSet1.gotoAndStop(sets1 + 1);
_local1.mcSet2.gotoAndStop(sets2 + 1);
strP1 = ((!p1.auto) ? "Player" : "Baron Von Viktor");
strP2 = ((!p2.auto) ? "Player" : "Baron Von Viktor");
}
stop();
clock = function () {
this.prevTime = new Date();
};
clock.prototype.tik = function () {
var _local3 = new Date();
var _local1 = this.prevTime.getTime();
var _local2 = _local3.getTime();
this.prevTime = new Date();
return((_local2 - _local1) / 1000);
};
default_tiker = new clock();
var gameLevel = 1;
var blnSound = true;
var Rh = 34;
var Rb = 23;
var tQ = 0.4;
var pengSpeed = 200;
var kElasti = 0.95;
var jSpeed = new Vector2d(0, -200);
var accel = new Vector2d(0, 400);
var accel2 = new Vector2d(0, 200);
var yFloor = 370;
var pengHeight = _root.player1._height;
var netTop = new Vector2d(318.8, 180);
var startBall1 = new Vector2d(148.5 + Rb, (yFloor - pengHeight) - (1.5 * Rb));
var startBall2 = new Vector2d(489.1 - Rb, (yFloor - pengHeight) - (1.5 * Rb));
var startP1 = new Vector2d(122 + Rh, (yFloor - pengHeight) + Rh);
var startP2 = new Vector2d(515.6 - Rh, (yFloor - pengHeight) + Rh);
var headPoint = new Object();
var timePause = 2;
var timeWaiting = 0;
var newPos;
var strPlayer = ((strGameOver = ""));
var strP1 = ((strP2 = ""));
var faul_f;
var pnts1;
var pnts2;
var sets1;
var sets2;
var blnStop;
var blnBallLost;
var newTrajectory;
var blnFirstHit;
totalPoints = 0;
player = function (a_name, a_crd, a_left, a_right, bound_func, a_shadow, a_auto) {
var _local1 = this;
_local1.name = a_name;
_local1.crd = new Vector2d(a_crd.x, a_crd.y);
_local1.state = new Boolean();
_local1.speed = new Vector2d(0, 0);
_local1.bounding = bound_func;
_local1.auto = a_auto;
_local1.serving = false;
_local1.touch = 0;
_local1.timeWinking = 0;
_local1.headCrd = new Vector2d(0, 0);
_local1.pengShadow = a_shadow;
_local1.leftBound = a_left;
_local1.rightBound = a_right;
_local1.state = true;
};
player.prototype.move = function (v) {
this.crd.x = v.x;
this.crd.y = v.y;
};
player.prototype.getHeadCrd = function () {
headPoint.x = 0;
headPoint.y = 0;
eval (this.name).body.head.localToGlobal(headPoint);
this.headCrd.x = headPoint.x;
this.headCrd.y = headPoint.y;
};
player.prototype.syn = function () {
eval (this.name)._x = this.crd.x;
eval (this.name)._y = this.crd.y;
this.pengShadow._x = this.crd.x - 25;
this.pengShadow._xscale = (this.pengShadow._yscale = ((100 * this.crd.y) / pengHeight) / 2.5);
this.getHeadCrd();
};
player.prototype.think = function (dt) {
var _local1 = this;
var _local3 = dt;
if (_local1.auto) {
autoGo(_local3, _local1);
}
if (!_local1.state) {
_local1.speed = Add(_local1.speed, Mul(_local3, accel));
}
var _local2 = Mul(_local3, _local1.speed);
var newCrd = Add(_local1.crd, _local2);
_local1.move(_local1.bounding(newCrd));
};
player.prototype.mLeft = function () {
if (!this.state) {
return(undefined);
}
this.speed = new Vector2d(-pengSpeed, 0);
eval (this.name).body.play();
};
player.prototype.mRight = function () {
if (!this.state) {
return(undefined);
}
this.speed = new Vector2d(pengSpeed, 0);
eval (this.name).body.play();
};
player.prototype.mStop = function () {
if (!this.state) {
return(undefined);
}
this.speed = new Vector2d(0, 0);
eval (this.name).body.gotoAndStop(1);
};
player.prototype.mJump = function () {
if (!this.state) {
return(undefined);
}
this.state = false;
this.speed = Add(this.speed, jSpeed);
eval (this.name).body.gotoAndPlay("Jump");
};
player.prototype.winking = function (dt) {
var timeWinking;
if (eval (this.name).body.head._currentframe > 1) {
if (this.timeWinking < 0.1) {
this.timeWinking = this.timeWinking + dt;
} else {
eval (this.name).body.head.gotoAndStop("lblOpenEyes");
}
} else if (Math.floor(Math.random() * 40) == 7) {
this.timeWinking = 0;
eval (this.name).body.head.gotoAndStop("lblCloseEyes");
}
};
ball = function (a_name, a_crd, bound_func, a_shadow) {
var _local1 = this;
_local1.name = a_name;
_local1.crd = new Vector2d(a_crd.x, a_crd.y);
_local1.speed = new Vector2d(0, 0);
_local1.bounding = bound_func;
_local1.moveState = false;
_local1.ballShadow = a_shadow;
};
ball.prototype.think = function (dt) {
var _local2 = this;
if (_local2.moveState) {
_local2.speed = Add(_local2.speed, Mul(dt, accel2));
}
if (!blnBallLost) {
var _local3 = 0;
while (_local3 < pSet.length) {
var v1 = Sub(_local2.crd, pSet[_local3].headCrd);
var v1_n = Normz(v1);
var spd = Sub(_local2.speed, pSet[_local3].speed);
var spd_n = Normz(spd);
if ((Nrm(v1) <= (Rh + Rb)) && ((Scal(spd_n, v1_n) < 0) || (Nrm(spd) == 0))) {
newTrajectory = true;
_local2.speed = Mul(Nrm(spd) * kElasti, Sub(spd_n, Mul(2 * Scal(spd_n, v1_n), v1_n)));
hitSound.setPan((50 * (_local2.crd.x - netTop.x)) / netTop.x);
hitSound.start(0, 1);
if (!_local2.moveState) {
_local2.speed = Mul(2, _local2.speed);
}
var _local1 = 0;
while (_local1 < pSet.length) {
if (_local1 == _local3) {
pSet[_local1].touch++;
if (!pSet[_local1].serving) {
blnFirstHit = false;
}
} else {
pSet[_local1].touch = 0;
}
_local1++;
}
_local2.moveState = true;
if ((p1.touch > 3) || (((p1.touch > 1) && (p1.serving)) && (blnFirstHit))) {
faul("p1");
} else if ((p2.touch > 3) || (((p2.touch > 1) && (p2.serving)) && (blnFirstHit))) {
faul("p2");
}
}
_local3++;
}
}
var dx = Mul(dt, _local2.speed);
var newCrd = Add(_local2.crd, dx);
_local2.move(_local2.bounding(newCrd));
};
ball.prototype.move = function (v) {
this.crd.x = v.x;
this.crd.y = v.y;
};
ball.prototype.syn = function () {
eval (this.name)._x = this.crd.x;
eval (this.name)._y = this.crd.y;
this.ballShadow._x = this.crd.x - 20;
this.ballShadow._y = yFloor + (((yFloor - Rb) - this.crd.y) / 10);
this.ballShadow._xscale = (this.ballShadow._yscale = (100 * (this.crd.y + 800)) / 1000);
};
ball.prototype.rotate = function () {
eval (this.name)._rotation = (this.speed.x + this.speed.y) / 2;
};
p1 = new player("player1", new Vector2d(player1._x, player1._y), 0, 311, playerBound, _root.mcPengShadow1, false);
p2 = new player("player2", new Vector2d(player2._x, player2._y), 328, 630, playerBound, _root.mcPengShadow2, true);
b1 = new ball("ball1", new Vector2d(ball1._x, ball1._y), ballBound, _root.mcBallShape);
var pSet = new Array(p1, p2);
initialize();
restart();
Instance of Symbol 166 MovieClip "ball1" in Frame 10
onClipEvent (enterFrame) {
_root.mainLoop();
updateAfterEvent();
}
onClipEvent (mouseDown) {
_root.myMouseUp();
}
Instance of Symbol 52 MovieClip [mcLeaveGame] "mcLeaveGame" in Frame 10
onClipEvent (load) {
this._x = 320;
this._y = 240;
}
Instance of Symbol 94 MovieClip [mcOptions] "mcOptions" in Frame 10
onClipEvent (load) {
this._x = 320;
this._y = 240;
}
Instance of Symbol 46 MovieClip [mcGameOver] "mcGameOver" in Frame 10
onClipEvent (load) {
this._x = 320;
this._y = 240;
}
Frame 16
stop();
trace(totalPoints);
if (totalPoints < 0) {
g_numScore = 0;
} else {
g_numScore = totalPoints;
}
endContainer.g_numScore = g_numScore;
if ((crypto == 2) || (crypto == 0)) {
postGameLog();
_root.xmlGameEnd.load((gameEndSubmitUrl + "?params=") + TEAEncrypt((((("freePlayID=" + freeplayid) + "&score=") + endContainer.g_numScore) + "&timeStamp=") + timeStamp, tKey));
} else {
_root.t_fLoadGameEnd();
}
Symbol 21 MovieClip Frame 1
num_loaded = _root.getBytesLoaded();
num_total = _root.getBytesTotal();
num_percent = int((num_loaded / num_total) * 100);
setProperty("_root.loading.line", _xscale , num_percent);
if (num_percent >= 99) {
_root.gotoAndStop("settings");
}
Symbol 21 MovieClip Frame 2
gotoAndPlay (1);
Symbol 34 Button
on (release) {
buttonSound.start(0, 1);
_root.gotoAndStop("game");
}
Symbol 38 MovieClip Frame 1
stop();
Symbol 41 Button
on (release) {
_root.buttonSound.start(0, 1);
_root.mcLeaveGame._visible = false;
_root.pressStop();
_root.gotoAndPlay("endGameFrame");
}
Symbol 48 Button
on (release) {
_root.buttonSound.start(0, 1);
_root.mcLeaveGame._visible = false;
_root.pressStop();
_root.gotoAndStop("endGameFrame");
}
on (rollOver) {
_root.playSound("mouseOverSound");
}
Symbol 50 Button
on (release) {
_root.buttonSound.start(0, 1);
_root.mcLeaveGame._visible = false;
_root.pressStop();
}
on (rollOver) {
_root.playSound("mouseOverSound");
}
Symbol 61 Button
on (press) {
startDrag ("", false, left, top, right, bottom);
}
on (release) {
stopDrag();
}
Instance of Symbol 62 MovieClip "knob" in Symbol 63 MovieClip Frame 1
onClipEvent (load) {
top = _y;
bottom = _y;
left = _x;
right = _x + 201;
}
Symbol 67 Button
on (release) {
_root.buttonSound.start(0, 1);
_root.mcOptions._visible = false;
_root.getOptions();
_root.pressStop();
}
Symbol 69 Button
on (release) {
_root.buttonSound.start(0, 1);
_root.mcOptions._visible = false;
_root.setOptions();
_root.pressStop();
}
Symbol 87 Button
on (release) {
_root.buttonSound.start(0, 1);
_root.pressRadioButton(_name);
}
Symbol 90 MovieClip Frame 1
stop();
Symbol 90 MovieClip Frame 2
stop();
Symbol 110 MovieClip Frame 1
stop();
Symbol 110 MovieClip Frame 185
_root.gameOver(_root.p2);
stop();
Symbol 119 MovieClip Frame 1
stop();
Symbol 123 MovieClip Frame 1
stop();
Symbol 125 Button
on (release) {
_root.buttonSound.start(0, 1);
if ((!_root.mcOptions._visible) && (!_root.mcLeaveGame._visible)) {
_root.pressLeaveGame();
}
}
Symbol 129 Button
on (release) {
_root.buttonSound.start(0, 1);
_root.pressStop();
}
Symbol 132 MovieClip Frame 1
stop();
Symbol 132 MovieClip Frame 2
stop();
Symbol 133 Button
on (release) {
buttonSound.start(0, 1);
if ((!_root.mcOptions._visible) && (!_root.mcLeaveGame._visible)) {
_root.pressOptions();
}
}
Symbol 155 MovieClip Frame 1
stop();
Symbol 155 MovieClip Frame 2
stop();
Symbol 156 MovieClip Frame 1
stop();
Symbol 156 MovieClip Frame 9
gotoAndPlay ("Running");
Symbol 156 MovieClip Frame 10
_root.headsCrd();
Symbol 156 MovieClip Frame 11
_root.headsCrd();
Symbol 156 MovieClip Frame 30
_root.headsCrd();
gotoAndStop ("Running");
Symbol 161 MovieClip Frame 1
stop();
Symbol 161 MovieClip Frame 2
stop();
Symbol 162 MovieClip Frame 1
stop();
Symbol 162 MovieClip Frame 9
gotoAndPlay ("Running");
Symbol 162 MovieClip Frame 10
_root.headsCrd();
Symbol 162 MovieClip Frame 11
_root.headsCrd();
Symbol 162 MovieClip Frame 30
_root.headsCrd();
gotoAndStop ("Running");
Symbol 163 MovieClip Frame 1
stop();
Symbol 163 MovieClip Frame 2
stop();
Symbol 164 MovieClip Frame 1
stop();
Symbol 164 MovieClip Frame 2
stop();
Symbol 179 MovieClip Frame 1
stop();
Symbol 187 Button
on (release) {
getURL ("http://www.arkadium.com", "_blank");
}
Symbol 188 MovieClip Frame 1
if (_root.logoUrl == undefined) {
play();
} else {
loadBrandMov.loadMovie(_root.logoUrl);
stop();
}
Symbol 188 MovieClip Frame 2
stop();