Instance of Symbol 50 MovieClip in Frame 1
on (release) {
_root.getURL("http://www.arcadetown.com/index.asp?gameid=alienparatroopers", "_blank");
}
Instance of Symbol 50 MovieClip in Frame 141
on (release) {
_root.getURL("http://www.arcadetown.com/index.asp?gameid=alienparatroopers", "_blank");
}
Frame 142
if (init == undefined) {
if (_root._url.indexOf("file:///") == -1) {
mochi.as2.MochiServices.connect("96acd2c84f322ec7", _root, onError);
} else {
trace("Ignoring MochiServices since we are on localhost");
}
_root.kongregateServices.connect();
__com_mochibot__("9807d994", this, 10301, true);
init = true;
}
var demo = false;
var showAds = false;
Mouse.show();
if (showAds) {
if (_root._url.indexOf("file:///") == -1) {
mochi.as2.MochiAd.showInterLevelAd({id:"96acd2c84f322ec7", res:"640x480"});
}
}
Frame 143
if (!demo) {
gotoAndPlay (392);
}
Frame 392
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
gotoAndStop (394);
}
Frame 394
function menuHandler(obj, menuObj) {
menuObj.customItems[0].enabled = true;
_root.showBubble("Mouse went off-screen.\nPlease click this bubble\nwhen you're ready!");
}
function itemHandler(obj, item) {
getURL ("http://www.arcadetown.com/index.asp?gameid=alienparatroopers", "_blank");
}
var my_cm = new ContextMenu(menuHandler);
my_cm.customItems.push(new ContextMenuItem("Visit www.arcadetown.com", itemHandler));
this.menu = my_cm;
initAlienShip = function (alien) {
do {
alien.movement = (Math.random() * 4) - 2;
} while (((alien.movement < 0) ? (-alien.movement) : (alien.movement)) < 0.5);
if (alien.movement > 0) {
alien._x = (-alien._width) * (1 + (Math.random() * 7));
} else {
alien._x = Stage.width + (alien._width * (0.5 + (Math.random() * 7)));
}
alien.initY = alien._y;
alien.phaseShift = (Math.random() * 2) * Math.PI;
};
InputWrapper.init();
follow = 0;
screen = 0;
choice = 0;
if (soundEffects == undecided) {
soundEffects = true;
}
if (tutorialEnabled == undecided) {
tutorialEnabled = true;
}
if (musicEffects == undecided) {
musicEffects = true;
_root.musicEnabled = musicEffects;
}
if (_root.musicEnabled == false) {
sndEvolution.gotoAndPlay("stop");
} else {
_root.sndEvolution.gotoAndPlay("start");
}
menuSoundEffects = soundEffects;
i = 1;
while (i <= 3) {
var alien = _root["alienShip" + i];
initAlienShip(alien);
alien.onEnterFrame = function () {
this._x = this._x + this.movement;
this._y = this.initY + (2 * Math.sin(this.phaseShift + (((Math.PI/2) * getTimer()) / 1000)));
if ((this.movement > 0) && ((this._x - this._width) > Stage.width)) {
initAlienShip(this);
}
if ((this.movement < 0) && ((this._x + this._width) < 0)) {
initAlienShip(this);
}
};
i++;
}
stop();
Frame 395
gotoAndStop (394);
Frame 396
stop();
delete alienShip1.onEnterFrame;
delete alienShip2.onEnterFrame;
delete alienShip3.onEnterFrame;
if (screen == 1) {
gotoAndPlay (392);
} else if (screen == 2) {
gotoAndPlay (913);
} else if (screen == 3) {
gotoAndPlay (914);
} else if (screen == 4) {
gotoAndPlay (917);
}
Frame 397
if (_root.menuSoundEffects == true) {
_root.sndMothership.gotoAndPlay("start");
}
Frame 494
guy.ani.gotoAndStop(guy.ani._totalframes);
if (_root.menuSoundEffects == true) {
_root.sndBeam.gotoAndPlay("start");
}
Frame 514
state = 1;
text1 = "Earthling! A Great Evil has fallen upon my people!\nAnd now it falls upon yours...";
text2 = "After a bloody military coup, our General has taken control of our planet! And now he wants Earth!";
text3 = "Our Council of Elders have sent me here to\nconvey our regrets, and to help guide you to victory.";
text4 = "Knowledge is power, and combined with your skill, Earth can put up a fight, worthy of a timeless Legend!";
startGame = function () {
guy.ani.gotoAndStop(guy.ani._totalframes);
gotoAndPlay ("frmEnd");
};
updateIntro = function (text) {
if (txtIntro == undefined) {
trace("quitting intro");
delete startGame;
delete updateIntro;
return(undefined);
}
txtIntro.text = text;
if (state == 1) {
guy.ani.play();
}
state++;
var newText = _root["text" + state];
if (newText != undefined) {
setTimeout(updateIntro, 7000, newText);
} else {
setTimeout(startGame, 8500);
}
};
setTimeout(updateIntro, 500, _root["text" + state]);
Frame 832
stop();
Frame 833
_root.sndEvolution.gotoAndPlay("stop");
Frame 863
gotoAndPlay (919);
Frame 913
mochi.as2.MochiEvents.trackEvent("OptionsMenu Activated");
stop();
if (soundEffects == true) {
menuscreen.soundon.gotoAndStop(1);
menuscreen.soundoff.gotoAndStop(1);
} else if (soundEffects == false) {
menuscreen.soundon.gotoAndStop(2);
menuscreen.soundoff.gotoAndStop(2);
}
if (musicEnabled == true) {
menuscreen.musicon.gotoAndStop(1);
menuscreen.musicoff.gotoAndStop(1);
} else if (musicEnabled == false) {
menuscreen.musicon.gotoAndStop(2);
menuscreen.musicoff.gotoAndStop(2);
}
if (tutorialEnabled == true) {
menuscreen.tutorialon.gotoAndStop(1);
menuscreen.tutorialoff.gotoAndStop(1);
} else if (tutorialEnabled == false) {
menuscreen.tutorialon.gotoAndStop(2);
menuscreen.tutorialoff.gotoAndStop(2);
}
if (difficulty == 1) {
menuscreen.diffnoob.gotoAndStop(2);
menuscreen.diffnorm.gotoAndStop(2);
menuscreen.diffowned.gotoAndStop(1);
} else if (difficulty == 2) {
menuscreen.diffnoob.gotoAndStop(1);
menuscreen.diffnorm.gotoAndStop(1);
menuscreen.diffowned.gotoAndStop(1);
} else if (difficulty == 3) {
menuscreen.diffnoob.gotoAndStop(1);
menuscreen.diffnorm.gotoAndStop(2);
menuscreen.diffowned.gotoAndStop(2);
}
if (_root._quality == "LOW") {
menuscreen.low.gotoAndStop(2);
menuscreen.med.gotoAndStop(1);
menuscreen.high.gotoAndStop(2);
} else if (_root._quality == "MEDIUM") {
menuscreen.low.gotoAndStop(1);
menuscreen.med.gotoAndStop(2);
menuscreen.high.gotoAndStop(2);
} else if (_root._quality == "BEST") {
menuscreen.low.gotoAndStop(1);
menuscreen.med.gotoAndStop(1);
menuscreen.high.gotoAndStop(1);
}
if (GameModes.__get__mode() == GameModes.NormalMode) {
_root.menuscreen.survival.gotoAndStop(1);
_root.menuscreen.squids.gotoAndStop(1);
_root.menuscreen.keyboard.gotoAndStop(1);
} else if (GameModes.__get__mode() == GameModes.KeyboardMode) {
_root.menuscreen.survival.gotoAndStop(2);
_root.menuscreen.squids.gotoAndStop(1);
_root.menuscreen.keyboard.gotoAndStop(2);
} else if (GameModes.__get__mode() == GameModes.SquidMode) {
_root.menuscreen.survival.gotoAndStop(2);
_root.menuscreen.squids.gotoAndStop(2);
_root.menuscreen.keyboard.gotoAndStop(1);
}
Frame 914
stop();
mouse.hide();
Frame 915
stop();
Frame 916
stop();
Frame 917
mochi.as2.MochiEvents.trackEvent("Credits Scene Activated");
stop();
mouse.hide();
Frame 918
stop();
Frame 919
_root.menuscreen._visible = false;
showmenu = 0;
initialTime = getTimer();
money = 0;
function initSounds() {
if (musicEnabled) {
bossMusic.gotoAndPlay("stop");
music.gotoAndPlay("start");
}
}
function BulletsInit() {
_root.createEmptyMovieClip("bulletsLayer", Util.bulletDepth);
bulletsLayer.createEmptyMovieClip("Left", bulletsLayer.getNextHighestDepth());
bulletsLayer.createEmptyMovieClip("Right", bulletsLayer.getNextHighestDepth());
lstBulletsLeftHead = 0;
lstBulletsLeftTail = 0;
lstBulletsRightHead = 0;
lstBulletsRightTail = 0;
bulletsLayer.s = new Sound(bulletsLayer);
bulletsLayer.s.setVolume(50);
MAX_BULLETS = 100;
}
function isHitByBullet(obj, side) {
var ret = 0;
if (side == "Both") {
ret = isHitByBullet(obj, "Left");
if (ret > 0) {
return(ret);
}
side = "Right";
}
pushSegment(50, "isHitByBullet");
var right;
var tail;
var head;
if (side == "Right") {
right = true;
tail = _root.lstBulletsRightTail;
head = _root.lstBulletsRightHead;
} else {
right = false;
tail = _root.lstBulletsLeftTail;
head = _root.lstBulletsLeftHead;
}
var bullets = (((tail + MAX_BULLETS) - head) % MAX_BULLETS);
var l = 0;
var u = (bullets - 1);
var mid = 0;
var ref = base.getBounds(_root);
var midBase = ((ref.xMin + ref.xMax) / 2);
var o = obj.getBounds(_root);
var dyu = (o.yMin - ref.yMax);
var dyl = (o.yMax - ref.yMax);
var dxl;
var dxu;
if (right) {
dxl = o.xMin - midBase;
dxu = o.xMax - midBase;
} else {
dxu = o.xMin - midBase;
dxl = o.xMax - midBase;
}
obj.rl = (dxl * dxl) + (dyl * dyl);
obj.ru = (dxu * dxu) + (dyu * dyu);
if (bullets > 0) {
while (l <= u) {
mid = int((l + u) / 2);
var index = ((head + mid) % MAX_BULLETS);
var enm = ("Bullet" + index);
var bul = bulletsLayer[side][enm];
var b = bul.getBounds(_root);
var dyu = (b.yMin - ref.yMax);
var dyl = (b.yMax - ref.yMax);
var dxl;
var dxu;
if (right) {
dxl = b.xMin - midBase;
dxu = b.xMax - midBase;
} else {
dxu = b.xMin - midBase;
dxl = b.xMax - midBase;
}
bul.rl = (dxl * dxl) + (dyl * dyl);
bul.ru = (dxu * dxu) + (dyu * dyu);
if (bul.rl > obj.ru) {
l = mid + 1;
} else if (bul.ru < obj.rl) {
u = mid - 1;
} else {
break;
}
}
if (l > u) {
} else {
var i = l;
while (i <= u) {
var index = ((head + i) % MAX_BULLETS);
var enm = ("Bullet" + index);
var bul = bulletsLayer[side][enm];
i++;
if (!bul.isActive) {
continue;
}
pushSegment(51, "HitTest");
if (obj.hitTest(bul)) {
bul.hitSomething = true;
var g = bul.gun;
if (g.isTangible()) {
ret = (u + 1) - l;
if (g.__get__hitOnce() || (obj.impenetrable == true)) {
removeBullet(bul);
}
obj.damage = obj.damage + g.damage;
popSegment();
break;
}
}
popSegment();
}
}
}
popSegment();
return(ret);
}
var lstBulletsLeftHead = 0;
var lstBulletsLeftTail = 0;
var lstBulletsRightHead = 0;
var lstBulletsRightTail = 0;
var MAX_BULLETS = 100;
deleteBullet = function (bullet) {
if (bullet.hitSomething) {
bullet.gun.successfulBullets++;
}
delete bullet.onEnterFrame;
_root[bullet.lstHead]++;
_root[bullet.lstHead] = _root[bullet.lstHead] % MAX_BULLETS;
bullet.removeMovieClip();
};
removeBullet = function (bullet) {
bullet.isActive = false;
bullet._visible = false;
};
createBullet = function (gun, pan, rot, atMouse) {
if ((gameState == GS_Explosion) || (gameState == GS_Die)) {
return(undefined);
}
pushSegment(20, "CreateBullet");
if (weaponScreen._visible == false) {
gun.totalBullets++;
}
rot = rot + defender._rotation;
var layer;
if (rot > 0) {
layer = "Right";
} else {
layer = "Left";
}
lstHead = ("lstBullets" + layer) + "Head";
lstTail = ("lstBullets" + layer) + "Tail";
var type = "Bullet";
var nm = ("Bullet" + _root[lstTail]);
var bullet = bulletsLayer[layer].attachMovie(type, nm, _root[("lstBullets" + layer) + "Tail"]);
bullet.gotoAndStop(gun.__get__BulletClip());
bullet.gun = gun;
bullet._rotation = rot;
bullet.isActive = true;
var rotation = (rot + 90);
rotation = rotation / 57.3;
var cos = Math.cos(rotation);
var sin = Math.sin(rotation);
bullet.dx = (-bullet.gun.speed) * cos;
bullet.dy = (-bullet.gun.speed) * sin;
var x = (defender._x - (cos * 30));
var y = (defender._y - (sin * 30));
bullet._x = x + (sin * pan);
bullet._y = y - (cos * pan);
if (atMouse && (((pan < 0) ? (-pan) : (pan)) > 0)) {
var dist = Math.sqrt(((_xmouse - x) * (_xmouse - x)) + ((_ymouse - y) * (_ymouse - y)));
var angle = (Math.atan2(dist, pan) - 1.571);
var cos = Math.cos(rotation + angle);
var sin = Math.sin(rotation + angle);
bullet.dx = (-bullet.gun.speed) * cos;
bullet.dy = (-bullet.gun.speed) * sin;
bullet._rotation = bullet._rotation + (angle * 57.3);
}
bullet.side = layer;
bullet.lstHead = lstHead;
bullet.lstTail = lstTail;
bullet.hitSomething = false;
bullet.onEnterFrame = function () {
if (((gameState == GS_Pause) && (weaponScreen._visible == false)) || (gameState == GS_Die)) {
return(undefined);
}
pushSegment(25, "RunBullet");
this._x = this._x + (this.dx * dt);
this._y = this._y + (this.dy * dt);
var MotherShipWidth = 160;
var bounds = this.getBounds(_root);
if (((bounds.yMax < -20) || (bounds.xMax < (-MotherShipWidth))) || (bounds.xMin > (ScreenWidth + MotherShipWidth))) {
_root.deleteBullet(this);
} else if (this.isActive) {
this.gun.bulletFrame(this);
}
popSegment();
};
_root[lstTail]++;
_root[lstTail] = _root[lstTail] % MAX_BULLETS;
if (Score >= 1) {
Score = Score - int(gun.__get__damage());
}
popSegment();
return(bullet);
};
function resetObjects() {
dayNight.gotoAndStop(1);
crosshair._visible = false;
base._visible = false;
city._visible = false;
delete defender.onEnterFrame;
defender._visible = false;
defender.removeMovieClip();
weaponScreen._visible = false;
healthBoss._visible = false;
var sides = ["Left", "Right"];
_root.MothershipsHit = 0;
_root.AliensHit = 0;
_root.MonstersHit = 0;
_root.SquidsHit = 0;
_root.endBlip = 0;
_root.endNuke = 0;
_root.end2x = 0;
_root.end3x = 0;
_root.endIntercepted = 0;
for (var s in sides) {
var side = sides[s];
for (var i in aliensLayer[side]) {
if (typeof(aliensLayer[side][i]) != "movieclip") {
continue;
}
aliensLayer[side][i]._visible = false;
if (i.slice(0, 5) == "Alien") {
removeAlien(aliensLayer[side][i]);
} else {
aliensLayer[side][i].removeMovieClip();
}
}
for (var i in aliensLayer[("floor" + side) + "Layer"]) {
if (typeof(aliensLayer[("floor" + side) + "Layer"][i]) != "movieclip") {
continue;
}
aliensLayer[("floor" + side) + "Layer"][i]._visible = false;
aliensLayer[("floor" + side) + "Layer"][i].removeMovieClip();
aliensLayer[("floor" + side) + "Layer"].size--;
}
for (var i in bulletsLayer[side]) {
if (typeof(bulletsLayer[side][i]) != "movieclip") {
continue;
}
bulletsLayer[side][i]._visible = false;
removeBullet(bulletsLayer[side][i]);
}
for (var i in squidsLayer[side]) {
if (typeof(squidsLayer[side][i]) != "movieclip") {
continue;
}
squidsLayer[side][i]._visible = false;
removeSquid(squidsLayer[side][i]);
}
}
for (var i in mothershipsLayer) {
if (typeof(mothershipsLayer[i]) != "movieclip") {
continue;
}
mothershipsLayer[i]._visible = false;
removeMothership(mothershipsLayer[i]);
}
for (var i in blipsLayer) {
if (typeof(blipsLayer[i]) != "movieclip") {
continue;
}
blipsLayer[i]._visible = false;
removeBlip(blipsLayer[i]);
}
giantShip.gotoAndPlay("frmDone");
giantShip.a = 0;
giantShip.v = 0;
delete giantShip.onEnterFrame;
giantShip._visible = false;
var i = 1;
while (i <= 6) {
_root["chute" + i].gotoAndPlay("frmDestroy");
_root["chute" + i]._visible = false;
i++;
}
if (Nukes != undefined) {
var i = 0;
while (i < Nukes) {
var nm = ("NukeIcon" + i);
if (NukeLayer[nm] != undefined) {
NukeLayer[nm]._visible = false;
}
i++;
}
Nukes = 0;
}
_root.menuscreen._visible = false;
_root.showmenu = 0;
}
function resetGame(lvl) {
level = lvl;
disp_level = 1;
disp_wave = 1;
MoneySpent = 0;
AliensHit = 0;
SquidsHit = 0;
Score = 0;
Gun.initKeyMap();
updateWeaponBar();
resetObjects();
gun = Gun.getCurrentGun();
bulletsLayer.s.attachSound(gun.sound);
DefenderInit();
Nukes = 4 - difficulty;
var i = 0;
while (i < Nukes) {
var nm = ("NukeIcon" + i);
if (NukeLayer[nm] == undefined) {
var nuke = NukeLayer.attachMovie("NukeIcon", nm, NukeLayer.getNextHighestDepth());
nuke._x = 20 + (i * (nuke._width + 5));
nuke._y = 420.3;
}
NukeLayer[nm]._visible = true;
i++;
}
if (GameModes.__get__mode() != GameModes.KeyboardMode) {
Mouse.hide();
crosshair._visible = true;
} else {
Mouse.show();
crosshair._visible = false;
}
city._visible = true;
lastTime = getTimer();
lastFPSTime = lastTime;
lastBulletTime = lastTime;
lastLevelTime = lastTime;
gameState = GS_EndLevel;
transitionLevel();
}
function UpdateScoring(lvl) {
Score = Score + ((lvl - 1) * 100);
if (Score < 0) {
Score = 0;
}
ScoreBullet = -1;
ScoreMothership = 80;
ScoreBlip = lvl * 500;
ScoreAlien = 60;
ScoreFallingAlien = 80;
ScoreAlienOnGround = 150;
ScoreIntercepted = 300;
ScoreTripleKill = 200;
ScoreDoubleKill = 50;
ScorePlatform = 40;
ScoreFallingPlatform = 100;
ScoreMonster = 200;
ScoreForceField = 50;
ScoreChute = 1000;
ScoreSquid = 60;
ScoreGiantShip = 1600;
}
function DoDeath(floor, offset) {
var AlienMovement = 75;
if ((gameState != GS_AlienDeath) && ((gameState == GS_Play) || (gameState == GS_EndLevel))) {
pushSegment(8, "DoDeath");
_root.stateBeforeDeath = gameState;
gameState = GS_AlienDeath;
floor.al = 0;
MinDiff = (AlienMovement * dt) + 1;
var i = 0;
for (var a in floor) {
if (typeof(floor[a]) != "movieclip") {
continue;
}
var alien2 = floor[a];
delete alien2.onEnterFrame;
if (alien2._y < Bottom) {
alien2._y = Bottom;
}
alien2.i = i;
alien2.gotoAndStop("land");
alien2.initWidth = alien2._width;
alien2.initHeight = alien2._height;
i++;
alien2.onEnterFrame = function () {
if (gameState == GS_Pause) {
return(undefined);
}
if ((gameState == GS_Die) || (gameState == GS_Explosion)) {
this.gotoAndStop("land");
delete this.onEnterFrame;
return(undefined);
}
if (floor.size < 4) {
gameState = GS_Play;
this.gotoAndStop("land");
delete this.onEnterFrame;
return(undefined);
}
if (this.i == floor.al) {
var dx = ((base._x + (base._width / 2)) - (this._x + (this.initWidth / 2)));
var dy = (Bottom - this._y);
if (this.i == 0) {
if (Math.abs(dx) < (((base._width / 2) + (this.initWidth / 2)) + MinDiff)) {
if (Math.abs(dx) < ((base._width / 2) + (this.initWidth / 2))) {
this._x = this._x - ((SGN(dx) * AlienMovement) * dt);
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
} else {
floor.al++;
for (var a in floor) {
if (typeof(floor[a]) != "movieclip") {
continue;
}
if (floor[a].i == floor.al) {
floor[a].gotoAndStop("frmWalking");
}
}
this.gotoAndStop("land");
delete this.onEnterFrame;
}
} else {
this._x = this._x + ((SGN(dx) * AlienMovement) * dt);
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
}
} else if (this.i == 1) {
if (Math.abs(dx) < ((((base._width / 2) + (this.initWidth / 2)) + this.initWidth) + MinDiff)) {
if (dy < this.initHeight) {
if (Math.abs(dx) < (((base._width / 2) + (this.initWidth / 2)) + this.initWidth)) {
this._x = this._x - ((SGN(dx) * AlienMovement) * dt);
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
} else {
this._y = this._y - (AlienMovement * dt);
this.gotoAndStop("land");
}
} else if (Math.abs(dx) < (((base._width / 2) + (this.initWidth / 2)) + MinDiff)) {
if (Math.abs(dx) < ((base._width / 2) + (this.initWidth / 2))) {
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
this._x = this._x - ((SGN(dx) * AlienMovement) * dt);
} else {
floor.al++;
for (var a in floor) {
if (typeof(floor[a]) != "movieclip") {
continue;
}
if (floor[a].i == floor.al) {
floor[a].gotoAndStop("frmWalking");
}
}
this.gotoAndStop("land");
delete this.onEnterFrame;
}
} else {
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
this._x = this._x + ((SGN(dx) * AlienMovement) * dt);
}
} else {
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
this._x = this._x + ((SGN(dx) * AlienMovement) * dt);
}
} else if (this.i == 2) {
if (Math.abs(dx) < ((((base._width / 2) + (this.initWidth / 2)) + this.initWidth) + MinDiff)) {
if (Math.abs(dx) < (((base._width / 2) + (this.initWidth / 2)) + this.initWidth)) {
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
this._x = this._x - ((SGN(dx) * AlienMovement) * dt);
} else {
floor.al++;
for (var a in floor) {
if (typeof(floor[a]) != "movieclip") {
continue;
}
if (floor[a].i == floor.al) {
floor[a].gotoAndStop("frmWalking");
}
}
this.gotoAndStop("land");
delete this.onEnterFrame;
}
} else {
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
this._x = this._x + ((SGN(dx) * AlienMovement) * dt);
}
} else if (this.i == 3) {
if (Math.abs(dx) < ((((base._width / 2) + (this.initWidth / 2)) + (2 * this.initWidth)) + MinDiff)) {
if ((dy < this.initHeight) && (Math.abs(dx) >= MinDiff)) {
if (Math.abs(dx) < (((base._width / 2) + (this.initWidth / 2)) + (2 * this.initWidth))) {
this._x = this._x - ((SGN(dx) * AlienMovement) * dt);
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
} else {
this._y = this._y - (AlienMovement * dt);
this.gotoAndStop("land");
}
} else if (Math.abs(dx) < ((((base._width / 2) + (this.initWidth / 2)) + this.initWidth) + MinDiff)) {
if ((dy < (this.initHeight * 2)) && (Math.abs(dx) >= MinDiff)) {
if (Math.abs(dx) < ((base._width / 2) + this.initWidth)) {
this._x = this._x - ((SGN(dx) * AlienMovement) * dt);
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
} else {
this._y = this._y - (AlienMovement * dt);
this.gotoAndStop("land");
}
} else if (Math.abs(dx) < MinDiff) {
this._x = (base._x + (base._width / 2)) - (this.initWidth / 2);
if (dy <= 0) {
floor.al++;
this.gotoAndStop("land");
delete this.onEnterFrame;
mochi.as2.MochiEvents.trackEvent("CauseOfDeath", "Infiltrated");
killDefender();
} else {
this._y = this._y + (AlienMovement * dt);
this.gotoAndStop("land");
}
} else {
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
this._x = this._x + ((SGN(dx) * AlienMovement) * dt);
}
} else {
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
this._x = this._x + ((SGN(dx) * AlienMovement) * dt);
}
} else {
if (this._currentFrame == 2) {
this.gotoAndStop("frmWalking");
}
this._x = this._x + ((SGN(dx) * AlienMovement) * dt);
}
}
}
};
}
popSegment();
}
}
function SGN(n) {
if (n < 0) {
return(-1);
}
return(1);
}
function loadLevel(level) {
var strState;
txtLevel.text = level;
UpdateScoring(level);
var lvl;
var offset = 0;
lvl = level + (bossInterval * ((_root.difficulty - 1) + offset));
disp_level = Math.floor((level - 1) / bossInterval) + 1;
disp_wave = Math.floor((level - 1) % bossInterval) + 1;
if ((((lvl % bossInterval) == 0) && (GameModes.__get__mode() != GameModes.SquidMode)) && (GameModes.__get__mode() != GameModes.KeyboardMode)) {
if (musicEnabled) {
music.gotoAndPlay("stop");
bossMusic.gotoAndPlay("start");
}
setGiantAILevel(lvl);
strState = GS_Giant;
} else {
if (musicEnabled) {
bossMusic.gotoAndPlay("stop");
music.gotoAndPlay("start");
}
setMothershipAILevel(lvl);
setMonsterAILevel(lvl);
strState = GS_Play;
if ((((lvl % bossInterval) == 1) && (level > 1)) && ((GameModes.__get__mode() == GameModes.SquidMode) || (GameModes.__get__mode() == GameModes.KeyboardMode))) {
if (soundEffects) {
_root.sndBonusShip.gotoAndPlay("start");
}
Gun.getGun(5).__set__upgradeLevel((Gun.getGun(5).__get__upgradeLevel()+1));
_root.showBubble("Congratulations!\nYou are being awarded a new Nuke!\nPress Space to use!");
strState = GS_Pause;
}
}
if (level == 1) {
if (GameModes.__get__mode() == GameModes.KeyboardMode) {
setTimeout(showBubble, levelInterval / 4, "In Legacy Mode, Keys are based on\noriginal DOS game, 'Paratroopers'.\nTherefore, these may feel unintuitive!");
} else {
setTimeout(showBubble, levelInterval / 4, "Here they come!\nI must hide, but please,\nStop the Alien Invasion!");
}
}
return(strState);
}
function rewardPlayer() {
if ((GameModes.__get__mode() != GameModes.BarrelMode) && (GameModes.__get__mode() != GameModes.ExplosiveMode)) {
_root.openWeaponScreen();
} else {
_root.gameState = _root.GS_EndLevel;
if (((_root.level == (bossInterval * 10)) || (_root.level == (bossInterval * 6))) || (_root.level == (bossInterval * 3))) {
if (_root.soundEffects) {
_root.sndBonusShip.gotoAndPlay("start");
}
_root.gun.upgradeLevel++;
_root.showBubble("Congratulations!\nWeapon Upgraded!");
}
if ((Math.round(_root.level / bossInterval) % 4) == 0) {
if (_root.soundEffects) {
_root.sndBonusShip.gotoAndPlay("start");
}
Gun.getGun(5).__set__upgradeLevel((Gun.getGun(5).__get__upgradeLevel()+1));
_root.showBubble("Congratulations!\nYou are being awarded a new Nuke!\nPress Space to use!");
}
}
}
function pauseGame() {
if (_root.pauseEnabled) {
if (_root.gameState != _root.GS_Pause) {
_root.lastGameState = _root.gameState;
_root.gameState = _root.GS_Pause;
_root.pauseTime = getTimer();
stars.stop();
var sides = ["Left", "Right"];
for (var s in sides) {
var side = sides[s];
for (var i in _root.aliensLayer[side]) {
var m = _root.aliensLayer[side][i];
if (typeof(m) != "movieclip") {
continue;
}
if (i.slice(0, 5) == "Alien") {
m.ani.stop();
} else {
m.stop();
}
}
for (var i in _root.aliensLayer[("floor" + side) + "Layer"]) {
var m = _root.aliensLayer[("floor" + side) + "Layer"][i];
if (typeof(m) != "movieclip") {
continue;
}
m.ani.stop();
}
for (var i in _root.squidsLayer[side]) {
var m = _root.squidsLayer[side][i];
if (typeof(m) != "movieclip") {
continue;
}
m.ani.stop();
}
for (var i in _root.monstersLayer[side]) {
var m = _root.monstersLayer[side][i];
if (typeof(m) != "movieclip") {
continue;
}
if ((m.state < 1) || (m.ani._currentframe < m.ani._totalframes)) {
m.ani.stop();
}
}
}
for (var i in mothershipsLayer) {
if (typeof(mothershipsLayer[i]) != "movieclip") {
continue;
}
mothershipsLayer[i].ani.stop();
}
for (var i in ExplosionLayer) {
if (typeof(ExplosionLayer[i]) != "movieclip") {
continue;
}
ExplosionLayer[i].stop();
}
_root.nukeDomain.stop();
if (_root.gun.lastSwitchTime != 0) {
_root.gun.useTime = _root.gun.useTime + ((getTimer() - _root.gun.lastSwitchTime) / 1000);
}
_root.gun.lastSwitchTime = 0;
}
}
}
function resumeGame() {
if (_root.pauseEnabled) {
if (_root.gameState == _root.GS_Pause) {
_root.gameState = _root.lastGameState;
_root.gun.lastSwitchTime = getTimer();
timePaused = getTimer() - _root.pauseTime;
lastLevelTime = lastLevelTime + timePaused;
stars.play();
var sides = ["Left", "Right"];
for (var s in sides) {
var side = sides[s];
for (var i in _root.aliensLayer[side]) {
var m = _root.aliensLayer[side][i];
if (typeof(m) != "movieclip") {
continue;
}
if (i.slice(0, 5) == "Alien") {
m.ani.play();
} else {
m.play();
}
}
for (var i in _root.aliensLayer[("floor" + side) + "Layer"]) {
var m = _root.aliensLayer[("floor" + side) + "Layer"][i];
if (typeof(m) != "movieclip") {
continue;
}
m.ani.play();
}
for (var i in _root.squidsLayer[side]) {
var m = squidsLayer[side][i];
m.ani.play();
}
for (var i in _root.monstersLayer[side]) {
var m = _root.monstersLayer[side][i];
if (typeof(m) != "movieclip") {
continue;
}
if ((m.state < 1) || (m.ani._currentframe < m.ani._totalframes)) {
m.ani.play();
}
m.startTime = m.startTime + timePaused;
}
}
for (var i in mothershipsLayer) {
if (typeof(mothershipsLayer[i]) != "movieclip") {
continue;
}
mothershipsLayer[i].ani.play();
}
for (var i in ExplosionLayer) {
if (typeof(ExplosionLayer[i]) != "movieclip") {
continue;
}
ExplosionLayer[i].play();
}
_root.nukeDomain.play();
}
}
}
function togglePause() {
if (_root.pauseEnabled) {
if (_root.gameState == _root.GS_Pause) {
resumeGame();
} else {
pauseGame();
}
}
}
transitionLevel = function () {
if (gameState == GS_EndLevel) {
if ((getMothershipCount() > 0) || (getAlienCount() > 0)) {
lastLevelTime = curTime;
} else {
var dt = (curTime - lastLevelTime);
if (dt > levelInterval) {
level++;
gameState = loadLevel(level);
cleared = 0;
} else if ((dt > (levelInterval / 2)) && (cleared != 1)) {
if (level > 0) {
city.clear();
generateStarfield(city);
makeCityScape(ScreenWidth, 350, 100);
makeCityScape(ScreenWidth, 350, 1);
makeCityScape(ScreenWidth, 350, 1);
}
cleared = 1;
dayNight.play();
}
}
}
};
function addExplosion(_targetX, _targetY, _explosionParticleAmount, _distance, _explosionSize, _explosionAlpha) {
var i = 0;
while (i < _explosionParticleAmount) {
var _tempClip2 = _root.ExplosionLayer.attachMovie("explosionlegit", "explosionlegit_" + _root.ExplosionLayer.getNextHighestDepth(), _root.ExplosionLayer.getNextHighestDepth());
var _tempClip = _root.ExplosionLayer.attachMovie("explosion", "explosion" + _root.ExplosionLayer.getNextHighestDepth(), _root.ExplosionLayer.getNextHighestDepth());
_tempClip._x = (_targetX + random(_distance)) - (_distance / 2);
_tempClip._y = (_targetY + random(_distance)) - (_distance / 2);
_tempClip2._x = (_targetX + random(_distance)) - (_distance / 2);
_tempClip2._y = (_targetY + random(_distance)) - (_distance / 2);
var tempRandomSize = (random(_explosionSize) + (_explosionSize / 2));
_tempClip._xscale = tempRandomSize;
_tempClip._yscale = tempRandomSize;
var tempRandomSize = (random(_explosionSize) + (_explosionSize / 2));
_tempClip2._xscale = tempRandomSize;
_tempClip2._yscale = tempRandomSize;
_tempClip2._rotation = random(359);
_tempClip._alpha = random(explosionAlpha) + (explosionAlpha / 4);
_tempClip2._alpha = random(explosionAlpha) + (explosionAlpha / 4);
i++;
}
}
function GiantInit() {
SquidInit();
GIANT_VELOCITY = 30;
GIANT_ACCELERATION = 30;
OSC_POINT = 105;
giantShip.a = 0;
giantShip.v = 0;
MAX_CHUTE_DAMAGE = 30;
BOSSTIME = 60;
LASER_INC = 100 / BOSSTIME;
GiantAIInterval = 100;
if (bossWarningGiven == undefined) {
bossWarningGiven = false;
}
if (laserWarningGiven == undefined) {
laserWarningGiven = false;
}
}
function setGiantAILevel(lvl) {
MAX_CHUTE_DAMAGE = (1 + _root.difficulty) + (((4.5 + _root.difficulty) * lvl) / bossInterval);
pThrowSquid = 0.0016 * (1 + ((lvl * 17) / 100));
}
function RunGiant() {
if (gameState == GS_Giant) {
lastLevelTime = curTime;
if (giantShip._y == 0) {
giantShip._visible = true;
giantShip.laserPercent = 0;
giantShip.damage = 0;
giantShip.onEnterFrame = function () {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
pushSegment(40, "RunGiant");
if ((gameState == GS_Giant) && (this.damage < 6)) {
this.laserPercent = this.laserPercent + (LASER_INC * dt);
}
if (this.damage == 6) {
if (this._currentframe == this._totalframes) {
Score = Score + ScoreGiantShip;
giantShip.a = 0;
giantShip.v = 0;
delete this.onEnterFrame;
giantShip._visible = false;
_root.rewardPlayer();
}
} else {
if (this.laserPercent > 10) {
if ((bossWarningGiven != true) && (_root.chute2._visible == true)) {
arrow1._x = _root.chute2._x;
arrow1._y = (_root.chute2._y + _root.chute2._height) + (arrow1._height / 2);
arrow1._visible = true;
arrow1._rotation = 0;
arrow2._x = Stage.width / 2;
arrow2._y = (_root.chute2._y + (_root.chute2._height * 2)) + (arrow2._height / 2);
arrow2._visible = true;
arrow2._rotation = 0;
showTutorial("Destroy the Portals to Destroy\nThe Giant Ship! Don't delay...\nIf the Laser turns Red, You are Dead!");
bossWarningGiven = true;
}
if (this.laserPercent > 100) {
this.laserPercent = 100;
}
if ((laserWarningGiven != true) && (this.laserPercent >= 94)) {
showTutorial("Watch out!\nThe Boss is about to shoot its Laser!\nPress Space to use Nuke.\n");
laserWarningGiven = true;
}
}
if (this.laserPercent == 100) {
this.gotoAndPlay("frmLaser");
mochi.as2.MochiEvents.trackEvent("CauseOfDeath", "GiantShip");
_root.defender.swapDepths(Util.defenderDepth);
killDefender();
delete this.onEnterFrame;
} else {
this.gotoAndStop(int(this.laserPercent + 0.5));
}
}
};
var i = 1;
while (i <= 6) {
if (i <= 3) {
_root["chute" + i].side = "Left";
} else {
_root["chute" + i].side = "Right";
}
_root["chute" + i]._visible = true;
_root["chute" + i].portal.damage = 0;
_root["chute" + i].healthBar.gotoAndStop(1);
_root["chute" + i].lastAI = curTime;
_root["chute" + i].portal.impenetrable = true;
_root["chute" + i].onEnterFrame = function () {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
if (gameState != GS_Giant) {
delete this.onEnterFrame;
}
if ((bossWarningGiven && (giantShip.laserPercent > 5)) && ((curTime - this.lastAI) > GiantAIInterval)) {
if (Math.random() < pThrowSquid) {
createSquid(this);
}
while ((curTime - this.lastAI) > GiantAIInterval) {
this.lastAI = this.lastAI + GiantAIInterval;
}
}
var bullets = isHitByBullet(this.portal, this.side);
var j = 1;
while (j < bullets) {
isHitByBullet(this.portal, this.side);
j++;
}
if (bullets > 0) {
if (soundEffects) {
sndPlatformHit.gotoAndPlay("start");
}
this.gotoAndPlay("frmHit");
}
checkChuteDeath(this);
};
i++;
}
giantShip.v = GIANT_VELOCITY;
giantShip.a = 0;
giantShip._y = 1;
} else {
giantShip.v = giantShip.v + (giantShip.a * dt);
if (giantShip.v < (-GIANT_VELOCITY)) {
giantShip.v = -GIANT_VELOCITY;
}
if (giantShip.v > GIANT_VELOCITY) {
giantShip.v = GIANT_VELOCITY;
}
giantShip._y = giantShip._y + (giantShip.v * dt);
var totDmg = 0;
var i = 1;
while (i <= 6) {
totDmg = totDmg + _root["chute" + i].portal.damage;
if (_root["chute" + i]._visible == true) {
_root["chute" + i]._y = _root["chute" + i]._y + (giantShip.v * dt);
_root["chute" + i].healthBar.gotoAndStop(int(((100 * _root["chute" + i].portal.damage) / MAX_CHUTE_DAMAGE) + 0.5));
}
i++;
}
var percentDmg = int((100 * totDmg) / (MAX_CHUTE_DAMAGE * 6));
if (giantShip._y > OSC_POINT) {
if (giantShip.a == 0) {
giantShip.a = GIANT_ACCELERATION;
}
if (giantShip.a > 0) {
giantShip.a = -giantShip.a;
}
} else if (giantShip._y < OSC_POINT) {
if (giantShip.a < 0) {
giantShip.a = -giantShip.a;
}
}
}
}
}
function checkChuteDeath(chute) {
if (chute.portal.damage >= MAX_CHUTE_DAMAGE) {
Score = Score + ScoreChute;
giantShip.damage++;
if (giantShip.damage < 6) {
_root.addExplosion(chute._x, 10 + chute._y, _root.explosionParticleAmount, _root.explosionDistance * 2, _root.explosionSize * 1.5, _root.explosionAlpha);
}
chute._visible = false;
chute._y = chute.initY;
chute.gotoAndStop("frmStart");
if (soundEffects) {
_root.sndMothershipHit.gotoAndPlay("start");
}
if (giantShip.damage == 6) {
if (soundEffects) {
sndExplosion.gotoAndPlay("start");
}
if (_root.nukeDomain._visible) {
_root.addExplosion(320, 20 + chute._y, _root.explosionParticleAmount / 2, _root.explosionDistance * 8, _root.explosionSize * 8, _root.explosionAlpha);
} else {
_root.addExplosion(320, 20 + chute._y, _root.explosionParticleAmount / 2, _root.explosionDistance * 8, _root.explosionSize * 8, _root.explosionAlpha);
}
giantShip.gotoAndPlay("frmDestroy");
_root.removeAllSquids();
}
delete chute.onEnterFrame;
}
}
var explosionParticleAmount = 20;
var explosionDistance = 45;
var explosionSize = 150;
var explosionAlpha = 75;
function removeAllSquids() {
var layer = _root.squidsLayer.Left;
for (var i in layer) {
if (typeof(layer[i]) != "movieclip") {
continue;
}
layer[i]._visible = false;
delete layer[i].onEnterFrame;
layer[i].removeMovieClip();
}
layer = _root.squidsLayer.Right;
for (var i in layer) {
if (typeof(layer[i]) != "movieclip") {
continue;
}
layer[i]._visible = false;
delete layer[i].onEnterFrame;
layer[i].removeMovieClip();
}
}
SquidInit = function () {
MAX_SQUIDS = 15;
SQUID_FALL = 160;
SQUID_MOVEMENT = 125;
_root.createEmptyMovieClip("squidsLayer", Util.squidDepth);
squidsLayer.createEmptyMovieClip("Left", squidsLayer.getNextHighestDepth());
squidsLayer.createEmptyMovieClip("Right", squidsLayer.getNextHighestDepth());
if (suicideWarningGiven == undefined) {
suicideWarningGiven = false;
}
_root.squidsCreated = 0;
};
removeSquid = function (squid) {
delete squid.onEnterFrame;
squid.removeMovieClip();
};
createSquid = function (chute) {
pushSegment(45, "CreateSquid");
_root.squidsCreated++;
var side = chute.side;
var type = "Squid";
var nm = (type + squidsLayer[side].getNextHighestDepth());
var squid = squidsLayer[side].attachMovie(type + side, nm, squidsLayer[side].getNextHighestDepth());
var cBounds = chute.getBounds(_root);
squid._x = ((cBounds.xMin + cBounds.xMax) / 2) - (squid._width / 2);
squid._y = cBounds.yMin;
squid.state = "fall";
squid.side = side;
squid.onEnterFrame = function () {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
if ((gameState == GS_Die) || (gameState == GS_Explosion)) {
delete this.onEnterFrame;
return(undefined);
}
pushSegment(46, "RunSquid");
if (isHitByBullet(this, this.side)) {
this.state = "death";
if (soundEffects) {
sndAlienDeath.gotoAndPlay("start");
}
}
switch (this.state) {
case "fall" :
this._y = this._y + (SQUID_FALL * dt);
if (this._y >= ((Stage.height * 1) / 4)) {
if (!suicideWarningGiven) {
arrow1._x = this._x + (this._width / 2);
arrow1._rotation = 0;
arrow1._y = (this._y + this._height) + arrow1._height;
arrow1._visible = true;
showTutorial("Beware Earthling!!!\nThese are Kamikaze Aliens that will\nrun straight at you!");
suicideWarningGiven = true;
}
if (this.getBounds(_root).yMax > (base.getBounds(_root).yMax - (base._height / 2))) {
this.state = "strike";
this.gotoAndStop("frm_walk");
this._y = ((base.getBounds(_root).yMax - (base._height / 2)) + 1) - this._height;
}
}
break;
case "strike" :
var me = this.getBounds(_root);
var d = base.getBounds(_root);
this._x = this._x + ((SGN(((d.xMin + d.xMax) / 2) - ((me.xMin + me.xMax) / 2)) * SQUID_MOVEMENT) * dt);
if ((!nukeWarningGiven) && (Math.abs(this._x - (base._x + (base._width / 2))) < 100)) {
nukeWarningGiven = true;
arrow1._x = this._x + (this._width / 2);
arrow1._rotation = 180;
arrow1._y = this._y - arrow1._height;
arrow1._visible = true;
showTutorial("Careful Earthling!\nPress Space to Nuke!");
}
if (this.hitTest(base)) {
mochi.as2.MochiEvents.trackEvent("CauseOfDeath", "Squid");
killDefender();
removeAllSquids();
delete this.onEnterFrame;
}
break;
case "death" :
Score = Score + ScoreSquid;
SquidsHit++;
_root.explosion(this, currentEffect);
delete this.onEnterFrame;
this.removeMovieClip();
}
popSegment();
};
popSegment();
};
function randRange(min, max) {
var randomNum = (random((max - min) + 1) + min);
return(randomNum);
}
function explosion(mc, type) {
var cx = (mc._x + (mc._width / 2));
var cy = (mc._y + (mc._height / 2));
if (type == "fire") {
var maxSpeed = 5;
var minSize = 2;
var maxSize = 6;
var minFragments = 15;
var maxFragments = 30;
var fragmentRange = 100;
var fragmentType = "fragments_fire";
} else if (type == GS_Explosion) {
var maxSpeed = 5;
var minSize = 3;
var maxSize = 8;
var minFragments = 9;
var maxFragments = 18;
var fragmentRange = 250;
var fragmentType = "fragments_ship";
} else if (type == "blood") {
var maxSpeed = 3;
var minSize = 2;
var maxSize = 4;
var minFragments = 30;
var maxFragments = 50;
var fragmentRange = 35;
var fragmentType = "fragments_blood";
}
var boundyLeft = (cx - fragmentRange);
var boundyTop = (cy - fragmentRange);
var boundyRight = (cx + fragmentRange);
var boundyBottom = (cy + fragmentRange);
var totalFragments = randRange(minFragments, maxFragments);
var depth = _root.ExplosionLayer.getNextHighestDepth();
var i = 0;
while (i < totalFragments) {
var fragment_mc = _root.ExplosionLayer.attachMovie(fragmentType, "fragment" + depth, depth);
fragment_mc._x = cx;
fragment_mc._y = cy;
fragment_mc.originX = cx;
fragment_mc.originY = cy;
fragment_mc.radius = fragmentRange / 2;
fragment_mc._rotation = randRange(1, 359);
fragment_mc.gotoAndStop(randRange(1, 3));
var newSize = randRange(minSize, maxSize);
fragment_mc._width = newSize;
fragment_mc._height = newSize;
fragment_mc.speedX = randRange(-maxSpeed, maxSpeed);
fragment_mc.speedY = randRange(-maxSpeed, maxSpeed);
fragment_mc._alpha = randRange(50, 100);
fragment_mc.cacheAsBitmap = true;
fragment_mc.startTime = getTimer();
fragment_mc.onEnterFrame = function () {
this._alpha = this._alpha - 1;
this._x = this._x + this.speedX;
this._y = this._y + this.speedY;
var dx = (this._x - this.originX);
var dy = (this._y - this.originY);
if ((((dx * dx) + (dy * dy)) > (this.radius * this.radius)) || ((getTimer() - this.startTime) > 3000)) {
this.removeMovieClip();
}
};
i++;
depth++;
}
}
var currentEffect = "blood";
var MAX_ALIENS = 50;
var MAX_FALLEN_ALIENS = 4;
var DescentRate = 75;
var FallRate = 200;
AlienInit = function () {
landed = 0;
if (landingWarningGiven == undefined) {
landingWarningGiven = false;
}
nukeWarningGiven = false;
_root.createEmptyMovieClip("aliensLayer", Util.alienDepth);
aliensLayer.createEmptyMovieClip("Left", aliensLayer.getNextHighestDepth());
aliensLayer.createEmptyMovieClip("Right", aliensLayer.getNextHighestDepth());
aliensLayer.Left.size = 0;
aliensLayer.Right.size = 0;
aliensLayer.createEmptyMovieClip("floorRightLayer", aliensLayer.getNextHighestDepth());
aliensLayer.createEmptyMovieClip("floorLeftLayer", aliensLayer.getNextHighestDepth());
aliensLayer.floorLeftLayer.size = 0;
aliensLayer.floorRightLayer.size = 0;
aliensLayer.floorLeftLayer.al = 0;
aliensLayer.floorRightLayer.al = 0;
};
removeAlien = function (alien) {
aliensLayer[alien.side].size--;
delete alien.onEnterFrame;
alien.removeMovieClip();
};
killAlien = function (alien, effect, rotation) {
_root.AliensHit++;
if ((effect != undefined) && (effect != "")) {
aliensLayer[alien.side].size--;
alien.gotoAndPlay(effect);
if (rotation != undefined) {
alien.ani._rotation = rotation;
}
delete alien.onEnterFrame;
} else {
removeAlien(alien);
}
};
createAlien = function (mothership) {
if (((mothership._x < (base._x + base._width)) && ((mothership._x + mothership._width) > base._x)) || (mothership.side == "Both")) {
return(undefined);
}
if (aliensLayer[mothership.side].size >= (MAX_ALIENS - 1)) {
trace((("Max aliens of " + MAX_ALIENS) + " reached at level ") + _root.level);
return(undefined);
}
pushSegment(15, "CreateAlien");
var side = mothership.side;
var type = "Alien";
var nm = (type + aliensLayer[side].getNextHighestDepth());
var alien = aliensLayer[side].attachMovie(type + side, nm, aliensLayer[side].getNextHighestDepth());
type = "Platform";
var nm2 = (type + nm);
var platform = aliensLayer[side].attachMovie(type, nm2, aliensLayer[side].getNextHighestDepth());
alien._x = (mothership._x + (mothership._width / 2)) - (alien._width / 2);
alien._y = mothership._y;
alien.dy = DescentRate;
alien.falling = false;
alien.platform = nm2;
alien.aliensKilled = 0;
alien.side = side;
alien.floor = aliensLayer[("floor" + side) + "Layer"];
alien.platformMC = platform;
platform._x = alien._x;
platform._y = (alien._y + alien._height) + 1;
platform.dy = DescentRate;
platform.falling = false;
platform.alien = nm;
platform.aliensKilled = 0;
platform.side = side;
platform.floor = alien.floor;
platform.alienMC = alien;
platform.onEnterFrame = function () {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
pushSegment(32, "RunAlienPlatform");
this._y = this._y + (this.dy * dt);
if ((this._y + this._height) > Bottom) {
if (this.falling) {
var floor = this.floor;
for (var i in floor) {
var alien2 = floor[i];
if (this.hitTest(alien2)) {
if (soundEffects) {
_root.sndAlienDeath.gotoAndPlay("start");
}
Score = Score + ScoreAlienOnGround;
alien2.removeMovieClip();
floor.size--;
if (floor.size == 3) {
if (soundEffects) {
_root.sndIntercepted.gotoAndPlay("start");
}
Score = Score + ScoreIntercepted;
showAchievement("Intercepted!");
_root.endIntercepted++;
for (var j in floor) {
var alienj = floor[j];
alienj.gotoAndStop("land");
alienj._y = Bottom + 1;
}
}
this.aliensKilled++;
if (_root.gameState == _root.GS_AlienDeath) {
_root.gameState = _root.stateBeforeDeath;
}
break;
}
}
if (this._y > ScreenHeight) {
if (this.aliensKilled == 2) {
if (soundEffects) {
_root.sndDoubleKill.gotoAndPlay("start");
}
_root.end2x++;
Score = Score + ScoreDoubleKill;
showAchievement("Double Kill!");
} else if (this.aliensKilled >= 3) {
if (soundEffects) {
_root.sndTripleKill.gotoAndPlay("start");
}
_root.end3x++;
Score = Score + ScoreTripleKill;
showAchievement("Triple Kill!");
}
delete this.onEnterFrame;
this.removeMovieClip();
}
} else if (this._y > ScreenHeight) {
delete this.onEnterFrame;
this.removeMovieClip();
}
}
if (isHitByBullet(this, this.side)) {
if (soundEffects) {
sndPlatformHit.gotoAndPlay("start");
}
if (!this.falling) {
var al = this.alienMC;
al.dy = FallRate;
al.falling = true;
al.gotoAndStop("falling");
Score = Score + ScorePlatform;
} else {
Score = Score + ScoreFallingPlatform;
}
delete this.onEnterFrame;
this.removeMovieClip();
}
popSegment();
};
alien.onEnterFrame = function () {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
pushSegment(31, "RunAlien");
this._y = this._y + (this.dy * dt);
if ((this._y + this._height) > Bottom) {
if (this.falling) {
var floor = this.floor;
for (var i in floor) {
var alien2 = floor[i];
if (this.hitTest(alien2)) {
if (soundEffects) {
_root.sndAlienDeath.gotoAndPlay("start");
}
Score = Score + (ScoreAlien + ScoreAlienOnGround);
alien2.removeMovieClip();
floor.size--;
if (floor.size == 3) {
if (soundEffects) {
_root.sndIntercepted.gotoAndPlay("start");
}
Score = Score + ScoreIntercepted;
showAchievement("Intercepted!");
_root.endIntercepted++;
for (var j in floor) {
var alienj = floor[j];
alienj.gotoAndStop("land");
alienj._y = Bottom + 1;
}
}
if (gameState == GS_AlienDeath) {
gameState = _root.stateBeforeDeath;
}
this.aliensKilled++;
popSegment();
return(undefined);
}
}
}
if (this._y > Bottom) {
if (!this.falling) {
this._y = Bottom + 1;
delete this.onEnterFrame;
delete this.platformMC;
this.platformMC.removeMovieClip();
landed++;
if (landingWarningGiven != true) {
arrow1._x = this._x + (this._width / 2);
arrow1._rotation = -180;
arrow1._y = this._y - this._height;
arrow1._visible = true;
showTutorial("Don't let 4 Aliens land on a side.\nKill them by causing other\nAliens to fall on them!");
landingWarningGiven = true;
}
var floor = this.floor;
var d = floor.getNextHighestDepth();
var al = floor.attachMovie("Alien" + side, "Alien" + d, d, this);
al._x = this._x;
al._y = this._y;
al.floor = floor;
al.gotoAndStop("land");
floor.size++;
if ((floor.size >= 4) && (nukeWarningGiven != true)) {
nukeWarningGiven = true;
arrow1._x = this._x + (this._width / 2);
arrow1._rotation = -180;
arrow1._y = this._y - this._height;
arrow1._visible = true;
showTutorial("Lookout Earthling!\nThese 4 aliens will try to infiltrate you!\nPress Space to Nuke them!");
}
removeAlien(this);
} else {
this.aliensKilled++;
if (this.aliensKilled == 2) {
if (soundEffects) {
_root.sndDoubleKill.gotoAndPlay("start");
}
_root.end2x++;
Score = Score + ScoreDoubleKill;
showAchievement("Double Kill!");
} else if (this.aliensKilled >= 3) {
if (soundEffects) {
_root.sndTripleKill.gotoAndPlay("start");
}
_root.end3x++;
Score = Score + ScoreTripleKill;
showAchievement("Triple Kill!");
}
if (soundEffects) {
_root.sndAlienDeath.gotoAndPlay("start");
}
killAlien(this, "frmSplat");
}
}
}
if (isHitByBullet(this, this.side)) {
if (soundEffects) {
_root.sndAlienDeath.gotoAndPlay("start");
}
if (!this.falling) {
this.platformMC.dy = FallRate;
this.platformMC.falling = true;
Score = Score + ScoreAlien;
} else {
Score = Score + ScoreFallingAlien;
}
killAlien(this, "frmBlood", random(360));
}
popSegment();
};
aliensLayer[alien.side].size++;
popSegment();
};
function addExplosion(_targetX, _targetY, _explosionParticleAmount, _distance, _explosionSize, _explosionAlpha) {
var i = 0;
while (i < _explosionParticleAmount) {
var _tempClip2 = _root.ExplosionLayer.attachMovie("explosionlegit", "explosionlegit_" + _root.ExplosionLayer.getNextHighestDepth(), _root.ExplosionLayer.getNextHighestDepth());
var _tempClip = _root.ExplosionLayer.attachMovie("explosion", "explosion" + _root.ExplosionLayer.getNextHighestDepth(), _root.ExplosionLayer.getNextHighestDepth());
_tempClip._x = (_targetX + random(_distance)) - (_distance / 2);
_tempClip._y = (_targetY + random(_distance)) - (_distance / 2);
_tempClip2._x = (_targetX + random(_distance)) - (_distance / 2);
_tempClip2._y = (_targetY + random(_distance)) - (_distance / 2);
var tempRandomSize = (random(_explosionSize) + (_explosionSize / 2));
_tempClip._xscale = tempRandomSize;
_tempClip._yscale = tempRandomSize;
var tempRandomSize = (random(_explosionSize) + (_explosionSize / 2));
_tempClip2._xscale = tempRandomSize;
_tempClip2._yscale = tempRandomSize;
_tempClip2._rotation = random(359);
_tempClip._alpha = random(explosionAlpha) + (explosionAlpha / 4);
_tempClip2._alpha = random(explosionAlpha) + (explosionAlpha / 4);
i++;
}
}
function setMothershipAILevel(lvl) {
AllowedMotherships = 3 + (((lvl - 1) * 14) / 100);
MinMothershipSpeed = 110 + (((lvl - 1) * 8) / 100);
MaxMothershipSpeed = 150 + (((lvl - 1) * 9) / 100);
pNewMothership = 0.012 * (1 + (((lvl - 1) * 14) / 100));
if (GameModes.__get__mode() == GameModes.SquidMode) {
pThrowAlien = (0.012 * FPSMUL) * (1 + (((lvl - 1) * 20) / 100));
} else {
pThrowAlien = (0.016 * FPSMUL) * (1 + (((lvl - 1) * 28) / 100));
}
}
var explosionParticleAmount = 20;
var explosionDistance = 45;
var explosionSize = 150;
var explosionAlpha = 75;
MothershipInit = function () {
AlienInit();
MAX_LAYERS = 6;
MAX_MOTHERSHIPS = 20;
ALIENINTERVAL = 100;
MothershipInterval = 100;
lastMothership = getTimer();
_root.createEmptyMovieClip("mothershipsLayer", Util.mothershipDepth);
mothershipsLayer.size = 0;
};
removeMothership = function (mothership) {
delete mothership.onEnterFrame;
mothershipsLayer.size--;
mothership.isDead = true;
mothership.play();
};
createMothership = function () {
if ((mothershipsLayer.size >= (MAX_MOTHERSHIPS - 1)) || (_root.nukeDomain._visible)) {
return(undefined);
}
pushSegment(3, "CreateMothership");
var startFromLeft = (Math.random() > 0.5);
var layer = int(random(MAX_LAYERS) + 2);
var type = "Mothership";
var nm = (type + mothershipsLayer.getNextHighestDepth());
mothershipsLayer.attachMovie(type, nm, mothershipsLayer.getNextHighestDepth());
MothershipSpeed = random(MaxMothershipSpeed - MinMothershipSpeed) + MinMothershipSpeed;
if (startFromLeft) {
mothershipsLayer[nm]._x = -mothershipsLayer[nm]._width;
mothershipsLayer[nm].dx = MothershipSpeed;
} else {
mothershipsLayer[nm]._x = ScreenWidth;
mothershipsLayer[nm].dx = -MothershipSpeed;
}
mothershipsLayer[nm]._y = layer * mothershipsLayer[nm]._height;
mothershipsLayer[nm].initY = mothershipsLayer[nm]._y;
mothershipsLayer[nm].lastAI = curTime;
mothershipsLayer[nm].isDead = false;
mothershipsLayer[nm].onEnterFrame = function () {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
pushSegment(10, "RunMothership");
this._x = this._x + (this.dx * dt);
if (((this._x + this._width) < 0) || (this._x > ScreenWidth)) {
this._visible = false;
removeMothership(this);
} else {
if (this._x > (base._x + (base._width / 2))) {
this.side = "Right";
} else if ((this._x + this._width) < (base._x + (base._width / 2))) {
this.side = "Left";
} else {
this.side = "Both";
}
var mothership = this;
if ((curTime - mothership.lastAI) > ALIENINTERVAL) {
if (gameState == GS_Play) {
if (Math.random() < pThrowAlien) {
if (((this.side != "Both") && (mothership._x > 0)) && ((mothership._x + mothership._width) < ScreenWidth)) {
if (GameModes.__get__mode() == GameModes.SquidMode) {
createSquid(mothership);
} else {
createAlien(mothership);
}
}
}
}
while ((curTime - mothership.lastAI) > ALIENINTERVAL) {
mothership.lastAI = mothership.lastAI + ALIENINTERVAL;
}
}
if (isHitByBullet(this, this.side)) {
if (soundEffects) {
sndMothershipHit.gotoAndPlay("start");
}
Score = Score + ScoreMothership;
addExplosion(this._x + 39, this._y + 10, explosionParticleAmount, explosionDistance, explosionSize, explosionAlpha);
_root.MothershipsHit++;
removeMothership(this);
}
}
popSegment();
};
mothershipsLayer.size++;
popSegment();
};
RunMotherships = function () {
if (gameState == GS_Play) {
var count = mothershipsLayer.size;
if ((curTime - lastMothership) > MothershipInterval) {
if (count == 0) {
createMothership();
} else if (count < AllowedMotherships) {
if (Math.random() < pNewMothership) {
createMothership();
}
}
while ((curTime - lastMothership) > MothershipInterval) {
lastMothership = lastMothership + MothershipInterval;
}
}
}
};
function killDefender() {
gameState = GS_Die;
if (_root.soundEffects) {
_root.sndExplosion.gotoAndPlay("start");
}
var layer = _root.ExplosionLayer;
var nm = ("ex" + layer.getNextHighestDepth());
var explosion = layer.attachMovie("Explosion2", nm, layer.getNextHighestDepth());
explosion._rotation = random(359);
explosion._x = base._x + (base._width / 2);
explosion._y = base._y - (base._height / 2);
base.play();
defender.gotoAndPlay("frmDestroy");
_root.pauseGame();
explosion.play();
setTimeout(endGame, 5000);
}
function KeyDown() {
if (gameState == GS_Die) {
return(undefined);
}
if (Key.getAscii() == "f".charCodeAt(0)) {
_root.txtFPS._visible = !_root.txtFPS._visible;
}
if (Key.getCode() == 20) {
}
if (Key.getCode() == 13) {
_root.hideBubble();
}
if ((Key.getCode() == 17) || (Key.getCode() == 38)) {
_root.firing = true;
_root.defender.gun.play();
}
if ((Key.getAscii() >= 48) && (Key.getAscii() <= 57)) {
var index = (Key.getAscii() - 48);
if (index == 0) {
index = 10;
}
index--;
if (!_root.weaponScreen._visible) {
Gun.switchGun(index);
}
}
if (!_root.cheatModeEnabled) {
return(undefined);
}
var a = Key.getAscii();
if (a == "p".charCodeAt(0)) {
togglePause();
}
if ((a == "r".charCodeAt(0)) || (a == "R".charCodeAt(0))) {
quitGame();
gotoAndPlay (142);
}
if (Key.getAscii() == "q".charCodeAt(0)) {
mochi.as2.MochiEvents.trackEvent("CauseOfDeath", "Manual");
killDefender();
}
if (Key.getAscii() == "n".charCodeAt(0)) {
_root.cheatMode = true;
resetGame(_root.level);
}
if (Key.getAscii() == "b".charCodeAt(0)) {
_root.cheatMode = true;
resetGame((int((_root.level + bossInterval) / bossInterval) * bossInterval) - 1);
}
if (Key.getAscii() == "w".charCodeAt(0)) {
_root.cheatMode = true;
openWeaponScreen();
}
if (Key.getAscii() == "+".charCodeAt(0)) {
_root.cheatMode = true;
Score = Score + 50000;
}
}
function KeyUp() {
if ((Key.getCode() == 17) || (Key.getCode() == 38)) {
if (_root.weaponScreen._visible == false) {
_root.firing = false;
_root.defender.gun.stop();
}
}
}
var rotationAcceleration = 3.75;
var rotationSpeed;
var keyboardMultiplier;
var MAX_ROTATION;
var rotDir = 0;
DefenderInit = function () {
rotationSpeed = 0;
MAX_ROTATION_SPEED = 22.5;
keyboardMultiplier = 10;
MAX_ROTATION = 88;
rotDir = 0;
base._visible = true;
delete defender.onEnterFrame;
_root.removeMovieClip(defender);
defender = _root.attachMovie("Defender", "defender", _root.getNextHighestDepth());
defender.gotoAndStop(_root.gun.GunClip);
defender.gun.stop();
_root.bulletsLayer.s.attachSound(_root.gun.sound);
defender._x = (base._x + (base._width / 2)) - 3;
defender._y = base._y;
defender._visible = true;
defender.onEnterFrame = function () {
if (((gameState == GS_Pause) || (gameState == GS_Die)) && (weaponScreen._visible == false)) {
return(undefined);
}
processInputs();
if (shootBullet && (weaponScreen._visible == false)) {
rotDir = 0;
shootBullet = false;
Gun.fireGun();
}
};
};
processInputs = function () {
pushSegment(60, "ProcessInputs");
if ((firing && ((getTimer() - lastBulletTime) > gun.delay)) || (shootBullet)) {
shootBullet = true;
lastBulletTime = getTimer();
}
if (GameModes.__get__mode() != GameModes.KeyboardMode) {
if ((InputWrapper.getMouseX() != lastMouseX) || (InputWrapper.getMouseY())) {
defender._rotation = (Math.atan2(InputWrapper.getMouseY() - defender._y, InputWrapper.getMouseX() - defender._x) * 57.3) + 90;
}
}
lastMouseX = InputWrapper.getMouseX();
lastMouseY = InputWrapper.getMouseY();
var newRot = (rotationSpeed + rotationAcceleration);
rotationSpeed = ((newRot < MAX_ROTATION_SPEED) ? (newRot) : (MAX_ROTATION_SPEED));
defender._rotation = defender._rotation + (((rotDir * rotationSpeed) * keyboardMultiplier) * dt);
if (defender._rotation > MAX_ROTATION) {
defender._rotation = MAX_ROTATION;
}
if (defender._rotation < (-MAX_ROTATION)) {
defender._rotation = -MAX_ROTATION;
}
popSegment();
};
function pushSegment(index, aName) {
}
function popSegment() {
}
function resetProfiler() {
}
function displayProfilingResult() {
}
function bitOR(a, b) {
var lsb = ((a & 1) | (b & 1));
var msb31 = ((a >>> 1) | (b >>> 1));
return((msb31 << 1) | lsb);
}
function bitXOR(a, b) {
var lsb = ((a & 1) ^ (b & 1));
var msb31 = ((a >>> 1) ^ (b >>> 1));
return((msb31 << 1) | lsb);
}
function bitAND(a, b) {
var lsb = ((a & 1) & (b & 1));
var msb31 = ((a >>> 1) & (b >>> 1));
return((msb31 << 1) | lsb);
}
function addme(x, y) {
var lsw = ((x & 65535) + (y & 65535));
var msw = (((x >> 16) + (y >> 16)) + (lsw >> 16));
return((msw << 16) | (lsw & 65535));
}
function rhex(num) {
str = "";
j = 0;
while (j <= 3) {
str = str + (hex_chr.charAt((num >> ((j * 8) + 4)) & 15) + hex_chr.charAt((num >> (j * 8)) & 15));
j++;
}
return(str);
}
function str2blks_MD5(str) {
nblk = ((str.length + 8) >> 6) + 1;
blks = new Array(nblk * 16);
i = 0;
while (i < (nblk * 16)) {
blks[i] = 0;
i++;
}
i = 0;
while (i < str.length) {
blks[i >> 2] = blks[i >> 2] | (str.charCodeAt(i) << ((((str.length * 8) + i) % 4) * 8));
i++;
}
blks[i >> 2] = blks[i >> 2] | (128 << ((((str.length * 8) + i) % 4) * 8));
var l = (str.length * 8);
blks[(nblk * 16) - 2] = l & 255;
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((l >>> 8) & 255) << 8);
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((l >>> 16) & 255) << 16);
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((l >>> 24) & 255) << 24);
return(blks);
}
function rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
function cmn(q, a, b, x, s, t) {
return(addme(rol(addme(addme(a, q), addme(x, t)), s), b));
}
function ff(a, b, c, d, x, s, t) {
return(cmn(bitOR(bitAND(b, c), bitAND(~b, d)), a, b, x, s, t));
}
function gg(a, b, c, d, x, s, t) {
return(cmn(bitOR(bitAND(b, d), bitAND(c, ~d)), a, b, x, s, t));
}
function hh(a, b, c, d, x, s, t) {
return(cmn(bitXOR(bitXOR(b, c), d), a, b, x, s, t));
}
function ii(a, b, c, d, x, s, t) {
return(cmn(bitXOR(c, bitOR(b, ~d)), a, b, x, s, t));
}
function funky(str) {
x = str2blks_MD5(str);
a = 1732584193 /* 0x67452301 */;
b = -271733879;
c = -1732584194;
d = 271733878 /* 0x10325476 */;
var step;
i = 0;
while (i < x.length) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
step = 0;
a = ff(a, b, c, d, x[i + 0], 7, -680876936);
d = ff(d, a, b, c, x[i + 1], 12, -389564586);
c = ff(c, d, a, b, x[i + 2], 17, 606105819);
b = ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = ff(a, b, c, d, x[i + 4], 7, -176418897);
d = ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = ff(b, c, d, a, x[i + 7], 22, -45705983);
a = ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = ff(c, d, a, b, x[i + 10], 17, -42063);
b = ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = ff(d, a, b, c, x[i + 13], 12, -40341101);
c = ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = gg(a, b, c, d, x[i + 1], 5, -165796510);
d = gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = gg(c, d, a, b, x[i + 11], 14, 643717713);
b = gg(b, c, d, a, x[i + 0], 20, -373897302);
a = gg(a, b, c, d, x[i + 5], 5, -701558691);
d = gg(d, a, b, c, x[i + 10], 9, 38016083);
c = gg(c, d, a, b, x[i + 15], 14, -660478335);
b = gg(b, c, d, a, x[i + 4], 20, -405537848);
a = gg(a, b, c, d, x[i + 9], 5, 568446438);
d = gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = gg(c, d, a, b, x[i + 3], 14, -187363961);
b = gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = gg(d, a, b, c, x[i + 2], 9, -51403784);
c = gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = hh(a, b, c, d, x[i + 5], 4, -378558);
d = hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = hh(b, c, d, a, x[i + 14], 23, -35309556);
a = hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = hh(c, d, a, b, x[i + 7], 16, -155497632);
b = hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = hh(a, b, c, d, x[i + 13], 4, 681279174);
d = hh(d, a, b, c, x[i + 0], 11, -358537222);
c = hh(c, d, a, b, x[i + 3], 16, -722521979);
b = hh(b, c, d, a, x[i + 6], 23, 76029189);
a = hh(a, b, c, d, x[i + 9], 4, -640364487);
d = hh(d, a, b, c, x[i + 12], 11, -421815835);
c = hh(c, d, a, b, x[i + 15], 16, 530742520);
b = hh(b, c, d, a, x[i + 2], 23, -995338651);
a = ii(a, b, c, d, x[i + 0], 6, -198630844);
d = ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = ii(b, c, d, a, x[i + 5], 21, -57434055);
a = ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = ii(c, d, a, b, x[i + 10], 15, -1051523);
b = ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = ii(d, a, b, c, x[i + 15], 10, -30611744);
c = ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = ii(a, b, c, d, x[i + 4], 6, -145523070);
d = ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = ii(c, d, a, b, x[i + 2], 15, 718787259);
b = ii(b, c, d, a, x[i + 9], 21, -343485551);
a = addme(a, olda);
b = addme(b, oldb);
c = addme(c, oldc);
d = addme(d, oldd);
i = i + 16;
}
return(((rhex(a) + rhex(b)) + rhex(c)) + rhex(d));
}
function submitScore() {
if (_root.cheatMode == true) {
trace("you have cheated in this game; so will not submit score.");
return(undefined);
}
var sUser = _root.userName;
var sHost = _url;
sHost = sHost.slice(0, sHost.indexOf(".") + 4);
var sGame = "Alien Paratroopers";
var sVersion = "0.1";
var sMode = GameModes.__get__name();
var sDifficulty = _root.difficulty;
var sScore = Score;
var sLevel = level;
var sMothershipsHit = MothershipsHit;
var special = "xVc";
var sAliensHit = AliensHit;
var sBonusItems = "0";
var squid = "Squid";
var k = ((squid + special) + squid);
var index = ((((((((((((((((((((((((((((((((("user=" + sUser) + "&") + "host=") + sHost) + "&") + "game=") + sGame) + "&") + "version=") + sVersion) + "&") + "mode=") + sMode) + "&") + "difficulty=") + sDifficulty) + "&") + "score=") + sScore) + "&") + "level=") + sLevel) + "&") + "mothershipshit=") + sMothershipsHit) + "&") + "alienshit=") + sAliensHit) + "&") + "bonusitems=") + sBonusItems) + "&") + "");
var thingy = ("hash=" + funky(index + k));
if (_root._url.indexOf("file:///") == -1) {
if ((sUser != "Your Name Here") && (sUser != "")) {
Mouse.show();
switch (GameModes.__get__mode()) {
case GameModes.ExplosiveMode :
var o = {n:[1, 1, 13, 11, 15, 3, 2, 14, 13, 2, 5, 2, 14, 8, 0, 7], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
break;
case GameModes.SquidMode :
var o = {n:[15, 14, 14, 1, 0, 15, 4, 2, 0, 0, 6, 7, 5, 6, 7, 3], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
break;
case GameModes.KeyboardMode :
var o = {n:[14, 14, 9, 4, 6, 7, 10, 7, 15, 1, 12, 4, 7, 7, 1, 12], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
break;
default :
var o = {n:[1, 14, 11, 10, 4, 13, 10, 7, 10, 2, 12, 6, 2, 11, 12, 12], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
}
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:Score, name:sUser});
}
}
}
function endGame() {
_root.endscreen.play();
}
function setMonsterAILevel(lvl) {
_root.pNewMonster = (0.001 * FPSMUL) * (1 + (((lvl - 1) * 9) / 100));
}
function getMoney() {
return(_root.Score - _root.MoneySpent);
}
function openWeaponScreen() {
_root.pauseGame();
_root.weaponScreen._visible = true;
_root.weaponScreen.redraw();
_root.weaponScreen.selectGun(Gun.__get__index());
_root.pauseEnabled = false;
_root.bulletsLayer.s.setVolume(20);
_root.menubtn.menuButton.enabled = false;
Mouse.show();
}
function quitGame() {
popSegment();
displayProfilingResult();
resetObjects();
delete onEnterFrame;
city.clear();
music.gotoAndPlay("stop");
bossMusic.gotoAndPlay("stop");
gotoAndPlay (142);
}
function hideWalkthrough(text) {
if (txtInfo.text == text) {
txtInfo.text = "";
}
}
function showWalkthrough(text) {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
if ((txtInfo.text != "") && (txtInfo.text != text)) {
setTimeout(showWalkthrough, 1000, text);
} else {
txtInfo.text = text;
setTimeout(hideWalkthrough, 4000, text);
}
}
function enableBubble() {
bubble.enabled = true;
}
function showBubble(text) {
hideWalkthrough(txtInfo.text);
bubble.caption.text = text;
bubble.enabled = false;
bubble._visible = true;
if (guy._currentFrame != 1) {
guy.gotoAndStop("frmBzztIn");
} else {
_root.guy.ani.play();
}
setTimeout(enableBubble, 800);
_root.pauseGame();
}
function hideBubble() {
_root.resumeGame();
bubble.caption.text = "";
bubble._visible = false;
arrow1._visible = false;
arrow2._visible = false;
guy.gotoAndStop("frmBzztOut");
}
function showTutorial(text) {
if (_root.tutorialEnabled) {
showBubble(text);
} else {
bubble._visible = false;
arrow1._visible = false;
arrow2._visible = false;
}
}
function showAchievement(text) {
if (achievementTimer != 0) {
clearTimeout(achievementTimer);
}
txtUltra.text = text;
achievementTimer = setTimeout(hideAchievement, 2000);
}
function hideAchievement() {
txtUltra.text = "";
}
function updateWeaponBar() {
if ((((GameModes.__get__mode() == GameModes.BarrelMode) || (GameModes.__get__mode() == GameModes.ExplosiveMode)) || (GameModes.__get__mode() == GameModes.SquidMode)) || (GameModes.__get__mode() == GameModes.KeyboardMode)) {
_root.weapBar._visible = false;
} else {
_root.weapBar._visible = true;
}
i = 1;
while (i <= 5) {
btn = _root.weapBar["btnW" + i];
btn.i = i;
btn.onRelease = function () {
if (Gun.keyMap[this.i - 1].upgradeLevel > 0) {
if (!_root.weaponScreen._visible) {
Gun.switchGun(this.i - 1);
if (!weaponChangeAdviceGiven) {
weaponChangeAdviceGiven = true;
_root.showBubble("Use the Mouse wheel or the\nkeys '1' through '5' to\nselect guns faster!");
}
}
}
};
var colorTrans = (new flash.geom.ColorTransform());
if (i == (Gun.__get__index() + 1)) {
colorTrans.redOffset = 0;
colorTrans.blueOffset = 128;
colorTrans.greenOffset = 0;
} else if (Gun.keyMap[i - 1].upgradeLevel > 0) {
colorTrans.redOffset = 0;
colorTrans.blueOffset = 0;
colorTrans.greenOffset = 196;
} else {
colorTrans.redOffset = 196;
colorTrans.blueOffset = 0;
colorTrans.greenOffset = 0;
}
var trans = (new flash.geom.Transform(btn));
trans.colorTransform = colorTrans;
i++;
}
}
var GS_PlayState = 1;
var GS_Die = 2;
var GS_AlienDeath = 3;
var GS_Pause = 4;
var GS_EndLevel = 5;
var GS_Explosion = 6;
var GS_Giant = 7;
var gameState;
var hex_chr = "0123456789abcdef";
BlipInit = function () {
MAX_LAYERS = 6;
MaxBlipSpeed = 150;
MinBlipSpeed = 100;
pNewBlip = 0.00125;
pFirstBlip = 0.003;
BlipInterval = 100;
lastBlip = getTimer();
_root.createEmptyMovieClip("blipsLayer", Util.blipDepth);
if (blipWarningGiven == undefined) {
blipWarningGiven = false;
}
blipCreated = false;
};
removeBlip = function (blip) {
blip.isDead = true;
delete blip.onEnterFrame;
blip.play();
};
createBlip = function () {
pushSegment(2, "CreateBlip");
var startFromLeft = (random(2) == 0);
var layer = int(random(MAX_LAYERS) + 1);
BlipSpeed = (random(MaxBlipSpeed - MinBlipSpeed) + MinBlipSpeed) * dt;
if (startFromLeft) {
var type = "BlipLeft";
nm = type + blipsLayer.getNextHighestDepth();
blipsLayer.attachMovie(type, nm, blipsLayer.getNextHighestDepth());
blipsLayer[nm]._x = -blipsLayer[nm]._width;
blipsLayer[nm].dx = BlipSpeed;
} else {
var type = "BlipRight";
nm = type + blipsLayer.getNextHighestDepth();
blipsLayer.attachMovie(type, nm, blipsLayer.getNextHighestDepth());
blipsLayer[nm]._x = ScreenWidth;
blipsLayer[nm].dx = -BlipSpeed;
}
blipsLayer[nm].isDead = false;
blipsLayer[nm]._y = layer * blipsLayer[nm]._height;
blipsLayer[nm].onEnterFrame = function () {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
pushSegment(5, "RunBlip");
this._x = this._x + this.dx;
if (((this._x + this._width) < 0) || (this._x > ScreenWidth)) {
this._visible = false;
removeBlip(this);
} else {
if (this._x > (base._x + (base._width / 2))) {
this.side = "Right";
} else if ((this._x + this._width) < (base._x + (base._width / 2))) {
this.side = "Left";
} else {
this.side = "Both";
if (blipWarningGiven != true) {
arrow1._x = this._x + (arrow1._width / 2);
arrow1._y = (this._y + this._height) + (arrow1._height / 2);
arrow1._visible = true;
arrow1._rotation = 0;
showTutorial("\nShoot this Bonus Ship to earn cash!");
blipWarningGiven = true;
}
}
if (isHitByBullet(this, this.side)) {
if (soundEffects) {
_root.sndBonusShip.gotoAndPlay("start");
}
this.txtBonus.text = "$" + ScoreBlip;
Score = Score + ScoreBlip;
_root.endBlip++;
removeBlip(this);
}
}
popSegment();
};
popSegment();
};
RunBlips = function () {
if (gameState == GS_Play) {
if ((curTime - lastBlip) > BlipInterval) {
if (Math.random() < (blipCreated ? (pNewBlip) : (pFirstBlip))) {
blipCreated = true;
createBlip();
}
while ((curTime - lastBlip) > BlipInterval) {
lastBlip = lastBlip + BlipInterval;
}
}
}
};
var MonsterFall = 200;
var MonsterJump = 280;
var MAX_MONSTERS = 10;
MonsterInit = function () {
if (monsterWarningGiven == undefined) {
monsterWarningGiven = false;
}
_root.createEmptyMovieClip("monstersLayer", Util.monsterDepth);
monstersLayer.createEmptyMovieClip("Left", monstersLayer.getNextHighestDepth());
monstersLayer.createEmptyMovieClip("Right", monstersLayer.getNextHighestDepth());
monstersLayer.Left.size = 0;
monstersLayer.Right.size = 0;
_root.monsterCreated = false;
_root.pFirstMonster = 0.01;
};
removeMonster = function (alien) {
_root.monstersLayer[alien.side].size--;
delete alien.onEnterFrame;
alien.removeMovieClip();
};
killMonster = function (alien, effect) {
_root.MonstersHit++;
if ((effect != undefined) && (effect != "")) {
_root.monstersLayer[alien.side].size--;
alien.gotoAndPlay(effect);
delete alien.onEnterFrame;
} else {
_root.removeMonster(alien);
}
};
createMonster = function () {
var side = "Left";
if (random(2) == 0) {
side = "Right";
}
if (monstersLayer[side].size >= (MAX_MONSTERS - 1)) {
trace((("Max monsters of " + MAX_MONSTERS) + " reached at level ") + _root.level);
return(undefined);
}
pushSegment(4, "CreateMonster");
var type = "Monster";
var nm = (type + monstersLayer[side].getNextHighestDepth());
var alien = monstersLayer[side].attachMovie(type, nm, monstersLayer[side].getNextHighestDepth());
var shield = alien.attachMovie("AlienShield", nm, monstersLayer[side].getNextHighestDepth());
alien.shield = shield;
alien.forceField = true;
alien._x = ((Math.random() * (Stage.width >> 2)) + (Stage.width >> 3)) - (alien._width >> 1);
if (side == "Right") {
alien._x = alien._x + (Stage.width >> 1);
} else {
alien._xscale = -100;
}
alien._y = 0;
alien.dy = MonsterFall;
alien.state = 0;
alien.side = side;
alien.time = 2;
alien.startTime = 0;
alien.impenetrable = true;
alien.confused = false;
alien.onEnterFrame = function () {
if ((gameState == GS_Pause) || (gameState == GS_Die)) {
return(undefined);
}
pushSegment(35, "RunMonster");
if (this.state == 0) {
this._y = this._y + (this.dy * dt);
if (!monsterWarningGiven) {
if (this._y > (Stage.height / 4)) {
arrow1._x = this._x + ((this._width / 2) * SGN(this._xscale));
arrow1._rotation = 0;
arrow1._y = (this._y + this._height) + (arrow1._height / 2);
arrow1._visible = true;
_root.showTutorial("These Alien Monsters have a shield.\nBeware!\nThey will jump right on to you!");
monsterWarningGiven = true;
}
}
if ((this._y + (this._height >> 1)) > Bottom) {
this._y = (Bottom - (this._height >> 1)) + 1;
this.state++;
this.gotoAndStop("land");
if (this.forceField) {
this.forceField = false;
this.shield.play();
} else {
this.confused = true;
}
if (_root.soundEffects) {
_root.sndPlatformHit.gotoAndPlay("start");
}
}
} else if (this.state == 1) {
if (this.ani._currentframe >= (this.ani._totalframes - 1)) {
if (this.confused == true) {
this.confused = false;
this.gotoAndStop("frmConfused");
this.ani.play();
} else {
this.state++;
this.gotoAndStop("frmJump");
this.ani.play();
}
}
} else if (this.state == 2) {
if (this.ani._currentframe == this.ani._totalframes) {
this.state++;
this.startTime = getTimer();
this.u = -MonsterJump;
this.s = (base._x + (base._width / 2)) - (this._x + (this._width / 2));
if (this.s < 0) {
this.s = this.s - (this._width / 2);
} else {
this.s = this.s + this._width;
}
this.initY = this._y;
this.initX = this._x;
this.a = (-2 * this.u) / this.time;
}
} else if (this.state == 3) {
t = (curTime - this.startTime) / 1000;
this._y = (this.initY + (this.u * t)) + (((0.5 * this.a) * t) * t);
this._x = this.initX + ((this.s * t) / this.time);
if (t >= this.time) {
this.state++;
}
} else if (this.state == 4) {
removeMonster(this);
mochi.as2.MochiEvents.trackEvent("CauseOfDeath", "Monster");
killDefender();
}
if (this.forceField) {
if (_root.isHitByBullet(this.shield, this.side)) {
if (_root.soundEffects) {
_root.sndPlatformHit.gotoAndPlay("start");
}
_root.Score = _root.Score + _root.ScoreForceField;
this.shield.removeMovieClip();
this.forceField = false;
}
} else if (_root.isHitByBullet(this, this.side)) {
if (_root.soundEffects) {
_root.sndMonsterDeath.gotoAndPlay("start");
}
_root.Score = _root.Score + _root.ScoreMonster;
_root.killMonster(this, "frmBlood");
}
popSegment();
};
monstersLayer[alien.side].size++;
popSegment();
};
RunMonsters = function () {
if (_root.gameState == _root.GS_Play) {
if (!_root.monsterCreated) {
if ((Math.random() < _root.pFirstMonster) && (_root.level > _root.bossInterval)) {
_root.createMonster();
_root.monsterCreated = true;
}
} else if (_root.MonstersHit > 0) {
if (Math.random() < _root.pNewMonster) {
_root.createMonster();
}
}
}
};
stop();
FPS = 20;
FPSMUL = 30 / FPS;
_root.cheatMode = false;
userName = "unknown";
Util.initLayers();
pauseEnabled = true;
ScreenWidth = Stage.width;
ScreenHeight = Stage.height;
lastMouseX = InputWrapper.getMouseX();
lastMouseY = InputWrapper.getMouseY();
var firing = false;
var shootBullet = false;
var frames = 0;
fps = 30 / FPSMUL;
var dt = 0;
Score = 0;
StartLevel = 1;
dayNight.gotoAndStop(1);
_root.cheatModeEnabled = false;
txtInfo.text = "";
healthBoss._visible = false;
bubble._visible = false;
bubble.caption.text = "";
bubble.swapDepths(Util.bubbleDepth);
arrow1._visible = false;
arrow1.swapDepths(Util.arrow1Depth);
arrow2._visible = false;
arrow2.swapDepths(Util.arrow2Depth);
_root.menubtn.menuButton.enabled = true;
weaponBought = false;
if (scrollWheelMessageGiven == undefined) {
scrollWheelMessageGiven = false;
}
if (_root.tutorialEnabled == undefined) {
_root.tutorialEnabled = true;
}
if (musicEnabled == undefined) {
musicEnabled = true;
}
if (soundEffects == undefined) {
soundEffects = true;
}
if (difficulty == undefined) {
difficulty = 2;
}
if (GameModes.__get__mode() == undefined) {
GameModes.__set__mode(GameModes.NormalMode);
}
Bottom = (base._y + base._height) - 40;
gameState = GS_Play;
_root.guy.ani.gotoAndStop(_root.guy.ani._totalframes);
InputWrapper.init();
initSounds();
generateStarfield(city);
MothershipInit();
MonsterInit();
BlipInit();
GiantInit();
nukeDomain._visible = false;
levelTime = 22000;
levelInterval = 3000;
bossInterval = 4;
BulletsInit();
resetGame(StartLevel - 1);
mochi.as2.MochiEvents.startPlay("" + GameModes.__get__name());
mochi.as2.MochiEvents.trackEvent("difficulty", difficulty);
if (GameModes.__get__mode() != GameModes.KeyboardMode) {
Mouse.hide();
crosshair._visible = true;
} else {
Mouse.show();
crosshair._visible = false;
}
_root.city.swapDepths(Util.cityDepth);
_root.crosshair.swapDepths(Util.mouseDepth);
txtFPS._visible = false;
if (clickWarningGiven == undefined) {
clickWarningGiven = false;
}
if (qualityWarningGiven == undefined) {
qualityWarningGiven = false;
}
if (weaponChangeAdviceGiven == undefined) {
weaponChangeAdviceGiven = false;
}
var lastSlowFrame = getTimer();
var lowFPS = 20;
var lowFPSInterval = 3500;
lastClick = getTimer();
clickInterval = 250;
numClicks = 0;
resetProfiler();
pushSegment(0, "Main");
_root.onEnterFrame = function () {
lastTime = curTime;
curTime = getTimer();
var fpsDiff = (curTime - lastFPSTime);
frames++;
if (fpsDiff >= 1000) {
fps = (frames * 1000) / fpsDiff;
txtFPS.text = fps;
frames = 0;
lastFPSTime = curTime;
if (!qualityWarningGiven) {
if (fps < lowFPS) {
if ((curTime - lastSlowFrame) > lowFPSInterval) {
qualityWarningGiven = true;
_root._quality = "LOW";
_root.showBubble("Game is lagging on your machine!\nQuality has been reduced\nto improve experience.");
}
} else {
lastSlowFrame = curTime;
}
}
return(undefined);
}
dt = (curTime - lastTime) / 1000;
if (gameState == GS_Pause) {
return(undefined);
}
pushSegment(1, "Loop");
if ((gameState == GS_AlienDeath) || (gameState == GS_Die)) {
lastLevelTime = lastLevelTime + (curTime - lastTime);
} else if ((curTime - lastLevelTime) > levelTime) {
lastLevelTime = curTime;
if (gameState != GS_Die) {
gameState = GS_EndLevel;
}
}
var death = false;
if (aliensLayer != undefined) {
if (aliensLayer.floorRightLayer.size >= MAX_FALLEN_ALIENS) {
_root.DoDeath(aliensLayer.floorRightLayer, offset);
death = true;
}
if (aliensLayer.floorLeftLayer.size >= MAX_FALLEN_ALIENS) {
_root.DoDeath(aliensLayer.floorLeftLayer, offset);
death = true;
}
if (!death) {
if (gameState == GS_AlienDeath) {
gameState = GS_Play;
}
}
}
RunBlips();
RunMotherships();
RunMonsters();
RunGiant();
_root.currentMoney = _root.getMoney();
transitionLevel();
if (((!_root.firing) && (gameState != GS_Pause)) && ((((_xmouse < 0) || (_xmouse > Stage.width)) || (_ymouse < 0)) || (_ymouse > Stage.height))) {
_root.showBubble("Mouse went off-screen.\nPlease click this bubble\nwhen you're ready!");
} else if (((!_root.scrollWheelMessageGiven) && (_root.weaponBought)) && (!_root.weaponScreen._visible)) {
arrow1._x = Stage.width / 4;
arrow1._rotation = 0;
arrow1._y = 40 + (arrow1._height / 2);
arrow1._visible = true;
_root.scrollWheelMessageGiven = true;
_root.showTutorial("Congratulations on new Weapon!\nYou can switch weapons with mouse\nwheel or click on Weapons Bar!");
}
popSegment();
};
bubble.onRollOver = function () {
Mouse.show();
_root.crosshair._visible = false;
};
bubble.onRollOut = function () {
if (GameModes.__get__mode() != GameModes.KeyboardMode) {
Mouse.hide();
crosshair._visible = true;
} else {
Mouse.show();
crosshair._visible = false;
}
};
bubble.onRelease = function () {
_root.hideBubble();
};
var achievementTimer = 0;
updateMuteButton = function () {
if (musicEnabled) {
btnMute.gotoAndStop(1);
} else if (soundEffects) {
btnMute.gotoAndStop(2);
} else {
btnMute.gotoAndStop(3);
}
};
btnMute.onRelease = function () {
if (_root.musicEnabled) {
_root.musicEnabled = false;
_root.soundEffects = true;
_root.bossMusic.gotoAndPlay("stop");
_root.music.gotoAndPlay("stop");
this.gotoAndStop(2);
} else if (_root.soundEffects) {
_root.soundEffects = false;
this.gotoAndStop(3);
} else {
_root.musicEnabled = true;
_root.soundEffects = true;
if (_root.gameState == _root.GS_Giant) {
_root.bossMusic.gotoAndPlay("start");
} else {
_root.music.gotoAndPlay("start");
}
this.gotoAndStop(1);
}
_root.updateMuteButton();
};
updateMuteButton();
Instance of Symbol 201 MovieClip "base" in Frame 919
onClipEvent (keyDown) {
_root.KeyDown();
}
onClipEvent (keyUp) {
_root.KeyUp();
}
Frame 920
_root.quitGame();
Symbol 5 MovieClip [fragments_fire] Frame 1
stop();
Symbol 9 MovieClip [fragments_ship] Frame 1
stop();
Symbol 14 MovieClip [explosion] Frame 19
removeMovieClip(this);
Symbol 17 MovieClip [explosion2] Frame 16
this.removeMovieClip();
Symbol 26 MovieClip [AlienShield] Frame 1
stop();
Symbol 26 MovieClip [AlienShield] Frame 10
this.removeMovieClip();
Symbol 30 MovieClip [fragments_blood] Frame 1
stop();
Symbol 50 MovieClip Frame 54
stop();
Symbol 1022 MovieClip [__Packages.mochi.as2.MochiAd] Frame 0
class mochi.as2.MochiAd
{
function MochiAd () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showPreGameAd(options) {
var DEFAULTS = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var ad_msec = 11000;
var ad_timeout = options.ad_timeout;
if (options.skip) {
ad_timeout = 0;
}
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var wh = _getRes(options);
var w = wh[0];
var h = wh[1];
mc._x = w * 0.5;
mc._y = h * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = w * -0.5;
chk._y = h * -0.5;
var bar = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
bar._visible = false;
delete options.no_progress_bar;
} else {
bar._x = 10;
bar._y = h - 20;
}
var bar_color = options.color;
delete options.color;
var bar_background = options.background;
delete options.background;
var bar_outline = options.outline;
delete options.outline;
var backing = bar.createEmptyMovieClip("_outline", 1);
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(w - 20, 0);
backing.lineTo(w - 20, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside = bar.createEmptyMovieClip("_inside", 2);
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(w - 20, 0);
inside.lineTo(w - 20, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside._xscale = 0;
var outline = bar.createEmptyMovieClip("_outline", 3);
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(w - 20, 0);
outline.lineTo(w - 20, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var p = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0) {
this._parent._alpha = p;
} else {
var _clip = this._parent._parent;
mochi.as2.MochiAd.unload(_clip);
delete this.onEnterFrame;
}
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _chk = this.mc._mochiad_wait;
_chk.server_control = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _clip = this._parent._parent;
var ad_clip = this._parent._mochiad_ctr;
var elapsed = (getTimer() - this.started);
var finished = false;
var clip_total = _clip.getBytesTotal();
var clip_loaded = _clip.getBytesLoaded();
var clip_pcnt = ((100 * clip_loaded) / clip_total);
var ad_pcnt = ((100 * elapsed) / chk.ad_msec);
var _inside = this._mochiad_bar._inside;
var pcnt = Math.min(100, Math.min(clip_pcnt || 0, ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside._xscale = pcnt;
options.ad_progress(pcnt);
if (sendHostProgress) {
mochi.as2.MochiAd.containerNotify(clip, {id:"hostLoadPcnt", pcnt:clip_pcnt}, clip._mochiad._containerLCName);
if (clip_pcnt == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var total = ad_clip.getBytesTotal();
if ((total > 0) || (typeof(total) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((elapsed > chk.ad_timeout) && (clip_pcnt == 100)) {
options.ad_failed();
finished = true;
}
}
if (elapsed > chk.ad_msec) {
finished = true;
}
if (((clip_total > 0) && (clip_loaded >= clip_total)) && (finished)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var DEFAULTS = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, DEFAULTS);
var clip = options.clip;
var ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var wh = _getRes(options);
var w = wh[0];
var h = wh[1];
mc._x = w * 0.5;
mc._y = h * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var sendHostProgress = false;
chk.onEnterFrame = function () {
var ad_clip = this._parent._mochiad_ctr;
var elapsed = (getTimer() - this.started);
var finished = false;
if (!chk.showing) {
var total = ad_clip.getBytesTotal();
if ((total > 0) || (typeof(total) == "undefined")) {
finished = true;
chk.showing = true;
chk.started = getTimer();
} else if (elapsed > chk.ad_timeout) {
options.ad_failed();
finished = true;
}
}
if (finished) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var DEFAULTS = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, DEFAULTS);
var clip = options.clip;
var ad_msec = 11000;
var ad_timeout = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var wh = _getRes(options);
var w = wh[0];
var h = wh[1];
mc._x = w * 0.5;
mc._y = h * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var p = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0) {
this._parent._alpha = p;
} else {
var _clip = this._parent._parent;
mochi.as2.MochiAd.unload(_clip);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _chk = this.mc._mochiad_wait;
_chk.server_control = true;
_chk.started = getTimer();
_chk.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var ad_clip = this._parent._mochiad_ctr;
var elapsed = (getTimer() - this.started);
var finished = false;
if (!chk.showing) {
var total = ad_clip.getBytesTotal();
if ((total > 0) || (typeof(total) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (elapsed > chk.ad_timeout) {
options.ad_failed();
finished = true;
}
}
if (elapsed > chk.ad_msec) {
finished = true;
}
if (finished) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var hostname = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(hostname);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(hostname);
}
}
return(hostname);
}
static function load(options) {
var DEFAULTS = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, DEFAULTS);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var clip = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (clip._mochiad_loaded) {
return(null);
}
var depth = options.depth;
delete options.depth;
var mc = clip.createEmptyMovieClip("_mochiad", depth);
var wh = _getRes(options);
options.res = (wh[0] + "x") + wh[1];
options.server = options.server + options.id;
delete options.id;
clip._mochiad_loaded = true;
if (clip._url.indexOf("http") != 0) {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
}
var lv = mc.createEmptyMovieClip("_mochiad_ctr", 1);
for (var k in options) {
lv[k] = options[k];
}
var server = lv.server;
delete lv.server;
var hostname = _allowDomains(server);
mc.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
mochi.as2.MochiAd.unload(this._parent);
}
};
}
};
var lc = new Object();
var name = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
lc.mc = mc;
lc.name = name;
lc.hostname = hostname;
lc.allowDomain = function (d) {
return(true);
};
lc.allowInsecureDomain = lc.allowDomain;
lc.connect(name);
mc.lc = lc;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
lv.lc = name;
lv.st = getTimer();
if (!options.skip) {
lv.loadMovie(server + ".swf", "POST");
}
return(mc);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
containerNotify(clip, {id:"unload"}, clip._mochiad._containerLCName);
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var o = System.security;
if (o.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var b = options.clip.getBounds();
var w = 0;
var h = 0;
if (typeof(options.res) != "undefined") {
var xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = b.xMax - b.xMin;
h = b.yMax - b.yMin;
}
if ((w == 0) || (h == 0)) {
w = Stage.width;
h = Stage.height;
}
return([w, h]);
}
static function _parseOptions(options, defaults) {
var optcopy = {};
for (var k in defaults) {
optcopy[k] = defaults[k];
}
if (options) {
for (var k in options) {
optcopy[k] = options[k];
}
}
if (_root.mochiad_options) {
var pairs = _root.mochiad_options.split("&");
var i = 0;
while (i < pairs.length) {
var kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
}
}
if (optcopy.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(optcopy);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
return;
case "getValue" :
var val = getValue(clip, arg.objectName);
containerRpcResult(clip, callbackID, val, clip._mochiad._containerLCName);
return;
case "runMethod" :
var ret = runMethod(clip, arg.method, arg.args);
containerRpcResult(clip, callbackID, ret, clip._mochiad._containerLCName);
return;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var nameArray = objectName.split(".");
var i;
i = 0;
while (i < (nameArray.length - 1)) {
if ((base[nameArray[i]] == undefined) || (base[nameArray[i]] == null)) {
return(undefined);
}
base = base[nameArray[i]];
i++;
}
base[nameArray[i]] = value;
}
static function getValue(base, objectName) {
var nameArray = objectName.split(".");
var i;
i = 0;
while (i < (nameArray.length - 1)) {
if ((base[nameArray[i]] == undefined) || (base[nameArray[i]] == null)) {
return(undefined);
}
base = base[nameArray[i]];
i++;
}
return(base[nameArray[i]]);
}
static function runMethod(base, methodName, argsArray) {
var nameArray = methodName.split(".");
var i;
i = 0;
while (i < (nameArray.length - 1)) {
if ((base[nameArray[i]] == undefined) || (base[nameArray[i]] == null)) {
return(undefined);
}
base = base[nameArray[i]];
i++;
}
if (typeof(base[nameArray[i]]) == "function") {
return(base[nameArray[i]].apply(base, argsArray));
}
return(undefined);
}
static function containerNotify(clip, args, lcName) {
var container = clip._mochiad._mochiad_ctr.ad.app;
if (container.notify) {
container.notify(args);
} else {
new LocalConnection().send(lcName, "notify", args);
}
}
static function containerRpcResult(clip, callbackID, val, lcName) {
var container = clip._mochiad._mochiad_ctr.ad.app;
if (container.rpcResult) {
container.rpcResult(callbackID, val);
} else {
new LocalConnection().send(lcName, "rpcResult", callbackID, val);
}
}
}
Symbol 1023 MovieClip [__Packages.mochi.as2.MochiSync] Frame 0
class mochi.as2.MochiSync
{
var _syncContainer;
function MochiSync () {
_syncContainer = {};
}
function getProp(name) {
return(_syncContainer[name]);
}
function setProp(name, value) {
if (_syncContainer[name] == value) {
return(undefined);
}
_syncContainer[name] = value;
mochi.as2.MochiServices.send("sync_propUpdate", {name:name, value:value});
}
function triggerEvent(eventType, args) {
switch (eventType) {
case SYNC_REQUEST :
mochi.as2.MochiServices.send("sync_syncronize", _syncContainer);
return;
case SYNC_PROPERTY :
_syncContainer[args.name] = args.value;
}
}
static var SYNC_REQUEST = "SyncRequest";
static var SYNC_PROPERTY = "UpdateProperty";
}
Symbol 1024 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function get childClip() {
return(_clip);
}
static function getVersion() {
return("3.8 as2");
}
static function allowDomains(server) {
var hostname = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(hostname);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(hostname);
}
}
return(hostname);
}
static function get isNetworkAvailable() {
if (System.security) {
var o = System.security;
if (o.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function set comChannelName(val) {
if (val != undefined) {
if (val.length > 3) {
_sendChannelName = val + "_fromgame";
initComChannels();
}
}
//return(__get__comChannelName());
}
static function get connected() {
return(_connected);
}
static function connect(id, clip, onError) {
warnID(id, false);
if ((!_connected) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.as2.MochiServices.onError = onError;
} else if (mochi.as2.MochiServices.onError == undefined) {
mochi.as2.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var clipname = ("_mochiservices_com_" + id);
var _loader = new MovieClipLoader();
var _loaderListener = {};
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servURL) {
_servURL = urlOptions().servURL;
}
var servicesURL = (_servURL + _services);
if (urlOptions().servicesURL) {
servicesURL = urlOptions().servicesURL;
}
allowDomains(servicesURL);
_clip = clip.createEmptyMovieClip(clipname, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener.onLoadError = loadError;
_loaderListener.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_loaderListener.onLoadComplete = function (target_mc) {
target_mc.MochiServices = mochi.as2.MochiServices;
};
_loaderListener.startTime = getTimer();
_loaderListener.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_loaderListener.waitInterval = setInterval(_loaderListener, "wait", 1000);
_loader.addListener(_loaderListener);
_loader.loadClip((((((servicesURL + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options)) + "&api_version=") + getVersion(), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
static function loadError(target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
disconnect();
onError.apply(null, [errorCode]);
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.as2.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel._nextcallbackID = 0;
_listenChannel._callbacks = {};
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var cb = pkg.callbackID;
var cblst = this._callbacks[cb];
if (!cblst) {
return(undefined);
}
var method = cblst.callbackMethod;
var obj = cblst.callbackObject;
if (obj && (typeof(method) == "string")) {
method = obj[method];
}
if (method != undefined) {
method.apply(obj, pkg.args);
}
delete this._callbacks[cb];
};
_listenChannel.onEvent = function (pkg) {
switch (pkg.target) {
case "events" :
mochi.as2.MochiEvents.triggerEvent(pkg.event, pkg.args);
return;
case "coins" :
mochi.as2.MochiSocial.triggerEvent(pkg.event, pkg.args);
return;
case "sync" :
mochi.as2.MochiServices.servicesSync.triggerEvent(pkg.event, pkg.args);
}
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function updateCopy(args) {
send("coins_updateCopy", args, null, null);
}
static function flush(error) {
var request;
var callback;
while (_sendChannel._queue.length > 0) {
request = _sendChannel._queue.shift();
delete callback;
if (request.callbackID != null) {
callback = _listenChannel._callbacks[request.callbackID];
}
delete _listenChannel._callbacks[request.callbackID];
if (error) {
handleError(request.args, callback.callbackObject, callback.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
if ((args.options != null) && (args.options.onError != null)) {
args.options.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
} else {
if ((_clip == undefined) || (!_connecting)) {
trace("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + methodName);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
}
_listenChannel._callbacks[_listenChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_listenChannel._nextcallbackID++;
}
static function urlOptions() {
var opts = {};
var options;
if (_root._url.indexOf("mochiad_options") != -1) {
var i = ((_root._url.indexOf("mochiad_options") + "mochiad_options".length) + 1);
options = _root._url.substr(i, _root._url.length);
} else if (_root.mochiad_options) {
options = _root.mochiad_options;
}
if (options) {
var pairs = _root.mochiad_options.split("&");
var i = 0;
while (i < pairs.length) {
var kv = pairs[i].split("=");
opts[unescape(kv[0])] = unescape(kv[1]);
i++;
}
}
return(opts);
}
static function warnID(bid, leaderboard) {
bid = bid.toLowerCase();
if (bid.length != 16) {
trace(("WARNING: " + (leaderboard ? "board" : "game")) + " ID is not the appropriate length");
return(undefined);
}
if (bid == "1e113c7239048b3f") {
if (leaderboard) {
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
}
return(undefined);
}
if (bid == "84993a1de4031cd8") {
if (leaderboard) {
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
}
return(undefined);
}
var i = 0;
while (i < bid.length) {
switch (bid.charAt(i)) {
case "0" :
case "1" :
case "2" :
case "3" :
case "4" :
case "5" :
case "6" :
case "7" :
case "8" :
case "9" :
case "a" :
case "b" :
case "c" :
case "d" :
case "e" :
case "f" :
break;
default :
trace("WARNING: Board ID contains illegal characters: " + bid);
return(undefined);
}
i++;
}
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var vars = new Object();
vars.mav = getVersion();
vars.swfv = btn.getSWFVersion() || 6;
vars.swfurl = btn._url;
vars.fv = System.capabilities.version;
vars.os = System.capabilities.os;
vars.lang = System.capabilities.language;
vars.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var i = 0;
for (var x in vars) {
if (i != 0) {
s = s + "&";
}
i++;
s = ((s + x) + "=") + escape(vars[x]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var nettest = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://x.mochiads.com/linkping.swf?t=" + getTimer());
nettest.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
mochi.as2.MochiServices.netup = false;
}
};
}
var clk = btn.createEmptyMovieClip("clk", 1001);
clk._alpha = 0;
clk.beginFill(1044735);
clk.moveTo(0, 0);
clk.lineTo(0, btn._height);
clk.lineTo(btn._width, btn._height);
clk.lineTo(btn._width, 0);
clk.lineTo(0, 0);
clk.endFill();
clk.onRelease = function () {
if (mochi.as2.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static function setContainer(clip) {
}
static function stayOnTop(clip) {
}
static var _servURL = "http://www.mochiads.com/static/lib/services/";
static var _services = "services.swf";
static var _mochiLC = "MochiLC.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
static var servicesSync = new mochi.as2.MochiSync();
}
Symbol 1025 MovieClip [__Packages.mochi.as2.MochiEventDispatcher] Frame 0
class mochi.as2.MochiEventDispatcher
{
var eventTable;
function MochiEventDispatcher () {
eventTable = {};
}
function buildDelegate(thisObject, thatObject) {
var delegate = {thisObject:thisObject, thatObject:thatObject};
if (thatObject != undefined) {
var funct = ((typeof(thatObject) == "string") ? (thisObject[thatObject]) : (thatObject));
delegate.delegate = function (args) {
funct.call(thisObject, args);
};
} else {
delegate.delegate = thisObject;
}
return(delegate);
}
function compareDelegate(d_A, d_B) {
if ((d_A.thisObject != d_B.thisObject) || (d_A.thatObject != d_B.thatObject)) {
return(false);
}
return(true);
}
function addEventListener(event, thisObject, thatObject) {
removeEventListener(event, thisObject, thatObject);
eventTable[event].push(buildDelegate(thisObject, thatObject));
}
function removeEventListener(event, thisObject, thatObject) {
var delegate = buildDelegate(thisObject, thatObject);
if (eventTable[event] == undefined) {
eventTable[event] = [];
return(undefined);
}
for (var s in eventTable[event]) {
if (!compareDelegate(eventTable[event][s], delegate)) {
continue;
}
eventTable[event].splice(Number(s), 1);
}
}
function triggerEvent(event, args) {
if (eventTable[event] == undefined) {
return(undefined);
}
for (var i in eventTable[event]) {
eventTable[event][i].delegate(args);
}
}
}
Symbol 1026 MovieClip [__Packages.mochi.as2.MochiEvents] Frame 0
class mochi.as2.MochiEvents
{
function MochiEvents () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function startSession(achievementID) {
mochi.as2.MochiServices.send("events_beginSession", {achievementID:achievementID}, null, null);
}
static function setNotifications(clip, style) {
var args = {};
for (var s in style) {
args[s] = style[s];
}
args.clip = clip;
mochi.as2.MochiServices.send("events_setNotifications", args, null, null);
}
static function addEventListener(eventType, thisObject, thatObject) {
_dispatcher.addEventListener(eventType, thisObject, thatObject);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, thisObject, thatObject) {
_dispatcher.removeEventListener(eventType, thisObject, thatObject);
}
static function startPlay(tag) {
if (tag == undefined) {
tag = "gameplay";
}
mochi.as2.MochiServices.send("events_setRoundID", {tag:String(tag)}, null, null);
}
static function endPlay() {
mochi.as2.MochiServices.send("events_clearRoundID", null, null, null);
}
static function trackEvent(tag, value) {
mochi.as2.MochiServices.send("events_trackEvent", {tag:tag, value:value}, null, null);
}
static var ACHIEVEMENT_RECEIVED = "AchievementReceived";
static var ALIGN_TOP_LEFT = "ALIGN_TL";
static var ALIGN_TOP = "ALIGN_T";
static var ALIGN_TOP_RIGHT = "ALIGN_TR";
static var ALIGN_LEFT = "ALIGN_L";
static var ALIGN_CENTER = "ALIGN_C";
static var ALIGN_RIGHT = "ALIGN_R";
static var ALIGN_BOTTOM_LEFT = "ALIGN_BL";
static var ALIGN_BOTTOM = "ALIGN_B";
static var ALIGN_BOTTOM_RIGHT = "ALIGN_BR";
static var FORMAT_SHORT = "ShortForm";
static var FORMAT_LONG = "LongForm";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 1027 MovieClip [__Packages.mochi.as2.MochiSocial] Frame 0
class mochi.as2.MochiSocial
{
function MochiSocial () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showLoginWidget(options) {
mochi.as2.MochiServices.setContainer();
mochi.as2.MochiServices.stayOnTop();
mochi.as2.MochiServices.send("coins_showLoginWidget", {options:options});
}
static function hideLoginWidget() {
mochi.as2.MochiServices.send("coins_hideLoginWidget");
}
static function requestLogin() {
mochi.as2.MochiServices.send("coins_requestLogin");
}
static function getUserInfo() {
mochi.as2.MochiServices.send("coins_getUserInfo");
}
static function saveUserProperties(properties) {
mochi.as2.MochiServices.send("coins_saveUserProperties", properties);
}
static function addEventListener(eventType, delegate) {
_dispatcher.addEventListener(eventType, delegate);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, delegate) {
_dispatcher.removeEventListener(eventType, delegate);
}
static var LOGGED_IN = "LoggedIn";
static var LOGGED_OUT = "LoggedOut";
static var LOGIN_SHOW = "LoginShow";
static var LOGIN_HIDE = "LoginHide";
static var LOGIN_SHOWN = "LoginShown";
static var PROFILE_SHOW = "ProfileShow";
static var PROFILE_HIDE = "ProfileHide";
static var PROPERTIES_SAVED = "PropertySaved";
static var WIDGET_LOADED = "WidgetLoaded";
static var USER_INFO = "UserInfo";
static var ERROR = "Error";
static var IO_ERROR = "IOError";
static var NO_USER = "NoUser";
static var PROPERTIES_SIZE = "PropertiesSize";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 1028 MovieClip [__Packages.InputWrapper] Frame 0
class InputWrapper
{
static var remote;
function InputWrapper () {
}
static function init() {
if (!initialized) {
initialized = true;
remote = com.wiicade.Wii.getPrimaryRemote();
remote.addEventListener("buttondown", buttonPressed);
remote.addEventListener("buttonup", buttonReleased);
remote.addEventListener("connected", remoteConnected);
remote.addEventListener("pointer", pointerMove);
remote.addEventListener("disconnected", remoteDisconnected);
}
}
static function buttonPressed(event) {
if ((_root.gameState == _root.GS_Die) || (_root.gameState == _root.GS_Pause)) {
return(undefined);
}
var button = event.buttonCode;
if (GameModes.__get__mode() == GameModes.KeyboardMode) {
if ((button == com.wiicade.WiiRemote.BUTTON_RIGHT) && (_root.rotDir < 1)) {
_root.rotDir = 1;
_root.rotationSpeed = 0;
} else if ((button == com.wiicade.WiiRemote.BUTTON_LEFT) && (_root.rotDir > -1)) {
_root.rotDir = -1;
_root.rotationSpeed = 0;
} else {
_root.rotDir = 0;
_root.rotationSpeed = 0;
}
} else {
if ((button == com.wiicade.WiiRemote.BUTTON_RIGHT) || (button == com.wiicade.WiiRemote.BUTTON_LEFT)) {
_root.showBubble("You cannot use keys in this mode!\nMouse is better at controlling gun.\nTry Legacy Mode if you prefer keys.\n");
}
if (button == com.wiicade.WiiRemote.BUTTON_A) {
if (getMouseY() > 20) {
_root.firing = true;
_root.defender.gun.play();
}
}
}
if (button == com.wiicade.WiiRemote.BUTTON_B) {
Gun.getGun(5).fire();
mochi.as2.MochiEvents.trackEvent("Nuke Used", _root.level);
}
if (button == com.wiicade.WiiRemote.BUTTON_PLUS) {
if (!_root.weaponScreen._visible) {
Gun.nextGun();
}
} else if (button == com.wiicade.WiiRemote.BUTTON_MINUS) {
if (!_root.weaponScreen._visible) {
Gun.previousGun();
}
}
}
static function getMouseX() {
return(remote.getCursorX());
}
static function getMouseY() {
return(remote.getCursorY());
}
static function buttonReleased(event) {
var button = event.buttonCode;
if ((button == com.wiicade.WiiRemote.BUTTON_A) && (_root.weaponScreen._visible == false)) {
_root.firing = false;
_root.defender.gun.stop();
if (!_root.clickWarningGiven) {
if ((getTimer() - _root.lastClick) < _root.clickInterval) {
_root.numClicks++;
if (_root.numClicks > 5) {
_root.clickWarningGiven = true;
mochi.as2.MochiEvents.trackEvent("Mouse_warning_given");
_root.showTutorial("Hold the mouse down!\nIt gives a faster rate of fire than\nconstantly clicking!");
_root.numClicks = 0;
}
} else {
_root.numClicks = 0;
}
_root.lastClick = getTimer();
}
}
}
static function pointerMove(event) {
_root.crosshair._x = remote.getCursorX() - (_root.crosshair._width / 2);
_root.crosshair._y = remote.getCursorY() - (_root.crosshair._height / 2);
}
static function remoteConnected(event) {
}
static function remoteDisconnected(event) {
}
static var initialized = false;
}
Symbol 1029 MovieClip [__Packages.com.wiicade.WiiRemote] Frame 0
class com.wiicade.WiiRemote
{
var identity, attachment, activated, dispatchEvent, oldcursorx, oldcursory;
function WiiRemote (identity) {
this.identity = identity;
allowRotate = com.wiicade.Wii.isWii();
attachment = new com.wiicade.Nunchuk(this);
activated = new Array();
if (this.identity == 0) {
primary = true;
connected = true;
}
mx.events.EventDispatcher.initialize(this);
}
static function init() {
}
function getIdentity() {
return(identity);
}
function isPrimary() {
return(primary);
}
function isConnected() {
return(connected);
}
function isRotated() {
return(rotated);
}
function setRotated(rotate) {
rotated = rotate;
}
function getTwistAngle() {
if ((!activated[com.wiicade.Wii.COMMAND_TWIST]) && (com.wiicade.Wii.isWii())) {
getURL (((("javascript:activateWiiRemoteFeature(" + identity) + ", ") + (com.wiicade.Wii.COMMAND_TWIST + identity)) + ", true);");
activated[com.wiicade.Wii.COMMAND_TWIST] = true;
}
return(twistAngle);
}
function getDistance() {
if ((!activated[com.wiicade.Wii.COMMAND_DISTANCE]) && (com.wiicade.Wii.isWii())) {
getURL (((("javascript:activateWiiRemoteFeature(" + identity) + ", ") + (com.wiicade.Wii.COMMAND_DISTANCE + identity)) + ", true);");
activated[com.wiicade.Wii.COMMAND_DISTANCE] = true;
}
return(distance);
}
function getCursorX() {
if ((!activated[com.wiicade.Wii.COMMAND_CURSORX]) && (com.wiicade.Wii.isWii())) {
getURL (((("javascript:activateWiiRemoteFeature(" + identity) + ", ") + (com.wiicade.Wii.COMMAND_CURSORX + identity)) + ", true);");
activated[com.wiicade.Wii.COMMAND_CURSORX] = true;
}
return(cursorx);
}
function getCursorY() {
if ((!activated[com.wiicade.Wii.COMMAND_CURSORX]) && (com.wiicade.Wii.isWii())) {
getURL (((("javascript:activateWiiRemoteFeature(" + identity) + ", ") + (com.wiicade.Wii.COMMAND_CURSORX + identity)) + ", true);");
activated[com.wiicade.Wii.COMMAND_CURSORX] = true;
}
return(cursory);
}
function isFacingScreen() {
return((cursorx > 0) || (cursory > 0));
}
function isDown(buttonCode) {
if (rotated && (allowRotate)) {
if (buttonCode == BUTTON_UP) {
buttonCode = BUTTON_RIGHT;
} else if (buttonCode == BUTTON_RIGHT) {
buttonCode = BUTTON_DOWN;
} else if (buttonCode == BUTTON_DOWN) {
buttonCode = BUTTON_LEFT;
} else if (buttonCode == BUTTON_LEFT) {
buttonCode = BUTTON_UP;
}
}
return((pressed & buttonCode) > 0);
}
function getAttachment() {
if ((!activated[com.wiicade.Wii.COMMAND_ATTACH]) && (com.wiicade.Wii.isWii())) {
getURL (((("javascript:activateWiiRemoteFeature(" + identity) + ", ") + (com.wiicade.Wii.COMMAND_ATTACH + identity)) + ", true);");
activated[com.wiicade.Wii.COMMAND_ATTACH] = true;
}
return(attachment);
}
function buttonsUpdated(bitmap) {
var mask = 1;
var oldpressed = pressed;
var diff;
pressed = bitmap;
diff = pressed ^ oldpressed;
var i = 0;
while (i < 10) {
if ((diff & mask) > 0) {
if ((pressed & mask) > 0) {
dispatchEvent({type:"buttondown", buttonCode:mask, identity:identity});
} else {
dispatchEvent({type:"buttonup", buttonCode:mask, identity:identity});
}
}
mask = mask << 1;
i++;
}
}
function twistUpdated(angle) {
var oldangle = twistAngle;
twistAngle = angle;
if (twistAngle != oldangle) {
dispatchEvent({type:"twist", angle:angle, identity:identity});
}
}
function distanceUpdated(distance) {
var olddistance = this.distance;
this.distance = distance;
if (this.distance != olddistance) {
dispatchEvent({type:"distance", distance:distance, identity:identity});
}
}
function connectedUpdated(connected) {
var oldconnected = this.connected;
this.connected = connected;
if (this.connected != oldconnected) {
if (connected) {
dispatchEvent({type:"connected", identity:identity});
} else {
dispatchEvent({type:"disconnected", identity:identity});
}
}
}
function cursorXUpdated(cursorx) {
oldcursorx = this.cursorx;
this.cursorx = cursorx;
}
function cursorYUpdated(cursory) {
oldcursory = this.cursory;
this.cursory = cursory;
if ((cursorx != oldcursorx) || (this.cursory != oldcursory)) {
dispatchEvent({type:"pointer", cursorx:cursorx, cursory:this.cursory, identity:identity});
}
}
function updatePrimary(primary) {
this.primary = primary;
}
function updateAttachment(attachment) {
this.attachment = attachment;
}
static var BUTTON_UP = 8;
static var BUTTON_DOWN = 4;
static var BUTTON_RIGHT = 2;
static var BUTTON_LEFT = 1;
static var BUTTON_1 = 64;
static var BUTTON_2 = 32;
static var BUTTON_A = 256;
static var BUTTON_B = 128;
static var BUTTON_PLUS = 16;
static var BUTTON_MINUS = 512;
var primary = false;
var connected = false;
var rotated = false;
var allowRotate = true;
var twistAngle = 0;
var distance = 0;
var cursorx = 0;
var cursory = 0;
var pressed = 0;
}
Symbol 1030 MovieClip [__Packages.com.wiicade.Wii] Frame 0
class com.wiicade.Wii
{
static var instance;
var keyboard, lc;
function Wii () {
if (!_global.Wii) {
_global.Wii = this;
} else {
return;
}
wii = System.capabilities.os == "Nintendo Wii";
com.wiicade.WiiRemote.init();
com.wiicade.KeyboardController.init();
com.wiicade.Browser.init();
var i = 0;
while (i < 4) {
remotes[i] = new com.wiicade.WiiRemote(i);
i++;
}
if (!isWii()) {
keyboard = new com.wiicade.KeyboardController(wiicommand);
}
lc = new LocalConnection();
lc.connect("wii");
lc.wiicommand = function (packet) {
_global.Wii.wiicommand(packet);
};
if (isWii()) {
getURL (((("javascript:initializeWiiCadeAPI(20, " + Stage.width) + ", ") + Stage.height) + ");");
}
}
static function getInstance() {
if (!_global.Wii) {
instance = new com.wiicade.Wii();
}
return(_global.Wii);
}
static function init() {
_global.Wii = null;
instance = new com.wiicade.Wii();
}
static function isWii() {
var wii = getInstance();
return(wii.wii || (wii.virtualized));
}
function wiicommand(packet) {
var wii = getInstance();
var command = ((4294901760 & packet) >> 16);
var data = (packet & 65535);
if (command < 5) {
wii.remotes[command - 1].buttonsUpdated(data);
} else if (command < 9) {
wii.remotes[command - 5].twistUpdated(data);
} else if (command < 13) {
wii.remotes[command - 9].distanceUpdated(data);
} else if (command == 13) {
parseFlags(data);
} else if (command < 18) {
parseAttachment(data, command - 14);
} else if (command < 22) {
wii.remotes[command - 18].cursorXUpdated(data);
} else if (command < 32) {
wii.remotes[command - 22].cursorYUpdated(data);
}
}
function parseFlags(flags) {
var oldprimary = primary;
var remote;
var connected;
var mask = 8;
primary = flags & 3;
if (primary != oldprimary) {
getRemote(oldprimary).updatePrimary(false);
getRemote(primary).updatePrimary(true);
}
virtualized = (4 & mask) > 0;
var i = 0;
while (i < 4) {
remote = getRemote(i);
connected = (mask & flags) > 0;
if (remote.isConnected() != connected) {
remote.connectedUpdated(connected);
}
mask = mask << 1;
i++;
}
}
function parseAttachment(data, remote) {
var wiiremote = getRemote(remote);
var attachment = wiiremote.getAttachment();
var x;
var y;
if ((data & 256) == 0) {
if (!(attachment instanceof com.wiicade.Nunchuk)) {
attachment = new com.wiicade.Nunchuk(wiiremote);
wiiremote.updateAttachment(attachment);
}
attachment.updateButtons(data & 3);
x = (data & 28) >>> 2;
y = (data & 224) >>> 5;
if ((x & 4) > 0) {
x = x | 65528;
}
if ((y & 4) > 0) {
y = y | 65528;
}
x = int((x * 128) / 3);
y = int((y * 128) / 3);
attachment.updateStick(x, y);
}
}
static function getRemote(identity) {
var wii = getInstance();
if ((!wii.activated[identity]) && (wii.isWii())) {
getURL (("javascript:activateWiiRemoteFeature(" + identity) + ", null, true);");
wii.activated[identity] = true;
}
return(wii.remotes[identity]);
}
static function getPrimaryRemote() {
var wii = getInstance();
return(wii.remotes[wii.primary]);
}
static var COMMAND_BUTTONS = 1;
static var COMMAND_TWIST = 5;
static var COMMAND_DISTANCE = 9;
static var COMMAND_FLAGS = 13;
static var COMMAND_ATTACH = 14;
static var COMMAND_CURSORX = 18;
static var COMMAND_CURSORY = 22;
var remotes = new Array();
var activated = new Array();
var primary = 0;
var virtualized = false;
var wii = true;
}
Symbol 1031 MovieClip [__Packages.com.wiicade.KeyboardController] Frame 0
class com.wiicade.KeyboardController
{
static var keyCodes, buttonCodes;
var callback;
function KeyboardController (callback) {
this.callback = callback;
Key.addListener(this);
Mouse.addListener(this);
if (!keyCodes) {
init();
}
}
static function init() {
keyCodes = new Array();
buttonCodes = new Array();
keyCodes[37] = com.wiicade.WiiRemote.BUTTON_LEFT;
keyCodes[38] = com.wiicade.WiiRemote.BUTTON_UP;
keyCodes[39] = com.wiicade.WiiRemote.BUTTON_RIGHT;
keyCodes[40] = com.wiicade.WiiRemote.BUTTON_DOWN;
keyCodes[65] = com.wiicade.WiiRemote.BUTTON_1;
keyCodes[83] = com.wiicade.WiiRemote.BUTTON_2;
keyCodes[68] = com.wiicade.WiiRemote.BUTTON_A;
keyCodes[32] = com.wiicade.WiiRemote.BUTTON_B;
keyCodes[187] = com.wiicade.WiiRemote.BUTTON_PLUS;
keyCodes[189] = com.wiicade.WiiRemote.BUTTON_MINUS;
buttonCodes[com.wiicade.WiiRemote.BUTTON_LEFT] = 37;
buttonCodes[com.wiicade.WiiRemote.BUTTON_UP] = 38;
buttonCodes[com.wiicade.WiiRemote.BUTTON_RIGHT] = 39;
buttonCodes[com.wiicade.WiiRemote.BUTTON_DOWN] = 40;
buttonCodes[com.wiicade.WiiRemote.BUTTON_1] = 65;
buttonCodes[com.wiicade.WiiRemote.BUTTON_2] = 83;
buttonCodes[com.wiicade.WiiRemote.BUTTON_A] = 68;
buttonCodes[com.wiicade.WiiRemote.BUTTON_B] = 32;
buttonCodes[com.wiicade.WiiRemote.BUTTON_PLUS] = 187;
buttonCodes[com.wiicade.WiiRemote.BUTTON_MINUS] = 189;
}
function onKeyDown() {
var code = Key.getCode();
if (keyCodes[code]) {
bitmap = bitmap | keyCodes[code];
callback((com.wiicade.Wii.COMMAND_BUTTONS << 16) | bitmap);
}
}
function onKeyUp() {
var code = Key.getCode();
if (keyCodes[code]) {
bitmap = bitmap & (~keyCodes[code]);
callback((com.wiicade.Wii.COMMAND_BUTTONS << 16) | bitmap);
}
}
function onMouseWheel(delta) {
if (delta > 0) {
bitmap = bitmap | com.wiicade.WiiRemote.BUTTON_PLUS;
} else if (delta < 0) {
bitmap = bitmap | com.wiicade.WiiRemote.BUTTON_MINUS;
}
callback((com.wiicade.Wii.COMMAND_BUTTONS << 16) | bitmap);
if (delta > 0) {
bitmap = bitmap & (~com.wiicade.WiiRemote.BUTTON_PLUS);
} else if (delta < 0) {
bitmap = bitmap & (~com.wiicade.WiiRemote.BUTTON_MINUS);
}
callback((com.wiicade.Wii.COMMAND_BUTTONS << 16) | bitmap);
}
function onMouseDown() {
bitmap = bitmap | com.wiicade.WiiRemote.BUTTON_A;
callback((com.wiicade.Wii.COMMAND_BUTTONS << 16) | bitmap);
}
function onMouseUp() {
bitmap = bitmap & (~com.wiicade.WiiRemote.BUTTON_A);
callback((com.wiicade.Wii.COMMAND_BUTTONS << 16) | bitmap);
}
function onMouseMove() {
callback((com.wiicade.Wii.COMMAND_CURSORX << 16) | _xmouse);
callback((com.wiicade.Wii.COMMAND_CURSORY << 16) | _ymouse);
}
static function getButtonMappingForKey(keyCode) {
if (!keyCodes) {
com.wiicade.Wii.isWii();
}
return(keyCodes[keyCode]);
}
static function getKeyMappingForButton(buttonCode) {
if (!keyCodes) {
com.wiicade.Wii.isWii();
}
return(buttonCodes[buttonCode]);
}
static function setKeyMapping(buttonCode, keyCode) {
if (!keyCodes) {
com.wiicade.Wii.isWii();
}
var origKeyCode = buttonCodes[buttonCode];
var origButtonCode = keyCodes[keyCode];
if (origKeyCode) {
keyCodes[origKeyCode] = null;
}
if (origButtonCode) {
buttonCodes[origButtonCode] = null;
}
keyCodes[keyCode] = buttonCode;
buttonCodes[buttonCode] = keyCode;
}
var bitmap = 0;
}
Symbol 1032 MovieClip [__Packages.com.wiicade.Browser] Frame 0
class com.wiicade.Browser
{
static var buttonEnabled;
function Browser () {
}
static function init() {
buttonEnabled = new Array();
buttonEnabled[com.wiicade.WiiRemote.BUTTON_LEFT] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_UP] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_RIGHT] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_DOWN] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_1] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_2] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_A] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_B] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_PLUS] = false;
buttonEnabled[com.wiicade.WiiRemote.BUTTON_MINUS] = false;
}
static function isDefaultEnabled(buttonCode) {
if (!buttonEnabled) {
com.wiicade.Wii.isWii();
}
return(buttonEnabled[buttonCode]);
}
static function setDefaultEnabled(buttonCode, enabled) {
if (!buttonEnabled) {
com.wiicade.Wii.isWii();
}
buttonEnabled[buttonCode] = enabled;
if (com.wiicade.Wii.isWii()) {
getURL (((("javascript:enableWiiButton(" + buttonCode) + ",") + enabled) + ");");
}
}
static function enableZooming() {
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_PLUS, true);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_MINUS, true);
}
static function disableZooming() {
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_PLUS, false);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_MINUS, false);
}
static function enableScrolling() {
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_LEFT, true);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_RIGHT, true);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_UP, true);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_DOWN, true);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_B, true);
}
static function disableScrolling() {
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_LEFT, false);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_RIGHT, false);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_UP, false);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_DOWN, false);
setDefaultEnabled(com.wiicade.WiiRemote.BUTTON_B, false);
}
static function setBackgroundColor(color) {
if (com.wiicade.Wii.isWii()) {
getURL (("javascript:setBackgroundColor(" + color) + ");");
}
}
}
Symbol 1033 MovieClip [__Packages.com.wiicade.Nunchuk] Frame 0
class com.wiicade.Nunchuk
{
var parent, dispatchEvent;
function Nunchuk (parent) {
this.parent = parent;
mx.events.EventDispatcher.initialize(this);
}
function isDown(buttonCode) {
return((pressed & buttonCode) > 0);
}
function getStickX() {
return(stickx);
}
function getStickY() {
return(sticky);
}
function updateButtons(buttons) {
var mask = 1;
var oldpressed = pressed;
var diff;
pressed = buttons;
diff = pressed ^ oldpressed;
var i = 0;
while (i < 10) {
if ((diff & mask) > 0) {
if ((pressed & mask) > 0) {
dispatchEvent({type:"buttondown", buttonCode:mask, identity:parent.getIdentity()});
} else {
dispatchEvent({type:"buttonup", buttonCode:mask, identity:parent.getIdentity()});
}
}
mask = mask << 1;
i++;
}
}
function updateStick(x, y) {
stickx = x;
sticky = y;
}
static var BUTTON_C = 2;
static var BUTTON_Z = 1;
var pressed = 0;
var stickx = 0;
var sticky = 0;
}
Symbol 1034 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var l = queue.length;
var i;
i = 0;
while (i < l) {
var o = queue[i];
if (o == handler) {
queue.splice(i, 1);
return(undefined);
}
i++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var queueName = ("__q_" + eventObj.type);
var queue = queueObj[queueName];
if (queue != undefined) {
var i;
for (i in queue) {
var o = queue[i];
var oType = typeof(o);
if ((oType == "object") || (oType == "movieclip")) {
if (o.handleEvent != undefined) {
o.handleEvent(eventObj);
}
if (o[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
o[eventObj.type](eventObj);
}
}
} else {
o.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var queueName = ("__q_" + event);
if (this[queueName] == undefined) {
this[queueName] = new Array();
}
_global.ASSetPropFlags(this, queueName, 1);
_removeEventListener(this[queueName], event, handler);
this[queueName].push(handler);
}
function removeEventListener(event, handler) {
var queueName = ("__q_" + event);
_removeEventListener(this[queueName], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 1035 MovieClip [__Packages.GameModes] Frame 0
class GameModes
{
function GameModes () {
}
static function set mode(Mode) {
_gameMode = Mode;
if (Mode == KeyboardMode) {
_root.difficulty = 1;
}
//return(mode);
}
static function get mode() {
return(_gameMode);
}
static function get name() {
switch (_gameMode) {
case NormalMode :
return("Normal");
case KeyboardMode :
return("Keyboard");
case SquidMode :
return("Squid");
case BarrelMode :
return("Barrel");
case ExplosiveMode :
return("Explosive");
}
return("");
}
static var NormalMode = 1;
static var KeyboardMode = 2;
static var SquidMode = 3;
static var BarrelMode = 4;
static var ExplosiveMode = 5;
static var _gameMode = undefined;
}
Symbol 1036 MovieClip [__Packages.Gun] Frame 0
class Gun
{
function Gun () {
}
function isTangible() {
return(true);
}
function isSelectable() {
return(true);
}
static function nextGun() {
var i = 1;
while (i < (GUNS - 1)) {
if (switchGun((index + i) % (GUNS - 1)) >= 0) {
return(undefined);
}
i++;
}
}
static function previousGun() {
var i = (GUNS - 2);
while (i > 0) {
if (switchGun((index + i) % (GUNS - 1)) >= 0) {
return(undefined);
}
i--;
}
}
static function switchGun(ind) {
if ((keyMap[ind].upgradeLevel > 0) && (keyMap[ind].isSelectable())) {
if (index != ind) {
if (_root.gun.lastSwitchTime != 0) {
_root.gun.useTime = _root.gun.useTime + ((getTimer() - _root.gun.lastSwitchTime) / 1000);
}
}
index = (ind);
_root.gun = getCurrentGun();
if (_root.gameState != _root.GS_Pause) {
_root.gun.lastSwitchTime = getTimer();
} else {
_root.gun.lastSwitchTime = 0;
}
_root.defender.gotoAndStop(_root.gun.GunClip);
if (_root.firing) {
_root.defender.gun.play();
} else if (_root.weaponScreen._visible == false) {
_root.defender.gun.stop();
}
_root.bulletsLayer.s.attachSound(_root.gun.sound);
_root.updateWeaponBar();
return(index);
}
return(-1);
}
static function initKeyMap() {
keyMap[0] = new BarrelGun();
keyMap[1] = new RapidGun();
keyMap[2] = new PenetrationGun();
keyMap[3] = new SprayGun();
keyMap[4] = new ExplosiveGun();
keyMap[5] = new NukeGun();
if (GameModes.__get__mode() == GameModes.ExplosiveMode) {
index = (4);
} else {
index = (0);
}
keyMap[index].upgradeLevel = 1;
keyMap[index].lastSwitchTime = getTimer();
}
function _upgradeTo(level) {
}
function get maxUpgrade() {
return(0);
}
function set upgradeLevel(level) {
if ((level >= 0) && (level <= maxUpgrade)) {
_upgrade = level;
_upgradeTo(level);
}
//return(upgradeLevel);
}
function get upgradeLevel() {
return(_upgrade);
}
function get description() {
return("This gun does not yet have a description");
}
static function getGun(ind) {
return(keyMap[ind]);
}
function fire() {
if (canFire && (_root.gameState != _root.GS_Die)) {
if (_root.soundEffects) {
_root.bulletsLayer.s.setPan((_root.defender._rotation * 100) / 90);
_root.bulletsLayer.s.start();
}
createBullets();
}
}
static function fireGun() {
getCurrentGun().fire();
}
function bulletFrame(bullet) {
}
function get canFire() {
return(true);
}
function createBullets() {
_root.createBullet(this, 0, 0, false);
}
static function getCurrentGun() {
return(keyMap[index]);
}
static function assignGunToKey(gun, index) {
keyMap[gun] = index;
}
function get hitOnce() {
return(true);
}
function get delay() {
return(_delay);
}
function get speed() {
return(_speed);
}
function get name() {
return(_name);
}
function set name(name) {
_name = name;
//return(this.name);
}
function set delay(delay) {
_delay = delay;
//return(this.delay);
}
function set speed(speed) {
_speed = speed;
//return(this.speed);
}
function get BulletClip() {
return("Bullet");
}
function get GunClip() {
return("SingleBarrelGun");
}
function get sound() {
return("sndBullet");
}
static function get index() {
return(_index);
}
static function set index(index) {
_index = index;
//return(Gun.index);
}
function get damage() {
return(_damage);
}
function set damage(damage) {
_damage = damage;
//return(this.damage);
}
function get bulletCount() {
return(_bulletCount);
}
function set bulletCount(count) {
_bulletCount = count;
//return(bulletCount);
}
function get price() {
return(_price);
}
function set price(val) {
_price = val;
//return(price);
}
static function hitTestWithAll(me, aDamage, aClearFloor) {
var sides = ["Left", "Right"];
for (var s in sides) {
var side = sides[s];
for (var i in _root.aliensLayer[side]) {
var m = _root.aliensLayer[side][i];
if (typeof(m) != "movieclip") {
continue;
}
if (me.hitTest(m)) {
m._visible = false;
if (i.slice(0, 5) == "Alien") {
if (!m.falling) {
_root.aliensLayer[m.side][m.platform].dy = _root.FallRate;
_root.aliensLayer[m.side][m.platform].falling = true;
}
_root.AliensHit++;
_root.removeAlien(m);
if (_root.soundEffects) {
_root.sndAlienDeath.gotoAndPlay("start");
}
_root.Score = _root.Score + _root.ScoreAlien;
} else {
if (_root.soundEffects) {
_root.sndPlatformHit.gotoAndPlay("start");
}
_root.AliensHit++;
_root.removeAlien(_root.aliensLayer[side][m.alien]);
_root.Score = _root.Score + _root.ScoreAlien;
_root.Score = _root.Score + _root.ScorePlatform;
delete m.onEnterFrame;
m.removeMovieClip();
}
}
}
if (aClearFloor) {
for (var i in _root.aliensLayer[("floor" + side) + "Layer"]) {
if (typeof(_root.aliensLayer[("floor" + side) + "Layer"][i]) != "movieclip") {
continue;
}
if (me.hitTest(_root.aliensLayer[("floor" + side) + "Layer"][i])) {
_root.aliensLayer[("floor" + side) + "Layer"][i]._visible = false;
_root.aliensLayer[("floor" + side) + "Layer"][i].removeMovieClip();
_root.aliensLayer[("floor" + side) + "Layer"].size--;
if (_root.soundEffects) {
_root.sndAlienDeath.gotoAndPlay("start");
}
_root.Score = _root.Score + _root.ScoreAlienOnGround;
}
}
}
for (var i in _root.squidsLayer[side]) {
if (typeof(_root.squidsLayer[side][i]) != "movieclip") {
continue;
}
if (me.hitTest(_root.squidsLayer[side][i])) {
_root.squidsLayer[side][i]._visible = false;
_root.SquidsHit++;
_root.removeSquid(_root.squidsLayer[side][i]);
if (_root.soundEffects) {
_root.sndAlienDeath.gotoAndPlay("start");
}
_root.Score = _root.Score + _root.ScoreSquid;
}
}
for (var i in _root.monstersLayer[side]) {
if (typeof(_root.monstersLayer[side][i]) != "movieclip") {
continue;
}
if (_root.monstersLayer[side][i].forceField) {
if (me.hitTest(_root.monstersLayer[side][i].shield)) {
if (_root.soundEffects) {
_root.sndPlatformHit.gotoAndPlay("start");
}
_root.Score = _root.Score + _root.ScoreForceField;
_root.monstersLayer[side][i].shield.removeMovieClip();
_root.monstersLayer[side][i].forceField = false;
}
} else if (me.hitTest(_root.monstersLayer[side][i])) {
_root.killMonster(_root.monstersLayer[side][i]);
if (_root.soundEffects) {
_root.sndMonsterDeath.gotoAndPlay("start");
}
_root.Score = _root.Score + _root.ScoreMonster;
}
}
}
for (var i in _root.mothershipsLayer) {
var m = _root.mothershipsLayer[i];
if ((typeof(m) != "movieclip") || (m.isDead == true)) {
continue;
}
if (me.hitTest(m)) {
_root.MothershipsHit++;
_root.addExplosion(m._x + 39, m._y + 10, 20, 45, 150, 75);
_root.removeMothership(m);
if (_root.soundEffects) {
_root.sndMothershipHit.gotoAndPlay("start");
}
_root.Score = _root.Score + _root.ScoreMothership;
}
}
for (var i in _root.blipsLayer) {
if ((typeof(_root.blipsLayer[i]) != "movieclip") || (_root.blipsLayer[i].isDead == true)) {
continue;
}
if (me.hitTest(_root.blipsLayer[i])) {
if (_root.soundEffects) {
_root.sndBonusShip.gotoAndPlay("start");
}
_root.blipsLayer[i].txtBonus.text = "$" + _root.ScoreBlip;
_root.Score = _root.Score + _root.ScoreBlip;
_root.endBlip++;
_root.removeBlip(_root.blipsLayer[i]);
}
}
if (_root.gameState == _root.GS_Giant) {
var i = 1;
while (i <= 6) {
if (_root["chute" + i]._visible) {
if (_root["chute" + i].portal.hitTest(me)) {
if (_root.soundEffects) {
_root.sndPlatformHit.gotoAndPlay("start");
}
_root["chute" + i].portal.damage = _root["chute" + i].portal.damage + aDamage;
_root["chute" + i].gotoAndPlay("frmHit");
}
}
i++;
}
}
}
var _speed = 0;
var _delay = 0;
var _damage = 1;
var _price = 0;
var _name = "Gun";
var _upgrade = 0;
var _bulletCount = 1;
var totalBullets = 0;
var successfulBullets = 0;
var lastSwitchTime = 0;
var useTime = 0;
static var _index = 0;
static var GUNS = 6;
static var keyMap = new Array(GUNS);
}
Symbol 1037 MovieClip [__Packages.BarrelGun] Frame 0
class BarrelGun extends Gun
{
var __set__name, __set__delay, __set__speed, __set__bulletCount, __set__price, __get__upgradeLevel;
function BarrelGun () {
super();
__set__name("Barrel Gun");
}
function get description() {
return("The Barrel Gun is an economically effective weapon capable of delivering modest-speed bullets with a decent rate of fire. The Barrel Gun comes in five variations, the most powerful of which is able to deliver 3 high-speed bullets simultaneously.");
}
function get maxUpgrade() {
return(5);
}
function _upgradeTo(level) {
switch (level) {
case 1 :
__set__delay(6 * (1000 / _root.FPS));
__set__speed(350);
__set__bulletCount(1);
__set__price(0);
return;
case 2 :
__set__delay(6 * (1000 / _root.FPS));
__set__speed(380);
__set__bulletCount(2);
__set__price(10800);
return;
case 3 :
__set__delay(4 * (1000 / _root.FPS));
__set__speed(380);
__set__bulletCount(2);
__set__price(60800);
return;
case 4 :
__set__delay(3.3 * (1000 / _root.FPS));
__set__speed(380);
__set__bulletCount(3);
__set__price(154400);
return;
case 5 :
__set__delay(3 * (1000 / _root.FPS));
__set__speed(380);
__set__bulletCount(3);
__set__price(300800);
}
}
function get BulletClip() {
return("Bullet");
}
function get GunClip() {
return("SingleBarrelGun");
}
function createBullets() {
switch (__get__upgradeLevel()) {
case 1 :
_root.createBullet(this, 0, 0);
return;
case 2 :
case 3 :
_root.createBullet(this, -6, 0);
_root.createBullet(this, 6, 0);
return;
case 4 :
case 5 :
_root.createBullet(this, -6, 0);
_root.createBullet(this, 0, 0);
_root.createBullet(this, 6, 0);
}
}
}
Symbol 1038 MovieClip [__Packages.RapidGun] Frame 0
class RapidGun extends Gun
{
var __set__name, __set__delay, __set__speed, __set__bulletCount, __set__price, __get__upgradeLevel;
function RapidGun () {
super();
__set__name("Rapid-Fire Gun");
}
function get description() {
return("The Rapid-Fire Gun is equipped with an advanced thrust mechanism that delivers bullets at an extremely high rate of fire. Although this comes with reduced accuracy, this is more than compensated for the resulting coverage.");
}
function get maxUpgrade() {
return(4);
}
function _upgradeTo(level) {
switch (level) {
case 1 :
__set__delay(3 * (1000 / _root.FPS));
__set__speed(300);
__set__bulletCount(1);
__set__price(10600);
return;
case 2 :
__set__delay(2.2 * (1000 / _root.FPS));
__set__speed(360);
__set__bulletCount(1);
__set__price(60000);
return;
case 3 :
__set__delay(2.2 * (1000 / _root.FPS));
__set__speed(375);
__set__bulletCount(2);
__set__price(154400);
return;
case 4 :
__set__delay(2 * (1000 / _root.FPS));
__set__speed(380);
__set__bulletCount(2);
__set__price(300800);
}
}
function get BulletClip() {
return("RapidFireBullet");
}
function get GunClip() {
return("RapidGun");
}
function createBullets() {
switch (__get__upgradeLevel()) {
case 1 :
case 2 :
_root.createBullet(this, 0, ((Math.random() * 2) - 1) * 3);
return;
case 3 :
_root.createBullet(this, -5, ((Math.random() * 2) - 1) * 3);
_root.createBullet(this, 5, ((Math.random() * 2) - 1) * 3);
return;
case 4 :
_root.createBullet(this, -5, ((Math.random() * 2) - 1) * 3);
_root.createBullet(this, 0, ((Math.random() * 2) - 1) * 3);
_root.createBullet(this, 5, ((Math.random() * 2) - 1) * 3);
}
}
}
Symbol 1039 MovieClip [__Packages.PenetrationGun] Frame 0
class PenetrationGun extends Gun
{
var __set__name, __set__delay, __set__speed, __set__damage, __set__price;
function PenetrationGun () {
super();
__set__name("Penetration Gun");
__set__delay(7 * (1000 / _root.FPS));
}
function get description() {
return("The Penetration Gun delivers highly technically advanced bullets, that refuse to even slow down on impact. As such, they not only deliver severe damage on impact, but will continue damaging anything that may come in its path.");
}
function get maxUpgrade() {
return(4);
}
function _upgradeTo(level) {
switch (level) {
case 1 :
__set__delay(14 * (1000 / _root.FPS));
__set__speed(330);
__set__damage(5.5);
__set__price(10600);
return;
case 2 :
__set__delay(10 * (1000 / _root.FPS));
__set__speed(340);
__set__damage(6);
__set__price(62900);
return;
case 3 :
__set__delay(9 * (1000 / _root.FPS));
__set__speed(350);
__set__damage(9);
__set__price(161500);
return;
case 4 :
__set__delay(8 * (1000 / _root.FPS));
__set__speed(360);
__set__damage(9);
__set__price(320000);
}
}
function get BulletClip() {
return("PenetrationBullet");
}
function get GunClip() {
return("PenetrationGun");
}
function get hitOnce() {
return(false);
}
}
Symbol 1040 MovieClip [__Packages.SprayGun] Frame 0
class SprayGun extends Gun
{
var __set__name, __set__delay, __set__speed, __set__bulletCount, __set__price, __get__upgradeLevel;
function SprayGun () {
super();
__set__name("Spray Gun");
}
function get description() {
return("The Spray Gun is able to deliver multiple bullets simultaneously, with a decent bullet-speed. It is especially useful for maintaining fire on a large area. The Spray Gun is capable of delivering up to 7 bullets simultanously.");
}
function get maxUpgrade() {
return(4);
}
function _upgradeTo(level) {
switch (level) {
case 1 :
__set__delay(9 * (1000 / _root.FPS));
__set__speed(360);
__set__bulletCount(3);
__set__price(10720);
return;
case 2 :
__set__delay(9 * (1000 / _root.FPS));
__set__speed(365);
__set__bulletCount(5);
__set__price(73730);
return;
case 3 :
__set__delay(7.7 * (1000 / _root.FPS));
__set__speed(370);
__set__bulletCount(7);
__set__price(158700);
return;
case 4 :
__set__delay(7 * (1000 / _root.FPS));
__set__speed(370);
__set__bulletCount(7);
__set__price(325400);
}
}
function get BulletClip() {
return("Bullet");
}
function get GunClip() {
var pic = __get__upgradeLevel();
if (pic < 1) {
pic = 1;
}
if (pic > 3) {
pic = 3;
}
return("SprayGun" + pic);
}
function createBullets() {
switch (__get__upgradeLevel()) {
case 4 :
case 3 :
_root.createBullet(this, -9, -12, false);
_root.createBullet(this, 9, 12, false);
case 2 :
_root.createBullet(this, -6, -8, false);
_root.createBullet(this, 6, 8, false);
case 1 :
_root.createBullet(this, 0, 0, false);
_root.createBullet(this, -3, -4, false);
_root.createBullet(this, 3, 4, false);
}
}
}
Symbol 1041 MovieClip [__Packages.ExplosiveGun] Frame 0
class ExplosiveGun extends Gun
{
var __set__name, __set__delay, __set__speed, __set__damage, __set__price;
function ExplosiveGun () {
super();
__set__name("Explosive Gun");
__set__delay(20 * (1000 / _root.FPS));
}
function get description() {
return("The Explosive Gun enables targetted delivery of missiles that yield a massive explosion that fatally damages everything within its blast radius.");
}
function isTangible() {
return(false);
}
function get maxUpgrade() {
return(4);
}
function _upgradeTo(level) {
switch (level) {
case 1 :
__set__delay(18 * (1000 / _root.FPS));
__set__speed(250);
__set__damage(2);
__set__price(10600);
return;
case 2 :
__set__delay(15 * (1000 / _root.FPS));
__set__speed(280);
__set__damage(2);
__set__price(61200);
return;
case 3 :
__set__delay(9 * (1000 / _root.FPS));
__set__speed(320);
__set__damage(2);
__set__price(154400);
return;
case 4 :
__set__delay(7 * (1000 / _root.FPS));
__set__speed(350);
__set__damage(2);
__set__price(332800);
}
}
function get BulletClip() {
return("Bullet");
}
function get GunClip() {
return("ExplosiveGun");
}
function get hitOnce() {
return(false);
}
function createBullets() {
var dx = (_xmouse - (_root.base._x + (_root.base._width / 2)));
var dy = (_ymouse - _root.base._y);
var bullet1 = _root.createBullet(this, -8, 0, true);
bullet1.destx = _xmouse;
bullet1.desty = _ymouse;
bullet1.destr = (dx * dx) + (dy * dy);
var bullet2 = _root.createBullet(this, 8, 0, true);
bullet2.destx = bullet1.destx;
bullet2.desty = bullet1.desty;
bullet2.destr = bullet1.destr;
bullet1.partner = bullet2;
bullet2.partner = bullet1;
}
function bulletFrame(bullet) {
if ((!bullet.isActive) || (!bullet.partner.isActive)) {
_root.deleteBullet(bullet);
return(undefined);
}
var dx = (bullet._x - (_root.base._x + (_root.base._width / 2)));
var dy = (bullet._y - _root.base._y);
if (((dx * dx) + (dy * dy)) >= bullet.destr) {
if (_root.soundEffects) {
_root.sndExplosion.gotoAndPlay("start");
}
var layer = _root.ExplosionLayer;
var nm = ("ex" + layer.getNextHighestDepth());
var explosion = layer.attachMovie("Explosion2", nm, layer.getNextHighestDepth());
var nm = ("exd" + layer.getNextHighestDepth());
var domain = layer.attachMovie("ExplosionDomain", nm, layer.getNextHighestDepth());
_root.defender.swapDepths(Util.defenderDepth);
explosion._rotation = random(359);
explosion._x = bullet.destx;
explosion._y = bullet.desty;
explosion.play();
domain._alpha = 0;
domain._x = bullet.destx;
domain._y = bullet.desty;
domain._xscale = 85;
domain._yscale = 85;
_root.removeBullet(bullet.partner);
_root.removeBullet(bullet);
domain.startTime = 0;
domain.play();
domain.onEnterFrame = function () {
var curTime = getTimer();
if ((curTime - this.startTime) >= 50) {
Gun.hitTestWithAll(this, 0.14, false);
this.startTime = this.startTime + 50;
if ((curTime - this.startTime) >= 50) {
this.startTime = curTime;
}
}
};
}
}
}
Symbol 1042 MovieClip [__Packages.Util] Frame 0
class Util
{
function Util () {
}
static function initLayers() {
if (_root.NukeLayer != undefined) {
} else {
_root.createEmptyMovieClip("NukeLayer", nukeDepth);
_root.createEmptyMovieClip("ExplosionLayer", explosionDepth);
}
_root.base.swapDepths(baseDepth);
_root.weaponScreen.swapDepths(weaponScreenDepth);
_root.giantShip.swapDepths(giantDepth);
var i = 1;
while (i <= 6) {
_root["chute" + i].swapDepths(chuteDepth + ((i - 1) * 2));
i++;
}
_root.nukeDomain.swapDepths(nukeDomainDepth);
_root.city.swapDepths(cityDepth);
_root.crosshair.swapDepths(mouseDepth);
_root.menuscreen.swapDepths(menuscreenDepth);
_root.menubtn.swapDepths(menuButtonDepth);
_root.weapBar.swapDepths(weaponBarDepth);
_root.endscreen.swapDepths(endScreenDepth);
}
static var depthOffset = -1024;
static var cityDepth = 2 + depthOffset;
static var nukeDepth = 4 + depthOffset;
static var giantDepth = 6 + depthOffset;
static var monsterDepth = 7 + depthOffset;
static var alienDepth = 8 + depthOffset;
static var squidDepth = 10 + depthOffset;
static var blipDepth = 11 + depthOffset;
static var mothershipDepth = 12 + depthOffset;
static var healthDepth = 13 + depthOffset;
static var chuteDepth = 14 + depthOffset;
static var bulletDepth = 26 + depthOffset;
static var defenderDepth = 28 + depthOffset;
static var baseDepth = 30 + depthOffset;
static var explosionDepth = 32 + depthOffset;
static var nukeDomainDepth = 34 + depthOffset;
static var arrow1Depth = 40 + depthOffset;
static var arrow2Depth = 42 + depthOffset;
static var bubbleDepth = 44 + depthOffset;
static var menuscreenDepth = 76 + depthOffset;
static var weaponBarDepth = 78 + depthOffset;
static var menuButtonDepth = 80 + depthOffset;
static var endScreenDepth = 82 + depthOffset;
static var mouseDepth = 100 + depthOffset;
static var weaponScreenDepth = 102 + depthOffset;
}
Symbol 1043 MovieClip [__Packages.NukeGun] Frame 0
class NukeGun extends Gun
{
var __set__name, __set__delay, __set__speed, __set__damage, __set__price;
function NukeGun () {
super();
__set__name("Nuke");
__set__delay(50 * (1000 / _root.FPS));
__set__speed(250);
__set__damage(100);
__set__price(40000);
}
function get description() {
return("A joint US-Japan research project has yielded a new and powerful technology, through which chain-reactions similar to Nuclear Fission can be kindled from not just Uranium, but any particle of their choosing. As such, the Nuke Gun is an application of this technology.");
}
function isSelectable() {
return(false);
}
function get maxUpgrade() {
return(100);
}
function get GunClip() {
return("Nuclear");
}
function get sound() {
return("sndBullet");
}
function get canFire() {
if ((_root.Nukes > 0) && (_root.weaponScreen._visible == false)) {
return(true);
}
return(false);
}
function createBullets() {
if (_root.nukeDomain._visible) {
return(undefined);
}
upgradeLevel = ((upgradeLevel-1));
if (_root._root.soundEffects) {
_root.sndPlatformHit.gotoAndPlay("start");
}
_root.nukeDomain._visible = true;
_root.endNuke++;
_root.nukeDomain.startTime = 0;
_root.nukeDomain.onEnterFrame = function () {
var curTime = getTimer();
if ((curTime - this.startTime) >= 50) {
Gun.hitTestWithAll(this, 6, true);
this.startTime = this.startTime + 50;
if ((curTime - this.startTime) >= 50) {
this.startTime = curTime;
}
}
};
_root.nukeDomain.gotoAndPlay(1);
}
function get hitOnce() {
return(false);
}
function set upgradeLevel(level) {
var i = _root.Nukes;
while (i >= level) {
var nm = ("NukeIcon" + i);
if (_root.NukeLayer[nm] != undefined) {
_root.NukeLayer[nm]._visible = false;
}
i--;
}
_root.Nukes = level;
var i = (_root.Nukes - 1);
while (i >= 0) {
var nm = ("NukeIcon" + i);
if (_root.NukeLayer[nm] == undefined) {
var nuke = _root.NukeLayer.attachMovie("NukeIcon", nm, _root.NukeLayer.getNextHighestDepth());
nuke._x = 20 + (i * (nuke._width + 5));
nuke._y = 420.3;
}
_root.NukeLayer[nm]._visible = true;
i--;
}
//return(upgradeLevel);
}
function get upgradeLevel() {
return(_root.Nukes);
}
}
Symbol 1044 MovieClip [__Packages.mochi.as2.MochiScores] Frame 0
class mochi.as2.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.as2.MochiServices.warnID(boardID, true);
mochi.as2.MochiScores.boardID = boardID;
mochi.as2.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
options.clip = mochi.as2.MochiServices.clip;
if ((options.clip != mochi.as2.MochiServices.__get__clip()) || (mochi.as2.MochiServices.__get__childClip()._target == undefined)) {
mochi.as2.MochiServices.disconnect();
trace("WARNING! This application is attempting to connect to MochiServices inside a showLeaderboard call!");
trace("make sure MochiServices.connect is called as early in the application runtime as possible.");
mochi.as2.MochiServices.connect(mochi.as2.MochiServices.__get__id(), options.clip);
}
delete options.clip;
if (options.name != null) {
if (typeof(options.name) == "object") {
if (options.name.text != undefined) {
options.name = options.name.text;
}
}
}
if (options.score != null) {
if (options.score instanceof TextField) {
if (options.score.text != undefined) {
options.score = options.score.text;
}
} else if (options.score instanceof mochi.as2.MochiDigits) {
options.score = options.score.value;
}
var n = Number(options.score);
if (isNaN(n)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'");
} else if ((n == Number.NEGATIVE_INFINITY) || (n == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(n) != n) {
trace(("WARNING: Submitted score '" + options.score) + "' will be truncated");
}
options.score = n;
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.as2.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
mochi.as2.MochiServices.__get__clip().play();
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
mochi.as2.MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
mochi.as2.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
mochi.as2.MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
score = Number(score);
if (isNaN(score)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'");
} else if ((score == Number.NEGATIVE_INFINITY) || (score == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(score) != score) {
trace(("WARNING: Submitted score '" + String(score)) + "' will be truncated");
}
score = Number(score);
}
mochi.as2.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
static function scoresArrayToObjects(scores) {
var so = {};
var i;
var j;
var o;
var row_obj;
for (var item in scores) {
if (typeof(scores[item]) == "object") {
if ((scores[item].cols != null) && (scores[item].rows != null)) {
so[item] = [];
o = scores[item];
j = 0;
while (j < o.rows.length) {
row_obj = {};
i = 0;
while (i < o.cols.length) {
row_obj[o.cols[i]] = o.rows[j][i];
i++;
}
so[item].push(row_obj);
j++;
}
} else {
so[item] = {};
for (var param in scores[item]) {
so[item][param] = scores[item][param];
}
}
} else {
so[item] = scores[item];
}
}
return(so);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 1045 MovieClip [__Packages.mochi.as2.MochiDigits] Frame 0
class mochi.as2.MochiDigits
{
var Encoder, Fragment, Sibling;
function MochiDigits (digit, index) {
Encoder = 0;
setValue(digit, index);
}
function get value() {
return(Number(toString()));
}
function set value(v) {
setValue(v);
//return(value);
}
function addValue(v) {
value = value + v;
}
function setValue(digit, index) {
var s = digit.toString();
if ((index == undefined) || (isNaN(index))) {
index = 0;
}
Fragment = s.charCodeAt(index++) ^ Encoder;
if (index < s.length) {
Sibling = new mochi.as2.MochiDigits(digit, index);
} else {
Sibling = null;
}
reencode();
}
function reencode() {
var newEncode = int(2147483647 * Math.random());
Fragment = Fragment ^ (newEncode ^ Encoder);
Encoder = newEncode;
}
function toString() {
var s = String.fromCharCode(Fragment ^ Encoder);
return(((Sibling != null) ? (s.concat(Sibling.toString())) : (s)));
}
}
Symbol 60 Button
on (release) {
gotoAndPlay (392);
}
Symbol 70 MovieClip Frame 1
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
bar._xscale = 4.2 * PercentLoaded;
} else {
gotoAndStop ("loaded");
}
Symbol 70 MovieClip Frame 2
gotoAndPlay (1);
Symbol 70 MovieClip Frame 3
_root.play();
Symbol 78 MovieClip Frame 20
this.removeMovieClip();
Symbol 86 Button
on (release) {
gotoAndPlay ("play");
}
Symbol 88 Button
on (release) {
gotoAndPlay (914);
}
Symbol 90 Button
on (release) {
gotoAndPlay (917);
}
Symbol 92 Button
on (release) {
gotoAndPlay (913);
}
Symbol 94 Button
on (release) {
var o = {n:[1, 14, 11, 10, 4, 13, 10, 7, 10, 2, 12, 6, 2, 11, 12, 12], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID});
}
Symbol 96 Button
on (release) {
getURL ("http://www.arcadetown.com/index.asp?gameid=alienparatroopers");
}
Symbol 98 Button
on (release) {
_root.getURL("http://www.arcadetown.com/free_content/index.asp", "_blank");
}
Symbol 100 Button
on (release) {
_root.getURL("http://www.arcadetown.com/alienparatroopers/download.asp", "_blank");
}
Symbol 111 MovieClip Frame 16
if (_root.menuSoundEffects == true) {
_root.sndScream.gotoAndPlay("start");
}
Symbol 111 MovieClip Frame 50
if (_root.menuSoundEffects == true) {
_root.sndAlienLaser.gotoAndPlay("start");
}
Symbol 111 MovieClip Frame 54
if (_root.menuSoundEffects == true) {
_root.sndLaserBoom.gotoAndPlay("start");
}
Symbol 115 MovieClip Frame 1
stop();
Symbol 117 MovieClip Frame 1
stop();
Symbol 140 Button
on (release) {
_root.getURL("http://www.arcadetown.com/index.asp?gameid=alienparatroopers", "_blank");
}
Symbol 142 MovieClip Frame 1
stop();
Symbol 142 MovieClip Frame 6
stop();
Symbol 143 Button
on (release) {
gotoAndPlay (394);
}
Symbol 153 Button
on (release) {
gotoAndPlay ("frmStart");
GameModes.__set__mode(GameModes.NormalMode);
}
Symbol 157 Button
on (release) {
gotoAndPlay ("frmStart");
GameModes.__set__mode(GameModes.ExplosiveMode);
}
Symbol 163 Button
on (release) {
gotoAndPlay ("frmStart");
GameModes.__set__mode(GameModes.KeyboardMode);
}
Symbol 167 Button
on (release) {
gotoAndPlay ("frmStart");
GameModes.__set__mode(GameModes.SquidMode);
}
Symbol 201 MovieClip Frame 1
stop();
Symbol 201 MovieClip Frame 61
stop();
Symbol 296 MovieClip [Mothership] Frame 1
stop();
Symbol 296 MovieClip [Mothership] Frame 16
this.removeMovieClip();
Symbol 297 Button
on (release) {
_root.sndEvolution.gotoAndPlay("stop");
_root.sndMothership.gotoAndStop("stop");
gotoAndPlay ("skip");
}
Symbol 300 MovieClip Frame 1
stop();
Symbol 334 MovieClip Frame 16
stop();
_parent.gotoAndStop("frmIdle");
Symbol 355 MovieClip Frame 15
stop();
Symbol 356 MovieClip Frame 1
stop();
Symbol 356 MovieClip Frame 2
stop();
Symbol 356 MovieClip Frame 3
stop();
Symbol 358 MovieClip Frame 1
stop();
Symbol 400 Button
on (release) {
gotoAndStop (394);
}
Symbol 408 Button
on (release) {
_root.soundEffects = true;
_root.menuscreen.soundoff.play();
prevFrame();
}
Symbol 409 MovieClip Frame 1
stop();
Symbol 409 MovieClip Frame 2
stop();
Symbol 411 Button
on (release) {
_root.soundEffects = false;
_root.menuscreen.soundon.play();
nextFrame();
}
Symbol 413 MovieClip Frame 1
stop();
Symbol 413 MovieClip Frame 2
stop();
Symbol 415 Button
on (release) {
_root.musicEnabled = true;
prevFrame();
_root.menuscreen.musicoff.play();
if (_root.gameState == _root.GS_Giant) {
_root.bossMusic.gotoAndPlay("start");
} else {
_root.music.gotoAndPlay("start");
}
_root.updateMuteButton();
}
Symbol 416 MovieClip Frame 1
stop();
Symbol 416 MovieClip Frame 2
stop();
Symbol 417 Button
on (release) {
_root.menuscreen.musicon.play();
_root.musicEnabled = false;
_root.music.gotoAndStop("stop");
_root.bossMusic.gotoAndStop("stop");
nextFrame();
_root.updateMuteButton();
}
Symbol 419 MovieClip Frame 1
stop();
Symbol 419 MovieClip Frame 2
stop();
Symbol 421 Button
on (release) {
_root._quality = "LOW";
nextFrame();
_root.menuscreen.high.gotoAndStop(2);
_root.menuscreen.med.gotoAndStop(1);
}
Symbol 423 MovieClip Frame 1
stop();
Symbol 423 MovieClip Frame 2
stop();
Symbol 425 Button
on (release) {
_root._quality = "MEDIUM";
nextFrame();
_root.menuscreen.high.gotoAndStop(2);
_root.menuscreen.low.gotoAndStop(1);
}
Symbol 427 MovieClip Frame 1
stop();
Symbol 427 MovieClip Frame 2
stop();
Symbol 430 Button
on (release) {
_root._quality = "BEST";
prevFrame();
_root.menuscreen.low.gotoAndStop(1);
_root.menuscreen.med.gotoAndStop(1);
}
Symbol 431 MovieClip Frame 1
stop();
Symbol 431 MovieClip Frame 2
stop();
Symbol 433 Button
on (release) {
_root.tutorialEnabled = true;
_root.menuscreen.tutorialoff.play();
prevFrame();
}
Symbol 434 MovieClip Frame 1
stop();
Symbol 434 MovieClip Frame 2
stop();
Symbol 435 Button
on (release) {
_root.tutorialEnabled = false;
_root.menuscreen.tutorialon.play();
nextFrame();
}
Symbol 436 MovieClip Frame 1
stop();
Symbol 436 MovieClip Frame 2
stop();
Instance of Symbol 436 MovieClip "tutorialoff" in Symbol 437 MovieClip Frame 1
/* no clip actions */
Symbol 460 Button
on (release) {
gotoAndPlay (915);
}
Symbol 472 Button
on (release) {
gotoAndPlay (914);
}
Symbol 481 Button
on (release) {
gotoAndPlay (916);
}
Symbol 492 MovieClip Frame 7
stop();
Symbol 505 MovieClip Frame 41
stop();
Symbol 506 MovieClip Frame 11
stop();
Symbol 525 MovieClip Frame 18
_parent.removeMovieClip();
Symbol 526 MovieClip [Monster] Frame 1
stop();
Symbol 526 MovieClip [Monster] Frame 2
stop();
Symbol 526 MovieClip [Monster] Frame 3
stop();
Symbol 526 MovieClip [Monster] Frame 4
stop();
Symbol 526 MovieClip [Monster] Frame 5
stop();
Symbol 531 MovieClip Frame 40
this.removeMovieClip();
Symbol 535 MovieClip Frame 7
this.removeMovieClip();
Symbol 537 MovieClip Frame 10
_parent.removeMovieClip();
Symbol 550 MovieClip Frame 24
_parent.removeMovieClip();
Symbol 551 MovieClip [AlienRight] Frame 1
stop();
Symbol 551 MovieClip [AlienRight] Frame 2
stop();
Symbol 551 MovieClip [AlienRight] Frame 3
stop();
Symbol 551 MovieClip [AlienRight] Frame 4
stop();
Symbol 551 MovieClip [AlienRight] Frame 5
stop();
Symbol 551 MovieClip [AlienRight] Frame 6
stop();
Symbol 561 Button
on (release) {
gotoAndPlay (915);
}
Symbol 567 MovieClip [BlipLeft] Frame 1
stop();
Symbol 567 MovieClip [BlipLeft] Frame 18
this.removeMovieClip();
Symbol 588 MovieClip Frame 1027
stop();
Symbol 590 Button
on (release) {
_root.getURL("http://www.midpointgames.com", "_blank");
}
Symbol 596 MovieClip Frame 7
stop();
Symbol 606 MovieClip [Platform] Frame 40
gotoAndPlay (1);
Symbol 633 MovieClip [Explosion2] Frame 26
this.removeMovieClip();
Symbol 639 MovieClip [ExplosionDomain] Frame 26
this.removeMovieClip();
Symbol 697 MovieClip [Defender] Frame 1
stop();
Symbol 697 MovieClip [Defender] Frame 21
stop();
Symbol 697 MovieClip [Defender] Frame 22
stop();
Symbol 697 MovieClip [Defender] Frame 42
stop();
Symbol 697 MovieClip [Defender] Frame 43
stop();
Symbol 697 MovieClip [Defender] Frame 63
stop();
Symbol 697 MovieClip [Defender] Frame 64
stop();
Symbol 697 MovieClip [Defender] Frame 84
stop();
Symbol 697 MovieClip [Defender] Frame 85
stop();
Symbol 697 MovieClip [Defender] Frame 105
stop();
Symbol 697 MovieClip [Defender] Frame 106
stop();
Symbol 697 MovieClip [Defender] Frame 107
stop();
Symbol 697 MovieClip [Defender] Frame 108
stop();
Symbol 697 MovieClip [Defender] Frame 128
stop();
Symbol 697 MovieClip [Defender] Frame 129
stop();
Symbol 701 MovieClip [BlipRight] Frame 1
stop();
Symbol 701 MovieClip [BlipRight] Frame 16
this.removeMovieClip();
Symbol 702 MovieClip [AlienLeft] Frame 1
stop();
Symbol 702 MovieClip [AlienLeft] Frame 2
stop();
Symbol 702 MovieClip [AlienLeft] Frame 3
stop();
Symbol 702 MovieClip [AlienLeft] Frame 4
stop();
Symbol 702 MovieClip [AlienLeft] Frame 5
stop();
Symbol 702 MovieClip [AlienLeft] Frame 6
stop();
Symbol 707 MovieClip [SquidLeft] Frame 1
stop();
Symbol 707 MovieClip [SquidLeft] Frame 2
stop();
Symbol 708 MovieClip [SquidRight] Frame 1
stop();
Symbol 708 MovieClip [SquidRight] Frame 2
stop();
Symbol 719 MovieClip Frame 30
this._visible = false;
gotoAndStop (1);
delete this.onEnterFrame;
Symbol 787 MovieClip Frame 1
stop();
Symbol 787 MovieClip Frame 6
stop();
Symbol 789 MovieClip Frame 1
stop();
Symbol 789 MovieClip Frame 5
stop();
Symbol 789 MovieClip Frame 6
stop();
Symbol 828 Button
on (release) {
if (_root.weaponScreen._visible == false) {
return(undefined);
}
_root.weaponScreen._visible = false;
_root.lastTime = getTimer();
_root.lastFPSTime = _root.lastTime;
_root.lastBulletTime = _root.lastTime;
_root.lastLevelTime = _root.lastTime;
_root.gameState = _root.GS_EndLevel;
_root.pauseEnabled = true;
_root.bulletsLayer.s.setVolume(50);
_root.menubtn.menuButton.enabled = true;
Mouse.hide();
if ((_root.weaponScreen.gun != null) && (_root.weaponScreen.btnBuy._visible)) {
_root.weaponScreen.gun.upgradeLevel--;
if (Gun.getCurrentGun().__get__upgradeLevel() == 0) {
Gun.switchGun(0);
}
}
_root.weaponScreen.gun = null;
_root.defender.gotoAndStop(_root.gun.GunClip);
_root.defender.gun.stop();
_root.firing = false;
_root.gun.lastSwitchTime = getTimer();
}
Symbol 831 Button
on (release) {
if (_root.weaponScreen._visible == false) {
return(undefined);
}
var price = _root.weaponScreen.gun.price;
var money = _root.getMoney();
if (money >= price) {
mochi.as2.MochiEvents.trackEvent(((_parent.gun.name + " ") + _parent.gun.upgradeLevel) + " Bought!", _root.level);
_root.MoneySpent = _root.MoneySpent + price;
_root.weaponScreen.redraw();
_root.weaponScreen.gun = null;
_root.weaponScreen.selectGun(Gun.__get__index());
_root.weaponBought = true;
}
}
Symbol 836 MovieClip Frame 1
function redraw() {
i = 1;
while (i <= 6) {
var gun = Gun.getGun(i - 1);
this["cat" + i].blendMode = 1;
if (gun.__get__upgradeLevel() < gun.__get__maxUpgrade()) {
gun.__set__upgradeLevel((gun.__get__upgradeLevel()+1));
p = gun.price;
gun.__set__upgradeLevel((gun.__get__upgradeLevel()-1));
var colorTrans = (new flash.geom.ColorTransform());
if (_root.getMoney() >= p) {
colorTrans.redOffset = -64;
colorTrans.blueOffset = -64;
colorTrans.greenOffset = 0;
} else {
colorTrans.redOffset = 0;
colorTrans.blueOffset = -128;
colorTrans.greenOffset = -128;
}
var trans = (new flash.geom.Transform(this["weaponSelect" + i]));
trans.colorTransform = colorTrans;
} else {
var colorTrans = (new flash.geom.ColorTransform());
colorTrans.redOffset = -64;
colorTrans.blueOffset = 0;
colorTrans.greenOffset = -64;
var trans = (new flash.geom.Transform(this["weaponSelect" + i]));
trans.colorTransform = colorTrans;
}
i++;
}
}
function selectGun(index) {
if (!this._visible) {
return(undefined);
}
txtWeaponNukes.text = _root.Nukes;
if ((gun != null) && (btnBuy._visible)) {
gun.__set__upgradeLevel((gun.__get__upgradeLevel()-1));
if (gun.__get__upgradeLevel() == 0) {
Gun.switchGun(0);
}
}
gun = Gun.getGun(index);
if (gun.__get__upgradeLevel() > 0) {
prevRate = Math.round(100000 / gun.__get__delay()) / 100;
prevSpeed = gun.speed;
prevDamage = gun.damage;
prevBullets = gun.bulletCount;
} else {
prevRate = 0;
prevSpeed = 0;
prevDamage = 0;
prevBullets = 0;
}
if (gun.__get__upgradeLevel() < gun.__get__maxUpgrade()) {
gun.__set__upgradeLevel((gun.__get__upgradeLevel()+1));
Gun.switchGun(index);
_root.defender.gun.play();
btnBuy._visible = true;
} else {
btnBuy._visible = false;
}
i = 1;
while (i <= 6) {
if (i < 6) {
this["cat" + i].gotoAndStop(Gun.getGun(i - 1).__get__GunClip());
}
if (i == (index + 1)) {
var colorTrans = (new flash.geom.ColorTransform());
colorTrans.redOffset = 0;
colorTrans.blueOffset = 0;
colorTrans.greenOffset = 0;
var trans = (new flash.geom.Transform(this["cat" + i]));
trans.colorTransform = colorTrans;
} else {
var colorTrans = (new flash.geom.ColorTransform());
colorTrans.redOffset = 96;
colorTrans.blueOffset = 96;
colorTrans.greenOffset = 96;
var trans = (new flash.geom.Transform(this["cat" + i]));
trans.colorTransform = colorTrans;
}
i++;
}
weaponDisplay.gotoAndStop(gun.__get__GunClip());
txtWeaponDesc.text = gun.description;
rate = Math.round(100000 / gun.__get__delay()) / 100;
if ((rate == prevRate) || (gun.__get__upgradeLevel() == 1)) {
txtRatePrev.text = rate;
txtRate.text = "";
colorful = new Color(txtRatePrev);
colorful.setRGB(65280);
arrowRate._visible = false;
} else {
txtRatePrev.text = prevRate;
txtRate.text = rate;
colorful = new Color(txtRatePrev);
colorful.setRGB(16711680);
arrowRate._visible = true;
}
if ((gun.__get__speed() == prevSpeed) || (gun.__get__upgradeLevel() == 1)) {
txtSpeedPrev.text = gun.speed;
txtSpeed.text = "";
colorful = new Color(txtSpeedPrev);
colorful.setRGB(65280);
arrowSpeed._visible = false;
} else {
txtSpeedPrev.text = prevSpeed;
txtSpeed.text = gun.speed;
colorful = new Color(txtSpeedPrev);
colorful.setRGB(267386880);
arrowSpeed._visible = true;
}
if ((gun.__get__bulletCount() == prevBullets) || (gun.__get__upgradeLevel() == 1)) {
txtBulletsPrev.text = gun.bulletCount;
txtBullets.text = "";
colorful = new Color(txtBulletsPrev);
colorful.setRGB(65280);
arrowBullets._visible = false;
} else {
txtBulletsPrev.text = prevBullets;
txtBullets.text = gun.bulletCount;
colorful = new Color(txtBulletsPrev);
colorful.setRGB(16711680);
arrowBullets._visible = true;
}
if ((gun.__get__damage() == prevDamage) || (gun.__get__upgradeLevel() == 1)) {
switch (gun.__get__damage()) {
case 1 :
txtDamagePrev.text = "Low";
break;
case 2 :
txtDamagePrev.text = "Med";
break;
default :
txtDamagePrev.text = "High";
}
txtDamage.text = "";
colorful = new Color(txtDamagePrev);
colorful.setRGB(65280);
arrowDamage._visible = false;
} else {
switch (gun.__get__damage()) {
case 1 :
txtDamage.text = "Low";
break;
case 2 :
txtDamage.text = "Med";
break;
default :
txtDamage.text = "High";
}
switch (prevDamage) {
case 1 :
txtDamagePrev.text = "Low";
break;
case 2 :
txtDamagePrev.text = "Med";
break;
default :
txtDamagePrev.text = "High";
}
colorful = new Color(txtDamagePrev);
colorful.setRGB(16711680);
arrowDamage._visible = true;
}
if (!gun.__get__hitOnce()) {
txtDamage.text = "";
txtDamagePrev.text = "High";
colorful = new Color(txtDamagePrev);
colorful.setRGB(65280);
}
txtPrice.text = ("$" + gun.__get__price()) + "";
txtMoney.text = ("$" + _root.getMoney()) + "";
}
mochi.as2.MochiEvents.trackEvent("Weapon Screen activated");
i = 1;
while (i <= 6) {
var gun = Gun.getGun(i - 1);
if (i < 6) {
this["cat" + i].gotoAndStop(gun.__get__GunClip());
}
this["weaponSelect" + i].i = i;
this["weaponSelect" + i].onPress = function () {
_root.weaponSelection = this.i;
selectGun(this.i - 1);
};
i++;
}
selectGun(Gun.__get__index());
stop();
var gun = null;
Instance of Symbol 697 MovieClip [Defender] "weaponDisplay" in Symbol 836 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_root.weaponScreen._visible) {
if (((getTimer() - _root.lastBulletTime) > _root.gun.delay) || (_root.shootBullet)) {
_root.shootBullet = true;
_root.lastBulletTime = getTimer();
}
if (_root.shootBullet) {
_root.shootBullet = false;
Score = _root.Score;
Gun.fireGun();
_root.Score = Score;
}
}
}
Symbol 838 MovieClip Frame 1
stop();
Symbol 919 MovieClip Frame 1
stop();
Symbol 919 MovieClip Frame 150
gotoAndPlay ("frmLaser");
Symbol 919 MovieClip Frame 171
this._y = 0;
gotoAndStop (1);
Symbol 925 MovieClip Frame 1
this.initY = this._y;
Symbol 925 MovieClip Frame 2
stop();
Symbol 925 MovieClip Frame 12
gotoAndStop ("frmStart");
Symbol 925 MovieClip Frame 14
this._visible = false;
this._y = this.initY;
gotoAndStop ("frmStart");
Symbol 927 MovieClip Frame 1
stop();
Symbol 928 MovieClip Frame 1
stop();
Symbol 930 MovieClip Frame 1
stop();
Symbol 932 MovieClip Frame 1
stop();
Symbol 934 MovieClip Frame 1
stop();
Symbol 936 MovieClip Frame 1
stop();
Symbol 938 MovieClip Frame 1
stop();
Symbol 940 MovieClip Frame 1
stop();
Symbol 946 Button
on (release) {
_root.userName = txtUser.text;
_root.submitScore();
}
Symbol 948 Button
on (release) {
_root.quitGame();
}
Symbol 989 MovieClip Frame 1
stop();
Symbol 989 MovieClip Frame 2
mochi.as2.MochiEvents.trackEvent("EndScene Activated");
_root.menubtn.menuButton.enabled = false;
_root.weapBar._visible = false;
i = 0;
while (i < 5) {
var g = Gun.getGun(i);
if (Gun.__get__index() == i) {
g.useTime = g.useTime + ((getTimer() - g.lastSwitchTime) / 1000);
}
var t = int(g.useTime);
var s = ("" + (t % 60));
if (s.length == 1) {
s = "0" + s;
}
_root[("endW" + (i + 1)) + "Upgrade"] = ((i == 0) ? (Math.max(0, g.__get__upgradeLevel() - 1)) : (g.__get__upgradeLevel()));
_root[("endW" + (i + 1)) + "Use"] = (Math.floor(t / 60) + ":") + s;
_root[("endW" + (i + 1)) + "Accuracy"] = ((g.totalBullets == 0) ? "0%" : (Math.round((100 * g.successfulBullets) / g.totalBullets) + "%"));
i++;
}
timeElapsed = (getTimer() - _root.initialTime) / 1000;
seconds = int(timeElapsed % 60);
minutes = Math.floor(timeElapsed / 60);
hours = 0;
highscore = _root.Score;
mochi.as2.MochiEvents.trackEvent("Final_Level", level);
i = 0;
while (i < 5) {
i++;
}
mochi.as2.MochiEvents.endPlay();
txtUser.onSetFocus = function (oldFocus) {
txtUser.text = "";
};
txtUser.onKillFocus = function (newFocus) {
if (txtUser.text == "") {
txtUser.text = "Your Name Here";
}
};
stop();
Symbol 993 MovieClip Frame 1
stop();
Symbol 997 MovieClip Frame 1
stop();
Symbol 997 MovieClip Frame 2
stop();
Symbol 997 MovieClip Frame 3
stop();
Symbol 1000 Button
on (release) {
_root.quitGame();
}
Symbol 1002 Button
on (release) {
_root.menuscreen._visible = false;
_root.showmenu = 0;
_root.bubble.enabled = true;
if (_root.bubble._visible == false) {
_root.resumeGame();
}
}
Symbol 1006 Button
on (release) {
if (_root.tutorialEnabled == true) {
_root.menuscreen.tutorialon.gotoAndStop(1);
_root.menuscreen.tutorialoff.gotoAndStop(1);
} else if (_root.tutorialEnabled == false) {
_root.menuscreen.tutorialon.gotoAndStop(2);
_root.menuscreen.tutorialoff.gotoAndStop(2);
}
if (_root.soundEffects == true) {
_root.menuscreen.soundon.gotoAndStop(1);
_root.menuscreen.soundoff.gotoAndStop(1);
} else if (_root.soundEffects == false) {
_root.menuscreen.soundon.gotoAndStop(2);
_root.menuscreen.soundoff.gotoAndStop(2);
}
if (_root.musicEnabled == true) {
_root.menuscreen.musicon.gotoAndStop(1);
_root.menuscreen.musicoff.gotoAndStop(1);
} else if (_root.musicEnabled == false) {
_root.menuscreen.musicon.gotoAndStop(2);
_root.menuscreen.musicoff.gotoAndStop(2);
}
if (_root._quality == "LOW") {
_root.menuscreen.low.gotoAndStop(2);
_root.menuscreen.med.gotoAndStop(1);
_root.menuscreen.high.gotoAndStop(2);
} else if (_root._quality == "MEDIUM") {
_root.menuscreen.low.gotoAndStop(1);
_root.menuscreen.med.gotoAndStop(2);
_root.menuscreen.high.gotoAndStop(2);
} else if (_root._quality == "BEST") {
_root.menuscreen.low.gotoAndStop(1);
_root.menuscreen.med.gotoAndStop(1);
_root.menuscreen.high.gotoAndStop(1);
}
if (_root.showmenu == 0) {
_root.menuscreen._visible = true;
_root.pauseGame();
_root.showmenu = 1;
_root.bubble.enabled = false;
mouse.show();
} else {
_root.menuscreen._visible = false;
_root.showmenu = 0;
_root.bubble.enabled = true;
if (_root.bubble._visible == false) {
_root.resumeGame();
}
mouse.hide();
}
}