Frame 1
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
var pv;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
pv = ((fv == 5) ? (getVersion()) : (System.capabilities.version));
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=8&fv=") + fv) + "&v=") + escape(pv)) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
stop();
_root.kongregateServices.connect();
_lockroot = true;
mochi.as2.MochiAd.showPreGameAd({id:"73afcf336adf0619", res:"500x500"});
mochi.as2.MochiServices.connect("73afcf336adf0619");
__com_mochibot__("062c5089", this, 10301, true);
Frame 2
gotoAndStop ("menu");
function hydrogenRing(num) {
rad = 0;
radInterval = (Math.PI*2) / num;
hydrogenNum = player.n;
i = 1;
while (i <= num) {
hydrogen.duplicateMovieClip("hydrogen" + hydrogenNum, hydrogenNum);
oxygen._parent["hydrogen" + hydrogenNum]._x = player._x;
oxygen._parent["hydrogen" + hydrogenNum]._y = player._y;
oxygen._parent["hydrogen" + hydrogenNum].xSpeed = player.bulletSpeed * Math.cos(rad);
oxygen._parent["hydrogen" + hydrogenNum].ySpeed = player.bulletSpeed * Math.sin(rad);
oxygen._parent["hydrogen" + hydrogenNum].num = n;
oxygen._parent["hydrogen" + hydrogenNum].angle = deg;
rad = rad + radInterval;
hydrogenNum++;
player.n++;
i++;
}
}
function calculateDeflection(i, hydrogenXSpeed, hydrogenYSpeed, type) {
oxygenXSpeed = oxygen._parent[type + i].xSpeed;
oxygenYSpeed = oxygen._parent[type + i].ySpeed;
xSpeed2 = oxygenXSpeed + hydrogenXSpeed;
ySpeed2 = oxygenYSpeed + hydrogenYSpeed;
oxygen._parent[type + i].xSpeed = xSpeed2 / 3;
oxygen._parent[type + i].ySpeed = ySpeed2 / 3;
}
function calculateSpin(i, hydrogenX, hydrogenY, type) {
xDist = oxygen._parent[type + i]._x - hydrogenX;
yDist = oxygen._parent[type + i]._y - hydrogenY;
distance = Math.sqrt((xDist * xDist) + (yDist * yDist));
oxygen._parent[type + i].rotateSpeed = distance;
}
function reflect(xSpeed, ySpeed, oxygenNum, type) {
xDist = oxygen._parent[type + oxygenNum]._x - 250;
yDist = oxygen._parent[type + oxygenNum]._y - 250;
moveSpeed = Math.sqrt((xSpeed * xSpeed) + (ySpeed * ySpeed));
distance = Math.sqrt((xDist * xDist) + (yDist * yDist));
fixDist = moveSpeed * 0.5;
rad = Math.acos(xDist / 250);
angle = (rad * 180) / Math.PI;
if (yDist < 0) {
angle = -angle;
rad = -rad;
}
if ((angle >= -67.5) and (angle < -22.5)) {
slopeRad = (Math.PI/4);
xSpeedTemp = (xSpeed * Math.cos(slopeRad)) + (ySpeed * Math.sin(slopeRad));
ySpeedTemp = (ySpeed * Math.cos(slopeRad)) - (xSpeed * Math.sin(slopeRad));
ySpeedTemp = ySpeedTemp * -1;
xSpeedTemp = xSpeedTemp * 1;
xSpeedNew = (xSpeedTemp * Math.cos(slopeRad)) - (ySpeedTemp * Math.sin(slopeRad));
ySpeedNew = (ySpeedTemp * Math.cos(slopeRad)) + (xSpeedTemp * Math.sin(slopeRad));
oxygen._parent[type + oxygenNum]._x = oxygen._parent[type + oxygenNum]._x - (fixDist * Math.cos(rad));
oxygen._parent[type + oxygenNum]._y = oxygen._parent[type + oxygenNum]._y - (fixDist * Math.sin(rad));
} else if ((angle >= -112.5) and (angle < -67.5)) {
slopeRad = 0;
ySpeedNew = -ySpeed;
xSpeedNew = xSpeed;
oxygen._parent[type + oxygenNum]._y = oxygen._parent[type + oxygenNum]._y + fixDist;
} else if ((angle >= -157.5) and (angle < -112.5)) {
slopeRad = -0.785398163397448;
xSpeedTemp = (xSpeed * Math.cos(slopeRad)) + (ySpeed * Math.sin(slopeRad));
ySpeedTemp = (ySpeed * Math.cos(slopeRad)) - (xSpeed * Math.sin(slopeRad));
ySpeedTemp = ySpeedTemp * -1;
xSpeedTemp = xSpeedTemp * 1;
xSpeedNew = (xSpeedTemp * Math.cos(slopeRad)) - (ySpeedTemp * Math.sin(slopeRad));
ySpeedNew = (ySpeedTemp * Math.cos(slopeRad)) + (xSpeedTemp * Math.sin(slopeRad));
oxygen._parent[type + oxygenNum]._x = oxygen._parent[type + oxygenNum]._x - (fixDist * Math.cos(rad));
oxygen._parent[type + oxygenNum]._y = oxygen._parent[type + oxygenNum]._y - (fixDist * Math.sin(rad));
} else if ((angle >= -22.5) and (angle < 22.5)) {
slopeRad = (Math.PI/2);
ySpeedNew = ySpeed;
xSpeedNew = -xSpeed;
oxygen._parent[type + oxygenNum]._x = oxygen._parent[type + oxygenNum]._x - fixDist;
} else if ((angle >= 22.5) and (angle < 67.5)) {
slopeRad = (Math.PI/4);
xSpeedTemp = (xSpeed * Math.cos(slopeRad)) + (ySpeed * Math.sin(slopeRad));
ySpeedTemp = (ySpeed * Math.cos(slopeRad)) - (xSpeed * Math.sin(slopeRad));
ySpeedTemp = ySpeedTemp * 1;
xSpeedTemp = xSpeedTemp * -1;
xSpeedNew = (xSpeedTemp * Math.cos(slopeRad)) - (ySpeedTemp * Math.sin(slopeRad));
ySpeedNew = (ySpeedTemp * Math.cos(slopeRad)) + (xSpeedTemp * Math.sin(slopeRad));
oxygen._parent[type + oxygenNum]._x = oxygen._parent[type + oxygenNum]._x - (fixDist * Math.cos(rad));
oxygen._parent[type + oxygenNum]._y = oxygen._parent[type + oxygenNum]._y - (fixDist * Math.sin(rad));
} else if ((angle >= 67.5) and (angle < 112.5)) {
slopeRad = 0;
xSpeedNew = xSpeed;
ySpeedNew = -ySpeed;
oxygen._parent[type + oxygenNum]._y = oxygen._parent[type + oxygenNum]._y - fixDist;
} else if ((angle >= 112.5) and (angle < 157.5)) {
slopeRad = (Math.PI/4);
xSpeedTemp = (xSpeed * Math.cos(slopeRad)) + (ySpeed * Math.sin(slopeRad));
ySpeedTemp = (ySpeed * Math.cos(slopeRad)) - (xSpeed * Math.sin(slopeRad));
ySpeedTemp = ySpeedTemp * -1;
xSpeedTemp = xSpeedTemp * 1;
xSpeedNew = (xSpeedTemp * Math.cos(slopeRad)) - (ySpeedTemp * Math.sin(slopeRad));
ySpeedNew = (ySpeedTemp * Math.cos(slopeRad)) + (xSpeedTemp * Math.sin(slopeRad));
oxygen._parent[type + oxygenNum]._x = oxygen._parent[type + oxygenNum]._x - (fixDist * Math.cos(rad));
oxygen._parent[type + oxygenNum]._y = oxygen._parent[type + oxygenNum]._y - (fixDist * Math.sin(rad));
} else {
slopeRad = (Math.PI/2);
ySpeedNew = ySpeed;
xSpeedNew = -xSpeed;
oxygen._parent[type + oxygenNum]._x = oxygen._parent[type + oxygenNum]._x + fixDist;
}
oxygen._parent[type + oxygenNum].xSpeed = xSpeedNew;
oxygen._parent[type + oxygenNum].ySpeed = ySpeedNew;
}
function playSound(soundName) {
if (_root.soundMute == false) {
sound = new Sound();
sound.attachSound(soundName);
sound.setVolume(_root.gameVolume);
sound.start(0.05, 0);
}
}
function playMusic(musicName) {
if (_root.musicMute == false) {
music = new Sound();
music.attachSound(musicName);
music.setVolume(gameVolume);
music.start(0, 100);
}
}
stop();
Mouse.hide();
Stage.showMenu = false;
gamePaused = false;
atomArray = new Array();
bossTime = false;
qualitySetting = "high";
if (_root.gameVolume == undefined) {
gameVolume = 100;
}
if (musicMute == undefined) {
musicMute = false;
}
if (soundMute == undefined) {
soundMute = false;
}
Instance of Symbol 33 MovieClip "codeClip" in Frame 2
onClipEvent (load) {
_parent.playMusic("menuMusic");
oNum = 50;
active = false;
atomNum = oNum;
i = 0;
n = 1;
while (n <= 4) {
_parent["spawn" + n].play();
n++;
}
}
onClipEvent (enterFrame) {
if (active == true) {
spawnChoice = random(4) + 1;
_parent.oxygen.duplicateMovieClip("oxygen" + i, i);
_parent["oxygen" + i]._x = _parent["spawn" + spawnChoice]._x;
_parent["oxygen" + i]._y = _parent["spawn" + spawnChoice]._y;
_parent["oxygen" + i].angle = (random(180) + 1) + ((spawnChoice - 1) * 90);
_parent["oxygen" + i].oxygenNum = i;
i++;
atomNum--;
if (atomNum <= 0) {
active = false;
n = 1;
while (n <= 4) {
_parent["spawn" + n].play();
n++;
}
}
}
}
Instance of Symbol 39 MovieClip "oxygen" in Frame 2
onClipEvent (load) {
moveSpeed = 2;
acc = 1;
rad = (angle * Math.PI) / 180;
xSpeed = moveSpeed * Math.cos(rad);
ySpeed = moveSpeed * Math.sin(rad);
rotateSpeed = 0;
}
onClipEvent (enterFrame) {
if (this._name != "oxygen") {
this._rotation = this._rotation - rotateSpeed;
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist > 240) {
_parent.reflect(xSpeed, ySpeed, oxygenNum, "oxygen");
}
}
}
Instance of Symbol 171 MovieClip "menuMC" in Frame 2
onClipEvent (load) {
this.swapDepths(500);
}
Instance of Symbol 173 MovieClip in Frame 2
onClipEvent (load) {
this.swapDepths(5000);
}
onClipEvent (enterFrame) {
this._x = _parent._xmouse;
this._y = _parent._ymouse;
}
Instance of Symbol 188 MovieClip "pauseScreen" in Frame 2
onClipEvent (load) {
function gamePause() {
this.swapDepths(5000);
if (_parent.gamePaused == false) {
if (_parent.bossTime == true) {
if (_parent.boss.charge == true) {
_parent.boss.chargeAnimation.stop();
} else if (_parent.boss.spin == true) {
_parent.boss.chargeAnimation.hitLight.stop();
}
}
this.nextFrame();
_parent.gamePaused = true;
gamePaused = true;
_parent.playSound("pause");
this._visible = true;
} else {
if (_parent.bossTime == true) {
if (_parent.boss.charge == true) {
_parent.boss.chargeAnimation.play();
} else if (_parent.boss.spin == true) {
_parent.boss.chargeAnimation.hitLight.play();
}
}
this.gotoAndStop(1);
_parent.gamePaused = false;
_parent.playSound("unpause");
this._visible = false;
}
}
this._visible = false;
}
onClipEvent (keyDown) {
if (Key.getCode() == 80) {
gamePause();
}
}
Instance of Symbol 194 MovieClip "fadeToBlack" in Frame 2
onClipEvent (load) {
this.swapDepths(6000);
}
Frame 3
stopAllSounds();
i = 0;
while (i <= 100) {
_parent["oxygen" + i].removeMovieClip();
_parent["spawn" + i].gotoAndStop(1);
i++;
}
_parent.menuMC.removeMovieClip();
gotoAndStop ("menu");
Frame 4
stop();
playMusic("gameMusic");
Instance of Symbol 207 MovieClip "rapidIndicator" in Frame 4
onClipEvent (load) {
rapidNum = 1;
}
Instance of Symbol 210 MovieClip "oxygenIndicator" in Frame 4
onClipEvent (load) {
oxygenNum = 0;
}
Instance of Symbol 39 MovieClip "oxygen" in Frame 4
onClipEvent (load) {
moveSpeed = 2;
acc = 1;
rad = (angle * Math.PI) / 180;
xSpeed = moveSpeed * Math.cos(rad);
ySpeed = moveSpeed * Math.sin(rad);
hits = 0;
rotateSpeed = 0;
collect = false;
decel = false;
exploded = false;
disappearTime = 300;
blink = false;
blinkTime = 2;
blinkTimeReset = 2;
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (this._name != "oxygen") {
if (collect == false) {
this._rotation = this._rotation - rotateSpeed;
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist > 240) {
_parent.reflect(xSpeed, ySpeed, oxygenNum, "oxygen");
}
if (this.hitTest(_parent.player.test)) {
xSpeed = xSpeed * -2;
ySpeed = ySpeed * -2;
angle = angle + 180;
decel = true;
collect = true;
hits = 2;
this.gotoAndPlay(3);
if (_parent.player.shield == false) {
_parent.playSound("hit");
_parent.background.gotoAndPlay(2);
_parent.codeClip.health = _parent.codeClip.health - 5;
} else {
_parent.playSound("shieldBreak");
_parent.player.shield = false;
_parent.player.shieldGraphic._visible = false;
}
}
} else if (decel == true) {
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist > 240) {
decel = false;
xSpeed = 0;
ySpeed = 0;
moveSpeed = 0;
}
xSpeed = xSpeed * 0.85;
ySpeed = ySpeed * 0.85;
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
moveSpeed = Math.sqrt((xSpeed * xSpeed) + (ySpeed * ySpeed));
if (moveSpeed <= 0.5) {
decel = false;
moveSpeed = 0;
}
} else {
disappearTime--;
if (disappearTime <= 0) {
_parent.atomArray[oxygenNum] = 0;
this.removeMovieClip();
} else if ((disappearTime > 45) and (disappearTime < 90)) {
blink = true;
} else if ((disappearTime > 0) and (disappearTime <= 45)) {
blinkTimeReset = 1;
}
if (blink == true) {
blinkTime--;
if (blinkTime <= 0) {
if (this._alpha == 100) {
this._alpha = 50;
} else {
this._alpha = 100;
}
blinkTime = blinkTimeReset;
}
}
playerDistX = this._x - _parent.player._x;
playerDistY = this._y - _parent.player._y;
playerDist = Math.sqrt((playerDistX * playerDistX) + (playerDistY * playerDistY));
rad = Math.acos(playerDistX / playerDist);
if (playerDistY < 0) {
rad = -rad;
}
if (playerDist < 75) {
this._x = this._x - (moveSpeed * Math.cos(rad));
this._y = this._y - (moveSpeed * Math.sin(rad));
if (moveSpeed < 15) {
moveSpeed = moveSpeed + acc;
} else {
moveSpeed = 15;
}
if (playerDist < 10) {
_parent.oxygenIndicator.oxygenNum++;
_parent.atomArray[oxygenNum] = 0;
_parent.playSound("oxygenGet");
this.removeMovieClip();
}
}
}
}
}
}
Instance of Symbol 33 MovieClip "hydrogen" in Frame 4
onClipEvent (load) {
centerDistX = 0;
centerDistY = 0;
centerDist = 0;
totalNum = (_parent.oxygenNum + _parent.nitrogenNum) + _parent.carbonNum;
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (this._name != "hydrogen") {
if (_root.gamePaused == false) {
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist >= 250) {
this.removeMovieClip();
}
i = 0;
while (i < _parent.atomArray.length) {
if (_parent.atomArray[i] == 1) {
if (_parent.bossTime == false) {
if (this.hitTest(_parent["oxygen" + i])) {
if (_parent["oxygen" + i].collect == false) {
if (_parent["oxygen" + i].hits < 1) {
_parent["oxygen" + i].nextFrame();
_parent["oxygen" + i].hits++;
_parent.calculateDeflection(i, xSpeed, ySpeed, "oxygen");
_parent.calculateSpin(i, this._x, this._y, "oxygen");
this.removeMovieClip();
} else {
_parent.calculateDeflection(i, xSpeed, ySpeed, "oxygen");
_parent["oxygen" + i].rotateSpeed = 0;
_parent["oxygen" + i].gotoAndPlay(3);
_parent["oxygen" + i].collect = true;
_parent["oxygen" + i].decel = true;
_parent.codeClip.powerUp(_parent["oxygen" + i]._x, _parent["oxygen" + i]._y);
this.removeMovieClip();
}
}
}
if (this.hitTest(_parent["nitrogen" + i])) {
if (_parent["nitrogen" + i].collect == false) {
if (_parent["nitrogen" + i].hits < 2) {
_parent["nitrogen" + i].nextFrame();
_parent["nitrogen" + i].hits++;
_parent.calculateDeflection(i, xSpeed, ySpeed, "nitrogen");
_parent.calculateSpin(i, this._x, this._y, "nitrogen");
this.removeMovieClip();
} else {
_parent.calculateDeflection(i, xSpeed, ySpeed, "nitrogen");
_parent["nitrogen" + i].rotateSpeed = 0;
_parent["nitrogen" + i].gotoAndStop(4);
_parent["nitrogen" + i].collect = true;
_parent["nitrogen" + i].decel = true;
this.removeMovieClip();
}
}
}
if (this.hitTest(_parent["carbon" + i])) {
if (_parent["carbon" + i].collect == false) {
if (_parent["carbon" + i].hits < 3) {
_parent["carbon" + i].nextFrame();
_parent["carbon" + i].hits++;
_parent.calculateDeflection(i, xSpeed, ySpeed, "carbon");
_parent.calculateSpin(i, this._x, this._y, "carbon");
this.removeMovieClip();
} else {
_parent.calculateDeflection(i, xSpeed, ySpeed, "carbon");
_parent["carbon" + i].rotateSpeed = 0;
_parent["carbon" + i].gotoAndStop(5);
_parent["carbon" + i].collect = true;
_parent["carbon" + i].decel = true;
this.removeMovieClip();
}
}
}
}
if (_parent.bossTime == true) {
if (this.hitTest(_parent["florine" + i])) {
if (_parent["florine" + i].hit == false) {
_parent.calculateDeflection(i, xSpeed * 2, ySpeed * 2, "florine");
_parent["florine" + i].rotateSpeed = 0;
_parent["florine" + i].gotoAndStop(5);
_parent["florine" + i].collect = true;
_parent["florine" + i].decel = true;
_parent["florine" + i].hit = true;
this.removeMovieClip();
}
}
}
}
i++;
}
}
}
}
}
Instance of Symbol 89 MovieClip "player" in Frame 4
onClipEvent (load) {
function reset() {
n = 200;
up = false;
down = false;
left = false;
right = false;
hSpeed = 0;
vSpeed = 0;
}
hurtTimer = 30;
hurt = false;
shield = false;
rapidFire = false;
rapidFireTimer = 150;
invincible = false;
active = true;
firingRateReset = 3;
firingRate = firingRateReset;
firing = false;
maxSpeed = 7;
acc = 0.75;
bulletSpeed = 15;
turretRad = 0;
xCoord = 0;
yCoord = 0;
centerDist = 0;
dead = false;
reset();
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (dead == false) {
if (active == true) {
if (_parent.bossTime == true) {
if (hurt == false) {
i = 1;
while (i <= 17) {
if (this.hitTest(_parent.boss.chargeAnimation.hitLight["hit" + i])) {
hurt = true;
if (shield == false) {
_parent.playSound("hit");
_parent.background.gotoAndPlay(2);
_parent.codeClip.health = _parent.codeClip.health - 5;
} else {
_parent.playSound("shieldBreak");
shield = false;
this.shieldGraphic._visible = false;
}
break;
}
i++;
}
} else {
hurtTimer--;
if (hurtTimer <= 0) {
hurt = false;
hurtTimer = 30;
}
}
}
if (rapidFire == true) {
rapidFireTimer--;
if (rapidFireTimer <= 0) {
this.rapidAnimation.gotoAndStop(1);
firingRateReset = 3;
firingRate = firingRateReset;
rapidFireTimer = 150;
rapidFire = false;
_parent.circle.powerupTimer.active = false;
_parent.circle.powerupTimer._rotation = 180;
}
}
xCoord = this._x - 250;
yCoord = this._y - 250;
centerDist = Math.sqrt((xCoord * xCoord) + (yCoord * yCoord));
angleRad = Math.acos(xCoord / centerDist);
if (yCoord < 0) {
angleRad = -angleRad;
}
angleDeg = (angleRad * 180) / Math.PI;
x = _parent._xmouse - this._x;
y = _parent._ymouse - this._y;
hyp = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
cos = x / hyp;
rad = Math.acos(cos);
deg = Math.floor(180 / (Math.PI / rad));
if (y < 0) {
deg = -deg;
rad = -rad;
}
this._rotation = deg;
this.test._rotation = -deg;
if (centerDist > 240) {
hSpeed = 0;
vSpeed = 0;
centerDist = 239;
this._x = 250 + (centerDist * Math.cos(angleRad));
this._y = 250 + (centerDist * Math.sin(angleRad));
}
this._x = this._x + hSpeed;
if (Key.isDown(39) or Key.isDown(68)) {
right = true;
if (hSpeed < maxSpeed) {
hSpeed = hSpeed + acc;
}
} else if (right == true) {
right = false;
}
if (Key.isDown(37) or Key.isDown(65)) {
left = true;
if (hSpeed > (-maxSpeed)) {
hSpeed = hSpeed - acc;
}
} else if (left == true) {
left = false;
}
if ((left == false) and (right == false)) {
if (hSpeed > 0) {
hSpeed = hSpeed - acc;
if (hSpeed < acc) {
hSpeed = 0;
}
} else if (hSpeed < 0) {
hSpeed = hSpeed + acc;
if (hSpeed > acc) {
hSpeed = 0;
}
}
}
this._y = this._y + vSpeed;
if (Key.isDown(40) or Key.isDown(83)) {
down = true;
if (vSpeed < maxSpeed) {
vSpeed = vSpeed + acc;
}
} else if (down == true) {
down = false;
}
if (Key.isDown(38) or Key.isDown(87)) {
up = true;
if (vSpeed > (-maxSpeed)) {
vSpeed = vSpeed - acc;
}
} else if (up == true) {
up = false;
}
if ((down == false) and (up == false)) {
if (vSpeed > 0) {
vSpeed = vSpeed - acc;
if (vSpeed < acc) {
vSpeed = 0;
}
} else if (vSpeed < 0) {
vSpeed = vSpeed + acc;
if (vSpeed > acc) {
vSpeed = 0;
}
}
}
if (firing == true) {
if (firingRate <= 0) {
_parent.playSound("fire");
_parent.hydrogen.duplicateMovieClip("hydrogen" + n, n);
_parent["hydrogen" + n].xSpeed = bulletSpeed * Math.cos(rad);
_parent["hydrogen" + n].ySpeed = bulletSpeed * Math.sin(rad);
_parent["hydrogen" + n]._x = this._x;
_parent["hydrogen" + n]._y = this._y;
_parent["hydrogen" + n].num = n;
_parent["hydrogen" + n].angle = deg;
n++;
firingRate = firingRateReset;
} else {
firingRate--;
}
}
}
} else {
this.gotoAndStop(2);
}
}
}
onClipEvent (mouseDown) {
if (_parent.gamePaused == false) {
if (dead == false) {
if (active == true) {
firing = true;
}
}
}
}
onClipEvent (mouseUp) {
if (_parent.gamePaused == false) {
if (dead == false) {
if (active == true) {
firing = false;
firingRate = 0;
}
}
}
}
onClipEvent (keyDown) {
if (_parent.gamePaused == false) {
if (dead == false) {
if ((Key.getCode() == 32) or (Key.getCode() == 17)) {
if (_parent.rapidIndicator.rapidNum > 0) {
if (rapidFire == false) {
_parent.playSound("rapidFire");
this.rapidAnimation.play();
rapidFire = true;
firingRateReset = 1;
_parent.rapidIndicator.rapidNum--;
_parent.circle.powerupTimer.active = true;
_parent.circle.powerupTimer._rotation = 0;
}
}
}
}
}
}
Instance of Symbol 127 MovieClip "nitrogen" in Frame 4
onClipEvent (load) {
moveSpeed = 4;
acc = 0.5;
rad = (angle * Math.PI) / 180;
xSpeed = moveSpeed * Math.cos(rad);
ySpeed = moveSpeed * Math.sin(rad);
hits = 0;
rotateSpeed = 0;
collect = false;
decel = false;
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (this._name != "nitrogen") {
if (collect == false) {
this._rotation = this._rotation - rotateSpeed;
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist > 240) {
_parent.reflect(xSpeed, ySpeed, nitrogenNum, "nitrogen");
}
if (this.hitTest(_parent.player.test)) {
xSpeed = xSpeed * -2;
ySpeed = ySpeed * -2;
angle = angle + 180;
decel = true;
hits = 3;
collect = true;
this.gotoAndStop(4);
if (_parent.player.shield == false) {
_parent.playSound("hit");
_parent.background.gotoAndPlay(2);
_parent.codeClip.health = _parent.codeClip.health - 5;
} else {
_parent.playSound("shieldBreak");
_parent.player.shield = false;
_parent.player.shieldGraphic._visible = false;
}
}
} else if (decel == true) {
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist > 240) {
decel = false;
xSpeed = 0;
ySpeed = 0;
moveSpeed = 0;
}
xSpeed = xSpeed * 0.85;
ySpeed = ySpeed * 0.85;
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
moveSpeed = Math.sqrt((xSpeed * xSpeed) + (ySpeed * ySpeed));
if (moveSpeed <= 0.5) {
this.gotoAndPlay(5);
decel = false;
moveSpeed = 0;
_parent.playSound("whoosh");
}
} else {
i = 0;
while (i < _parent.atomArray.length) {
if ((_parent["oxygen" + i].collect == true) and (_parent["oxygen" + i].decel == false)) {
xDist = this._x - _parent["oxygen" + i]._x;
yDist = this._y - _parent["oxygen" + i]._y;
distance = Math.sqrt((xDist * xDist) + (yDist * yDist));
rad = Math.acos(xDist / distance);
if (yDist < 0) {
rad = -rad;
}
if (distance < 75) {
_parent["oxygen" + i]._x = _parent["oxygen" + i]._x + (moveSpeed * Math.cos(rad));
_parent["oxygen" + i]._y = _parent["oxygen" + i]._y + (moveSpeed * Math.sin(rad));
if (moveSpeed < 10) {
moveSpeed = moveSpeed + acc;
} else {
moveSpeed = 10;
}
if (distance < 10) {
_parent["oxygen" + i].removeMovieClip();
}
}
}
i++;
}
}
}
}
}
Instance of Symbol 121 MovieClip "carbon" in Frame 4
onClipEvent (load) {
explodeSpeed = 5;
moveSpeed = 4;
acc = 0.5;
rad = (angle * Math.PI) / 180;
xSpeed = moveSpeed * Math.cos(rad);
ySpeed = moveSpeed * Math.sin(rad);
hits = 0;
rotateSpeed = 0;
collect = false;
decel = false;
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (this._name != "carbon") {
if (collect == false) {
this._rotation = this._rotation - rotateSpeed;
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist > 240) {
_parent.reflect(xSpeed, ySpeed, carbonNum, "carbon");
}
if (this.hitTest(_parent.player.test)) {
xSpeed = xSpeed * -2;
ySpeed = ySpeed * -2;
angle = angle + 180;
decel = true;
hits = 4;
collect = true;
this.gotoAndStop(5);
if (_parent.player.shield == false) {
_parent.playSound("hit");
_parent.background.gotoAndPlay(2);
_parent.codeClip.health = _parent.codeClip.health - 5;
} else {
_parent.playSound("shieldBreak");
_parent.player.shield = false;
_parent.player.shieldGraphic._visible = false;
}
}
} else if (decel == true) {
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist > 240) {
decel = false;
xSpeed = 0;
ySpeed = 0;
moveSpeed = 0;
}
xSpeed = xSpeed * 0.85;
ySpeed = ySpeed * 0.85;
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
moveSpeed = Math.sqrt((xSpeed * xSpeed) + (ySpeed * ySpeed));
if (moveSpeed <= 0.5) {
this.gotoAndPlay(6);
decel = false;
moveSpeed = 0;
_parent.playSound("explode");
}
} else {
i = 0;
while (i < _parent.atomArray.length) {
if (_parent["oxygen" + i].collect == false) {
xDist = this._x - _parent["oxygen" + i]._x;
yDist = this._y - _parent["oxygen" + i]._y;
distance = Math.sqrt((xDist * xDist) + (yDist * yDist));
rad = Math.acos(xDist / distance);
if (yDist < 0) {
rad = -rad;
}
if (distance < 75) {
if (_parent["oxygen" + i].exploded == false) {
explodeXSpeed = explodeSpeed * Math.cos(rad);
explodeYSpeed = explodeSpeed * Math.sin(rad);
_parent["oxygen" + i].xSpeed = _parent["oxygen" + i].xSpeed - explodeXSpeed;
_parent["oxygen" + i].ySpeed = _parent["oxygen" + i].ySpeed - explodeYSpeed;
_parent["oxygen" + i].exploded = true;
}
}
if ((distance > 100) and (_parent["oxygen" + i].exploded == true)) {
_parent["oxygen" + i].exploded = false;
}
}
i++;
}
}
}
}
}
Instance of Symbol 70 MovieClip "rapidFire" in Frame 4
onClipEvent (load) {
active = false;
moveSpeed = 2;
acc = 0.5;
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (active == true) {
playerDistX = this._x - _parent.player._x;
playerDistY = this._y - _parent.player._y;
playerDist = Math.sqrt((playerDistX * playerDistX) + (playerDistY * playerDistY));
rad = Math.acos(playerDistX / playerDist);
if (playerDistY < 0) {
rad = -rad;
}
if (playerDist < 75) {
this._x = this._x - (moveSpeed * Math.cos(rad));
this._y = this._y - (moveSpeed * Math.sin(rad));
if (moveSpeed < 15) {
moveSpeed = moveSpeed + acc;
} else {
moveSpeed = 15;
}
if (playerDist < 10) {
_parent.rapidIndicator.rapidNum++;
active = false;
this._x = -100;
_parent.playSound("powerupGet");
}
}
}
}
}
Instance of Symbol 74 MovieClip "shield" in Frame 4
onClipEvent (load) {
active = false;
moveSpeed = 2;
acc = 0.5;
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (active == true) {
playerDistX = this._x - _parent.player._x;
playerDistY = this._y - _parent.player._y;
playerDist = Math.sqrt((playerDistX * playerDistX) + (playerDistY * playerDistY));
rad = Math.acos(playerDistX / playerDist);
if (playerDistY < 0) {
rad = -rad;
}
if (playerDist < 75) {
this._x = this._x - (moveSpeed * Math.cos(rad));
this._y = this._y - (moveSpeed * Math.sin(rad));
if (moveSpeed < 15) {
moveSpeed = moveSpeed + acc;
} else {
moveSpeed = 15;
}
if (playerDist < 10) {
active = false;
this._x = -100;
_parent.player.shieldGraphic._visible = true;
_parent.player.shield = true;
_parent.playSound("powerupGet");
}
}
}
}
}
Instance of Symbol 78 MovieClip "health" in Frame 4
onClipEvent (load) {
active = false;
moveSpeed = 2;
acc = 0.5;
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (active == true) {
playerDistX = this._x - _parent.player._x;
playerDistY = this._y - _parent.player._y;
playerDist = Math.sqrt((playerDistX * playerDistX) + (playerDistY * playerDistY));
rad = Math.acos(playerDistX / playerDist);
if (playerDistY < 0) {
rad = -rad;
}
if (playerDist < 75) {
this._x = this._x - (moveSpeed * Math.cos(rad));
this._y = this._y - (moveSpeed * Math.sin(rad));
if (moveSpeed < 15) {
moveSpeed = moveSpeed + acc;
} else {
moveSpeed = 15;
}
if (playerDist < 10) {
this._x = -100;
_parent.codeClip.health = _parent.codeClip.health + 20;
if (_parent.codeClip.health > 100) {
_parent.codeClip.health = 100;
}
active = false;
_parent.playSound("powerupGet");
}
}
}
}
}
Instance of Symbol 214 MovieClip "bomb" in Frame 4
onClipEvent (load) {
active = false;
moveSpeed = 2;
acc = 0.5;
}
onClipEvent (enterFrame) {
if (active == true) {
playerDistX = this._x - _parent.player._x;
playerDistY = this._y - _parent.player._y;
playerDist = Math.sqrt((playerDistX * playerDistX) + (playerDistY * playerDistY));
rad = Math.acos(playerDistX / playerDist);
if (playerDistY < 0) {
rad = -rad;
}
if (playerDist < 75) {
this._x = this._x - (moveSpeed * Math.cos(rad));
this._y = this._y - (moveSpeed * Math.sin(rad));
if (moveSpeed < 15) {
moveSpeed = moveSpeed + acc;
} else {
moveSpeed = 15;
}
if (playerDist < 10) {
_parent.bombIndicator.bombNum++;
this._x = -100;
active = false;
}
}
}
}
Instance of Symbol 217 MovieClip "florine" in Frame 4
onClipEvent (load) {
moveSpeed = 6;
acc = 0.5;
rad = (angle * Math.PI) / 180;
xSpeed = moveSpeed * Math.cos(rad);
ySpeed = moveSpeed * Math.sin(rad);
hit = false;
rotateSpeed = 0;
collect = false;
decel = false;
exploded = false;
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (this._name != "florine") {
this._x = this._x + xSpeed;
this._y = this._y + ySpeed;
centerDistX = this._x - 250;
centerDistY = this._y - 250;
centerDist = Math.sqrt((centerDistX * centerDistX) + (centerDistY * centerDistY));
if (centerDist > 240) {
this.removeMovieClip();
}
if (this.hitTest(_parent.player.test)) {
if (_parent.player.shield == false) {
_parent.playSound("hit");
_parent.background.gotoAndPlay(2);
_parent.codeClip.health = _parent.codeClip.health - 5;
} else {
_parent.playSound("shieldBreak");
_parent.player.shield = false;
_parent.shieldGraphic.active = false;
_parent.shieldGraphic._x = -100;
}
_parent.atomArray[florineNum] = 0;
this.removeMovieClip();
}
if (hit == true) {
i = 1;
while (i <= 17) {
if (this.hitTest(_parent.boss.chargeAnimation.hitLight["hit" + i])) {
_parent.boss.health--;
_parent.boss.chargeAnimation.hitLight.play();
_parent.atomArray[florineNum] = 0;
this.removeMovieClip();
}
i++;
}
}
}
}
}
Instance of Symbol 33 MovieClip "codeClip" in Frame 4
onClipEvent (load) {
function powerUp(xPos, yPos) {
powerupNum = random(100) + 1;
if (powerupNum <= 3) {
do {
randomWeapon = random(30) + 1;
if (randomWeapon <= 10) {
if ((health < 30) and (_parent.health.active == false)) {
_parent.health._x = xPos;
_parent.health._y = yPos;
_parent.health.active = true;
powerupGet = true;
} else {
healthCheck = true;
}
} else if ((randomWeapon > 10) and (randomWeapon <= 20)) {
if (_parent.rapidFire.active == false) {
_parent.rapidFire._x = xPos;
_parent.rapidFire._y = yPos;
_parent.rapidFire.active = true;
powerupGet = true;
} else {
rapidCheck = true;
}
} else if ((randomWeapon > 20) and (randomWeapon <= 30)) {
if ((_parent.shield.active == false) and (_parent.player.shield == false)) {
_parent.shield._x = xPos;
_parent.shield._y = yPos;
_parent.shield.active = true;
powerupGet = true;
} else {
shieldCheck = true;
}
}
if (((healthCheck == true) and (rapidCheck == true)) and (shieldCheck == true)) {
powerupGet = true;
}
} while (powerupGet == false);
powerupGet = false;
healthCheck = false;
rapidCheck = false;
shieldCheck = false;
}
}
function nextLevel() {
if (level < 8) {
level++;
oNum = level * 10;
nNum = Math.round(level * 0.4);
cNum = Math.round(level * 0.3);
atomNum = (oNum + nNum) + cNum;
i = 0;
active = false;
_parent.circle.fill.reset(Math.round(10 + (level * 3.5)));
n = 1;
while (n <= 4) {
_parent["spawn" + n].play();
n++;
}
} else if (gotoBoss == false) {
_parent.gotoAndStop("bossStart");
gotoBoss = true;
}
}
gotoBoss = false;
healthCheck = false;
rapidCheck = false;
shieldCheck = false;
health = 100;
level = 0;
atomNum = 0;
powerupGet = false;
nextLevel();
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (health <= 0) {
_parent.player.dead = true;
}
if (active == true) {
if ((_parent.atomArray[i] == 0) or (_parent.atomArray[i] == undefined)) {
spawnChoice = random(4) + 1;
if (atomNum <= (nNum + cNum)) {
if (nNum > 0) {
_parent.nitrogen.duplicateMovieClip("nitrogen" + i, i);
_parent["nitrogen" + i]._x = _parent["spawn" + spawnChoice]._x;
_parent["nitrogen" + i]._y = _parent["spawn" + spawnChoice]._y;
_parent["nitrogen" + i].angle = (random(180) + 1) + (spawnChoice * 90);
_parent["nitrogen" + i].nitrogenNum = i;
nNum--;
} else if (cNum > 0) {
_parent.carbon.duplicateMovieClip("carbon" + i, i);
_parent["carbon" + i]._x = _parent["spawn" + spawnChoice]._x;
_parent["carbon" + i]._y = _parent["spawn" + spawnChoice]._y;
_parent["carbon" + i].angle = (random(180) + 1) + (spawnChoice * 90);
_parent["carbon" + i].carbonNum = i;
cNum--;
}
} else {
_parent.oxygen.duplicateMovieClip("oxygen" + i, i);
_parent["oxygen" + i]._x = _parent["spawn" + spawnChoice]._x;
_parent["oxygen" + i]._y = _parent["spawn" + spawnChoice]._y;
_parent["oxygen" + i].angle = (random(180) + 1) + ((spawnChoice - 1) * 90);
_parent["oxygen" + i].oxygenNum = i;
}
_parent.atomArray[i] = 1;
i++;
atomNum--;
} else {
i++;
}
if (atomNum <= 0) {
active = false;
n = 1;
while (n <= 4) {
_parent["spawn" + n].play();
n++;
}
}
}
}
}
Frame 6
stopAllSounds();
stop();
circle.stageNum._visible = false;
playMusic("bossMusic");
health._x = 250;
health._y = 250;
health.active = true;
Frame 7
bossTime = true;
circle.fill.active = true;
i = 0;
while (i <= 500) {
if (atomArray[i] == 1) {
boss._parent["oxygen" + i].removeMovieClip();
boss._parent["nitrogen" + i].removeMovieClip();
boss._parent["carbon" + i].removeMovieClip();
atomArray[i] = 0;
}
i++;
}
Instance of Symbol 242 MovieClip "boss" in Frame 7
onClipEvent (load) {
function attackChoice() {
do {
attackNum = random(40) + 1;
if (health < 25) {
attackNum = 1;
fireWait = false;
if (fireAtoms == true) {
fireAtoms = false;
}
}
if (attackNum <= 15) {
if (fireWait == false) {
fireAtoms = true;
fireWait = true;
rotateWait = false;
chargeWait = false;
spinWait = false;
attackChosen = true;
}
} else if ((attackNum > 15) and (attackNum <= 22)) {
if (chargeWait == false) {
charge = true;
fireWait = false;
rotateWait = false;
chargeWait = true;
spinWait = false;
attackChosen = true;
}
} else if ((attackNum > 22) and (attackNum <= 32)) {
if (rotateWait == false) {
rotate = true;
rotateWait = true;
chargeWait = false;
spinWait = false;
rotateDirection = random(10) + 1;
if (rotateDirection <= 5) {
rotateSpeed = rotateSpeed * -1;
}
attackChosen = true;
}
} else if (attackNum > 32) {
if (spinWait == false) {
spin = true;
fireWait = false;
rotateWait = false;
chargeWait = false;
spinWait = true;
attackChosen = true;
}
}
} while (attackChosen == false);
attackChosen = false;
}
doOnce = false;
active = true;
rotate = false;
fireAtoms = false;
charge = false;
pause = true;
pauseTimer = 20;
pauseTimerReset = 20;
i = 1;
atomFireReset = 40;
currentAngle = -90;
currentRad = (currentAngle * Math.PI) / 180;
health = 150;
rotateSpeed = 2;
rotateAmount = 90 + random(90);
rotateWait = false;
attackChosen = false;
fireWait = false;
spinWait = false;
n = 0;
while (n <= 400) {
_parent.atomArray[n] = 0;
n++;
}
}
onClipEvent (enterFrame) {
if (_parent.gamePaused == false) {
if (health <= 0) {
this.gotoAndStop(3);
active = false;
rotate = false;
fireAtoms = false;
charge = false;
i = 1;
while (i <= 100) {
_parent["florine" + i].removeMovieClip();
i++;
}
}
if (charge == true) {
this.gotoAndStop(1);
this.chargeAnimation.play();
}
if (pause == true) {
pauseTimer--;
if (pauseTimer <= 0) {
pauseTimer = pauseTimerReset;
pause = false;
attackChoice();
}
}
if ((health < 25) and (health > 0)) {
if (doOnce == false) {
fireAtoms = false;
atomFire = 20;
i = 1;
pause = true;
doOnce = true;
}
rotate = true;
rotateAmount = 100;
rotateSpeed = 3;
pauseTimerReset = 90;
}
if (rotate == true) {
if (rotateAmount > 0) {
rotateAmount = rotateAmount - Math.abs(rotateSpeed);
this._rotation = this._rotation + rotateSpeed;
currentAngle = currentAngle + rotateSpeed;
currentRad = (currentAngle * Math.PI) / 180;
} else {
if (health < 100) {
rotateAmount = 180 + random(180);
rotateSpeed = 3;
} else {
rotateAmount = 90 + random(90);
}
rotate = false;
pause = true;
}
}
if (fireAtoms == true) {
if (i < atomFire) {
_parent.playSound("bossFire");
_parent.florine.duplicateMovieClip("florine" + i, i);
_parent["florine" + i]._x = this._x + (130 * Math.cos(currentRad));
_parent["florine" + i]._y = this._y + (130 * Math.sin(currentRad));
_parent["florine" + i].angle = currentAngle - (135 + random(90));
_parent["florine" + i].florineNum = i;
_parent.atomArray[i] = 1;
i++;
} else {
if (health < 25) {
atomFire = 20;
} else if ((health >= 30) and (health < 60)) {
atomFire = 80;
} else if ((health >= 60) and (health < 90)) {
atomFire = 60;
} else if ((health >= 90) and (health < 120)) {
atomFire = 50;
} else {
atomFire = 40;
}
fireAtoms = false;
i = 1;
pause = true;
}
}
if (spin == true) {
this.gotoAndStop(2);
this.chargeAnimation.hitLight.play();
}
}
}
Frame 8
_root.HPScoreService.postScore(tally.totalScore);
ScoreAPI = new LocalConnection();
ScoreAPI.send(_root.com_mindjolt_api, "submitScore", tally.totalScore);
_root.kongregateScores.submit(tally.totalScore);
Instance of Symbol 257 MovieClip "tally" in Frame 8
onClipEvent (load) {
oxygenTally = false;
rapidTally = false;
healthTally = false;
oxygenNum = _parent.oxygenIndicator.oxygenNum;
rapidNum = _parent.rapidIndicator.rapidNum;
health = _parent.codeClip.health;
totalScore = 0;
}
onClipEvent (enterFrame) {
if (oxygenTally == true) {
if (oxygenNum > 0) {
totalScore++;
oxygenNum--;
_parent.playSound("pointSound");
} else {
oxygenTally = false;
this.play();
}
}
if (healthTally == true) {
if (health > 0) {
totalScore++;
health--;
_parent.playSound("pointSound");
} else {
healthTally = false;
this.play();
}
}
if (rapidTally == true) {
if (rapidNum > 0) {
rapidNum--;
totalScore = totalScore + 10;
_parent.playSound("pointSound");
} else {
rapidTally = false;
this.play();
}
}
}
onClipEvent (mouseDown) {
if (oxygenTally == true) {
totalScore = totalScore + oxygenNum;
oxygenNum = 0;
oxygenTally = false;
healthTally = true;
this.play();
} else if (healthTally == true) {
totalScore = totalScore + health;
health = 0;
healthTally = false;
rapidTally = true;
this.play();
} else if (rapidTally == true) {
totalScore = totalScore + (rapidNum * 10);
rapidNum = 0;
rapidTally = false;
this.play();
}
}
Frame 9
stopAllSounds();
gotoAndStop ("menu");
Symbol 260 MovieClip [__Packages.mochi.as2.MochiAd] Frame 0
class mochi.as2.MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("3.0 as2");
}
static function showPreGameAd(options) {
var _local26 = {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, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = 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 _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
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 _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.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 _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local2});
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local9 = {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, _local9);
var clip = options.clip;
var _local8 = 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 _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
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 _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {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, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = 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 _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.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 _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
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 _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local7 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local7._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local7.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local7._mochiad_loaded = true;
if (_local7._url.indexOf("http") != 0) {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
}
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.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 _local5 = new LocalConnection();
var _local9 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local9;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local9);
_local6.lc = _local5;
_local4.lc = _local9;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
if (clip._mochiad._containerLCName != undefined) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local3);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
}
Symbol 261 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _loader, _loaderListener, _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.0");
}
static function allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function get isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.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) {
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 _local3 = "_mochiservices_com_" + id;
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servicesURL != undefined) {
_servicesURL = urlOptions().servicesURL;
}
allowDomains(_servicesURL);
_clip = clip.createEmptyMovieClip(_local3, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, [errorCode]);
};
_loaderListener.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_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), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
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, clip:_clip, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _listenChannel._callbacks[_local1.callbackID];
}
delete _listenChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.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)) {
onError.apply(null, ["NotConnected"]);
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 _local5 = {};
if (_root.mochiad_options) {
var _local4 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
_local5[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local5);
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var _local2 = new Object();
_local2.mav = getVersion();
_local2.swfv = btn.getSWFVersion() || 6;
_local2.swfurl = btn._url;
_local2.fv = System.capabilities.version;
_local2.os = System.capabilities.os;
_local2.lang = System.capabilities.language;
_local2.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var _local3 = 0;
for (var _local6 in _local2) {
if (_local3 != 0) {
s = s + "&";
}
_local3++;
s = ((s + _local6) + "=") + escape(_local2[_local6]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var _local7 = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://x.mochiads.com/linkping.swf?t=" + getTimer());
_local7.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 _local4 = btn.createEmptyMovieClip("clk", 1001);
_local4._alpha = 0;
_local4.beginFill(1044735);
_local4.moveTo(0, 0);
_local4.lineTo(0, btn._height);
_local4.lineTo(btn._width, btn._height);
_local4.lineTo(btn._width, 0);
_local4.lineTo(0, 0);
_local4.endFill();
_local4.onRelease = function () {
if (mochi.as2.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static var _servicesURL = "http://www.mochiads.com/static/lib/services/services.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
}
Symbol 262 MovieClip [__Packages.mochi.as2.MochiScores] Frame 0
class mochi.as2.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.as2.MochiScores.boardID = boardID;
mochi.as2.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
if ((options.clip == null) || (options.clip == undefined)) {
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();
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 _local1 = Number(options.score);
if (isNaN(_local1)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'");
} else if ((_local1 == Number.NEGATIVE_INFINITY) || (_local1 == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(_local1) != _local1) {
trace(("WARNING: Submitted score '" + options.score) + "' will be truncated");
}
options.score = _local1;
}
}
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;
}
}
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 _local5 = {};
var _local1;
var _local4;
var _local2;
var _local6;
for (var _local8 in scores) {
if (typeof(scores[_local8]) == "object") {
if ((scores[_local8].cols != null) && (scores[_local8].rows != null)) {
_local5[_local8] = [];
_local2 = scores[_local8];
_local4 = 0;
while (_local4 < _local2.rows.length) {
_local6 = {};
_local1 = 0;
while (_local1 < _local2.cols.length) {
_local6[_local2.cols[_local1]] = _local2.rows[_local4][_local1];
_local1++;
}
_local5[_local8].push(_local6);
_local4++;
}
} else {
_local5[_local8] = {};
for (var _local7 in scores[_local8]) {
_local5[_local8][_local7] = scores[_local8][_local7];
}
}
} else {
_local5[_local8] = scores[_local8];
}
}
return(_local5);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 263 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 _local3 = digit.toString();
if ((index == undefined) || (isNaN(index))) {
index = 0;
}
Fragment = _local3.charCodeAt(index++) ^ Encoder;
if (index < _local3.length) {
Sibling = new mochi.as2.MochiDigits(digit, index);
} else {
Sibling = null;
}
reencode();
}
function reencode() {
var _local2 = int(2147483647 * Math.random());
Fragment = Fragment ^ (_local2 ^ Encoder);
Encoder = _local2;
}
function toString() {
var _local2 = String.fromCharCode(Fragment ^ Encoder);
return(((Sibling != null) ? (_local2.concat(Sibling.toString())) : (_local2)));
}
}
Symbol 26 MovieClip Frame 1
stop();
Symbol 26 MovieClip Frame 20
gotoAndStop (1);
Symbol 31 MovieClip Frame 1
stop();
Symbol 31 MovieClip Frame 18
stop();
_parent.codeClip.active = true;
Symbol 31 MovieClip Frame 34
gotoAndStop (1);
Symbol 39 MovieClip Frame 1
stop();
Symbol 39 MovieClip Frame 2
stop();
Symbol 39 MovieClip Frame 3
play();
Symbol 39 MovieClip Frame 10
stop();
Symbol 48 Button
on (release) {
gotoAndStop ("credits");
}
Symbol 53 Button
on (release) {
nextFrame();
}
Symbol 58 Button
on (release) {
gotoAndStop ("options");
}
Symbol 63 Button
on (release) {
i = 0;
while (i <= 100) {
_parent["oxygen" + i].removeMovieClip();
_parent["spawn" + i].gotoAndStop(1);
i++;
}
Mouse.show();
var o = {n:[1, 11, 8, 0, 9, 10, 15, 13, 10, 7, 6, 3, 10, 3, 15, 0], 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});
_parent.menuMC.removeMovieClip();
}
Instance of Symbol 68 MovieClip in Symbol 70 MovieClip Frame 1
onClipEvent (enterFrame) {
this._rotation = this._rotation + 3;
}
Instance of Symbol 72 MovieClip in Symbol 74 MovieClip Frame 1
onClipEvent (enterFrame) {
this._rotation = this._rotation + 3;
}
Instance of Symbol 76 MovieClip in Symbol 78 MovieClip Frame 1
onClipEvent (enterFrame) {
this._rotation = this._rotation + 3;
}
Symbol 86 MovieClip Frame 1
stop();
Instance of Symbol 85 MovieClip in Symbol 86 MovieClip Frame 7
onClipEvent (enterFrame) {
this._rotation = this._rotation + 2;
}
Instance of Symbol 85 MovieClip in Symbol 86 MovieClip Frame 7
onClipEvent (enterFrame) {
this._rotation = this._rotation + 2;
}
Instance of Symbol 85 MovieClip in Symbol 86 MovieClip Frame 7
onClipEvent (enterFrame) {
this._rotation = this._rotation + 2;
}
Symbol 86 MovieClip Frame 11
stop();
Symbol 88 MovieClip Frame 30
stop();
_parent._parent.fadeToBlack.play();
Symbol 89 MovieClip Frame 1
stop();
Instance of Symbol 83 MovieClip "shieldGraphic" in Symbol 89 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 89 MovieClip Frame 2
_parent.playSound("playerDie");
Instance of Symbol 88 MovieClip in Symbol 89 MovieClip Frame 2
onClipEvent (enterFrame) {
this._rotation = this._rotation + 3;
}
Symbol 101 MovieClip Frame 1
stop();
Symbol 101 MovieClip Frame 15
gotoAndStop (1);
Symbol 113 Button
on (release) {
nextFrame();
}
Symbol 121 MovieClip Frame 1
stop();
Symbol 121 MovieClip Frame 37
_parent.atomArray[carbonNum] = 0;
this.removeMovieClip();
Symbol 127 MovieClip Frame 1
stop();
Symbol 127 MovieClip Frame 36
_parent.atomArray[nitrogenNum] = 0;
this.removeMovieClip();
Symbol 144 Button
on (release) {
stopAllSounds();
i = 0;
while (i <= 100) {
_parent["oxygen" + i].removeMovieClip();
_parent["spawn" + i].gotoAndStop(1);
i++;
}
_parent.gotoAndStop("game");
_parent.menuMC.removeMovieClip();
}
Symbol 150 MovieClip Frame 1
stop();
_root.musicMute = false;
Symbol 150 MovieClip Frame 2
_root.musicMute = true;
Symbol 151 MovieClip Frame 1
stop();
_root.soundMute = false;
Symbol 151 MovieClip Frame 2
_root.soundMute = true;
Instance of Symbol 159 MovieClip in Symbol 160 MovieClip Frame 1
onClipEvent (load) {
if (_parent._parent._parent.qualitySetting == "high") {
this._x = 125;
} else if (_parent._parent._parent.qualitySetting == "low") {
this._x = -125;
} else if (_parent._parent._parent.qualitySetting == "medium") {
this._x = 0;
}
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag(false, -125, 0, 125, 0);
}
}
onClipEvent (mouseUp) {
this.stopDrag();
if (this._x < -50) {
this._x = -125;
_parent._parent._parent._quality = "low";
_parent._parent._parent.qualitySetting = "low";
} else if (this._x > 50) {
this._x = 125;
_parent._parent._parent._quality = "high";
_parent._parent._parent.qualitySetting = "high";
} else {
this._x = 0;
_parent._parent._parent._quality = "medium";
_parent._parent._parent.qualitySetting = "medium";
}
}
Instance of Symbol 159 MovieClip "slider" in Symbol 163 MovieClip Frame 1
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag(false, 0, 0, 200, 0);
}
}
onClipEvent (mouseUp) {
this.stopDrag();
}
Symbol 168 Button
on (release) {
gotoAndStop (1);
}
Symbol 171 MovieClip Frame 1
stop();
Instance of Symbol 101 MovieClip in Symbol 171 MovieClip Frame 2
onClipEvent (enterFrame) {
this.play();
}
Instance of Symbol 150 MovieClip in Symbol 171 MovieClip Frame 4
onClipEvent (load) {
if (_parent._parent.musicMute == true) {
this.gotoAndStop(2);
}
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
if (_parent._parent.musicMute == false) {
this.nextFrame();
stopAllSounds();
} else {
this.prevFrame();
_parent._parent.musicMute = false;
_parent._parent.playMusic("menuMusic");
}
}
}
Instance of Symbol 151 MovieClip in Symbol 171 MovieClip Frame 4
onClipEvent (load) {
if (_parent._parent.soundMute == true) {
this.gotoAndStop(2);
}
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
if (_parent._parent.soundMute == false) {
this.nextFrame();
} else {
this.prevFrame();
}
}
}
Instance of Symbol 163 MovieClip in Symbol 171 MovieClip Frame 4
onClipEvent (load) {
if (_parent._parent.gameVolume >= 0) {
this.slider._x = _parent._parent.gameVolume * 2;
}
}
onClipEvent (enterFrame) {
_parent._parent.gameVolume = Math.ceil(this.slider._x / 2);
_parent._parent.sound.setVolume(_parent._parent.gameVolume);
}
Symbol 177 Button
on (release) {
nextFrame();
}
Symbol 180 Button
on (release) {
_parent.pauseScreen.gamePause();
}
Symbol 185 Button
on (release) {
stopAllSounds();
_parent.gotoAndStop("menu");
i = 1;
while (i <= 1500) {
_parent["oxygen" + i].removeMovieClip();
_parent["nitrogen" + i].removeMovieClip();
_parent["carbon" + i].removeMovieClip();
_parent["florine" + i].removeMovieClip();
_parent["hydrogen" + i].removeMovieClip();
i++;
}
_parent.pauseScreen.removeMovieClip();
}
Symbol 187 Button
on (release) {
prevFrame();
}
Symbol 188 MovieClip Frame 1
stop();
Symbol 188 MovieClip Frame 2
stop();
Instance of Symbol 150 MovieClip in Symbol 188 MovieClip Frame 2
onClipEvent (load) {
if (_parent._parent.musicMute == true) {
this.gotoAndStop(2);
}
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
if (_parent._parent.musicMute == false) {
this.nextFrame();
stopAllSounds();
} else {
this.prevFrame();
_parent._parent.musicMute = false;
if (_parent._parent.bossTime == false) {
_parent._parent.playMusic("gameMusic");
} else {
_parent._parent.playMusic("bossMusic");
}
}
}
}
Instance of Symbol 151 MovieClip in Symbol 188 MovieClip Frame 2
onClipEvent (load) {
if (_parent._parent.soundMute == true) {
this.gotoAndStop(2);
}
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
if (_parent._parent.soundMute == false) {
this.nextFrame();
} else {
this.prevFrame();
}
}
}
Instance of Symbol 163 MovieClip in Symbol 188 MovieClip Frame 2
onClipEvent (load) {
if (_root.gameVolume >= 0) {
this.slider._x = _root.gameVolume * 2;
}
}
onClipEvent (enterFrame) {
_parent._parent.gameVolume = Math.ceil(this.slider._x / 2);
_parent._parent.sound.setVolume(_root.gameVolume);
}
Symbol 191 Button
on (release) {
_root.pauseScreen.gamePause();
}
Symbol 194 MovieClip Frame 1
stop();
Symbol 194 MovieClip Frame 60
stopAllSounds();
_parent.gamePaused = true;
Symbol 194 MovieClip Frame 111
i = 1;
while (i <= 1000) {
_parent["oxygen" + i].removeMovieClip();
_parent["nitrogen" + i].removeMovieClip();
_parent["carbon" + i].removeMovieClip();
_parent["florine" + i].removeMovieClip();
_parent["hydrogen" + i].removeMovieClip();
i++;
}
_parent.gamePaused = false;
_parent.gotoAndStop("menu");
Instance of Symbol 29 MovieClip "fill" in Symbol 204 MovieClip Frame 1
onClipEvent (load) {
function reset(timeSeconds) {
active = true;
this._xscale = 100;
this._yscale = 100;
timeFrames = timeSeconds * 30;
shrink = 100 / timeFrames;
grow = false;
}
reset();
gameVolume = _parent._parent.gameVolume;
}
onClipEvent (enterFrame) {
if (_parent._parent.gamePaused == false) {
if (active == true) {
if (_parent._parent.bossTime == false) {
if (grow == false) {
this._xscale = this._xscale - shrink;
this._yscale = this._yscale - shrink;
if (this._xscale <= 0) {
grow = true;
_parent._parent.playSound("fill");
}
} else {
this._xscale = this._xscale + 5;
this._yscale = this._yscale + 5;
if (this._xscale >= 100) {
active = false;
_parent._parent.codeClip.nextLevel();
}
}
} else {
this._xscale = (_parent._parent.boss.health / 150) * 100;
this._yscale = (_parent._parent.boss.health / 150) * 100;
}
}
}
}
Instance of Symbol 197 MovieClip "powerupTimer" in Symbol 204 MovieClip Frame 1
onClipEvent (load) {
active = false;
this._rotation = 180;
}
onClipEvent (enterFrame) {
if (_parent._parent.gamePaused == false) {
if (active == true) {
this._rotation = this._rotation - 1.2;
}
}
}
Instance of Symbol 197 MovieClip in Symbol 204 MovieClip Frame 1
onClipEvent (enterFrame) {
this._rotation = (180 - (_parent._parent.codeClip.health * 1.8)) + 180;
}
Instance of Symbol 212 MovieClip in Symbol 214 MovieClip Frame 1
onClipEvent (enterFrame) {
this._rotation = this._rotation + 3;
}
Symbol 217 MovieClip Frame 1
stop();
Symbol 220 MovieClip Frame 185
_parent.nextFrame();
Symbol 223 MovieClip Frame 1
stop();
trace("blub");
Symbol 223 MovieClip Frame 2
_parent._parent._parent.playSound("bossHit");
Symbol 223 MovieClip Frame 3
gotoAndStop (1);
Symbol 224 MovieClip Frame 1
stop();
Symbol 224 MovieClip Frame 28
_parent._parent.playSound("chargeSound");
Symbol 224 MovieClip Frame 67
_parent.charge = false;
_parent.pause = true;
gotoAndStop (1);
Symbol 228 MovieClip Frame 30
_parent._parent._parent.playSound("bigWhoosh");
Symbol 228 MovieClip Frame 128
_parent._parent.spin = false;
_parent._parent.pause = true;
_parent._parent.gotoAndStop(1);
Symbol 229 MovieClip Frame 1
stop();
Symbol 241 MovieClip Frame 6
_parent._parent.playSound("flash");
Symbol 241 MovieClip Frame 10
_parent._parent.playSound("flash");
Symbol 241 MovieClip Frame 41
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 48
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 54
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 61
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 69
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 77
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 95
_parent._parent.playSound("explode");
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 101
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 104
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 107
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 110
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 113
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 116
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 119
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 122
_parent._parent.playSound("explode");
Symbol 241 MovieClip Frame 130
_parent._parent.playSound("bossExplode");
Symbol 241 MovieClip Frame 224
_parent._parent.nextFrame();
Symbol 242 MovieClip Frame 1
stop();
Symbol 242 MovieClip Frame 2
stop();
Symbol 253 Button
on (release) {
Mouse.show();
var o = {n:[1, 11, 8, 0, 9, 10, 15, 13, 10, 7, 6, 3, 10, 3, 15, 0], 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:_parent.tally.totalScore});
}
Symbol 256 Button
on (release) {
stopAllSounds();
_parent.gotoAndStop("menu");
}
Symbol 257 MovieClip Frame 1
Symbol 257 MovieClip Frame 9
stop();
oxygenTally = true;
Symbol 257 MovieClip Frame 19
stop();
healthTally = true;
Symbol 257 MovieClip Frame 29
stop();
rapidTally = true;
Symbol 257 MovieClip Frame 37
stop();