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;
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);
}
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(getVersion())) + "&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);
}
__com_mochibot__("4bcf6b3f", this, 10301, true);
function init() {
GoToJumbled.onPress = function () {
getURL ("http://www.jumbledmind.com", "_blank");
};
_root.kongregateServices.connect();
}
init();
Frame 2
function init() {
databaseScriptsHome = "";
databaseScriptsHome = "http://jumbledmind.com/stardefensesquad/";
_root.licensed = false;
fps = 45;
INVERSE_FPS = 1 / fps;
urlStart = _url.indexOf("://") + 3;
urlEnd = _url.indexOf("/", urlStart);
domain = _url.substring(urlStart, urlEnd);
GameBuild = true;
_root.licensed = true;
}
init();
Frame 4
function init() {
MochiAd.showPreGameAd({id:"2972325a4f038aa7", res:"640x640"});
}
init();
Frame 5
function replayGame() {
_root.gotoAndStop("Replay");
}
function postScore() {
hidePostScoreMenu();
displayPlayAgainMenu();
userData = new LoadVars();
userData.submittedScore = score;
userData.submittedName = postScoreMenu.submittedName;
userData.submittedName = userData.submittedName.substring(0, 23);
userData.mainShip = mainShipToString(mainShip);
userData.probes1to10 = probesToString(0, 10);
userData.probes11to20 = probesToString(10, 10);
userData.probes21to30 = probesToString(20, 10);
userData.probes31to40 = probesToString(30, 10);
userData.onLoad = function (ok) {
if (ok == true) {
displayResultPostMenu("Submitted Successfully!");
} else {
displayResultPostMenu("Error submitting. Sorry!");
}
};
userData.sendAndLoad(databaseScriptsHome + "SaveScore.php", userData, POST);
}
function probesToString(startValue, num) {
endValue = startValue + num;
string = "";
ptsi = startValue;
while (ptsi < endValue) {
if (probes.objects[ptsi] != -1) {
string = string + ("p:" + getProbeName(probes.objects[ptsi].probeType));
string = string + ("," + int(probes.objects[ptsi].origX));
string = string + ("," + int(probes.objects[ptsi].origY));
string = string + ("," + probes.objects[ptsi].upgradeLevel);
string = string + ("," + probes.objects[ptsi].onHit1Level);
string = string + ("," + probes.objects[ptsi].onHit2Level);
string = string + ("," + probes.objects[ptsi].onHit3Level);
string = string + ("," + probes.objects[ptsi].killCount);
string = string + "/";
}
ptsi++;
}
return(string);
}
function mainShipToString(ship) {
string = "";
string = string + "p:mainship";
string = string + ("," + int(ship._x));
string = string + ("," + int(ship._y));
string = string + ("," + ship.upgradeLevel);
string = string + ("," + ship.onHit1Level);
string = string + ("," + ship.onHit2Level);
string = string + ("," + ship.onHit3Level);
string = string + ("," + ship.killCount);
return(string);
}
function getProbeName(probeType) {
if (probeType == REPULSOR_PROBE) {
return("repulsor");
}
if (probeType == ROCKET_PROBE) {
return("rocket");
}
if (probeType == BOMB_PROBE) {
return("bomb");
}
if (probeType == PB_PROBE) {
return("pb");
}
if (probeType == STASIS_PROBE) {
return("stasis");
}
if (probeType == DECOY_PROBE) {
return("decoy");
}
if (probeType == BATTERY_PROBE) {
return("battery");
}
if (probeType == WALL_PROBE) {
return("wall");
}
}
function cancelPost() {
hidePostScoreMenu();
displayPlayAgainMenu();
}
Frame 7
function initSounds() {
initPBProbeSounds();
initRocketProbeSounds();
initRepulsorProbeSounds();
initStasisProbeSounds();
initBatteryProbeSounds();
initStasisEffectSounds();
initLinkStationSounds();
initDialogSounds();
initLaserBeamSounds();
initToggleSounds();
initHeartDeathSounds();
initRepulsorBurstSounds();
initProbeHitSounds();
initAsteroidDeathSounds();
initExplosionSounds();
initHeatBurstSounds();
}
function initPBProbeSounds() {
pbProbeSounds = new Sound();
pbProbeSounds.attachSound("PBSound");
}
function playPBProbeSound() {
if (soundOn == true) {
pbProbeSounds.start();
}
}
function initRocketProbeSounds() {
rocketProbeSounds = new Sound();
rocketProbeSounds.attachSound("RocketSound");
}
function playRocketProbeSound() {
if (soundOn == true) {
rocketProbeSounds.start();
}
}
function initRepulsorProbeSounds() {
repulsorProbeSounds = new Sound();
repulsorProbeSounds.attachSound("RepulsorSound");
}
function playRepulsorProbeSound() {
if (soundOn == true) {
repulsorProbeSounds.start();
}
}
function initStasisProbeSounds() {
stasisProbeSounds = new Sound();
stasisProbeSounds.attachSound("StasisSound");
}
function playStasisProbeSound() {
if (soundOn == true) {
stasisProbeSounds.start();
}
}
function initBatteryProbeSounds() {
batteryProbeSounds = new Sound();
batteryProbeSounds.attachSound("BatterySound");
}
function playBatteryProbeSound() {
if (soundOn == true) {
batteryProbeSounds.start();
}
}
function initStasisEffectSounds() {
stasisEffectSounds = new Sound();
stasisEffectSounds.attachSound("StasisEffectSound");
}
function playStasisEffectSound() {
if (soundOn == true) {
stasisEffectSounds.start();
}
}
function initLinkStationSounds() {
linkStationSounds = new Sound();
linkStationSounds.attachSound("LinkStationSound");
}
function playLinkStationSound() {
if (soundOn == true) {
linkStationSounds.start();
}
}
function initRepulsorBurstSounds() {
repulsorBurstSounds = new Sound();
repulsorBurstSounds.attachSound("RepulsorBurst");
}
function playRepulsorBurstSound() {
if (soundOn == true) {
repulsorBurstSounds.start();
}
}
function initHeartDeathSounds() {
heartDeathSounds = new Sound();
heartDeathSounds.attachSound("HeartDeath");
}
function playHeartDeathSound() {
if (soundOn == true) {
heartDeathSounds.start();
}
}
function initDialogSounds() {
dialogSounds = new Sound();
dialogSounds.attachSound("DialogTick");
}
function playDialogSound() {
if (soundOn == true) {
dialogSounds.start();
}
}
function initLaserBeamSounds() {
laserBeamSounds = new Sound();
laserBeamSounds.attachSound("LaserBeamSound");
}
function playLaserBeamSound() {
if (soundOn == true) {
laserBeamSounds.start();
}
}
function initToggleSounds() {
toggleSounds = new Sound();
toggleSounds.attachSound("ToggleSound");
}
function playToggleSound() {
if (soundOn == true) {
toggleSounds.start();
}
}
function initProbeHitSounds() {
probeHitSounds = new Sound();
probeHitSounds.attachSound("ProbeHit");
}
function playProbeHitSound() {
if (soundOn == true) {
probeHitSounds.start();
}
}
function initAsteroidDeathSounds() {
asteroidDeathSounds = new Sound();
asteroidDeathSounds.attachSound("MeteorDeath");
}
function playAsteroidDeathSound() {
if (soundOn == true) {
asteroidDeathSounds.start();
}
}
function initExplosionSounds() {
explosionSounds = new Sound();
explosionSounds.attachSound("Explosion2");
}
function playExplosionSound() {
if (soundOn == true) {
explosionSounds.start();
}
}
function initHeatBurstSound() {
heatBurstSounds = new Sound();
heatBurstSounds.attachSound("Explosion1");
}
function playHeatBurstSound() {
if (soundOn == true) {
heatBurstSounds.start();
}
}
Frame 8
function init() {
RAD_TO_DEG = 57.2957795;
DEG_TO_RAD = 0.0174532925;
PI_PI = 6.28318531;
PI = 3.14159265;
HALF_PI = 1.57079633;
QUARTER_PI = 0.785398163;
initTrigTables();
}
function distance(px1, py1, px2, py2) {
tx = px2 - px1;
ty = py2 - py1;
return(Math.sqrt((tx * tx) + (ty * ty)));
}
function getSquaredDistance(px1, py1, px2, py2) {
tx = px2 - px1;
ty = py2 - py1;
return((tx * tx) + (ty * ty));
}
function findDirection(vec, px1, py1, px2, py2) {
vec.dx = px2 - px1;
vec.dy = py2 - py1;
}
function magnitude(vec) {
return(Math.sqrt((vec.dx * vec.dx) + (vec.dy * vec.dy)));
}
function magnitudeSquared(vec) {
vec.magnitudeSquared = (vec.dx * vec.dx) + (vec.dy * vec.dy);
return(vec.magnitudeSquared);
}
function normalize(vec) {
mag = Math.sqrt((vec.dx * vec.dx) + (vec.dy * vec.dy));
if (mag == 0) {
mag = 1;
}
vec.dx = vec.dx / mag;
vec.dy = vec.dy / mag;
}
function normalizeSpecial(vec) {
mag = Math.sqrt(vec.magnitudeSquared);
if (mag == 0) {
mag = 1;
}
invMag = 1 / mag;
vec.dx = vec.dx * invMag;
vec.dy = vec.dy * invMag;
}
function normalizeTmp(vec, vecDest) {
mag = Math.sqrt((vecDest.tmpDx * vecDest.tmpDx) + (vecDest.tmpDy * vecDest.tmpDy));
if (mag == 0) {
mag = 1;
}
vecDest.tmpDx = vec.tmpDx / mag;
vecDest.tmpDy = vec.tmpDy / mag;
}
function findPerpendicular2D(vec, pVec) {
pVec.dx = -vec.dx;
pVec.dy = vec.dy;
}
function intersectLines() {
}
function angleBetween(vec1, vec2) {
tmpValue = dot(vec1.dx, vec1.dy, vec2.dx, vec2.dy);
mag1 = Math.sqrt((vec1.dx * vec1.dx) + (vec1.dy * vec1.dy));
mag2 = Math.sqrt((vec2.dx * vec2.dx) + (vec2.dy * vec2.dy));
radiansBetween = Math.acos(tmpValue / (mag1 * mag2));
return(radiansBetween * RAD_TO_DEG);
}
function angleBetween(vec1dx, vec1dy, vec2dx, vec2dy) {
tmpValue = dot(vec1dx, vec1dy, vec2dx, vec2dy);
mag1 = Math.sqrt((vec1dx * vec1dx) + (vec1dy * vec1dy));
mag2 = Math.sqrt((vec2dx * vec2dx) + (vec2dy * vec2dy));
radiansBetween = Math.acos(tmpValue / (mag1 * mag2));
return(radiansBetween * RAD_TO_DEG);
}
function angleBetweenTest(vec1dx, vec1dy, vec2dx, vec2dy) {
tmpValue = -vec1dy;
mag1 = Math.sqrt((vec1dx * vec1dx) + (vec1dy * vec1dy));
radiansBetween = Math.acos(tmpValue);
return(radiansBetween * RAD_TO_DEG);
}
function projectVec(vec1, ontoVec) {
}
function intersectLineAndPlane() {
}
function dot(x1, y1, x2, y2) {
return((x1 * x2) + (y1 * y2));
}
function initTrigTables() {
}
init();
Frame 10
function init() {
COEF_OF_ELASTICITY = 1;
COEF_OF_ELASTICITY_P1 = COEF_OF_ELASTICITY + 1;
}
function initCollider(collider) {
collider.cRadius = collider._height * 0.5;
collider.k = 0.5;
collider.collidesCircle = function (circle) {
combinedRadius = circle.cRadius + this.cRadius;
xtmp = circle._x - this._x;
if (xtmp > combinedRadius) {
return(false);
}
ytmp = circle._y - this._y;
if (ytmp > combinedRadius) {
return(false);
}
distanceSq = (xtmp * xtmp) + (ytmp * ytmp);
return(distanceSq <= (combinedRadius * combinedRadius));
};
collider.addAcceleration = function (ax, ay) {
this.ax = this.ax + ax;
this.ay = this.ay + ay;
};
}
function responseCollision(vecA, vecB, objA, objB) {
nx = objB._x - objA._x;
ny = objB._y - objA._y;
lengthNInv = 1 / Math.sqrt((nx * nx) + (ny * ny));
if (isNaN(lengthNInv)) {
lengthNInv = 0;
}
normX = nx * lengthNInv;
normY = ny * lengthNInv;
tx = -normY;
ty = normX;
vait = dot(objA.dx, objA.dy, tx, ty);
vain = dot(objA.dx, objA.dy, normX, normY);
vbit = dot(objB.dx, objB.dy, tx, ty);
vbin = dot(objB.dx, objB.dy, normX, normY);
COEF_OF_ELASTICITY = objA.k + objB.k;
COEF_OF_ELASTICITY_P1 = COEF_OF_ELASTICITY + 1;
md = objA.mass - (COEF_OF_ELASTICITY * objB.mass);
mTotalInv = 1 / (objA.mass + objB.mass);
vafn = (((objB.mass * vbin) * COEF_OF_ELASTICITY_P1) + (vain * md)) * mTotalInv;
vbfn = (((objA.mass * vain) * COEF_OF_ELASTICITY_P1) + (vbin * md)) * mTotalInv;
objA.dx = (vafn * normX) + (vait * tx);
objA.dy = (vafn * normY) + (vait * ty);
objB.dx = (vbfn * normX) + (vbit * tx);
objB.dy = (vbfn * normY) + (vbit * ty);
}
function responseCollisionNoMass(vecA, vecB, objA, objB) {
nx = objB._x - objA._x;
ny = objB._y - objA._y;
lengthN = Math.sqrt((nx * nx) + (ny * ny));
normX = nx / lengthN;
normY = ny / lengthN;
tx = -normY;
ty = normX;
vait = dot(objA._x, objA._y, tx, ty);
vain = dot(objA._x, objA._y, nx, ny);
vbit = dot(objB._x, objB._y, tx, ty);
vbin = dot(objB._x, objB._y, nx, ny);
vafn = (vbin * COEF_OF_ELASTICITY_P1) + vain;
vbfn = (vain * COEF_OF_ELASTICITY_P1) + vbin;
vecA.dx = (vafn * normX) + (vait * tx);
vecA.dy = (vafn * normY) + (vait * ty);
vecB.dx = (vbfn * normX) + (vbit * tx);
vecB.dy = (vbfn * normY) + (vbit * ty);
}
init();
Frame 13
function createOnHitUpgradeButtons() {
createUpgradeDeflectBurst();
createUpgradeLink();
createUpgradeFrostBurst();
createUpgradeHeatBurst();
createUpgradeSpike();
createUpgradeStructural();
createUpgradeLaserBeam();
createUpgradeBoostAll();
createUpgradeStasisShip();
createUpgradeProtectShip();
createUpgradeRepulsorProbe();
createUpgradeRocketProbe();
createUpgradePBProbe();
createUpgradeBombProbe();
createUpgradeStasisProbe();
createUpgradeDecoyProbe();
createUpgradeWallProbe();
createUpgradeBatteryProbe();
}
function createUpgradeDeflectBurst() {
upgradeDeflectBurst = _root.attachMovie("DeflectBurstIconMC", "UpgradeDeflectBurstButton", depth--);
upgradeDeflectBurst._x = MENU_BTN_X;
upgradeDeflectBurst._y = OFFSCREEN_Y;
upgradeDeflectBurst.doClick = function () {
upgradeDeflectBurstSkill(selectedObject);
};
}
function createUpgradeLink() {
upgradeLink = _root.attachMovie("LinkIconMC", "UpgradeLinkButton", depth--);
upgradeLink._x = MENU_BTN_X;
upgradeLink._y = OFFSCREEN_Y;
upgradeLink.doClick = function () {
upgradeLinkSkill(selectedObject);
};
}
function createUpgradeFrostBurst() {
upgradeFrostBurst = _root.attachMovie("FrostBurstIconMC", "UpgradeFrostBurstButton", depth--);
upgradeFrostBurst._x = MENU_BTN_X;
upgradeFrostBurst._y = OFFSCREEN_Y;
upgradeFrostBurst.doClick = function () {
upgradeFrostBurstSkill(selectedObject);
};
}
function createUpgradeHeatBurst() {
upgradeHeatBurst = _root.attachMovie("HeatBurstIconMC", "UpgradeHeatBurstButton", depth--);
upgradeHeatBurst._x = MENU_BTN_X;
upgradeHeatBurst._y = OFFSCREEN_Y;
upgradeHeatBurst.doClick = function () {
upgradeHeatBurstSkill(selectedObject);
};
}
function createUpgradeSpike() {
upgradeSpiked = _root.attachMovie("SpikedIconMC", "UpgradeSpikeButton", depth--);
upgradeSpiked._x = MENU_BTN_X;
upgradeSpiked._y = OFFSCREEN_Y;
upgradeSpiked.doClick = function () {
upgradeSpikedSkill(selectedObject);
};
}
function createUpgradeStructural() {
upgradeStructural = _root.attachMovie("StructuralIconMC", "UpgradeStructuralButton", depth--);
upgradeStructural._x = MENU_BTN_X;
upgradeStructural._y = OFFSCREEN_Y;
upgradeStructural.doClick = function () {
upgradeStructuralSkill(selectedObject);
};
}
function createUpgradeLaserBeam() {
upgradeLaserBeam = _root.attachMovie("LaserBeamIconMC", "UpgradeLaserBeamButton", depth--);
upgradeLaserBeam._x = MENU_BTN_X;
upgradeLaserBeam._y = OFFSCREEN_Y;
upgradeLaserBeam.doClick = function () {
upgradeLaserBeamSkill(selectedObject);
};
}
function createUpgradeBoostAll() {
upgradeBoostAll = _root.attachMovie("BoostAllIconMC", "UpgradeBoostAllButton", depth--);
upgradeBoostAll._x = MENU_BTN_X;
upgradeBoostAll._y = OFFSCREEN_Y;
upgradeBoostAll.doClick = function () {
upgradeBoostAll(selectedObject);
};
}
function createUpgradeProtectShip() {
upgradeProtectShip = _root.attachMovie("ProtectShipIconMC", "UpgradeProtectShipButton", depth--);
upgradeProtectShip._x = MENU_BTN_X;
upgradeProtectShip._y = OFFSCREEN_Y;
upgradeProtectShip.doClick = function () {
upgradeProtectShipSkill(selectedObject);
};
}
function createUpgradeStasisShip() {
upgradeStasisShip = _root.attachMovie("StasisShipIconMC", "UpgradeStasisShipButton", depth--);
upgradeStasisShip._x = MENU_BTN_X;
upgradeStasisShip._y = OFFSCREEN_Y;
upgradeStasisShip.doClick = function () {
upgradeStasisShipSkill(selectedObject);
};
}
function createUpgradeRepulsorProbe() {
upgradeRepulsorProbe = _root.attachMovie("RepulsorProbeMC", "UpgradeRepulsorProbeButton", depth--);
upgradeRepulsorProbe._x = MENU_BTN_X;
upgradeRepulsorProbe._y = OFFSCREEN_Y;
upgradeRepulsorProbe.doClick = function () {
upgradeRepulsorProbeSkill(selectedObject);
};
}
function createUpgradeRocketProbe() {
upgradeRocketProbe = _root.attachMovie("RocketProbeMC", "UpgradeRocketProbeButton", depth--);
upgradeRocketProbe._x = MENU_BTN_X;
upgradeRocketProbe._y = OFFSCREEN_Y;
upgradeRocketProbe.doClick = function () {
upgradeRocketProbeSkill(selectedObject);
};
}
function createUpgradePBProbe() {
upgradePBProbe = _root.attachMovie("ParticleBlasterProbeMC", "UpgradeParticleBlasterProbeButton", depth--);
upgradePBProbe._x = MENU_BTN_X;
upgradePBProbe._y = OFFSCREEN_Y;
upgradePBProbe.doClick = function () {
upgradePBProbeSkill(selectedObject);
};
}
function createUpgradeBombProbe() {
upgradeBombProbe = _root.attachMovie("BombProbeMC", "UpgradeBombProbeButton", depth--);
upgradeBombProbe._x = MENU_BTN_X;
upgradeBombProbe._y = OFFSCREEN_Y;
upgradeBombProbe.doClick = function () {
upgradeBombProbeSkill(selectedObject);
};
}
function createUpgradeBatteryProbe() {
upgradeBatteryProbe = _root.attachMovie("BatteryProbeMC", "UpgradeBatteryProbeButton", depth--);
upgradeBatteryProbe._x = MENU_BTN_X;
upgradeBatteryProbe._y = OFFSCREEN_Y;
upgradeBatteryProbe.doClick = function () {
upgradeBatteryProbeSkill(selectedObject);
};
}
function createUpgradeStasisProbe() {
upgradeStasisProbe = _root.attachMovie("StasisProbeMC", "UpgradeStasisProbeButton", depth--);
upgradeStasisProbe._x = MENU_BTN_X;
upgradeStasisProbe._y = OFFSCREEN_Y;
upgradeStasisProbe.doClick = function () {
upgradeStasisProbeSkill(selectedObject);
};
}
function createUpgradeDecoyProbe() {
upgradeDecoyProbe = _root.attachMovie("DecoyProbeMC", "UpgradeDecoyProbeButton", depth--);
upgradeDecoyProbe._x = MENU_BTN_X;
upgradeDecoyProbe._y = OFFSCREEN_Y;
upgradeDecoyProbe.doClick = function () {
upgradeDecoyProbeSkill(selectedObject);
};
}
function createUpgradeWallProbe() {
upgradeWallProbe = _root.attachMovie("WallProbeMC", "UpgradeWallProbeButton", depth--);
upgradeWallProbe._x = MENU_BTN_X;
upgradeWallProbe._y = OFFSCREEN_Y;
upgradeWallProbe.doClick = function () {
upgradeWallProbeSkill(selectedObject);
};
}
Frame 14
function init() {
ON_HIT_DEFLECT = 1;
ON_HIT_LINK = 2;
ON_HIT_STRUCTURAL = 3;
ON_HIT_FROST = 4;
ON_HIT_HEAT = 5;
ON_HIT_SPIKED = 6;
}
function createOnHitChooseUpgradeButtons() {
createStructuralIcon();
createSpikedIcon();
createHeatBurstIcon();
createFrostBurstIcon();
createLinkIcon();
createDeflectBurstIcon();
}
function createStructuralIcon() {
structuralIconButton = _root.attachMovie("StructuralIconMC", "onHitChooseStructuralBtn", depth--);
structuralIconButton._x = OFFSCREEN_X;
structuralIconButton._y = OFFSCREEN_Y;
structuralIconButton.onRollOver = function () {
popupInfo = "Structural Support - Strengthens probe. Increases hit points and mass.";
popupCountdown = POPUP_COUNTDOWN;
};
structuralIconButton.onPress = function () {
if ((selectedObject != -1) && (selectedObject.probeType == REPULSOR_PROBE)) {
selectedObject.onHitChosen = ON_HIT_STRUCTURAL;
selectedObject.onHitLevel = 1;
selectedObject.onHit = function () {
this.gameState = PS_HIT;
this.flashCounter = 4 + (this.flashCounter % 2);
if (this.onHitCooldownTimer == 0) {
this.onHitCooldownTimer = this.onHitCooldown;
}
};
configureStatsMenu();
}
};
}
function createSpikedIcon() {
spikedIconButton = _root.attachMovie("StructuralIconMC", "onHitChooseStructuralBtn", depth--);
spikedIconButton._x = OFFSCREEN_X;
spikedIconButton._y = OFFSCREEN_Y;
spikedIconButton.onRollOver = function () {
popupInfo = "Structural Support - Strengthens probe. Increases hit points and mass.";
popupCountdown = POPUP_COUNTDOWN;
};
spikedIconButton.onPress = function () {
if ((selectedObject != -1) && (selectedObject.probeType == REPULSOR_PROBE)) {
selectedObject.onHitChosen = ON_HIT_SPIKED;
selectedObject.onHitLevel = 1;
selectedObject.onHit = function () {
this.gameState = PS_HIT;
this.flashCounter = 4 + (this.flashCounter % 2);
if (this.onHitCooldownTimer == 0) {
this.onHitCooldownTimer = this.onHitCooldown;
}
};
configureStatsMenu();
}
};
}
function createLinkIcon() {
linkIconButton = _root.attachMovie("LinkIconMC", "onHitLinkBtn", depth--);
linkIconButton._x = OFFSCREEN_X;
linkIconButton._y = OFFSCREEN_Y;
linkIconButton.onRollOver = function () {
popupInfo = "Link To Station - On contact, probe will disperse energy created by contact back to station.";
popupCountdown = POPUP_COUNTDOWN;
};
linkIconButton.onPress = function () {
if ((selectedObject != -1) && (selectedObject.probeType == REPULSOR_PROBE)) {
selectedObject.onHitChosen = ON_HIT_LINK;
selectedObject.onHitLevel = 1;
selectedObject.onHit = function () {
this.gameState = PS_HIT;
this.flashCounter = 4 + (this.flashCounter % 2);
if (this.onHitCooldownTimer == 0) {
this.onHitCooldownTimer = this.onHitCooldown;
createLinkToShip(this);
}
};
configureStatsMenu();
}
};
}
function createHeatBurstIcon() {
heatBurstIconButton = _root.attachMovie("HeatBurstIconMC", "onHitChooseHeatBtn", depth--);
heatBurstIconButton._x = OFFSCREEN_X;
heatBurstIconButton._y = OFFSCREEN_Y;
heatBurstIconButton.onRollOver = function () {
popupInfo = "Repulsor Exploder - Sends all enemies within radius away from probe.";
popupCountdown = POPUP_COUNTDOWN;
};
heatBurstIconButton.onPress = function () {
if ((selectedObject != -1) && (selectedObject.probeType == REPULSOR_PROBE)) {
selectedObject.onHitChosen = ON_HIT_HEAT;
selectedObject.onHitLevel = 1;
selectedObject.onHit = function () {
this.gameState = PS_HIT;
this.flashCounter = 4 + (this.flashCounter % 2);
if (this.onHitCooldownTimer == 0) {
this.onHitCooldownTimer = this.onHitCooldown;
createHeatBurst(this, this.onHitPower, this.onHitMass, this.onHitK, this.onHitRange);
}
};
configureStatsMenu();
}
};
}
function createFrostBurstIcon() {
frostBurstIconButton = _root.attachMovie("FrostBurstIconMC", "onHitChooseHeatBtn", depth--);
frostBurstIconButton._x = OFFSCREEN_X;
frostBurstIconButton._y = OFFSCREEN_Y;
frostBurstIconButton.onRollOver = function () {
popupInfo = "Stasis Burst - Distorts space time continuum and slows all enemies within area.";
popupCountdown = POPUP_COUNTDOWN;
};
frostBurstIconButton.onPress = function () {
if (((selectedObject != -1) && (selectedObject.probeType == REPULSOR_PROBE)) && (selectedObject.onHitChosen == -1)) {
selectedObject.onHitChosen = ON_HIT_FROST;
selectedObject.onHitLevel = 1;
selectedObject.onHit = function () {
this.gameState = PS_HIT;
this.flashCounter = 4 + (this.flashCounter % 2);
if (this.onHitCooldownTimer == 0) {
this.onHitCooldownTimer = this.onHitCooldown;
createFrostBurst(this, this.onHitPower, this.onHitMass, this.onHitK, this.onHitRange, this.onHitVariable1, this.onHitVariable2);
}
};
configureStatsMenu();
}
};
}
function createDeflectBurstIcon() {
deflectBurstIconButton = _root.attachMovie("DeflectBurstIconMC", "onHitChooseDeflectBtn", depth--);
deflectBurstIconButton._x = OFFSCREEN_X;
deflectBurstIconButton._y = OFFSCREEN_Y;
deflectBurstIconButton.onRollOver = function () {
popupInfo = "Repulsor Exploder - Sends all enemies within radius away from probe.";
popupCountdown = POPUP_COUNTDOWN;
};
deflectBurstIconButton.onPress = function () {
if ((selectedObject != -1) && (selectedObject.probeType == REPULSOR_PROBE)) {
selectedObject.onHitChosen = ON_HIT_DEFLECT;
selectedObject.onHitLevel = 1;
selectedObject.onHit = function () {
this.gameState = PS_HIT;
this.flashCounter = 4 + (this.flashCounter % 2);
if (this.onHitCooldownTimer == 0) {
this.onHitCooldownTimer = this.onHitCooldown;
createDeflectBurst(this, this.onHitPower, this.onHitMass, this.onHitK, this.onHitRange);
}
};
configureStatsMenu();
}
};
}
init();
Frame 15
function init() {
BLUE = 0;
YELLOW = 1;
SCREEN_TOP = 0;
SCREEN_BOTTOM = 1;
SCREEN_RIGHT = 2;
SCREEN_LEFT = 3;
GUI_STATE_HIDDEN = 0;
GUI_STATE_SHOW = 1;
GUI_STATE_MOVE_TO = 2;
GUI_STATE_PLAY_SHOW = 3;
GUI_STATE_END_SHOW = 4;
GUI_STATE_PLAY_HIDE = 5;
GUI_STATE_END_HIDE = 6;
GUI_STATE_MOVE_BACK = 7;
MENU_BTN_X = Stage.width - 32;
SHIP_CHARGE1_Y = Stage.height - 32;
SHIP_CHARGE2_Y = Stage.height - 64;
SHIP_CHARGE3_Y = Stage.height - 96;
SHIP_CHARGE4_Y = Stage.height - 128;
ACTION_BAR_Y = Stage.height - 280;
ACTION_BAR_ACTION1_X = Stage.width - 215;
ACTION_BAR_ACTION2_X = ACTION_BAR_ACTION1_X + 58;
ACTION_BAR_ACTION3_X = ACTION_BAR_ACTION2_X + 59;
ACTION_BAR_ACTION4_X = ACTION_BAR_ACTION3_X + 60;
ERROR_POPUP_X = 320;
ERROR_POPUP_Y = 300;
ERROR_DISPLAY_TIME = fps * 2;
QUICK_INFO_LEFT_BORDER = Stage.width - 100;
}
function initUIPiece(uiPiece) {
uiPiece.gameState = GUI_STATE_HIDDEN;
uiPiece.displayAt = function (xTarget, yTarget, xPos, yPos, speed) {
if (this.gameState == GUI_STATE_HIDDEN) {
this.speed = speed;
this._x = xPos;
this._y = yPos;
this.xTarget = xTarget;
this.yTarget = yTarget;
this.xOrig = xPos;
this.yOrig = yPos;
this.guiNextState();
this.move = function () {
if (this.gameState == GUI_STATE_MOVE_TO) {
if (distance(this.xTarget, this.yTarget, this._x, this._y) < this.speed) {
this.guiNextState();
this.move = function () {
};
} else {
this.tmpDx = this.xTarget - this._x;
this.tmpDy = this.yTarget - this._y;
normalizeTmp(this, this);
this.dx = this.tmpDx * this.speed;
this.dy = this.tmpDy * this.speed;
this._x = this._x + this.dx;
this._y = this._y + this.dy;
}
}
};
}
};
uiPiece.hideBack = function () {
this.hideChildMenus();
this.hideAddOns();
if (this.gameState == GUI_STATE_END_SHOW) {
this._x = this.xTarget;
this._y = this.yTarget;
this.xTarget = this.xOrig;
this.yTarget = this.yOrig;
this.guiNextState();
this.move = function () {
if (this.gameState == GUI_STATE_MOVE_BACK) {
if (distance(this.xTarget, this.yTarget, this._x, this._y) < this.speed) {
this.guiNextState();
this.move = function () {
};
} else {
this.tmpDx = this.xTarget - this._x;
this.tmpDy = this.yTarget - this._y;
normalizeTmp(this, this);
this.dx = this.tmpDx * this.speed;
this.dy = this.tmpDy * this.speed;
this._x = this._x + this.dx;
this._y = this._y + this.dy;
}
}
};
}
};
uiPiece.comeInFrom = function (directionFrom, xy, speed) {
if (directionFrom == SCREEN_RIGHT) {
this.displayAt(PLAYABLE_WIDTH - this.definedWidth, xy, PLAYABLE_WIDTH, xy, speed);
}
};
uiPiece.guiNextState = function () {
if (this.gameState == GUI_STATE_HIDDEN) {
this.gameState = GUI_STATE_SHOW;
this.gotoAndStop("SHOW");
this.guiNextState();
} else if (this.gameState == GUI_STATE_SHOW) {
this.gameState = GUI_STATE_MOVE_TO;
} else if (this.gameState == GUI_STATE_MOVE_TO) {
this.gameState = GUI_STATE_PLAY_SHOW;
this.gotoAndPlay("PLAY_SHOW");
} else if (this.gameState == GUI_STATE_PLAY_SHOW) {
this.displayAddOns();
this.gameState = GUI_STATE_END_SHOW;
} else if (this.gameState == GUI_STATE_END_SHOW) {
this.gameState = GUI_STATE_PLAY_HIDE;
this.gotoAndPlay("PLAY_HIDE");
} else if (this.gameState == GUI_STATE_PLAY_HIDE) {
this.gameState = GUI_STATE_END_HIDE;
this.guiNextState();
} else if (this.gameState == GUI_STATE_END_HIDE) {
this.gameState = GUI_STATE_MOVE_BACK;
} else if (this.gameState == GUI_STATE_MOVE_BACK) {
this.gameState = GUI_STATE_HIDDEN;
this.gotoAndStop("HIDDEN");
}
};
}
function createResultPostMenu() {
resultPostMenu = _root.attachMovie("PostScoreOkMC", "PostScoreOk", depth--);
resultPostMenu._x = OFFSCREEN_X;
resultPostMenu._y = Stage.height * 0.5;
resultPostMenu.OkButton.onPress = hideResultPostMenu;
}
function displayResultPostMenu(string) {
resultPostMenu.Field1 = string;
resultPostMenu._x = Stage.width * 0.5;
}
function hideResultPostMenu() {
resultPostMenu._x = OFFSCREEN_X;
}
function createPlayAgainMenu() {
playAgainMenu = _root.attachMovie("PlayAgainMenuMC", "PlayAgainMenu", depth--);
playAgainMenu._x = OFFSCREEN_X;
playAgainMenu._y = (Stage.height * 0.5) + 128;
playAgainMenu.button1.onPress = replayGame;
playAgainMenu.button2.onPress = function () {
getURL ("http://www.jumbledmind.com/SDSHighScores", "_blank");
};
playAgainMenu.button3.onPress = function () {
hideOptionsMenu();
hideStatsMenu();
hideRangeDisplay();
optionsButton._x = OFFSCREEN_X;
optionsButton.gotoAndStop("f0");
optionsButton.toggled = false;
buildingRange._x = OFFSCREEN_X;
_root.gotoAndStop("Credits");
};
}
function displayPlayAgainMenu() {
playAgainMenu._x = Stage.width * 0.5;
}
function hidePlayAgainMenu() {
playAgainMenu._x = OFFSCREEN_X;
}
function createPostScoreMenu() {
postScoreMenu = _root.attachMovie("PostScoreMenuMC", "PostScoreMenu", depth--);
postScoreMenu._x = OFFSCREEN_X;
postScoreMenu._y = Stage.height * 0.5;
postScoreMenu.submitButton.onPress = postScore;
postScoreMenu.cancelButton.onPress = cancelPost;
}
function displayPostScoreMenu() {
postScoreMenu._x = Stage.width * 0.5;
}
function hidePostScoreMenu() {
postScoreMenu._x = OFFSCREEN_X;
}
function createOptionsButtons() {
optionsButton = _root.attachMovie("OptionMC", "Option", depth--);
optionsButton._x = 0;
optionsButton._y = 0;
optionsButton.Field1 = "OPTIONS";
optionsButton.gotoAndStop("f0");
optionsButton.toggled = false;
optionsButton.onPress = function () {
if (this.toggled == false) {
displayOptionsMenu();
this.gotoAndStop("f1");
this.toggled = true;
} else {
hideOptionsMenu();
this.gotoAndStop("f0");
this.toggled = false;
}
};
rangeToggleButton = _root.attachMovie("OptionMC", "RangeToggle", depth--);
rangeToggleButton.Field1 = "Display Range";
rangeToggleButton._x = OFFSCREEN_X;
rangeToggleButton._y = 32;
rangeToggleButton.onPress = function () {
toggleRangeDisplay();
};
soundToggleButton = _root.attachMovie("OptionMC", "SoundToggle", depth--);
soundToggleButton.Field1 = "Sound On";
soundToggleButton._x = OFFSCREEN_X;
soundToggleButton._y = 64;
soundToggleButton.onPress = function () {
toggleSound();
};
pauseToggleButton = _root.attachMovie("OptionMC", "PauseToggle", depth--);
pauseToggleButton.Field1 = "Pause";
pauseToggleButton._x = OFFSCREEN_X;
pauseToggleButton._y = 96;
pauseToggleButton.onPress = function () {
togglePause();
};
}
function displayOptionsMenu() {
rangeToggleButton._x = 0;
soundToggleButton._x = 0;
pauseToggleButton._x = 0;
if (displayRangeOn == true) {
rangeToggleButton.gotoAndStop("f1");
} else {
rangeToggleButton.gotoAndStop("f0");
}
if (soundOn == true) {
soundToggleButton.gotoAndStop("f1");
} else {
soundToggleButton.gotoAndStop("f0");
}
if (gamePaused == true) {
pauseToggleButton.gotoAndStop("f1");
} else {
pauseToggleButton.gotoAndStop("f0");
}
}
function hideOptionsMenu() {
rangeToggleButton._x = OFFSCREEN_X;
soundToggleButton._x = OFFSCREEN_X;
pauseToggleButton._x = OFFSCREEN_X;
}
function togglePause() {
gamePaused = !gamePaused;
if (gamePaused == true) {
pauseToggleButton.gotoAndStop("f1");
} else {
pauseToggleButton.gotoAndStop("f0");
}
if (gamePaused == false) {
errorPopup._y = OFFSCREEN_Y;
}
}
function toggleSound() {
soundOn = !soundOn;
if (soundOn == true) {
soundToggleButton.gotoAndStop("f1");
} else {
soundToggleButton.gotoAndStop("f0");
}
}
function toggleRangeDisplay() {
displayRangeOn = !displayRangeOn;
if (displayRangeOn == true) {
rangeToggleButton.gotoAndStop("f1");
} else {
rangeToggleButton.gotoAndStop("f0");
hideRangeDisplay();
}
}
function createHitFlash() {
hitFlash = _root.attachMovie("FlashMC", "HitFlash", depth--);
hitFlash._x = Stage.width * 0.5;
hitFlash._y = Stage.height * 0.5;
hitFlash.gotoAndStop("fend");
}
function createMainMenu() {
index = uiDepth - uiPieces.getNextIndex();
mainMenu = _root.attachMovie("MainMenuMC", "MainMenu", index);
mainMenu.index = index;
mainMenu._x = OFFSCREEN_X;
mainMenu._y = OFFSCREEN_Y;
initUIPiece(mainMenu);
if (uiPieces.addObject(mainMenu) > -1) {
}
}
function createQuickInfo() {
quickInfo = _root.attachMovie("QuickInfoMC", "QuickInfo", depth--);
quickInfo._y = OFFSCREEN_Y;
}
function createBuildQuickInfo() {
buildQuickInfo = _root.attachMovie("QuickInfo2MC", "QuickInfo2", depth--);
buildQuickInfo._y = OFFSCREEN_Y;
}
function createSkipDialog() {
skipDialog = _root.attachMovie("SkipDialogMC", "SkipDialog", depth--);
skipDialog._y = OFFSCREEN_Y;
skipDialog._x = Stage.width - 32;
skipDialog.onPress = function () {
currentDialog.ttl = 0;
goNextGameState();
};
}
function createActionBar() {
actionBar = _root.attachMovie("ActionBarMC", "ActionBar", depth--);
actionBar._y = OFFSCREEN_Y;
actionBar._x = Stage.width - 250;
actionBar.onPress = function () {
};
}
function createActionBarOptions() {
laserBeamActionIcon = _root.attachMovie("LaserBeamActionIconMC", "LaserBeamActionIcon", depth--);
probeBoostActionIcon = _root.attachMovie("ProbeBoostActionIconMC", "ProbeBoostActionIcon", depth--);
protectShipActionIcon = _root.attachMovie("ProtectShipActionIconMC", "ProtectShipActionIcon", depth--);
stasisShipActionIcon = _root.attachMovie("StasisShipActionIconMC", "StasisShipActionIcon", depth--);
laserBeamActionIcon._x = OFFSCREEN_X;
laserBeamActionIcon._y = ACTION_BAR_Y - 30;
laserBeamActionIcon.onPress = function () {
playDialogSound();
if (selectedObject.energy >= 100) {
hideStatsMenu();
userState = ACTION;
changeMouseCursor(targetCrossHairs);
actionObject = mainShip;
displayError("Choose Direction or Esc to Cancel");
} else {
displayError("Not Enough Energy.");
}
};
laserBeamActionIcon.onRollOver = function () {
popupInfo = "Fires Laser Beam. Requires 100 Energy";
popupCountdown = POPUP_COUNTDOWN;
};
probeBoostActionIcon._x = OFFSCREEN_X;
probeBoostActionIcon._y = ACTION_BAR_Y - 30;
probeBoostActionIcon.onPress = function () {
playDialogSound();
if (selectedObject.energy >= 45) {
mainShip.boostProbes();
} else {
displayError("Not Enough Energy.");
}
};
probeBoostActionIcon.onRollOver = function () {
popupInfo = "Regenerates All Downed Probes. Requires 45 Energy";
popupCountdown = POPUP_COUNTDOWN;
};
protectShipActionIcon._x = OFFSCREEN_X;
protectShipActionIcon._y = ACTION_BAR_Y - 30;
protectShipActionIcon.onPress = function () {
playDialogSound();
if (selectedObject.energy >= 50) {
mainShip.protect();
} else {
displayError("Not Enough Energy.");
}
};
protectShipActionIcon.onRollOver = function () {
popupInfo = "Creates a Deflection Burst to Protect Ship. Requires 50 Energy";
popupCountdown = POPUP_COUNTDOWN;
};
stasisShipActionIcon._x = OFFSCREEN_X;
stasisShipActionIcon._y = ACTION_BAR_Y - 30;
stasisShipActionIcon.onPress = function () {
playDialogSound();
if (selectedObject.energy >= 50) {
mainShip.stasisBurst();
} else {
displayError("Not Enough Energy.");
}
};
stasisShipActionIcon.onRollOver = function () {
popupInfo = "Creates a Stasis Burst surrounding the ship. Requires 50 Energy";
popupCountdown = POPUP_COUNTDOWN;
};
}
function createStatsMenu() {
upgradeProbeButton = _root.attachMovie("UpgradeProbeButtonMC", "UpgradeProbeButton", depth--);
upgradeProbeButton._y = OFFSCREEN_Y;
sellProbeButton = _root.attachMovie("SellProbeButtonMC", "SellProbeButton", depth--);
sellProbeButton._y = OFFSCREEN_Y;
upgradeProbeButton.onPress = function () {
playToggleSound();
if (selectedMenuButton.menuColor == "Red") {
menuBtn1.doClick();
} else if (selectedMenuButton.menuColor == "Green") {
menuBtn2.doClick();
} else if (selectedMenuButton.menuColor == "Yellow") {
menuBtn3.doClick();
} else if (selectedMenuButton.menuColor == "Blue") {
menuBtn4.doClick();
}
};
sellProbeButton.onPress = function () {
playToggleSound();
sellProbe(selectedObject);
};
redButton = _root.attachMovie("MenuButtonRedMC", "MenuButtonRed", depth--);
redButton.menuColor = "Red";
redButton._y = OFFSCREEN_Y;
redButton.onPress = function () {
playToggleSound();
toggleStatsMenuButton(this);
};
greenButton = _root.attachMovie("MenuButtonGreenMC", "MenuButtonGreen", depth--);
greenButton.menuColor = "Green";
greenButton._y = OFFSCREEN_Y;
greenButton.onPress = function () {
playToggleSound();
toggleStatsMenuButton(this);
};
yellowButton = _root.attachMovie("MenuButtonYellowMC", "MenuButtonYellow", depth--);
yellowButton.menuColor = "Yellow";
yellowButton._y = OFFSCREEN_Y;
yellowButton.onPress = function () {
playToggleSound();
toggleStatsMenuButton(this);
};
blueButton = _root.attachMovie("MenuButtonBlueMC", "MenuButtonBlue", depth--);
blueButton.menuColor = "Blue";
blueButton._y = OFFSCREEN_Y;
blueButton.onPress = function () {
playToggleSound();
toggleStatsMenuButton(this);
};
statsMenu = _root.attachMovie("SimpleStatsMenuMC", "StatsMenu", depth--);
statsMenu._y = OFFSCREEN_Y;
statsMenu.onPress = function () {
};
statsMenu.clearAll = function () {
this.Field1 = "";
this.Field2 = "";
this.Field3 = "";
this.Field4 = "";
this.Field5 = "";
this.Field6 = "";
this.Field7 = "";
this.Field8 = "";
this.Stat1 = "";
this.Stat2 = "";
this.Stat3 = "";
this.Stat4 = "";
this.Stat5 = "";
this.Stat6 = "";
this.Stat7 = "";
this.Stat8 = "";
this.StatChange1 = "";
this.StatChange2 = "";
this.StatChange3 = "";
this.StatChange4 = "";
this.StatChange5 = "";
this.StatChange6 = "";
this.StatChange7 = "";
this.StatChange8 = "";
};
redButton._x = MENU_BTN_X;
greenButton._x = MENU_BTN_X;
yellowButton._x = MENU_BTN_X;
blueButton._x = MENU_BTN_X;
upgradeProbeButton._x = Stage.width - 190;
sellProbeButton._x = Stage.width - 100;
statsMenu._x = Stage.width - statsMenu._width;
}
function toggleStatsMenuButton(button) {
redButton.gotoAndStop("NoHilite");
greenButton.gotoAndStop("NoHilite");
yellowButton.gotoAndStop("NoHilite");
blueButton.gotoAndStop("NoHilite");
upgradeProbeButton._y = Stage.height - 20;
button.gotoAndStop("Hilite");
selectedMenuButton = button;
if (selectedMenuButton.menuColor == "Red") {
configureRedStats();
} else if (selectedMenuButton.menuColor == "Green") {
configureGreenStats();
} else if (selectedMenuButton.menuColor == "Yellow") {
configureYellowStats();
} else if (selectedMenuButton.menuColor == "Blue") {
configureBlueStats();
}
statsMenu.gotoAndStop(button.menuColor);
}
function displayStatsMenu() {
redButton._y = Stage.height - 203;
menuBtn1._y = Stage.height - 203;
greenButton._y = Stage.height - 146;
menuBtn2._y = Stage.height - 146;
yellowButton._y = Stage.height - 88;
menuBtn3._y = Stage.height - 88;
blueButton._y = Stage.height - 32;
menuBtn4._y = Stage.height - 32;
upgradeProbeButton._y = Stage.height - 20;
toggleStatsMenuButton(redButton);
statsMenu._y = Stage.height;
if (selectedObject.objectType == OBJ_MAIN_SHIP) {
actionBar._y = ACTION_BAR_Y;
actionIcon1 = laserBeamActionIcon;
actionIcon2 = probeBoostActionIcon;
actionIcon3 = protectShipActionIcon;
actionIcon4 = stasisShipActionIcon;
} else {
sellProbeButton._y = Stage.height - 20;
}
actionIcon1._x = ACTION_BAR_ACTION1_X;
actionIcon2._x = ACTION_BAR_ACTION2_X;
actionIcon3._x = ACTION_BAR_ACTION3_X;
actionIcon4._x = ACTION_BAR_ACTION4_X;
}
function hideStatsMenu() {
redButton._y = OFFSCREEN_Y;
greenButton._y = OFFSCREEN_Y;
yellowButton._y = OFFSCREEN_Y;
blueButton._y = OFFSCREEN_Y;
statsMenu._y = OFFSCREEN_Y;
menuBtn1._y = OFFSCREEN_Y;
menuBtn2._y = OFFSCREEN_Y;
menuBtn3._y = OFFSCREEN_Y;
menuBtn4._y = OFFSCREEN_Y;
menuBtn1 = -1;
menuBtn2 = -1;
menuBtn3 = -1;
menuBtn4 = -1;
actionBar._y = OFFSCREEN_Y;
actionIcon1._x = OFFSCREEN_X;
actionIcon2._x = OFFSCREEN_X;
actionIcon3._x = OFFSCREEN_X;
actionIcon4._x = OFFSCREEN_X;
actionIcon1 = -1;
actionIcon2 = -1;
actionIcon3 = -1;
actionIcon4 = -1;
upgradeProbeButton._y = OFFSCREEN_Y;
sellProbeButton._y = OFFSCREEN_Y;
}
function configureStatsMenu() {
hideStatsMenu();
refreshHighLevelStats();
if (selectedObject.objectType == OBJ_PROBE) {
if (selectedObject.probeType == REPULSOR_PROBE) {
menuBtn1 = upgradeRepulsorProbe;
menuBtn2 = upgradeDeflectBurst;
menuBtn3 = upgradeStructural;
menuBtn4 = upgradeLink;
} else if (selectedObject.probeType == ROCKET_PROBE) {
menuBtn1 = upgradeRocketProbe;
menuBtn2 = upgradeHeatBurst;
menuBtn3 = upgradeStructural;
menuBtn4 = upgradeLink;
} else if (selectedObject.probeType == PB_PROBE) {
menuBtn1 = upgradePBProbe;
menuBtn2 = upgradeHeatBurst;
menuBtn3 = upgradeStructural;
menuBtn4 = upgradeLink;
} else if (selectedObject.probeType == BOMB_PROBE) {
menuBtn1 = upgradeBombProbe;
menuBtn2 = upgradeHeatBurst;
menuBtn3 = upgradeStructural;
menuBtn4 = upgradeLink;
} else if (selectedObject.probeType == BATTERY_PROBE) {
menuBtn1 = upgradeBatteryProbe;
menuBtn2 = upgradeSpiked;
menuBtn3 = upgradeStructural;
menuBtn4 = upgradeLink;
} else if (selectedObject.probeType == DECOY_PROBE) {
menuBtn1 = upgradeDecoyProbe;
menuBtn2 = upgradeSpiked;
menuBtn3 = upgradeStructural;
menuBtn4 = upgradeLink;
} else if (selectedObject.probeType == STASIS_PROBE) {
menuBtn1 = upgradeStasisProbe;
menuBtn2 = upgradeFrostBurst;
menuBtn3 = upgradeStructural;
menuBtn4 = upgradeLink;
} else if (selectedObject.probeType == WALL_PROBE) {
menuBtn1 = upgradeWallProbe;
menuBtn2 = upgradeSpiked;
menuBtn3 = upgradeStructural;
menuBtn4 = upgradeLink;
}
} else if (selectedObject.objectType == OBJ_MAIN_SHIP) {
menuBtn1 = upgradeLaserBeam;
menuBtn2 = upgradeBoostAll;
menuBtn3 = upgradeProtectShip;
menuBtn4 = upgradeStasisShip;
}
displayStatsMenu();
}
function refreshHighLevelStats() {
redButton.Field1 = selectedObject.upgradeLevel;
greenButton.Field1 = selectedObject.onHit1Level;
yellowButton.Field1 = selectedObject.onHit2Level;
blueButton.Field1 = selectedObject.onHit3Level;
}
function configureRedStats() {
statsMenu.clearAll();
if (selectedObject.objectType == OBJ_PROBE) {
statsMenu.SkillName = "Probe Stats";
statsMenu.ValueField = selectedObject.cost * SELL_VALUE_PERCENTAGE;
if ((((selectedObject.probeType == REPULSOR_PROBE) || (selectedObject.probeType == ROCKET_PROBE)) || (selectedObject.probeType == PB_PROBE)) || (selectedObject.probeType == BOMB_PROBE)) {
statsMenu.Field1 = "DPS:";
dpsValue = (selectedObject.power * selectedObject.shotsPerReload) / (selectedObject.reloadRate + (selectedObject.shotsPerReload / selectedObject.shotRate));
statsMenu.Stat1 = dpsValue;
statsMenu.Field2 = "Power:";
statsMenu.Stat2 = selectedObject.power;
statsMenu.Field3 = "Range:";
statsMenu.Stat3 = selectedObject.range;
if (selectedObject.upgradeLevel < MAX_UPGRADE_LEVEL) {
if (selectedObject.probeType == REPULSOR_PROBE) {
nextLevelStats = repulsorProbeUpgradeStats[selectedObject.upgradeLevel];
statsMenu.InfoField = "Upgrading will slightly increase damage output and deflection strength and range.";
} else if (selectedObject.probeType == ROCKET_PROBE) {
nextLevelStats = rocketProbeUpgradeStats[selectedObject.upgradeLevel];
statsMenu.InfoField = "Upgrading will increase damage output and range.";
} else if (selectedObject.probeType == PB_PROBE) {
nextLevelStats = pbProbeUpgradeStats[selectedObject.upgradeLevel];
statsMenu.InfoField = "Upgrading will increase damage output and range.";
} else if (selectedObject.probeType == BOMB_PROBE) {
nextLevelStats = bombProbeUpgradeStats[selectedObject.upgradeLevel];
statsMenu.InfoField = "Upgrading will increase damage output and decrease cooldown.";
}
statsMenu.StatChange2 = getStat(nextLevelStats.power);
statsMenu.StatChange3 = getStat(nextLevelStats.range);
statsMenu.CostField = nextLevelStats.cost;
statsMenu.StatChange1 = getStat((((selectedObject.power + nextLevelStats.power) * (selectedObject.shotsPerReload + nextLevelStats.shotsPerReload)) / ((selectedObject.reloadRate + nextLevelStats.reloadRate) + ((selectedObject.shotsPerReload + nextLevelStats.shotsPerReload) / (selectedObject.shotRate + nextLevelStats.shotRate)))) - dpsValue);
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
} else if (selectedObject.probeType == BATTERY_PROBE) {
statsMenu.Field1 = "Healing PS:";
statsMenu.Stat1 = (selectedObject.power * selectedObject.shotsPerReload) / (selectedObject.reloadRate + (selectedObject.shotsPerReload / selectedObject.shotRate));
statsMenu.Field2 = "Heal Power:";
statsMenu.Stat2 = selectedObject.power;
statsMenu.Field3 = "Range:";
statsMenu.Stat3 = selectedObject.range;
if (selectedObject.upgradeLevel < MAX_UPGRADE_LEVEL) {
nextLevelStats = batteryProbeUpgradeStats[selectedObject.upgradeLevel];
statsMenu.StatChange2 = getStat(nextLevelStats.power);
statsMenu.StatChange3 = getStat(nextLevelStats.range);
statsMenu.InfoField = "Upgrading will increase healing capabilities and coverage range.";
statsMenu.CostField = nextLevelStats.cost;
statsMenu.StatChange1 = getStat(((selectedObject.power + nextLevelStats.power) * (selectedObject.shotsPerReload + nextLevelStats.shotsPerReload)) / ((selectedObject.reloadRate + nextLevelStats.reloadRate) + ((selectedObject.shotsPerReload + nextLevelStats.shotsPerReload) / (selectedObject.shotRate + nextLevelStats.shotRate))));
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
} else if (selectedObject.probeType == DECOY_PROBE) {
statsMenu.Field1 = "Range:";
statsMenu.Stat1 = selectedObject.range;
statsMenu.Field2 = "Speed:";
statsMenu.Stat2 = selectedObject.speed;
statsMenu.Field3 = "Max HP:";
statsMenu.Stat3 = selectedObject.hpMax;
if (selectedObject.upgradeLevel < MAX_UPGRADE_LEVEL) {
nextLevelStats = decoyProbeUpgradeStats[selectedObject.upgradeLevel];
statsMenu.StatChange1 = getStat(nextLevelStats.range);
statsMenu.StatChange2 = getStat(nextLevelStats.speed);
statsMenu.StatChange3 = getStat(nextLevelStats.hp);
statsMenu.InfoField = "Upgrading will increase range.";
statsMenu.CostField = nextLevelStats.cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
} else if (selectedObject.probeType == STASIS_PROBE) {
statsMenu.Field1 = "Stasis Effect:";
statsMenu.Stat1 = selectedObject.slowEffect;
statsMenu.Field2 = "Stasis Duration:";
statsMenu.Stat2 = selectedObject.coldTime;
statsMenu.Field3 = "Range:";
statsMenu.Stat3 = selectedObject.range;
if (selectedObject.upgradeLevel < MAX_UPGRADE_LEVEL) {
nextLevelStats = stasisProbeUpgradeStats[selectedObject.upgradeLevel];
statsMenu.StatChange1 = getStat(nextLevelStats.slowEffect);
statsMenu.StatChange2 = getStat(nextLevelStats.coldTime);
statsMenu.StatChange3 = getStat(nextLevelStats.range);
statsMenu.InfoField = "Upgrading will increase effectiveness of the stasis probe. Either increasing stasis effect or duration. Damage is minimal";
statsMenu.CostField = nextLevelStats.cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
} else if (selectedObject.probeType == WALL_PROBE) {
statsMenu.Field1 = "Probe Speed:";
statsMenu.Stat1 = selectedObject.speed;
statsMenu.Field2 = "Max HP:";
statsMenu.Stat2 = selectedObject.hpMax;
statsMenu.Field3 = "Mass:";
statsMenu.Stat3 = selectedObject.mass;
if (selectedObject.upgradeLevel < MAX_UPGRADE_LEVEL) {
nextLevelStats = wallProbeUpgradeStats[selectedObject.upgradeLevel];
statsMenu.StatChange1 = getStat(nextLevelStats.speed);
statsMenu.StatChange2 = getStat(nextLevelStats.hp);
statsMenu.StatChange3 = getStat(nextLevelStats.mass);
statsMenu.InfoField = "Upgrading will increase wall probe hit points as well as increase the mass of the probe.";
statsMenu.CostField = nextLevelStats.cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
} else if (selectedObject.objectType == OBJ_MAIN_SHIP) {
configureLaserBeamStats();
}
}
function configureGreenStats() {
statsMenu.clearAll();
if (selectedObject.objectType == OBJ_PROBE) {
if (selectedObject.onHit1Skill == ON_HIT_DEFLECT) {
configureDeflectShieldStats();
} else if (selectedObject.onHit1Skill == ON_HIT_FROST) {
configureFrostShieldStats();
} else if (selectedObject.onHit1Skill == ON_HIT_HEAT) {
configureHeatShieldStats();
} else if (selectedObject.onHit1Skill == ON_HIT_SPIKED) {
configureSpikedStats();
}
} else if (selectedObject.objectType == OBJ_MAIN_SHIP) {
configureBoostAllStats();
}
}
function configureYellowStats() {
statsMenu.clearAll();
if (selectedObject.objectType == OBJ_PROBE) {
if (selectedObject.onHit2Skill == ON_HIT_DEFLECT) {
configureDeflectShieldStats();
} else if (selectedObject.onHit2Skill == ON_HIT_FROST) {
configureFrostShieldStats();
} else if (selectedObject.onHit2Skill == ON_HIT_HEAT) {
} else if (selectedObject.onHit2Skill == ON_HIT_SPIKED) {
configureSpikedStats();
} else if (selectedObject.onHit2Skill == ON_HIT_LINKED) {
configureLinkStats();
} else if (selectedObject.onHit2Skill == ON_HIT_STRUCTURAL) {
configureStructuralStats();
}
} else if (selectedObject.objectType == OBJ_MAIN_SHIP) {
configureProtectShipStats();
}
}
function configureBlueStats() {
statsMenu.clearAll();
if (selectedObject.objectType == OBJ_PROBE) {
if (selectedObject.onHit3Skill == ON_HIT_DEFLECT) {
configureDeflectShieldStats();
} else if (selectedObject.onHit3Skill == ON_HIT_FROST) {
configureFrostShieldStats();
} else if (selectedObject.onHit3Skill == ON_HIT_HEAT) {
} else if (selectedObject.onHit3Skill == ON_HIT_SPIKED) {
configureSpikedStats();
} else if (selectedObject.onHit3Skill == ON_HIT_LINK) {
configureLinkStats();
} else if (selectedObject.onHit3Skill == ON_HIT_STRUCTURAL) {
configureStructuralStats();
}
} else if (selectedObject.objectType == OBJ_MAIN_SHIP) {
configureStasisShipStats();
}
}
function configureDeflectShieldStats() {
statsMenu.SkillName = "Deflection Shield";
statsMenu.Field1 = "Shield Power:";
statsMenu.Field2 = "Shield Range:";
statsMenu.Field3 = "Repulsion:";
if (selectedMenuButton.menuColor == "Green") {
if (selectedObject.onHit1Level > 0) {
statsMenu.Stat1 = selectedObject.onHit1Power;
statsMenu.Stat2 = selectedObject.onHit1Range;
statsMenu.Stat3 = selectedObject.onHit1K;
} else {
statsMenu.Stat1 = "-";
statsMenu.Stat2 = "-";
statsMenu.Stat3 = "-";
}
if (selectedObject.onHit1Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(deflectBurstUpgradeStats[selectedObject.onHit1Level].onHitPower);
statsMenu.StatChange2 = getStat(deflectBurstUpgradeStats[selectedObject.onHit1Level].onHitRange);
statsMenu.StatChange3 = getStat(deflectBurstUpgradeStats[selectedObject.onHit1Level].onHitK);
statsMenu.InfoField = "Upgrading will increase effectiveness of the deflection burst. Increasing damage, range and bounciness";
statsMenu.CostField = deflectBurstUpgradeStats[selectedObject.onHit1Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureFrostShieldStats() {
statsMenu.SkillName = "Stasis Shield";
statsMenu.Field1 = "Stasis Effect:";
statsMenu.Field2 = "Stasis Duration:";
statsMenu.Field3 = "Range";
if (selectedMenuButton.menuColor == "Green") {
if (selectedObject.onHit1Level > 0) {
statsMenu.Stat1 = selectedObject.onHit1SlowEffect;
statsMenu.Stat2 = selectedObject.onHit1ColdTime;
statsMenu.Stat3 = selectedObject.onHit1Range;
} else {
statsMenu.Stat1 = "-";
statsMenu.Stat2 = "-";
statsMenu.Stat3 = "-";
}
if (selectedObject.onHit1Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(frostBurstUpgradeStats[selectedObject.onHit1Level].onHit1SlowEffect);
statsMenu.StatChange2 = getStat(frostBurstUpgradeStats[selectedObject.onHit1Level].onHit1ColdTime);
statsMenu.StatChange3 = getStat(frostBurstUpgradeStats[selectedObject.onHit1Level].onHit1Range);
statsMenu.InfoField = "Upgrading will increase effectiveness of the stasis burst. Increasing stasis effect or duration. Damage is minimal";
statsMenu.CostField = frostBurstUpgradeStats[selectedObject.onHit1Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureHeatShieldStats() {
statsMenu.SkillName = "Heat Shield";
statsMenu.Field1 = "Shield Power:";
statsMenu.Field2 = "Shield Range:";
if (selectedMenuButton.menuColor == "Green") {
if (selectedObject.onHit1Level > 0) {
statsMenu.Stat1 = selectedObject.onHit1Power;
statsMenu.Stat2 = selectedObject.onHit1Range;
} else {
statsMenu.Stat1 = "-";
statsMenu.Stat2 = "-";
}
if (selectedObject.onHit1Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(heatBurstUpgradeStats[selectedObject.onHit1Level].onHitPower);
statsMenu.StatChange2 = getStat(heatBurstUpgradeStats[selectedObject.onHit1Level].onHitRange);
statsMenu.InfoField = "Upgrading will increase damage of the heat burst";
statsMenu.CostField = heatBurstUpgradeStats[selectedObject.onHit1Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureSpikedStats() {
statsMenu.SkillName = "Spiked Shell";
statsMenu.Field1 = "Spike Damage:";
statsMenu.Field2 = "Dmg Reduction:";
if (selectedMenuButton.menuColor == "Green") {
if (selectedObject.onHit1Level > 0) {
statsMenu.Stat1 = selectedObject.onHit1Power;
statsMenu.Stat2 = selectedObject.reduction;
} else {
statsMenu.Stat1 = "-";
statsMenu.Stat2 = selectedObject.reduction;
}
if (selectedObject.onHit1Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(spikedUpgradeStats[selectedObject.onHit1Level].onHitPower);
statsMenu.StatChange2 = getStat(spikedUpgradeStats[selectedObject.onHit1Level].reduction);
statsMenu.InfoField = "Upgrading will increase spike damage";
statsMenu.CostField = spikedUpgradeStats[selectedObject.onHit1Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
} else if (selectedMenuButton.menuColor == "Yellow") {
if (selectedObject.onHit2Level > 0) {
statsMenu.Stat1 = selectedObject.onHit2Power;
statsMenu.Stat2 = selectedObject.reduction;
} else {
statsMenu.Stat1 = "-";
statsMenu.Stat2 = selectedObject.reduction;
}
if (selectedObject.onHit2Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(spikedUpgradeStats[selectedObject.onHit2Level].onHitPower);
statsMenu.StatChange2 = getStat(spikedUpgradeStats[selectedObject.onHit2Level].reduction);
statsMenu.InfoField = "Upgrading will increase spike damage";
statsMenu.CostField = spikedUpgradeStats[selectedObject.onHit2Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureStructuralStats() {
statsMenu.SkillName = "Structure";
statsMenu.Field1 = "Max HP:";
statsMenu.Field2 = "HP Regen:";
statsMenu.Field3 = "Mass:";
if (selectedMenuButton.menuColor == "Yellow") {
statsMenu.Stat1 = selectedObject.hpMax;
statsMenu.Stat2 = selectedObject.hpRegen * fps;
statsMenu.Stat3 = selectedObject.mass;
if (selectedObject.onHit2Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(structuralUpgradeStats[selectedObject.onHit2Level].hp);
statsMenu.StatChange2 = getStat(structuralUpgradeStats[selectedObject.onHit2Level].hpRegen * fps);
statsMenu.StatChange3 = getStat(structuralUpgradeStats[selectedObject.onHit2Level].mass);
statsMenu.InfoField = "Upgrading will increase a combination of health, mass, regeneration and speed.";
statsMenu.CostField = structuralUpgradeStats[selectedObject.onHit2Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
} else if (selectedMenuButton.menuColor == "Blue") {
statsMenu.Stat1 = selectedObject.hpMax;
statsMenu.Stat2 = selectedObject.hpRegen * fps;
statsMenu.Stat3 = selectedObject.mass;
if (selectedObject.onHit3Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(structuralUpgradeStats[selectedObject.onHit3Level].hp);
statsMenu.StatChange2 = getStat(structuralUpgradeStats[selectedObject.onHit3Level].hpRegen * fps);
statsMenu.StatChange3 = getStat(structuralUpgradeStats[selectedObject.onHit3Level].mass);
statsMenu.InfoField = "Upgrading will increase a combination of health, mass, regeneration and speed.";
statsMenu.CostField = structuralUpgradeStats[selectedObject.onHit3Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureLinkStats() {
statsMenu.SkillName = "Ship Link";
statsMenu.Field1 = "Collision Xfer:";
if (selectedMenuButton.menuColor == "Blue") {
statsMenu.Stat1 = selectedObject.onHit3Power;
if (selectedObject.onHit3Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(linkUpgradeStats[selectedObject.onHit3Level].onHitPower);
statsMenu.InfoField = "Upgrading will link strength between probe and ship, increasing the energy transfered between.";
statsMenu.CostField = linkUpgradeStats[selectedObject.onHit3Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureLaserBeamStats() {
statsMenu.SkillName = "Laser Beam";
statsMenu.Field1 = "Power:";
statsMenu.ValueField = "-";
if (selectedMenuButton.menuColor == "Red") {
statsMenu.Stat1 = selectedObject.power;
if (selectedObject.upgradeLevel < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(laserBeamUpgradeStats[selectedObject.upgradeLevel].power);
statsMenu.InfoField = "Upgrading will increase damage output by the laser beam.";
statsMenu.CostField = laserBeamUpgradeStats[selectedObject.upgradeLevel].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureBoostAllStats() {
statsMenu.SkillName = "Recovery";
statsMenu.InfoField = "Use this skill to restore all probes";
statsMenu.ValueField = "-";
if (selectedMenuButton.menuColor == "Green") {
statsMenu.Stat1 = selectedObject.power;
if (selectedObject.upgradeLevel < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(laserBeamUpgradeStats[selectedObject.upgradeLevel].power);
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureProtectShipStats() {
statsMenu.SkillName = "Ship Bubble";
statsMenu.Field1 = "Power:";
statsMenu.Field2 = "Range:";
statsMenu.Field3 = "Deflect Power:";
statsMenu.ValueField = "-";
if (selectedMenuButton.menuColor == "Yellow") {
statsMenu.Stat1 = selectedObject.onHit2Power;
statsMenu.Stat2 = selectedObject.onHit2Range;
statsMenu.Stat3 = selectedObject.onHit2K;
if (selectedObject.onHit2Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(protectShipUpgradeStats[selectedObject.onHit2Level].onHitPower);
statsMenu.StatChange2 = getStat(protectShipUpgradeStats[selectedObject.onHit2Level].onHitRange);
statsMenu.StatChange3 = getStat(protectShipUpgradeStats[selectedObject.onHit2Level].onHitK);
statsMenu.InfoField = "Upgrading will increase protection, damage and range.";
statsMenu.CostField = protectShipUpgradeStats[selectedObject.onHit2Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function configureStasisShipStats() {
statsMenu.SkillName = "Ship Warp";
statsMenu.Field1 = "Range:";
statsMenu.Field2 = "Stasis Effect:";
statsMenu.Field3 = "Stasis Duration:";
statsMenu.ValueField = "-";
if (selectedMenuButton.menuColor == "Blue") {
statsMenu.Stat1 = selectedObject.onHit3Range;
statsMenu.Stat2 = selectedObject.slowEffect;
statsMenu.Stat3 = selectedObject.coldTime;
if (selectedObject.onHit3Level < MAX_ON_HIT_LEVEL) {
statsMenu.StatChange1 = getStat(stasisShipUpgradeStats[selectedObject.onHit3Level].onHitRange);
statsMenu.StatChange2 = getStat(stasisShipUpgradeStats[selectedObject.onHit3Level].slowEffect);
statsMenu.StatChange3 = getStat(stasisShipUpgradeStats[selectedObject.onHit3Level].coldTime);
statsMenu.InfoField = "Upgrading will increase effectiveness of stasis field.";
statsMenu.CostField = stasisShipUpgradeStats[selectedObject.onHit3Level].cost;
} else {
statsMenu.CostField = "";
upgradeProbeButton._y = OFFSCREEN_Y;
}
}
}
function createBackground() {
backgroundImage.onPress = function () {
unselectSelectedObject();
onMouseDownExtended();
};
backgroundImage.onRollOver = function () {
popupInfo = -1;
popupCountdown = POPUP_COUNTDOWN;
};
}
function createPopupInfo() {
popup = _root.attachMovie("InfoPopUpMC", "Popup1", depth--);
popup._x = 100;
popup._y = 100;
}
function createErrorPopup() {
errorPopup = _root.attachMovie("ErrorPopupMC", "ErrorPopup", depth--);
errorPopup._x = ERROR_POPUP_X;
errorPopup._y = OFFSCREEN_Y;
errorPopup.displayTime = 0;
}
function createMouseCursors() {
targetCrossHairs = _root.attachMovie("TargetCrossHairsMC", "TargetCrossHairs", depth--);
targetCrossHairs._x = OFFSCREEN_X;
targetCrossHairs._y = OFFSCREEN_Y;
normalCursor = _root.attachMovie("NormalCursorMC", "NormalCursor", depth--);
normalCursor._x = OFFSCREEN_X;
normalCursor._y = OFFSCREEN_Y;
mouseCursor = normalCursor;
}
function getStat(stat) {
if (stat >= 0) {
string = "+" + stat;
} else {
string = stat;
}
return(string);
}
init();
Frame 18
function init() {
CHAR_BOY_PILOT = 0;
CHAR_GIRL_PILOT = 1;
CHAR_BUTTEFACE = 2;
CHAR_COMMANDO = 3;
DIALOG_HEIGHT = 80;
DIALOG_SIDE_RIGHT = 0;
DIALOG_SIDE_LEFT = 1;
DIALOG_START_LEFT_X = 50;
DIALOG_START_Y = 100;
DIALOG_START_RIGHT_X = Stage.width - DIALOG_START_LEFT_X;
DIALOG_STATE_HIDDEN = 0;
DIALOG_STATE_PLAY_SHOW = 1;
DIALOG_STATE_END_SHOW = 2;
DIALOG_STATE_DISPLAY_TEXT = 7;
DIALOG_STATE_MOVING = 3;
DIALOG_STATE_PLAY_HIDE = 4;
DIALOG_STATE_END_HIDE = 5;
DIALOG_STATE_MOVE_BACK = 6;
DIALOG_TEXT_DELAY = 0;
DIALOG_PRESENT_DELAY = fps * 0.15;
}
function createDialogGroup() {
dialogPieces = _root.attachMovie("Variable", "DialogPieces", depth--);
dialogDepth = depth;
depth = depth - MAX_DIALOG_PIECES;
dialogPieces.dialogs = new Array();
oefi = 0;
while (oefi < MAX_DIALOG_PIECES) {
dialogPieces.dialogs[oefi] = -1;
oefi++;
}
dialogPieces.maxSize = MAX_DIALOG_PIECES;
dialogPieces.frontIndex = 0;
dialogPieces.backIndex = 0;
dialogPieces.dialogCount = 0;
dialogPieces.tmpDialog = -1;
dialogPieces.hideAll = function () {
oefi = 0;
while (oefi < MAX_DIALOG_PIECES) {
if (this.dialogs[oefi] != -1) {
this.dialogs[oefi].hideBack();
}
oefi++;
}
};
dialogPieces.displayDialog = function (presenter, dialog, side) {
this.shiftExisting();
playToggleSound();
if ((this.backIndex != this.frontIndex) || (this.dialogCount == 0)) {
if (side == DIALOG_SIDE_RIGHT) {
tmpDialog = _root.attachMovie("DialogRight1", "tmpDialog" + this.backIndex, dialogDepth - this.backIndex);
tmpDialog.picOffsetX = -41;
tmpDialog.picOffsetY = -34;
dialogX = DIALOG_START_RIGHT_X;
dialogY = DIALOG_START_Y;
} else if (side == DIALOG_SIDE_LEFT) {
tmpDialog = _root.attachMovie("DialogLeft1", "tmpDialog" + this.backIndex, dialogDepth - this.backIndex);
tmpDialog.picOffsetX = 38;
tmpDialog.picOffsetY = -34;
dialogX = DIALOG_START_LEFT_X;
dialogY = DIALOG_START_Y;
} else if (side == DIALOG_CENTER) {
tmpDialog = _root.attachMovie("DialogCenter1MC", "tmpDialog" + this.backIndex, dialogDepth - this.backIndex);
dialogX = 400;
dialogY = 400;
}
tmpDialog.presenter = getPresenterMC(presenter);
this.dialogCount++;
tmpDialog.shiftCount = 0;
initDialogPiece(tmpDialog);
tmpDialog.dialogText = dialog;
tmpDialog.displayNow(dialogX, dialogY);
this.dialogs[this.backIndex] = tmpDialog;
this.backIndex++;
if (this.backIndex >= this.maxSize) {
this.backIndex = 0;
}
tmpDialog.presenter._x = tmpDialog._x + tmpDialog.picOffsetX;
tmpDialog.presenter._y = tmpDialog._y + tmpDialog.picOffsetY;
}
};
dialogPieces.update = function () {
oefi = 0;
while (oefi < MAX_DIALOG_PIECES) {
if (this.dialogs[oefi] != -1) {
this.dialogs[oefi].move();
}
oefi++;
}
};
dialogPieces.shiftExisting = function () {
oefi = 0;
while (oefi < MAX_DIALOG_PIECES) {
if (this.dialogs[oefi] != -1) {
this.dialogs[oefi].shiftCount++;
if (this.dialogs[oefi].shiftCount >= 1) {
this.dialogCount--;
this.dialogs[oefi].hideBack();
this.dialogs[oefi] = -1;
this.frontIndex++;
if (this.frontIndex >= this.maxSize) {
this.frontIndex = 0;
}
} else {
this.dialogs[oefi].moveTo(this.dialogs[oefi].xTarget, this.dialogs[oefi].yTarget - DIALOG_HEIGHT, 8);
}
}
oefi++;
}
};
}
function initDialogPiece(dialogPiece) {
dialogPiece.gameState = DIALOG_STATE_HIDDEN;
dialogPiece.gotoAndStop("SHOW");
dialogPiece.textDelay = 0;
dialogPiece.counter = 0;
dialogPiece.lettersDisplayed = 0;
dialogPiece.presentDelay = 0;
dialogPiece.presentCountdown = 0;
dialogPiece.displayNow = function (xPos, yPos) {
this.displayAt(xPos, yPos, this.dialogText, this.presenter);
};
dialogPiece.displayAt = function (xPos, yPos, dialog, presenter) {
this.displayAtDef(xPos, yPos, dialog, presenter, DIALOG_TEXT_DELAY, DIALOG_PRESENT_DELAY);
};
dialogPiece.displayAtDef = function (xPos, yPos, dialog, presenter, textDelay, presentDelay) {
if (this.gameState == DIALOG_STATE_HIDDEN) {
this.TextLine = "";
this.textDelay = textDelay;
this.presentDelay = presentDelay;
this._x = xPos;
this._y = yPos;
this.xTarget = xPos;
this.yTarget = yPos;
this.dialogText = dialog;
this.guiNextState();
}
};
dialogPiece.moveTo = function (xTarget, yTarget, speed) {
this.TextLine = this.dialogText;
this.gotoAndStop("END_SHOW");
this.gameState = DIALOG_STATE_MOVING;
this.speed = speed;
this.xTarget = xTarget;
this.yTarget = yTarget;
this.move = function () {
if (this.gameState == DIALOG_STATE_MOVING) {
if (distance(this.xTarget, this.yTarget, this._x, this._y) < this.speed) {
this.guiNextState();
this.move = function () {
};
} else {
this.tmpDx = this.xTarget - this._x;
this.tmpDy = this.yTarget - this._y;
normalizeTmp(this, this);
this.dx = this.tmpDx * this.speed;
this.dy = this.tmpDy * this.speed;
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this.presenter._x = this._x + this.picOffsetX;
this.presenter._y = this._y + this.picOffsetY;
}
}
};
};
dialogPiece.hideBack = function () {
this.hideAddOns();
this.gameState = DIALOG_STATE_END_SHOW;
this.presenter._y = OFFSCREEN_Y;
this.guiNextState();
this.move = function () {
};
};
dialogPiece.comeInFrom = function (directionFrom, xy, speed) {
if (directionFrom == SCREEN_RIGHT) {
this.displayAt(PLAYABLE_WIDTH - this.definedWidth, xy, PLAYABLE_WIDTH, xy, speed);
}
};
dialogPiece.guiNextState = function () {
if (this.gameState == DIALOG_STATE_HIDDEN) {
this.gameState = DIALOG_STATE_PLAY_SHOW;
this.gotoAndPlay("PLAY_SHOW");
} else if (this.gameState == DIALOG_STATE_PLAY_SHOW) {
this.gameState = DIALOG_STATE_DISPLAY_TEXT;
this.lettersDisplayed = 0;
this.counter = 0;
this.presentCountdown = this.presentDelay;
this.move = function () {
if ((this.presentCountdown--) > 0) {
} else if (this.lettersDisplayed < this.dialogText.length) {
if ((this.counter++) >= this.textDelay) {
this.counter = 0;
this.lettersDisplayed++;
this.TextLine = substring(this.dialogText, 0, this.lettersDisplayed);
}
} else {
this.guiNextState();
}
};
} else if (this.gameState == DIALOG_STATE_DISPLAY_TEXT) {
this.TextLine = this.dialogText;
this.move = function () {
};
this.gameState = DIALOG_STATE_END_SHOW;
} else if (this.gameState == DIALOG_STATE_MOVING) {
this.gameState = DIALOG_STATE_END_SHOW;
} else if (this.gameState == DIALOG_STATE_END_SHOW) {
this.gameState = DIALOG_STATE_PLAY_HIDE;
this.gotoAndPlay("PLAY_HIDE");
} else if (this.gameState == DIALOG_STATE_PLAY_HIDE) {
this.gameState = DIALOG_STATE_END_HIDE;
this.guiNextState();
} else if (this.gameState == DIALOG_STATE_END_HIDE) {
this.gameState = DIALOG_STATE_HIDDEN;
this.gotoAndStop("HIDDEN");
this.removeMovieClip();
}
};
}
function getPresenterMC(presenter, index) {
if (presenter == CHAR_BOY_PILOT) {
return(boyPilot);
}
if (presenter == CHAR_GIRL_PILOT) {
return(girlPilot);
}
if (presenter == CHAR_BUTTEFACE) {
return(butteFace);
}
if (presenter == CHAR_COMMANDO) {
return(commandoFace);
}
}
function createPresenterIcons() {
boyPilot = _root.attachMovie("BoyPilotMC", "BoyPilotFace" + depth, depth--);
boyPilot._x = OFFSCREEN_X;
girlPilot = _root.attachMovie("GirlPilotMC", "GirlPilotFace" + depth, depth--);
girlPilot._x = OFFSCREEN_X;
butteFace = _root.attachMovie("ButtefaceMC", "ButteFaceFace" + depth, depth--);
butteFace._x = OFFSCREEN_X;
commandoFace = _root.attachMovie("CommandoMC", "CommandoFace" + depth, depth--);
commandoFace._x = OFFSCREEN_X;
}
init();
Frame 21
function init() {
}
function initInput() {
currentActions = _root.attachMovie("Variable", "currentActions", depth--);
prevActions = _root.attachMovie("Variable", "prevActions", depth--);
firstDownActions = _root.attachMovie("Variable", "firstDownActions", depth--);
currentActions.clear = function () {
clearKeys(this);
};
firstDownActions.clear = function () {
clearKeys(this);
};
prevActions.setInput = function (input) {
this.scrollProbes = input.scrollProbes;
this.toggleRangeDisplay = input.toggleRangeDisplay;
this.moveLeft = input.moveLeft;
this.moveRight = input.moveRight;
this.advance = input.advance;
this.cancelPressed = input.cancelPressed;
this.pausePressed = input.pausePressed;
this.debugPressed = input.debugPressed;
};
}
function clearKeys(keyboard) {
keyboard.scrollProbes = false;
keyboard.toggleRangeDisplay = false;
keyboard.moveLeft = false;
keyboard.moveRight = false;
keyboard.advance = false;
keyboard.cancelPressed = false;
keyboard.pausePressed = false;
keyboard.debugPressed = false;
}
function checkInput() {
prevActions.setInput(currentActions);
firstDownActions.clear();
currentActions.clear();
if (Key.isDown(37)) {
currentActions.moveLeft = true;
firstDownActions.moveLeft = false;
if (prevActions.moveLeft != true) {
firstDownActions.moveLeft = true;
}
}
if (Key.isDown(39)) {
currentActions.moveRight = true;
firstDownActions.moveRight = false;
if (prevActions.moveRight == false) {
firstDownActions.moveRight = true;
}
}
if (Key.isDown(9)) {
currentActions.scrollProbes = true;
firstDownActions.scrollProbes = false;
if (prevActions.scrollProbes == false) {
firstDownActions.scrollProbes = true;
}
}
if (Key.isDown(17)) {
currentActions.toggleRangeDisplay = true;
firstDownActions.toggleRangeDisplay = false;
if (prevActions.toggleRangeDisplay == false) {
firstDownActions.toggleRangeDisplay = true;
}
}
if (Key.isDown(27)) {
currentActions.cancelPressed = true;
firstDownActions.cancelPressed = false;
if (prevActions.cancelPressed == false) {
firstDownActions.cancelPressed = true;
}
}
if (Key.isDown(32)) {
currentActions.advance = true;
firstDownActions.advance = false;
if (prevActions.advance == false) {
firstDownActions.advance = true;
}
}
if (Key.isDown(13)) {
currentActions.charging = true;
firstDownActions.advance = false;
if (prevActions.advance == false) {
firstDownActions.advance = true;
}
}
if (Key.isDown(36)) {
currentActions.pausePressed = true;
firstDownActions.pausePressed = false;
if (prevActions.pausePressed == false) {
firstDownActions.pausePressed = true;
}
}
if (Key.isDown(46)) {
currentActions.debugPressed = true;
firstDownActions.debugPressed = false;
if (prevActions.debugPressed == false) {
firstDownActions.debugPressed = true;
}
}
}
init();
Frame 24
function init() {
DEPTH_SEED = 888888 /* 0x0D9038 */;
depth = DEPTH_SEED;
OFFSCREEN_X = -1000;
OFFSCREEN_Y = -1000;
ZERO = 1E-5;
fpsInMilli = 1000 / fps;
currentTime = getTimer();
fpsChecker = 0;
}
function throttled() {
this.lastTime = this.currentTime;
this.currentTime = getTimer();
differenceTime = this.currentTime - this.lastTime;
this.fpsChecker = this.fpsChecker + differenceTime;
if (this.fpsChecker >= fpsInMilli) {
this.fpsChecker = this.fpsChecker % fpsInMilli;
return(false);
}
return(true);
}
function createTypelessGroup(myName, instanceName, maxSize) {
group = _root.attachMovie("Variable", instanceName, depth--);
group.myName = myName;
group.openPointer = 0;
group.fillPointer = 0;
group.maxSize = maxSize;
group.objects = new Array();
group.deadObjects = new Array();
group._x = OFFSCREEN_X;
i = 0;
while (i < group.maxSize) {
group.deadObjects[i] = i;
group.objects[i] = -1;
i++;
}
group.getNextIndex = function () {
myNextValue = this.deadObjects[this.openPointer];
return(myNextValue);
};
group.addObject = function (currentObj) {
this.nextIndex = this.getNextIndex();
if (this.nextIndex > -1) {
this.objects[this.nextIndex] = currentObj;
currentObj.indexValue = this.nextIndex;
this.deadObjects[this.openPointer] = -1;
this.openPointer++;
if (this.openPointer >= this.maxSize) {
this.openPointer = 0;
}
return(0);
}
return(-1);
};
group.killObject = function (index) {
if (this.objects[index] != -1) {
this.deadObjects[this.fillPointer] = index;
this.fillPointer++;
if (this.fillPointer >= this.maxSize) {
this.fillPointer = 0;
}
this.objects[index].removeMovieClip();
this.objects[index] = -1;
}
};
group.killObjectDontRemove = function (index) {
if (this.objects[index] != -1) {
this.deadObjects[this.fillPointer] = index;
this.fillPointer++;
if (this.fillPointer >= this.maxSize) {
this.fillPointer = 0;
}
this.objects[index] = -1;
}
};
group.debug = function () {
i = 0;
while (i < this.maxSize) {
i++;
}
};
group.killAll = function () {
i = 0;
while (i < this.maxSize) {
this.killObject(i);
i++;
}
};
group.killAllDontRemove = function () {
i = 0;
while (i < this.maxSize) {
this.killObjectDontRemove(i);
i++;
}
};
return(group);
}
function createGroup(myName, spriteName, instanceName, maxSize) {
group = _root.attachMovie("Variable", instanceName, depth--);
group.myName = myName;
group.openPointer = 0;
group.fillPointer = 0;
group.maxSize = maxSize;
group.objects = new Array();
group.deadObjects = new Array();
group._x = OFFSCREEN_X;
i = 0;
while (i < group.maxSize) {
group.deadObjects[i] = i;
group.objects[i] = _root.attachMovie(spriteName, instanceName + i, depth--);
group.objects[i]._x = OFFSCREEN_X;
group.objects[i]._y = OFFSCREEN_Y;
group.objects[i].alive = false;
group.objects[i].index = i;
i++;
}
group.getNextIndex = function () {
if (this.deadObjects[this.openPointer] != -1) {
return(this.deadObjects[this.openPointer]);
}
return(-1);
};
group.getNext = function () {
currentObj = -1;
this.nextIndex = this.getNextIndex();
if (this.nextIndex > -1) {
currentObj = this.objects[this.nextIndex];
this.deadObjects[this.openPointer] = -1;
this.openPointer++;
if (this.openPointer >= this.maxSize) {
this.openPointer = 0;
}
}
return(currentObj);
};
group.killObject = function (index) {
if (this.objects[index].alive == true) {
this.deadObjects[this.fillPointer] = index;
this.fillPointer++;
if (this.fillPointer >= this.maxSize) {
this.fillPointer = 0;
}
this.objects[index].alive = false;
this.objects[index]._x = OFFSCREEN_X;
this.objects[index]._y = OFFSCREEN_Y;
}
};
group.debug = function () {
i = 0;
while (i < this.maxSize) {
i++;
}
};
return(group);
}
function createRotatingGroup(myName, spriteName, instanceName, maxSize, numVariations) {
group = _root.attachMovie("Variable", instanceName, depth--);
group.myName = myName;
group.openPointer = 0;
group.fillPointer = 0;
group.maxSize = maxSize;
group.objects = new Array();
group.deadObjects = new Array();
group._x = OFFSCREEN_X;
tmpVar = 0;
i = 0;
while (i < group.maxSize) {
group.deadObjects[i] = i;
tmpVar++;
if (tmpVar > numVariations) {
tmpVar = 1;
}
group.objects[i] = _root.attachMovie(((spriteName + "") + tmpVar) + "MC", instanceName + i, depth--);
group.objects[i]._x = OFFSCREEN_X;
group.objects[i]._y = OFFSCREEN_Y;
group.objects[i].alive = false;
group.objects[i].index = i;
i++;
}
group.getNextIndex = function () {
if (this.deadObjects[this.openPointer] != -1) {
return(this.deadObjects[this.openPointer]);
}
return(-1);
};
group.getNext = function () {
currentObj = -1;
this.nextIndex = this.getNextIndex();
if (this.nextIndex > -1) {
currentObj = this.objects[this.nextIndex];
this.deadObjects[this.openPointer] = -1;
this.openPointer++;
if (this.openPointer >= this.maxSize) {
this.openPointer = 0;
}
}
return(currentObj);
};
group.killObject = function (index) {
if (this.objects[index].alive == true) {
this.deadObjects[this.fillPointer] = index;
this.fillPointer++;
if (this.fillPointer >= this.maxSize) {
this.fillPointer = 0;
}
this.objects[index].alive = false;
this.objects[index]._x = OFFSCREEN_X;
this.objects[index]._y = OFFSCREEN_Y;
}
};
group.debug = function () {
i = 0;
while (i < this.maxSize) {
i++;
}
};
return(group);
}
function createGrouping(myName, maxSize) {
group = _root.attachMovie("Variable", myName, depth--);
group.myName = myName;
group.openPointer = 0;
group.maxSize = maxSize;
group.objects = new Array();
group._x = OFFSCREEN_X;
i = 0;
while (i < group.maxSize) {
group.objects[i] = -1;
i++;
}
group.addObject = function (object) {
if (this.openPointer < this.maxSize) {
this.objects[this.openPointer] = object;
this.openPointer++;
return(0);
}
return(-1);
};
group.clearAll = function () {
i = this.openPointer;
while (i >= 0) {
this.objects[i] = -1;
i--;
}
this.openPointer = 0;
};
group.debug = function () {
i = 0;
while (i < this.maxSize) {
i++;
}
};
return(group);
}
init();
Frame 28
function orbitStep() {
this.orbitAngle = this.orbitAngle + this.orbitAngleIncrementor;
if (this.orbitAngle >= 360) {
this.orbitAngle = this.orbitAngle - 360;
}
this.tmpDx = this.gameTarget._x + (this.gameTarget.orbitRadius * Math.cos(this.orbitAngle * DEG_TO_RAD));
this.tmpDy = this.gameTarget._y + (this.gameTarget.orbitRadius * Math.sin(this.orbitAngle * DEG_TO_RAD));
this.tmpDx = this.tmpDx - this._x;
this.tmpDy = this.tmpDy - this._y;
normalizeTmp(this, this);
this.tmpDx = this.tmpDx * this.speed;
this.tmpDy = this.tmpDy * this.speed;
if (magnitude(this) < this.speed) {
this.ax = this.ax + this.tmpDx;
this.ay = this.ay + this.tmpDy;
}
}
function orbitCenterMove() {
this.dx = this.dx * 0.9;
this.dy = this.dy * 0.9;
this.dx = this.dx + this.ax;
this.dy = this.dy + this.ay;
if (magnitudeSquared(this) > TERMINAL_VELOCITY_SQ) {
normalize(this);
this.dx = this.dx * TERMINAL_VELOCITY;
this.dy = this.dy * TERMINAL_VELOCITY;
}
if (this.slowTime > 0) {
this.slowTime--;
this.dx = this.dx * this.slowPercentage;
this.dy = this.dy * this.slowPercentage;
}
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this.orbit1._x = this.orbit1._x + this.dx;
this.orbit1._y = this.orbit1._y + this.dy;
this.orbit2._x = this.orbit2._x + this.dx;
this.orbit2._y = this.orbit2._y + this.dy;
this.orbit3._x = this.orbit3._x + this.dx;
this.orbit3._y = this.orbit3._y + this.dy;
this.orbit4._x = this.orbit4._x + this.dx;
this.orbit4._y = this.orbit4._y + this.dy;
this.orbit5._x = this.orbit5._x + this.dx;
this.orbit5._y = this.orbit5._y + this.dy;
this.ax = 0;
this.ay = 0;
}
function slowObject(percentage, slowTime) {
this.slowPercentage = 1 - percentage;
this.slowTime = slowTime * fps;
}
function basicAsteroidMoveBack() {
this._x = this.oldX;
this._y = this.oldY;
}
function basicAsteroidMove() {
this.dx = this.dx * 0.9;
this.dy = this.dy * 0.9;
this.dx = this.dx + this.ax;
this.dy = this.dy + this.ay;
if (magnitudeSquared(this) > TERMINAL_VELOCITY_SQ) {
normalizeSpecial(this);
this.dx = this.dx * TERMINAL_VELOCITY;
this.dy = this.dy * TERMINAL_VELOCITY;
}
if (this.slowTime > 0) {
this.slowTime--;
this.dx = this.dx * this.slowPercentage;
this.dy = this.dy * this.slowPercentage;
}
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this.ax = 0;
this.ay = 0;
}
function basicAsteroidStep() {
this.oldX = this._x;
this.oldY = this._y;
if ((this.stepCounter--) < 0) {
this.stepCounter = 15;
if (this.gameTarget.gameState == PS_DISCHARGED) {
this.gameTarget = mainShip;
}
this.tmpDx = this.gameTarget._x - this._x;
this.tmpDy = this.gameTarget._y - this._y;
normalizeTmp(this, this);
this.tmpDx = this.tmpDx * this.speed;
this.tmpDy = this.tmpDy * this.speed;
if (isNaN(this.dx)) {
this.dx = 0;
this.gameTarget = mainShip;
}
if (isNaN(this.dy)) {
this.dy = 0;
this.gameTarget = mainShip;
}
}
if (magnitudeSquared(this) < this.speedSquared) {
this.ax = this.ax + this.tmpDx;
this.ay = this.ay + this.tmpDy;
}
}
function basicMove() {
this.dx = this.dx * 0.85;
this.dy = this.dy * 0.85;
this.dx = this.dx + this.ax;
this.dy = this.dy + this.ay;
if (magnitudeSquared(this) > this.terminalVelocitySq) {
normalize(this);
this.dx = this.dx * this.terminalVelocity;
this.dy = this.dy * this.terminalVelocity;
}
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this.ax = 0;
this.ay = 0;
}
function straightLineStep() {
this.at++;
if (this.at > this.ttl) {
this.killObject();
} else {
this.ax = this.ax + this.tmpDx;
this.ay = this.ay + this.tmpDy;
}
return(false);
}
function heatSeekingStep() {
this.at++;
if (this.at > this.ttl) {
this.killObject();
return(true);
}
if ((this.gameTarget == -1) || (this.gameTarget.alive == false)) {
this.gameTarget = -1;
this.ax = this.ax + this.tmpDx;
this.ay = this.ay + this.tmpDy;
} else {
if ((this.stepCounter--) < 0) {
this.stepCounter = 8;
this.tmpDx = this.gameTarget._x - this._x;
this.tmpDy = this.gameTarget._y - this._y;
normalizeTmp(this, this);
if (this.tmpDx < 0) {
this._rotation = Math.acos(this.tmpDy) * RAD_TO_DEG;
} else {
this._rotation = -(Math.acos(this.tmpDy) * RAD_TO_DEG);
}
this.tmpDx = this.tmpDx * this.speed;
this.tmpDy = this.tmpDy * this.speed;
if (isNaN(this.dx)) {
this.dx = 0;
}
if (isNaN(this.dy)) {
this.dy = 0;
}
}
this.ax = this.ax + this.tmpDx;
this.ay = this.ay + this.tmpDy;
}
return(false);
}
Frame 29
function init() {
OBJ_PROBE = 0;
OBJ_MAIN_SHIP = 1;
OBJ_PROJECTILE = 2;
OBJ_ENEMY = 3;
KT_COUNT = 0;
ACT_TYPE_DISP_DIALOG = 0;
TERMINAL_VELOCITY = 20;
TERMINAL_VELOCITY_SQ = TERMINAL_VELOCITY * TERMINAL_VELOCITY;
NOT_TRUE_ENEMY = -1;
ERS_IN_ORDER = 0;
ERS_RANDOM = 1;
ERS_SPORADIC = 2;
ERP_ANY = 0;
ERP_LEFT_SIDE = 1;
ERP_RIGHT_SIDE = 2;
ERP_BOTTOM = 3;
ERP_TOP = 4;
ERP_CIRCULAR = 5;
ERP_TOP_CIRCULAR = 6;
ERP_TOP_SHEET = 8;
ERP_SPECIAL1 = 7;
ERP_MARCH = 9;
WC_TOTAL_LEVEL_KILLS = 0;
WC_SAME_LEVEL_KILLS = 1;
WC_FRAMES_ELAPSED = 2;
WC_ALL_CLEAR = 3;
PURPLE_ASTEROID = 0;
YELLOW_ASTEROID = 1;
RED_ASTEROID = 2;
GREEN_ASTEROID = 4;
ORANGE_ASTEROID = 5;
GRAY_ASTEROID = 6;
SPLITTER = 7;
BOMB_BOT = 8;
EXPLODER_ASTEROID = 10;
PINK_ASTEROID = 11;
PLANET_ASTEROID = 14;
AIR_FLEET = 15;
COMMANDO = 16;
INS_SET_NONE = 0;
INS_SET_S_MARCH = 1;
INS_SET_Z_MARCH = 2;
INS_SET_AIR_FLEET_MARCH = 3;
INS_SET_COMMANDO_MARCH = 4;
INS_SET_DUCK_MARCH = 5;
INS_SET_WHIRLWIND = 6;
INS_SET_BOMB_BOT_MARCH = 7;
INS_SET_BOMB_BOT_MARCH_2 = 8;
MASS1 = 1;
MASS2 = 2;
MASS3 = 3;
MASS4 = 4;
MASS5 = 5;
MASS6 = 6;
MASS7 = 7;
MASS8 = 8;
MASS9 = 9;
MASS10 = 10;
HP1 = 350;
HP2 = 600;
HP3 = 800;
HP4 = 1100;
HP5 = 1500;
HP6 = 2000;
HP7 = 2300;
HP8 = 2500;
HP9 = 5000;
HP10 = 7000;
HP15 = 12500;
HPPLANET = 80000 /* 0x013880 */;
SPEED1 = 1.25;
SPEED2 = 2;
SPEED3 = 3;
SPEED4 = 4;
SPEED5 = 5;
LVL1_TOTAL_MONEY = 1500;
LVL2_TOTAL_MONEY = LVL1_TOTAL_MONEY + 500;
LVL3_TOTAL_MONEY = LVL2_TOTAL_MONEY + 500;
LVL4_TOTAL_MONEY = LVL3_TOTAL_MONEY + 500;
LVL5_TOTAL_MONEY = LVL4_TOTAL_MONEY + 500;
LVL6_TOTAL_MONEY = LVL5_TOTAL_MONEY + 500;
LVL7_TOTAL_MONEY = LVL6_TOTAL_MONEY + 500;
LVL8_TOTAL_MONEY = LVL7_TOTAL_MONEY + 500;
LVL9_TOTAL_MONEY = LVL8_TOTAL_MONEY + 500;
LVL10_TOTAL_MONEY = LVL9_TOTAL_MONEY + 500;
LVL11_TOTAL_MONEY = LVL10_TOTAL_MONEY + 500;
LVL12_TOTAL_MONEY = LVL11_TOTAL_MONEY + 500;
LVL13_TOTAL_MONEY = LVL12_TOTAL_MONEY + 500;
LVL14_TOTAL_MONEY = LVL13_TOTAL_MONEY + 500;
LVL15_TOTAL_MONEY = LVL14_TOTAL_MONEY + 500;
LVL16_TOTAL_MONEY = LVL15_TOTAL_MONEY + 500;
LVL17_TOTAL_MONEY = LVL16_TOTAL_MONEY + 500;
LVL18_TOTAL_MONEY = LVL17_TOTAL_MONEY + 500;
LVL19_TOTAL_MONEY = LVL18_TOTAL_MONEY + 500;
LVL20_TOTAL_MONEY = LVL19_TOTAL_MONEY + 500;
LVL21_TOTAL_MONEY = LVL20_TOTAL_MONEY + 500;
LVL22_TOTAL_MONEY = LVL21_TOTAL_MONEY + 500;
LVL23_TOTAL_MONEY = LVL22_TOTAL_MONEY + 500;
LVL24_TOTAL_MONEY = LVL23_TOTAL_MONEY + 500;
LVL25_TOTAL_MONEY = LVL24_TOTAL_MONEY + 500;
LVL26_TOTAL_MONEY = LVL25_TOTAL_MONEY + 500;
LVL27_TOTAL_MONEY = LVL26_TOTAL_MONEY + 500;
LVL28_TOTAL_MONEY = LVL27_TOTAL_MONEY + 500;
LVL29_TOTAL_MONEY = LVL28_TOTAL_MONEY + 500;
LVL30_TOTAL_MONEY = LVL29_TOTAL_MONEY + 500;
LVL31_TOTAL_MONEY = LVL30_TOTAL_MONEY + 500;
LVL32_TOTAL_MONEY = LVL31_TOTAL_MONEY + 500;
LVL33_TOTAL_MONEY = LVL32_TOTAL_MONEY + 500;
LVL34_TOTAL_MONEY = LVL33_TOTAL_MONEY + 500;
LVL35_TOTAL_MONEY = LVL34_TOTAL_MONEY + 500;
LVL36_TOTAL_MONEY = LVL35_TOTAL_MONEY + 500;
LVL37_TOTAL_MONEY = LVL36_TOTAL_MONEY + 500;
LVL38_TOTAL_MONEY = LVL37_TOTAL_MONEY + 500;
LVL39_TOTAL_MONEY = LVL38_TOTAL_MONEY + 500;
LVL40_TOTAL_MONEY = LVL39_TOTAL_MONEY + 500;
LVL1_AMT = 12;
LVL1_SPEED = SPEED1;
LVL1_K = 1;
LVL1_MASS = MASS1;
LVL1_HP = HP1;
LVL1_RELEASE_SPEED = fps * 1.25;
LVL1_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL1_WIN_CONDITION = WC_ALL_CLEAR;
LVL1_WIN_CONDITION_VAR = LVL1_AMT;
LVL1_RELEASE_ANGLE_INCREMENT = 14;
LVL1_CURRENT_RELEASE_ANGLE = 0;
LVL1_RELEASE_POINT = ERP_TOP;
LVL1_COUNTDOWN = 15;
LVL1_POWER = 5;
LVL1_MONEY_BONUS = 525 - LVL1_AMT;
LVL2_AMT = 25;
LVL2_SPEED = SPEED1;
LVL2_K = 1;
LVL2_MASS = MASS1;
LVL2_HP = HP1;
LVL2_RELEASE_SPEED = fps * 0.7;
LVL2_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL2_WIN_CONDITION = WC_ALL_CLEAR;
LVL2_WIN_CONDITION_VAR = LVL2_AMT;
LVL2_RELEASE_ANGLE_INCREMENT = 14;
LVL2_CURRENT_RELEASE_ANGLE = 90;
LVL2_RELEASE_POINT = ERP_TOP;
LVL2_COUNTDOWN = 15;
LVL2_POWER = 5;
LVL2_MONEY_BONUS = 525 - LVL2_AMT;
LVL3_AMT = 20;
LVL3_SPEED = SPEED3;
LVL3_K = 1;
LVL3_MASS = MASS1;
LVL3_HP = HP1;
LVL3_RELEASE_SPEED = fps;
LVL3_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL3_WIN_CONDITION = WC_ALL_CLEAR;
LVL3_WIN_CONDITION_VAR = LVL3_AMT;
LVL3_RELEASE_ANGLE_INCREMENT = 44;
LVL3_CURRENT_RELEASE_ANGLE = 90;
LVL3_RELEASE_POINT = ERP_TOP;
LVL3_COUNTDOWN = 15;
LVL3_POWER = 5;
LVL3_MONEY_BONUS = 525 - LVL3_AMT;
LVL4_AMT = 20;
LVL4_SPEED = SPEED3;
LVL4_K = 1;
LVL4_MASS = MASS1;
LVL4_HP = HP1;
LVL4_RELEASE_SPEED = fps * 0.6;
LVL4_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL4_WIN_CONDITION = WC_ALL_CLEAR;
LVL4_WIN_CONDITION_VAR = LVL4_AMT;
LVL4_RELEASE_ANGLE_INCREMENT = 44;
LVL4_CURRENT_RELEASE_ANGLE = 90;
LVL4_RELEASE_POINT = ERP_TOP;
LVL4_COUNTDOWN = 15;
LVL4_POWER = 5;
LVL4_MONEY_BONUS = 525 - LVL4_AMT;
LVL5_AMT = 5;
LVL5_SPEED = SPEED1;
LVL5_K = 1;
LVL5_MASS = MASS4;
LVL5_HP = HP5;
LVL5_RELEASE_SPEED = fps * 4;
LVL5_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL5_WIN_CONDITION = WC_ALL_CLEAR;
LVL5_WIN_CONDITION_VAR = LVL5_AMT;
LVL5_RELEASE_ANGLE_INCREMENT = 90;
LVL5_CURRENT_RELEASE_ANGLE = 0;
LVL5_RELEASE_POINT = ERP_TOP;
LVL5_COUNTDOWN = 15;
LVL5_POWER = 10;
LVL5_MONEY_BONUS = 525 - LVL5_AMT;
LVL6_AMT = 25;
LVL6_SPEED = SPEED2;
LVL6_K = 1;
LVL6_MASS = MASS1;
LVL6_HP = HP2;
LVL6_RELEASE_SPEED = fps * 0.8;
LVL6_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL6_WIN_CONDITION = WC_ALL_CLEAR;
LVL6_WIN_CONDITION_VAR = LVL6_AMT;
LVL6_RELEASE_ANGLE_INCREMENT = 44;
LVL6_CURRENT_RELEASE_ANGLE = 0;
LVL6_RELEASE_POINT = ERP_TOP;
LVL6_COUNTDOWN = 15;
LVL6_POWER = 10;
LVL6_MONEY_BONUS = 525 - LVL6_AMT;
LVL7_AMT = 25;
LVL7_SPEED = SPEED2;
LVL7_K = 1;
LVL7_MASS = MASS1;
LVL7_HP = HP2;
LVL7_RELEASE_SPEED = fps * 0.6;
LVL7_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL7_WIN_CONDITION = WC_ALL_CLEAR;
LVL7_WIN_CONDITION_VAR = LVL7_AMT;
LVL7_RELEASE_ANGLE_INCREMENT = 90;
LVL7_CURRENT_RELEASE_ANGLE = 0;
LVL7_RELEASE_POINT = ERP_TOP;
LVL7_COUNTDOWN = 15;
LVL7_POWER = 10;
LVL7_MONEY_BONUS = 525 - LVL7_AMT;
LVL8_AMT = 25;
LVL8_SPEED = SPEED3;
LVL8_K = 1;
LVL8_MASS = MASS2;
LVL8_HP = HP2;
LVL8_RELEASE_SPEED = fps * 0.8;
LVL8_RELEASE_STRATEGY = ERS_SPORADIC;
LVL8_WIN_CONDITION = WC_ALL_CLEAR;
LVL8_WIN_CONDITION_VAR = LVL8_AMT;
LVL8_RELEASE_ANGLE_INCREMENT = 90;
LVL8_CURRENT_RELEASE_ANGLE = 0;
LVL8_RELEASE_POINT = ERP_TOP;
LVL8_COUNTDOWN = 15;
LVL8_POWER = 10;
LVL8_MONEY_BONUS = 525 - LVL8_AMT;
LVL9_AMT = 25;
LVL9_SPEED = SPEED3;
LVL9_K = 0.5;
LVL9_MASS = MASS2;
LVL9_HP = HP2;
LVL9_RELEASE_SPEED = fps * 0.6;
LVL9_RELEASE_STRATEGY = ERS_SPORADIC;
LVL9_WIN_CONDITION = WC_ALL_CLEAR;
LVL9_WIN_CONDITION_VAR = LVL9_AMT;
LVL9_RELEASE_ANGLE_INCREMENT = 90;
LVL9_CURRENT_RELEASE_ANGLE = 0;
LVL9_RELEASE_POINT = ERP_TOP;
LVL9_COUNTDOWN = 15;
LVL9_POWER = 10;
LVL9_MONEY_BONUS = 525 - LVL9_AMT;
LVL10_AMT = 85;
LVL10_SPEED = SPEED2;
LVL10_K = 0.5;
LVL10_MASS = MASS1;
LVL10_HP = HP2;
LVL10_RELEASE_SPEED = fps * 0.25;
LVL10_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL10_WIN_CONDITION = WC_ALL_CLEAR;
LVL10_WIN_CONDITION_VAR = LVL10_AMT;
LVL10_RELEASE_ANGLE_INCREMENT = 90;
LVL10_CURRENT_RELEASE_ANGLE = 0;
LVL10_RELEASE_POINT = ERP_SPECIAL1;
LVL10_COUNTDOWN = 15;
LVL10_POWER = 10;
LVL10_MONEY_BONUS = 525 - LVL10_AMT;
LVL11_AMT = 8;
LVL11_SPEED = SPEED2;
LVL11_K = 0.5;
LVL11_MASS = MASS4;
LVL11_HP = HP6;
LVL11_RELEASE_SPEED = fps * 3.5;
LVL11_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL11_WIN_CONDITION = WC_ALL_CLEAR;
LVL11_WIN_CONDITION_VAR = LVL11_AMT;
LVL11_RELEASE_ANGLE_INCREMENT = 90;
LVL11_CURRENT_RELEASE_ANGLE = 0;
LVL11_RELEASE_POINT = ERP_TOP;
LVL11_COUNTDOWN = 15;
LVL11_POWER = 15;
LVL11_MONEY_BONUS = 525 - LVL11_AMT;
LVL12_AMT = 15;
LVL12_SPEED = SPEED3;
LVL12_K = 0.5;
LVL12_MASS = MASS2;
LVL12_HP = HP2;
LVL12_RELEASE_SPEED = fps * 1;
LVL12_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL12_WIN_CONDITION = WC_ALL_CLEAR;
LVL12_WIN_CONDITION_VAR = LVL12_AMT;
LVL12_RELEASE_ANGLE_INCREMENT = 90;
LVL12_CURRENT_RELEASE_ANGLE = 0;
LVL12_RELEASE_POINT = ERP_TOP;
LVL12_COUNTDOWN = 15;
LVL12_POWER = 15;
LVL12_MONEY_BONUS = 525 - LVL12_AMT;
LVL13_AMT = 30;
LVL13_SPEED = SPEED4;
LVL13_K = 0.5;
LVL13_MASS = MASS2;
LVL13_HP = HP3;
LVL13_RELEASE_SPEED = fps * 0.6;
LVL13_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL13_WIN_CONDITION = WC_ALL_CLEAR;
LVL13_WIN_CONDITION_VAR = LVL13_AMT;
LVL13_RELEASE_ANGLE_INCREMENT = 90;
LVL13_CURRENT_RELEASE_ANGLE = 0;
LVL13_RELEASE_POINT = ERP_TOP;
LVL13_COUNTDOWN = 15;
LVL13_POWER = 15;
LVL13_MONEY_BONUS = 525 - LVL13_AMT;
LVL14_AMT = 30;
LVL14_SPEED = SPEED3;
LVL14_K = 0.5;
LVL14_MASS = MASS2;
LVL14_HP = HP4;
LVL14_RELEASE_SPEED = fps * 0.8;
LVL14_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL14_WIN_CONDITION = WC_ALL_CLEAR;
LVL14_WIN_CONDITION_VAR = LVL14_AMT;
LVL14_RELEASE_ANGLE_INCREMENT = 90;
LVL14_CURRENT_RELEASE_ANGLE = 0;
LVL14_RELEASE_POINT = ERP_TOP;
LVL14_COUNTDOWN = 15;
LVL14_POWER = 10;
LVL14_MONEY_BONUS = 525 - LVL14_AMT;
LVL15_AMT = 40;
LVL15_SPEED = SPEED2;
LVL15_K = 0.5;
LVL15_MASS = MASS2;
LVL15_HP = HP4;
LVL15_RELEASE_SPEED = fps * 0.25;
LVL15_RELEASE_STRATEGY = ERS_SPORADIC;
LVL15_WIN_CONDITION = WC_ALL_CLEAR;
LVL15_WIN_CONDITION_VAR = LVL15_AMT;
LVL15_RELEASE_ANGLE_INCREMENT = 90;
LVL15_CURRENT_RELEASE_ANGLE = 0;
LVL15_RELEASE_POINT = ERP_SPECIAL1;
LVL15_COUNTDOWN = 15;
LVL15_POWER = 15;
LVL15_MONEY_BONUS = 525 - LVL15_AMT;
LVL15A_AMT = 40;
LVL15A_SPEED = SPEED3;
LVL15A_K = 0.5;
LVL15A_MASS = MASS2;
LVL15A_HP = HP4;
LVL15A_RELEASE_SPEED = fps * 0.25;
LVL15A_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL15A_WIN_CONDITION = WC_ALL_CLEAR;
LVL15A_WIN_CONDITION_VAR = LVL15A_AMT;
LVL15A_RELEASE_ANGLE_INCREMENT = 90;
LVL15A_CURRENT_RELEASE_ANGLE = 0;
LVL15A_RELEASE_POINT = ERP_SPECIAL1;
LVL15A_COUNTDOWN = 15;
LVL15A_POWER = 5;
LVL16_AMT = 35;
LVL16_SPEED = SPEED1;
LVL16_K = 0.5;
LVL16_MASS = MASS3;
LVL16_HP = HP4;
LVL16_RELEASE_SPEED = fps * 0.6;
LVL16_RELEASE_STRATEGY = ERS_SPORADIC;
LVL16_WIN_CONDITION = WC_ALL_CLEAR;
LVL16_WIN_CONDITION_VAR = LVL11_AMT;
LVL16_RELEASE_ANGLE_INCREMENT = 90;
LVL16_CURRENT_RELEASE_ANGLE = 0;
LVL16_RELEASE_POINT = ERP_TOP;
LVL16_COUNTDOWN = 15;
LVL16_POWER = 20;
LVL16_MONEY_BONUS = 525 - LVL16_AMT;
LVL17_AMT = 30;
LVL17_SPEED = SPEED4;
LVL17_K = 0.5;
LVL17_MASS = MASS3;
LVL17_HP = HP4;
LVL17_RELEASE_SPEED = fps * 0.6;
LVL17_RELEASE_STRATEGY = ERS_SPORADIC;
LVL17_WIN_CONDITION = WC_ALL_CLEAR;
LVL17_WIN_CONDITION_VAR = LVL17_AMT;
LVL17_RELEASE_ANGLE_INCREMENT = 90;
LVL17_CURRENT_RELEASE_ANGLE = 0;
LVL17_RELEASE_POINT = ERP_TOP;
LVL17_COUNTDOWN = 15;
LVL17_POWER = 20;
LVL17_MONEY_BONUS = 525 - LVL17_AMT;
LVL18_AMT = 30;
LVL18_SPEED = SPEED3;
LVL18_K = 1;
LVL18_MASS = MASS3;
LVL18_HP = HP4;
LVL18_RELEASE_SPEED = fps * 0.6;
LVL18_RELEASE_STRATEGY = ERS_SPORADIC;
LVL18_WIN_CONDITION = WC_ALL_CLEAR;
LVL18_WIN_CONDITION_VAR = LVL18_AMT;
LVL18_RELEASE_ANGLE_INCREMENT = 90;
LVL18_CURRENT_RELEASE_ANGLE = 0;
LVL18_RELEASE_POINT = ERP_TOP;
LVL18_COUNTDOWN = 15;
LVL18_POWER = 10;
LVL18_MONEY_BONUS = 525 - LVL18_AMT;
LVL19_AMT = 30;
LVL19_SPEED = SPEED2;
LVL19_K = 1;
LVL19_MASS = MASS3;
LVL19_HP = HP5;
LVL19_RELEASE_SPEED = fps * 0.6;
LVL19_RELEASE_STRATEGY = ERS_SPORADIC;
LVL19_WIN_CONDITION = WC_ALL_CLEAR;
LVL19_WIN_CONDITION_VAR = LVL19_AMT;
LVL19_RELEASE_ANGLE_INCREMENT = 90;
LVL19_CURRENT_RELEASE_ANGLE = 0;
LVL19_RELEASE_POINT = ERP_TOP;
LVL19_COUNTDOWN = 15;
LVL19_POWER = 20;
LVL19_MONEY_BONUS = 525 - LVL19_AMT;
LVL20_AMT = 75;
LVL20_SPEED = SPEED3;
LVL20_K = 1;
LVL20_MASS = MASS3;
LVL20_HP = HP4;
LVL20_RELEASE_SPEED = fps * 0.3;
LVL20_RELEASE_STRATEGY = ERS_SPORADIC;
LVL20_WIN_CONDITION = WC_ALL_CLEAR;
LVL20_WIN_CONDITION_VAR = LVL20_AMT;
LVL20_RELEASE_ANGLE_INCREMENT = 90;
LVL20_CURRENT_RELEASE_ANGLE = 0;
LVL20_RELEASE_POINT = ERP_SPECIAL1;
LVL20_COUNTDOWN = 15;
LVL20_POWER = 10;
LVL20_MONEY_BONUS = 525 - LVL20_AMT;
LVL21_AMT = 20;
LVL21_SPEED = SPEED3;
LVL21_K = 0.5;
LVL21_MASS = MASS3;
LVL21_HP = HP4;
LVL21_RELEASE_SPEED = fps * 0.6;
LVL21_RELEASE_STRATEGY = ERS_SPORADIC;
LVL21_WIN_CONDITION = WC_ALL_CLEAR;
LVL21_WIN_CONDITION_VAR = LVL21_AMT;
LVL21_RELEASE_ANGLE_INCREMENT = 90;
LVL21_CURRENT_RELEASE_ANGLE = 0;
LVL21_RELEASE_POINT = ERP_TOP;
LVL21_COUNTDOWN = 15;
LVL21_POWER = 25;
LVL21_MONEY_BONUS = 525 - LVL21_AMT;
LVL21A_AMT = 20;
LVL21A_SPEED = SPEED4;
LVL21A_K = 0.5;
LVL21A_MASS = MASS3;
LVL21A_HP = HP4;
LVL21A_RELEASE_POINT = ERP_TOP;
LVL21A_POWER = 25;
LVL21B_AMT = 14;
LVL21B_SPEED = SPEED2;
LVL21B_K = 0.5;
LVL21B_MASS = MASS3;
LVL21B_HP = HP8;
LVL21B_RELEASE_POINT = ERP_TOP;
LVL21B_POWER = 25;
LVL22_AMT = 20;
LVL22_SPEED = SPEED2;
LVL22_K = 0.5;
LVL22_MASS = MASS3;
LVL22_HP = HP4;
LVL22_RELEASE_SPEED = fps * 0.4;
LVL22_RELEASE_STRATEGY = ERS_SPORADIC;
LVL22_WIN_CONDITION = WC_ALL_CLEAR;
LVL22_WIN_CONDITION_VAR = LVL22_AMT;
LVL22_RELEASE_ANGLE_INCREMENT = 90;
LVL22_CURRENT_RELEASE_ANGLE = 0;
LVL22_RELEASE_POINT = ERP_TOP;
LVL22_COUNTDOWN = 15;
LVL22_POWER = 25;
LVL22_MONEY_BONUS = 525 - LVL22_AMT;
LVL22A_AMT = 20;
LVL22A_SPEED = SPEED3;
LVL22A_K = 0.5;
LVL22A_MASS = MASS3;
LVL22A_HP = HP5;
LVL22A_RELEASE_POINT = ERP_TOP;
LVL22A_POWER = 15;
LVL22B_AMT = 20;
LVL22B_SPEED = SPEED2;
LVL22B_K = 0.5;
LVL22B_MASS = MASS3;
LVL22B_HP = HP5;
LVL22B_RELEASE_POINT = ERP_TOP;
LVL22B_POWER = 25;
LVL23_AMT = 20;
LVL23_SPEED = SPEED2;
LVL23_K = 0.5;
LVL23_MASS = MASS3;
LVL23_HP = HP4;
LVL23_RELEASE_SPEED = fps * 0.5;
LVL23_RELEASE_STRATEGY = ERS_SPORADIC;
LVL23_WIN_CONDITION = WC_ALL_CLEAR;
LVL23_WIN_CONDITION_VAR = LVL23_AMT;
LVL23_RELEASE_ANGLE_INCREMENT = 90;
LVL23_CURRENT_RELEASE_ANGLE = 0;
LVL23_RELEASE_POINT = ERP_TOP;
LVL23_COUNTDOWN = 15;
LVL23_POWER = 25;
LVL23_MONEY_BONUS = 525 - LVL23_AMT;
LVL23A_AMT = 14;
LVL23A_SPEED = SPEED2;
LVL23A_K = 0.5;
LVL23A_MASS = MASS5;
LVL23A_HP = HP8;
LVL23A_RELEASE_POINT = ERP_TOP;
LVL23A_POWER = 25;
LVL23B_AMT = 20;
LVL23B_SPEED = SPEED2;
LVL23B_K = 0.5;
LVL23B_MASS = MASS3;
LVL23B_HP = HP5;
LVL23B_RELEASE_POINT = ERP_TOP;
LVL23B_POWER = 25;
LVL24_AMT = 20;
LVL24_SPEED = SPEED2;
LVL24_K = 0.5;
LVL24_MASS = MASS10;
LVL24_HP = HP8;
LVL24_RELEASE_SPEED = fps * 0.6;
LVL24_RELEASE_STRATEGY = ERS_SPORADIC;
LVL24_WIN_CONDITION = WC_ALL_CLEAR;
LVL24_WIN_CONDITION_VAR = LVL24_AMT;
LVL24_RELEASE_ANGLE_INCREMENT = 90;
LVL24_CURRENT_RELEASE_ANGLE = 0;
LVL24_RELEASE_POINT = ERP_TOP;
LVL24_COUNTDOWN = 15;
LVL24_POWER = 25;
LVL24_MONEY_BONUS = 525 - LVL24_AMT;
LVL24A_AMT = 20;
LVL24A_SPEED = SPEED3;
LVL24A_K = 0.5;
LVL24A_MASS = MASS3;
LVL24A_HP = HP5;
LVL24A_RELEASE_POINT = ERP_TOP;
LVL24A_POWER = 15;
LVL24B_AMT = 20;
LVL24B_SPEED = SPEED2;
LVL24B_K = 0.5;
LVL24B_MASS = MASS3;
LVL24B_HP = HP5;
LVL24B_COUNTDOWN = 15;
LVL24B_RELEASE_POINT = ERP_TOP;
LVL24B_POWER = 25;
LVL25_AMT = 20;
LVL25_SPEED = SPEED1;
LVL25_K = 1;
LVL25_MASS = MASS10;
LVL25_HP = HP8;
LVL25_RELEASE_SPEED = fps * 0.5;
LVL25_RELEASE_STRATEGY = ERS_SPORADIC;
LVL25_WIN_CONDITION = WC_ALL_CLEAR;
LVL25_WIN_CONDITION_VAR = LVL25_AMT;
LVL25_RELEASE_ANGLE_INCREMENT = 90;
LVL25_CURRENT_RELEASE_ANGLE = 0;
LVL25_RELEASE_POINT = ERP_SPECIAL1;
LVL25_COUNTDOWN = 15;
LVL25_POWER = 25;
LVL25_MONEY_BONUS = 525 - LVL25_AMT;
LVL26_AMT = 15;
LVL26_SPEED = SPEED3;
LVL26_K = 1;
LVL26_MASS = MASS3;
LVL26_HP = HP4;
LVL26_RELEASE_SPEED = fps * 0.5;
LVL26_RELEASE_STRATEGY = ERS_SPORADIC;
LVL26_WIN_CONDITION = WC_ALL_CLEAR;
LVL26_WIN_CONDITION_VAR = LVL26_AMT;
LVL26_RELEASE_ANGLE_INCREMENT = 90;
LVL26_CURRENT_RELEASE_ANGLE = 0;
LVL26_RELEASE_POINT = ERP_TOP;
LVL26_COUNTDOWN = 15;
LVL26_POWER = 25;
LVL26_MONEY_BONUS = 525 - LVL26_AMT;
LVL26A_AMT = 20;
LVL26A_SPEED = SPEED2;
LVL26A_K = 1;
LVL26A_MASS = MASS3;
LVL26A_HP = HP5;
LVL26A_RELEASE_POINT = ERP_TOP;
LVL26A_POWER = 25;
LVL26B_AMT = 18;
LVL26B_SPEED = SPEED2;
LVL26B_K = 1;
LVL26B_MASS = MASS10;
LVL26B_HP = HP8;
LVL26B_RELEASE_POINT = ERP_TOP;
LVL26B_POWER = 25;
LVL27_AMT = 20;
LVL27_SPEED = SPEED1;
LVL27_K = 1;
LVL27_MASS = MASS3;
LVL27_HP = HP4;
LVL27_RELEASE_SPEED = fps * 0.6;
LVL27_RELEASE_STRATEGY = ERS_SPORADIC;
LVL27_WIN_CONDITION = WC_ALL_CLEAR;
LVL27_WIN_CONDITION_VAR = LVL27_AMT;
LVL27_RELEASE_ANGLE_INCREMENT = 90;
LVL27_CURRENT_RELEASE_ANGLE = 0;
LVL27_RELEASE_POINT = ERP_TOP;
LVL27_COUNTDOWN = 15;
LVL27_POWER = 25;
LVL27_MONEY_BONUS = 525 - LVL27_AMT;
LVL27A_AMT = 20;
LVL27A_SPEED = SPEED4;
LVL27A_K = 0.5;
LVL27A_MASS = MASS3;
LVL27A_HP = HP4;
LVL27A_RELEASE_POINT = ERP_TOP;
LVL27A_POWER = 25;
LVL27B_AMT = 14;
LVL27B_SPEED = SPEED2;
LVL27B_K = 0.5;
LVL27B_MASS = MASS3;
LVL27B_HP = HP8;
LVL27B_RELEASE_POINT = ERP_TOP;
LVL27B_POWER = 25;
LVL27C_AMT = 20;
LVL27C_SPEED = SPEED3;
LVL27C_K = 0.5;
LVL27C_MASS = MASS3;
LVL27C_HP = HP5;
LVL27C_RELEASE_POINT = ERP_TOP;
LVL27C_POWER = 25;
LVL27D_AMT = 20;
LVL27D_SPEED = SPEED2;
LVL27D_K = 0.5;
LVL27D_MASS = MASS3;
LVL27D_HP = HP5;
LVL27D_RELEASE_POINT = ERP_TOP;
LVL27D_POWER = 25;
LVL28_AMT = 20;
LVL28_SPEED = SPEED1;
LVL28_K = 1;
LVL28_MASS = MASS3;
LVL28_HP = HP4;
LVL28_RELEASE_SPEED = fps * 0.5;
LVL28_RELEASE_STRATEGY = ERS_SPORADIC;
LVL28_WIN_CONDITION = WC_ALL_CLEAR;
LVL28_WIN_CONDITION_VAR = LVL28_AMT;
LVL28_RELEASE_ANGLE_INCREMENT = 90;
LVL28_CURRENT_RELEASE_ANGLE = 0;
LVL28_RELEASE_POINT = ERP_TOP;
LVL28_COUNTDOWN = 15;
LVL28_POWER = 25;
LVL28_MONEY_BONUS = 525 - LVL28_AMT;
LVL28A_AMT = 20;
LVL28A_SPEED = SPEED4;
LVL28A_K = 0.5;
LVL28A_MASS = MASS3;
LVL28A_HP = HP4;
LVL28A_RELEASE_POINT = ERP_TOP;
LVL28A_POWER = 25;
LVL28B_AMT = 14;
LVL28B_SPEED = SPEED2;
LVL28B_K = 0.5;
LVL28B_MASS = MASS10;
LVL28B_HP = HP8;
LVL28B_RELEASE_POINT = ERP_TOP;
LVL28B_POWER = 25;
LVL28C_AMT = 20;
LVL28C_SPEED = SPEED3;
LVL28C_K = 0.5;
LVL28C_MASS = MASS3;
LVL28C_HP = HP5;
LVL28C_RELEASE_POINT = ERP_TOP;
LVL28C_POWER = 25;
LVL28D_AMT = 20;
LVL28D_SPEED = SPEED2;
LVL28D_K = 0.5;
LVL28D_MASS = MASS3;
LVL28D_HP = HP5;
LVL28D_RELEASE_POINT = ERP_TOP;
LVL28D_POWER = 25;
LVL29_AMT = 30;
LVL29_SPEED = SPEED1;
LVL29_K = 1;
LVL29_MASS = MASS3;
LVL29_HP = HP4;
LVL29_RELEASE_SPEED = fps * 0.4;
LVL29_RELEASE_STRATEGY = ERS_SPORADIC;
LVL29_WIN_CONDITION = WC_ALL_CLEAR;
LVL29_WIN_CONDITION_VAR = LVL29_AMT;
LVL29_RELEASE_ANGLE_INCREMENT = 90;
LVL29_CURRENT_RELEASE_ANGLE = 0;
LVL29_RELEASE_POINT = ERP_TOP;
LVL29_COUNTDOWN = 15;
LVL29_POWER = 25;
LVL29_MONEY_BONUS = 525 - LVL29_AMT;
LVL29A_AMT = 30;
LVL29A_SPEED = SPEED4;
LVL29A_K = 0.5;
LVL29A_MASS = MASS3;
LVL29A_HP = HP4;
LVL29A_RELEASE_POINT = ERP_TOP;
LVL29A_POWER = 25;
LVL29B_AMT = 14;
LVL29B_SPEED = SPEED2;
LVL29B_K = 0.5;
LVL29B_MASS = MASS10;
LVL29B_HP = HP8;
LVL29B_RELEASE_POINT = ERP_TOP;
LVL29B_POWER = 25;
LVL29C_AMT = 30;
LVL29C_SPEED = SPEED3;
LVL29C_K = 0.5;
LVL29C_MASS = MASS3;
LVL29C_HP = HP5;
LVL29C_RELEASE_POINT = ERP_TOP;
LVL29C_POWER = 25;
LVL29D_AMT = 30;
LVL29D_SPEED = SPEED2;
LVL29D_K = 0.5;
LVL29D_MASS = MASS3;
LVL29D_HP = HP5;
LVL29D_RELEASE_POINT = ERP_TOP;
LVL29D_POWER = 25;
LVL30_AMT = 1;
LVL30_SPEED = SPEED3;
LVL30_K = 1;
LVL30_MASS = MASS10;
LVL30_HP = HP10;
LVL30_RELEASE_SPEED = fps * 0.4;
LVL30_RELEASE_STRATEGY = ERS_SPORADIC;
LVL30_WIN_CONDITION = WC_ALL_CLEAR;
LVL30_WIN_CONDITION_VAR = LVL30_AMT;
LVL30_RELEASE_ANGLE_INCREMENT = 90;
LVL30_CURRENT_RELEASE_ANGLE = 0;
LVL30_RELEASE_POINT = ERP_SPECIAL1;
LVL30_COUNTDOWN = 15;
LVL30_POWER = 25;
LVL30_MONEY_BONUS = 525 - LVL30_AMT;
LVL30A_AMT = 30;
LVL30A_SPEED = SPEED4;
LVL30A_K = 0.5;
LVL30A_MASS = 1;
LVL30A_HP = HP5;
LVL30A_RELEASE_POINT = ERP_TOP;
LVL30A_POWER = 25;
LVL30B_AMT = 30;
LVL30B_SPEED = SPEED3;
LVL30B_K = 0.5;
LVL30B_MASS = 10;
LVL30B_HP = HP5;
LVL30B_RELEASE_POINT = ERP_TOP;
LVL30B_POWER = 25;
LVL31_AMT = 5;
LVL31_SPEED = SPEED2;
LVL31_K = 1;
LVL31_MASS = 10;
LVL31_HP = HP9;
LVL31_RELEASE_SPEED = fps * 2.5;
LVL31_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL31_WIN_CONDITION = WC_ALL_CLEAR;
LVL31_WIN_CONDITION_VAR = LVL31AMT;
LVL31_RELEASE_ANGLE_INCREMENT = 90;
LVL31_CURRENT_RELEASE_ANGLE = 0;
LVL31_RELEASE_POINT = ERP_SPECIAL1;
LVL31_COUNTDOWN = 15;
LVL31_POWER = 25;
LVL31_MONEY_BONUS = 525 - LVL31_AMT;
LVL32_AMT = 1;
LVL32_SPEED = 1;
LVL32_K = 0.1;
LVL32_MASS = 50000;
LVL32_HP = HPPLANET;
LVL32_RELEASE_SPEED = fps;
LVL32_RELEASE_STRATEGY = ERS_IN_ORDER;
LVL32_WIN_CONDITION = WC_ALL_CLEAR;
LVL32_WIN_CONDITION_VAR = LVL32AMT;
LVL32_RELEASE_ANGLE_INCREMENT = 90;
LVL32_CURRENT_RELEASE_ANGLE = 0;
LVL32_RELEASE_POINT = ERP_SPECIAL1;
LVL32_COUNTDOWN = 15;
LVL32_POWER = 2;
LVL32_MONEY_BONUS = 500 - LVL32_AMT;
initLevels();
}
function reInitPurpleAsteroid(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initPurpleAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = PURPLE_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
purpleAsteroids.killObject(this.index);
};
}
function reInitYellowAsteroid(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initYellowAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = YELLOW_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
yellowAsteroids.killObject(this.index);
};
}
function initPlanetAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = PLANET_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
planetAsteroids.killObject(this.index);
};
tmpPA.damage = function (amt, damager) {
this.hp = this.hp - amt;
this.lastDamager = damager;
this.hpPercentage = (this.hp / this.hpMax) * 1000;
this._xscale = this.hpPercentage;
this._yscale = this.hpPercentage;
this.cRadius = this._height * 0.5;
};
tmpPA.addHp = function (amt) {
this.hp = this.hp + amt;
if (this.hp > this.hpMax) {
this.hp = this.hpMax;
}
this.hpPercentage = (this.hp / this.hpMax) * 1000;
this._xscale = hpPercentage;
this._yscale = hpPercentage;
this.cRadius = this._height * 0.5;
};
}
function initCommando(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = COMMANDO;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
commando.killObject(this.index);
};
tmpPA.damage = function (amt, damager) {
this.hp = this.hp - amt;
this.lastDamager = damager;
};
tmpPA.addHp = function (amt) {
this.hp = this.hp + amt;
if (this.hp > this.hpMax) {
this.hp = this.hpMax;
}
};
tmpPA.fireShot = function () {
this.shotCooldownTimer = this.shotCooldown;
this.shotsFired++;
return(this.createProjectile(this, this.gameTarget));
};
tmpPA.createProjectile = function (shooter, target) {
if (enemyList.getNextIndex() != -1) {
tmpProj = yellowAsteroids.getNext();
if (tmpProj != -1) {
reInitAsteroid(tmpProj, 6, shooter.k, shooter.mass, HP5, 30);
tmpProj._x = this._x;
tmpProj._y = this._y;
tmpProj.oldX = this._x;
tmpProj.oldY = this._y;
enemyList.addObject(tmpProj);
}
}
};
}
function reInitGrayAsteroid(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initGrayAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = GRAY_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
grayAsteroids.killObject(this.index);
};
}
function reInitRedAsteroid(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initRedAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = RED_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
redAsteroids.killObject(this.index);
};
}
function reInitGreenAsteroid(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initGreenAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = GREEN_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
greenAsteroids.killObject(this.index);
};
}
function initPinkAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = PINK_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
fireHeartBurst(this, this.power * 10, this.mass, 1, 200);
createMeteorDeath(this);
pinkAsteroids.killObject(this.index);
};
}
function initMarcherAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = MARCHER_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = smartStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
marcherAsteroids.killObject(this.index);
};
}
function reInitExploderAsteroid(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initExploderAsteroid(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = EXPLODER_ASTEROID;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.range = 75;
tmpPA.killObject = function () {
createExplosionAgainstProbes(this);
createMeteorDeath(this);
exploderAsteroids.killObject(this.index);
};
}
function reInitSplitter(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initSplitter(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = SPLITTER;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
this.spawnChildren();
splitters.killObject(this.index);
};
tmpPA.killObjectDontSpawn = function () {
createMeteorDeath(this);
splitters.killObject(this.index);
};
tmpPA.spawnChildren = function () {
this.spawn1 = createSpawnling(this);
this.spawn2 = createSpawnling(this);
this.spawn3 = createSpawnling(this);
this.spawn4 = createSpawnling(this);
this.spawn1.addAcceleration(10, 0);
this.spawn2.addAcceleration(-10, 0);
this.spawn3.addAcceleration(0, 10);
this.spawn4.addAcceleration(0, -10);
};
}
function initAirFleet(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = AIR_FLEET;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
airFleets.killObject(this.index);
};
tmpPA.damage = function (amt, damager) {
this.hp = this.hp - amt;
this.lastDamager = damager;
};
tmpPA.addHp = function (amt) {
this.hp = this.hp + amt;
if (this.hp > this.hpMax) {
this.hp = this.hpMax;
}
};
tmpPA.fireShot = function () {
this.shotCooldownTimer = this.shotCooldown;
this.shotsFired++;
return(this.createProjectile(this, this.gameTarget));
};
tmpPA.createProjectile = function (shooter, target) {
if (enemyList.getNextIndex() != -1) {
tmpProj = purpleAsteroids.getNext();
if (tmpProj != -1) {
reInitAsteroid(tmpProj, 6, 1, shooter.mass, 250, 30);
tmpProj._x = this._x;
tmpProj._y = this._y;
tmpProj.oldX = this._x;
tmpProj.oldY = this._y;
enemyList.addObject(tmpProj);
}
}
};
}
function initBombBot(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = BOMB_BOT;
tmpPA.move = basicAsteroidMove;
tmpPA.step = basicAsteroidStep;
tmpPA.slow = slowObject;
tmpPA.killObject = function () {
createMeteorDeath(this);
bombBots.killObject(this.index);
};
tmpPA.damage = function (amt, damager) {
this.hp = this.hp - amt;
this.lastDamager = damager;
};
tmpPA.addHp = function (amt) {
this.hp = this.hp + amt;
if (this.hp > this.hpMax) {
this.hp = this.hpMax;
}
};
tmpPA.fireShot = function () {
this.shotCooldownTimer = this.shotCooldown;
this.shotsFired++;
return(this.createProjectile(this, this.gameTarget));
};
tmpPA.createProjectile = function (shooter, target) {
if (enemyList.getNextIndex() != -1) {
tmpProj = yellowAsteroids.getNext();
if (tmpProj != -1) {
reInitAsteroid(tmpProj, 6, shooter.k, shooter.mass, shooter.hp * 0.4, shooter.power);
tmpProj._x = this._x;
tmpProj._y = this._y;
tmpProj.oldX = this._x;
tmpProj.oldY = this._y;
enemyList.addObject(tmpProj);
}
}
};
}
function zMarchInstructions(tmpPA) {
tmpPA.step = smartStep;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 100;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 700;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 2;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 100;
tmpPA.instructions[insNum].instructionVar2 = 500;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 3;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 700;
tmpPA.instructions[insNum].instructionVar2 = 500;
tmpPA.instructions[insNum].gotoInstruction = -1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
tmpPA.numInstructions = insNum - 1;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
}
function whirlwindMarchInstructions(tmpPA) {
tmpPA.numInstructions = 2;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 500;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 500;
tmpPA.instructions[insNum].instructionVar2 = 500;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 3;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = -1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = 10 * fps;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
}
function sMarchInstructions(tmpPA) {
tmpPA.step = smartStep;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 700;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 100;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 2;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 100;
tmpPA.instructions[insNum].instructionVar2 = 400;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 3;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 700;
tmpPA.instructions[insNum].instructionVar2 = 400;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 4;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 700;
tmpPA.instructions[insNum].instructionVar2 = 600;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 5;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 100;
tmpPA.instructions[insNum].instructionVar2 = 600;
tmpPA.instructions[insNum].gotoInstruction = -1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
tmpPA.numInstructions = insNum - 1;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
}
function duckMarchInstructions(tmpPA) {
tmpPA.step = smartStep;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 900;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = -100;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 2;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = -100;
tmpPA.instructions[insNum].instructionVar2 = 400;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 3;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 900;
tmpPA.instructions[insNum].instructionVar2 = 400;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 4;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 900;
tmpPA.instructions[insNum].instructionVar2 = 600;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 5;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = -100;
tmpPA.instructions[insNum].instructionVar2 = 600;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 450;
tmpPA.instructions[insNum].instructionVar2 = 400;
tmpPA.instructions[insNum].gotoInstruction = -1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
tmpPA.numInstructions = insNum - 1;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
}
function airFleetMarchInstructions(tmpPA) {
tmpPA.step = smartStep;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 500;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = Math.ceil(Math.random() * 2);
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 100;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 2;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = Math.ceil(Math.random() * 2);
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 100;
tmpPA.instructions[insNum].instructionVar2 = 400;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 3;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = Math.ceil(Math.random() * 2);
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 500;
tmpPA.instructions[insNum].instructionVar2 = 400;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 4;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 500;
tmpPA.instructions[insNum].instructionVar2 = 300;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 5;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 350;
tmpPA.instructions[insNum].instructionVar2 = 300;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = 0;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
tmpPA.numInstructions = insNum - 1;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
}
function commandoMarchInstructions(tmpPA) {
tmpPA.step = smartStep;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 320;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 320;
tmpPA.instructions[insNum].instructionVar2 = 320;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 2;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 100;
tmpPA.instructions[insNum].instructionVar2 = 320;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 3;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 540;
tmpPA.instructions[insNum].instructionVar2 = 320;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 4;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 320;
tmpPA.instructions[insNum].instructionVar2 = 320;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 5;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 320;
tmpPA.instructions[insNum].instructionVar2 = 400;
tmpPA.instructions[insNum].gotoInstruction = 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
tmpPA.numInstructions = insNum - 1;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
}
function bombBotMarchInstructions(tmpPA) {
tmpPA.step = smartStep;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 50 + (Math.random() * 500);
tmpPA.instructions[insNum].instructionVar2 = 100 + (Math.random() * 200);
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = -1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
tmpPA.numInstructions = insNum - 1;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
}
function bombBot2MarchInstructions(tmpPA) {
tmpPA.step = smartStep;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 50 + (Math.random() * 500);
tmpPA.instructions[insNum].instructionVar2 = 100 + (Math.random() * 150);
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = 1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 50 + (Math.random() * 500);
tmpPA.instructions[insNum].instructionVar2 = 100 + (Math.random() * 200);
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 1;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = -1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
tmpPA.numInstructions = insNum - 1;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
}
function reInitKillBot(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initKillBot(tmpPA) {
initAsteroid(tmpPA);
tmpPA.type = KILL_BOT;
tmpPA.move = orbitCenterMove;
tmpPA.step = smartStep;
tmpPA.slow = slowObject;
tmpPA.orbitRadius = 100;
tmpPA.numOrbits = 5;
tmpPA.orbitAngleIncrementor = 5;
tmpPA.orbitSpeed = 8;
tmpPA.shotCooldown = fps * 0.3;
tmpPA.shotsFired = 0;
tmpPA.resetOrbiters = function () {
this.orbit1 = createAsteroidShieldUnit(tmpPA, 0, tmpPA.orbitAngleIncrementor, tmpPA.orbitSpeed);
this.orbit2 = createAsteroidShieldUnit(tmpPA, 72, tmpPA.orbitAngleIncrementor, tmpPA.orbitSpeed);
this.orbit3 = createAsteroidShieldUnit(tmpPA, 144, tmpPA.orbitAngleIncrementor, tmpPA.orbitSpeed);
this.orbit4 = createAsteroidShieldUnit(tmpPA, 216, tmpPA.orbitAngleIncrementor, tmpPA.orbitSpeed);
this.orbit5 = createAsteroidShieldUnit(tmpPA, 288, tmpPA.orbitAngleIncrementor, tmpPA.orbitSpeed);
this.orbit1.resetOrbiter();
this.orbit2.resetOrbiter();
this.orbit3.resetOrbiter();
this.orbit4.resetOrbiter();
this.orbit5.resetOrbiter();
};
tmpPA.fireShot = function () {
this.shotCooldownTimer = this.shotCooldown;
this.shotsFired++;
return(this.createProjectile(this, this.gameTarget));
};
tmpPA.createProjectile = function (shooter, target) {
if (enemyList.getNextIndex() != -1) {
tmpProj = grayAsteroids.getNext();
if (tmpProj != -1) {
reInitAsteroid(tmpProj, 10, shooter.k, shooter.mass, shooter.hp);
tmpProj._x = this._x;
tmpProj._y = this._y;
tmpProj.oldX = this._x;
tmpProj.oldY = this._y;
enemyList.addObject(tmpProj);
}
}
};
tmpPA.killObject = function () {
createMeteorDeath(this);
reInitAsteroid(this.orbit1, 10, this.orbit1.k, this.mass, this.orbit1.hp);
reInitAsteroid(this.orbit2, 10, this.orbit2.k, this.mass, this.orbit2.hp);
reInitAsteroid(this.orbit3, 10, this.orbit3.k, this.mass, this.orbit3.hp);
reInitAsteroid(this.orbit4, 10, this.orbit4.k, this.mass, this.orbit4.hp);
reInitAsteroid(this.orbit5, 10, this.orbit5.k, this.mass, this.orbit5.hp);
killBots.killObject(this.index);
};
}
function reInitStraferBot(tmpPA, speed, k, mass, hp, power) {
reInitAsteroid(tmpPA, speed, k, mass, hp, power);
return(tmpPA);
}
function initStraferBot(tmpPA) {
reInitAsteroid(tmpPA);
tmpPA.type = STRAFER_BOT;
tmpPA.move = basicAsteroidMove;
tmpPA.step = smartStep;
tmpPA.slow = slowObject;
tmpPA.numOrbits = 5;
tmpPA.shotCooldown = fps * 0.3;
tmpPA.shotsFired = 0;
tmpPA.numInstructions = 2;
insNum = 0;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = 64;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 3;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = 10 * fps;
insNum++;
tmpPA.instructions[insNum].instructionType = MOVE_TO_TARGET_POS;
tmpPA.instructions[insNum].instructionVar1 = Stage.width - 64;
tmpPA.instructions[insNum].instructionVar2 = 100;
tmpPA.instructions[insNum].gotoInstruction = insNum + 1;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = fps * 20;
insNum++;
tmpPA.instructions[insNum].instructionType = ATTACK_TARGET_AMT;
tmpPA.instructions[insNum].instructionVar1 = 3;
tmpPA.instructions[insNum].instructionVar2 = 0;
tmpPA.instructions[insNum].gotoInstruction = 0;
tmpPA.instructions[insNum].planBInstruction = -1;
tmpPA.instructions[insNum].instructionTimeOut = 10 * fps;
copyInstruction(tmpPA.instructions[0], tmpPA.currentInstruction);
tmpPA.currentInstruction.instructionFramesElapsed = 0;
tmpPA.fireShot = function () {
this.shotCooldownTimer = this.shotCooldown;
this.shotsFired++;
return(this.createProjectile(this, this.gameTarget));
};
tmpPA.createProjectile = function (shooter, target) {
if (enemyList.getNextIndex() != -1) {
tmpProj = redAsteroids.getNext();
if (tmpProj != -1) {
initRedAsteroid(tmpProj, 10, shooter.k, shooter.mass, shooter.hp);
tmpProj._x = this._x;
tmpProj._y = this._y;
tmpProj.oldX = this._x;
tmpProj.oldY = this._y;
enemyList.addObject(tmpProj);
}
}
};
tmpPA.killObject = function () {
createMeteorDeath(this);
killBots.killObject(this.index);
};
}
function reInitAsteroid(asteroid, speed, k, mass, hp, power) {
asteroid._x = 0;
asteroid._y = 0;
asteroid.oldX = 0;
asteroid.oldY = 0;
asteroid.ax = 0;
asteroid.ay = 0;
asteroid.dx = 0;
asteroid.dy = 0;
asteroid.auxAx = 0;
asteroid.auxAy = 0;
asteroid.mass = mass;
asteroid.speed = speed;
asteroid.speedSquared = speed * speed;
asteroid.gameTarget = mainShip;
asteroid.newTarget = true;
asteroid.alive = true;
asteroid.slowTime = 0;
asteroid.slowPercentage = 0;
asteroid.k = k;
asteroid.hp = hp;
asteroid.hpMax = hp;
asteroid.power = power;
asteroid.currentInstruction.instructionFramesElapsed = 0;
asteroid.stepCounter = -1;
}
function initAsteroid(asteroid) {
asteroid.objectType = OBJ_ENEMY;
asteroid.moveBack = basicAsteroidMoveBack;
asteroid.getDamage = function () {
return(this.power * ((Math.abs(this.dx) + Math.abs(this.dy)) / this.speed));
};
asteroid.damage = function (amt, damager) {
this.hp = this.hp - amt;
this.lastDamager = damager;
};
asteroid.addHp = function (amt) {
this.hp = this.hp + amt;
if (this.hp > this.hpMax) {
this.hp = this.hpMax;
}
};
asteroid.onPress = function () {
selectObject(this);
};
}
function initLevels() {
gameLevels = _root.attachMovie("Variable", "GameLevelsClip", depth--);
gameLevels.numLevels = 32;
gameLevels._x = OFFSCREEN_X;
gameLevels.levels = new Array();
i = 0;
while (i < gameLevels.numLevels) {
gameLevels.levels[i] = _root.attachMovie("Variable", "gLevel" + i, depth--);
gameLevels.levels[i]._x = OFFSCREEN_X;
gameLevels.levels[i]._y = OFFSCREEN_Y;
gameLevels.levels[i].index = i;
gameLevels.levels[i].levelPreDialogs = new Array();
gameLevels.levels[i].lpredAmt = 0;
gameLevels.levels[i].gamePreDialogs = new Array();
gameLevels.levels[i].gpredAmt = 0;
gameLevels.levels[i].gameInterruptDialogs = new Array();
gameLevels.levels[i].gidAmt = 0;
gameLevels.levels[i].gamePostDialogs = new Array();
gameLevels.levels[i].gpostdAmt = 0;
gameLevels.levels[i].levelPostDialogs = new Array();
gameLevels.levels[i].lpostdAmt = 0;
gameLevels.levels[i].numKillTriggers = 0;
gameLevels.levels[i].killTriggers = new Array();
gameLevels.levels[i].numTriggerDialogs = 0;
gameLevels.levels[i].triggerDialogs = new Array();
gameLevels.levels[i].enemies = new Array();
gameLevels.levels[i].currentReleaseAngle = 0;
i++;
}
createLevelDefinitions();
}
function createLevelDefinitions() {
level = 0;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL1_AMT, LVL1_RELEASE_POINT, LVL1_SPEED, LVL1_K, LVL1_MASS, LVL1_HP, LVL1_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL1_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL1_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL1_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL1_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL1_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL1_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL1_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL1_AMT;
gameLevels.levels[level].moneyBonus = LVL1_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Welcome to the sector!", fps * 2, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "You'll be in charge of protecting the station from harm. Build probes to help protect the ship. We're counting on you...", fps * 6, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "...and...", fps, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "ME!!!", int(fps * 1.2), 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "AND ME!!!", int(fps * 1.5), 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Err, Uhh, yeah you'll be assisted by these two... they're a handful.", fps * 4, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Good Luck, I'm off on vacation!", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "COOL!", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Quick build some probes before those asteroids hit us!", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "WE DID IT!!!", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL2_AMT, LVL2_RELEASE_POINT, LVL2_SPEED, LVL2_K, LVL2_MASS, LVL2_HP, LVL2_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL2_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL2_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL2_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL2_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL2_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL2_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL2_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL2_AMT;
gameLevels.levels[level].moneyBonus = LVL2_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "More are coming this way!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "WOW!", fps, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "SWEET!", fps, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Hint: Click on the ship and use the ship's skills!", fps * 3.5, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(RED_ASTEROID, LVL3_AMT, LVL3_RELEASE_POINT, LVL3_SPEED, LVL3_K, LVL3_MASS, LVL3_HP, LVL3_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL3_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL3_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL3_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL3_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL3_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL3_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL3_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL3_AMT;
gameLevels.levels[level].moneyBonus = LVL3_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Incoming! These look fast", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "Oooh RED!!!", fps, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Hint: The further away you destroy the asteroids, the you score!", fps * 5, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(RED_ASTEROID, LVL4_AMT, LVL4_RELEASE_POINT, LVL4_SPEED, LVL4_K, LVL4_MASS, LVL4_HP, LVL4_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL4_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL4_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL4_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL4_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL4_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL4_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL4_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL4_AMT;
gameLevels.levels[level].moneyBonus = LVL4_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "THERE'S MORE?!", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "I LIKE RED!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Hint: Try different builds, there are many useful skills for each probe", fps * 5, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(SPLITTER, LVL5_AMT, LVL5_RELEASE_POINT, LVL5_SPEED, LVL5_K, LVL5_MASS, LVL5_HP, LVL5_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL5_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL5_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL5_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL5_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL5_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL5_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL5_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL5_AMT;
gameLevels.levels[level].moneyBonus = LVL5_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Why are there so many asteroids?", fps * 4, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "HA HA HA HA HA!", fps * 3, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "You really don't know do you?", fps * 4, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "OOOOOOH PINK!!!", fps * 2, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "PINK?! HOW INSULTING!", fps * 3, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "I LIKE PINK!!!", fps * 2, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Hey, you just said you liked red!", fps * 5, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "I FORGOT, I LIKE PINK!", fps * 4, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "AaaRgh! PREPARE FOR DEATH!", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "WHO US?", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "FOOLS! You'll soon see true power!", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Hmm...These look kind of big...", fps * 2, 5);
gameLevels.levels[level].numKillTriggers = 1;
gameLevels.levels[level].killTriggers[0] = createTriggerDefinition(KT_COUNT, ACT_TYPE_DISP_DIALOG, 1, 0);
gameLevels.levels[level].numTriggerDialogs = 1;
gameLevels.levels[level].triggerDialogs[0] = createDialogDefinition(CHAR_BOY_PILOT, "Hey! It broke apart!", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Aww, no more?", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL6_AMT, LVL6_RELEASE_POINT, LVL6_SPEED, LVL6_K, LVL6_MASS, LVL6_HP, LVL6_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL6_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL6_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL6_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL6_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL6_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL6_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL6_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL6_AMT;
gameLevels.levels[level].moneyBonus = LVL6_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "Looks like you are more of challenge than I thought. No matter, take this!", fps * 6, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Is he controlling the asteroids?!", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "WE'RE ALIVE!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "IMPOSSIBLE! Just you wait, I'll be back!", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL7_AMT, LVL7_RELEASE_POINT, LVL7_SPEED, LVL7_K, LVL7_MASS, LVL7_HP, LVL7_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL7_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL7_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL7_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL7_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL7_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL7_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL7_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL7_AMT;
gameLevels.levels[level].moneyBonus = LVL7_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "...", fps, 15);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "EWW BUTT FACE IS BACK", fps * 3, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "EWW BUTT FACE!", fps * 2, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Yeah yeah kids, you know it's ButteFace, You must be wondering why I'm back...", fps * 7, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Had to turn around, too many asteroids in the area.", fps * 5, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Pretty strange as this place is usually bare", fps * 4, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Oh well let's prepare for what's coming", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Well we've survived this group, but there are more coming", fps * 4, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(RED_ASTEROID, LVL8_AMT, LVL8_RELEASE_POINT, LVL8_SPEED, LVL8_K, LVL8_MASS, LVL8_HP, LVL8_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL8_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL8_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL8_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL8_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL8_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL8_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL8_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL8_AMT + LVL8A_AMT;
gameLevels.levels[level].moneyBonus = LVL8_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Hmm, these red ones are fast!", fps * 3, 15);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "DUH! We just fought these awhile ago!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Another job well done.", fps * 5, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(RED_ASTEROID, LVL9_AMT, LVL9_RELEASE_POINT, LVL9_SPEED, LVL9_K, LVL9_MASS, LVL9_HP, LVL9_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL9_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL9_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL9_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL9_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL9_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL9_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL9_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL9_AMT;
gameLevels.levels[level].moneyBonus = LVL9_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "More Red ones... Let's protect this ship!", fps * 4, 15);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "I'MMM BAAACCCKK!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "PINK AGAIN!", fps, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL10_AMT, LVL10_RELEASE_POINT, LVL10_SPEED, LVL10_K, LVL10_MASS, LVL10_HP, LVL10_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL10_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL10_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL10_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL10_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL10_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL10_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL10_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL10_AMT;
gameLevels.levels[level].moneyBonus = LVL10_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Who's this?", fps * 2, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "Um... Mr. Pink?", fps * 2, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_COMMANDO, "More insults...prepare for my next attack!'", fps * 4, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_COMMANDO, "I call this, 'ASTEROID PILLAR OF DEATH!'", fps * 2, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "OoOooOoooH! Cool name!", fps * 2, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Here it comes, get ready!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Yes we did it!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "We beat Pinky!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "IMPOSSIBLE!... That was just a test, we'll see how tough you really are! Sector 2 will be MINE!", fps * 6, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(SPLITTER, LVL11_AMT, LVL11_RELEASE_POINT, LVL11_SPEED, LVL11_K, LVL11_MASS, LVL11_HP, LVL11_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL11_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL11_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL11_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL11_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL11_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL11_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL11_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL11_AMT;
gameLevels.levels[level].moneyBonus = LVL11_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "I'll send a report to main station about Mr. Pink.", fps * 3, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "It looks like more asteroids are coming this way", fps * 3, 5);
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "These look big...", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "Each wave you survive, the harder it will get!!!", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(BOMB_BOT, LVL12_AMT, LVL12_RELEASE_POINT, LVL12_SPEED, LVL12_K, LVL12_MASS, LVL12_HP, LVL12_POWER, INS_SET_BOMB_BOT_MARCH);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL12_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL12_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL12_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL12_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL12_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL12_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL12_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL12_AMT;
gameLevels.levels[level].moneyBonus = LVL12_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_COMMANDO, "BOMB BOTS, ATTACK!", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Bomb bots?", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(RED_ASTEROID, LVL13_AMT, LVL13_RELEASE_POINT, LVL13_SPEED, LVL13_K, LVL13_MASS, LVL13_HP, LVL13_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL13_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL13_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL13_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL13_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL13_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL13_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL13_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL13_AMT;
gameLevels.levels[level].moneyBonus = LVL13_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "We've seen these before. But they seem to come in faster, stronger or in more numbers!", fps * 5, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "I've just got a report back from Main Station. I'll need some time to look it over.", fps * 5, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(EXPLODER_ASTEROID, LVL14_AMT, LVL14_RELEASE_POINT, LVL14_SPEED, LVL14_K, LVL14_MASS, LVL14_HP, LVL14_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL14_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL14_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL14_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL14_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL14_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL14_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL14_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL14_AMT;
gameLevels.levels[level].moneyBonus = LVL14_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "Time to strengthen the asteroids!", fps * 2, 5);
gameLevels.levels[level].numKillTriggers = 3;
gameLevels.levels[level].killTriggers[0] = createTriggerDefinition(KT_COUNT, ACT_TYPE_DISP_DIALOG, 2, 0);
gameLevels.levels[level].killTriggers[1] = createTriggerDefinition(KT_COUNT, ACT_TYPE_DISP_DIALOG, 10, 1);
gameLevels.levels[level].killTriggers[2] = createTriggerDefinition(KT_COUNT, ACT_TYPE_DISP_DIALOG, 15, 1);
gameLevels.levels[level].numTriggerDialogs = 3;
gameLevels.levels[level].triggerDialogs[0] = createDialogDefinition(CHAR_BUTTEFACE, "Wow...I've never seen these exploding ones before.", fps * 5, 5);
gameLevels.levels[level].triggerDialogs[1] = createDialogDefinition(CHAR_BOY_PILOT, "These are soooo COOL!", fps * 5, 5);
gameLevels.levels[level].triggerDialogs[2] = createDialogDefinition(CHAR_BUTTEFACE, "They may look cool, but they sure are deadly.", fps * 5, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "The explosions are capable of knocking our probes offline...", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "Did you get time to read the report?", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Not quite, give me a few minutes.", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL15_AMT, LVL15_RELEASE_POINT, LVL15_SPEED, LVL15_K, LVL15_MASS, LVL15_HP, LVL15_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(RED_ASTEROID, LVL15A_AMT, LVL15A_RELEASE_POINT, LVL15A_SPEED, LVL15A_K, LVL15A_MASS, LVL15A_HP, LVL15A_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 2;
gameLevels.levels[level].totalNumEnemies = LVL15_AMT + LVL15A_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL15_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL15_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL15_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL15_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL15_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL15_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL15_AMT + LVL15A_AMT;
gameLevels.levels[level].moneyBonus = LVL15_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Ok, I'll fill you in, but more asteroids are headed this way!", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "WE DID IT! Are you going to tell us Pink's Secret now?", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Oh yeah, I almost forgot", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL16_AMT, LVL16_RELEASE_POINT, LVL16_SPEED, LVL16_K, LVL16_MASS, LVL16_HP, LVL16_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL16_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL16_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL16_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL16_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL16_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL16_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL16_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (LVL16_AMT + LVL16A_AMT) + LVL16B_AMT;
gameLevels.levels[level].moneyBonus = LVL16_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "It looks like Mr. Pink has been able to redirect the flow of asteroids", fps * 5, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "He's been using a similar technology as our decoy probes.", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "However, he's been focusing his attack at our ship this whole time", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "He's also developed new technology and has been able to increase the strength of certain asteroids", fps * 6, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "As if we didn't know already! What a useless report!", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "HEY! You asked to hear it!", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "Looks like you've figure out my secret... but there's more!", fps * 4, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(RED_ASTEROID, LVL17_AMT, LVL17_RELEASE_POINT, LVL17_SPEED, LVL17_K, LVL17_MASS, LVL17_HP, LVL17_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL17_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL17_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL17_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL17_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL17_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL17_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL17_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (LVL17_AMT + LVL17A_AMT) + LVL17B_AMT;
gameLevels.levels[level].moneyBonus = LVL17_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "More Red?", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Pink's running out of ideas!", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "I don't think it's a good idea to taunt him...", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(EXPLODER_ASTEROID, LVL18_AMT, LVL18_RELEASE_POINT, LVL18_SPEED, LVL18_K, LVL18_MASS, LVL18_HP, LVL18_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL18_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL18_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL18_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL18_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL18_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL18_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL18_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL18_AMT;
gameLevels.levels[level].moneyBonus = LVL18_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "More of those dangerous exploding asteroids.", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "These are fun at least", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "If these aren't enough for you, prepare for my lastest!", fps * 4, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(PINK_ASTEROID, LVL19_AMT, LVL19_RELEASE_POINT, LVL19_SPEED, LVL19_K, LVL19_MASS, LVL19_HP, LVL19_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL19_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL19_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL19_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL19_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL19_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL19_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL19_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL19_AMT;
gameLevels.levels[level].moneyBonus = LVL19_MONEY_BONUS;
gameLevels.levels[level].levelPreDialogs[gameLevels.levels[level].lpreAmt++] = createDialogDefinition(CHAR_COMMANDO, "These are my latest super creation!", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "umm.. not very intimidating are they?", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "PINK ONES!", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "I LOVE PINK!", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "EWWW!, he's the enemy!", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "No! The color!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "That was odd, they seemed to 'heal' other asteroids upon being destroyed.", fps * 5, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Too bad he's a bad guy or else he'd be quite helpful.", fps * 4, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(EXPLODER_ASTEROID, LVL20_AMT, LVL20_RELEASE_POINT, LVL20_SPEED, LVL20_K, LVL20_MASS, LVL20_HP, LVL20_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL20_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL20_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL20_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL20_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL20_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL20_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL20_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL20_AMT;
gameLevels.levels[level].moneyBonus = LVL20_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "Argh..now for the PILLAR OF FIRE!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "IMPOSSIBLE!", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL21_AMT, LVL21_RELEASE_POINT, LVL21_SPEED, LVL21_K, LVL21_MASS, LVL21_HP, LVL21_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(RED_ASTEROID, LVL21A_AMT, LVL21A_RELEASE_POINT, LVL21A_SPEED, LVL21A_K, LVL21A_MASS, LVL21A_HP, LVL21A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(SPLITTER, LVL21B_AMT, LVL21B_RELEASE_POINT, LVL21B_SPEED, LVL21B_K, LVL21B_MASS, LVL21B_HP, LVL21B_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 3;
gameLevels.levels[level].totalNumEnemies = (LVL21_AMT + LVL21A_AMT) + LVL21B_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL21_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL21_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL21_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL21_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL21_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL21_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (LVL21_AMT + LVL21A_AMT) + LVL21B_AMT;
gameLevels.levels[level].moneyBonus = LVL21_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "You'll start seeing more diverse waves!", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "It was quite odd for them to be so uniform before...", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Mr. Pink sure has some powerful control over the asteroids", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL22_AMT, LVL22_RELEASE_POINT, LVL22_SPEED, LVL22_K, LVL22_MASS, LVL22_HP, LVL22_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(EXPLODER_ASTEROID, LVL22A_AMT, LVL22A_RELEASE_POINT, LVL22A_SPEED, LVL22A_K, LVL22A_MASS, LVL22A_HP, LVL22A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(PINK_ASTEROID, LVL22B_AMT, LVL22B_RELEASE_POINT, LVL22B_SPEED, LVL22B_K, LVL22B_MASS, LVL22B_HP, LVL22B_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 3;
gameLevels.levels[level].totalNumEnemies = (LVL22_AMT + LVL22A_AMT) + LVL22B_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL22_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL22_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL22_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL22_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL22_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL22_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (LVL22_AMT + LVL22A_AMT) + LVL22B_AMT;
gameLevels.levels[level].moneyBonus = LVL22_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Now this is starting to get fun!", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Well it sure looks colorful!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "BLAST! Won't you just go away!?", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL23_AMT, LVL23_RELEASE_POINT, LVL23_SPEED, LVL23_K, LVL23_MASS, LVL23_HP, LVL23_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(SPLITTER, LVL23A_AMT, LVL23A_RELEASE_POINT, LVL23A_SPEED, LVL23A_K, LVL23A_MASS, LVL23A_HP, LVL23A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(PINK_ASTEROID, LVL23B_AMT, LVL23B_RELEASE_POINT, LVL23B_SPEED, LVL23B_K, LVL23B_MASS, LVL23B_HP, LVL23B_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 3;
gameLevels.levels[level].totalNumEnemies = (LVL23_AMT + LVL23A_AMT) + LVL23B_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL23_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL23_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL23_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL23_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL23_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL23_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (LVL23_AMT + LVL23A_AMT) + LVL23B_AMT;
gameLevels.levels[level].moneyBonus = LVL23_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "He's starting to get desperate.", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "And running out of ideas.", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "Out of ideas? gfaw! I'm just getting started...", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(SPLITTER, LVL24_AMT, LVL24_RELEASE_POINT, LVL24_SPEED, LVL24_K, LVL24_MASS, LVL24_HP, LVL24_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(EXPLODER_ASTEROID, LVL24A_AMT, LVL24A_RELEASE_POINT, LVL24A_SPEED, LVL24A_K, LVL24A_MASS, LVL24A_HP, LVL24A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(PINK_ASTEROID, LVL24B_AMT, LVL24B_RELEASE_POINT, LVL24B_SPEED, LVL24B_K, LVL24B_MASS, LVL24B_HP, LVL24B_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 3;
gameLevels.levels[level].totalNumEnemies = (LVL24_AMT + LVL24A_AMT) + LVL24B_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL24_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL24_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL24_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL24_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL24_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL24_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (LVL24_AMT + LVL24A_AMT) + LVL24B_AMT;
gameLevels.levels[level].moneyBonus = LVL24_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "Soon you will see what I call.. Cata-PILLAR!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "You are starting to annoy me.", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(SPLITTER, LVL25_AMT, LVL25_RELEASE_POINT, LVL25_SPEED, LVL25_K, LVL25_MASS, LVL25_HP, LVL25_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL25_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL25_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL25_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL25_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL25_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL25_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL25_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL25_AMT;
gameLevels.levels[level].moneyBonus = LVL25_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "Unleash, the Cata- PILLAR!", fps * 2, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "It looks like one of his other attacks, just with the big Green Asteroids!", fps * 6, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Whatever it is, here it comes!", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "I can't believe it!", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(RED_ASTEROID, LVL26_AMT, LVL26_RELEASE_POINT, LVL26_SPEED, LVL26_K, LVL26_MASS, LVL26_HP, LVL26_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(PINK_ASTEROID, LVL26A_AMT, LVL26A_RELEASE_POINT, LVL26A_SPEED, LVL26A_K, LVL26A_MASS, LVL26A_HP, LVL26A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(SPLITTER, LVL26B_AMT, LVL26B_RELEASE_POINT, LVL26B_SPEED, LVL26B_K, LVL26B_MASS, LVL26B_HP, LVL26B_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 3;
gameLevels.levels[level].totalNumEnemies = (LVL26_AMT + LVL26A_AMT) + LVL26B_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL26_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL26_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL26_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL26_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL26_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL26_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (LVL26_AMT + LVL26A_AMT) + LVL26B_AMT;
gameLevels.levels[level].moneyBonus = LVL26_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "Won't you just go away!?", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "What's the magic word?", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "Tee Hee!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "I've had enough!!!", fps * 2, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(GRAY_ASTEROID, LVL27_AMT, LVL27_RELEASE_POINT, LVL27_SPEED, LVL27_K, LVL27_MASS, LVL27_HP, LVL27_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(RED_ASTEROID, LVL27A_AMT, LVL27A_RELEASE_POINT, LVL27A_SPEED, LVL27A_K, LVL27A_MASS, LVL27A_HP, LVL27A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(SPLITTER, LVL27B_AMT, LVL27B_RELEASE_POINT, LVL27B_SPEED, LVL27B_K, LVL27B_MASS, LVL27B_HP, LVL27B_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[3] = createEnemyDefinition(EXPLODER_ASTEROID, LVL27C_AMT, LVL27C_RELEASE_POINT, LVL27C_SPEED, LVL27C_K, LVL27C_MASS, LVL27C_HP, LVL27C_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[4] = createEnemyDefinition(PINK_ASTEROID, LVL27D_AMT, LVL27D_RELEASE_POINT, LVL27D_SPEED, LVL27D_K, LVL27D_MASS, LVL27D_HP, LVL27D_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 5;
gameLevels.levels[level].totalNumEnemies = (((LVL27_AMT + LVL27A_AMT) + LVL27B_AMT) + LVL27C_AMT) + LVL27D_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL27_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL27_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL27_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL27_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL27_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL27_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (((LVL27_AMT + LVL27A_AMT) + LVL27B_AMT) + LVL27C_AMT) + LVL27D_AMT;
gameLevels.levels[level].moneyBonus = LVL27_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "It looks like he's sending everything he's got!", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Be ready for anything!", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "I have a bad feeling about this!", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(BOMB_BOT, LVL28_AMT, LVL28_RELEASE_POINT, LVL28_SPEED, LVL28_K, LVL28_MASS, LVL28_HP, LVL28_POWER, INS_SET_BOMB_BOT_MARCH);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(RED_ASTEROID, LVL28A_AMT, LVL28A_RELEASE_POINT, LVL28A_SPEED, LVL28A_K, LVL28A_MASS, LVL28A_HP, LVL28A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(SPLITTER, LVL28B_AMT, LVL28B_RELEASE_POINT, LVL28B_SPEED, LVL28B_K, LVL28B_MASS, LVL28B_HP, LVL28B_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[3] = createEnemyDefinition(EXPLODER_ASTEROID, LVL28C_AMT, LVL28C_RELEASE_POINT, LVL28C_SPEED, LVL28C_K, LVL28C_MASS, LVL28C_HP, LVL28C_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[4] = createEnemyDefinition(PINK_ASTEROID, LVL28D_AMT, LVL28D_RELEASE_POINT, LVL28D_SPEED, LVL28D_K, LVL28D_MASS, LVL28D_HP, LVL28D_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 5;
gameLevels.levels[level].totalNumEnemies = (((LVL28_AMT + LVL28A_AMT) + LVL28B_AMT) + LVL28C_AMT) + LVL28D_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL28_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL28_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL28_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL28_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL28_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL28_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (((LVL28_AMT + LVL28A_AMT) + LVL28B_AMT) + LVL28C_AMT) + LVL28D_AMT;
gameLevels.levels[level].moneyBonus = LVL28_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "They're still coming in!", fps * 4, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "And they seem to be coming in larger numbers!", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "We aren't going to make it!", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(BOMB_BOT, LVL29_AMT, LVL29_RELEASE_POINT, LVL29_SPEED, LVL29_K, LVL29_MASS, LVL29_HP, LVL29_POWER, INS_SET_BOMB_BOT_MARCH_2);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(RED_ASTEROID, LVL29A_AMT, LVL29A_RELEASE_POINT, LVL29A_SPEED, LVL29A_K, LVL29A_MASS, LVL29A_HP, LVL29A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(SPLITTER, LVL29B_AMT, LVL29B_RELEASE_POINT, LVL29B_SPEED, LVL29B_K, LVL29B_MASS, LVL29B_HP, LVL29B_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[3] = createEnemyDefinition(EXPLODER_ASTEROID, LVL29C_AMT, LVL29C_RELEASE_POINT, LVL29C_SPEED, LVL29C_K, LVL29C_MASS, LVL29C_HP, LVL29C_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[4] = createEnemyDefinition(PINK_ASTEROID, LVL29D_AMT, LVL29D_RELEASE_POINT, LVL29D_SPEED, LVL29D_K, LVL29D_MASS, LVL29D_HP, LVL29D_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 5;
gameLevels.levels[level].totalNumEnemies = (((LVL29_AMT + LVL29A_AMT) + LVL29B_AMT) + LVL29C_AMT) + LVL29D_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL29_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL29_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL29_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL29_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL29_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL29_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (((LVL29_AMT + LVL29A_AMT) + LVL29B_AMT) + LVL29C_AMT) + LVL29D_AMT;
gameLevels.levels[level].moneyBonus = LVL29_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "This looks to be the last of it!", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "I don't know how much longer we can hold on!", fps * 4, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Whew we did it!", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "YES!", fps * 1, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "YES!", fps * 1, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(COMMANDO, LVL30_AMT, LVL30_RELEASE_POINT, LVL30_SPEED, LVL30_K, LVL30_MASS, LVL30_HP, LVL30_POWER, INS_SET_COMMANDO_MARCH);
gameLevels.levels[level].enemies[1] = createEnemyDefinition(EXPLODER_ASTEROID, LVL30A_AMT, LVL30A_RELEASE_POINT, LVL30A_SPEED, LVL30A_K, LVL30A_MASS, LVL30A_HP, LVL30A_POWER, INS_SET_NONE);
gameLevels.levels[level].enemies[2] = createEnemyDefinition(PINK_ASTEROID, LVL30A_AMT, LVL30A_RELEASE_POINT, LVL30A_SPEED, LVL30A_K, LVL30A_MASS, LVL30A_HP, LVL30A_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 3;
gameLevels.levels[level].totalNumEnemies = (LVL30_AMT + LVL30A_AMT) + LVL30B_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL30_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL30_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL30_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL30_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL30_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL30_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = (LVL30_AMT + LVL30A_AMT) + LVL30B_AMT;
gameLevels.levels[level].moneyBonus = LVL30_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_COMMANDO, "ArGH! I'll have to destroy you myself!", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Incoming ship! Prepare for counter attack!", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "NOOOOoooOOOOOooOOOo", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_COMMANDO, "MY MASTERFUL PLAN!!! MY PERSONAL AIRFLEET... AVENGE Meeeeeeee!...", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "WE DID IT!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_GIRL_PILOT, "BYE BYE, I have a NEW favorite color now", fps * 4, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(AIR_FLEET, LVL31_AMT, LVL31_RELEASE_POINT, LVL31_SPEED, LVL31_K, LVL31_MASS, LVL31_HP, LVL31_POWER, INS_SET_AIR_FLEET_MARCH);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL31_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL31_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL31_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL31_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL31_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL31_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL31_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL31_AMT;
gameLevels.levels[level].moneyBonus = LVL31_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "He wasn't bluffing... Incoming ships", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "This doesn't look good :-( !", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "WAHOOOOOO!", fps * 3, 5);
level++;
gameLevels.levels[level].enemies[0] = createEnemyDefinition(PLANET_ASTEROID, LVL32_AMT, LVL32_RELEASE_POINT, LVL32_SPEED, LVL32_K, LVL32_MASS, LVL32_HP, LVL32_POWER, INS_SET_NONE);
gameLevels.levels[level].totalEnemyTypes = 1;
gameLevels.levels[level].totalNumEnemies = LVL32_AMT;
gameLevels.levels[level].currentReleaseAngle = LVL32_CURRENT_RELEASE_ANGLE;
gameLevels.levels[level].releaseAngleIncrement = LVL32_RELEASE_ANGLE_INCREMENT;
gameLevels.levels[level].releaseSpeed = LVL32_RELEASE_SPEED;
gameLevels.levels[level].enemyReleaseStrategy = LVL32_RELEASE_STRATEGY;
gameLevels.levels[level].countDownTime = LVL32_COUNTDOWN;
gameLevels.levels[level].winCondition = LVL32_WIN_CONDITION;
gameLevels.levels[level].winConditionVar = LVL32_AMT;
gameLevels.levels[level].moneyBonus = LVL32_MONEY_BONUS;
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "I wonder what happened to his weapon...", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "What's this? Huge object headed our way!!!", fps * 3, 5);
gameLevels.levels[level].gamePreDialogs[gameLevels.levels[level].gpredAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Why did you have to ask?", fps * 3, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "We've done it again!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BOY_PILOT, "Beaten all odds!", fps * 2, 5);
gameLevels.levels[level].gamePostDialogs[gameLevels.levels[level].gpostdAmt++] = createDialogDefinition(CHAR_BUTTEFACE, "Congratulations!", fps * 2, 5);
}
function createEnemyDefinition(type, amt, releasePoint, speed, k, mass, hp, power, instructionSet) {
enemy = _root.attachMovie("Variable", "LevelEnemies" + depth, depth--);
enemy.type = type;
enemy.amount = amt;
enemy.releasePoint = releasePoint;
enemy.speed = speed;
enemy.speedSquared = speed;
enemy.k = k;
enemy.mass = mass;
enemy.hp = hp;
enemy._x = OFFSCREEN_X;
enemy._y = OFFSCREEN_Y;
enemy.power = power;
enemy.instructionSet = instructionSet;
return(enemy);
}
function createDialogDefinition(presenter, textString, ttl, preDelay) {
dialog = _root.attachMovie("Variable", "Dialog" + depth, depth--);
dialog.ttl = ttl;
dialog.presenter = presenter;
dialog.textString = textString;
dialog.preDelay = preDelay;
dialog._x = OFFSCREEN_X;
dialog._y = OFFSCREEN_Y;
return(dialog);
}
function createTriggerDefinition(triggerType, triggerActionType, triggerValue1, triggerValue2) {
gameTrigger = _root.attachMovie("Variable", "Trigger" + depth, depth--);
gameTrigger._x = OFFSCREEN_X;
gameTrigger._y = OFFSCREEN_Y;
gameTrigger.triggerType = triggerType;
gameTrigger.actionType = triggerActionType;
gameTrigger.value1 = triggerValue1;
gameTrigger.value2 = triggerValue2;
return(gameTrigger);
}
function copyDialog(dialogTarget, dialogDest) {
dialogDest.ttl = dialogTarget.ttl;
dialogDest.textString = dialogTarget.textString;
dialogDest.presenter = dialogTarget.presenter;
dialogDest.preDelay = dialogTarget.preDelay;
}
function copyTrigger(triggerTarget, triggerDest) {
triggerDest.triggerType = triggerTarget.triggerType;
triggerDest.actionType = triggerTarget.actionType;
triggerDest.value1 = triggerTarget.value1;
triggerDest.value2 = triggerTarget.value2;
triggerDest.complete = false;
}
function copyLevel(levelTarget, levelDest) {
levelDest.lpredAmt = levelTarget.lpredAmt;
if (levelTarget.lpredAmt > 0) {
j = 0;
while (j < levelTarget.lpredAmt) {
copyDialog(levelTarget.levelPreDialogs[j], levelDest.levelPreDialogs[j]);
j++;
}
}
levelDest.gpredAmt = levelTarget.gpredAmt;
if (levelTarget.gpredAmt > 0) {
j = 0;
while (j < levelTarget.gpredAmt) {
copyDialog(levelTarget.gamePreDialogs[j], levelDest.gamePreDialogs[j]);
j++;
}
}
levelDest.gpostdAmt = levelTarget.gpostdAmt;
if (levelTarget.gpostdAmt > 0) {
j = 0;
while (j < levelTarget.gpostdAmt) {
copyDialog(levelTarget.gamePostDialogs[j], levelDest.gamePostDialogs[j]);
j++;
}
}
levelDest.lpostdAmt = levelTarget.lpostdAmt;
if (levelTarget.lpostdAmt > 0) {
j = 0;
while (j < levelTarget.lpostdAmt) {
copyDialog(levelTarget.levelPostDialogs[j], levelDest.levelPostDialogs[j]);
j++;
}
}
levelDest.numKillTriggers = levelTarget.numKillTriggers;
if (levelTarget.numKillTriggers > 0) {
j = 0;
while (j < levelTarget.numKillTriggers) {
copyTrigger(levelTarget.killTriggers[j], levelDest.killTriggers[j]);
j++;
}
}
levelDest.numTriggerDialogs = levelTarget.numTriggerDialogs;
if (levelTarget.numTriggerDialogs > 0) {
j = 0;
while (j < levelTarget.numTriggerDialogs) {
copyDialog(levelTarget.triggerDialogs[j], levelDest.triggerDialogs[j]);
j++;
}
}
j = 0;
while (j < 5) {
levelDest.enemies[j].type = levelTarget.enemies[j].type;
levelDest.enemies[j].amount = levelTarget.enemies[j].amount;
levelDest.enemies[j].releasePoint = levelTarget.enemies[j].releasePoint;
levelDest.enemies[j].speed = levelTarget.enemies[j].speed;
levelDest.enemies[j].speedSquared = levelTarget.enemies[j].speedSquared;
levelDest.enemies[j].k = levelTarget.enemies[j].k;
levelDest.enemies[j].mass = levelTarget.enemies[j].mass;
levelDest.enemies[j].hp = levelTarget.enemies[j].hp;
levelDest.enemies[j].speed = levelTarget.enemies[j].speed;
levelDest.enemies[j].power = levelTarget.enemies[j].power;
levelDest.enemies[j].instructionSet = levelTarget.enemies[j].instructionSet;
levelDest.totalNumEnemies = levelTarget.totalNumEnemies;
levelDest.totalEnemyTypes = levelTarget.totalEnemyTypes;
levelDest.enemyReleaseStrategy = levelTarget.enemyReleaseStrategy;
levelDest.currentReleaseAngle = levelTarget.currentReleaseAngle;
levelDest.releaseAngleIncrement = levelTarget.releaseAngleIncrement;
levelDest.releaseSpeed = levelTarget.releaseSpeed;
levelDest.winCondition = levelTarget.winCondition;
levelDest.winConditionVar = levelTarget.winConditionVar;
levelDest.moneyBonus = levelTarget.moneyBonus;
j++;
}
levelDest.countDownTime = levelTarget.countDownTime;
levelDest.levelNum = levelTarget.levelNum;
}
function createSpawnling(splitter) {
if (enemyList.getNextIndex() != -1) {
cSpawnling = greenAsteroids.getNext();
if (cSpawnling != -1) {
reInitAsteroid(cSpawnling, splitter.speed, splitter.k * 0.25, 1, splitter.hpMax * 0.25, splitter.power * 0.25);
}
cSpawnling.levelNum = NOT_TRUE_ENEMY;
cSpawnling._x = splitter._x;
cSpawnling._y = splitter._y;
cSpawnling.oldX = splitter._x;
cSpawnling.oldY = splitter._y;
enemyList.addObject(cSpawnling);
}
return(cSpawnling);
}
function createAsteroidShieldUnit(protectedUnit, initialOrbitAngle, orbitAngleIncrementor, orbitSpeed) {
if (enemyList.getNextIndex() != -1) {
cAsteroidShieldUnit = purpleAsteroids.getNext();
if (cAsteroidShieldUnit != -1) {
reInitPurpleAsteroid(cAsteroidShieldUnit, orbitSpeed, protectedUnit.k * 0.25, protectedUnit.mass * 0.25, protectedUnit.hp * 0.25);
cAsteroidShieldUnit.gameTarget = protectedUnit;
cAsteroidShieldUnit.step = orbitStep;
cAsteroidShieldUnit.orbitAngle = initialOrbitAngle;
cAsteroidShieldUnit.orbitAngleIncrementor = orbitAngleIncrementor;
}
cAsteroidShieldUnit.levelNum = NOT_TRUE_ENEMY;
cAsteroidShieldUnit._x = protectedUnit._x;
cAsteroidShieldUnit._y = protectedUnit._y;
cAsteroidShieldUnit.resetOrbiter = function () {
this._x = this.gameTarget._x + (this.gameTarget.orbitRadius * Math.cos(this.orbitAngle * DEG_TO_RAD));
this._y = this.gameTarget._y + (this.gameTarget.orbitRadius * Math.sin(this.orbitAngle * DEG_TO_RAD));
};
enemyList.addObject(cAsteroidShieldUnit);
}
return(cAsteroidShieldUnit);
}
init();
Frame 32
function init() {
PS_IDLE = 0;
PS_HIT = 1;
PS_DISCHARGED = 2;
REPULSOR_PROBE = 0;
ROCKET_PROBE = 1;
BOMB_PROBE = 2;
PB_PROBE = 3;
STASIS_PROBE = 4;
DECOY_PROBE = 5;
BATTERY_PROBE = 6;
WALL_PROBE = 7;
COST_OF_REPULSOR_PROBE = 400;
COST_OF_ROCKET_PROBE = 600;
COST_OF_PB_PROBE = 450;
COST_OF_BOMB_PROBE = 400;
COST_OF_DECOY_PROBE = 550;
COST_OF_STASIS_PROBE = 425;
COST_OF_BATTERY_PROBE = 150;
COST_OF_WALL_PROBE = 100;
REPULSOR_PROBE_CONTROL = 4;
ROCKET_PROBE_CONTROL = 7;
PB_PROBE_CONTROL = 5;
BOMB_PROBE_CONTROL = 4;
DECOY_PROBE_CONTROL = 6;
STASIS_PROBE_CONTROL = 4;
BATTERY_PROBE_CONTROL = 2;
WALL_PROBE_CONTROL = 2;
REPULSOR_PROBE_HP = 200;
REPULSOR_PROBE_MASS = 1;
REPULSOR_PROBE_SPEED = 0.3;
REPULSOR_PROBE_POWER = 152;
REPULSOR_PROBE_ATTACK_RATE = 0.75;
REPULSOR_PROBE_SHOT_RATE = 1.5;
REPULSOR_PROBE_RANGE = 100;
REPULSOR_PROBE_SHOTS_PER_RELOAD = 8;
REPULSOR_PROBE_RECHARGE_TIME = fps * 8;
REPULSOR_PROBE_REDUCTION = 1;
REPULSOR_PROBE_PROJ_SPEED = 8;
REPULSOR_PROBE_PROJ_TTL = fps;
REPULSOR_PROBE_PROJ_MASS = 0.5;
REPULSOR_PROBE_PROJ_K = 1;
REPULSOR_PROBE_PROJ_TERMINAL_VELOCITY = 15;
ROCKET_PROBE_HP = 150;
ROCKET_PROBE_MASS = 1;
ROCKET_PROBE_SPEED = 0.2;
ROCKET_PROBE_POWER = 228;
ROCKET_PROBE_ATTACK_RATE = 2.5;
ROCKET_PROBE_SHOT_RATE = 3.5;
ROCKET_PROBE_RANGE = 100;
ROCKET_PROBE_SHOTS_PER_RELOAD = 4;
ROCKET_PROBE_RECHARGE_TIME = fps * 8;
ROCKET_PROBE_REDUCTION = 1;
ROCKET_PROBE_PROJ_SPEED = 8;
ROCKET_PROBE_PROJ_TTL = fps;
ROCKET_PROBE_PROJ_MASS = 0.5;
ROCKET_PROBE_PROJ_K = 0.5;
ROCKET_PROBE_PROJ_TERMINAL_VELOCITY = 10;
BOMB_PROBE_HP = 400;
BOMB_PROBE_MASS = 1;
BOMB_PROBE_SPEED = 0.3;
BOMB_PROBE_POWER = 900;
BOMB_PROBE_ATTACK_RATE = 5;
BOMB_PROBE_SHOT_RATE = 1;
BOMB_PROBE_RANGE = 105;
BOMB_PROBE_SHOTS_PER_RELOAD = 1;
BOMB_PROBE_RECHARGE_TIME = fps * 8;
BOMB_PROBE_REDUCTION = 1;
BOMB_PROBE_PROJ_SPEED = 8;
BOMB_PROBE_PROJ_TTL = fps;
BOMB_PROBE_PROJ_MASS = 1;
BOMB_PROBE_PROJ_K = 1;
PB_PROBE_HP = 175;
PB_PROBE_MASS = 1;
PB_PROBE_SPEED = 0.3;
PB_PROBE_POWER = 48;
PB_PROBE_ATTACK_RATE = 0.75;
PB_PROBE_SHOT_RATE = 15;
PB_PROBE_RANGE = 100;
PB_PROBE_SHOTS_PER_RELOAD = 8;
PB_PROBE_RECHARGE_TIME = fps * 8;
PB_PROBE_REDUCTION = 1;
PB_PROBE_PROJ_SPEED = 20;
PB_PROBE_PROJ_TTL = fps;
PB_PROBE_PROJ_MASS = 0.01;
PB_PROBE_PROJ_K = 1;
PB_PROBE_PROJ_TERMINAL_VELOCITY = 30;
STASIS_PROBE_HP = 125;
STASIS_PROBE_MASS = 1;
STASIS_PROBE_SPEED = 0.2;
STASIS_PROBE_POWER = 10;
STASIS_PROBE_ATTACK_RATE = 2;
STASIS_PROBE_SHOT_RATE = 0.5;
STASIS_PROBE_RANGE = 100;
STASIS_PROBE_SHOTS_PER_RELOAD = 100;
STASIS_PROBE_RECHARGE_TIME = fps * 8;
STASIS_PROBE_REDUCTION = 1;
STASIS_PROBE_PROJ_SPEED = 20;
STASIS_PROBE_PROJ_TTL = fps * 10;
STASIS_PROBE_PROJ_MASS = 0.01;
STASIS_PROBE_PROJ_K = 0.01;
STASIS_PROBE_PROJ_TERMINAL_VELOCITY = 10;
DECOY_PROBE_HP = 20;
DECOY_PROBE_MASS = 1;
DECOY_PROBE_SPEED = 0.15;
DECOY_PROBE_POWER = 10;
DECOY_PROBE_ATTACK_RATE = 0.5;
DECOY_PROBE_SHOT_RATE = 2;
DECOY_PROBE_RANGE = 125;
DECOY_PROBE_SHOTS_PER_RELOAD = 2;
DECOY_PROBE_RECHARGE_TIME = fps * 8;
DECOY_PROBE_REDUCTION = 1;
DECOY_PROBE_PROJ_SPEED = 8;
DECOY_PROBE_PROJ_TTL = fps;
DECOY_PROBE_PROJ_MASS = 1;
DECOY_PROBE_PROJ_K = 1;
BATTERY_PROBE_HP = 150;
BATTERY_PROBE_MASS = 1;
BATTERY_PROBE_SPEED = 0.15;
BATTERY_PROBE_POWER = 4;
BATTERY_PROBE_ATTACK_RATE = 1;
BATTERY_PROBE_SHOT_RATE = 1;
BATTERY_PROBE_RANGE = 100;
BATTERY_PROBE_SHOTS_PER_RELOAD = 1;
BATTERY_PROBE_RECHARGE_TIME = fps * 6;
BATTERY_PROBE_REDUCTION = 1;
BATTERY_PROBE_PROJ_SPEED = 8;
BATTERY_PROBE_PROJ_TTL = fps;
BATTERY_PROBE_PROJ_MASS = 1;
BATTERY_PROBE_PROJ_K = 1;
WALL_PROBE_HP = 350;
WALL_PROBE_MASS = 1;
WALL_PROBE_SPEED = 0.4;
WALL_PROBE_POWER = 10;
WALL_PROBE_ATTACK_RATE = 8;
WALL_PROBE_SHOT_RATE = 10;
WALL_PROBE_RANGE = 100;
WALL_PROBE_SHOTS_PER_RELOAD = 4;
WALL_PROBE_RECHARGE_TIME = fps * 8;
WALL_PROBE_REDUCTION = 1;
WALL_PROBE_PROJ_SPEED = 8;
WALL_PROBE_PROJ_TTL = fps;
WALL_PROBE_PROJ_MASS = 1;
WALL_PROBE_PROJ_K = 1;
}
function buildRepulsorProbe(xPos, yPos) {
index = probes.getNextIndex();
zDepth = probeDepth - index;
repulsorProbe = _root.attachMovie("RepulsorProbeMC", "RepulsorMC" + zDepth, zDepth);
repulsorProbe.index = index;
initBasicProbe(repulsorProbe);
repulsorProbe._x = xPos;
repulsorProbe._y = yPos;
repulsorProbe.origX = xPos;
repulsorProbe.origY = yPos;
repulsorProbe.oldX = xPos;
repulsorProbe.oldY = yPos;
repulsorProbe.hp = REPULSOR_PROBE_HP;
repulsorProbe.hpMax = REPULSOR_PROBE_HP;
repulsorProbe.mass = REPULSOR_PROBE_MASS;
repulsorProbe.speed = REPULSOR_PROBE_SPEED;
repulsorProbe.power = REPULSOR_PROBE_POWER;
repulsorProbe.probeType = REPULSOR_PROBE;
repulsorProbe.range = REPULSOR_PROBE_RANGE;
repulsorProbe.setReloadRate(REPULSOR_PROBE_ATTACK_RATE);
repulsorProbe.setShotRate(REPULSOR_PROBE_SHOT_RATE);
repulsorProbe.reloadTimer = repulsorProbe.fullReloadCooldown;
repulsorProbe.shotCooldownTimer = 0;
repulsorProbe.shotsFired = 0;
repulsorProbe.shotsPerReload = REPULSOR_PROBE_SHOTS_PER_RELOAD;
repulsorProbe.rechargeTime = REPULSOR_PROBE_RECHARGE_TIME;
repulsorProbe.flashCounter = 0;
repulsorProbe.reduction = REPULSOR_PROBE_REDUCTION;
repulsorProbe.control = REPULSOR_PROBE_CONTROL;
repulsorProbe.cost = COST_OF_REPULSOR_PROBE;
repulsorProbe.onHit1Skill = ON_HIT_DEFLECT;
repulsorProbe.onHit2Skill = ON_HIT_STRUCTURAL;
repulsorProbe.onHit3Skill = ON_HIT_LINK;
repulsorProbe.upgradeLevel = 1;
repulsorProbe.k = 4;
repulsorProbe.projSpeed = REPULSOR_PROBE_PROJ_SPEED;
repulsorProbe.projTTL = REPULSOR_PROBE_PROJ_TTL;
repulsorProbe.projMass = REPULSOR_PROBE_PROJ_MASS;
repulsorProbe.projK = REPULSOR_PROBE_PROJ_K;
repulsorProbe.projTerminalVelocity = REPULSOR_PROBE_PROJ_TERMINAL_VELOCITY;
repulsorProbe.projTerminalVelocitySq = REPULSOR_PROBE_PROJ_TERMINAL_VELOCITY * REPULSOR_PROBE_PROJ_TERMINAL_VELOCITY;
repulsorProbe.createProjectile = createRepulsorBlast;
return(repulsorProbe);
}
function buildRocketProbe(xPos, yPos) {
index = probes.getNextIndex();
zDepth = probeDepth - index;
rocketProbe = _root.attachMovie("RocketProbeMC", "RocketProbeMC" + zDepth, zDepth);
rocketProbe.index = index;
initBasicProbe(rocketProbe);
rocketProbe._x = xPos;
rocketProbe._y = yPos;
rocketProbe.origX = xPos;
rocketProbe.origY = yPos;
rocketProbe.oldX = xPos;
rocketProbe.oldY = yPos;
rocketProbe.hp = ROCKET_PROBE_HP;
rocketProbe.hpMax = ROCKET_PROBE_HP;
rocketProbe.mass = ROCKET_PROBE_MASS;
rocketProbe.speed = ROCKET_PROBE_SPEED;
rocketProbe.power = ROCKET_PROBE_POWER;
rocketProbe.probeType = ROCKET_PROBE;
rocketProbe.range = ROCKET_PROBE_RANGE;
rocketProbe.setReloadRate(ROCKET_PROBE_ATTACK_RATE);
rocketProbe.setShotRate(ROCKET_PROBE_SHOT_RATE);
rocketProbe.reloadTimer = rocketProbe.fullReloadCooldown;
rocketProbe.shotCooldownTimer = 0;
rocketProbe.shotsFired = 0;
rocketProbe.shotsPerReload = ROCKET_PROBE_SHOTS_PER_RELOAD;
rocketProbe.rechargeTime = ROCKET_PROBE_RECHARGE_TIME;
rocketProbe.flashCounter = 0;
rocketProbe.reduction = ROCKET_PROBE_REDUCTION;
rocketProbe.control = ROCKET_PROBE_CONTROL;
rocketProbe.cost = COST_OF_ROCKET_PROBE;
rocketProbe.onHit1Skill = ON_HIT_HEAT;
rocketProbe.onHit2Skill = ON_HIT_STRUCTURAL;
rocketProbe.onHit3Skill = ON_HIT_LINK;
rocketProbe.upgradeLevel = 1;
rocketProbe.k = 4;
rocketProbe.projSpeed = ROCKET_PROBE_PROJ_SPEED;
rocketProbe.projTTL = ROCKET_PROBE_PROJ_TTL;
rocketProbe.projMass = ROCKET_PROBE_PROJ_MASS;
rocketProbe.projK = ROCKET_PROBE_PROJ_K;
rocketProbe.projTerminalVelocity = ROCKET_PROBE_PROJ_TERMINAL_VELOCITY;
rocketProbe.projTerminalVelocitySq = ROCKET_PROBE_PROJ_TERMINAL_VELOCITY * ROCKET_PROBE_PROJ_TERMINAL_VELOCITY;
rocketProbe.createProjectile = createMissile;
return(rocketProbe);
}
function buildBombProbe(xPos, yPos) {
index = probes.getNextIndex();
zDepth = probeDepth - index;
bombProbe = _root.attachMovie("BombProbeMC", "BombProbeMC" + zDepth, zDepth);
bombProbe.index = index;
initBasicProbe(bombProbe);
bombProbe._x = xPos;
bombProbe._y = yPos;
bombProbe.origX = xPos;
bombProbe.origY = yPos;
bombProbe.oldX = xPos;
bombProbe.oldY = yPos;
bombProbe.hp = BOMB_PROBE_HP;
bombProbe.hpMax = BOMB_PROBE_HP;
bombProbe.mass = BOMB_PROBE_MASS;
bombProbe.speed = BOMB_PROBE_SPEED;
bombProbe.power = BOMB_PROBE_POWER;
bombProbe.probeType = BOMB_PROBE;
bombProbe.range = BOMB_PROBE_RANGE;
bombProbe.setReloadRate(BOMB_PROBE_ATTACK_RATE);
bombProbe.setShotRate(BOMB_PROBE_SHOT_RATE);
bombProbe.reloadTimer = bombProbe.fullReloadCooldown;
bombProbe.shotCooldownTimer = 0;
bombProbe.shotsFired = 0;
bombProbe.shotsPerReload = BOMB_PROBE_SHOTS_PER_RELOAD;
bombProbe.rechargeTime = BOMB_PROBE_RECHARGE_TIME;
bombProbe.flashCounter = 0;
bombProbe.reduction = BOMB_PROBE_REDUCTION;
bombProbe.control = BOMB_PROBE_CONTROL;
bombProbe.cost = COST_OF_BOMB_PROBE;
bombProbe.onHit1Skill = ON_HIT_HEAT;
bombProbe.onHit2Skill = ON_HIT_STRUCTURAL;
bombProbe.onHit3Skill = ON_HIT_LINK;
bombProbe.upgradeLevel = 1;
bombProbe.k = 4;
bombProbe.projSpeed = BOMB_PROBE_PROJ_SPEED;
bombProbe.projTTL = BOMB_PROBE_PROJ_TTL;
bombProbe.projMass = BOMB_PROBE_PROJ_MASS;
bombProbe.projK = BOMB_PROBE_PROJ_K;
bombProbe.createProjectile = createBombBurst;
return(bombProbe);
}
function buildPBProbe(xPos, yPos) {
index = probes.getNextIndex();
zDepth = probeDepth - index;
pbProbe = _root.attachMovie("ParticleBlasterProbeMC", "PBProbeMC" + zDepth, zDepth);
pbProbe.index = index;
initBasicProbe(pbProbe);
pbProbe._x = xPos;
pbProbe._y = yPos;
pbProbe.origX = xPos;
pbProbe.origY = yPos;
pbProbe.oldX = xPos;
pbProbe.oldY = yPos;
pbProbe.hp = PB_PROBE_HP;
pbProbe.hpMax = PB_PROBE_HP;
pbProbe.mass = PB_PROBE_MASS;
pbProbe.speed = PB_PROBE_SPEED;
pbProbe.power = PB_PROBE_POWER;
pbProbe.probeType = PB_PROBE;
pbProbe.range = PB_PROBE_RANGE;
pbProbe.setReloadRate(PB_PROBE_ATTACK_RATE);
pbProbe.setShotRate(PB_PROBE_SHOT_RATE);
pbProbe.reloadTimer = pbProbe.fullReloadCooldown;
pbProbe.shotCooldownTimer = 0;
pbProbe.shotsFired = 0;
pbProbe.shotsPerReload = PB_PROBE_SHOTS_PER_RELOAD;
pbProbe.rechargeTime = PB_PROBE_RECHARGE_TIME;
pbProbe.flashCounter = 0;
pbProbe.reduction = PB_PROBE_REDUCTION;
pbProbe.control = PB_PROBE_CONTROL;
pbProbe.cost = COST_OF_PB_PROBE;
pbProbe.onHit1Skill = ON_HIT_HEAT;
pbProbe.onHit2Skill = ON_HIT_STRUCTURAL;
pbProbe.onHit3Skill = ON_HIT_LINK;
pbProbe.upgradeLevel = 1;
pbProbe.k = 4;
pbProbe.projSpeed = PB_PROBE_PROJ_SPEED;
pbProbe.projTTL = PB_PROBE_PROJ_TTL;
pbProbe.projMass = PB_PROBE_PROJ_MASS;
pbProbe.projK = PB_PROBE_PROJ_K;
pbProbe.projTerminalVelocity = PB_PROBE_PROJ_TERMINAL_VELOCITY;
pbProbe.projTerminalVelocitySq = PB_PROBE_PROJ_TERMINAL_VELOCITY * PB_PROBE_PROJ_TERMINAL_VELOCITY;
pbProbe.createProjectile = createParticleBlast;
return(pbProbe);
}
function buildStasisProbe(xPos, yPos) {
index = probes.getNextIndex();
zDepth = probeDepth - index;
stasisProbe = _root.attachMovie("StasisProbeMC", "StasisProbeMC" + zDepth, zDepth);
stasisProbe.index = index;
initBasicProbe(stasisProbe);
stasisProbe._x = xPos;
stasisProbe._y = yPos;
stasisProbe.origX = xPos;
stasisProbe.origY = yPos;
stasisProbe.oldX = xPos;
stasisProbe.oldY = yPos;
stasisProbe.hp = STASIS_PROBE_HP;
stasisProbe.hpMax = STASIS_PROBE_HP;
stasisProbe.mass = STASIS_PROBE_MASS;
stasisProbe.speed = STASIS_PROBE_SPEED;
stasisProbe.power = STASIS_PROBE_POWER;
stasisProbe.probeType = STASIS_PROBE;
stasisProbe.range = STASIS_PROBE_RANGE;
stasisProbe.setReloadRate(STASIS_PROBE_ATTACK_RATE);
stasisProbe.setShotRate(STASIS_PROBE_SHOT_RATE);
stasisProbe.reloadTimer = stasisProbe.fullReloadCooldown;
stasisProbe.shotCooldownTimer = 0;
stasisProbe.shotsFired = 0;
stasisProbe.shotsPerReload = STASIS_PROBE_SHOTS_PER_RELOAD;
stasisProbe.rechargeTime = STASIS_PROBE_RECHARGE_TIME;
stasisProbe.flashCounter = 0;
stasisProbe.reduction = STASIS_PROBE_REDUCTION;
stasisProbe.control = STASIS_PROBE_CONTROL;
stasisProbe.cost = COST_OF_STASIS_PROBE;
stasisProbe.slowEffect = 0.5;
stasisProbe.coldTime = 5;
stasisProbe.onHit1Skill = ON_HIT_FROST;
stasisProbe.onHit2Skill = ON_HIT_STRUCTURAL;
stasisProbe.onHit3Skill = ON_HIT_LINK;
stasisProbe.onHit1SlowEffect = 0;
stasisProbe.onHit1ColdTime = 0;
stasisProbe.upgradeLevel = 1;
stasisProbe.k = 4;
stasisProbe.projSpeed = STASIS_PROBE_PROJ_SPEED;
stasisProbe.projTTL = STASIS_PROBE_PROJ_TTL;
stasisProbe.projMass = STASIS_PROBE_PROJ_MASS;
stasisProbe.projK = STASIS_PROBE_PROJ_K;
stasisProbe.projTerminalVelocity = STASIS_PROBE_PROJ_TERMINAL_VELOCITY;
stasisProbe.projTerminalVelocitySq = STASIS_PROBE_PROJ_TERMINAL_VELOCITY * STASIS_PROBE_PROJ_TERMINAL_VELOCITY;
stasisProbe.createProjectile = fireStasisBurst;
return(stasisProbe);
}
function buildDecoyProbe(xPos, yPos) {
index = probes.getNextIndex();
zDepth = probeDepth - index;
decoyProbe = _root.attachMovie("DecoyProbeMC", "DecoyProbeMC" + zDepth, zDepth);
decoyProbe.index = index;
initBasicProbe(decoyProbe);
decoyProbe._x = xPos;
decoyProbe._y = yPos;
decoyProbe.origX = xPos;
decoyProbe.origY = yPos;
decoyProbe.oldX = xPos;
decoyProbe.oldY = yPos;
decoyProbe.hp = DECOY_PROBE_HP;
decoyProbe.hpMax = DECOY_PROBE_HP;
decoyProbe.mass = DECOY_PROBE_MASS;
decoyProbe.speed = DECOY_PROBE_SPEED;
decoyProbe.power = DECOY_PROBE_POWER;
decoyProbe.probeType = DECOY_PROBE;
decoyProbe.range = DECOY_PROBE_RANGE;
decoyProbe.setReloadRate(DECOY_PROBE_ATTACK_RATE);
decoyProbe.setShotRate(DECOY_PROBE_SHOT_RATE);
decoyProbe.reloadTimer = decoyProbe.fullReloadCooldown;
decoyProbe.shotCooldownTimer = 0;
decoyProbe.shotsFired = 0;
decoyProbe.shotsPerReload = DECOY_PROBE_SHOTS_PER_RELOAD;
decoyProbe.rechargeTime = DECOY_PROBE_RECHARGE_TIME;
decoyProbe.flashCounter = 0;
decoyProbe.reduction = DECOY_PROBE_REDUCTION;
decoyProbe.control = DECOY_PROBE_CONTROL;
decoyProbe.cost = COST_OF_DECOY_PROBE;
decoyProbe.onHit1Skill = ON_HIT_SPIKED;
decoyProbe.onHit2Skill = ON_HIT_STRUCTURAL;
decoyProbe.onHit3Skill = ON_HIT_LINK;
decoyProbe.upgradeLevel = 1;
decoyProbe.k = 4;
decoyProbe.projSpeed = DECOY_PROBE_PROJ_SPEED;
decoyProbe.projTTL = DECOY_PROBE_PROJ_TTL;
decoyProbe.projMass = DECOY_PROBE_PROJ_MASS;
decoyProbe.projK = DECOY_PROBE_PROJ_K;
decoyProbe.fireShot = function () {
if (this.readyToFire == true) {
this.shotCooldownTimer = this.shotCooldown;
this.partialReloadCooldownCounter = 0;
this.shotsFired++;
this.readyToFire = false;
}
};
return(decoyProbe);
}
function buildBatteryProbe(xPos, yPos) {
index = probes.getNextIndex();
zDepth = probeDepth - index;
batteryProbe = _root.attachMovie("BatteryProbeMC", "BatteryProbeMC" + zDepth, zDepth);
batteryProbe.index = index;
initBasicProbe(batteryProbe);
batteryProbe._x = xPos;
batteryProbe._y = yPos;
batteryProbe.origX = xPos;
batteryProbe.origY = yPos;
batteryProbe.oldX = xPos;
batteryProbe.oldY = yPos;
batteryProbe.hp = BATTERY_PROBE_HP;
batteryProbe.hpMax = BATTERY_PROBE_HP;
batteryProbe.mass = BATTERY_PROBE_MASS;
batteryProbe.speed = BATTERY_PROBE_SPEED;
batteryProbe.power = BATTERY_PROBE_POWER;
batteryProbe.probeType = BATTERY_PROBE;
batteryProbe.range = BATTERY_PROBE_RANGE;
batteryProbe.setReloadRate(BATTERY_PROBE_ATTACK_RATE);
batteryProbe.setShotRate(BATTERY_PROBE_SHOT_RATE);
batteryProbe.reloadTimer = batteryProbe.fullReloadCooldown;
batteryProbe.shotCooldownTimer = 0;
batteryProbe.shotsFired = 0;
batteryProbe.shotsPerReload = BATTERY_PROBE_SHOTS_PER_RELOAD;
batteryProbe.rechargeTime = BATTERY_PROBE_RECHARGE_TIME;
batteryProbe.flashCounter = 0;
batteryProbe.reduction = BATTERY_PROBE_REDUCTION;
batteryProbe.control = BATTERY_PROBE_CONTROL;
batteryProbe.cost = COST_OF_BATTERY_PROBE;
batteryProbe.onHit1Skill = ON_HIT_SPIKED;
batteryProbe.onHit2Skill = ON_HIT_STRUCTURAL;
batteryProbe.onHit3Skill = ON_HIT_LINK;
batteryProbe.upgradeLevel = 1;
batteryProbe.k = 4;
batteryProbe.projSpeed = BATTERY_PROBE_PROJ_SPEED;
batteryProbe.projTTL = BATTERY_PROBE_PROJ_TTL;
batteryProbe.projMass = BATTERY_PROBE_PROJ_MASS;
batteryProbe.projK = BATTERY_PROBE_PROJ_K;
batteryProbe.fireShot = function () {
if (this.readyToFire == true) {
this.shotCooldownTimer = this.shotCooldown;
this.partialReloadCooldownCounter = 0;
this.shotsFired++;
this.readyToFire = false;
}
};
batteryProbe.affect = function (affected) {
if (affected.gameState == PS_DISCHARGED) {
affected.rechargeCounter = affected.rechargeCounter + (fps * this.power);
return(1);
}
return(affected.addHealth(this.power));
};
return(batteryProbe);
}
function buildWallProbe(xPos, yPos) {
index = probes.getNextIndex();
zDepth = probeDepth - index;
wallProbe = _root.attachMovie("WallProbeMC", "WallProbeMC" + zDepth, zDepth);
wallProbe.index = index;
initBasicProbe(wallProbe);
wallProbe._x = xPos;
wallProbe._y = yPos;
wallProbe.origX = xPos;
wallProbe.origY = yPos;
wallProbe.oldX = xPos;
wallProbe.oldY = yPos;
wallProbe.hp = WALL_PROBE_HP;
wallProbe.hpMax = WALL_PROBE_HP;
wallProbe.mass = WALL_PROBE_MASS;
wallProbe.speed = WALL_PROBE_SPEED;
wallProbe.power = WALL_PROBE_POWER;
wallProbe.probeType = WALL_PROBE;
wallProbe.range = WALL_PROBE_RANGE;
wallProbe.setReloadRate(WALL_PROBE_ATTACK_RATE);
wallProbe.setShotRate(WALL_PROBE_SHOT_RATE);
wallProbe.reloadTimer = wallProbe.fullReloadCooldown;
wallProbe.shotCooldownTimer = 0;
wallProbe.shotsFired = 0;
wallProbe.shotsPerReload = WALL_PROBE_SHOTS_PER_RELOAD;
wallProbe.rechargeTime = WALL_PROBE_RECHARGE_TIME;
wallProbe.flashCounter = 0;
wallProbe.reduction = WALL_PROBE_REDUCTION;
wallProbe.control = WALL_PROBE_CONTROL;
wallProbe.cost = COST_OF_WALL_PROBE;
wallProbe.onHit1Skill = ON_HIT_SPIKED;
wallProbe.onHit2Skill = ON_HIT_STRUCTURAL;
wallProbe.onHit3Skill = ON_HIT_LINK;
wallProbe.upgradeLevel = 1;
wallProbe.k = 4;
wallProbe.projSpeed = WALL_PROBE_PROJ_SPEED;
wallProbe.projTTL = WALL_PROBE_PROJ_TTL;
wallProbe.projMass = WALL_PROBE_PROJ_MASS;
wallProbe.projK = WALL_PROBE_PROJ_K;
wallProbe.hpRegen = 1 / (2 * fps);
wallProbe.createProjectile = createParticleBlast;
return(wallProbe);
}
function initBasicProbe(probe) {
initCollider(probe);
probe.objectType = OBJ_PROBE;
probe._xscale = 100;
probe._yscale = 100;
probe.dx = 0;
probe.dy = 0;
probe.ax = 0;
probe.ay = 0;
probe.gameState = PS_IDLE;
probe.rechargeCounter = 0;
probe.gameTarget = -1;
probe.onHitChosen = -1;
probe.beenHitCooldownTimer = 0;
probe.readyToFire = true;
probe.onHit1CooldownTimer = 0;
probe.onHit1Cooldown = 0;
probe.onHit1Level = 0;
probe.onHit1Power = 0;
probe.onHit1Range = 0;
probe.onHit1Variable1 = 0;
probe.onHit1Variable2 = 0;
probe.onHit1K = 0;
probe.onHit1Mass = 1;
probe.onHit2CooldownTimer = 0;
probe.onHit2Cooldown = 0;
probe.onHit2Level = 0;
probe.onHit2Power = 0;
probe.onHit2Range = 0;
probe.onHit2Variable1 = 0;
probe.onHit2Variable2 = 0;
probe.onHit2K = 0;
probe.onHit2Mass = 1;
probe.onHit3CooldownTimer = 0;
probe.onHit3Cooldown = 0;
probe.onHit3Level = 0;
probe.onHit3Power = 0;
probe.onHit3Range = 0;
probe.onHit3Variable1 = 0;
probe.onHit3Variable2 = 0;
probe.onHit3K = 0;
probe.onHit3Mass = 1;
probe.hpRegen = 0;
probe.killCount = 0;
probe.touched = false;
probe.stoodStill = 0;
probe.checkForTargetCounter = 0;
probe.inRange = function (circle) {
combinedRadius = circle.cRadius + this.range;
ytmp = circle._y - this._y;
xtmp = circle._x - this._x;
distanceSq = (xtmp * xtmp) + (ytmp * ytmp);
return(distanceSq <= (combinedRadius * combinedRadius));
};
probe.hasTarget = function () {
if (((this.gameTarget == -1) || (this.gameTarget.alive == false)) || (this.inRange(this.gameTarget) == false)) {
return(false);
}
return(true);
};
probe.onHit = function () {
if (this.gameState == PS_DISCHARGED) {
} else {
this.gameState = PS_HIT;
this.flashCounter = 4 + (this.flashCounter % 2);
}
};
probe.onPress = function () {
selectObject(this);
};
probe.setReloadRate = function (sec) {
this.reloadRate = sec;
this.fullReloadCooldown = fps * sec;
this.partialReloadCooldown = int(this.shotsPerReload / this.fullReloadCooldown);
};
probe.setShotRate = function (rate) {
this.shotRate = rate;
if (rate == 0) {
rate = 1;
}
this.shotCooldown = int(fps / rate);
};
probe.fireShot = function () {
if (this.readyToFire == true) {
this.shotCooldownTimer = this.shotCooldown;
this.partialReloadCooldownCounter = 0;
this.shotsFired++;
this.readyToFire = false;
tmpProj = this.createProjectile(this, this.gameTarget);
if (tmpProj == -1) {
this.shotsFired--;
this.readyToFire = true;
return(-1);
}
return(tmpProj);
}
return(-1);
};
probe.damage = function (dmgAmt) {
dmgAmt = dmgAmt - this.reduction;
if (dmgAmt >= 1) {
this.hp = this.hp - dmgAmt;
if (this.hp <= 0) {
this.hp = 0;
this.gameState = PS_DISCHARGED;
this.gotoAndStop("f3");
}
}
};
probe.moveBack = function () {
this._x = this.oldX;
this._y = this.oldY;
};
probe.move = function () {
if (this.touched == true) {
this.dx = this.dx * 0.85;
this.dy = this.dy * 0.85;
this.dx = this.dx + this.ax;
this.dy = this.dy + this.ay;
if (magnitudeSquared(this) > TERMINAL_VELOCITY_SQ) {
normalize(this);
this.dx = this.dx * this.speed;
this.dy = this.dy * this.speed;
}
if (Math.abs(this.dx) <= 1E-5) {
this.dx = 0;
if (Math.abs(this.dy) <= 1E-5) {
this.dy = 0;
}
this.stoodStill++;
if (this.stoodStill > 5) {
this.touched == false;
this.stoodStill = 0;
}
}
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this.ax = 0;
this.ay = 0;
}
};
probe.step = function () {
this.oldX = this._x;
this.oldY = this._y;
if (this.gameState == PS_DISCHARGED) {
this.rechargeCounter++;
if (this.rechargeCounter > this.rechargeTime) {
this.gameState = PS_IDLE;
this.gotoAndStop("f0");
this.rechargeCounter = 0;
this.hp = this.hpMax;
this.stoodStill = 0;
this.touched = true;
}
} else {
if (this.checkForTargetCounter > 0) {
this.checkForTargetCounter--;
if (isNaN(this.dx)) {
this.dx = 0;
}
if (isNaN(this.dy)) {
this.dy = 0;
}
if (isNaN(this.ax)) {
this.ax = 0;
}
if (isNaN(this.ay)) {
this.ay = 0;
}
}
this.addHealth(this.hpRegen);
if (this.shotCooldownTimer > 0) {
this.shotCooldownTimer--;
this.partialReloadCooldownCounter++;
}
if (this.shotCooldownTimer <= 0) {
if (this.shotsFired < this.shotsPerReload) {
if (((this.readyToFire == true) && (this.shotsFired > 0)) && (this.partialReloadCooldownCounter == this.partialReloadCooldown)) {
this.shotsFired--;
this.partialReloadCooldownCounter = 0;
} else {
this.readyToFire = true;
}
} else {
this.reloadTimer--;
if (this.reloadTimer <= 0) {
this.shotsFired = 0;
this.readyToFire = true;
this.reloadTimer = this.fullReloadCooldown;
}
}
}
if (this.onHit1CooldownTimer > 0) {
this.onHit1CooldownTimer--;
}
if (this.onHit2CooldownTimer > 0) {
this.onHit2CooldownTimer--;
}
if (this.onHit3CooldownTimer > 0) {
this.onHit3CooldownTimer--;
}
if (this.beenHitCooldownTimer > 0) {
this.beenHitCooldownTimer--;
}
if (this.gameState == PS_HIT) {
if ((this.flashCounter % 6) > 2) {
this.gotoAndStop("f3");
} else {
this.gotoAndStop("f0");
}
this.flashCounter--;
if (this.flashCounter == 0) {
this.gotoAndStop("f0");
this.gameState = PS_IDLE;
}
}
if (this.touched == true) {
tx = this.origX - this._x;
ty = this.origY - this._y;
this.tmpDx = tx;
this.tmpDy = ty;
normalizeTmp(this, this);
this.ax = this.ax + (this.tmpDx * this.speed);
this.ay = this.ay + (this.tmpDy * this.speed);
if ((this.dx > 0) && (tx > 0)) {
if ((this.dx + this.ax) > tx) {
this.ax = tx - this.dx;
}
} else if ((this.dx < 0) && (tx < 0)) {
if ((this.dx + this.ax) < tx) {
this.ax = tx - this.dx;
}
} else if (this.dx > 0) {
if ((this.dx + this.ax) < tx) {
this.ax = tx - this.dx;
}
} else if (this.dx < 0) {
if ((this.dx + this.ax) > tx) {
this.ax = tx - this.dx;
}
}
if ((this.dy > 0) && (ty > 0)) {
if ((this.dy + this.ay) > ty) {
this.ay = ty - this.dy;
}
} else if ((this.dy < 0) && (ty < 0)) {
if ((this.dy + this.ay) < ty) {
this.ay = ty - this.dy;
}
} else if (this.dy > 0) {
if ((this.dy + this.ay) < ty) {
this.ay = ty - this.dy;
}
} else if (this.dy < 0) {
if ((this.dy + this.ay) > ty) {
this.ay = ty - this.dy;
}
}
}
}
};
probe.addHealth = function (amt) {
if (this.hp >= this.hpMax) {
return(0);
}
this.hp = this.hp + amt;
if (this.hp > this.hpMax) {
this.hp = this.hpMax;
}
return(1);
};
}
init();
Frame 35
function init() {
ET_DEFLECT_BURST = 0;
ET_HEAT_BURST = 1;
ET_FROST_BURST = 2;
}
function createLinkToShip(linker, energyXfer) {
playLinkStationSound();
mainShip.addEnergy(energyXfer);
}
function createFrostBurst(exploder, power, mass, k, range, slowEffect, coldTime) {
burst = createStasisBurst(exploder);
if (burst != -1) {
burst.rangedCollisionGroupIndex = getRangedCollisionGroupIndex(burst);
burst.power = power;
burst.range = range;
burst.k = k;
burst.slowEffect = slowEffect;
burst.coldTime = coldTime;
burst._xscale = range;
burst._yscale = range;
loadRangeOfEnemyCollisionGroups(burst.rangedCollisionGroupIndex, range, sharedBurstCGs);
bk = 0;
while (bk < sharedBurstCGs.maxSize) {
if (sharedBurstCGs.objects[bk] == -1) {
break;
}
cgBTmp = sharedBurstCGs.objects[bk];
bj = 0;
while (bj < cgBTmp.maxSize) {
if (cgBTmp.objects[bj] == -1) {
break;
}
if (burst.inRange(cgBTmp.objects[bj])) {
burst.affect(cgBTmp.objects[bj]);
}
bj++;
}
bk++;
}
}
}
function fireHeartBurst(exploder, power, mass, k, range) {
burst = createHeartBurst(exploder);
if (burst != -1) {
burst.rangedCollisionGroupIndex = getRangedCollisionGroupIndex(burst);
burst.power = power;
burst.range = range;
burst.k = k;
burst._xscale = range;
burst._yscale = range;
loadPastRangeOfEnemyCollisionGroups(burst.rangedCollisionGroupIndex, range, sharedBurstCGs);
bk = 0;
while (bk < sharedBurstCGs.maxSize) {
if (sharedBurstCGs.objects[bk] == -1) {
break;
}
cgBTmp = sharedBurstCGs.objects[bk];
bj = 0;
while (bj < cgBTmp.maxSize) {
if (cgBTmp.objects[bj] == -1) {
break;
}
if (burst.inRange(cgBTmp.objects[bj])) {
burst.affect(cgBTmp.objects[bj]);
}
bj++;
}
bk++;
}
}
}
function fireHeatBurst(exploder, power, mass, k, range) {
burst = createHeatBurst(exploder);
if (burst != -1) {
burst.rangedCollisionGroupIndex = getRangedCollisionGroupIndex(burst);
burst.power = power;
burst.range = range;
burst.k = k;
burst._xscale = range;
burst._yscale = range;
loadRangeOfEnemyCollisionGroups(burst.rangedCollisionGroupIndex, range, sharedBurstCGs);
bk = 0;
while (bk < sharedBurstCGs.maxSize) {
if (sharedBurstCGs.objects[bk] == -1) {
break;
}
cgBTmp = sharedBurstCGs.objects[bk];
bj = 0;
while (bj < cgBTmp.maxSize) {
if (cgBTmp.objects[bj] == -1) {
break;
}
if (burst.inRange(cgBTmp.objects[bj])) {
burst.affect(cgBTmp.objects[bj]);
}
bj++;
}
bk++;
}
}
}
function fireExplosionBurst(exploder, power, mass, k, range) {
burst = createExplosionBurst(exploder);
if (burst != -1) {
burst.rangedCollisionGroupIndex = getRangedCollisionGroupIndex(burst);
burst.power = power;
burst.range = range;
burst.k = k;
burst._xscale = range;
burst._yscale = range;
loadRangeOfEnemyCollisionGroups(burst.rangedCollisionGroupIndex, range, sharedBurstCGs);
bk = 0;
while (bk < sharedBurstCGs.maxSize) {
if (sharedBurstCGs.objects[bk] == -1) {
break;
}
cgBTmp = sharedBurstCGs.objects[bk];
bj = 0;
while (bj < cgBTmp.maxSize) {
if (cgBTmp.objects[bj] == -1) {
break;
}
if (burst.inRange(cgBTmp.objects[bj])) {
burst.affect(cgBTmp.objects[bj]);
}
bj++;
}
bk++;
}
}
}
function fireDeflectBurst(exploder, power, mass, k, range) {
burst = createDeflectBurst(exploder);
if (burst != -1) {
burst.rangedCollisionGroupIndex = getRangedCollisionGroupIndex(burst);
burst.power = power;
burst.range = range;
burst.k = k;
burst._xscale = range;
burst._yscale = range;
burst.mass = mass;
loadRangeOfEnemyCollisionGroups(burst.rangedCollisionGroupIndex, range, sharedBurstCGs);
bk = 0;
while (bk < sharedBurstCGs.maxSize) {
if (sharedBurstCGs.objects[bk] == -1) {
break;
}
cgBTmp = sharedBurstCGs.objects[bk];
bj = 0;
while (bj < cgBTmp.maxSize) {
if (cgBTmp.objects[bj] == -1) {
break;
}
if (burst.inRange(cgBTmp.objects[bj])) {
burst.affect(cgBTmp.objects[bj]);
}
bj++;
}
bk++;
}
}
}
function createExplosionAgainstProbes(exploder) {
burst = createExplosionBurst(exploder);
if (burst != -1) {
burst.rangedCollisionGroupIndex = getRangedCollisionGroupIndex(burst);
burst.power = exploder.power;
burst.range = exploder.range;
burst.k = k;
burst._xscale = exploder.range;
burst._yscale = exploder.range;
loadRangeOfProbeCollisionGroups(burst.rangedCollisionGroupIndex, burst.range, sharedBurstCGs);
bk = 0;
while (bk < sharedBurstCGs.maxSize) {
if (sharedBurstCGs.objects[bk] == -1) {
break;
}
cgBTmp = sharedBurstCGs.objects[bk];
bj = 0;
while (bj < cgBTmp.maxSize) {
if (cgBTmp.objects[bj] == -1) {
break;
}
if (burst.inRange(cgBTmp.objects[bj])) {
burst.affect(cgBTmp.objects[bj]);
}
bj++;
}
bk++;
}
}
}
init();
Frame 38
function init() {
LASER_BEAM = 1;
}
function createRepulsorBlast(probe, target) {
if (repulsorBlasts.getNextIndex() != -1) {
repulsorBlast = repulsorBlasts.getNext();
initProjectile(repulsorBlast, probe, target);
repulsorBlast.move = basicMove;
repulsorBlast.step = heatSeekingStep;
repulsorBlast.affect = function (affected) {
affected.damage(this.power, this.shooter);
};
repulsorBlast.killObject = function () {
repulsorBlasts.killObject(this.index);
projectiles.killObjectDontRemove(this.indexValue);
};
if (projectiles.addObject(repulsorBlast) > -1) {
playRepulsorProbeSound();
return(repulsorBlast);
}
repulsorBlast.killObject();
return(-1);
}
return(-1);
}
function createMissile(probe, target) {
if (missile.getNextIndex() != -1) {
missile = missiles.getNext();
initProjectile(missile, probe, target);
missile.move = basicMove;
missile.step = heatSeekingStep;
missile.range = 75;
missile.affect = function (affected) {
};
missile.killObject = function () {
fireExplosionBurst(this, this.power, this.mass, this.k, this.range);
missiles.killObject(this.index);
projectiles.killObjectDontRemove(this.indexValue);
};
if (projectiles.addObject(missile) > -1) {
playRocketProbeSound();
return(missile);
}
missile.killObject();
return(-1);
}
return(-1);
}
function createBombBurst(exploder) {
burst = createHeatBurst(exploder);
if (burst != -1) {
burst.rangedCollisionGroupIndex = getRangedCollisionGroupIndex(burst);
burst.power = exploder.power;
burst.range = exploder.range;
burst.k = k;
burst._xscale = exploder.range;
burst._yscale = exploder.range;
loadRangeOfEnemyCollisionGroups(burst.rangedCollisionGroupIndex, burst.range, sharedBurstCGs);
bk = 0;
while (bk < sharedBurstCGs.maxSize) {
if (sharedBurstCGs.objects[bk] == -1) {
break;
}
cgBTmp = sharedBurstCGs.objects[bk];
bj = 0;
while (bj < cgBTmp.maxSize) {
if (cgBTmp.objects[bj] == -1) {
break;
}
if (burst.inRange(cgBTmp.objects[bj])) {
burst.affect(cgBTmp.objects[bj]);
}
bj++;
}
bk++;
}
return(burst);
}
return(-1);
}
function fireStasisBurst(exploder) {
burst = createStasisBurst(exploder);
if (burst != -1) {
burst.rangedCollisionGroupIndex = getRangedCollisionGroupIndex(burst);
burst.power = exploder.power;
burst.range = exploder.range;
burst.slowEffect = exploder.slowEffect;
burst.coldTime = exploder.coldTime;
burst.k = k;
burst._xscale = exploder.range;
burst._yscale = exploder.range;
loadRangeOfEnemyCollisionGroups(burst.rangedCollisionGroupIndex, burst.range, sharedBurstCGs);
bk = 0;
while (bk < sharedBurstCGs.maxSize) {
if (sharedBurstCGs.objects[bk] == -1) {
break;
}
cgBTmp = sharedBurstCGs.objects[bk];
bj = 0;
while (bj < cgBTmp.maxSize) {
if (cgBTmp.objects[bj] == -1) {
break;
}
if (burst.inRange(cgBTmp.objects[bj])) {
burst.affect(cgBTmp.objects[bj]);
}
bj++;
}
bk++;
}
return(burst);
}
return(-1);
}
function createParticleBlast(probe, target) {
if (pblasts.getNextIndex() != -1) {
pblast = pblasts.getNext();
initProjectile(pblast, probe, target);
pblast.move = basicMove;
pblast.step = heatSeekingStep;
pblast.affect = function (affected) {
affected.damage(this.power, this.shooter);
};
pblast.killObject = function () {
createParticleDeath(this);
pblasts.killObject(this.index);
projectiles.killObjectDontRemove(this.indexValue);
};
if (projectiles.addObject(pblast) > -1) {
playPBProbeSound();
return(pblast);
}
pblast.killObject();
return(-1);
}
return(-1);
}
function createLaserBeam(probe, target, front) {
if (laserBeams.getNextIndex() != -1) {
laserBeam = laserBeams.getNext();
initProjectile(laserBeam, probe, target);
laserBeam.projType = LASER_BEAM;
laserBeam.piercing = true;
laserBeam.mass = 0.001;
laserBeam.tmpDx = laserBeam.gameTarget._x - laserBeam._x;
laserBeam.tmpDy = laserBeam.gameTarget._y - laserBeam._y;
normalizeTmp(laserBeam, laserBeam);
if (laserBeam.tmpDx < 0) {
laserBeam._rotation = Math.acos(laserBeam.tmpDy) * RAD_TO_DEG;
} else {
laserBeam._rotation = -(Math.acos(laserBeam.tmpDy) * RAD_TO_DEG);
}
laserBeam.tmpDx = laserBeam.tmpDx * laserBeam.speed;
laserBeam.tmpDy = laserBeam.tmpDy * laserBeam.speed;
if (front == true) {
laserBeam.gotoAndStop("f0");
} else {
laserBeam.gotoAndStop("f1");
}
laserBeam.move = basicMove;
laserBeam.step = straightLineStep;
laserBeam.affect = function (affected) {
affected.damage(this.power, this.shooter);
};
laserBeam.killObject = function () {
laserBeams.killObject(this.index);
projectiles.killObjectDontRemove(this.indexValue);
};
if (projectiles.addObject(laserBeam) > -1) {
return(laserBeam);
}
laserBeam.killObject();
return(-1);
}
}
function initProjectile(projectile, probe, target) {
projectile._x = probe._x;
projectile._y = probe._y;
projectile.objectType = OBJ_PROJECTILE;
projectile.ax = 0;
projectile.ay = 0;
projectile.dx = 0;
projectile.dy = 0;
projectile.k = probe.projK;
projectile.power = probe.power;
projectile.speed = probe.projSpeed;
projectile.gameTarget = target;
projectile.mass = probe.projMass;
projectile.alive = true;
projectile.ttl = probe.projTTL;
projectile.at = 0;
projectile.terminalVelocity = probe.projTerminalVelocity;
projectile.terminalVelocitySq = probe.projTerminalVelocitySq;
projectile.shooter = probe;
projectile.piercing = false;
projectile.stepCounter = -1;
}
init();
Frame 40
function createParticleDeath(creator) {
if (pelletDeaths.getNextIndex() != -1) {
pelletDeath = pelletDeaths.getNext();
if (reInitBasicEffect(pelletDeath) != -1) {
pelletDeath._x = creator._x;
pelletDeath._y = creator._y;
pelletDeath.dx = 0;
pelletDeath.dy = 0;
return(pelletDeath);
}
}
return(-1);
}
function initPelletDeath(pelletDeath) {
initBasicEffect(pelletDeath);
pelletDeath.killObject = function () {
this.dx = 0;
this.dy = 0;
pelletDeaths.killObject(this.index);
};
pelletDeath.maxFrames = 3;
pelletDeath.framesCounter = 0;
pelletDeath.currentKeyFrameIndex = 0;
pelletDeath.keyFrames = new Array();
pelletDeath.keyFrames[0] = "f0";
pelletDeath.keyFrames[1] = "f1";
pelletDeath.keyFrames[2] = "f2";
pelletDeath.keyFrameDurations = new Array();
pelletDeath.keyFrameDurations[0] = 2;
pelletDeath.keyFrameDurations[1] = 2;
pelletDeath.keyFrameDurations[2] = 2;
}
function createMeteorDeath(creator) {
if (meteorDeaths.getNextIndex() != -1) {
meteorDeath = meteorDeaths.getNext();
if (reInitBasicEffect(meteorDeath) != -1) {
meteorDeath._x = creator._x;
meteorDeath._y = creator._y;
meteorDeath.dx = creator.dx;
meteorDeath.dy = creator.dy;
return(meteorDeath);
}
}
return(-1);
}
function initMeteorDeath(meteorDeath) {
initBasicEffect(meteorDeath);
meteorDeath.killObject = function () {
this.dx = 0;
this.dy = 0;
meteorDeaths.killObject(this.index);
};
meteorDeath.maxFrames = 3;
meteorDeath.framesCounter = 0;
meteorDeath.currentKeyFrameIndex = 0;
meteorDeath.keyFrames = new Array();
meteorDeath.keyFrames[0] = "f0";
meteorDeath.keyFrames[1] = "f1";
meteorDeath.keyFrames[2] = "f2";
meteorDeath.keyFrameDurations = new Array();
meteorDeath.keyFrameDurations[0] = 2;
meteorDeath.keyFrameDurations[1] = 2;
meteorDeath.keyFrameDurations[2] = 2;
}
function createLaserHit(creator) {
if (laserHits.getNextIndex() != -1) {
laserHit = laserHits.getNext();
if (reInitBasicEffect(laserHit) != -1) {
laserHit._x = creator._x;
laserHit._y = creator._y;
laserHit.dx = creator.dx;
laserHit.dy = creator.dy;
return(laserHit);
}
}
return(-1);
}
function initLaserHit(laserHit) {
initBasicEffect(laserHit);
laserHit.killObject = function () {
this.dx = 0;
this.dy = 0;
laserHits.killObject(this.index);
};
laserHit.maxFrames = 3;
laserHit.framesCounter = 0;
laserHit.currentKeyFrameIndex = 0;
laserHit.keyFrames = new Array();
laserHit.keyFrames[0] = "f0";
laserHit.keyFrames[1] = "f1";
laserHit.keyFrames[2] = "f2";
laserHit.keyFrameDurations = new Array();
laserHit.keyFrameDurations[0] = 2;
laserHit.keyFrameDurations[1] = 2;
laserHit.keyFrameDurations[2] = 2;
}
function createStasisBurst(creator) {
if (stasisBursts.getNextIndex() != -1) {
explosion = stasisBursts.getNext();
if (creator.objectType == OBJ_PROJECTILE) {
explosion.shooter = creator.shooter;
} else {
explosion.shooter = creator;
}
if (reInitBasicEffect(explosion) != -1) {
explosion._x = creator._x;
explosion._y = creator._y;
explosion.dx = 0;
explosion.dy = 0;
playStasisProbeSound();
return(explosion);
}
}
return(-1);
}
function initStasisBurst(explosion) {
initBasicEffect(explosion);
explosion.killObject = function () {
this.dx = 0;
this.dy = 0;
stasisBursts.killObject(this.index);
};
explosion.maxFrames = 14;
explosion.framesCounter = 0;
explosion.currentKeyFrameIndex = 0;
explosion.keyFrames = new Array();
explosion.keyFrames[0] = "f0";
explosion.keyFrames[1] = "f1";
explosion.keyFrames[2] = "f2";
explosion.keyFrames[3] = "f3";
explosion.keyFrames[4] = "f4";
explosion.keyFrames[5] = "f5";
explosion.keyFrames[6] = "f6";
explosion.keyFrames[7] = "f7";
explosion.keyFrames[8] = "f8";
explosion.keyFrames[9] = "f9";
explosion.keyFrames[10] = "f10";
explosion.keyFrames[11] = "f11";
explosion.keyFrames[12] = "f12";
explosion.keyFrames[13] = "f13";
explosion.keyFrameDurations = new Array();
explosion.keyFrameDurations[0] = 2;
explosion.keyFrameDurations[1] = 2;
explosion.keyFrameDurations[2] = 2;
explosion.keyFrameDurations[3] = 2;
explosion.keyFrameDurations[4] = 2;
explosion.keyFrameDurations[5] = 2;
explosion.keyFrameDurations[6] = 2;
explosion.keyFrameDurations[7] = 2;
explosion.keyFrameDurations[8] = 2;
explosion.keyFrameDurations[9] = 2;
explosion.keyFrameDurations[10] = 2;
explosion.keyFrameDurations[11] = 2;
explosion.keyFrameDurations[12] = 2;
explosion.keyFrameDurations[13] = 2;
explosion.inRange = function (circle) {
combinedRadius = circle.cRadius + this.range;
ytmp = circle._y - this._y;
xtmp = circle._x - this._x;
distanceSq = (xtmp * xtmp) + (ytmp * ytmp);
return(distanceSq <= (combinedRadius * combinedRadius));
};
explosion.affect = function (affected) {
affected.slow(this.slowEffect, this.coldTime);
affected.damage(this.power, this.shooter);
};
}
function createDeflectBurst(creator) {
if (deflectBursts.getNextIndex() != -1) {
explosion = deflectBursts.getNext();
if (creator.objectType == OBJ_PROJECTILE) {
explosion.shooter = creator.shooter;
} else {
explosion.shooter = creator;
}
if (reInitBasicEffect(explosion) != -1) {
explosion._x = creator._x;
explosion._y = creator._y;
explosion.dx = 0;
explosion.dy = 0;
playRepulsorBurstSound();
return(explosion);
}
}
return(-1);
}
function initDeflectBurst(explosion) {
initBasicEffect(explosion);
explosion.killObject = function () {
this.dx = 0;
this.dy = 0;
deflectBursts.killObject(this.index);
};
explosion.maxFrames = 15;
explosion.framesCounter = 0;
explosion.currentKeyFrameIndex = 0;
explosion.keyFrames = new Array();
explosion.keyFrames[0] = "f0";
explosion.keyFrames[1] = "f1";
explosion.keyFrames[2] = "f2";
explosion.keyFrames[3] = "f3";
explosion.keyFrames[4] = "f4";
explosion.keyFrames[5] = "f5";
explosion.keyFrames[6] = "f6";
explosion.keyFrames[7] = "f7";
explosion.keyFrames[8] = "f8";
explosion.keyFrames[9] = "f9";
explosion.keyFrames[10] = "f10";
explosion.keyFrames[11] = "f11";
explosion.keyFrames[12] = "f12";
explosion.keyFrames[13] = "f13";
explosion.keyFrames[14] = "f14";
explosion.keyFrameDurations = new Array();
explosion.keyFrameDurations[0] = 1;
explosion.keyFrameDurations[1] = 1;
explosion.keyFrameDurations[2] = 1;
explosion.keyFrameDurations[3] = 1;
explosion.keyFrameDurations[4] = 1;
explosion.keyFrameDurations[5] = 1;
explosion.keyFrameDurations[6] = 1;
explosion.keyFrameDurations[7] = 1;
explosion.keyFrameDurations[8] = 1;
explosion.keyFrameDurations[9] = 1;
explosion.keyFrameDurations[10] = 1;
explosion.keyFrameDurations[11] = 1;
explosion.keyFrameDurations[12] = 1;
explosion.keyFrameDurations[13] = 2;
explosion.keyFrameDurations[14] = 2;
explosion.inRange = function (circle) {
combinedRadius = circle.cRadius + this.range;
ytmp = circle._y - this._y;
xtmp = circle._x - this._x;
distanceSq = (xtmp * xtmp) + (ytmp * ytmp);
return(distanceSq <= (combinedRadius * combinedRadius));
};
explosion.affect = function (affected) {
tmpX = affected._x - mainShip._x;
tmpY = affected._y - mainShip._y;
mag = Math.sqrt((tmpX * tmpX) + (tmpY * tmpY));
if (mag == 0) {
mag = 1;
}
tmpX = ((tmpX / mag) * this.k) * Math.abs(affected.dx);
tmpY = ((tmpY / mag) * this.k) * Math.abs(affected.dy);
affected.addAcceleration(tmpX, tmpY);
affected.damage(this.power, this.shooter);
};
}
function createHeatBurst(creator) {
if (heatBursts.getNextIndex() != -1) {
explosion = heatBursts.getNext();
if (creator.objectType == OBJ_PROJECTILE) {
explosion.shooter = creator.shooter;
} else {
explosion.shooter = creator;
}
if (reInitBasicEffect(explosion) != -1) {
explosion._x = creator._x;
explosion._y = creator._y;
playHeatBurstSound();
return(explosion);
}
}
return(-1);
}
function initHeatBurst(explosion) {
initBasicEffect(explosion);
explosion.killObject = function () {
this.dx = 0;
this.dy = 0;
heatBursts.killObject(this.index);
};
explosion.maxFrames = 12;
explosion.framesCounter = 0;
explosion.currentKeyFrameIndex = 0;
explosion.keyFrames = new Array();
explosion.keyFrames[0] = "f0";
explosion.keyFrames[1] = "f1";
explosion.keyFrames[2] = "f2";
explosion.keyFrames[3] = "f3";
explosion.keyFrames[4] = "f4";
explosion.keyFrames[5] = "f5";
explosion.keyFrames[6] = "f6";
explosion.keyFrames[7] = "f7";
explosion.keyFrames[8] = "f8";
explosion.keyFrames[9] = "f9";
explosion.keyFrames[10] = "f10";
explosion.keyFrames[11] = "f11";
explosion.keyFrameDurations = new Array();
explosion.keyFrameDurations[0] = 1;
explosion.keyFrameDurations[1] = 1;
explosion.keyFrameDurations[2] = 1;
explosion.keyFrameDurations[3] = 1;
explosion.keyFrameDurations[4] = 1;
explosion.keyFrameDurations[5] = 1;
explosion.keyFrameDurations[6] = 1;
explosion.keyFrameDurations[7] = 1;
explosion.keyFrameDurations[8] = 1;
explosion.keyFrameDurations[9] = 1;
explosion.keyFrameDurations[10] = 2;
explosion.keyFrameDurations[11] = 2;
explosion.inRange = function (circle) {
combinedRadius = circle.cRadius + this.range;
ytmp = circle._y - this._y;
xtmp = circle._x - this._x;
distanceSq = (xtmp * xtmp) + (ytmp * ytmp);
return(distanceSq <= (combinedRadius * combinedRadius));
};
explosion.affect = function (affected) {
affected.damage(this.power, this.shooter);
};
}
function createExplosionBurst(creator) {
if (explosionBursts.getNextIndex() != -1) {
explosion = explosionBursts.getNext();
if (creator.objectType == OBJ_PROJECTILE) {
explosion.shooter = creator.shooter;
} else {
explosion.shooter = creator;
}
if (reInitBasicEffect(explosion) != -1) {
explosion._x = creator._x;
explosion._y = creator._y;
playExplosionSound();
return(explosion);
}
}
return(-1);
}
function initExplosionBurst(explosion) {
initBasicEffect(explosion);
explosion.killObject = function () {
this.dx = 0;
this.dy = 0;
explosionBursts.killObject(this.index);
};
explosion.maxFrames = 12;
explosion.framesCounter = 0;
explosion.currentKeyFrameIndex = 0;
explosion.keyFrames = new Array();
explosion.keyFrames[0] = "f0";
explosion.keyFrames[1] = "f1";
explosion.keyFrames[2] = "f2";
explosion.keyFrames[3] = "f3";
explosion.keyFrames[4] = "f4";
explosion.keyFrames[5] = "f5";
explosion.keyFrames[6] = "f6";
explosion.keyFrames[7] = "f7";
explosion.keyFrames[8] = "f8";
explosion.keyFrames[9] = "f9";
explosion.keyFrames[10] = "f10";
explosion.keyFrames[11] = "f11";
explosion.keyFrameDurations = new Array();
explosion.keyFrameDurations[0] = 1;
explosion.keyFrameDurations[1] = 1;
explosion.keyFrameDurations[2] = 1;
explosion.keyFrameDurations[3] = 1;
explosion.keyFrameDurations[4] = 1;
explosion.keyFrameDurations[5] = 1;
explosion.keyFrameDurations[6] = 1;
explosion.keyFrameDurations[7] = 1;
explosion.keyFrameDurations[8] = 1;
explosion.keyFrameDurations[9] = 2;
explosion.keyFrameDurations[10] = 2;
explosion.keyFrameDurations[11] = 2;
explosion.inRange = function (circle) {
combinedRadius = circle.cRadius + this.range;
ytmp = circle._y - this._y;
xtmp = circle._x - this._x;
distanceSq = (xtmp * xtmp) + (ytmp * ytmp);
return(distanceSq <= (combinedRadius * combinedRadius));
};
explosion.affect = function (affected) {
affected.damage(this.power, this.shooter);
};
}
function initFlashBurst(explosion) {
initBasicEffect(explosion);
explosion.killObject = function () {
this.dx = 0;
this.dy = 0;
flashBursts.killObject(this.index);
};
explosion.maxFrames = 12;
explosion.framesCounter = 0;
explosion.currentKeyFrameIndex = 0;
explosion.keyFrames = new Array();
explosion.keyFrames[0] = "f0";
explosion.keyFrames[1] = "f1";
explosion.keyFrames[2] = "f2";
explosion.keyFrames[3] = "f3";
explosion.keyFrames[4] = "f4";
explosion.keyFrames[5] = "f5";
explosion.keyFrames[6] = "f6";
explosion.keyFrames[7] = "f7";
explosion.keyFrames[8] = "f8";
explosion.keyFrames[9] = "f9";
explosion.keyFrames[10] = "f10";
explosion.keyFrames[11] = "f11";
explosion.keyFrameDurations = new Array();
explosion.keyFrameDurations[0] = 1;
explosion.keyFrameDurations[1] = 1;
explosion.keyFrameDurations[2] = 1;
explosion.keyFrameDurations[3] = 1;
explosion.keyFrameDurations[4] = 1;
explosion.keyFrameDurations[5] = 1;
explosion.keyFrameDurations[6] = 1;
explosion.keyFrameDurations[7] = 1;
explosion.keyFrameDurations[8] = 1;
explosion.keyFrameDurations[9] = 2;
explosion.keyFrameDurations[10] = 2;
explosion.keyFrameDurations[11] = 2;
}
function createHeartBurst(creator) {
if (heartBursts.getNextIndex() != -1) {
explosion = heartBursts.getNext();
if (creator.objectType == OBJ_PROJECTILE) {
explosion.shooter = creator.shooter;
} else {
explosion.shooter = creator;
}
if (reInitBasicEffect(explosion) != -1) {
explosion._x = creator._x;
explosion._y = creator._y;
explosion.dx = 0;
explosion.dy = 0;
playHeartDeathSound();
return(explosion);
}
}
return(-1);
}
function initHeartBurst(explosion) {
initBasicEffect(explosion);
explosion.killObject = function () {
this.dx = 0;
this.dy = 0;
heartBursts.killObject(this.index);
};
explosion.maxFrames = 12;
explosion.framesCounter = 0;
explosion.currentKeyFrameIndex = 0;
explosion.keyFrames = new Array();
explosion.keyFrames[0] = "f0";
explosion.keyFrames[1] = "f1";
explosion.keyFrames[2] = "f2";
explosion.keyFrames[3] = "f3";
explosion.keyFrames[4] = "f4";
explosion.keyFrames[5] = "f5";
explosion.keyFrames[6] = "f6";
explosion.keyFrames[7] = "f7";
explosion.keyFrames[8] = "f8";
explosion.keyFrames[9] = "f9";
explosion.keyFrames[10] = "f10";
explosion.keyFrames[11] = "f11";
explosion.keyFrameDurations = new Array();
explosion.keyFrameDurations[0] = 1;
explosion.keyFrameDurations[1] = 1;
explosion.keyFrameDurations[2] = 1;
explosion.keyFrameDurations[3] = 1;
explosion.keyFrameDurations[4] = 1;
explosion.keyFrameDurations[5] = 1;
explosion.keyFrameDurations[6] = 1;
explosion.keyFrameDurations[7] = 1;
explosion.keyFrameDurations[8] = 1;
explosion.keyFrameDurations[9] = 2;
explosion.keyFrameDurations[10] = 2;
explosion.keyFrameDurations[11] = 2;
explosion.inRange = function (circle) {
combinedRadius = circle.cRadius + this.range;
ytmp = circle._y - this._y;
xtmp = circle._x - this._x;
distanceSq = (xtmp * xtmp) + (ytmp * ytmp);
return(distanceSq <= (combinedRadius * combinedRadius));
};
explosion.affect = function (affected) {
affected.hp = affected.hp + (this.power * 2);
};
}
function reInitBasicEffect(effect) {
effect.alive = true;
effect.gotoAndStop("f0");
effect.frameCounter = 0;
effect.currentKeyFrameIndex = 0;
if (effects.addObject(effect) != -1) {
return(effect);
}
effect.alive = false;
effect._x = OFFSCREEN_X;
return(-1);
}
function initBasicEffect(effect) {
effect.alive = false;
effect.gotoAndStop("f0");
effect.frameCounter = 0;
effect.currentKeyFrameIndex = 0;
effect.step = function () {
this.framesCounter++;
if (this.framesCounter >= this.keyFrameDurations[this.currentKeyFrameIndex]) {
this.goNextFrame();
}
this.dx = this.dx * 0.9;
this.dy = this.dy * 0.9;
this._x = this._x + this.dx;
this._y = this._y + this.dy;
};
effect.goNextFrame = function () {
this.currentKeyFrameIndex++;
if (this.currentKeyFrameIndex < this.maxFrames) {
this.framesCounter = 0;
this.gotoAndStop(this.keyFrames[this.currentKeyFrameIndex]);
} else {
this.currentKeyFrameIndex = 0;
this.framesCounter = 0;
this.killObject();
effects.killObjectDontRemove(this.indexValue);
}
};
}
Frame 42
function init() {
MAX_ON_HIT_LEVEL = 3;
MAX_UPGRADE_LEVEL = 3;
deflectBurstUpgradeStats = new Array();
linkUpgradeStats = new Array();
structuralUpgradeStats = new Array();
spikedUpgradeStats = new Array();
heatBurstUpgradeStats = new Array();
frostBurstUpgradeStats = new Array();
repulsorProbeUpgradeStats = new Array();
rocketProbeUpgradeStats = new Array();
pbProbeUpgradeStats = new Array();
bombProbeUpgradeStats = new Array();
decoyProbeUpgradeStats = new Array();
stasisProbeUpgradeStats = new Array();
batteryProbeUpgradeStats = new Array();
wallProbeUpgradeStats = new Array();
laserBeamUpgradeStats = new Array();
protectShipUpgradeStats = new Array();
stasisShipUpgradeStats = new Array();
i = 0;
while (i < MAX_ON_HIT_LEVEL) {
deflectBurstUpgradeStats[i] = _root.attachMovie("Variable", "DeflectBurstUpgradeStat" + i, depth--);
initUpgrade(deflectBurstUpgradeStats[i]);
linkUpgradeStats[i] = _root.attachMovie("Variable", "LinkUpgradeStat" + i, depth--);
initUpgrade(linkUpgradeStats[i]);
structuralUpgradeStats[i] = _root.attachMovie("Variable", "StructuralUpgradeStat" + i, depth--);
initUpgrade(structuralUpgradeStats[i]);
heatBurstUpgradeStats[i] = _root.attachMovie("Variable", "HeatBurstUpgradeStat" + i, depth--);
initUpgrade(heatBurstUpgradeStats[i]);
frostBurstUpgradeStats[i] = _root.attachMovie("Variable", "FrostBurstUpgradeStat" + i, depth--);
initUpgrade(frostBurstUpgradeStats[i]);
spikedUpgradeStats[i] = _root.attachMovie("Variable", "SpikedUpgradeStat" + i, depth--);
initUpgrade(spikedUpgradeStats[i]);
repulsorProbeUpgradeStats[i] = _root.attachMovie("Variable", "RepulsorProbeUpgradeStat" + i, depth--);
initUpgrade(repulsorProbeUpgradeStats[i]);
rocketProbeUpgradeStats[i] = _root.attachMovie("Variable", "RocketProbeUpgradeStat" + i, depth--);
initUpgrade(rocketProbeUpgradeStats[i]);
bombProbeUpgradeStats[i] = _root.attachMovie("Variable", "BombProbeUpgradeStat" + i, depth--);
initUpgrade(bombProbeUpgradeStats[i]);
decoyProbeUpgradeStats[i] = _root.attachMovie("Variable", "DecoyProbeUpgradeStat" + i, depth--);
initUpgrade(decoyProbeUpgradeStats[i]);
batteryProbeUpgradeStats[i] = _root.attachMovie("Variable", "BatteryProbeUpgradeStat" + i, depth--);
initUpgrade(batteryProbeUpgradeStats[i]);
stasisProbeUpgradeStats[i] = _root.attachMovie("Variable", "StasisProbeUpgradeStat" + i, depth--);
initUpgrade(stasisProbeUpgradeStats[i]);
pbProbeUpgradeStats[i] = _root.attachMovie("Variable", "PBProbeUpgradeStat" + i, depth--);
initUpgrade(pbProbeUpgradeStats[i]);
wallProbeUpgradeStats[i] = _root.attachMovie("Variable", "WallProbeUpgradeStat" + i, depth--);
initUpgrade(wallProbeUpgradeStats[i]);
laserBeamUpgradeStats[i] = _root.attachMovie("Variable", "LaserBeamUpgradeStat" + i, depth--);
initUpgrade(laserBeamUpgradeStats[i]);
protectShipUpgradeStats[i] = _root.attachMovie("Variable", "protectShipUpgradeStat" + i, depth--);
initUpgrade(protectShipUpgradeStats[i]);
stasisShipUpgradeStats[i] = _root.attachMovie("Variable", "stasisShipUpgradeStat" + i, depth--);
initUpgrade(stasisShipUpgradeStats[i]);
i++;
}
configureDeflectBurstUpgradeStats();
configureLinkUpgradeStats();
configureStructuralUpgradeStats();
configureHeatBurstUpgradeStats();
configureFrostBurstUpgradeStats();
configureSpikedUpgradeStats();
configureRepulsorProbeUpgradeStats();
configureRocketProbeUpgradeStats();
configurePBProbeUpgradeStats();
configureBombProbeUpgradeStats();
configureDecoyProbeUpgradeStats();
configureStasisProbeUpgradeStats();
configureBatteryProbeUpgradeStats();
configureWallProbeUpgradeStats();
configureLaserBeamUpgradeStats();
configureProtectShipUpgradeStats();
configureStasisShipUpgradeStats();
}
function initUpgrade(upgrade) {
upgrade.hp = 0;
upgrade.hpRegen = 0;
upgrade.rechargeTime = 0;
upgrade.mass = 0;
upgrade.speed = 0;
upgrade.shotRate = 0;
upgrade.reloadRate = 0;
upgrade.shotsPerReload = 0;
upgrade.power = 0;
upgrade.range = 0;
upgrade.onHitVariable1 = 0;
upgrade.onHitVariable2 = 0;
upgrade.onHitPower = 0;
upgrade.onHitCooldown = 0;
upgrade.onHitRange = 0;
upgrade.onHitK = 0;
upgrade.onHitMass = 0;
upgrade.projSpeed = 0;
upgrade.reduction = 0;
upgrade.cost = 0;
}
function upgradeDeflectBurstSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Green") {
upgradeLevel = ptu.onHit1Level;
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(deflectBurstUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, deflectBurstUpgradeStats[upgradeLevel]);
ptu.onHit1Level++;
if (upgradeLevel == 0) {
ptu.onHit1 = function (objectHit) {
if (this.gameState != PS_DISCHARGED) {
if (this.onHit1CooldownTimer == 0) {
this.onHit1CooldownTimer = this.onHit1Cooldown;
fireDeflectBurst(this, this.onHit1Power, this.onHit1Mass, this.onHit1K, this.onHit1Range);
}
}
};
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
}
function upgradeFrostBurstSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Green") {
upgradeLevel = ptu.onHit1Level;
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(frostBurstUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, frostBurstUpgradeStats[upgradeLevel]);
ptu.onHit1Level++;
ptu.onHit1SlowEffect = ptu.onHit1SlowEffect + frostBurstUpgradeStats[upgradeLevel].onHit1SlowEffect;
ptu.onHit1ColdTime = ptu.onHit1ColdTime + frostBurstUpgradeStats[upgradeLevel].onHit1ColdTime;
if (upgradeLevel == 0) {
ptu.onHit1 = function (objectHit) {
if (this.gameState != PS_DISCHARGED) {
if (this.onHit1CooldownTimer == 0) {
this.onHit1CooldownTimer = this.onHit1Cooldown;
createFrostBurst(this, this.onHit1Power, this.onHit1Mass, this.onHit1K, this.onHit1Range, this.onHit1SlowEffect, this.onHit1ColdTime);
}
}
};
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
}
function upgradeHeatBurstSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Green") {
upgradeLevel = ptu.onHit1Level;
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(heatBurstUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, heatBurstUpgradeStats[upgradeLevel]);
ptu.onHit1Level++;
if (upgradeLevel == 0) {
ptu.onHit1 = function (objectHit) {
if (this.gameState != PS_DISCHARGED) {
if (this.onHit1CooldownTimer == 0) {
this.onHit1CooldownTimer = this.onHit1Cooldown;
fireHeatBurst(this, this.onHit1Power, this.onHit1Mass, this.onHit1K, this.onHit1Range);
}
}
};
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
}
function upgradeSpikedSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Yellow") {
upgradeLevel = ptu.onHit2Level;
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(spikedUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, spikedUpgradeStats[upgradeLevel]);
ptu.onHit2Level++;
if (upgradeLevel == 0) {
ptu.onHit2 = function (objectHit) {
if (this.gameState != PS_DISCHARGED) {
if (this.onHit2CooldownTimer == 0) {
this.onHit2CooldownTimer = this.onHit2Cooldown;
}
objectHit.damage(this.onHit2Power);
}
};
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
} else if (selectedMenuButton.menuColor == "Blue") {
upgradeLevel = ptu.onHit3Level;
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(spikedUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, spikedUpgradeStats[upgradeLevel]);
ptu.onHit3Level++;
if (upgradeLevel == 0) {
ptu.onHit3 = function (objectHit) {
if (this.gameState != PS_DISCHARGED) {
if (this.onHit3CooldownTimer == 0) {
this.onHit3CooldownTimer = this.onHit3Cooldown;
}
objectHit.damage(this.onHit3Power);
}
};
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
} else if (selectedMenuButton.menuColor == "Green") {
upgradeLevel = ptu.onHit1Level;
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(spikedUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, spikedUpgradeStats[upgradeLevel]);
ptu.onHit1Level++;
if (upgradeLevel == 0) {
ptu.onHit1 = function (objectHit) {
if (this.gameState != PS_DISCHARGED) {
if (this.onHit1CooldownTimer == 0) {
this.onHit1CooldownTimer = this.onHit1Cooldown;
}
objectHit.damage(this.onHit1Power);
}
};
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
}
function upgradeLinkSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Blue") {
upgradeLevel = ptu.onHit3Level;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(linkUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, linkUpgradeStats[upgradeLevel]);
ptu.onHit3Level++;
if (upgradeLevel == 0) {
ptu.onHit3 = function (objectHit) {
if (this.gameState != PS_DISCHARGED) {
if (this.onHit3CooldownTimer == 0) {
this.onHit3CooldownTimer = this.onHit3Cooldown;
createLinkToShip(this, this.onHit3Power);
}
}
};
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
}
function upgradeStructuralSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Yellow") {
upgradeLevel = ptu.onHit2Level;
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(structuralUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, structuralUpgradeStats[upgradeLevel]);
ptu.onHit2Level++;
if (upgradeLevel == 0) {
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
} else if (selectedMenuButton.menuColor == "Blue") {
upgradeLevel = ptu.onHit3Level;
if ((upgradeLevel != -1) && (upgradeLevel < MAX_ON_HIT_LEVEL)) {
if (canUpgrade(structuralUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, structuralUpgradeStats[upgradeLevel]);
ptu.onHit3Level++;
if (upgradeLevel == 0) {
ptu.onHit3 = function (objectHit) {
if (this.gameState != PS_DISCHARGED) {
}
};
}
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
}
function upgradeRepulsorProbeSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(repulsorProbeUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, repulsorProbeUpgradeStats[upgradeLevel]);
ptu.projMass = ptu.projMass + repulsorProbeUpgradeStats[upgradeLevel].projMass;
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeRocketProbeSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(rocketProbeUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, rocketProbeUpgradeStats[upgradeLevel]);
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradePBProbeSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(pbProbeUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, pbProbeUpgradeStats[upgradeLevel]);
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeBombProbeSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(bombProbeUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, bombProbeUpgradeStats[upgradeLevel]);
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeBatteryProbeSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(batteryProbeUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, batteryProbeUpgradeStats[upgradeLevel]);
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeStasisProbeSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(stasisProbeUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, stasisProbeUpgradeStats[upgradeLevel]);
ptu.slowEffect = ptu.slowEffect + stasisProbeUpgradeStats[upgradeLevel].slowEffect;
ptu.coldTime = ptu.coldTime + stasisProbeUpgradeStats[upgradeLevel].coldTime;
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeDecoyProbeSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(decoyProbeUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, decoyProbeUpgradeStats[upgradeLevel]);
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeWallProbeSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(wallProbeUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, wallProbeUpgradeStats[upgradeLevel]);
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeLaserBeamSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Red") {
upgradeLevel = ptu.upgradeLevel;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(laserBeamUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, laserBeamUpgradeStats[upgradeLevel]);
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeProtectShipSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Yellow") {
upgradeLevel = ptu.onHit2Level;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(protectShipUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, protectShipUpgradeStats[upgradeLevel]);
ptu.onHit2Level++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeStasisShipSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Blue") {
upgradeLevel = ptu.onHit3Level;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(stasisShipUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, stasisShipUpgradeStats[upgradeLevel]);
ptu.slowEffect = ptu.slowEffect + stasisShipUpgradeStats[upgradeLevel].slowEffect;
ptu.coldTime = ptu.coldTime + stasisShipUpgradeStats[upgradeLevel].coldTime;
ptu.onHit3Level++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeBoostAllSkill(ptu) {
upgradeLevel = -1;
if (ptu != -1) {
if (selectedMenuButton.menuColor == "Green") {
upgradeLevel = ptu.onHit1Level;
}
if ((upgradeLevel != -1) && (upgradeLevel < MAX_UPGRADE_LEVEL)) {
if (canUpgrade(boostAllUpgradeStats[upgradeLevel].cost)) {
upgradeProbeStats(ptu, boostAllUpgradeStats[upgradeLevel]);
ptu.upgradeLevel++;
refreshHighLevelStats();
toggleStatsMenuButton(selectedMenuButton);
} else {
displayError("Not Enough Money for Upgrade");
}
}
}
}
function upgradeProbeStats(ptu, upgradeStats) {
money = money - upgradeStats.cost;
MoneyField.text = money;
ptu.mass = ptu.mass + upgradeStats.mass;
ptu.shotRate = ptu.shotRate + upgradeStats.shotRate;
ptu.reloadRate = ptu.reloadRate + upgradeStats.reloadRate;
ptu.speed = ptu.speed + upgradeStats.speed;
ptu.projSpeed = ptu.projSpeed + upgradeStats.projSpeed;
ptu.setReloadRate(ptu.reloadRate);
ptu.setShotRate(ptu.shotRate);
ptu.shotsPerReload = ptu.shotsPerReload + upgradeStats.shotsPerReload;
ptu.power = ptu.power + upgradeStats.power;
ptu.range = ptu.range + upgradeStats.range;
ptu.hpMax = ptu.hpMax + upgradeStats.hp;
ptu.hp = ptu.hp + upgradeStats.hp;
ptu.reduction = ptu.reduction + upgradeStats.reduction;
ptu.cost = ptu.cost + upgradeStats.cost;
ptu.hpRegen = ptu.hpRegen + upgradeStats.hpRegen;
if (selectedMenuButton.menuColor == "Green") {
ptu.onHit1Mass = ptu.onHit1Mass + upgradeStats.onHitMass;
ptu.onHit1Variable1 = ptu.onHit1Variable1 + upgradeStats.onHitVariable1;
ptu.onHit1Variable2 = ptu.onHit1Variable2 + upgradeStats.onHitVariable2;
ptu.onHit1Power = ptu.onHit1Power + upgradeStats.onHitPower;
ptu.onHit1Cooldown = ptu.onHit1Cooldown + upgradeStats.onHitCooldown;
ptu.onHit1Range = ptu.onHit1Range + upgradeStats.onHitRange;
ptu.onHit1K = ptu.onHit1K + upgradeStats.onHitK;
} else if (selectedMenuButton.menuColor == "Yellow") {
ptu.onHit2Mass = ptu.onHit2Mass + upgradeStats.onHitMass;
ptu.onHit2Variable1 = ptu.onHit2Variable1 + upgradeStats.onHitVariable1;
ptu.onHit2Variable2 = ptu.onHit2Variable2 + upgradeStats.onHitVariable2;
ptu.onHit2Power = ptu.onHit2Power + upgradeStats.onHitPower;
ptu.onHit2Cooldown = ptu.onHit2Cooldown + upgradeStats.onHitCooldown;
ptu.onHit2Range = ptu.onHit2Range + upgradeStats.onHitRange;
ptu.onHit2K = ptu.onHit2K + upgradeStats.onHitK;
} else if (selectedMenuButton.menuColor == "Blue") {
ptu.onHit3Mass = ptu.onHit3Mass + upgradeStats.onHitMass;
ptu.onHit3Variable1 = ptu.onHit3Variable1 + upgradeStats.onHitVariable1;
ptu.onHit3Variable2 = ptu.onHit3Variable2 + upgradeStats.onHitVariable2;
ptu.onHit3Power = ptu.onHit3Power + upgradeStats.onHitPower;
ptu.onHit3Cooldown = ptu.onHit3Cooldown + upgradeStats.onHitCooldown;
ptu.onHit3Range = ptu.onHit3Range + upgradeStats.onHitRange;
ptu.onHit3K = ptu.onHit3K + upgradeStats.onHitK;
}
}
function configureDeflectBurstUpgradeStats() {
deflectBurstUpgradeStats[0].onHitVariable1 = 0;
deflectBurstUpgradeStats[0].onHitVariable2 = 0;
deflectBurstUpgradeStats[0].onHitPower = 50;
deflectBurstUpgradeStats[0].onHitCooldown = int(fps * 0.5);
deflectBurstUpgradeStats[0].onHitRange = 100;
deflectBurstUpgradeStats[0].onHitK = 3;
deflectBurstUpgradeStats[0].onHitMass = 1;
deflectBurstUpgradeStats[0].cost = 250;
deflectBurstUpgradeStats[1].onHitVariable1 = 0;
deflectBurstUpgradeStats[1].onHitVariable2 = 0;
deflectBurstUpgradeStats[1].onHitPower = 50;
deflectBurstUpgradeStats[1].onHitCooldown = 0;
deflectBurstUpgradeStats[1].onHitRange = 0;
deflectBurstUpgradeStats[1].onHitK = 1;
deflectBurstUpgradeStats[1].cost = 250;
deflectBurstUpgradeStats[2].onHitVariable1 = 0;
deflectBurstUpgradeStats[2].onHitVariable2 = 0;
deflectBurstUpgradeStats[2].onHitPower = 50;
deflectBurstUpgradeStats[2].onHitCooldown = 0;
deflectBurstUpgradeStats[2].onHitRange = 0;
deflectBurstUpgradeStats[2].onHitK = 1;
deflectBurstUpgradeStats[2].cost = 250;
}
function configureLinkUpgradeStats() {
linkUpgradeStats[0].onHitVariable1 = 0;
linkUpgradeStats[0].onHitVariable2 = 0;
linkUpgradeStats[0].onHitPower = 0.75;
linkUpgradeStats[0].onHitCooldown = int(fps * 0.2);
linkUpgradeStats[0].onHitRange = 0;
linkUpgradeStats[0].onHitK = 0;
linkUpgradeStats[0].onHitMass = 0;
linkUpgradeStats[0].cost = 125;
linkUpgradeStats[1].onHitVariable1 = 0;
linkUpgradeStats[1].onHitVariable2 = 0;
linkUpgradeStats[1].onHitPower = 0.75;
linkUpgradeStats[1].onHitCooldown = 0;
linkUpgradeStats[1].onHitRange = 0;
linkUpgradeStats[1].onHitK = 0;
linkUpgradeStats[1].cost = 85;
linkUpgradeStats[2].onHitVariable1 = 0;
linkUpgradeStats[2].onHitVariable2 = 0;
linkUpgradeStats[2].onHitPower = 0.5;
linkUpgradeStats[2].onHitCooldown = 0;
linkUpgradeStats[2].onHitRange = 0;
linkUpgradeStats[2].onHitK = 0;
linkUpgradeStats[2].cost = 85;
}
function configureStructuralUpgradeStats() {
structuralUpgradeStats[0].onHitVariable1 = 0;
structuralUpgradeStats[0].onHitVariable2 = 0;
structuralUpgradeStats[0].onHitPower = 1;
structuralUpgradeStats[0].onHitCooldown = int(fps * 0.5);
structuralUpgradeStats[0].onHitRange = 0;
structuralUpgradeStats[0].onHitK = 0;
structuralUpgradeStats[0].onHitMass = 0;
structuralUpgradeStats[0].hp = 50;
structuralUpgradeStats[0].rechargeTime = 0;
structuralUpgradeStats[0].hpRegen = 1 / (4 * fps);
structuralUpgradeStats[0].cost = 50;
structuralUpgradeStats[1].onHitVariable1 = 0;
structuralUpgradeStats[1].onHitVariable2 = 0;
structuralUpgradeStats[1].onHitPower = 0.5;
structuralUpgradeStats[1].onHitCooldown = -1;
structuralUpgradeStats[1].onHitRange = 0;
structuralUpgradeStats[1].onHitK = 0;
structuralUpgradeStats[1].hp = 50;
structuralUpgradeStats[1].rechargeTime = 0;
structuralUpgradeStats[1].hpRegen = 1 / (4 * fps);
structuralUpgradeStats[1].cost = 50;
structuralUpgradeStats[2].onHitVariable1 = 0;
structuralUpgradeStats[2].onHitVariable2 = 0;
structuralUpgradeStats[2].onHitPower = 0.5;
structuralUpgradeStats[2].onHitCooldown = -1;
structuralUpgradeStats[2].onHitRange = 0;
structuralUpgradeStats[2].onHitK = 0;
structuralUpgradeStats[2].hp = 50;
structuralUpgradeStats[2].rechargeTime = 0;
structuralUpgradeStats[2].hpRegen = 1 / (4 * fps);
structuralUpgradeStats[2].cost = 50;
}
function configureHeatBurstUpgradeStats() {
heatBurstUpgradeStats[0].onHitVariable1 = 0;
heatBurstUpgradeStats[0].onHitVariable2 = 0;
heatBurstUpgradeStats[0].onHitPower = 75;
heatBurstUpgradeStats[0].onHitCooldown = int(fps * 0.5);
heatBurstUpgradeStats[0].onHitRange = 100;
heatBurstUpgradeStats[0].onHitK = 0;
heatBurstUpgradeStats[0].onHitMass = 0;
heatBurstUpgradeStats[0].cost = 150;
heatBurstUpgradeStats[1].onHitVariable1 = 0;
heatBurstUpgradeStats[1].onHitVariable2 = 0;
heatBurstUpgradeStats[1].onHitPower = 75;
heatBurstUpgradeStats[1].onHitCooldown = 0;
heatBurstUpgradeStats[1].onHitRange = 15;
heatBurstUpgradeStats[1].onHitK = 0;
heatBurstUpgradeStats[1].cost = 150;
heatBurstUpgradeStats[2].onHitVariable1 = 0;
heatBurstUpgradeStats[2].onHitVariable2 = 0;
heatBurstUpgradeStats[2].onHitPower = 75;
heatBurstUpgradeStats[2].onHitCooldown = 0;
heatBurstUpgradeStats[2].onHitRange = 15;
heatBurstUpgradeStats[2].onHitK = 0;
heatBurstUpgradeStats[2].cost = 150;
}
function configureFrostBurstUpgradeStats() {
frostBurstUpgradeStats[0].onHitVariable1 = 0;
frostBurstUpgradeStats[0].onHitVariable2 = 0;
frostBurstUpgradeStats[0].onHitPower = 10;
frostBurstUpgradeStats[0].onHitCooldown = int(fps * 0.5);
frostBurstUpgradeStats[0].onHitRange = 100;
frostBurstUpgradeStats[0].onHitK = 0;
frostBurstUpgradeStats[0].onHitMass = 0;
frostBurstUpgradeStats[0].onHit1SlowEffect = 0.75;
frostBurstUpgradeStats[0].onHit1ColdTime = 3;
frostBurstUpgradeStats[0].cost = 150;
frostBurstUpgradeStats[1].onHitVariable1 = 0;
frostBurstUpgradeStats[1].onHitVariable2 = 0;
frostBurstUpgradeStats[1].onHitPower = 10;
frostBurstUpgradeStats[1].onHitCooldown = 0;
frostBurstUpgradeStats[1].onHitRange = 15;
frostBurstUpgradeStats[1].onHitK = 0;
frostBurstUpgradeStats[1].onHit1SlowEffect = 0.1;
frostBurstUpgradeStats[1].onHit1ColdTime = 0;
frostBurstUpgradeStats[1].cost = 150;
frostBurstUpgradeStats[2].onHitVariable1 = 0;
frostBurstUpgradeStats[2].onHitVariable2 = 0;
frostBurstUpgradeStats[2].onHitPower = 10;
frostBurstUpgradeStats[2].onHitCooldown = 0;
frostBurstUpgradeStats[2].onHitRange = 15;
frostBurstUpgradeStats[2].onHitK = 0;
frostBurstUpgradeStats[2].onHit1SlowEffect = 0.1;
frostBurstUpgradeStats[2].onHit1ColdTime = 0;
frostBurstUpgradeStats[2].cost = 150;
}
function configureSpikedUpgradeStats() {
spikedUpgradeStats[0].onHitVariable1 = 0;
spikedUpgradeStats[0].onHitVariable2 = 0;
spikedUpgradeStats[0].onHitPower = 30;
spikedUpgradeStats[0].onHitCooldown = int(fps * 0.5);
spikedUpgradeStats[0].onHitRange = 0;
spikedUpgradeStats[0].onHitK = 0;
spikedUpgradeStats[0].onHitMass = 0;
spikedUpgradeStats[0].reduction = 1;
spikedUpgradeStats[0].cost = 100;
spikedUpgradeStats[1].onHitVariable1 = 0;
spikedUpgradeStats[1].onHitVariable2 = 0;
spikedUpgradeStats[1].onHitPower = 25;
spikedUpgradeStats[1].onHitCooldown = 0;
spikedUpgradeStats[1].onHitRange = 0;
spikedUpgradeStats[1].onHitK = 0;
spikedUpgradeStats[1].reduction = 1;
spikedUpgradeStats[1].cost = 100;
spikedUpgradeStats[2].onHitVariable1 = 0;
spikedUpgradeStats[2].onHitVariable2 = 0;
spikedUpgradeStats[2].onHitPower = 25;
spikedUpgradeStats[2].onHitCooldown = 0;
spikedUpgradeStats[2].onHitRange = 0;
spikedUpgradeStats[2].onHitK = 0;
spikedUpgradeStats[2].reduction = 1;
spikedUpgradeStats[2].cost = 100;
}
function configureRepulsorProbeUpgradeStats() {
repulsorProbeUpgradeStats[0].mass = 0;
repulsorProbeUpgradeStats[0].speed = 0;
repulsorProbeUpgradeStats[0].shotRate = 0;
repulsorProbeUpgradeStats[0].reloadRate = 0;
repulsorProbeUpgradeStats[0].shotsPerReload = 0;
repulsorProbeUpgradeStats[0].power = 0;
repulsorProbeUpgradeStats[0].range = 0;
repulsorProbeUpgradeStats[0].hp = 0;
repulsorProbeUpgradeStats[0].projMass = 0.5;
repulsorProbeUpgradeStats[0].cost = 350;
repulsorProbeUpgradeStats[1].mass = 0;
repulsorProbeUpgradeStats[1].speed = 0;
repulsorProbeUpgradeStats[1].shotRate = 0;
repulsorProbeUpgradeStats[1].reloadRate = 0;
repulsorProbeUpgradeStats[1].shotsPerReload = 1;
repulsorProbeUpgradeStats[1].power = 35.4;
repulsorProbeUpgradeStats[1].range = 30;
repulsorProbeUpgradeStats[1].hp = 150;
repulsorProbeUpgradeStats[1].projMass = 0.5;
repulsorProbeUpgradeStats[1].cost = 400;
repulsorProbeUpgradeStats[2].mass = 0;
repulsorProbeUpgradeStats[2].speed = 0;
repulsorProbeUpgradeStats[2].shotRate = 0;
repulsorProbeUpgradeStats[2].reloadRate = 0;
repulsorProbeUpgradeStats[2].shotsPerReload = 1;
repulsorProbeUpgradeStats[2].power = 35;
repulsorProbeUpgradeStats[2].range = 20;
repulsorProbeUpgradeStats[2].hp = 150;
repulsorProbeUpgradeStats[2].projMass = 0.5;
repulsorProbeUpgradeStats[2].cost = 400;
}
function configureRocketProbeUpgradeStats() {
rocketProbeUpgradeStats[0].mass = 0;
rocketProbeUpgradeStats[0].speed = 0;
rocketProbeUpgradeStats[0].shotRate = 0;
rocketProbeUpgradeStats[0].reloadRate = 0;
rocketProbeUpgradeStats[0].shotsPerReload = 1;
rocketProbeUpgradeStats[0].power = 0;
rocketProbeUpgradeStats[0].range = 40;
rocketProbeUpgradeStats[0].hp = 100;
rocketProbeUpgradeStats[0].cost = 600;
rocketProbeUpgradeStats[1].mass = 0;
rocketProbeUpgradeStats[1].speed = 0;
rocketProbeUpgradeStats[1].shotRate = 0;
rocketProbeUpgradeStats[1].reloadRate = -0.15;
rocketProbeUpgradeStats[1].shotsPerReload = 0;
rocketProbeUpgradeStats[1].power = 78;
rocketProbeUpgradeStats[1].range = 15;
rocketProbeUpgradeStats[1].hp = 100;
rocketProbeUpgradeStats[1].cost = 600;
rocketProbeUpgradeStats[2].mass = 0;
rocketProbeUpgradeStats[2].speed = 0;
rocketProbeUpgradeStats[2].shotRate = 0;
rocketProbeUpgradeStats[2].reloadRate = -0.35;
rocketProbeUpgradeStats[2].shotsPerReload = 0;
rocketProbeUpgradeStats[2].power = 48;
rocketProbeUpgradeStats[2].range = 10;
rocketProbeUpgradeStats[2].hp = 50;
rocketProbeUpgradeStats[2].cost = 600;
}
function configureBombProbeUpgradeStats() {
bombProbeUpgradeStats[0].mass = 0;
bombProbeUpgradeStats[0].speed = 0;
bombProbeUpgradeStats[0].shotRate = 0;
bombProbeUpgradeStats[0].reloadRate = 0;
bombProbeUpgradeStats[0].shotsPerReload = 0;
bombProbeUpgradeStats[0].power = 0;
bombProbeUpgradeStats[0].range = 0;
bombProbeUpgradeStats[0].hp = 0;
bombProbeUpgradeStats[0].cost = 450;
bombProbeUpgradeStats[1].mass = 0;
bombProbeUpgradeStats[1].speed = 0;
bombProbeUpgradeStats[1].shotRate = 0;
bombProbeUpgradeStats[1].reloadRate = -1;
bombProbeUpgradeStats[1].shotsPerReload = 0;
bombProbeUpgradeStats[1].power = 400;
bombProbeUpgradeStats[1].range = 15;
bombProbeUpgradeStats[1].hp = 125;
bombProbeUpgradeStats[1].cost = 450;
bombProbeUpgradeStats[2].mass = 0;
bombProbeUpgradeStats[2].speed = 0;
bombProbeUpgradeStats[2].shotRate = 0;
bombProbeUpgradeStats[2].reloadRate = -2;
bombProbeUpgradeStats[2].shotsPerReload = 0;
bombProbeUpgradeStats[2].power = 400;
bombProbeUpgradeStats[2].range = 10;
bombProbeUpgradeStats[2].hp = 125;
bombProbeUpgradeStats[2].cost = 450;
}
function configurePBProbeUpgradeStats() {
pbProbeUpgradeStats[0].mass = 0;
pbProbeUpgradeStats[0].speed = 0;
pbProbeUpgradeStats[0].shotRate = 0;
pbProbeUpgradeStats[0].reloadRate = 0;
pbProbeUpgradeStats[0].shotsPerReload = 0;
pbProbeUpgradeStats[0].power = 0;
pbProbeUpgradeStats[0].range = 0;
pbProbeUpgradeStats[0].hp = 0;
pbProbeUpgradeStats[0].cost = 400;
pbProbeUpgradeStats[1].mass = 0;
pbProbeUpgradeStats[1].speed = 0;
pbProbeUpgradeStats[1].shotRate = 2;
pbProbeUpgradeStats[1].reloadRate = 0;
pbProbeUpgradeStats[1].shotsPerReload = 3;
pbProbeUpgradeStats[1].power = 3;
pbProbeUpgradeStats[1].range = 20;
pbProbeUpgradeStats[1].hp = 100;
pbProbeUpgradeStats[1].cost = 300;
pbProbeUpgradeStats[2].mass = 0;
pbProbeUpgradeStats[2].speed = 0;
pbProbeUpgradeStats[2].shotRate = 1;
pbProbeUpgradeStats[2].reloadRate = 0;
pbProbeUpgradeStats[2].shotsPerReload = 2;
pbProbeUpgradeStats[2].power = 6;
pbProbeUpgradeStats[2].range = 20;
pbProbeUpgradeStats[2].hp = 100;
pbProbeUpgradeStats[2].cost = 300;
}
function configureDecoyProbeUpgradeStats() {
decoyProbeUpgradeStats[0].mass = 0;
decoyProbeUpgradeStats[0].speed = 0;
decoyProbeUpgradeStats[0].shotRate = 0;
decoyProbeUpgradeStats[0].reloadRate = 0;
decoyProbeUpgradeStats[0].shotsPerReload = 0;
decoyProbeUpgradeStats[0].power = 0;
decoyProbeUpgradeStats[0].range = 0;
decoyProbeUpgradeStats[0].hp = 0;
decoyProbeUpgradeStats[0].cost = 170;
decoyProbeUpgradeStats[1].mass = 0;
decoyProbeUpgradeStats[1].speed = 0;
decoyProbeUpgradeStats[1].shotRate = 0;
decoyProbeUpgradeStats[1].reloadRate = 0;
decoyProbeUpgradeStats[1].shotsPerReload = 0;
decoyProbeUpgradeStats[1].power = 0;
decoyProbeUpgradeStats[1].range = 15;
decoyProbeUpgradeStats[1].hp = 20;
decoyProbeUpgradeStats[1].cost = 185;
decoyProbeUpgradeStats[2].mass = 0;
decoyProbeUpgradeStats[2].speed = 0;
decoyProbeUpgradeStats[2].shotRate = 0;
decoyProbeUpgradeStats[2].reloadRate = 0;
decoyProbeUpgradeStats[2].shotsPerReload = 0;
decoyProbeUpgradeStats[2].power = 0;
decoyProbeUpgradeStats[2].range = 15;
decoyProbeUpgradeStats[2].hp = 20;
decoyProbeUpgradeStats[2].cost = 185;
}
function configureBatteryProbeUpgradeStats() {
batteryProbeUpgradeStats[0].mass = 0;
batteryProbeUpgradeStats[0].speed = 0;
batteryProbeUpgradeStats[0].shotRate = 0;
batteryProbeUpgradeStats[0].reloadRate = 0;
batteryProbeUpgradeStats[0].shotsPerReload = 0;
batteryProbeUpgradeStats[0].power = 0;
batteryProbeUpgradeStats[0].range = 0;
batteryProbeUpgradeStats[0].hp = 0;
batteryProbeUpgradeStats[0].cost = 115;
batteryProbeUpgradeStats[1].mass = 0;
batteryProbeUpgradeStats[1].speed = 0.2;
batteryProbeUpgradeStats[1].shotRate = 0;
batteryProbeUpgradeStats[1].reloadRate = 0;
batteryProbeUpgradeStats[1].shotsPerReload = 0;
batteryProbeUpgradeStats[1].power = 0.5;
batteryProbeUpgradeStats[1].range = 10;
batteryProbeUpgradeStats[1].hp = 125;
batteryProbeUpgradeStats[1].cost = 115;
batteryProbeUpgradeStats[2].mass = 0;
batteryProbeUpgradeStats[2].speed = 0.1;
batteryProbeUpgradeStats[2].shotRate = 0;
batteryProbeUpgradeStats[2].reloadRate = 0;
batteryProbeUpgradeStats[2].shotsPerReload = 0;
batteryProbeUpgradeStats[2].power = 0.5;
batteryProbeUpgradeStats[2].range = 10;
batteryProbeUpgradeStats[2].hp = 125;
batteryProbeUpgradeStats[2].cost = 115;
}
function configureStasisProbeUpgradeStats() {
stasisProbeUpgradeStats[0].mass = 0;
stasisProbeUpgradeStats[0].speed = 0;
stasisProbeUpgradeStats[0].shotRate = 0;
stasisProbeUpgradeStats[0].reloadRate = 0;
stasisProbeUpgradeStats[0].shotsPerReload = 0;
stasisProbeUpgradeStats[0].power = 0;
stasisProbeUpgradeStats[0].range = 0;
stasisProbeUpgradeStats[0].hp = 0;
stasisProbeUpgradeStats[0].slowEffect = 0.1;
stasisProbeUpgradeStats[0].coldTime = -1;
stasisProbeUpgradeStats[0].cost = 140;
stasisProbeUpgradeStats[1].mass = 0;
stasisProbeUpgradeStats[1].speed = 0;
stasisProbeUpgradeStats[1].shotRate = 0;
stasisProbeUpgradeStats[1].reloadRate = 0;
stasisProbeUpgradeStats[1].shotsPerReload = 0;
stasisProbeUpgradeStats[1].power = 0;
stasisProbeUpgradeStats[1].range = 0;
stasisProbeUpgradeStats[1].hp = 25;
stasisProbeUpgradeStats[1].slowEffect = 0.1;
stasisProbeUpgradeStats[1].coldTime = -0.5;
stasisProbeUpgradeStats[1].cost = 140;
stasisProbeUpgradeStats[2].mass = 0;
stasisProbeUpgradeStats[2].speed = 0;
stasisProbeUpgradeStats[2].shotRate = 0;
stasisProbeUpgradeStats[2].reloadRate = 0;
stasisProbeUpgradeStats[2].shotsPerReload = 0;
stasisProbeUpgradeStats[2].power = 0;
stasisProbeUpgradeStats[2].range = 0;
stasisProbeUpgradeStats[2].hp = 25;
stasisProbeUpgradeStats[2].slowEffect = 0.1;
stasisProbeUpgradeStats[2].coldTime = -0.5;
stasisProbeUpgradeStats[2].cost = 140;
}
function configureWallProbeUpgradeStats() {
wallProbeUpgradeStats[0].mass = 0;
wallProbeUpgradeStats[0].speed = 0;
wallProbeUpgradeStats[0].shotRate = 0;
wallProbeUpgradeStats[0].reloadRate = 0;
wallProbeUpgradeStats[0].shotsPerReload = 0;
wallProbeUpgradeStats[0].power = 0;
wallProbeUpgradeStats[0].range = 0;
wallProbeUpgradeStats[0].hp = 0;
wallProbeUpgradeStats[0].cost = 100;
wallProbeUpgradeStats[1].mass = 1;
wallProbeUpgradeStats[1].speed = 0.2;
wallProbeUpgradeStats[1].shotRate = 0;
wallProbeUpgradeStats[1].reloadRate = 0;
wallProbeUpgradeStats[1].shotsPerReload = 0;
wallProbeUpgradeStats[1].power = 0;
wallProbeUpgradeStats[1].range = 0;
wallProbeUpgradeStats[1].hp = 150;
wallProbeUpgradeStats[1].cost = 100;
wallProbeUpgradeStats[2].mass = 1;
wallProbeUpgradeStats[2].speed = 0.2;
wallProbeUpgradeStats[2].shotRate = 0;
wallProbeUpgradeStats[2].reloadRate = 0;
wallProbeUpgradeStats[2].shotsPerReload = 0;
wallProbeUpgradeStats[2].power = 0;
wallProbeUpgradeStats[2].range = 0;
wallProbeUpgradeStats[2].hp = 200;
wallProbeUpgradeStats[2].cost = 100;
}
function configureLaserBeamUpgradeStats() {
laserBeamUpgradeStats[0].mass = 0;
laserBeamUpgradeStats[0].speed = 0;
laserBeamUpgradeStats[0].shotRate = 0;
laserBeamUpgradeStats[0].reloadRate = 0;
laserBeamUpgradeStats[0].shotsPerReload = 0;
laserBeamUpgradeStats[0].power = 20;
laserBeamUpgradeStats[0].range = 0;
laserBeamUpgradeStats[0].hp = 0;
laserBeamUpgradeStats[1].mass = 0;
laserBeamUpgradeStats[1].speed = 0;
laserBeamUpgradeStats[1].shotRate = 0;
laserBeamUpgradeStats[1].reloadRate = 0;
laserBeamUpgradeStats[1].shotsPerReload = 0;
laserBeamUpgradeStats[1].power = 35;
laserBeamUpgradeStats[1].range = 0;
laserBeamUpgradeStats[1].hp = 0;
laserBeamUpgradeStats[1].cost = 300;
laserBeamUpgradeStats[2].mass = 0;
laserBeamUpgradeStats[2].speed = 0;
laserBeamUpgradeStats[2].shotRate = 0;
laserBeamUpgradeStats[2].reloadRate = 0;
laserBeamUpgradeStats[2].shotsPerReload = 0;
laserBeamUpgradeStats[2].power = 35;
laserBeamUpgradeStats[2].range = 0;
laserBeamUpgradeStats[2].hp = 0;
laserBeamUpgradeStats[2].cost = 300;
}
function configureProtectShipUpgradeStats() {
protectShipUpgradeStats[0].mass = 0;
protectShipUpgradeStats[0].speed = 0;
protectShipUpgradeStats[0].shotRate = 0;
protectShipUpgradeStats[0].reloadRate = 0;
protectShipUpgradeStats[0].shotsPerReload = 0;
protectShipUpgradeStats[0].onHitPower = 0;
protectShipUpgradeStats[0].onHitRange = 50;
protectShipUpgradeStats[0].hp = 0;
protectShipUpgradeStats[1].mass = 0;
protectShipUpgradeStats[1].speed = 0;
protectShipUpgradeStats[1].shotRate = 0;
protectShipUpgradeStats[1].reloadRate = 0;
protectShipUpgradeStats[1].shotsPerReload = 0;
protectShipUpgradeStats[1].onHitPower = 100;
protectShipUpgradeStats[1].onHitRange = 50;
protectShipUpgradeStats[1].hp = 0;
protectShipUpgradeStats[1].cost = 300;
protectShipUpgradeStats[2].mass = 0;
protectShipUpgradeStats[2].speed = 0;
protectShipUpgradeStats[2].shotRate = 0;
protectShipUpgradeStats[2].reloadRate = 0;
protectShipUpgradeStats[2].shotsPerReload = 0;
protectShipUpgradeStats[2].onHitPower = 150;
protectShipUpgradeStats[2].onHitRange = 50;
protectShipUpgradeStats[2].hp = 0;
protectShipUpgradeStats[2].cost = 300;
}
function configureStasisShipUpgradeStats() {
stasisShipUpgradeStats[0].mass = 0;
stasisShipUpgradeStats[0].speed = 0;
stasisShipUpgradeStats[0].shotRate = 0;
stasisShipUpgradeStats[0].reloadRate = 0;
stasisShipUpgradeStats[0].shotsPerReload = 0;
stasisShipUpgradeStats[0].onHitPower = 0;
stasisShipUpgradeStats[0].onHitRange = 50;
stasisShipUpgradeStats[0].slowEffect = 0;
stasisShipUpgradeStats[0].coldTime = 0;
stasisShipUpgradeStats[0].hp = 0;
stasisShipUpgradeStats[1].mass = 0;
stasisShipUpgradeStats[1].speed = 0;
stasisShipUpgradeStats[1].shotRate = 0;
stasisShipUpgradeStats[1].reloadRate = 0;
stasisShipUpgradeStats[1].shotsPerReload = 0;
stasisShipUpgradeStats[1].onHitPower = 200;
stasisShipUpgradeStats[1].onHitRange = 50;
stasisShipUpgradeStats[1].slowEffect = 0.1;
stasisShipUpgradeStats[1].coldTime = 0.5;
stasisShipUpgradeStats[1].hp = 0;
stasisShipUpgradeStats[1].cost = 300;
stasisShipUpgradeStats[2].mass = 0;
stasisShipUpgradeStats[2].speed = 0;
stasisShipUpgradeStats[2].shotRate = 0;
stasisShipUpgradeStats[2].reloadRate = 0;
stasisShipUpgradeStats[2].shotsPerReload = 0;
stasisShipUpgradeStats[2].onHitPower = 200;
stasisShipUpgradeStats[2].onHitRange = 50;
stasisShipUpgradeStats[2].slowEffect = 0.1;
stasisShipUpgradeStats[2].coldTime = 0.5;
stasisShipUpgradeStats[2].hp = 0;
stasisShipUpgradeStats[2].cost = 300;
}
init();
Frame 46
function init() {
MOVE_TO_TARGET_POS = 0;
ATTACK_TARGET_AMT = 1;
MOVE_DIRECTION_TIME = 2;
ATTACK_DIRECTION = 3;
MOVE_TO_TARGET = 4;
ATTACK_TARGET_TIME = 5;
ATTACK_DIRECTION_TIME = 6;
}
function initSmartUnit(smartUnit) {
smartUnit.step = smartStep;
smartUnit.goNextInstruction = goNextInstruction;
smartUnit.goPlanB = goPlanB;
smartUnit.numInstructions = 25;
smartUnit.instructions = new Array();
smartUnit.currentInstruction = _root.attachMovie("Variable", "CurrentIns" + insi, depth--);
insi = 0;
while (insi < smartUnit.numInstructions) {
smartUnit.instructions[insi] = _root.attachMovie("Variable", "BotIns" + insi, depth--);
insi++;
}
}
function smartStep() {
this.instructionFramesElapsed++;
if (this.currentInstruction.instructionFramesElapsed > this.currentInstruction.instructionTimeOut) {
this.couldNotCompleteInstruction++;
this.gotoPlanB();
}
if (this.currentInstruction.instructionType == MOVE_TO_TARGET_POS) {
this.tmpDx = this.currentInstruction.instructionVar1 - this._x;
this.tmpDy = this.currentInstruction.instructionVar2 - this._y;
distanceSq = (this.tmpDx * this.tmpDx) + (this.tmpDy * this.tmpDy);
if (distanceSq < 4096) {
this.goNextInstruction();
}
normalizeTmp(this, this);
this.tmpDx = this.tmpDx * this.speed;
this.tmpDy = this.tmpDy * this.speed;
if (magnitude(this) < this.speed) {
this.ax = this.ax + this.tmpDx;
this.ay = this.ay + this.tmpDy;
}
} else if (this.currentInstruction.instructionType == ATTACK_TARGET_AMT) {
this.shotCooldownTimer--;
if (this.shotCooldownTimer <= 0) {
this.fireShot();
if (this.shotsFired >= this.currentInstruction.instructionVar1) {
this.goNextInstruction();
}
}
} else if (this.currentInstruction.instructionType == MOVE_DIRECTION_TIME) {
this.tmpDx = this.instructionVar1 - this._x;
this.tmpDy = this.instructionVar2 - this._y;
distanceSq = (this.tmpDx * this.tmpDx) + (this.tmpDy * this.tmpDy);
if (distanceSq < 4096) {
this.goNextInstruction();
}
normalizeTmp(this, this);
this.tmpDx = this.tmpDx * this.speed;
this.tmpDy = this.tmpDy * this.speed;
if (magnitude(this) < this.speed) {
this.ax = this.ax + this.tmpDx;
this.ay = this.ay + this.tmpDy;
}
} else if (this.currentInstruction.instructionType == ATTACK_DIRECTION) {
} else if (this.currentInstruction.instructionType == MOVE_TO_TARGET) {
this.tmpDx = this.gameTarget._x - this._x;
this.tmpDy = this.gameTarget._y - this._y;
distanceSq = (this.tmpDx * this.tmpDx) + (this.tmpDy * this.tmpDy);
if (distanceSq < 4096) {
this.goNextInstruction();
}
normalizeTmp(this, this);
this.tmpDx = this.tmpDx * this.speed;
this.tmpDy = this.tmpDy * this.speed;
if (magnitude(this) < this.speed) {
this.ax = this.ax + this.tmpDx;
this.ay = this.ay + this.tmpDy;
}
}
}
function goNextInstruction() {
this.currentInstruction.instructionFramesElapsed = 0;
this.shotsFired = 0;
if (this.currentInstruction.gotoInstruction == -1) {
this.gameTarget = mainShip;
this.step = basicAsteroidStep;
}
copyInstruction(this.instructions[this.currentInstruction.gotoInstruction], this.currentInstruction);
}
function goPlanB() {
this.currentInstruction.instructionFramesElapsed = 0;
if (this.currentInstruction.planBInstruction == -1) {
this.gameTarget = mainShip;
this.step = basicAsteroidStep();
}
copyInstruction(this.instructions[this.currentInstruction.planBInstruction], this.currentInstruction);
}
function copyInstruction(insTarget, insDest) {
insDest.instructionType = insTarget.instructionType;
insDest.instructionVar1 = insTarget.instructionVar1;
insDest.instructionVar2 = insTarget.instructionVar2;
insDest.gotoInstruction = insTarget.gotoInstruction;
insDest.planBInstruction = insTarget.planBInstruction;
insDest.instructionTimeOut = insTarget.instructionTimeOut;
}
init();
Frame 48
function init() {
i = fps * 5;
}
function onMouseDown() {
i = fps * 1.25;
}
function checkAckInput() {
if (firstDownActions.advance == true) {
i = fps * 1.25;
}
}
stop();
init();
_root.onEnterFrame = function () {
if (i < (fps * 1.25)) {
} else if (GameBuild == false) {
_root.gotoAndStop("Initializer");
} else {
_root.gotoAndStop("TableOfContents");
}
checkInput();
checkAckInput();
if (!throttled()) {
if (i < (fps * 1.25)) {
i++;
} else if (GameBuild == false) {
_root.gotoAndStop("Initializer");
} else {
_root.gotoAndStop("TableOfContents");
}
}
};
Frame 49
function init() {
innerFrozen = false;
outterFrozen = false;
GirlFace.angle = 0;
GirlFace.angleIncrement = 0.25;
GirlFace.radius = 250;
GirlFace.move = tocMove;
Pink.angle = 30;
Pink.angleIncrement = 0.25;
Pink.radius = 250;
Pink.move = tocMove;
Green.angle = 60;
Green.angleIncrement = 0.25;
Green.radius = 250;
Green.move = tocMove;
BoyFace.angle = 90;
BoyFace.angleIncrement = 0.25;
BoyFace.radius = 250;
BoyFace.move = tocMove;
Gray.angle = 120;
Gray.angleIncrement = 0.25;
Gray.radius = 250;
Gray.move = tocMove;
Yellow.angle = 150;
Yellow.angleIncrement = 0.25;
Yellow.radius = 250;
Yellow.move = tocMove;
ButteFace.angle = 180;
ButteFace.angleIncrement = 0.25;
ButteFace.radius = 250;
ButteFace.move = tocMove;
Red.angle = 210;
Red.angleIncrement = 0.25;
Red.radius = 250;
Red.move = tocMove;
CShip.angle = 240;
CShip.angleIncrement = 0.25;
CShip.radius = 250;
CShip.move = tocMove;
CommandoFace.angle = 270;
CommandoFace.angleIncrement = 0.25;
CommandoFace.radius = 250;
CommandoFace.move = tocMove;
Exploder.angle = 300;
Exploder.angleIncrement = 0.25;
Exploder.radius = 250;
Exploder.move = tocMove;
BBot.angle = 330;
BBot.angleIncrement = 0.25;
BBot.radius = 250;
BBot.move = tocMove;
TOCCredits.onPress = function () {
_root.gotoAndStop("Credits");
};
TOCJumbled.onPress = function () {
getURL ("http://www.jumbledmind.com", "_blank");
};
TOCHS.onPress = function () {
getURL ("http://www.jumbledmind.com/SDSHighScores", "_blank");
};
PlayGameButton.onPress = function () {
if (_root.initialized == true) {
_root.gotoAndStop("PlayGame");
} else {
_root.gotoAndPlay("Initializer");
}
};
}
function tocMove() {
this.angle = this.angle + this.angleIncrement;
if (this.angle > 360) {
this.angle = this.angle - 360;
} else if (this.angle < 0) {
this.angle = this.angle + 360;
}
angle = this.angle * DEG_TO_RAD;
this._x = (this.radius * Math.cos(angle)) + 320;
this._y = (this.radius * Math.sin(angle)) + 320;
}
stop();
init();
_root.onEnterFrame = function () {
if (outterFrozen) {
} else {
BoyFace.move();
GirlFace.move();
ButteFace.move();
CommandoFace.move();
Pink.move();
Gray.move();
Red.move();
Exploder.move();
CShip.move();
Green.move();
Splitter.move();
BBot.move();
Yellow.move();
}
};
Frame 53
function init() {
if (_root.licensed == false) {
_root.gotoAndStop("NoLicense");
}
_root.initialized = true;
SELL_VALUE_PERCENTAGE = 0.75;
PLAYABLE_HEIGHT = Stage.height;
PLAYABLE_WIDTH = Stage.width;
OUTSIDE_RADIUS = Math.max(PLAYABLE_HEIGHT, PLAYABLE_WIDTH * 0.5);
BOTTOM_EDGE = Stage.height - 32;
PROBE_MENU_EDGE = 256;
MAX_PROBES = 40;
MAX_PROJECTILES = 30;
MAX_ENEMIES = 20;
MAX_DIALOG_PIECES = 3;
MAX_EFFECTS = 25;
MAX_CONTROL = 75;
MAX_PROBE_GROUP_SIZE = 6;
MAX_ENEMY_GROUP_SIZE = 10;
RANGED_SECTORS_HORIZONTAL = 4;
RANGED_SECTORS_VERTICAL = 4;
RANGED_SECTORS_HORIZONTAL_SUB_1 = RANGED_SECTORS_HORIZONTAL - 1;
RANGED_INVERSE_SECTORS_HORIZONTAL = 1 / RANGED_SECTORS_HORIZONTAL;
RANGED_INVERSE_SECTORS_VERTICAL = 1 / RANGED_SECTORS_VERTICAL;
RANGED_INVERSE_SECTOR_HORIZONTAL_SIZE = 1 / (PLAYABLE_WIDTH / RANGED_SECTORS_HORIZONTAL);
RANGED_INVERSE_SECTOR_VERTICAL_SIZE = 1 / (PLAYABLE_HEIGHT / RANGED_SECTORS_VERTICAL);
RANGED_INVERSE_SECTOR_WIDTH = RANGED_SECTORS_HORIZONTAL / PLAYABLE_WIDTH;
RANGED_INVERSE_SECTOR_HEIGHT = RANGED_SECTORS_VERTICAL / PLAYABLE_HEIGHT;
RANGED_TOTAL_SECTORS = RANGED_SECTORS_HORIZONTAL * RANGED_SECTORS_VERTICAL;
RANGED_BOTTOM_LEFT_INDEX = RANGED_TOTAL_SECTORS - RANGED_SECTORS_HORIZONTAL;
RANGED_BOTTOM_RIGHT_INDEX = RANGED_TOTAL_SECTORS - 1;
SECTORS_HORIZONTAL = 10;
SECTORS_VERTICAL = 10;
SECTORS_HORIZONTAL_SUB_1 = SECTORS_HORIZONTAL - 1;
INVERSE_SECTORS_HORIZONTAL = 1 / SECTORS_HORIZONTAL;
INVERSE_SECTORS_VERTICAL = 1 / SECTORS_VERTICAL;
INVERSE_SECTOR_HORIZONTAL_SIZE = 1 / (PLAYABLE_WIDTH / SECTORS_HORIZONTAL);
INVERSE_SECTOR_VERTICAL_SIZE = 1 / (PLAYABLE_HEIGHT / SECTORS_VERTICAL);
INVERSE_SECTOR_WIDTH = SECTORS_HORIZONTAL / PLAYABLE_WIDTH;
INVERSE_SECTOR_HEIGHT = SECTORS_VERTICAL / PLAYABLE_HEIGHT;
TOTAL_SECTORS = SECTORS_HORIZONTAL * SECTORS_VERTICAL;
BOTTOM_LEFT_INDEX = TOTAL_SECTORS - SECTORS_HORIZONTAL;
BOTTOM_RIGHT_INDEX = TOTAL_SECTORS - 1;
POPUP_COUNTDOWN = int((fps * 10) / 100);
IDLE = 0;
BUILD = 1;
UPGRADE = 2;
SELECT = 3;
DIALOG = 4;
COUNTDOWN = 5;
RELEASING = 6;
ACTION = 7;
MSS_IDLE = 0;
MSS_FIRING = 1;
LEVEL_PRE_DIALOG = 0;
LEVEL_PRE_ANIM = 1;
INGAME_PRE_DIALOG = 2;
INGAME_PLAYING = 3;
INGAME_POST_DIALOG = 4;
LEVEL_POST_ANIM = 5;
LEVEL_POST_DIALOG = 6;
START_GAME = 7;
GAME_OVER = 8;
initInput();
soundOn = true;
displayRangeOn = false;
currentLevel = createCurrentLevelHolder();
currentDialog = _root.attachMovie("Variable", "CurrentDialog", depth--);
initLevels();
initMainShip();
createPopupInfo();
createMouseCursors();
createOnHitUpgradeButtons();
createOptionsButtons();
createResultPostMenu();
createPostScoreMenu();
createPlayAgainMenu();
createErrorPopup();
createStatsMenu();
createActionBarOptions();
createActionBar();
createQuickInfo();
createBuildQuickInfo();
createSkipDialog();
createPresenterIcons();
createHitFlash();
createDialogGroup();
initListsAndGameSprites();
createMainMenu();
initSounds();
if (GameBuild == false) {
_root.gotoAndStop("ViewHighScores");
} else {
_root.gotoAndStop("PlayGame");
}
}
function initMainShip() {
mainShip = _root.attachMovie("ShipSprite", "MainShip", depth--);
mainShipTarget = _root.attachMovie("Variable", "mainShipTarget", depth--);
mainShipTarget._x = 100;
mainShipTarget._y = 0;
mainShip._x = (PLAYABLE_WIDTH * 0.5) + (mainShip._width * 0.5);
mainShip._y = OFFSCREEN_Y;
mainShip.mass = 1;
mainShip.moved = false;
mainShip.gameState = MSS_IDLE;
mainShip.objectType = OBJ_MAIN_SHIP;
initCollider(mainShip);
mainShip.onPress = function () {
selectObject(this);
};
mainShip.createProjectile = createLaserBeam;
mainShip.doAction = function () {
if (this.energy >= 100) {
this.fireLaserBeam(_root._xmouse, _root._ymouse);
selectObject(mainShip);
}
};
mainShip.boostProbes = function () {
this.energy = this.energy - 45;
playBatteryProbeSound();
oefi = 0;
while (oefi < MAX_PROBES) {
if (probes.objects[oefi] != -1) {
probes.objects[oefi].hp = probes.objects[oefi].hpMax;
probes.objects[oefi].gameState = PS_IDLE;
probes.objects[oefi].gotoAndStop("f0");
probes.rechargeCounter = 0;
}
oefi++;
}
};
mainShip.fireLaserBeam = function (xTarg, yTarg) {
this.energy = this.energy - 100;
playLaserBeamSound();
this.shotsFired = 0;
mainShipTarget._x = xTarg;
mainShipTarget._y = yTarg;
connectLaserBeam._x = this._x;
connectLaserBeam.tmpDx = mainShipTarget._x - connectLaserBeam._x;
connectLaserBeam.tmpDy = mainShipTarget._y - connectLaserBeam._y;
normalizeTmp(connectLaserBeam, connectLaserBeam);
if (connectLaserBeam.tmpDx < 0) {
connectLaserBeam._rotation = Math.acos(connectLaserBeam.tmpDy) * RAD_TO_DEG;
} else {
connectLaserBeam._rotation = -(Math.acos(connectLaserBeam.tmpDy) * RAD_TO_DEG);
}
};
mainShip.protect = function () {
this.energy = this.energy - 50;
playRepulsorBurstSound();
fireDeflectBurst(this, 0, 10, this.onHit2K, this.onHit2Range);
};
mainShip.stasisBurst = function () {
this.energy = this.energy - 50;
playStasisProbeSound();
createFrostBurst(this, 0, 10, this.onHit3K, this.onHit3Range, this.slowEffect, this.coldTime);
};
mainShip.update = function () {
if (this.shotCooldownTimer > 0) {
this.shotCooldownTimer--;
}
if (this.shotCooldownTimer <= 0) {
if (this.shotsFired < this.shotsPerReload) {
this.readyToFire = true;
}
}
this.addEnergy(this.energyRegen);
mainShip.fireShot();
};
mainShip.addEnergy = function (energyAmt) {
this.energy = this.energy + energyAmt;
if (this.energy > this.energyMax) {
this.energy = this.energyMax;
}
};
mainShip.fireShot = function () {
if (this.readyToFire == true) {
this.shotCooldownTimer = this.shotCooldown;
this.readyToFire = false;
if ((this.shotsFired++) == 0) {
return(this.createProjectile(this, this.gameTarget, true));
}
if (this.shotsFired == this.shotsPerReload) {
connectLaserBeam._x = OFFSCREEN_X;
}
return(this.createProjectile(this, this.gameTarget, false));
}
return(-1);
};
}
function createCurrentLevelHolder() {
currentLevelHolder = _root.attachMovie("Variable", "CurrentLevelHolder", depth--);
currentLevelHolder.dialogIndex = 0;
currentLevelHolder.sameLevelKills = 0;
currentLevelHolder.totalLevelKills = 0;
currentLevelHolder.framesElapsed = 0;
currentLevelHolder.finishLevelType = -1;
currentLevelHolder.finishLevelKills = -1;
currentLevelHolder.finishLevelFrames = -1;
currentLevelHolder.moneyBonus = 0;
currentLevelHolder.levelPreDialogs = new Array();
currentLevelHolder.gamePreDialogs = new Array();
currentLevelHolder.gameInterruptDialogs = new Array();
currentLevelHolder.gamePostDialogs = new Array();
currentLevelHolder.levelPostDialogs = new Array();
currentLevelHolder.killTriggers = new Array();
currentLevelHolder.triggerDialogs = new Array();
currentLevelHolder.enemies = new Array();
j = 0;
while (j < 10) {
currentLevelHolder.levelPreDialogs[j] = _root.attachMovie("Variable", "CLHlpred" + j, depth--);
currentLevelHolder.gamePreDialogs[j] = _root.attachMovie("Variable", "CLHgpred" + j, depth--);
currentLevelHolder.gameInterruptDialogs[j] = _root.attachMovie("Variable", "CLHgid" + j, depth--);
currentLevelHolder.gamePostDialogs[j] = _root.attachMovie("Variable", "CLHgpostd" + j, depth--);
currentLevelHolder.levelPostDialogs[j] = _root.attachMovie("Variable", "CLHlpostd" + j, depth--);
currentLevelHolder.triggerDialogs[j] = _root.attachMovie("Variable", "CLHtriggerd" + j, depth--);
currentLevelHolder.killTriggers[j] = _root.attachMovie("Variable", "CLHkillTriggers" + j, depth--);
j++;
}
j = 0;
while (j < 5) {
currentLevelHolder.enemies[j] = _root.attachMovie("Variable", "CLHE" + j, depth--);
j++;
}
return(currentLevelHolder);
}
function initListsAndGameSprites() {
probes = createTypelessGroup("Probes", "ProbeSprite", MAX_PROBES);
probeDepth = depth;
depth = depth - MAX_PROBES;
rangeRadiusDisplays = new Array();
i = 0;
while (i < MAX_PROBES) {
rangeRadiusDisplays[i] = _root.attachMovie("RangeRadiusSprite", "RangeRadius" + i, depth--);
rangeRadiusDisplays[i]._x = OFFSCREEN_X;
i++;
}
laserHits = createGroup("LaserHits", "LaserHitMC", "LaserHits", MAX_EFFECTS);
purpleAsteroids = createGroup("PurpleAsteroids", "PurpleAsteroidSprite", "PurpleAsteroid", MAX_ENEMIES);
yellowAsteroids = createGroup("YellowAsteroids", "YellowAsteroid1MC", "YellowAsteroid", MAX_ENEMIES);
grayAsteroids = createGroup("GrayAsteroids", "GrayAsteroid1MC", "GrayAsteroids", MAX_ENEMIES);
redAsteroids = createGroup("RedAsteroids", "RedAsteroid1MC", "RedAsteroids", MAX_ENEMIES);
greenAsteroids = createGroup("GreenAsteroids", "GreenAsteroid1MC", "GreenAsteroids", MAX_ENEMIES);
exploderAsteroids = createGroup("ExploderAsteroids", "ExploderAsteroid1MC", "ExploderAsteroids", MAX_ENEMIES);
pinkAsteroids = createGroup("PinkAsteroids", "PinkAsteroid1MC", "PinkAsteroids", MAX_ENEMIES);
planetAsteroids = createGroup("PlanetAsteroids", "PlanetAsteroid1MC", "PlanetAsteroid", 1);
airFleets = createGroup("AirFleet", "AirFleetMC", "AirFleet", 15);
bombBots = createGroup("BombBots", "KillBotMC", "BombBots", MAX_ENEMIES);
commando = createGroup("Commando", "CommandoShipMC", "Commando", 1);
splitters = createGroup("Splitters", "SplitterMC", "Splitters", MAX_ENEMIES);
missiles = createGroup("Missiles", "MissileMC", "Missiles", MAX_PROJECTILES);
repulsorBlasts = createGroup("RepulsionBlasts", "RepulsionBallSprite", "RepulsionBlasts", MAX_PROJECTILES);
pblasts = createGroup("ParticleBlasts", "PelletMC", "ParticleBlasts", MAX_PROJECTILES);
stasisBeams = createGroup("StasisBeams", "StasisBeamMC", "StasisBeams", MAX_PROJECTILES);
laserBeams = createGroup("LaserBeams", "LaserBeamMC", "LaserBeams", MAX_PROJECTILES);
connectLaserBeam = _root.attachMovie("LaserBeamMC", "LaserBeam", depth--);
connectLaserBeam.gotoAndStop("f1");
connectLaserBeam._x = OFFSCREEN_X;
connectLaserBeam._y = mainShip._y;
pelletDeaths = createGroup("PelletDeaths", "PelletDeathMC", "PelletDeaths", MAX_EFFECTS);
meteorDeaths = createGroup("MeteorDeaths", "MeteorDeathMC", "MeteorDeaths", MAX_EFFECTS);
stasisBursts = createGroup("StasisBursts", "StasisExplosionMC", "StasisBursts", MAX_EFFECTS);
deflectBursts = createGroup("DeflectBursts", "DeflectExplosionMC", "DeflectBursts", MAX_EFFECTS);
heatBursts = createGroup("HeatBursts", "HeatShieldMC", "HeatBursts", MAX_EFFECTS);
explosionBursts = createRotatingGroup("ExplosionBursts", "Explosion", "ExplosionBursts", MAX_EFFECTS, 3);
heartBursts = createGroup("HeartBursts", "HeartExplosionMC", "HeartBursts", MAX_EFFECTS);
effects = createTypelessGroup("Effects", "Effects", MAX_EFFECTS);
effectsDepth = depth;
depth = depth - MAX_EFFECTS;
projectiles = createTypelessGroup("Projectiles", "ProjectileSprite", MAX_PROJECTILES);
projectileDepth = depth;
depth = depth - MAX_PROJECTILES;
enemyList = createTypelessGroup("EnemyList", "EnemyList", MAX_ENEMIES);
enemyListDepth = depth;
depth = depth - MAX_ENEMIES;
initCollisionGroups();
i = 0;
while (i < MAX_ENEMIES) {
initCollider(purpleAsteroids.objects[i]);
initPurpleAsteroid(purpleAsteroids.objects[i]);
initCollider(yellowAsteroids.objects[i]);
initYellowAsteroid(yellowAsteroids.objects[i]);
initCollider(grayAsteroids.objects[i]);
initGrayAsteroid(grayAsteroids.objects[i]);
initCollider(redAsteroids.objects[i]);
initRedAsteroid(redAsteroids.objects[i]);
initCollider(greenAsteroids.objects[i]);
initGreenAsteroid(greenAsteroids.objects[i]);
initCollider(exploderAsteroids.objects[i]);
initExploderAsteroid(exploderAsteroids.objects[i]);
initCollider(pinkAsteroids.objects[i]);
initPinkAsteroid(pinkAsteroids.objects[i]);
initCollider(marcherAsteroids.objects[i]);
initMarcherAsteroid(marcherAsteroids.objects[i]);
initSmartUnit(marcherAsteroids.objects[i]);
initCollider(airFleets.objects[i]);
initAirFleet(airFleets.objects[i]);
initSmartUnit(airFleets.objects[i]);
initCollider(bombBots.objects[i]);
initBombBot(bombBots.objects[i]);
initSmartUnit(bombBots.objects[i]);
initCollider(splitters.objects[i]);
initSplitter(splitters.objects[i]);
i++;
}
initCollider(commando.objects[0]);
initCommando(commando.objects[0]);
initSmartUnit(commando.objects[0]);
initCollider(planetAsteroids.objects[0]);
initPlanetAsteroid(planetAsteroids.objects[0]);
planetCollisionGroup[0].addObject(planetAsteroids.objects[0]);
i = 0;
while (i < MAX_PROJECTILES) {
initCollider(missiles.objects[i]);
initCollider(repulsorBlasts.objects[i]);
initCollider(pblasts.objects[i]);
initCollider(stasisBeams.objects[i]);
initCollider(laserBeams.objects[i]);
i++;
}
i = 0;
while (i < MAX_EFFECTS) {
initPelletDeath(pelletDeaths.objects[i]);
initMeteorDeath(meteorDeaths.objects[i]);
initStasisBurst(stasisBursts.objects[i]);
initDeflectBurst(deflectBursts.objects[i]);
initHeatBurst(heatBursts.objects[i]);
initExplosionBurst(explosionBursts.objects[i]);
initHeartBurst(heartBursts.objects[i]);
initLaserHit(laserHits.objects[i]);
i++;
}
}
function initCollisionGroups() {
ecgBuffer = 0;
enemyCollisionGroups = new Array();
enemyCollisionGroups2 = new Array();
probeCollisionGroups = new Array();
rangedEnemyCollisionGroups = new Array();
rangedEnemyCollisionGroups2 = new Array();
rangedProbeCollisionGroups = new Array();
icg = 0;
while (icg < TOTAL_SECTORS) {
enemyCollisionGroups[icg] = createGrouping("EnemyCollisionGroup" + icg, MAX_ENEMY_GROUP_SIZE);
enemyCollisionGroups2[icg] = createGrouping("EnemyCollisionGroup2" + icg, MAX_ENEMY_GROUP_SIZE);
probeCollisionGroups[icg] = createGrouping("ProbeCollisionGroup" + icg, MAX_PROBE_GROUP_SIZE);
icg++;
}
icg = 0;
while (icg < RANGED_TOTAL_SECTORS) {
rangedEnemyCollisionGroups[icg] = createGrouping("RangedEnemyCollisionGroup" + icg, MAX_ENEMY_GROUP_SIZE);
rangedEnemyCollisionGroups2[icg] = createGrouping("RangedEnemyCollisionGroup2" + icg, MAX_ENEMY_GROUP_SIZE);
rangedProbeCollisionGroups[icg] = createGrouping("RangedProbeCollisionGroup" + icg, MAX_PROBE_GROUP_SIZE);
icg++;
}
sharedCollisionGroups = createGrouping("CollisionGroupsSV", TOTAL_SECTORS);
enemyCollisionGroupList = createGrouping("CollisionGroupsSV", TOTAL_SECTORS);
sharedBurstCGs = createGrouping("CollisionGroupsFB", TOTAL_SECTORS);
planetCollisionGroup = new Array();
planetCollisionGroup[0] = createGrouping("PlanetCollisionGroup", 1);
}
init();
Frame 54
function init() {
reinitListsAndGameSprites();
mainShip._y = OFFSCREEN_Y;
hideOptionsMenu();
optionsButton._x = OFFSCREEN_X;
optionsButton.gotoAndStop("f0");
optionsButton.toggled = false;
hideRangeDisplay();
buildingRange._x = OFFSCREEN_X;
MochiAd.showPreGameAd({id:"2972325a4f038aa7", res:"640x640"});
}
init();
Frame 55
function init() {
if (_root.licensed != true) {
_root.gotoAndStop("NoLicense");
}
optionsButton._x = 0;
FINAL_LEVEL_NUM = 32;
gamePaused = false;
hitsLeft = 20;
HitsLeft = hitsLeft;
userState = IDLE;
gameState = START_GAME;
levelState = DIALOG;
levelNumber = 0;
controlUsed = 0;
MaxControl = "/" + MAX_CONTROL;
score = 0;
money = 1500;
ScoreField = score;
ControlField.text = controlUsed;
MoneyField.text = money;
currentLevelHolder.moneyBonus = 0;
currentDialog.ttl = 0;
dialogIndex = 0;
countDownTimer = 0;
spawnCounter = 0;
releaseCounter = 0;
selectedObject = -1;
popupInfo = -1;
popupCountdown = fps * 0.25;
buildingRange._x = OFFSCREEN_X;
initBuildButtons();
reinitListsAndGameSprites();
reinitMainShip();
createBackground();
goNextLevel();
goNextGameState();
}
function reinitListsAndGameSprites() {
i = 0;
while (i < MAX_ENEMIES) {
if (enemyList.objects[i] != -1) {
if (enemyList.objects[i].type == SPLITTER) {
enemyList.objects[i].killObjectDontSpawn();
} else {
enemyList.objects[i].killObject();
}
}
i++;
}
enemyList.killAllDontRemove();
i = 0;
while (i < MAX_PROJECTILES) {
if (projectiles.objects[i] != -1) {
projectiles.objects[i].killObject();
}
i++;
}
projectiles.killAllDontRemove();
i = 0;
while (i < MAX_EFFECTS) {
if (effects.objects[i] != -1) {
effects.objects[i].killObject();
}
i++;
}
effects.killAllDontRemove();
probes.killAll();
hidePlayAgainMenu();
}
function reinitMainShip() {
mainShip._y = PLAYABLE_HEIGHT - (mainShip._height * 2);
connectLaserBeam._y = mainShip._y;
mainShip.energy = 150;
mainShip.energyRegen = 1 / (3 * fps);
mainShip.energyMax = 300;
mainShip.shotsPerReload = 10;
mainShip.shotCooldown = 1;
mainShip.shotCooldownTimer = 0;
mainShip.shotsFired = mainShip.shotsPerReload + 1;
mainShip.gameTarget = mainShipTarget;
mainShip.readyToFire = false;
mainShip.power = 50;
mainShip.projTTL = 50;
mainShip.projTerminalVelocity = 40;
mainShip.projTerminalVelocitySq = mainShip.projTerminalVelocity * mainShip.projTerminalVelocity;
mainShip.projMass = 1;
mainShip.projSpeed = 30;
mainShip.projK = 0.5;
mainShip.killCount = 0;
mainShip.upgradeLevel = 1;
mainShip.onHit1Level = 3;
mainShip.onHit2Level = 1;
mainShip.onHit3Level = 1;
mainShip.slowEffect = 0.8;
mainShip.coldTime = 4;
mainShip.onHit1Power = 0;
mainShip.onHit1Range = 300;
mainShip.onHit1K = 1;
mainShip.onHit2Power = 0;
mainShip.onHit2Range = 300;
mainShip.onHit2K = 15;
mainShip.onHit3Power = 0;
mainShip.onHit3Range = 300;
mainShip.onHit3K = 1;
mainShip.collisionGroupIndex = getCollisionGroupIndex(mainShip);
}
function onMouseDown() {
if (userState == BUILD) {
if (canBuildAt()) {
if (hasEnoughMoney()) {
if (hasEnoughControl() && (probes.getNextIndex() != -1)) {
controlUsed = controlUsed + build.controlNeeded;
money = money - build.cost;
ControlField.text = controlUsed;
MoneyField.text = money;
buildingRange._x = OFFSCREEN_X;
userState = SELECT;
if (buildProbeType == REPULSOR_PROBE) {
builtProbe = buildRepulsorProbe(_root._xmouse, _root._ymouse);
} else if (buildProbeType == ROCKET_PROBE) {
builtProbe = buildRocketProbe(_root._xmouse, _root._ymouse);
} else if (buildProbeType == BOMB_PROBE) {
builtProbe = buildBombProbe(_root._xmouse, _root._ymouse);
} else if (buildProbeType == PB_PROBE) {
builtProbe = buildPBProbe(_root._xmouse, _root._ymouse);
} else if (buildProbeType == STASIS_PROBE) {
builtProbe = buildStasisProbe(_root._xmouse, _root._ymouse);
} else if (buildProbeType == DECOY_PROBE) {
builtProbe = buildDecoyProbe(_root._xmouse, _root._ymouse);
} else if (buildProbeType == BATTERY_PROBE) {
builtProbe = buildBatteryProbe(_root._xmouse, _root._ymouse);
} else if (buildProbeType == WALL_PROBE) {
builtProbe = buildWallProbe(_root._xmouse, _root._ymouse);
}
if (probes.addObject(builtProbe) != -1) {
}
build._x = build.origX;
build._y = build.origY;
build.gotoAndStop("f0");
} else {
displayError("Cannot build, not enough control");
}
} else {
displayError("Cannot build, not enough funds");
}
} else {
displayError("Cannot build, another probe is there.");
}
}
}
function onMouseDownExtended() {
if (userState == ACTION) {
userState = SELECT;
actionObject.doAction();
changeMouseCursor(normalCursor);
}
}
function goNextLevel() {
money = money + currentLevel.moneyBonus;
MoneyField.text = money;
score = score + (1000 * levelNumber);
ScoreField = score;
copyLevel(gameLevels.levels[levelNumber], currentLevel);
levelNumber++;
LevelNumber = levelNumber;
currentLevel.sameLevelKills = 0;
currentLevel.totalLevelKills = 0;
currentLevel.framesElapsed = 0;
currentLevel.dialogIndex = 0;
currentLevel.firstKill = false;
if (levelNumber > 12) {
_root.kongregateScores.submit(score);
}
}
function spawnEnemy() {
releaseCounter--;
if ((releaseCounter <= 0) && (enemyList.getNextIndex() > -1)) {
releaseCounter = currentLevel.releaseSpeed;
if (currentLevel.enemyReleaseStrategy == ERS_IN_ORDER) {
if (currentLevel.enemies[0].amount > 0) {
if (spawn(currentLevel.enemies[0]) != -1) {
currentLevel.enemies[0].amount--;
currentLevel.totalNumEnemies--;
}
} else if (currentLevel.enemies[1].amount > 0) {
if (spawn(currentLevel.enemies[1]) != -1) {
currentLevel.enemies[1].amount--;
currentLevel.totalNumEnemies--;
}
} else if (currentLevel.enemies[2].amount > 0) {
if (spawn(currentLevel.enemies[2]) != -1) {
currentLevel.enemies[2].amount--;
currentLevel.totalNumEnemies--;
}
} else if (currentLevel.enemies[3].amount > 0) {
if (spawn(currentLevel.enemies[3]) != -1) {
currentLevel.enemies[3].amount--;
currentLevel.totalNumEnemies--;
}
} else if (currentLevel.enemies[4].amount > 0) {
if (spawn(currentLevel.enemies[4]) != -1) {
currentLevel.enemies[4].amount--;
currentLevel.totalNumEnemies--;
}
}
} else if (currentLevel.enemyReleaseStrategy == ERS_RANDOM) {
} else if (currentLevel.enemyReleaseStrategy == ERS_SPORADIC) {
randomNum = int(Math.random() * currentLevel.totalEnemyTypes);
if (currentLevel.enemies[randomNum].amount > 0) {
if (spawn(currentLevel.enemies[randomNum]) != -1) {
currentLevel.enemies[randomNum].amount--;
currentLevel.totalNumEnemies--;
} else if (currentLevel.enemies[0].amount > 0) {
if (spawn(currentLevel.enemies[0]) != -1) {
currentLevel.enemies[0].amount--;
currentLevel.totalNumEnemies--;
}
} else if (currentLevel.enemies[1].amount > 0) {
if (spawn(currentLevel.enemies[1]) != -1) {
currentLevel.enemies[1].amount--;
currentLevel.totalNumEnemies--;
}
} else if (currentLevel.enemies[2].amount > 0) {
if (spawn(currentLevel.enemies[2]) != -1) {
currentLevel.enemies[2].amount--;
currentLevel.totalNumEnemies--;
}
} else if (currentLevel.enemies[3].amount > 0) {
if (spawn(currentLevel.enemies[3]) != -1) {
currentLevel.enemies[3].amount--;
currentLevel.totalNumEnemies--;
}
} else if (currentLevel.enemies[4].amount > 0) {
if (spawn(currentLevel.enemies[4]) != -1) {
currentLevel.enemies[4].amount--;
currentLevel.totalNumEnemies--;
}
}
}
} else if (currentLevel.enemyReleaseStrategy == ERS_INVADERS) {
}
}
}
function spawn(enemy) {
if (enemyList.getNextIndex != -1) {
newEnemy = -1;
if (enemy.type == PURPLE_ASTEROID) {
newEnemy = purpleAsteroids.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
}
} else if (enemy.type == YELLOW_ASTEROID) {
newEnemy = yellowAsteroids.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
}
} else if (enemy.type == RED_ASTEROID) {
newEnemy = redAsteroids.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
}
} else if (enemy.type == GRAY_ASTEROID) {
newEnemy = grayAsteroids.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
}
} else if (enemy.type == GREEN_ASTEROID) {
newEnemy = greenAsteroids.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
}
} else if (enemy.type == SPLITTER) {
newEnemy = splitters.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
}
} else if (enemy.type == EXPLODER_ASTEROID) {
newEnemy = exploderAsteroids.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
}
} else if (enemy.type == PINK_ASTEROID) {
newEnemy = pinkAsteroids.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
}
} else if (enemy.type == AIR_FLEET) {
newEnemy = airFleets.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
if (enemy.instructionSet == INS_SET_AIR_FLEET_MARCH) {
airFleetMarchInstructions(newEnemy);
}
}
} else if (enemy.type == BOMB_BOT) {
newEnemy = bombBots.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
if (enemy.instructionSet == INS_SET_BOMB_BOT_MARCH) {
bombBotMarchInstructions(newEnemy);
}
if (enemy.instructionSet == INS_SET_BOMB_BOT_MARCH_2) {
bombBot2MarchInstructions(newEnemy);
}
}
} else if (enemy.type == COMMANDO) {
newEnemy = commando.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
if (enemy.instructionSet == INS_SET_COMMANDO_MARCH) {
commandoMarchInstructions(newEnemy);
}
}
} else if (enemy.type == PLANET_ASTEROID) {
newEnemy = planetAsteroids.getNext();
if (newEnemy != -1) {
reInitAsteroid(newEnemy, enemy.speed, enemy.k, enemy.mass, enemy.hp, enemy.power);
newEnemy.hpPercentage = (newEnemy.hp / newEnemy.hpMax) * 1000;
newEnemy._xscale = newEnemy.hpPercentage;
newEnemy._yscale = newEnemy.hpPercentage;
newEnemy.cRadius = newEnemy._height * 0.5;
}
}
if (newEnemy != -1) {
if (enemy.type == PLANET_ASTEROID) {
newEnemy._x = Stage.width * 0.5;
newEnemy._y = -(newEnemy.cRadius + 25);
} else {
setSpawnLocation(newEnemy, enemy.releasePoint);
}
newEnemy.levelNum = levelNumber;
enemyList.addObject(newEnemy);
return(newEnemy);
}
}
return(-1);
}
function setSpawnLocation(object, releasePoint) {
if (releasePoint == ERP_ANY) {
releaseAngle = Math.random() * 360;
} else if (releasePoint == ERP_LEFT_SIDE) {
releaseAngle = -45 + (Math.random() * 90);
} else if (releasePoint == ERP_RIGHT_SIDE) {
releaseAngle = 135 + (Math.random() * 90);
} else if (releasePoint == ERP_BOTTOM) {
releaseAngle = 225 + (Math.random() * 90);
} else if (releasePoint == ERP_TOP) {
releaseAngle = 60 + (Math.random() * 60);
} else if (releasePoint == ERP_SPECIAL1) {
releaseAngle = 85 + (Math.random() * 10);
} else if (releasePoint == ERP_CIRCULAR) {
releaseAngle = currentLevel.currentReleaseAngle;
currentLevel.currentReleaseAngle = currentLevel.currentReleaseAngle + currentLevel.releaseAngleIncrement;
if (currentLevel.currentReleaseAngle > 360) {
currentLevel.currentReleaseAngle = currentLevel.currentReleaseAngle - 360;
}
} else if (releasePoint == ERP_TOP_CIRCULAR) {
releaseAngle = currentLevel.currentReleaseAngle;
currentLevel.currentReleaseAngle = currentLevel.currentReleaseAngle + currentLevel.releaseAngleIncrement;
if (currentLevel.currentReleaseAngle > 120) {
currentLevel.currentReleaseAngle = 120;
currentLevel.releaseAngleIncrement = -currentLevel.releaseAngleIncrement;
} else if (currentLevel.currentReleaseAngle < 60) {
currentLevel.currentReleaseAngle = 60;
currentLevel.releaseAngleIncrement = -currentLevel.releaseAngleIncrement;
}
}
if (releasePoint == ERP_TOP_SHEET) {
currentLevel.currentReleaseAngle = currentLevel.currentReleaseAngle + currentLevel.releaseAngleIncrement;
if (currentLevel.currentReleaseAngle > (Stage.width - 32)) {
currentLevel.currentReleaseAngle = 32;
}
object._x = currentLevel.currentReleaseAngle;
object._y = mainShip._y - OUTSIDE_RADIUS;
} else {
object._x = mainShip._x - (Math.cos(releaseAngle * DEG_TO_RAD) * OUTSIDE_RADIUS);
object._y = mainShip._y - (Math.sin(releaseAngle * DEG_TO_RAD) * OUTSIDE_RADIUS);
}
}
function getCollisionGroupIndex(object) {
if ((object._x > PLAYABLE_WIDTH) || (object._x < 0)) {
return(0);
}
if ((object._y > PLAYABLE_HEIGHT) || (object._y < 0)) {
return(0);
}
secX = int(object._x * INVERSE_SECTOR_WIDTH);
secY = int(object._y * INVERSE_SECTOR_HEIGHT);
return((secY * SECTORS_HORIZONTAL) + secX);
}
function getRangedCollisionGroupIndex(object) {
if ((object._x > PLAYABLE_WIDTH) || (object._x < 0)) {
return(0);
}
if ((object._y > PLAYABLE_HEIGHT) || (object._y < 0)) {
return(0);
}
secX = int(object._x * RANGED_INVERSE_SECTOR_WIDTH);
secY = int(object._y * RANGED_INVERSE_SECTOR_HEIGHT);
return((secY * RANGED_SECTORS_HORIZONTAL) + secX);
}
function getRangedCollisionGroupIndexTest(object) {
if ((object._x > PLAYABLE_WIDTH) || (object._x < 0)) {
return(0);
}
if ((object._y > PLAYABLE_HEIGHT) || (object._y < 0)) {
return(0);
}
secX = Math.floor(object._x * RANGED_INVERSE_SECTOR_WIDTH);
secY = Math.floor(object._y * RANGED_INVERSE_SECTOR_HEIGHT);
return((secY * RANGED_SECTORS_HORIZONTAL) + secX);
}
function loadRangeOfProbeCollisionGroups(cgIndex, radius, sharedCGs) {
sharedCGs.clearAll();
sectorSpanHorizontal = Math.ceil(radius * RANGED_INVERSE_SECTOR_HORIZONTAL_SIZE);
sectorSpanVertical = sectorSpanHorizontal;
sectorSpanRows = sectorSpanVertical * RANGED_SECTORS_HORIZONTAL;
cgIndexBottomRow = cgIndex + sectorSpanRows;
cgIndexTopRow = cgIndex - sectorSpanRows;
indexRow = int(cgIndexTopRow * RANGED_INVERSE_SECTORS_HORIZONTAL);
i = cgIndexTopRow;
while (i <= cgIndexBottomRow) {
if ((i >= 0) && (i < RANGED_TOTAL_SECTORS)) {
endIndex = i + sectorSpanHorizontal;
j = i - sectorSpanHorizontal;
while (j <= endIndex) {
thisRow = int(j * RANGED_INVERSE_SECTORS_HORIZONTAL);
if (thisRow == indexRow) {
if ((j >= 0) && (j < RANGED_TOTAL_SECTORS)) {
sharedCGs.addObject(rangedProbeCollisionGroups[j]);
}
}
j++;
}
}
indexRow = indexRow + 1;
i = i + RANGED_SECTORS_HORIZONTAL;
}
}
function loadEnemyCollisionGroups(cgIndex, sharedCGs) {
sharedCGs.clearAll();
cgIndexTopRow = cgIndex - SECTORS_HORIZONTAL;
cgIndexBottomRow = cgIndex - SECTORS_VERTICAL;
if (levelNumber == FINAL_LEVEL_NUM) {
sharedCGs.addObject(planetCollisionGroup[0]);
}
ecg = enemyCollisionGroups;
if (cgIndex < SECTORS_HORIZONTAL) {
if (cgIndex == 0) {
sharedCGs.addObject(ecg[cgIndex]);
sharedCGs.addObject(ecg[cgIndex + 1]);
sharedCGs.addObject(ecg[cgIndexBottomRow]);
sharedCGs.addObject(ecg[cgIndexBottomRow + 1]);
} else if (cgIndex == SECTORS_HORIZONTAL_SUB_1) {
sharedCGs.addObject(ecg[cgIndex - 1]);
sharedCGs.addObject(ecg[cgIndex]);
sharedCGs.addObject(ecg[cgIndexBottomRow - 1]);
sharedCGs.addObject(ecg[cgIndexBottomRow]);
} else {
sharedCGs.addObject(ecg[cgIndex - 1]);
sharedCGs.addObject(ecg[cgIndex]);
sharedCGs.addObject(ecg[cgIndex + 1]);
sharedCGs.addObject(ecg[cgIndexBottomRow - 1]);
sharedCGs.addObject(ecg[cgIndexBottomRow]);
sharedCGs.addObject(ecg[cgIndexBottomRow + 1]);
}
} else if (cgIndex >= BOTTOM_LEFT_INDEX) {
if (cgIndex == BOTTOM_LEFT_INDEX) {
sharedCGs.addObject(ecg[cgIndexTopRow]);
sharedCGs.addObject(ecg[cgIndexTopRow + 1]);
sharedCGs.addObject(ecg[cgIndex]);
sharedCGs.addObject(ecg[cgIndex + 1]);
} else if (cgIndex == BOTTOM_RIGHT_INDEX) {
sharedCGs.addObject(ecg[cgIndexTopRow - 1]);
sharedCGs.addObject(ecg[cgIndexTopRow]);
sharedCGs.addObject(ecg[cgIndex - 1]);
sharedCGs.addObject(ecg[cgIndex]);
} else {
sharedCGs.addObject(ecg[cgIndexTopRow - 1]);
sharedCGs.addObject(ecg[cgIndexTopRow]);
sharedCGs.addObject(ecg[cgIndexTopRow + 1]);
sharedCGs.addObject(ecg[cgIndex - 1]);
sharedCGs.addObject(ecg[cgIndex]);
sharedCGs.addObject(ecg[cgIndex + 1]);
}
} else if ((cgIndex % SECTORS_VERTICAL) == 0) {
sharedCGs.addObject(ecg[cgIndexTopRow]);
sharedCGs.addObject(ecg[cgIndexTopRow + 1]);
sharedCGs.addObject(ecg[cgIndex]);
sharedCGs.addObject(ecg[cgIndex + 1]);
sharedCGs.addObject(ecg[cgIndexBottomRow]);
sharedCGs.addObject(ecg[cgIndexBottomRow + 1]);
} else if ((cgIndex % SECTORS_HORIZONTAL) == 7) {
sharedCGs.addObject(ecg[cgIndexTopRow - 1]);
sharedCGs.addObject(ecg[cgIndexTopRow]);
sharedCGs.addObject(ecg[cgIndex - 1]);
sharedCGs.addObject(ecg[cgIndex]);
sharedCGs.addObject(ecg[cgIndexBottomRow - 1]);
sharedCGs.addObject(ecg[cgIndexBottomRow]);
} else {
sharedCGs.addObject(ecg[cgIndexTopRow - 1]);
sharedCGs.addObject(ecg[cgIndexTopRow]);
sharedCGs.addObject(ecg[cgIndexTopRow + 1]);
sharedCGs.addObject(ecg[cgIndex - 1]);
sharedCGs.addObject(ecg[cgIndex]);
sharedCGs.addObject(ecg[cgIndex + 1]);
sharedCGs.addObject(ecg[cgIndexBottomRow - 1]);
sharedCGs.addObject(ecg[cgIndexBottomRow]);
sharedCGs.addObject(ecg[cgIndexBottomRow + 1]);
}
}
function loadRangeOfEnemyCollisionGroups(cgIndex, radius, sharedCGs) {
sharedCGs.clearAll();
sectorSpanHorizontal = Math.ceil(radius * RANGED_INVERSE_SECTOR_HORIZONTAL_SIZE);
sectorSpanVertical = sectorSpanHorizontal;
sectorSpanRows = sectorSpanVertical * RANGED_SECTORS_HORIZONTAL;
cgIndexBottomRow = cgIndex + sectorSpanRows;
cgIndexTopRow = cgIndex - sectorSpanRows;
if (levelNumber == FINAL_LEVEL_NUM) {
sharedCGs.addObject(planetCollisionGroup[0]);
}
recg = rangedEnemyCollisionGroups;
indexRow = Math.floor(cgIndexTopRow * RANGED_INVERSE_SECTORS_HORIZONTAL);
i = cgIndexTopRow;
while (i <= cgIndexBottomRow) {
if ((i >= 0) && (i < RANGED_TOTAL_SECTORS)) {
endIndex = i + sectorSpanHorizontal;
j = i - sectorSpanHorizontal;
while (j <= endIndex) {
thisRow = Math.floor(j * RANGED_INVERSE_SECTORS_HORIZONTAL);
if (thisRow == indexRow) {
if ((j >= 0) && (j < RANGED_TOTAL_SECTORS)) {
sharedCGs.addObject(recg[j]);
}
}
j++;
}
}
indexRow = indexRow + 1;
i = i + RANGED_SECTORS_HORIZONTAL;
}
}
function loadPastRangeOfEnemyCollisionGroups(cgIndex, radius, sharedCGs) {
sharedCGs.clearAll();
sectorSpanHorizontal = Math.ceil(radius * RANGED_INVERSE_SECTOR_HORIZONTAL_SIZE);
sectorSpanVertical = sectorSpanHorizontal;
sectorSpanRows = sectorSpanVertical * RANGED_SECTORS_HORIZONTAL;
cgIndexBottomRow = cgIndex + sectorSpanRows;
cgIndexTopRow = cgIndex - sectorSpanRows;
recg = rangedEnemyCollisionGroups;
indexRow = Math.floor(cgIndexTopRow * RANGED_INVERSE_SECTORS_HORIZONTAL);
i = cgIndexTopRow;
while (i <= cgIndexBottomRow) {
if ((i >= 0) && (i < RANGED_TOTAL_SECTORS)) {
endIndex = i + sectorSpanHorizontal;
j = i - sectorSpanHorizontal;
while (j <= endIndex) {
thisRow = Math.floor(j * RANGED_INVERSE_SECTORS_HORIZONTAL);
if (thisRow == indexRow) {
if ((j >= 0) && (j < RANGED_TOTAL_SECTORS)) {
sharedCGs.addObject(recg[j]);
}
}
j++;
}
}
indexRow = indexRow + 1;
i = i + RANGED_SECTORS_HORIZONTAL;
}
}
function updateEffects() {
oefi = 0;
while (oefi < MAX_EFFECTS) {
if (effects.objects[oefi] != -1) {
effects.objects[oefi].step();
}
oefi++;
}
}
function updateEnemies() {
enemyList.allDead = true;
oefi = 0;
while (oefi < MAX_ENEMIES) {
if (enemyList.objects[oefi] != -1) {
if (enemyList.objects[oefi].hp < 1) {
enemyList.objects[oefi].lastDamager.killCount++;
killEnemy(enemyList.objects[oefi]);
} else {
enemyList.allDead = false;
}
}
oefi++;
}
lecg = 0;
while (lecg < TOTAL_SECTORS) {
enemyCollisionGroups[lecg].clearAll();
if (lecg < RANGED_TOTAL_SECTORS) {
rangedEnemyCollisionGroups[lecg].clearAll();
}
lecg++;
}
oefi = 0;
while (oefi < MAX_ENEMIES) {
if (enemyList.objects[oefi] != -1) {
enemyList.objects[oefi].step();
enemyList.objects[oefi].move();
enemyList.objects[oefi].collisionGroupIndex = getCollisionGroupIndex(enemyList.objects[oefi]);
enemyList.objects[oefi].rangedCollisionGroupIndex = getRangedCollisionGroupIndex(enemyList.objects[oefi]);
enemyCollisionGroups[enemyList.objects[oefi].collisionGroupIndex].addObject(enemyList.objects[oefi]);
rangedEnemyCollisionGroups[enemyList.objects[oefi].rangedCollisionGroupIndex].addObject(enemyList.objects[oefi]);
}
oefi++;
}
}
function updateProbes() {
lecg = 0;
while (lecg < TOTAL_SECTORS) {
probeCollisionGroups[lecg].clearAll();
if (lecg < RANGED_TOTAL_SECTORS) {
rangedProbeCollisionGroups[lecg].clearAll();
}
lecg++;
}
oefi = 0;
while (oefi < MAX_PROBES) {
if (probes.objects[oefi] != -1) {
probes.objects[oefi].step();
probes.objects[oefi].move();
if (displayRangeOn == true) {
rangeRadiusDisplays[oefi]._x = probes.objects[oefi]._x;
rangeRadiusDisplays[oefi]._y = probes.objects[oefi]._y;
rangeRadiusDisplays[oefi]._xscale = probes.objects[oefi].range;
rangeRadiusDisplays[oefi]._yscale = probes.objects[oefi].range;
}
if (probes.objects[oefi].beenHitCooldownTimer <= 0) {
probes.objects[oefi].collisionGroupIndex = getCollisionGroupIndex(probes.objects[oefi]);
probes.objects[oefi].rangedCollisionGroupIndex = getRangedCollisionGroupIndex(probes.objects[oefi]);
probeCollisionGroups[probes.objects[oefi].collisionGroupIndex].addObject(probes.objects[oefi]);
rangedProbeCollisionGroups[probes.objects[oefi].rangedCollisionGroupIndex].addObject(probes.objects[oefi]);
}
}
oefi++;
}
pc = 0;
while (pc < TOTAL_SECTORS) {
if (probeCollisionGroups[pc].objects[0] != -1) {
checkProbeCollisions(probeCollisionGroups[pc]);
}
pc++;
}
oefi = 0;
while (oefi < MAX_PROBES) {
if (probes.objects[oefi] != -1) {
tmpVar = 0;
if (probes.objects[oefi].probeType == BATTERY_PROBE) {
if ((probes.objects[oefi].readyToFire == true) && (probes.objects[oefi].checkForTargetCounter == 0)) {
if (probes.objects[oefi].gameState != PS_DISCHARGED) {
loadRangeOfProbeCollisionGroups(probes.objects[oefi].rangedCollisionGroupIndex, probes.objects[oefi].range, sharedCollisionGroups);
k = 0;
while (k < sharedCollisionGroups.maxSize) {
if (sharedCollisionGroups.objects[k] == -1) {
break;
}
cgTmp = sharedCollisionGroups.objects[k];
oefj = 0;
while (oefj < cgTmp.maxSize) {
if (cgTmp.objects[oefj] == -1) {
break;
}
if (probes.objects[oefi].inRange(cgTmp.objects[oefj])) {
tmpVar = tmpVar + probes.objects[oefi].affect(cgTmp.objects[oefj]);
}
oefj++;
}
k++;
}
}
if (tmpVar > 0) {
probes.objects[oefi].fireShot();
playBatteryProbeSound();
} else {
probes.objects[oefi].checkForTargetCounter = 10;
}
}
} else if (probes.objects[oefi].probeType == DECOY_PROBE) {
if ((probes.objects[oefi].readyToFire == true) && (probes.objects[oefi].checkForTargetCounter == 0)) {
if (probes.objects[oefi].gameState != PS_DISCHARGED) {
loadRangeOfEnemyCollisionGroups(probes.objects[oefi].rangedCollisionGroupIndex, probes.objects[oefi].range, sharedCollisionGroups);
k = 0;
while (k < sharedCollisionGroups.maxSize) {
if (sharedCollisionGroups.objects[k] == -1) {
break;
}
cgTmp = sharedCollisionGroups.objects[k];
oefj = 0;
while (oefj < cgTmp.maxSize) {
if (cgTmp.objects[oefj] == -1) {
break;
}
if (probes.objects[oefi].inRange(cgTmp.objects[oefj])) {
cgTmp.objects[oefj].gameTarget = probes.objects[oefi];
tmpVar = 1;
}
oefj++;
}
k++;
}
if (tmpVar > 0) {
probes.objects[oefi].fireShot();
} else {
probes.objects[oefi].checkForTargetCounter = 10;
}
}
}
} else if (probes.objects[oefi].probeType == WALL_PROBE) {
} else if ((probes.objects[oefi].readyToFire == true) && (probes.objects[oefi].checkForTargetCounter == 0)) {
if (probes.objects[oefi].hasTarget()) {
if (projectiles.getNextIndex() > -1) {
probes.objects[oefi].fireShot();
}
} else {
loadRangeOfEnemyCollisionGroups(probes.objects[oefi].rangedCollisionGroupIndex, probes.objects[oefi].range, enemyCollisionGroupList);
if (levelNumber == FINAL_LEVEL_NUM) {
oefi = 0;
while (oefi < MAX_PROBES) {
if (probes.objects[oefi] != -1) {
probes.objects[oefi].gameTarget = planetAsteroids.objects[0];
initProbeForFinalLevel(probes.objects[oefi]);
}
oefi++;
}
} else {
k = 0;
while (k < enemyCollisionGroupList.maxSize) {
if (enemyCollisionGroupList.objects[k] == -1) {
break;
}
cgTmp = enemyCollisionGroupList.objects[k];
oefj = 0;
while (oefj < cgTmp.maxSize) {
if (cgTmp.objects[oefj] == -1) {
break;
}
if (probes.objects[oefi].inRange(cgTmp.objects[oefj])) {
probes.objects[oefi].gameTarget = cgTmp.objects[oefj];
tmpVar = 1;
break;
}
oefj++;
}
if (tmpVar == 1) {
break;
}
k++;
}
}
if (!probes.objects[oefi].hasTarget()) {
probes.objects[oefi].checkForTargetCounter = 6;
}
}
}
}
oefi++;
}
}
function checkProbeCollisions(probeGroup) {
loadEnemyCollisionGroups(probeGroup.objects[0].collisionGroupIndex, sharedCollisionGroups);
oefi = 0;
while (oefi < MAX_PROBES) {
if (probeGroup.objects[oefi] == -1) {
break;
}
if (probeGroup.objects[oefi].beenHitCooldownTimer <= 0) {
tmpVar = 0;
k = 0;
while (k < sharedCollisionGroups.maxSize) {
if (sharedCollisionGroups.objects[k] == -1) {
break;
}
cgTmp = sharedCollisionGroups.objects[k];
oefj = 0;
while (oefj < cgTmp.maxSize) {
if (cgTmp.objects[oefj] == -1) {
break;
}
if (cgTmp.objects[oefj].collidesCircle(probeGroup.objects[oefi]) == true) {
if ((probeGroup.objects[oefi].gameState != PS_DISCHARGED) && (probeGroup.objects[oefi].gameState != PS_HIT)) {
playProbeHitSound();
}
probeGroup.objects[oefi].damage(cgTmp.objects[oefj].getDamage());
responseCollision(cgTmp.objects[oefj], probeGroup.objects[oefi], cgTmp.objects[oefj], probeGroup.objects[oefi]);
probeGroup.objects[oefi].moveBack();
cgTmp.objects[oefj].moveBack();
probeGroup.objects[oefi].move();
cgTmp.objects[oefj].move();
probeGroup.objects[oefi].onHit();
probeGroup.objects[oefi].onHit1(cgTmp.objects[oefj]);
probeGroup.objects[oefi].onHit2(cgTmp.objects[oefj]);
probeGroup.objects[oefi].onHit3(cgTmp.objects[oefj]);
probeGroup.objects[oefi].beenHitCooldownTimer = 0;
probeGroup.objects[oefi].touched = true;
tmpVar = 1;
break;
}
oefj++;
}
if (tmpVar == 1) {
break;
}
k++;
}
}
oefi++;
}
}
function updateMainShip() {
loadEnemyCollisionGroups(mainShip.collisionGroupIndex, sharedCollisionGroups);
mainShip.update();
oefi = 0;
while (oefi < sharedCollisionGroups.maxSize) {
if (sharedCollisionGroups.objects[oefi] == -1) {
return;
}
cgTmp = sharedCollisionGroups.objects[oefi];
oefj = 0;
while (oefj < cgTmp.maxSize) {
if (cgTmp.objects[oefj] == -1) {
break;
}
if (cgTmp.objects[oefj].collidesCircle(mainShip) == true) {
killEnemy(cgTmp.objects[oefj]);
hitMainShip();
}
oefj++;
}
oefi++;
}
}
function hitMainShip() {
hitFlash.gotoAndPlay("f1");
hitsLeft--;
HitsLeft = hitsLeft;
if (hitsLeft <= 0) {
endGameFailure();
}
}
function killEnemy(enemy) {
playAsteroidDeathSound();
if (selectedObject == enemy) {
unselectSelectedObject();
}
points = int(getSquaredDistance(mainShip._x, mainShip._y, enemy._x, enemy._y) * 0.001);
score = score + points;
ScoreField = score;
enemy.killObject();
enemyList.killObjectDontRemove(enemy.indexValue);
currentLevel.totalLevelKills++;
if (enemy.levelNum == levelNumber) {
currentLevel.sameLevelKills++;
}
money++;
MoneyField.text = money;
checkKillTriggers();
}
function checkKillTriggers() {
if (((currentLevel.numKillTriggers > 0) && (currentLevel.killTriggers[0].complete == false)) && (currentLevel.killTriggers[0].triggerType == KT_COUNT)) {
if (currentLevel.killTriggers[0].value1 <= currentLevel.sameLevelKills) {
doEventAction(currentLevel.killTriggers[0]);
currentLevel.killTriggers[0].complete = true;
}
}
}
function doEventAction(action) {
if (action.actionType == ACT_TYPE_DISP_DIALOG) {
copyDialog(currentLevel.triggerDialogs[currentLevel.killTriggers[0].value2], currentDialog);
dialogPieces.displayDialog(currentDialog.presenter, currentDialog.textString, DIALOG_SIDE_LEFT);
}
}
function updateProjectiles() {
oefi = 0;
while (oefi < MAX_PROJECTILES) {
if (projectiles.objects[oefi] != -1) {
markForDeath = projectiles.objects[oefi].step();
if (markForDeath == false) {
projectiles.objects[oefi].move();
projectiles.objects[oefi].collisionGroupIndex = getCollisionGroupIndex(projectiles.objects[oefi]);
loadEnemyCollisionGroups(projectiles.objects[oefi].collisionGroupIndex, sharedCollisionGroups);
tmpVar = 0;
k = 0;
while (k < sharedCollisionGroups.maxSize) {
if (sharedCollisionGroups.objects[k] == -1) {
break;
}
cgTmp = sharedCollisionGroups.objects[k];
oefj = 0;
while (oefj < cgTmp.maxSize) {
if (cgTmp.objects[oefj] == -1) {
break;
}
if (cgTmp.objects[oefj].collidesCircle(projectiles.objects[oefi]) == true) {
projectiles.objects[oefi].affect(cgTmp.objects[oefj]);
if (projectiles.objects[oefi].projType == LASER_BEAM) {
createLaserHit(cgTmp.objects[oefj]);
} else {
responseCollision(cgTmp.objects[oefj], projectiles.objects[oefi], cgTmp.objects[oefj], projectiles.objects[oefi]);
}
tmpVar = 1;
break;
}
oefj++;
}
if (tmpVar == 1) {
if (projectiles.objects[oefi].piercing == false) {
projectiles.objects[oefi].killObject();
break;
}
}
k++;
}
}
}
oefi++;
}
}
function selectObject(object) {
playToggleSound();
rangeRadiusDisplays[selectedObject.indexValue]._x = OFFSCREEN_X;
if (object.objectType == OBJ_PROBE) {
selectedObject = probes.objects[object.index];
if (selectedObject != -1) {
configureStatsMenu();
}
} else if (object.objectType == OBJ_MAIN_SHIP) {
selectedObject = mainShip;
configureStatsMenu();
} else if (object.objectType == OBJ_ENEMY) {
selectedObject = object;
hideStatsMenu();
}
onMouseDownExtended();
}
function hideRangeDisplay() {
i = 0;
while (i < MAX_PROBES) {
rangeRadiusDisplays[i]._x = OFFSCREEN_X;
i++;
}
}
function initBuildButtons() {
initCollider(BuildRepulsionProbe);
BuildRepulsionProbe.cRadius = BuildRepulsionProbe.cRadius * 0.25;
initCollider(BuildRocketProbe);
BuildRocketProbe.cRadius = BuildRocketProbe.cRadius * 0.25;
initCollider(BuildPBProbe);
BuildPBProbe.cRadius = BuildPBProbe.cRadius * 0.25;
initCollider(BuildBombProbe);
BuildBombProbe.cRadius = BuildBombProbe.cRadius * 0.25;
initCollider(BuildDecoyProbe);
BuildDecoyProbe.cRadius = BuildDecoyProbe.cRadius * 0.25;
initCollider(BuildStasisProbe);
BuildStasisProbe.cRadius = BuildStasisProbe.cRadius * 0.25;
initCollider(BuildBatteryProbe);
BuildBatteryProbe.cRadius = BuildBatteryProbe.cRadius * 0.25;
initCollider(BuildWallProbe);
BuildWallProbe.cRadius = BuildWallProbe.cRadius * 0.25;
BuildRepulsionProbe.origX = 16;
BuildRepulsionProbe.origY = 624;
BuildRepulsionProbe._x = BuildRepulsionProbe.origX;
BuildRepulsionProbe._y = BuildRepulsionProbe.origY;
BuildRepulsionProbe.probeType = REPULSOR_PROBE;
BuildRepulsionProbe.controlNeeded = REPULSOR_PROBE_CONTROL;
BuildRepulsionProbe.cost = COST_OF_REPULSOR_PROBE;
BuildRepulsionProbe.onRollOver = function () {
if (userState != BUILD) {
buildQuickInfo._x = this._x;
buildQuickInfo._y = this._y - 32;
buildQuickInfo.Field1 = "Materials:" + COST_OF_REPULSOR_PROBE;
buildQuickInfo.Field2 = "Control:" + REPULSOR_PROBE_CONTROL;
buildQuickInfo.InfoField = "A Probe built to repel asteroids. Fires energy projectiles that bounce objects on contact. Useful keep asteroids stalled.";
}
};
BuildRepulsionProbe.onRollOut = function () {
buildQuickInfo._y = OFFSCREEN_Y;
};
BuildRepulsionProbe.onPress = function () {
unselectSelectedObject();
prepBuildRepulsorProbe();
};
BuildRocketProbe.origX = 49.35;
BuildRocketProbe.origY = 624;
BuildRocketProbe._x = BuildRocketProbe.origX;
BuildRocketProbe._y = BuildRocketProbe.origY;
BuildRocketProbe.probeType = ROCKET_PROBE;
BuildRocketProbe.controlNeeded = ROCKET_PROBE_CONTROL;
BuildRocketProbe.cost = COST_OF_ROCKET_PROBE;
BuildRocketProbe.onRollOver = function () {
if (userState != BUILD) {
buildQuickInfo._x = this._x;
buildQuickInfo._y = this._y - 32;
buildQuickInfo.Field1 = "Materials:" + COST_OF_ROCKET_PROBE;
buildQuickInfo.Field2 = "Control:" + ROCKET_PROBE_CONTROL;
buildQuickInfo.InfoField = "Area damage probe. Fires rockets that explode and damage all objects within the area. Has minor knockback abilities";
}
};
BuildRocketProbe.onRollOut = function () {
buildQuickInfo._y = OFFSCREEN_Y;
};
BuildRocketProbe.onPress = function () {
unselectSelectedObject();
prepBuildRocketProbe();
};
BuildBombProbe.origX = 80;
BuildBombProbe.origY = 624;
BuildBombProbe._x = BuildBombProbe.origX;
BuildBombProbe._y = BuildBombProbe.origY;
BuildBombProbe.probeType = BOMB_PROBE;
BuildBombProbe.controlNeeded = BOMB_PROBE_CONTROL;
BuildBombProbe.cost = COST_OF_BOMB_PROBE;
BuildBombProbe.onRollOver = function () {
if (userState != BUILD) {
buildQuickInfo._x = this._x;
buildQuickInfo._y = this._y - 32;
buildQuickInfo.Field1 = "Materials:" + COST_OF_BOMB_PROBE;
buildQuickInfo.Field2 = "Control:" + BOMB_PROBE_CONTROL;
buildQuickInfo.InfoField = "Mass damage probe. Explodes the area surrounding the probe. Very slow reload times, but massive damage makes up for it.";
}
};
BuildBombProbe.onRollOut = function () {
buildQuickInfo._y = OFFSCREEN_Y;
};
BuildBombProbe.onPress = function () {
unselectSelectedObject();
prepBuildBombProbe();
};
BuildPBProbe.origX = 112;
BuildPBProbe.origY = 624;
BuildPBProbe._x = BuildPBProbe.origX;
BuildPBProbe._y = BuildPBProbe.origY;
BuildPBProbe.probeType = PB_PROBE;
BuildPBProbe.controlNeeded = PB_PROBE_CONTROL;
BuildPBProbe.cost = COST_OF_PB_PROBE;
BuildPBProbe.onRollOver = function () {
if (userState != BUILD) {
buildQuickInfo._x = this._x;
buildQuickInfo._y = this._y - 32;
buildQuickInfo.Field1 = "Materials:" + COST_OF_PB_PROBE;
buildQuickInfo.Field2 = "Control:" + PB_PROBE_CONTROL;
buildQuickInfo.InfoField = "High damage probe. Fires particles that rip through targets. Great concentrated damage with little waste.";
}
};
BuildPBProbe.onRollOut = function () {
buildQuickInfo._y = OFFSCREEN_Y;
};
BuildPBProbe.onPress = function () {
unselectSelectedObject();
prepBuildPBProbe();
};
BuildStasisProbe.origX = 145;
BuildStasisProbe.origY = 624;
BuildStasisProbe._x = BuildStasisProbe.origX;
BuildStasisProbe._y = BuildStasisProbe.origY;
BuildStasisProbe.probeType = STASIS_PROBE;
BuildStasisProbe.controlNeeded = STASIS_PROBE_CONTROL;
BuildStasisProbe.cost = COST_OF_STASIS_PROBE;
BuildStasisProbe.onRollOver = function () {
if (userState != BUILD) {
buildQuickInfo._x = this._x;
buildQuickInfo._y = this._y - 32;
buildQuickInfo.Field1 = "Materials:" + COST_OF_STASIS_PROBE;
buildQuickInfo.Field2 = "Control:" + STASIS_PROBE_CONTROL;
buildQuickInfo.InfoField = "A probe designed to slow down enemy lines. Will create a stasis field surrounding the probe, nearly freezing any enemy caught in the field. Higher levels increase effectiveness of the stasis.";
}
};
BuildStasisProbe.onRollOut = function () {
buildQuickInfo._y = OFFSCREEN_Y;
};
BuildStasisProbe.onPress = function () {
unselectSelectedObject();
prepBuildStasisProbe();
};
BuildDecoyProbe.origX = 209;
BuildDecoyProbe.origY = 624;
BuildDecoyProbe._x = BuildDecoyProbe.origX;
BuildDecoyProbe._y = BuildDecoyProbe.origY;
BuildDecoyProbe.probeType = DECOY_PROBE;
BuildDecoyProbe.controlNeeded = DECOY_PROBE_CONTROL;
BuildDecoyProbe.cost = COST_OF_DECOY_PROBE;
BuildDecoyProbe.onRollOver = function () {
if (userState != BUILD) {
buildQuickInfo._x = this._x;
buildQuickInfo._y = this._y - 32;
buildQuickInfo.Field1 = "Materials:" + COST_OF_DECOY_PROBE;
buildQuickInfo.Field2 = "Control:" + DECOY_PROBE_CONTROL;
buildQuickInfo.InfoField = "This probe will create a gravity link with any object within range. Once this link is established, the object will become attracted to this probe. The link will be broken if this probe gets downed.";
}
};
BuildDecoyProbe.onRollOut = function () {
buildQuickInfo._y = OFFSCREEN_Y;
};
BuildDecoyProbe.onPress = function () {
unselectSelectedObject();
prepBuildDecoyProbe();
};
BuildBatteryProbe.origX = 177;
BuildBatteryProbe.origY = 624;
BuildBatteryProbe._x = BuildBatteryProbe.origX;
BuildBatteryProbe._y = BuildBatteryProbe.origY;
BuildBatteryProbe.probeType = BATTERY_PROBE;
BuildBatteryProbe.controlNeeded = BATTERY_PROBE_CONTROL;
BuildBatteryProbe.cost = COST_OF_BATTERY_PROBE;
BuildBatteryProbe.onRollOver = function () {
if (userState != BUILD) {
buildQuickInfo._x = this._x;
buildQuickInfo._y = this._y - 32;
buildQuickInfo.Field1 = "Materials:" + COST_OF_BATTERY_PROBE;
buildQuickInfo.Field2 = "Control:" + BATTERY_PROBE_CONTROL;
buildQuickInfo.InfoField = "This helper probe will regenerate hit points for all probes in range. It will also speed up recharge speeds when probes are down.";
}
};
BuildBatteryProbe.onRollOut = function () {
buildQuickInfo._y = OFFSCREEN_Y;
};
BuildBatteryProbe.onPress = function () {
unselectSelectedObject();
prepBuildBatteryProbe();
};
BuildWallProbe.origX = 241;
BuildWallProbe.origY = 624;
BuildWallProbe._x = BuildWallProbe.origX;
BuildWallProbe._y = BuildWallProbe.origY;
BuildWallProbe.probeType = WALL_PROBE;
BuildWallProbe.controlNeeded = WALL_PROBE_CONTROL;
BuildWallProbe.cost = COST_OF_WALL_PROBE;
BuildWallProbe.onRollOver = function () {
if (userState != BUILD) {
buildQuickInfo._x = this._x;
buildQuickInfo._y = this._y - 32;
buildQuickInfo.Field1 = "Materials:" + COST_OF_WALL_PROBE;
buildQuickInfo.Field2 = "Control:" + WALL_PROBE_CONTROL;
buildQuickInfo.InfoField = "The wall probe. Cost effective way of blocking objects from reaching their target. Can upgrade secondary skills to increase effectiveness.";
}
};
BuildWallProbe.onRollOut = function () {
buildQuickInfo._y = OFFSCREEN_Y;
};
BuildWallProbe.onPress = function () {
unselectSelectedObject();
prepBuildWallProbe();
};
}
function prepBuildRepulsorProbe() {
if ((userState == IDLE) || (userState == SELECT)) {
userState = BUILD;
build = BuildRepulsionProbe;
buildProbeType = REPULSOR_PROBE;
buildingRange._xscale = REPULSOR_PROBE_RANGE;
buildingRange._yscale = REPULSOR_PROBE_RANGE;
}
}
function prepBuildRocketProbe() {
if ((userState == IDLE) || (userState == SELECT)) {
userState = BUILD;
build = BuildRocketProbe;
buildProbeType = ROCKET_PROBE;
buildingRange._xscale = ROCKET_PROBE_RANGE;
buildingRange._yscale = ROCKET_PROBE_RANGE;
}
}
function prepBuildBombProbe() {
if ((userState == IDLE) || (userState == SELECT)) {
userState = BUILD;
build = BuildBombProbe;
buildProbeType = BOMB_PROBE;
buildingRange._xscale = BOMB_PROBE_RANGE;
buildingRange._yscale = BOMB_PROBE_RANGE;
}
}
function prepBuildPBProbe() {
if ((userState == IDLE) || (userState == SELECT)) {
userState = BUILD;
build = BuildPBProbe;
buildProbeType = PB_PROBE;
buildingRange._xscale = PB_PROBE_RANGE;
buildingRange._yscale = PB_PROBE_RANGE;
}
}
function prepBuildStasisProbe() {
if ((userState == IDLE) || (userState == SELECT)) {
userState = BUILD;
build = BuildStasisProbe;
buildProbeType = STASIS_PROBE;
buildingRange._xscale = STASIS_PROBE_RANGE;
buildingRange._yscale = STASIS_PROBE_RANGE;
}
}
function prepBuildDecoyProbe() {
if ((userState == IDLE) || (userState == SELECT)) {
userState = BUILD;
build = BuildDecoyProbe;
buildProbeType = DECOY_PROBE;
buildingRange._xscale = DECOY_PROBE_RANGE;
buildingRange._yscale = DECOY_PROBE_RANGE;
}
}
function prepBuildBatteryProbe() {
if ((userState == IDLE) || (userState == SELECT)) {
userState = BUILD;
build = BuildBatteryProbe;
buildProbeType = BATTERY_PROBE;
buildingRange._xscale = BATTERY_PROBE_RANGE;
buildingRange._yscale = BATTERY_PROBE_RANGE;
}
}
function prepBuildWallProbe() {
if ((userState == IDLE) || (userState == SELECT)) {
userState = BUILD;
build = BuildWallProbe;
buildProbeType = WALL_PROBE;
buildingRange._xscale = WALL_PROBE_RANGE;
buildingRange._yscale = WALL_PROBE_RANGE;
}
}
function gameInput() {
if (firstDownActions.cancelPressed == true) {
cancelAction();
}
if (firstDownActions.pausePressed == true) {
togglePause();
}
if (firstDownActions.toggleRangeDisplay == true) {
toggleRangeDisplay();
}
if (firstDownActions.debugPressed == true) {
debugField = ((((((((((((((((((("myIndex" + selectedObject.index) + ",") + selectedObject.indexValue) + ":") + "gameTarget:") + selectedObject.gameTarget) + "; alive=") + selectedObject.alive) + ";gameTargetXY=") + selectedObject.gameTarget._x) + ",") + selectedObject.gameTarget._y) + ";speed=") + selectedObject.speed) + ";dx=") + selectedObject.dx) + ";mass=") + selectedObject.mass) + ";ax") + selectedObject.ax;
}
if (firstDownActions.scrollProbes == true) {
if (selectedObject == -1) {
i = 0;
while (i < MAX_PROBES) {
if (probes.objects[i] != -1) {
selectObject(probes.objects[i]);
break;
}
i++;
}
} else {
tmp = false;
i = selectedObject.index + 1;
while (i < MAX_PROBES) {
if (probes.objects[i] != -1) {
selectObject(probes.objects[i]);
tmp = true;
break;
}
i++;
}
if (tmp == false) {
i = 0;
while (i <= selectedObject.index) {
if (probes.objects[i] != -1) {
selectObject(probes.objects[i]);
tmp = true;
return;
}
i++;
}
}
}
}
}
function goNextGameState() {
currentLevel.dialogIndex = 0;
skipDialog._y = OFFSCREEN_Y;
if (gameState == START_GAME) {
gameState = LEVEL_PRE_DIALOG;
gameUpdate = levelPreDialogLoop;
skipDialog._y = 44;
} else if (gameState == LEVEL_PRE_DIALOG) {
gameState = LEVEL_PRE_ANIM;
goNextGameState();
} else if (gameState == LEVEL_PRE_ANIM) {
gameState = INGAME_PRE_DIALOG;
gameUpdate = function () {
};
goNextGameState();
} else if (gameState == INGAME_PRE_DIALOG) {
gameState = INGAME_PLAYING;
gameUpdate = function () {
currentDialog.ttl--;
if (currentDialog.ttl <= 0) {
if (currentLevel.dialogIndex < currentLevel.gpredAmt) {
copyDialog(currentLevel.gamePreDialogs[currentLevel.dialogIndex++], currentDialog);
dialogPieces.displayDialog(currentDialog.presenter, currentDialog.textString, DIALOG_SIDE_LEFT);
} else {
dialogPieces.hideAll();
}
}
playGameLoop();
};
} else if (gameState == INGAME_PLAYING) {
gameState = INGAME_POST_DIALOG;
skipDialog._y = 44;
gameUpdate = gamePostDialogLoop;
} else if (gameState == INGAME_POST_DIALOG) {
gameState = LEVEL_POST_ANIM;
goNextGameState();
} else if (gameState == LEVEL_POST_ANIM) {
gameState = LEVEL_POST_DIALOG;
gameUpdate = levelPostDialogLoop;
skipDialog._y = 44;
} else if (gameState == LEVEL_POST_DIALOG) {
if (levelNumber >= gameLevels.numLevels) {
endGameSuccess();
} else {
gameState = LEVEL_PRE_DIALOG;
goNextLevel();
gameUpdate = levelPreDialogLoop;
currentLevel.dialogIndex = 0;
skipDialog._y = 44;
}
}
}
function goNextUserState() {
}
function cancelUserState() {
}
function levelPreDialogLoop() {
currentDialog.ttl--;
if (currentDialog.ttl <= 0) {
if (currentLevel.dialogIndex < currentLevel.lpredAmt) {
copyDialog(currentLevel.levelPreDialogs[currentLevel.dialogIndex++], currentDialog);
dialogPieces.displayDialog(currentDialog.presenter, currentDialog.textString, DIALOG_SIDE_LEFT);
} else {
goNextGameState();
}
}
notPlayLoop();
}
function gamePostDialogLoop() {
currentDialog.ttl--;
if (currentDialog.ttl <= 0) {
if (currentLevel.dialogIndex < currentLevel.gpostdAmt) {
copyDialog(currentLevel.gamePostDialogs[currentLevel.dialogIndex++], currentDialog);
dialogPieces.displayDialog(currentDialog.presenter, currentDialog.textString, DIALOG_SIDE_LEFT);
} else {
goNextGameState();
}
}
notPlayLoop();
}
function levelPostDialogLoop() {
currentDialog.ttl--;
if (currentDialog.ttl <= 0) {
if (currentLevel.dialogIndex < currentLevel.lpostdAmt) {
copyDialog(currentLevel.levelPostDialogs[currentLevel.dialogIndex++], currentDialog);
dialogPieces.displayDialog(currentDialog.presenter, currentDialog.textString, DIALOG_CENTER);
} else {
goNextGameState();
}
}
notPlayLoop();
}
function notPlayLoop() {
updateErrorDisplay();
updateEnemies();
updateProjectiles();
updateMainShip();
updateProbes();
updateEffects();
}
function playGameLoop() {
spawnEnemy();
updateErrorDisplay();
updateEnemies();
updateProjectiles();
updateMainShip();
updateProbes();
updateEffects();
currentLevel.framesElapsed++;
isLevelComplete();
}
function updateErrorDisplay() {
if (errorPopup.displayTime > 0) {
errorPopup.displayTime--;
if (errorPopup.displayTime == 0) {
hideError();
}
}
}
function isLevelComplete() {
if (currentLevel.totalNumEnemies == 0) {
if (currentLevel.winCondition == WC_ALL_CLEAR) {
if (enemyList.allDead == true) {
goNextGameState();
}
} else if (currentLevel.winCondition == WC_SAME_LEVEL_KILLS) {
if (currentLevel.sameLevelKills == currentLevel.winConditionVar) {
goNextGameState();
}
} else if (currentLevel.winCondition == WC_FRAMES_ELAPSED) {
if (currentLevel.framesElapsed == currentLevel.winConditionVar) {
goNextGameState();
}
}
}
}
function unselectSelectedObject() {
if (selectedObject != -1) {
rangeRadiusDisplays[selectedObject.indexValue]._x = OFFSCREEN_X;
selectedObject = -1;
}
}
function changeMouseCursor(cursor) {
mouseCursor._x = OFFSCREEN_X;
mouseCursor = cursor;
}
function displayError(string) {
errorPopup.TextString = string;
errorPopup._y = ERROR_POPUP_Y;
errorPopup.displayTime = ERROR_DISPLAY_TIME;
}
function hideError() {
errorPopup._y = OFFSCREEN_Y;
}
function hasEnoughMoney() {
if (build.cost <= money) {
return(true);
}
return(false);
}
function hasEnoughControl() {
if ((controlUsed + build.controlNeeded) <= MAX_CONTROL) {
return(true);
}
return(false);
}
function canBuildAt() {
i = 0;
while (i < MAX_PROBES) {
if (probes.objects[i].collidesCircle(build)) {
return(false);
}
i++;
}
if ((build._y > BOTTOM_EDGE) && (build._x < PROBE_MENU_EDGE)) {
return(false);
}
if (mainShip.collidesCircle(build)) {
return(false);
}
return(true);
}
function sellProbe(probe) {
if ((probe.objectType == OBJ_PROBE) && (gameState != GAME_OVER)) {
if (probe.probeType == DECOY_PROBE) {
oefi = 0;
while (oefi < MAX_ENEMIES) {
if (enemyList.objects[oefi] != -1) {
if (enemyList.objects[oefi].gameTarget == probe) {
enemyList.objects[oefi].gameTarget = mainShip;
}
}
oefi++;
}
}
money = money + (probe.cost * SELL_VALUE_PERCENTAGE);
controlUsed = controlUsed - probe.control;
rangeRadiusDisplays[probe.indexValue]._x = OFFSCREEN_X;
probes.killObject(probe.indexValue);
ControlField.text = controlUsed;
MoneyField.text = money;
unselectSelectedObject();
} else {
displayError("Cannot sell");
}
}
function canUpgrade(amt) {
if (amt <= money) {
return(true);
}
return(false);
}
function cancelAction() {
if (userState == BUILD) {
userState = SELECT;
build._x = build.origX;
build._y = build.origY;
build.gotoAndStop("f0");
buildingRange._x = OFFSCREEN_X;
} else if (userState == IDLE) {
} else if (userState == ACTION) {
userState = SELECT;
changeMouseCursor(normalCursor);
}
}
function endGameSuccess() {
gameUpdate = emptyLoop;
gameState = GAME_OVER;
displayPostScoreMenu();
_root.kongregateStats.submit("GameComplete", 1);
_root.kongregateScores.submit(score);
}
function endGameFailure() {
gameUpdate = emptyLoop;
gameState = GAME_OVER;
displayPostScoreMenu();
_root.kongregateScores.submit(score);
}
function emptyLoop() {
}
function initProbeForFinalLevel(probe) {
probe.inRange = finalLevelInRangeFunction;
}
function finalLevelInRangeFunction(circle) {
return(true);
}
stop();
init();
_root.onEnterFrame = function () {
mouseCursor._x = _root._xmouse;
mouseCursor._y = _root._ymouse;
if (!throttled()) {
checkInput();
gameInput();
if (userState == IDLE) {
} else if (userState == BUILD) {
if (!canBuildAt()) {
build.gotoAndStop("cantBuild");
} else {
build.gotoAndStop("f0");
}
build._x = _root._xmouse;
build._y = _root._ymouse;
buildingRange._x = _root._xmouse;
buildingRange._y = _root._ymouse;
} else if (userState == UPGRADE) {
}
if (!gamePaused) {
gameUpdate();
} else {
displayError("Paused");
}
dialogPieces.update();
if (selectedObject == -1) {
selectPointer._y = OFFSCREEN_Y;
quickInfo._y = OFFSCREEN_Y;
hideStatsMenu();
} else if (selectedObject.objectType == OBJ_ENEMY) {
quickInfo._x = selectedObject._x;
quickInfo._y = selectedObject._y - 32;
quickInfo.Field1 = (("HP:" + int(selectedObject.hp)) + "/") + selectedObject.hpMax;
quickInfo.Field2 = "";
} else {
rangeRadiusDisplays[selectedObject.indexValue]._x = selectedObject._x;
rangeRadiusDisplays[selectedObject.indexValue]._y = selectedObject._y;
rangeRadiusDisplays[selectedObject.indexValue]._xscale = selectedObject.range;
rangeRadiusDisplays[selectedObject.indexValue]._yscale = selectedObject.range;
selectPointer._x = selectedObject._x;
selectPointer._y = selectedObject._y;
quickInfo._x = selectedObject._x;
quickInfo._y = selectedObject._y - 32;
if (selectedObject.objectType == OBJ_MAIN_SHIP) {
quickInfo.Field1 = (("EP:" + int(selectedObject.energy)) + "/") + selectedObject.energyMax;
quickInfo.Field2 = "Kills:" + selectedObject.killCount;
} else {
quickInfo.Field1 = (("HP:" + int(selectedObject.hp)) + "/") + selectedObject.hpMax;
quickInfo.Field2 = "Kills:" + selectedObject.killCount;
}
}
if (popupInfo != -1) {
popupCountdown--;
}
if (popupCountdown <= 0) {
if (popupCountdown == 0) {
popup.Text = popupInfo;
popup.gotoAndPlay("PLAY_SHOW");
}
popup._x = _root._xmouse;
popup._y = _root._ymouse;
} else {
popup._x = OFFSCREEN_X;
popup._y = OFFSCREEN_Y;
}
}
};
testVar = 0;
Frame 60
function init() {
_root.gotoAndStop("ReplayGameAd");
}
init();
Frame 61
function init() {
probes.killAll();
RankField.text = "1";
mainShip._x = OFFSCREEN_X;
NextPage.onPress = goNextScores;
PreviousPage.onPress = goPreviousScores;
LookUp.onPress = rankLookUp;
HSPlayGame.onPress = function () {
getURL ("http://www.jumbledmind.com/StarDefenseSquad", "_blank");
};
popup._x = OFFSCREEN_X;
optionsButton._x = OFFSCREEN_X;
configureEntry(Entry1);
configureEntry(Entry2);
configureEntry(Entry3);
configureEntry(Entry4);
configureEntry(Entry5);
configureEntry(Entry6);
configureEntry(Entry7);
configureEntry(Entry8);
configureEntry(Entry9);
configureEntry(Entry10);
viewRankOffset = 0;
displayHighScores(viewRankOffset);
}
function goNextScores() {
viewRankOffset++;
displayHighScores(viewRankOffset);
}
function goPreviousScores() {
viewRankOffset--;
if (viewRankOffset < 0) {
viewRankOffset = 0;
}
displayHighScores(viewRankOffset);
}
function rankLookUp() {
rank = RankField.text;
if ((rank == 0) || (rank == "")) {
rank = 1;
}
rank = rank - 1;
viewRankOffset = int(rank / 10);
displayHighScores(viewRankOffset);
}
function displayHighScores(offset) {
userData = new LoadVars();
userData.searchType = "byRank";
userData.startIndex = offset * 10;
userData.onLoad = function (ok) {
if (ok) {
showHighScores();
}
};
userData.sendAndLoad(databaseScriptsHome + "GetTopScores.php", userData, POST);
}
function showHighScores() {
rankOffset = viewRankOffset * 10;
Entry1.NameField = userData.name1;
Entry1.ScoreField = userData.score1;
Entry1.RankField = rankOffset + 1;
Entry1.id = userData.idList1;
Entry2.NameField = userData.name2;
Entry2.ScoreField = userData.score2;
Entry2.RankField = rankOffset + 2;
Entry2.id = userData.idList2;
Entry3.NameField = userData.name3;
Entry3.ScoreField = userData.score3;
Entry3.RankField = rankOffset + 3;
Entry3.id = userData.idList3;
Entry4.NameField = userData.name4;
Entry4.ScoreField = userData.score4;
Entry4.RankField = rankOffset + 4;
Entry4.id = userData.idList4;
Entry5.NameField = userData.name5;
Entry5.ScoreField = userData.score5;
Entry5.RankField = rankOffset + 5;
Entry5.id = userData.idList5;
Entry6.NameField = userData.name6;
Entry6.ScoreField = userData.score6;
Entry6.RankField = rankOffset + 6;
Entry6.id = userData.idList6;
Entry7.NameField = userData.name7;
Entry7.ScoreField = userData.score7;
Entry7.RankField = rankOffset + 7;
Entry7.id = userData.idList7;
Entry8.NameField = userData.name8;
Entry8.ScoreField = userData.score8;
Entry8.RankField = rankOffset + 8;
Entry8.id = userData.idList8;
Entry9.NameField = userData.name9;
Entry9.ScoreField = userData.score9;
Entry9.RankField = rankOffset + 9;
Entry9.id = userData.idList9;
Entry10.NameField = userData.name10;
Entry10.ScoreField = userData.score10;
Entry10.RankField = rankOffset + 10;
Entry10.id = userData.idList10;
}
function configureEntry(entry) {
entry.RankField = "";
entry.NameField = "";
entry.ScoreField = "";
entry.onRollOver = function () {
this.gotoAndStop("f1");
};
entry.onRollOut = function () {
this.gotoAndStop("f0");
};
entry.onPress = function () {
if (this.id > 0) {
viewBluePrint(this.id);
}
};
}
function viewBluePrint(id) {
userData = new LoadVars();
userData.highScoresId = "" + id;
userData.onLoad = function (ok) {
if (ok) {
configureProbeList();
}
};
userData.sendAndLoad(databaseScriptsHome + "GetBuildStrategy.php", userData, POST);
}
function configureProbeList() {
string = userData.probeList;
probeArray = new Array();
probeArray = string.split("/");
_root.gotoAndStop("ViewBuildStrategy");
}
stop();
init();
_root.onEnterFrame = function () {
};
Frame 62
function init() {
probes.killAll();
GoBack.onPress = function () {
_root.gotoAndStop("ViewHighScores");
};
i = 0;
while (i < (probeArray.length - 1)) {
rebuildProbe(probeArray[i]);
i++;
}
}
function rebuildProbe(probeString) {
probeStringPieces = new Array();
probeStringPieces = probeString.split(",");
probeType = probeStringPieces[0].substring(2, probeStringPieces[0].length);
xPos = probeStringPieces[1];
yPos = probeStringPieces[2];
upgradeLevel = probeStringPieces[3];
onHit1Level = probeStringPieces[4];
onHit2Level = probeStringPieces[5];
onHit3Level = probeStringPieces[6];
killCount = probeStringPieces[7];
if (probeType == "repulsor") {
probe = buildRepulsorProbe(xPos, yPos);
} else if (probeType == "rocket") {
probe = buildRocketProbe(xPos, yPos);
} else if (probeType == "pb") {
probe = buildPBProbe(xPos, yPos);
} else if (probeType == "decoy") {
probe = buildDecoyProbe(xPos, yPos);
} else if (probeType == "battery") {
probe = buildBatteryProbe(xPos, yPos);
} else if (probeType == "stasis") {
probe = buildStasisProbe(xPos, yPos);
} else if (probeType == "wall") {
probe = buildWallProbe(xPos, yPos);
} else if (probeType == "bomb") {
probe = buildBombProbe(xPos, yPos);
} else if (probeType == "mainship") {
mainShip._x = xPos;
mainShip._y = yPos;
}
probes.addObject(probe);
}
init();
Frame 63
function init() {
Mouse.show();
mouseCursor._y = OFFSCREEN_Y;
hidePlayAgainMenu();
if (_root.initialized == true) {
mainShip._y = OFFSCREEN_Y;
reinitListsAndGameSprites();
}
CreditsPlayGameButton.onPress = function () {
if (_root.initialized == true) {
_root.gotoAndStop("PlayGame");
} else {
_root.gotoAndPlay("Initializer");
}
};
VisitSiteBtn.onPress = function () {
getURL ("http://www.jumbledmind.com", "_blank");
};
}
stop();
init();
Symbol 57 MovieClip [DialogLeft1] Frame 14
this.guiNextState();
Symbol 57 MovieClip [DialogLeft1] Frame 15
stop();
Symbol 57 MovieClip [DialogLeft1] Frame 18
this.guiNextState();
Symbol 57 MovieClip [DialogLeft1] Frame 23
stop();
Symbol 57 MovieClip [DialogLeft1] Frame 24
stop();
Symbol 68 MovieClip [MainMenuMC] Frame 36
this.guiNextState();
stop();
Symbol 68 MovieClip [MainMenuMC] Frame 73
this.guiNextState();
stop();
Symbol 68 MovieClip [MainMenuMC] Frame 74
stop();
Symbol 71 Button [StatsMenuToggle1]
on (press) {
_root.probeStatsMenu.gotoAndStop("END_SHOW");
_root.probeStatsMenu.toggleMenuColor();
}
Symbol 74 Button [StatsMenuToggle2]
on (press) {
_root.probeStatsMenu.gotoAndStop("END_SHOW2");
_root.probeStatsMenu.toggleMenuColor();
}
Symbol 118 MovieClip [ProbeStatsMenuMC] Frame 2
this.guiNextState();
Symbol 118 MovieClip [ProbeStatsMenuMC] Frame 6
stop();
Symbol 118 MovieClip [ProbeStatsMenuMC] Frame 13
this.guiNextState();
stop();
Symbol 123 MovieClip [StatsExtensionMC] Frame 7
this.guiNextState();
stop();
Symbol 123 MovieClip [StatsExtensionMC] Frame 12
this.guiNextState();
stop();
Symbol 123 MovieClip [StatsExtensionMC] Frame 13
stop();
Symbol 145 MovieClip [InfoPopUpMC] Frame 7
stop();
Symbol 157 MovieClip [StatsExtension2MC] Frame 7
this.guiNextState();
stop();
Symbol 157 MovieClip [StatsExtension2MC] Frame 14
this.guiNextState();
stop();
Symbol 164 MovieClip [DialogRight1] Frame 7
this.guiNextState();
Symbol 164 MovieClip [DialogRight1] Frame 8
stop();
Symbol 164 MovieClip [DialogRight1] Frame 9
this.guiNextState();
Symbol 164 MovieClip [DialogRight1] Frame 14
stop();
Symbol 164 MovieClip [DialogRight1] Frame 15
stop();
Symbol 177 MovieClip [MenuButtonRedMC] Frame 2
stop();
Symbol 182 MovieClip [MenuButtonYellowMC] Frame 2
stop();
Symbol 187 MovieClip [MenuButtonBlueMC] Frame 2
stop();
Symbol 192 MovieClip [MenuButtonGreenMC] Frame 2
stop();
Symbol 401 MovieClip [LaserBeamMC] Frame 1
stop();
Symbol 401 MovieClip [LaserBeamMC] Frame 2
stop();
Symbol 401 MovieClip [LaserBeamMC] Frame 3
stop();
Symbol 467 MovieClip [DialogCenter1MC] Frame 3
this.guiNextState();
Symbol 467 MovieClip [DialogCenter1MC] Frame 4
stop();
Symbol 467 MovieClip [DialogCenter1MC] Frame 5
this.guiNextState();
Symbol 467 MovieClip [DialogCenter1MC] Frame 6
stop();
Symbol 467 MovieClip [DialogCenter1MC] Frame 7
stop();
Symbol 470 MovieClip [FlashMC] Frame 30
stop();
Symbol 471 MovieClip [YellowMC] Frame 30
stop();
Symbol 550 MovieClip [ScoreEntry2MC] Frame 1
stop();
Symbol 559 MovieClip [ScoreEntryMC] Frame 1
stop();
Symbol 569 MovieClip [BatteryProbeMC] Frame 1
stop();
Symbol 576 MovieClip [WallProbeMC] Frame 1
stop();
Symbol 583 MovieClip [DecoyProbeMC] Frame 1
stop();
Symbol 590 MovieClip [StasisProbeMC] Frame 1
stop();
Symbol 597 MovieClip [ParticleBlasterProbeMC] Frame 1
stop();
Symbol 597 MovieClip [ParticleBlasterProbeMC] Frame 2
stop();
Symbol 604 MovieClip [BombProbeMC] Frame 1
stop();
Symbol 604 MovieClip [BombProbeMC] Frame 2
stop();
Symbol 611 MovieClip [RocketProbeMC] Frame 1
stop();
Symbol 611 MovieClip [RocketProbeMC] Frame 2
stop();
Symbol 634 MovieClip [RepulsorProbeMC] Frame 1
stop();
Symbol 634 MovieClip [RepulsorProbeMC] Frame 4
stop();
Symbol 735 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.1");
}
static function showPreGameAd(options) {
var _local27 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}};
options = _parseOptions(options, _local27);
var clip = options.clip;
var _local23 = 11000;
var _local26 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
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 _local7 = chk.createEmptyMovieClip("_mochiad_bar", 4);
_local7._x = 10;
_local7._y = _local13 - 20;
var _local22 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local24 = options.outline;
delete options.outline;
var _local5 = _local7.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 = _local7.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local22);
_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 _local6 = _local7.createEmptyMovieClip("_outline", 3);
_local6.lineStyle(0, _local24, 100);
_local6.moveTo(0, 0);
_local6.lineTo(_local4 - 20, 0);
_local6.lineTo(_local4 - 20, 10);
_local6.lineTo(0, 10);
_local6.lineTo(0, 0);
chk.ad_msec = _local23;
chk.ad_timeout = _local26;
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;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local12 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local10 = (100 * _local8) / _local4;
var _local11 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local2 = Math.min(100, Math.min(_local10 || 0, _local11));
_local2 = Math.max(this.last_pcnt, _local2);
this.last_pcnt = _local2;
_local9._xscale = _local2;
if (!chk.showing) {
var _local7 = _local12.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local5 > chk.ad_timeout) {
_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 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();
}};
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_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;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
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) {
_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 showTimedAd(options) {
showInterLevelAd(options);
}
static function showPreloaderAd(options) {
showPreGameAd(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 _loadCommunicator(options) {
var _local26 = {clip:_root, com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = _parseOptions(options, _local26);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local18 = options.clip;
var _local20 = "_mochiad_com_" + options.id;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local18[_local20]) {
return(_local18[_local20].lc);
}
var _local21 = options.com_server + options.id;
_allowDomains(_local21);
delete options.id;
delete options.com_server;
var _local25 = options.depth;
delete options.depth;
var _local17 = _local18.createEmptyMovieClip(_local20, _local25);
var _local11 = _local17.createEmptyMovieClip("_mochiad_com", 1);
for (var _local15 in options) {
_local11[_local15] = options[_local15];
}
var _local6 = new LocalConnection();
var _local16 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local6.mc = _local17;
_local6.name = _local16;
_local6.allowDomain = function (d) {
return(true);
};
_local6.allowInsecureDomain = _local6.allowDomain;
_local6.connect(_local16);
_local17.lc = _local6;
_local11.lc = _local16;
_local6._id = 0;
_local6._queue = [];
_local6.rpcResult = function (cb_arg) {
var _local8 = parseInt(cb_arg);
var _local4 = this._callbacks[_local8];
if (!_local4) {
return(undefined);
}
delete this._callbacks[_local8];
var _local5 = [];
var _local3 = 2;
while (_local3 < _local4.length) {
_local5.push(_local4[_local3]);
_local3++;
}
_local3 = 1;
while (_local3 < arguments.length) {
_local5.push(arguments[_local3]);
_local3++;
}
var _local6 = _local4[1];
var _local7 = _local4[0];
if (_local7 && (typeof(_local6) == "string")) {
_local6 = _local7[_local6];
}
if (_local6) {
_local6.apply(_local7, _local5);
}
};
_local6._didConnect = function (endpoint) {
this._endpoint = endpoint;
var _local4 = this._queue;
delete this._queue;
var _local5 = this.doSend;
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
_local5.apply(this, _local3);
_local2++;
}
};
_local6.doSend = function (args, cbobj, cbfn) {
if (this._endpoint == null) {
var _local4 = [];
var _local3 = 0;
while (_local3 < arguments.length) {
_local4.push(arguments[_local3]);
_local3++;
}
this._queue.push(_local4);
return(undefined);
}
this._id = this._id + 1;
var _local5 = this._id;
if ((cbfn === undefined) || (cbfn === null)) {
cbfn = cbobj;
}
this._callbacks[_local5] = [cbobj, cbfn];
var _local7 = new LocalConnection();
var _local9 = _local7.send(this._endpoint, "rpc", _local5, args);
};
_local6._callbacks = {};
_local6._callbacks[0] = [_local6, "_didConnect"];
_local11.st = getTimer();
_local11.loadMovie(_local21 + ".swf", "POST");
return(_local6);
}
static function fetchHighScores(options, callbackObj, callbackMethod) {
var _local1 = _loadCommunicator({id:options.id});
if (!_local1) {
return(false);
}
var _local4 = ["fetchHighScores", options];
_local1.doSend(["fetchHighScores", options], callbackObj, callbackMethod);
return(true);
}
static function sendHighScore(options, callbackObj, callbackMethod) {
var _local1 = _loadCommunicator({id:options.id});
if (!_local1) {
return(false);
}
var _local4 = ["sendHighScore", options];
_local1.doSend(["sendHighScore", options], callbackObj, callbackMethod);
return(true);
}
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 _local9 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local9._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local9.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local9._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
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;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local8;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
_local6.lc = _local5;
_local4.lc = _local8;
_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);
}
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++;
}
}
return(_local4);
}
}