Frame 1
function init() {
this._lockroot = true;
gotoAndStop (2);
}
Frame 2
function throwLifeSaver() {
var j = 0;
while (j < 10) {
if (mc_Mouse.hitTest(eval ("Boy" + j)) && (eval ("Boy" + j).mc_Boy._currentframe == 1)) {
duplicateMovieClip (mc_LifeSaver, "lifeSaver" + iSaverIndex, iSaverIndex + 10);
eval ("lifeSaver" + iSaverIndex)._x = player._x;
eval ("lifeSaver" + iSaverIndex)._y = player._y;
aSaverSpdX[iSaverIndex] = 10 * Math.cos(angle);
aSaverSpdY[iSaverIndex] = 10 * Math.sin(angle);
if ((++iSaverIndex) > 9) {
iSaverIndex = 0;
}
if (iBoySpawnCounter > 50) {
iBoySpawnCounter = iBoySpawnCounter + -50;
}
player.mc_Topaz.gotoAndPlay(2);
sThrow.start(0, 0);
}
j++;
}
}
function moveSaver() {
var i = 0;
while (i < aSaverSpdX.length) {
eval ("lifeSaver" + i)._x = eval ("lifeSaver" + i)._x + aSaverSpdX[i];
eval ("lifeSaver" + i)._y = eval ("lifeSaver" + i)._y + aSaverSpdY[i];
i++;
}
}
function rotatePlayer() {
i_mouseX = _root._xmouse;
i_mouseY = _root._ymouse;
distX = i_mouseX - player._x;
distY = i_mouseY - player._y;
angle = Math.atan2(distY, distX);
degrees = (angle / Math.PI) * 180;
player._rotation = degrees + 90;
}
function bobPlayer() {
if ((player._xscale > 100) || (player._xscale < 90)) {
iBobSpd = iBobSpd * -1;
}
player._xscale = player._xscale + iBobSpd;
player._yscale = player._yscale + iBobSpd;
}
function pickBoy() {
var _local1 = 1;
var _local2 = 5;
var _local3 = Math.round(Math.random() * (_local2 - _local1)) + _local1;
return(_local3);
}
function manageBoys() {
if (iBoysLeft != 0) {
var iBoy = pickBoy();
} else {
nextLevel();
}
var minX = 10;
var maxX = (640 - mc_Boys._width);
var minY = 50;
var maxY = (480 - mc_Boys._height);
var iRandX = (Math.round(Math.random() * (maxX - minX)) + minX);
var iRandY = (Math.round(Math.random() * (maxY - minY)) + minY);
if ((iRandX >= (player._x - 50)) && (iRandX <= (player._x + 50))) {
var iCoinFlip = random(2);
if (iCoinFlip) {
iRandX = player._x - 50;
} else {
iRandX = player._x + 50;
}
}
if ((iRandY >= (player._y - 50)) && (iRandY <= (player._y + 50))) {
var iCoinFlip = random(2);
if (iCoinFlip) {
iRandY = player._y - 50;
} else {
iRandY = player._y + 50;
}
}
if ((--iBoySpawnCounter) <= 0) {
duplicateMovieClip (mc_Boys, "Boy" + iBoyIndex, iBoyIndex + 20);
eval ("Boy" + iBoyIndex)._x = iRandX;
eval ("Boy" + iBoyIndex)._y = iRandY;
eval ("Boy" + iBoyIndex).gotoAndStop(iBoy);
aBoyTimer[iBoyIndex] = iLevelMin * 50;
var iRand = (Math.round(Math.random() * (iLevelMax - iLevelMin)) + iLevelMin);
iBoySpawnCounter = iRand;
if ((++iBoyIndex) > 9) {
iBoyIndex = 0;
}
}
var i = 0;
while (i < 10) {
var j = 0;
while (j < 10) {
if (eval ("lifeSaver" + i).hitTest(eval ("Boy" + j).mc_CRect)) {
if (eval ("Boy" + j).mc_Boy._currentframe < 2) {
eval ("Boy" + j).mc_Boy.gotoAndPlay(2);
removeMovieClip(eval ("lifeSaver" + i));
iBoysLeft--;
iScore = iScore + 50;
aBoyTimer[j] = null;
sCatch.start(0, 0);
}
}
if (aBoyTimer[j] != null) {
if ((--aBoyTimer[j]) <= 0) {
removeMovieClip(eval ("Boy" + j));
aBoyTimer[j] = null;
iBoysLeft++;
sMiss.start(0, 0);
}
}
j++;
}
i++;
}
}
function checkNextLevel() {
if (iBoysLeft > 0) {
gameOver(false);
} else {
nextLevel();
}
}
function nextLevel() {
if (iLevel != 10) {
iLevel++;
iLevelMax = iLevelMax + -50;
iLevelMin = Math.floor(iLevelMax / 10);
iSeconds = iSeconds + 50;
if (iSeconds > 59) {
iSeconds = iSeconds - 59;
iMinutes++;
}
iBoysLeft = 5 * iLevel;
mc_LevelOutput._visible = true;
mc_LevelOutput.gotoAndPlay(2);
sNewLevel.start(0, 0);
} else {
gameOver(true);
}
}
function gameOver(iWin) {
mc_Reward._visible = true;
sendTrollars();
var i = 0;
while (i < 10) {
removeMovieClip(eval ("Boy" + i));
removeMovieClip(eval ("lifeSaver" + i));
i++;
}
if (iWin) {
mc_Reward.gotoAndStop(2);
}
sBGM.stop();
sGameOver.start(0, 0);
bWait = true;
}
function resetGame() {
bWait = false;
i_mouseX = _root._xmouse;
i_mouseY = _root._ymouse;
i_PlyrCurRot = player._rotation;
distX = i_mouseX - player._x;
distY = i_mouseY - player._y;
iBobSpd = 1;
iScore = 0;
iAward = 0;
iBoysLeft = 5;
sTimeLeft = null;
iSeconds = 0;
iMinutes = 1;
iLevelMax = 300;
iLevelMin = 30;
iLevel = 1;
var _local2 = 0;
while (_local2 < 10) {
aBoyTimer[_local2] = null;
_local2++;
}
iSaverIndex = 0;
iBoyIndex = 0;
iBoySpawnCounter = 300;
mc_LevelOutput._visible = true;
mc_LevelOutput.gotoAndPlay(2);
sBGM.start(0, 0);
}
function handleTime() {
var _local1 = null;
var _local2 = null;
if (!bWait) {
if ((--iSeconds) < 0) {
iSeconds = 59;
if (iMinutes > 0) {
iMinutes--;
} else {
checkNextLevel();
}
}
if (iSeconds < 10) {
_local1 = "0" + iSeconds.toString();
} else {
_local1 = iSeconds.toString();
}
_local2 = iMinutes.toString();
sTimeLeft = (_local2 + ":") + _local1;
}
updateAfterEvent();
}
function setSoundToggle(bool) {
if (bool) {
mainSound.setVolume(100);
} else {
mainSound.setVolume(0);
}
}
function requestSoundToggle(bool) {
receiveConn.send("trollz_sound_push", "setSound", bool);
}
var bWait = true;
var i_mouseX = _root._xmouse;
var i_mouseY = _root._ymouse;
var i_PlyrCurRot = player._rotation;
var distX = (i_mouseX - player._x);
var distY = (i_mouseY - player._y);
var degrees;
var iLifeSaverX;
var iLifeSaverY;
var iBobSpd = 1;
var iScore = 0;
var iAward = 0;
var iBoysLeft = 5;
var sTimeLeft = null;
var iSeconds = 0;
var iMinutes = 1;
var iLevelMax = 300;
var iLevelMin = 30;
var iLevel = 1;
var aBoyTimer = new Array();
var iSaverIndex = 0;
var aSaverSpdX = new Array();
var aSaverSpdY = new Array();
var iBoyIndex = 0;
var iBoySpawnCounter = 100;
onLoad = function () {
};
var lMouseListener = new Object();
lMouseListener.onMouseDown = function () {
throwLifeSaver();
};
Mouse.addListener(lMouseListener);
var timeHandler = setInterval(handleTime, 1000);
var sBGM = new Sound(this);
sBGM.attachSound("BGM");
var sGameOver = new Sound(this);
sGameOver.attachSound("GameOver");
var sNewLevel = new Sound(this);
sNewLevel.attachSound("NewLevel");
var sThrow = new Sound(this);
sThrow.attachSound("Throw");
var sCatch = new Sound(this);
sCatch.attachSound("Catch");
var sMiss = new Sound(this);
sMiss.attachSound("Miss");
sBGM.onSoundComplete = function () {
sBGM.start(0, 0);
};
receiveConn = new LocalConnection();
receiveChannel = "save_the_boys";
mainSound = new Sound(this);
receiveConn.toggleSound = function (bool) {
setSoundToggle(bool);
clearInterval(soundCheck);
};
do {
receiveChannel = receiveChannel + "x";
var conSuccess = receiveConn.connect(receiveChannel);
} while (conSuccess == false);
setSoundToggle(false);
soundCheck = setInterval(function () {
receiveConn.send("trollz_sound_push", "registerChannel", receiveChannel);
}, 500, this);
setSoundToggle(true);
onEnterFrame = function () {
if (!bWait) {
rotatePlayer();
bobPlayer();
moveSaver();
manageBoys();
}
};
stop();
Instance of Symbol 17 MovieClip "mc_BoatRipples" in Frame 2
onClipEvent (enterFrame) {
this._x = player._x;
this._y = player._y;
this._rotation = player._rotation;
}
Instance of Symbol 29 MovieClip "mc_Mouse" in Frame 2
onClipEvent (load) {
this._visible = false;
}
onClipEvent (enterFrame) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
Instance of Symbol 83 MovieClip "mc_LevelOutput" in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 93 MovieClip "mc_HelpPanel" in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 116 MovieClip "mc_Reward" in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 130 MovieClip [mc_Help] "mc_Help" in Frame 2
on (release, releaseOutside) {
_parent.mc_HelpPanel._visible = true;
_root.bWait = true;
}
Instance of Symbol 133 MovieClip [mc_Quit] "mc_Quit" in Frame 2
on (release, releaseOutside) {
_parent.sendTrollars();
clearInterval(_root.timeHandler);
_level0.unloadGame();
}
Symbol 25 MovieClip Frame 1
stop();
Symbol 25 MovieClip Frame 5
gotoAndStop (1);
Symbol 42 MovieClip Frame 1
stop();
Symbol 42 MovieClip Frame 30
removeMovieClip(_parent);
Symbol 49 MovieClip Frame 1
stop();
Symbol 49 MovieClip Frame 30
removeMovieClip(_parent);
Symbol 56 MovieClip Frame 1
stop();
Symbol 56 MovieClip Frame 30
removeMovieClip(_parent);
Symbol 62 MovieClip Frame 1
stop();
Symbol 62 MovieClip Frame 30
removeMovieClip(_parent);
Symbol 68 MovieClip Frame 1
stop();
Symbol 68 MovieClip Frame 30
removeMovieClip(_parent);
Symbol 69 MovieClip Frame 1
stop();
Symbol 69 MovieClip Frame 2
stop();
Symbol 69 MovieClip Frame 3
stop();
Symbol 69 MovieClip Frame 4
stop();
Symbol 69 MovieClip Frame 5
stop();
Symbol 83 MovieClip Frame 160
this._visible = false;
this.gotoAndStop(1);
Instance of Symbol 88 MovieClip "mc_CloseBtn" in Symbol 93 MovieClip Frame 1
on (release, releaseOutside) {
_parent._visible = false;
_root.bWait = false;
}
Symbol 102 Button
on (release) {
this._visible = false;
_parent.bGameOver = false;
_root.getScore();
_parent.resetGame();
}
Symbol 114 Button
on (release, releaseOutside) {
getURL ("http://www.trollz.com/", _blank);
}
Symbol 116 MovieClip Frame 1
stop();
Symbol 116 MovieClip Frame 2
stop();
Symbol 124 Button
on (release, releaseOutside) {
_root.bWait = false;
_root.sBGM.start(0, 0);
_root.mc_LevelOutput._visible = true;
_root.mc_LevelOutput.gotoAndPlay(2);
this._visible = false;
}
Symbol 125 MovieClip Frame 40
stop();