Frame 1
function itemHandler1(obj, item) {
getURL ("http://www.newgrounds.com/portal/search/author/plumpman");
}
function createExplosion(targetX, targetY) {
var _local6 = 0;
while (_local6 < particleTotalPreload) {
var _local5 = flash.display.BitmapData.loadBitmap(DeathParticlePreload[random(4)]);
var _local3 = _root.createEmptyMovieClip("main_holder", _root.getNextHighestDepth());
var _local4 = _local3.createEmptyMovieClip("internal_holder", _local3.getNextHighestDepth());
_local4._x = (-_local5.width) / 2;
_local4._y = (-_local5.height) / 2;
_local4.attachBitmap(_local5, _local4.getNextHighestDepth(), "never");
_local3._x = targetX;
_local3._y = targetY;
_local3._rotation = random(360);
_local3._alpha = random(50) + 50;
_local3.boundyLeft = targetX - particleRangePreload;
_local3.boundyTop = targetY - particleRangePreload;
_local3.boundyRight = targetX + particleRangePreload;
_local3.boundyBottom = targetY + particleRangePreload;
_local3.speedX = Math.random(particleMaxSpeedPreLoad) - Math.random(particleMaxSpeedPreLoad);
_local3.speedY = Math.random(particleMaxSpeedPreLoad) - Math.random(particleMaxSpeedPreLoad);
_local3.speedX = _local3.speedX * particleMaxSpeedPreLoad;
_local3.speedY = _local3.speedY * particleMaxSpeedPreLoad;
_local3.fadeSpeed = Math.random(particleFadeSpeedPreload) * particleFadeSpeedPreload;
numberOfParticles++;
_local3.onEnterFrame = function () {
this._alpha = this._alpha - this.fadeSpeed;
this._x = this._x + this.speedX;
this._y = this._y + this.speedY;
if (((((this._alpha <= 0) || (this._x < this.boundyLeft)) || (this._x > this.boundyRight)) || (this._y < this.boundyTop)) || (this._y > this.boundyBottom)) {
this.removeMovieClip();
numberOfParticles--;
}
};
_local6++;
}
}
stop();
mochi.as2.MochiServices.connect("cef40ee0d09b338c");
savefile = SharedObject.getLocal("GeomWarsSaveGame");
var NoExplosionTimer = 60;
var particleMaxSpeedPreLoad = 5;
var particleFadeSpeedPreload = 5;
var particleTotalPreload = 50;
var particleRangePreload = 100;
var DeathParticlePreload = ["Player_Particle", "Red_Particle", "Green_Particle", "Purple_Particle"];
myPop1 = new Sound(this);
myPop1.attachSound("Pop01");
myPop1.setVolume(100);
myPop2 = new Sound(this);
myPop2.attachSound("Pop02");
myPop2.setVolume(100);
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
item1 = new ContextMenuItem("Geoms Wars", itemHandler1);
item2 = new ContextMenuItem("Designed by Nicolas 'Plumpman' Picouet", itemHandler1);
myMenu.customItems.push(item1);
myMenu.customItems.push(item2);
_root.menu = myMenu;
onEnterFrame = function () {
if (NoExplosionTimer > 0) {
NoExplosionTimer--;
} else {
NoExplosionTimer = random(90);
createExplosion(random(450) + 50, random(350) + 50);
randomPop = random(2);
if (randomPop == 0) {
myPop1.start();
} else {
myPop2.start();
}
}
var _local2 = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
preloader_mc._yscale = _local2;
preloader_output.text = Math.floor(_local2) + "%";
preloader_output._y = 300 - preloader_mc._height;
if (_local2 == 100) {
delete onEnterFrame;
gotoAndPlay (2);
}
};
Frame 2
stop();
var NewGame = false;
var LoadGame = false;
if (savefile.data.Saved == 1) {
LoadGameButton._alpha = 100;
LoadGameButton.enabled = true;
} else {
LoadGameButton._alpha = 25;
LoadGameButton.enabled = false;
}
Frame 3
bgMusic.stop();
bgMusic = new Sound(this);
bgMusic.attachSound("menuBG");
bgMusic.start(1, 100);
bgMusic.setVolume(50);
bgMusicEnabled = true;
if (NewGame == true) {
savefile.clear();
var CharacterLevel = 1;
var KillCounterTotal = 0;
var XP = 0;
var TotalXPtoSpend = 0;
var TotalXP = 0;
var LevelsUnlocked = 1;
var currStage = 1;
var LevelsFailed = 0;
var WeaponChoice = "Standard";
var ChassisChoice = "Basic";
var WeaponSlot1Info = "Tier 1";
var WeaponSlot2Info = "Tier 2";
var ChassisSlotInfo = "Basic";
var WideBought = false;
var NarrowBought = false;
var LongBought = false;
var ShortBought = false;
var PlatedBought = false;
var StealthBought = false;
var EscalationUnlocked = false;
}
if (LoadGame == true) {
var CharacterLevel = savefile.data.CharacterLevel;
var KillCounterTotal = savefile.data.KillCounterTotal;
var XP = savefile.data.XP;
var TotalXPtoSpend = savefile.data.TotalXPtoSpend;
var TotalXP = savefile.data.TotalXP;
var LevelsUnlocked = savefile.data.LevelsUnlocked;
var currStage = savefile.data.currStage;
var LevelsFailed = savefile.data.LevelsFailed;
var WeaponChoice = savefile.data.WeaponChoice;
var ChassisChoice = savefile.data.ChassisChoice;
var WeaponSlot1Info = savefile.data.WeaponSlot1Info;
var WeaponSlot2Info = savefile.data.WeaponSlot2Info;
var ChassisSlotInfo = savefile.data.ChassisSlotInfo;
var WideBought = savefile.data.WideBought;
var NarrowBought = savefile.data.NarrowBought;
var LongBought = savefile.data.LongBought;
var ShortBought = savefile.data.ShortBought;
var PlatedBought = savefile.data.PlatedBought;
var StealthBought = savefile.data.StealthBought;
var EscalationUnlocked = savefile.data.EscalationUnlocked;
}
var XPGuide = new Array();
XPGuide[0] = 0;
XPGuide[1] = 50;
XPGuide[2] = 200;
XPGuide[3] = 400;
XPGuide[4] = 650;
XPGuide[5] = 900;
XPGuide[6] = 1200;
XPGuide[7] = 1600;
XPGuide[8] = 2500;
XPGuide[9] = 3500;
XPGuide[10] = 5000;
var LevelName = "";
var SpawnRate = 0;
var EnemyCounter = 0;
var EnemyCounterTotal = 0;
var EnemyShape = [0];
var EnemyType = [["RedSquare_Container", 0, 1, 0.03, 1500, 0, 0, "Red_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 4], ["GreenTriangle_Container", 0, 3, 0.05, 1500, 0, 0, "Green_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 6], ["PurpleHexagon_Container", 0, 2, 0.04, 1500, 0, 0, "Purple_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 8], ["OrangeDonut_Container", 0, 0.75, 0.01, 1500, 0, 0, "Orange_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 4], ["YellowWall_Container", 0, 2, 0.02, 1500, 0, 0, "Yellow_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 12], ["LightBlueCarrier_Container", 100, 0.5, 0.03, 1500, 0, 0, "LightBlue_Particle", 4, 2, 25, 100, 0, 0, 0, 0, 0, 0, 50], ["GrayShuriken_Container", 0, 2.75, 0.04, 1500, 0, 0, "Gray_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 15], ["BrownMine_Container", 5, 0.5, 0.05, 1500, 0, 0, "Brown_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 18], ["VioletMini_Container", 0, 0.75, 0.04, 1500, 0, 0, "Violet_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 10], ["DarkGreenPentagon_Container", 2, 2.5, 0.03, 1500, 0, 0, "DarkGreen_Particle", 4, 2, 15, 100, 0, 0, 0, 0, 0, 0, 20], ["BlackMothership_Container", 250, 1, 0.03, 1500, 0, 0, "Black_Particle", 4, 2, 40, 100, 0, 0, 0, 0, 0, 0, 100]];
Frame 4
function openSubMenu(whichSubMenu, currentPosition) {
chosenMenu = eval ("subMenu" + (whichSubMenu + 1));
j = 0;
while (j < chosenMenu.length) {
this.createEmptyMovieClip("subMenuHolder_mc", this.getNextHighestDepth());
subMenuHolder_mc.attachMovie("LevelMenu", "subMenuButton" + j, this.getNextHighestDepth());
subMenuHolder_mc["subMenuButton" + j]._x = currentPosition;
subMenuHolder_mc["subMenuButton" + j]._y = 78 + (j * 27);
subMenuHolder_mc["subMenuButton" + j].LevelMenuInfo.text = chosenMenu[j];
var subMenuStartColor = new Color(subMenuHolder_mc["subMenuButton" + j].bkgColor_mc);
subMenuStartColor.setRGB(8496098);
subMenuHolder_mc["subMenuButton" + j].onRelease = (subMenuHolder_mc["subMenuButton" + j].onReleaseOutside = function () {
if (this.LevelMenuInfo.text == "Easy 1") {
closeMenu();
currStage = 1;
LevelName = "Easy 1 - Mindless Horde";
SpawnRate = 25;
EnemyCounter = 40;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [0];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Easy 2") {
closeMenu();
currStage = 2;
LevelName = "Easy 2 - Spearhead";
SpawnRate = 30;
EnemyCounter = 20;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [1];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Easy 3") {
closeMenu();
currStage = 3;
LevelName = "Easy 3 - Stormchasers";
SpawnRate = 20;
EnemyCounter = 30;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [2];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Easy 4") {
closeMenu();
currStage = 4;
LevelName = "Easy 4 - Pest Control";
SpawnRate = 15;
EnemyCounter = 40;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [3];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Easy 5") {
closeMenu();
currStage = 5;
LevelName = "Easy 5 - Trinity";
SpawnRate = 30;
EnemyCounter = 60;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [0, 1, 2];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Easy Boss") {
closeMenu();
currStage = 6;
LevelName = "Easy Boss - Fatboy";
SpawnRate = 100;
EnemyCounter = 25;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [5, 2, 3];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Medium 1") {
closeMenu();
currStage = 7;
LevelName = "Medium 1 - Merry-Go-Round";
SpawnRate = 20;
EnemyCounter = 40;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [4];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Medium 2") {
closeMenu();
currStage = 8;
LevelName = "Medium 2 - Evasion";
SpawnRate = 15;
EnemyCounter = 30;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [6];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Medium 3") {
closeMenu();
currStage = 9;
LevelName = "Medium 3 - Sandstorm";
SpawnRate = 50;
EnemyCounter = 20;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [7];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Medium 4") {
closeMenu();
currStage = 10;
LevelName = "Medium 4 - Sweep";
SpawnRate = 25;
EnemyCounter = 100;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [8];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Medium 5") {
closeMenu();
currStage = 11;
LevelName = "Medium 5 - Older Brother";
SpawnRate = 40;
EnemyCounter = 20;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [9];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Medium Boss") {
closeMenu();
currStage = 12;
LevelName = "Medium Boss - Mothership";
SpawnRate = 75;
EnemyCounter = 40;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [10, 8, 6];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Hard 1") {
closeMenu();
currStage = 13;
LevelName = "Hard 1 - Duality";
SpawnRate = 20;
EnemyCounter = 50;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [0, 1];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Hard 2") {
closeMenu();
currStage = 14;
LevelName = "Hard 2 - Brothers";
SpawnRate = 40;
EnemyCounter = 30;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [1, 9];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Hard 3") {
closeMenu();
currStage = 15;
LevelName = "Hard 3 - Flood";
SpawnRate = 20;
EnemyCounter = 75;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [2, 3, 8];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Hard 4") {
closeMenu();
currStage = 16;
LevelName = "Hard 4 - Minefield";
SpawnRate = 35;
EnemyCounter = 40;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [3, 7];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Hard 5") {
closeMenu();
currStage = 17;
LevelName = "Hard 5 - Divide and Conquer";
SpawnRate = 150;
EnemyCounter = 3;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [5];
delete eval (onEnterFrame());
gotoAndStop (6);
}
if (this.LevelMenuInfo.text == "Hard Boss") {
closeMenu();
currStage = 18;
LevelName = "Hard Boss - The Endless Assault";
SpawnRate = 35;
EnemyCounter = 150;
EnemyCounterTotal = EnemyCounter;
EnemyShape = [0, 1, 2, 3, 4, 6, 7, 8, 9];
delete eval (onEnterFrame());
gotoAndStop (6);
}
closeSubMenu();
});
subMenuHolder_mc["subMenuButton" + j].onRollOver = function () {
var _local2 = new Color(this.bkgColor_mc);
_local2.setRGB(16737792);
};
subMenuHolder_mc["subMenuButton" + j].onRollOut = function () {
var _local2 = new Color(this.bkgColor_mc);
_local2.setRGB(8496098);
};
j++;
}
}
function closeSubMenu() {
removeMovieClip(subMenuHolder_mc);
}
function closeMenu() {
closeSubMenu();
i = 0;
while (i < menuButtons.length) {
removeMovieClip(_root["menuButton" + i]);
i++;
}
}
stop();
bgMusic.start(1, 100);
removeMovieClip(_root.InfoBox);
if (EscalationUnlocked == false) {
ChallengeButton._alpha = 50;
ChallengeButton.enabled = false;
} else {
ChallengeButton._alpha = 100;
ChallengeButton.enabled = true;
unloadMovie ("EscalationPurchase");
}
EscalationPurchase.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "New Challenge";
_root.InfoBox.Title.text = "High Score";
_root.InfoBox.Info.text = "[Beat Medium Boss] \n\n Unlock High Score Challenge";
};
EscalationPurchase.onRelease = function () {
if (LevelsUnlocked >= 13) {
EscalationUnlocked = true;
this._alpha = 0;
this.enabled = false;
removeMovieClip(_root.InfoBox);
unloadMovie ("EscalationPurchase");
ChallengeButton.enabled = true;
ChallengeButton._alpha = 100;
}
};
EscalationPurchase.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
EscalationPurchase.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
LevelTotalInfo.text = "Levels Completed: " + (LevelsUnlocked - 1);
LevelFailedInfo.text = "Levels Failed: " + LevelsFailed;
KillTotalInfo.text = "Cuboids Erased: " + KillCounterTotal;
CharacterLevelInfo.text = "Ship Level: " + CharacterLevel;
XPTotalInfo.text = "Total XP Gained: " + TotalXP;
var menuButtons = ["Easy", "Medium", "Hard"];
var subMenu1 = [];
var subMenu2 = ["Locked"];
var subMenu3 = ["Locked"];
if (LevelsUnlocked > 6) {
subMenu2.splice(0, 1);
}
if (LevelsUnlocked > 12) {
subMenu3.splice(0, 1);
}
i = 1;
while (i <= LevelsUnlocked) {
if (i <= 5) {
subMenu1.push("Easy " + i);
}
if (i == 6) {
subMenu1.push("Easy Boss");
}
if ((i <= 11) and (i > 6)) {
subMenu2.push("Medium " + (i - 6));
}
if (i == 12) {
subMenu2.push("Medium Boss");
}
if ((i <= 17) and (i > 12)) {
subMenu3.push("Hard " + (i - 12));
}
if (i == 18) {
subMenu3.push("Hard Boss");
}
i++;
}
var chosenMenu = new Array();
var subMenuOpened = false;
var whichSubMenu = new Number();
var currentPosition = new Number();
i = 0;
while (i < menuButtons.length) {
this.attachMovie("LevelMenu", "menuButton" + i, this.getNextHighestDepth());
this["menuButton" + i]._x = 65 + (102 * i);
this["menuButton" + i]._y = 50;
this["menuButton" + i].LevelMenuInfo.text = menuButtons[i];
this["menuButton" + i].onRollOver = function () {
whichSubMenu = Number(this._name.substr(-1, 1));
currentPosition = this._x;
if (!subMenuOpened) {
subMenuOpened = true;
openSubMenu(whichSubMenu, currentPosition);
} else {
closeSubMenu();
openSubMenu(whichSubMenu, currentPosition);
}
};
i++;
}
ResetButton.onRollOver = function () {
attachMovie("ResetInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Warning!";
_root.InfoBox.Title.text = "Reset Stats";
_root.InfoBox.Info.text = "Beware, this will reset everything you've done.";
};
ResetButton.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
ResetButton.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
onEnterFrame = function () {
XPSpendInfo.text = "Research XP: " + TotalXPtoSpend;
_root.InfoBox._x = _xmouse;
_root.InfoBox._y = _ymouse;
};
Frame 5
stop();
CannonInfo.text = WeaponChoice + " Cannon";
ChassisInfo.text = ChassisChoice + " Chassis";
player_mc.muzzle.gotoAndStop(WeaponChoice);
player_mc.Chassis.gotoAndStop(ChassisChoice);
WeaponSlot1.Info.text = WeaponSlot1Info;
WeaponSlot2.Info.text = WeaponSlot2Info;
Chassis.Info.text = ChassisSlotInfo;
if (WideBought == false) {
WideResearch._alpha = 50;
WideResearch.enabled = false;
} else {
WideResearch._alpha = 100;
WideResearch.enabled = true;
WidePurchase._alpha = 0;
WidePurchase.enabled = false;
}
if (NarrowBought == false) {
NarrowResearch._alpha = 50;
NarrowResearch.enabled = false;
} else {
NarrowResearch._alpha = 100;
NarrowResearch.enabled = true;
NarrowPurchase._alpha = 0;
NarrowPurchase.enabled = false;
}
if (LongBought == false) {
LongResearch._alpha = 50;
LongResearch.enabled = false;
} else {
LongResearch._alpha = 100;
LongResearch.enabled = true;
LongPurchase._alpha = 0;
LongPurchase.enabled = false;
}
if (ShortBought == false) {
ShortResearch._alpha = 50;
ShortResearch.enabled = false;
} else {
ShortResearch._alpha = 100;
ShortResearch.enabled = true;
ShortPurchase._alpha = 0;
ShortPurchase.enabled = false;
}
if (PlatedBought == false) {
PlatedResearch._alpha = 50;
PlatedResearch.enabled = false;
} else {
PlatedResearch._alpha = 100;
PlatedResearch.enabled = true;
PlatedPurchase._alpha = 0;
PlatedPurchase.enabled = false;
}
if (StealthBought == false) {
StealthResearch._alpha = 50;
StealthResearch.enabled = false;
} else {
StealthResearch._alpha = 100;
StealthResearch.enabled = true;
StealthPurchase._alpha = 0;
StealthPurchase.enabled = false;
}
WidePurchase.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Research";
_root.InfoBox.Title.text = "Wide Modifier";
_root.InfoBox.Info.text = "[Beat Easy Boss] \n\n Increases Barrel Width";
};
WidePurchase.onRelease = function () {
if (LevelsUnlocked >= 7) {
WideBought = true;
this._alpha = 0;
this.enabled = false;
removeMovieClip(_root.InfoBox);
WideResearch.enabled = true;
WideResearch._alpha = 100;
}
};
WidePurchase.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
WidePurchase.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
NarrowPurchase.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Research";
_root.InfoBox.Title.text = "Narrow Modifier";
_root.InfoBox.Info.text = "[Beat Medium Boss] \n\n Decreases Barrel Width";
};
NarrowPurchase.onRelease = function () {
if (LevelsUnlocked >= 13) {
NarrowBought = true;
this._alpha = 0;
this.enabled = false;
removeMovieClip(_root.InfoBox);
NarrowResearch.enabled = true;
NarrowResearch._alpha = 100;
}
};
NarrowPurchase.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
NarrowPurchase.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
LongPurchase.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Research";
_root.InfoBox.Title.text = "Long Modifier";
_root.InfoBox.Info.text = "Cost: 3000 XP \n\n Increases Barrel Length";
};
LongPurchase.onRelease = function () {
if (TotalXPtoSpend >= 3000) {
TotalXPtoSpend = TotalXPtoSpend - 3000;
LongBought = true;
this._alpha = 0;
this.enabled = false;
removeMovieClip(_root.InfoBox);
LongResearch.enabled = true;
LongResearch._alpha = 100;
}
};
LongPurchase.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
LongPurchase.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
ShortPurchase.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Research";
_root.InfoBox.Title.text = "Short Modifier";
_root.InfoBox.Info.text = "Cost: 2000 XP \n\n Decreases Barrel Length";
};
ShortPurchase.onRelease = function () {
if (TotalXPtoSpend >= 2000) {
TotalXPtoSpend = TotalXPtoSpend - 2000;
ShortBought = true;
this._alpha = 0;
this.enabled = false;
removeMovieClip(_root.InfoBox);
ShortResearch.enabled = true;
ShortResearch._alpha = 100;
}
};
ShortPurchase.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
ShortPurchase.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
PlatedPurchase.onRollOver = function () {
attachMovie("PurchaseInfoReverse", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Research";
_root.InfoBox.Title.text = "Plated Chassis";
_root.InfoBox.Info.text = "Cost: 1000 XP \n\n Increases Armor, Decreases Speed";
};
PlatedPurchase.onRelease = function () {
if (TotalXPtoSpend >= 1000) {
TotalXPtoSpend = TotalXPtoSpend - 1000;
PlatedBought = true;
this._alpha = 0;
this.enabled = false;
removeMovieClip(_root.InfoBox);
PlatedResearch.enabled = true;
PlatedResearch._alpha = 100;
}
};
PlatedPurchase.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
PlatedPurchase.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
StealthPurchase.onRollOver = function () {
attachMovie("PurchaseInfoReverse", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Research";
_root.InfoBox.Title.text = "Stealth Chassis";
_root.InfoBox.Info.text = "[Beat Hard Boss] \n\n Increases Speed, Decreases Armor";
};
StealthPurchase.onRelease = function () {
if (LevelsUnlocked >= 18) {
StealthBought = true;
this._alpha = 0;
this.enabled = false;
removeMovieClip(_root.InfoBox);
StealthResearch.enabled = true;
StealthResearch._alpha = 100;
}
};
StealthPurchase.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
StealthPurchase.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
WideResearch.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Equip";
_root.InfoBox.Title.text = "Wide Modifier";
_root.InfoBox.Info.text = "Increases your barrel width";
};
WideResearch.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
WideResearch.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
NarrowResearch.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Equip";
_root.InfoBox.Title.text = "Narrow Modifier";
_root.InfoBox.Info.text = "Decreases your barrel width";
};
NarrowResearch.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
NarrowResearch.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
LongResearch.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Equip";
_root.InfoBox.Title.text = "Long Modifier";
_root.InfoBox.Info.text = "Increases your barrel length \n Prereq: Tier 1 Equipped";
};
LongResearch.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
LongResearch.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
ShortResearch.onRollOver = function () {
attachMovie("PurchaseInfo", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Equip";
_root.InfoBox.Title.text = "Short Modifier";
_root.InfoBox.Info.text = "Decreases your barrel length \n Prereq: Tier 1 Equipped";
};
ShortResearch.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
ShortResearch.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
PlatedResearch.onRollOver = function () {
attachMovie("PurchaseInfoReverse", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Equip";
_root.InfoBox.Title.text = "Plated Chassis";
_root.InfoBox.Info.text = "Increases Armor, Decreases Speed";
};
PlatedResearch.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
PlatedResearch.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
StealthResearch.onRollOver = function () {
attachMovie("PurchaseInfoReverse", "InfoBox", _root.getNextHighestDepth(), {_x:_xmouse, _y:_ymouse});
_root.InfoBox.Header.text = "Equip";
_root.InfoBox.Title.text = "Stealth Chassis";
_root.InfoBox.Info.text = "Increases Speed, Decreases Armor";
};
StealthResearch.onRollOut = function () {
removeMovieClip(_root.InfoBox);
};
StealthResearch.onReleaseOutside = function () {
removeMovieClip(_root.InfoBox);
};
this.onEnterFrame = function () {
if (Chassis.Info.text == "Chassis") {
ChassisInfo.text = "Basic Chassis";
ChassisSlotInfo = "Basic";
ChassisChoice = "Basic";
player_mc.Chassis.gotoAndStop("Basic");
}
if (Chassis.Info.text == "Plated") {
ChassisInfo.text = "Plated Chassis";
ChassisSlotInfo = "Plated";
ChassisChoice = "Plated";
player_mc.Chassis.gotoAndStop("Plated");
}
if (Chassis.Info.text == "Stealth") {
ChassisInfo.text = "Stealth Chassis";
ChassisSlotInfo = "Stealth";
ChassisChoice = "Stealth";
player_mc.Chassis.gotoAndStop("Stealth");
}
if (WeaponSlot1.Info.text == "Tier 1") {
WeaponSlot2.Info.text = "Tier 2";
WeaponSlot1Info = "Tier 1";
WeaponSlot2Info = "Tier 2";
CannonInfo.text = "Standard Cannon";
WeaponChoice = "Standard";
player_mc.muzzle.gotoAndStop("Standard");
}
if (WeaponSlot1.Info.text == "Wide") {
CannonInfo.text = "Spread Cannon";
WeaponSlot1Info = "Wide";
WeaponSlot2Info = "Tier 2";
WeaponChoice = "Spread";
player_mc.muzzle.gotoAndStop("Spread");
}
if (WeaponSlot1.Info.text == "Narrow") {
CannonInfo.text = "Typewriter Cannon";
WeaponSlot1Info = "Narrow";
WeaponSlot2Info = "Tier 2";
WeaponChoice = "Typewriter";
player_mc.muzzle.gotoAndStop("Typewriter");
}
if ((WeaponSlot2.Info.text == "Long") and (WeaponSlot1.Info.text == "Wide")) {
CannonInfo.text = "Wall Cannon";
WeaponSlot1Info = "Wide";
WeaponSlot2Info = "Long";
WeaponChoice = "Wall";
player_mc.muzzle.gotoAndStop("Wall");
}
if ((WeaponSlot2.Info.text == "Short") and (WeaponSlot1.Info.text == "Wide")) {
CannonInfo.text = "Jackhammer Cannon";
WeaponSlot1Info = "Wide";
WeaponSlot2Info = "Short";
WeaponChoice = "Jackhammer";
player_mc.muzzle.gotoAndStop("Jackhammer");
}
if ((WeaponSlot2.Info.text == "Long") and (WeaponSlot1.Info.text == "Narrow")) {
CannonInfo.text = "Distance Cannon";
WeaponSlot1Info = "Narrow";
WeaponSlot2Info = "Long";
WeaponChoice = "Distance";
player_mc.muzzle.gotoAndStop("Distance");
}
if ((WeaponSlot2.Info.text == "Short") and (WeaponSlot1.Info.text == "Narrow")) {
CannonInfo.text = "Beam Cannon";
WeaponSlot1Info = "Narrow";
WeaponSlot2Info = "Short";
WeaponChoice = "Beam";
player_mc.muzzle.gotoAndStop("Beam");
}
XPSpendInfo.text = "Research XP: " + TotalXPtoSpend;
CharacterLevelInfo.text = "Ship Level: " + CharacterLevel;
_root.InfoBox._x = _xmouse;
_root.InfoBox._y = _ymouse;
};
Frame 6
function loadWeapon(weaponType) {
switch (weaponType) {
case "Standard" :
bulletNumber = 1;
bulletOffset = 4;
bulletSpeed = 5;
bulletMaxAge = 2500;
reloadSpeed = 400;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Standard");
bulletGraphic = "StandardBullet";
weaponSound = "Standard";
weaponInfo.text = "Standard Cannon";
break;
case "Spread" :
bulletNumber = 8;
bulletOffset = 40;
bulletSpeed = 5;
bulletMaxAge = 600;
reloadSpeed = 1200;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Spread");
bulletGraphic = "StandardBullet";
weaponSound = "Spread";
weaponInfo.text = "Spread Cannon";
break;
case "Typewriter" :
bulletNumber = 1;
bulletOffset = 40;
bulletSpeed = 5;
bulletMaxAge = 1200;
reloadSpeed = 180;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Typewriter");
bulletGraphic = "StandardBullet";
weaponSound = "Typewriter";
weaponInfo.text = "Typewriter Cannon";
break;
case "Distance" :
bulletNumber = 1;
bulletOffset = 1;
bulletSpeed = 8;
bulletMaxAge = 2500;
reloadSpeed = 900;
Piercing = 1;
player_mc.muzzle.gotoAndStop("Distance");
bulletGraphic = "DistanceBullet";
weaponSound = "Distance";
weaponInfo.text = "Distance Cannon";
break;
case "Wall" :
bulletNumber = 1;
bulletOffset = 1;
bulletSpeed = 5;
bulletMaxAge = 750;
reloadSpeed = 800;
Piercing = 1;
player_mc.muzzle.gotoAndStop("Wall");
bulletGraphic = "WallBullet";
weaponSound = "Wall";
weaponInfo.text = "Wall Cannon";
break;
case "Beam" :
bulletNumber = 1;
bulletOffset = 1;
bulletSpeed = 6;
bulletMaxAge = 800;
reloadSpeed = 200;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Beam");
bulletGraphic = "BeamBullet";
weaponSound = "Beam";
weaponInfo.text = "Beam Cannon";
break;
case "Jackhammer" :
bulletNumber = 8;
bulletOffset = 25;
bulletSpeed = 5;
bulletMaxAge = 800;
reloadSpeed = 600;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Jackhammer");
bulletGraphic = "JackhammerBullet";
weaponSound = "Jackhammer";
weaponInfo.text = "Jackhammer Cannon";
}
}
function loadChassis(chassisType) {
switch (chassisType) {
case "Basic" :
player_mc.Chassis.gotoAndStop(chassisType);
BallSpeed = 3;
ArmorRating = 3;
break;
case "Plated" :
player_mc.Chassis.gotoAndStop(chassisType);
BallSpeed = 2;
ArmorRating = 5;
break;
case "Stealth" :
player_mc.Chassis.gotoAndStop(chassisType);
BallSpeed = 4;
ArmorRating = 1;
}
}
function fireWeapon() {
if ((reloadComplete and mouseClicked) and (ClickPaused == false)) {
createBullet();
mySound.start();
}
}
function createBullet() {
var _local5 = 0;
while (_local5 < bulletNumber) {
var _local3 = _root.attachMovie(bulletGraphic, "b" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3.swapDepths(player_mc);
player_mc.swapDepths(ArmorInfo_mc);
var _local4 = {x:player_mc.muzzle._x, y:player_mc.muzzle._y};
player_mc.localToGlobal(_local4);
_local3._x = _local4.x;
_local3._y = _local4.y;
_local3._rotation = player_mc._rotation;
var _local6 = random(bulletOffset) - (bulletOffset / 2);
_local3.bulletAngle = (((player_mc._rotation + _local6) - 90) * Math.PI) / 180;
_local3.xSpeed = Math.cos(_local3.bulletAngle) * bulletSpeed;
_local3.ySpeed = Math.sin(_local3.bulletAngle) * bulletSpeed;
_local3.lifeTimer = setInterval(destroyBullet, bulletMaxAge, _local3);
_local3.onEnterFrame = function () {
if (Paused == false) {
this._x = this._x + this.xSpeed;
this._y = this._y + this.ySpeed;
}
j = 0;
while (j < enemies.length) {
n = enemies[j];
if (_root["enemy" + n].hitTest(this)) {
if (Piercing == 0) {
destroyBullet(this);
}
if (hp[n] > 1) {
hp[n]--;
_root["enemyHP" + n].HP.text = hp[n];
mySound3.start();
createExplosion(_root["enemy" + n]._x, _root["enemy" + n]._y, n);
} else {
mySound4.start();
createExplosion(_root["enemy" + n]._x, _root["enemy" + n]._y, n);
removeMovieClip(_root["enemy" + n]);
removeMovieClip(_root["enemyHP" + n]);
XP = XP + EnemyType[currShape[n]][18];
TotalXP = TotalXP + EnemyType[currShape[n]][18];
TotalXPtoSpend = TotalXPtoSpend + EnemyType[currShape[n]][18];
KillCounter++;
KillCounterTotal++;
KillInfo.text = (("Cuboids Erased: " + KillCounter) + "/") + EnemyCounterTotal;
}
}
j++;
}
};
_local5++;
}
startReloading();
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(gunReloaded, reloadSpeed);
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function destroyBullet(bullet) {
clearInterval(bullet.lifeTimer);
bullet.removeMovieClip();
bullet.unloadMovie();
}
function rotatePlayer() {
playerX = player_mc._x;
playerY = player_mc._y;
rotationDirection = Math.round(180 - ((Math.atan2(_root._xmouse - playerX, _root._ymouse - playerY) * 180) / Math.PI));
player_mc._rotation = rotationDirection;
}
function doFollow(follower, target, EnemyNum) {
if (currShape[EnemyNum] == 2) {
randomZag = random(200) - 200;
distanceX[EnemyNum] = (target._x + randomZag) - follower._x;
distanceY[EnemyNum] = (target._y + randomZag) - follower._y;
} else {
distanceX[EnemyNum] = target._x - follower._x;
distanceY[EnemyNum] = target._y - follower._y;
}
distanceTotal[EnemyNum] = Math.sqrt((distanceX[EnemyNum] * distanceX[EnemyNum]) + (distanceY[EnemyNum] * distanceY[EnemyNum]));
if (distanceTotal[EnemyNum] <= agroRange[EnemyNum]) {
moveDistanceX[EnemyNum] = (turnRate[EnemyNum] * distanceX[EnemyNum]) / distanceTotal[EnemyNum];
moveDistanceY[EnemyNum] = (turnRate[EnemyNum] * distanceY[EnemyNum]) / distanceTotal[EnemyNum];
moveX[EnemyNum] = moveX[EnemyNum] + moveDistanceX[EnemyNum];
moveY[EnemyNum] = moveY[EnemyNum] + moveDistanceY[EnemyNum];
totalmove[EnemyNum] = Math.sqrt((moveX[EnemyNum] * moveX[EnemyNum]) + (moveY[EnemyNum] * moveY[EnemyNum]));
moveX[EnemyNum] = (speed[EnemyNum] * moveX[EnemyNum]) / totalmove[EnemyNum];
moveY[EnemyNum] = (speed[EnemyNum] * moveY[EnemyNum]) / totalmove[EnemyNum];
follower._x = follower._x + moveX[EnemyNum];
follower._y = follower._y + moveY[EnemyNum];
if (currShape[EnemyNum] == 2) {
follower._rotation = follower._rotation + 5;
} else if (currShape[EnemyNum] == 4) {
follower._rotation = follower._rotation + 4;
} else if (currShape[EnemyNum] == 6) {
follower._rotation = follower._rotation + 6;
} else if (currShape[EnemyNum] == 7) {
follower._rotation = follower._rotation - 2;
} else {
follower._rotation = (180 * Math.atan2(moveY[EnemyNum], moveX[EnemyNum])) / Math.PI;
}
}
}
function createExplosion(targetX, targetY, EnemyDeathNum) {
var _local7 = 0;
while (_local7 < particleTotal[EnemyDeathNum]) {
var _local6 = flash.display.BitmapData.loadBitmap(DeathParticle[EnemyDeathNum]);
var _local3 = _root.createEmptyMovieClip("main_holder", _root.getNextHighestDepth());
var _local5 = _local3.createEmptyMovieClip("internal_holder", _local3.getNextHighestDepth());
_local5._x = (-_local6.width) / 2;
_local5._y = (-_local6.height) / 2;
_local5.attachBitmap(_local6, _local5.getNextHighestDepth(), "never");
_local3._x = targetX;
_local3._y = targetY;
_local3._rotation = random(360);
_local3._alpha = random(50) + 50;
_local3.boundyLeft = targetX - particleRange[EnemyDeathNum];
_local3.boundyTop = targetY - particleRange[EnemyDeathNum];
_local3.boundyRight = targetX + particleRange[EnemyDeathNum];
_local3.boundyBottom = targetY + particleRange[EnemyDeathNum];
_local3.speedX = Math.random(particleMaxSpeed[EnemyDeathNum]) - Math.random(particleMaxSpeed[EnemyDeathNum]);
_local3.speedY = Math.random(particleMaxSpeed[EnemyDeathNum]) - Math.random(particleMaxSpeed[EnemyDeathNum]);
_local3.speedX = _local3.speedX * particleMaxSpeed[EnemyDeathNum];
_local3.speedY = _local3.speedY * particleMaxSpeed[EnemyDeathNum];
_local3.fadeSpeed = Math.random(particleFadeSpeed[EnemyDeathNum]) * particleFadeSpeed[EnemyDeathNum];
numberOfParticles++;
_local3.onEnterFrame = function () {
this._alpha = this._alpha - this.fadeSpeed;
this._x = this._x + this.speedX;
this._y = this._y + this.speedY;
if (((((this._alpha <= 0) || (this._x < this.boundyLeft)) || (this._x > this.boundyRight)) || (this._y < this.boundyTop)) || (this._y > this.boundyBottom)) {
this.removeMovieClip();
numberOfParticles--;
}
};
_local7++;
}
}
function FinishLevel() {
delete _root.onEnterFrame;
j = 0;
while (j < enemies.length) {
n = enemies[j];
removeMovieClip(_root["enemy" + n]);
removeMovieClip(_root["enemyHP" + n]);
j++;
}
removeMovieClip(player_mc);
removeMovieClip(ArmorInfo_mc);
mouseClicked = false;
Mouse.removeListener(mouseListener);
Mouse.show();
bgMusic.stop();
mochi.as2.MochiAd.showInterLevelAd({id:"cef40ee0d09b338c", res:"550x450"});
}
function checkCollision(mc1, mc2) {
var _local2 = com.gskinner.sprites.CollisionDetection.checkForCollision(mc1, mc2, 120);
if (_local2) {
mySound2.start();
if (ArmorRating <= 1) {
createExplosion(player_mc._x, player_mc._y, -5);
unloadMovie (player_mc);
removeMovieClip(ArmorInfo_mc);
ClickPaused = true;
LevelFailed = true;
} else {
createExplosion(_root["enemy" + n]._x, _root["enemy" + n]._y, n);
if (hp[n] > 1) {
hp[n]--;
_root["enemyHP" + n].HP.text = hp[n];
ArmorRating--;
} else {
ArmorRating--;
removeMovieClip(_root["enemy" + n]);
removeMovieClip(_root["enemyHP" + n]);
KillCounter++;
KillCounterTotal++;
KillInfo.text = (("Cuboids Erased: " + KillCounter) + "/") + EnemyCounterTotal;
}
}
}
}
stop();
bgMusic.stop();
bgMusic.start(1, 100);
Mouse.hide();
LevelInfo.text = LevelName;
PauseScreen._alpha = 0;
PauseScreen.enabled = false;
LevelComplete._alpha = 0;
LevelComplete.CompleteInfo.text = "";
var BossSpawn = 1;
var currShape = new Array();
var hp = new Array();
var speed = new Array();
var turnRate = new Array();
var agroRange = new Array();
var moveX = new Array();
var moveY = new Array();
var distanceX = new Array();
var distanceY = new Array();
var distanceTotal = new Array();
var moveDistanceX = new Array();
var moveDistanceY = new Array();
var totalmove = new Array();
var DeathParticle = new Array();
var particleMaxSpeed = new Array();
var particleFadeSpeed = new Array();
var particleTotal = new Array();
var particleRange = new Array();
particleMaxSpeed[-5] = 4;
particleFadeSpeed[-5] = 2;
particleTotal[-5] = 200;
particleRange[-5] = 1000;
DeathParticle[-5] = "Player_Particle";
var bulletNumber;
var bulletOffset;
var bulletSpeed;
var bulletMaxAge;
var reloadSpeed;
var Piercing;
var bulletGraphic = "None";
var weaponSound = "None";
var reloadTimer;
var reloadComplete = true;
var mouseClicked = false;
var radians = (Math.PI/180);
var radians2 = 57.2957795130823;
var i = 0;
var LevelFailed = false;
var LevelCompleted = false;
var Paused = false;
var ClickPaused = false;
var KillCounter = 0;
var enemies = new Array();
var enemyType = new Array();
var ArmorRating = 0;
var BallSpeed = 0;
var BallSpeedx = 0;
var BallSpeedy = 0;
var Friction = 0.8;
var DirectionFriction = 0.9;
var noControlTimer = 20;
var EndLevelCounter = 180;
loadWeapon(WeaponChoice);
loadChassis(ChassisChoice);
attachMovie("ArmorInfo_mc", "ArmorInfo_mc", _root.getNextHighestDepth(), {_x:player_mc._x, _y:player_mc._y});
XPBar._xscale = (XP / XPGuide[CharacterLevel]) * 100;
XPInfo.text = (("XP: " + XP) + "/") + XPGuide[CharacterLevel];
KillInfo.text = (("Cuboids Erased: " + KillCounter) + "/") + EnemyCounterTotal;
mySound = new Sound(this);
mySound.attachSound(weaponSound);
mySound.setVolume(60);
mySound2 = new Sound(this);
mySound2.attachSound("ArmorHit");
mySound2.setVolume(75);
mySound3 = new Sound(this);
mySound3.attachSound("Enemy_Hit");
mySound3.setVolume(60);
mySound4 = new Sound(this);
mySound4.attachSound("Enemy_Death");
mySound4.setVolume(60);
mouseListener = new Object();
mouseListener.onMouseDown = function () {
if ((Paused == false) and (ClickPaused == false)) {
mouseClicked = true;
}
};
mouseListener.onMouseUp = function () {
mouseClicked = false;
};
Mouse.addListener(mouseListener);
this.onEnterFrame = function () {
ArmorInfo_mc.ArmorInfo.text = ArmorRating;
ArmorInfo_mc._x = player_mc._x;
ArmorInfo_mc._y = player_mc._y;
XPInfo.text = (("XP: " + XP) + "/") + XPGuide[CharacterLevel];
CharacterLevelInfo.text = "Ship Level: " + CharacterLevel;
XPBar._xscale = (XP / XPGuide[CharacterLevel]) * 100;
if (XP >= XPGuide[CharacterLevel]) {
CharacterLevel++;
XP = 0;
}
if ((LevelCompleted == false) and (LevelFailed == false)) {
if (Key.isDown(80)) {
if (Paused == false) {
Paused = true;
player_mc._alpha = 25;
j = 0;
while (j < enemies.length) {
n = enemies[j];
_root["enemy" + n]._alpha = 25;
j++;
}
Mouse.show();
Crosshair._alpha = 0;
PauseScreen._alpha = 75;
PauseScreen.enabled = true;
PauseScreen.swapDepths(_root["enemy" + i]);
}
}
}
if (Paused == false) {
fireWeapon();
rotatePlayer();
Crosshair._x = _xmouse;
Crosshair._y = _ymouse;
if ((random(SpawnRate) == 0) and (EnemyCounter > 0)) {
randomPos = random(3);
if (randomPos == 0) {
randomPosX = random(550);
randomPosY = -50;
}
if (randomPos == 1) {
randomPosX = random(550);
randomPosY = 500;
}
if (randomPos == 2) {
randomPosX = -50;
randomPosY = random(450);
}
if (randomPos == 3) {
randomPosX = 600;
randomPosY = random(450);
}
if ((((currStage == 6) or (currStage == 12)) or (currStage == 18)) and (BossSpawn == 1)) {
BossSpawn = 0;
randomShape = 0;
} else {
randomShape = random(EnemyShape.length);
}
attachMovie(EnemyType[EnemyShape[randomShape]][0], "enemy" + i, getNextHighestDepth(), {_x:randomPosX, _y:randomPosY});
EnemyCounter--;
currShape[i] = EnemyShape[randomShape];
hp[i] = EnemyType[EnemyShape[randomShape]][1];
speed[i] = EnemyType[EnemyShape[randomShape]][2];
turnRate[i] = EnemyType[EnemyShape[randomShape]][3];
agroRange[i] = EnemyType[EnemyShape[randomShape]][4];
moveX[i] = EnemyType[EnemyShape[randomShape]][5];
moveY[i] = EnemyType[EnemyShape[randomShape]][6];
DeathParticle[i] = EnemyType[EnemyShape[randomShape]][7];
particleMaxSpeed[i] = EnemyType[EnemyShape[randomShape]][8];
particleFadeSpeed[i] = EnemyType[EnemyShape[randomShape]][9];
particleTotal[i] = EnemyType[EnemyShape[randomShape]][10];
particleRange[i] = EnemyType[EnemyShape[randomShape]][11];
if (EnemyType[EnemyShape[randomShape]][0] == "LightBlueCarrier_Container") {
attachMovie("EnemyHP_Black", "enemyHP" + i, getNextHighestDepth(), {_x:-50, _y:-50});
_root["enemyHP" + i].HP.text = hp[i];
}
if (EnemyType[EnemyShape[randomShape]][0] == "BrownMine_Container") {
attachMovie("EnemyHP_White", "enemyHP" + i, getNextHighestDepth(), {_x:-50, _y:-50});
_root["enemyHP" + i].HP.text = hp[i];
}
if (EnemyType[EnemyShape[randomShape]][0] == "DarkGreenPentagon_Container") {
attachMovie("EnemyHP_Black", "enemyHP" + i, getNextHighestDepth(), {_x:-50, _y:-50});
_root["enemyHP" + i].HP.text = hp[i];
}
if (EnemyType[EnemyShape[randomShape]][0] == "BlackMothership_Container") {
attachMovie("EnemyHP_White", "enemyHP" + i, getNextHighestDepth(), {_x:-50, _y:-50});
_root["enemyHP" + i].HP.text = hp[i];
}
distanceX[i] = EnemyType[EnemyShape[randomShape]][12];
distanceY[i] = EnemyType[EnemyShape[randomShape]][13];
distanceTotal[i] = EnemyType[EnemyShape[randomShape]][14];
moveDistanceX[i] = EnemyType[EnemyShape[randomShape]][15];
moveDistanceY[i] = EnemyType[EnemyShape[randomShape]][16];
totalmove[i] = EnemyType[EnemyShape[randomShape]][17];
if (BossSpawn == 0) {
BossSpawn = -1;
EnemyShape.splice(0, 1);
}
enemies[enemies.length] = i;
i++;
}
if (KillCounter >= EnemyCounterTotal) {
if (EndLevelCounter > 0) {
EndLevelCounter--;
LevelCompleted = true;
LevelComplete._alpha = 100;
LevelComplete.CompleteInfo.text = "Level Completed";
} else {
if (LevelsUnlocked == currStage) {
LevelsUnlocked++;
}
FinishLevel();
}
}
j = 0;
while (j < enemies.length) {
n = enemies[j];
doFollow(_root["enemy" + n], player_mc, n);
_root["enemyHP" + n]._x = _root["enemy" + n]._x;
_root["enemyHP" + n]._y = _root["enemy" + n]._y;
if (LevelFailed == false) {
checkCollision(player_mc, _root["enemy" + n]);
}
j++;
}
if (LevelFailed == true) {
if (EndLevelCounter > 0) {
EndLevelCounter--;
LevelComplete._alpha = 100;
LevelComplete.CompleteInfo.text = "Level Failed";
} else {
FinishLevel();
LevelsFailed++;
}
}
if (player_mc._x > 532) {
player_mc._x = player_mc._x - 0.5;
BallSpeedx = 0;
}
if (player_mc._x < 17) {
player_mc._x = player_mc._x + 0.5;
BallSpeedx = 0;
}
if (player_mc._y < 17) {
player_mc._y = player_mc._y + 0.5;
BallSpeedy = 0;
}
if (player_mc._y > 432) {
player_mc._y = player_mc._y - 0.5;
BallSpeedy = 0;
}
player_mc._x = player_mc._x + BallSpeedx;
player_mc._y = player_mc._y + BallSpeedy;
if (noControlTimer > 0) {
noControlTimer--;
} else {
if (Key.isDown(87) or Key.isDown(38)) {
BallSpeedy = -BallSpeed;
BallSpeedx = BallSpeedx * DirectionFriction;
}
if (Key.isDown(83) or Key.isDown(40)) {
BallSpeedy = BallSpeed;
BallSpeedx = BallSpeedx * DirectionFriction;
}
if (Key.isDown(68) or Key.isDown(39)) {
BallSpeedx = BallSpeed;
BallSpeedy = BallSpeedy * DirectionFriction;
}
if (Key.isDown(65) or Key.isDown(37)) {
BallSpeedx = -BallSpeed;
BallSpeedy = BallSpeedy * DirectionFriction;
}
}
BallSpeedx = BallSpeedx * Friction;
BallSpeedy = BallSpeedy * Friction;
}
};
Frame 7
function TimerIncrease() {
LevelTimer++;
}
function loadWeapon(weaponType) {
switch (weaponType) {
case "Standard" :
bulletNumber = 1;
bulletOffset = 4;
bulletSpeed = 5;
bulletMaxAge = 2500;
reloadSpeed = 400;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Standard");
bulletGraphic = "StandardBullet";
weaponSound = "Standard";
weaponInfo.text = "Standard Cannon";
break;
case "Spread" :
bulletNumber = 8;
bulletOffset = 40;
bulletSpeed = 5;
bulletMaxAge = 600;
reloadSpeed = 1200;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Spread");
bulletGraphic = "StandardBullet";
weaponSound = "Spread";
weaponInfo.text = "Spread Cannon";
break;
case "Typewriter" :
bulletNumber = 1;
bulletOffset = 40;
bulletSpeed = 5;
bulletMaxAge = 1200;
reloadSpeed = 180;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Typewriter");
bulletGraphic = "StandardBullet";
weaponSound = "Typewriter";
weaponInfo.text = "Typewriter Cannon";
break;
case "Distance" :
bulletNumber = 1;
bulletOffset = 1;
bulletSpeed = 8;
bulletMaxAge = 2500;
reloadSpeed = 900;
Piercing = 1;
player_mc.muzzle.gotoAndStop("Distance");
bulletGraphic = "DistanceBullet";
weaponSound = "Distance";
weaponInfo.text = "Distance Cannon";
break;
case "Wall" :
bulletNumber = 1;
bulletOffset = 1;
bulletSpeed = 5;
bulletMaxAge = 750;
reloadSpeed = 800;
Piercing = 1;
player_mc.muzzle.gotoAndStop("Wall");
bulletGraphic = "WallBullet";
weaponSound = "Wall";
weaponInfo.text = "Wall Cannon";
break;
case "Beam" :
bulletNumber = 1;
bulletOffset = 1;
bulletSpeed = 6;
bulletMaxAge = 800;
reloadSpeed = 200;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Beam");
bulletGraphic = "BeamBullet";
weaponSound = "Beam";
weaponInfo.text = "Beam Cannon";
break;
case "Jackhammer" :
bulletNumber = 8;
bulletOffset = 25;
bulletSpeed = 5;
bulletMaxAge = 800;
reloadSpeed = 600;
Piercing = 0;
player_mc.muzzle.gotoAndStop("Jackhammer");
bulletGraphic = "JackhammerBullet";
weaponSound = "Jackhammer";
weaponInfo.text = "Jackhammer Cannon";
}
}
function loadChassis(chassisType) {
switch (chassisType) {
case "Basic" :
player_mc.Chassis.gotoAndStop(chassisType);
BallSpeed = 3;
ArmorRating = 3;
break;
case "Plated" :
player_mc.Chassis.gotoAndStop(chassisType);
BallSpeed = 2;
ArmorRating = 5;
break;
case "Stealth" :
player_mc.Chassis.gotoAndStop(chassisType);
BallSpeed = 4;
ArmorRating = 1;
}
}
function fireWeapon() {
if ((reloadComplete and mouseClicked) and (ClickPaused == false)) {
createBullet();
mySound.start();
}
}
function createBullet() {
var _local5 = 0;
while (_local5 < bulletNumber) {
var _local3 = _root.attachMovie(bulletGraphic, "b" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3.swapDepths(player_mc);
player_mc.swapDepths(ArmorInfo_mc);
var _local4 = {x:player_mc.muzzle._x, y:player_mc.muzzle._y};
player_mc.localToGlobal(_local4);
_local3._x = _local4.x;
_local3._y = _local4.y;
_local3._rotation = player_mc._rotation;
var _local6 = random(bulletOffset) - (bulletOffset / 2);
_local3.bulletAngle = (((player_mc._rotation + _local6) - 90) * Math.PI) / 180;
_local3.xSpeed = Math.cos(_local3.bulletAngle) * bulletSpeed;
_local3.ySpeed = Math.sin(_local3.bulletAngle) * bulletSpeed;
_local3.lifeTimer = setInterval(destroyBullet, bulletMaxAge, _local3);
_local3.onEnterFrame = function () {
if (Paused == false) {
this._x = this._x + this.xSpeed;
this._y = this._y + this.ySpeed;
}
j = 0;
while (j < enemies.length) {
n = enemies[j];
if (_root["enemy" + n].hitTest(this)) {
if (Piercing == 0) {
destroyBullet(this);
}
if (hp[n] > 1) {
hp[n]--;
_root["enemyHP" + n].HP.text = hp[n];
mySound3.start();
createExplosion(_root["enemy" + n]._x, _root["enemy" + n]._y, n);
} else {
mySound4.start();
createExplosion(_root["enemy" + n]._x, _root["enemy" + n]._y, n);
removeMovieClip(_root["enemy" + n]);
removeMovieClip(_root["enemyHP" + n]);
KillCounter++;
Score = Score + (EnemyType[currShape[n]][18] * Multiplier);
ScoreInfo.text = "Score: " + Score;
}
}
j++;
}
};
_local5++;
}
startReloading();
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(gunReloaded, reloadSpeed);
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function destroyBullet(bullet) {
clearInterval(bullet.lifeTimer);
bullet.removeMovieClip();
bullet.unloadMovie();
}
function rotatePlayer() {
playerX = player_mc._x;
playerY = player_mc._y;
rotationDirection = Math.round(180 - ((Math.atan2(_root._xmouse - playerX, _root._ymouse - playerY) * 180) / Math.PI));
player_mc._rotation = rotationDirection;
}
function doFollow(follower, target, EnemyNum) {
if (currShape[EnemyNum] == 2) {
randomZag = random(200) - 200;
distanceX[EnemyNum] = (target._x + randomZag) - follower._x;
distanceY[EnemyNum] = (target._y + randomZag) - follower._y;
} else {
distanceX[EnemyNum] = target._x - follower._x;
distanceY[EnemyNum] = target._y - follower._y;
}
distanceTotal[EnemyNum] = Math.sqrt((distanceX[EnemyNum] * distanceX[EnemyNum]) + (distanceY[EnemyNum] * distanceY[EnemyNum]));
if (distanceTotal[EnemyNum] <= agroRange[EnemyNum]) {
moveDistanceX[EnemyNum] = (turnRate[EnemyNum] * distanceX[EnemyNum]) / distanceTotal[EnemyNum];
moveDistanceY[EnemyNum] = (turnRate[EnemyNum] * distanceY[EnemyNum]) / distanceTotal[EnemyNum];
moveX[EnemyNum] = moveX[EnemyNum] + moveDistanceX[EnemyNum];
moveY[EnemyNum] = moveY[EnemyNum] + moveDistanceY[EnemyNum];
totalmove[EnemyNum] = Math.sqrt((moveX[EnemyNum] * moveX[EnemyNum]) + (moveY[EnemyNum] * moveY[EnemyNum]));
moveX[EnemyNum] = (speed[EnemyNum] * moveX[EnemyNum]) / totalmove[EnemyNum];
moveY[EnemyNum] = (speed[EnemyNum] * moveY[EnemyNum]) / totalmove[EnemyNum];
follower._x = follower._x + moveX[EnemyNum];
follower._y = follower._y + moveY[EnemyNum];
if (currShape[EnemyNum] == 2) {
follower._rotation = follower._rotation + 5;
} else if (currShape[EnemyNum] == 4) {
follower._rotation = follower._rotation + 4;
} else if (currShape[EnemyNum] == 6) {
follower._rotation = follower._rotation + 6;
} else if (currShape[EnemyNum] == 7) {
follower._rotation = follower._rotation - 2;
} else {
follower._rotation = (180 * Math.atan2(moveY[EnemyNum], moveX[EnemyNum])) / Math.PI;
}
}
}
function createExplosion(targetX, targetY, EnemyDeathNum) {
var _local7 = 0;
while (_local7 < particleTotal[EnemyDeathNum]) {
var _local6 = flash.display.BitmapData.loadBitmap(DeathParticle[EnemyDeathNum]);
var _local3 = _root.createEmptyMovieClip("main_holder", _root.getNextHighestDepth());
var _local5 = _local3.createEmptyMovieClip("internal_holder", _local3.getNextHighestDepth());
_local5._x = (-_local6.width) / 2;
_local5._y = (-_local6.height) / 2;
_local5.attachBitmap(_local6, _local5.getNextHighestDepth(), "never");
_local3._x = targetX;
_local3._y = targetY;
_local3._rotation = random(360);
_local3._alpha = random(50) + 50;
_local3.boundyLeft = targetX - particleRange[EnemyDeathNum];
_local3.boundyTop = targetY - particleRange[EnemyDeathNum];
_local3.boundyRight = targetX + particleRange[EnemyDeathNum];
_local3.boundyBottom = targetY + particleRange[EnemyDeathNum];
_local3.speedX = Math.random(particleMaxSpeed[EnemyDeathNum]) - Math.random(particleMaxSpeed[EnemyDeathNum]);
_local3.speedY = Math.random(particleMaxSpeed[EnemyDeathNum]) - Math.random(particleMaxSpeed[EnemyDeathNum]);
_local3.speedX = _local3.speedX * particleMaxSpeed[EnemyDeathNum];
_local3.speedY = _local3.speedY * particleMaxSpeed[EnemyDeathNum];
_local3.fadeSpeed = Math.random(particleFadeSpeed[EnemyDeathNum]) * particleFadeSpeed[EnemyDeathNum];
numberOfParticles++;
_local3.onEnterFrame = function () {
this._alpha = this._alpha - this.fadeSpeed;
this._x = this._x + this.speedX;
this._y = this._y + this.speedY;
if (((((this._alpha <= 0) || (this._x < this.boundyLeft)) || (this._x > this.boundyRight)) || (this._y < this.boundyTop)) || (this._y > this.boundyBottom)) {
this.removeMovieClip();
numberOfParticles--;
}
};
_local7++;
}
}
function FinishLevel() {
delete _root.onEnterFrame;
clearInterval(LevelClock);
j = 0;
while (j < enemies.length) {
n = enemies[j];
removeMovieClip(_root["enemy" + n]);
removeMovieClip(_root["enemyHP" + n]);
j++;
}
removeMovieClip(player_mc);
removeMovieClip(ArmorInfo_mc);
mouseClicked = false;
Mouse.removeListener(mouseListener);
Mouse.show();
var _local3 = {n:[11, 2, 7, 6, 10, 0, 6, 8, 4, 3, 13, 0, 6, 10, 12, 0], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var _local4 = _local3.f(0, "");
bgMusic.stop();
mochi.as2.MochiScores.showLeaderboard({boardID:_local4, score:Score});
}
function checkCollision(mc1, mc2) {
var _local2 = com.gskinner.sprites.CollisionDetection.checkForCollision(mc1, mc2, 120);
if (_local2) {
mySound2.start();
if (ArmorRating <= 1) {
if (Lives <= 1) {
Lives--;
createExplosion(player_mc._x, player_mc._y, -5);
unloadMovie (player_mc);
removeMovieClip(ArmorInfo_mc);
ClickPaused = true;
LevelFailed = true;
} else {
Lives--;
createExplosion(player_mc._x, player_mc._y, -5);
j = 0;
while (j < enemies.length) {
n = enemies[j];
removeMovieClip(_root["enemy" + n]);
removeMovieClip(_root["enemyHP" + n]);
j++;
}
player_mc._x = 275;
player_mc._y = 225;
KillCounter = 0;
Multiplier = 1;
loadWeapon(WeaponChoice);
loadChassis(ChassisChoice);
}
} else {
createExplosion(_root["enemy" + n]._x, _root["enemy" + n]._y, n);
if (hp[n] > 1) {
hp[n]--;
_root["enemyHP" + n].HP.text = hp[n];
ArmorRating--;
} else {
ArmorRating--;
removeMovieClip(_root["enemy" + n]);
removeMovieClip(_root["enemyHP" + n]);
KillCounter++;
Score = Score + (EnemyType[currShape[n]][18] * Multiplier);
ScoreInfo.text = "Score: " + Score;
}
}
}
}
stop();
bgMusic.start(1, 100);
Mouse.hide();
var Lives = 3;
var Score = 0;
var Multiplier = 1;
var LevelTimer = 0;
var LevelClock = setInterval(TimerIncrease, 1000);
LevelInfo.text = LevelName;
PauseScreen._alpha = 0;
PauseScreen.enabled = false;
LevelComplete._alpha = 0;
LevelComplete.CompleteInfo.text = "";
var BossSpawn = 1;
var currShape = new Array();
var hp = new Array();
var speed = new Array();
var turnRate = new Array();
var agroRange = new Array();
var moveX = new Array();
var moveY = new Array();
var distanceX = new Array();
var distanceY = new Array();
var distanceTotal = new Array();
var moveDistanceX = new Array();
var moveDistanceY = new Array();
var totalmove = new Array();
var DeathParticle = new Array();
var particleMaxSpeed = new Array();
var particleFadeSpeed = new Array();
var particleTotal = new Array();
var particleRange = new Array();
particleMaxSpeed[-5] = 4;
particleFadeSpeed[-5] = 2;
particleTotal[-5] = 200;
particleRange[-5] = 1000;
DeathParticle[-5] = "Player_Particle";
var bulletNumber;
var bulletOffset;
var bulletSpeed;
var bulletMaxAge;
var reloadSpeed;
var Piercing;
var bulletGraphic = "None";
var weaponSound = "None";
var reloadTimer;
var reloadComplete = true;
var mouseClicked = false;
var radians = (Math.PI/180);
var radians2 = 57.2957795130823;
var i = 0;
var LevelFailed = false;
var LevelCompleted = false;
var Paused = false;
var ClickPaused = false;
var KillCounter = 0;
var enemies = new Array();
var enemyType = new Array();
var ArmorRating = 0;
var BallSpeed = 0;
var BallSpeedx = 0;
var BallSpeedy = 0;
var Friction = 0.8;
var DirectionFriction = 0.9;
var noControlTimer = 20;
var EndLevelCounter = 180;
loadWeapon(WeaponChoice);
loadChassis(ChassisChoice);
attachMovie("ArmorInfo_mc", "ArmorInfo_mc", _root.getNextHighestDepth(), {_x:player_mc._x, _y:player_mc._y});
LivesInfo.text = "Lives: " + Lives;
MultiplierInfo.text = Multiplier + "X Multiplier";
LevelTimerInfo.text = "Time Elapsed: " + LevelTimer;
ScoreInfo.text = "Score: " + Score;
mySound = new Sound(this);
mySound.attachSound(weaponSound);
mySound.setVolume(60);
mySound2 = new Sound(this);
mySound2.attachSound("ArmorHit");
mySound2.setVolume(75);
mySound3 = new Sound(this);
mySound3.attachSound("Enemy_Hit");
mySound3.setVolume(60);
mySound4 = new Sound(this);
mySound4.attachSound("Enemy_Death");
mySound4.setVolume(60);
mouseListener = new Object();
mouseListener.onMouseDown = function () {
if ((Paused == false) and (ClickPaused == false)) {
mouseClicked = true;
}
};
mouseListener.onMouseUp = function () {
mouseClicked = false;
};
Mouse.addListener(mouseListener);
this.onEnterFrame = function () {
if (KillCounter >= 10) {
Multiplier = 2;
}
if (KillCounter >= 25) {
Multiplier = 3;
}
if (KillCounter >= 50) {
Multiplier = 4;
}
if (LevelTimer == 10) {
EnemyShape.push(1);
}
if (LevelTimer == 20) {
EnemyShape.push(2);
}
if (LevelTimer == 30) {
EnemyShape.push(3);
}
if (LevelTimer == 40) {
EnemyShape.push(4);
}
if (LevelTimer == 50) {
EnemyShape.push(6);
}
if (LevelTimer == 60) {
EnemyShape.push(7);
}
if (LevelTimer == 70) {
SpawnRate = 45;
}
if (LevelTimer == 80) {
SpawnRate = 40;
}
if (LevelTimer == 90) {
SpawnRate = 35;
}
if (LevelTimer == 100) {
EnemyShape.push(8);
}
if (LevelTimer == 110) {
EnemyShape.push(9);
}
if (LevelTimer == 120) {
SpawnRate = 30;
}
if (LevelTimer == 130) {
SpawnRate = 25;
}
if (LevelTimer == 140) {
SpawnRate = 20;
}
ArmorInfo_mc.ArmorInfo.text = ArmorRating;
ArmorInfo_mc._x = player_mc._x;
ArmorInfo_mc._y = player_mc._y;
LivesInfo.text = "Lives: " + Lives;
MultiplierInfo.text = Multiplier + "X Multiplier";
LevelTimerInfo.text = "Time Elapsed: " + LevelTimer;
ScoreInfo.text = "Score: " + Score;
if ((LevelCompleted == false) and (LevelFailed == false)) {
if (Key.isDown(80)) {
if (Paused == false) {
Paused = true;
player_mc._alpha = 25;
j = 0;
while (j < enemies.length) {
n = enemies[j];
_root["enemy" + n]._alpha = 25;
j++;
}
Mouse.show();
Crosshair._alpha = 0;
PauseScreen._alpha = 75;
PauseScreen.enabled = true;
PauseScreen.swapDepths(_root["enemy" + i]);
}
}
}
if (Paused == false) {
fireWeapon();
rotatePlayer();
Crosshair._x = _xmouse;
Crosshair._y = _ymouse;
if ((random(SpawnRate) == 0) and (LevelFailed == false)) {
randomPos = random(3);
if (randomPos == 0) {
randomPosX = random(550);
randomPosY = -50;
}
if (randomPos == 1) {
randomPosX = random(550);
randomPosY = 500;
}
if (randomPos == 2) {
randomPosX = -50;
randomPosY = random(450);
}
if (randomPos == 3) {
randomPosX = 600;
randomPosY = random(450);
}
if ((((currStage == 6) or (currStage == 12)) or (currStage == 18)) and (BossSpawn == 1)) {
BossSpawn = 0;
randomShape = 0;
} else {
randomShape = random(EnemyShape.length);
}
attachMovie(EnemyType[EnemyShape[randomShape]][0], "enemy" + i, getNextHighestDepth(), {_x:randomPosX, _y:randomPosY});
currShape[i] = EnemyShape[randomShape];
hp[i] = EnemyType[EnemyShape[randomShape]][1];
speed[i] = EnemyType[EnemyShape[randomShape]][2];
turnRate[i] = EnemyType[EnemyShape[randomShape]][3];
agroRange[i] = EnemyType[EnemyShape[randomShape]][4];
moveX[i] = EnemyType[EnemyShape[randomShape]][5];
moveY[i] = EnemyType[EnemyShape[randomShape]][6];
DeathParticle[i] = EnemyType[EnemyShape[randomShape]][7];
particleMaxSpeed[i] = EnemyType[EnemyShape[randomShape]][8];
particleFadeSpeed[i] = EnemyType[EnemyShape[randomShape]][9];
particleTotal[i] = EnemyType[EnemyShape[randomShape]][10];
particleRange[i] = EnemyType[EnemyShape[randomShape]][11];
if (EnemyType[EnemyShape[randomShape]][0] == "LightBlueCarrier_Container") {
attachMovie("EnemyHP_Black", "enemyHP" + i, getNextHighestDepth(), {_x:-50, _y:-50});
_root["enemyHP" + i].HP.text = hp[i];
}
if (EnemyType[EnemyShape[randomShape]][0] == "BrownMine_Container") {
attachMovie("EnemyHP_White", "enemyHP" + i, getNextHighestDepth(), {_x:-50, _y:-50});
_root["enemyHP" + i].HP.text = hp[i];
}
if (EnemyType[EnemyShape[randomShape]][0] == "DarkGreenPentagon_Container") {
attachMovie("EnemyHP_Black", "enemyHP" + i, getNextHighestDepth(), {_x:-50, _y:-50});
_root["enemyHP" + i].HP.text = hp[i];
}
if (EnemyType[EnemyShape[randomShape]][0] == "BlackMothership_Container") {
attachMovie("EnemyHP_White", "enemyHP" + i, getNextHighestDepth(), {_x:-50, _y:-50});
_root["enemyHP" + i].HP.text = hp[i];
}
distanceX[i] = EnemyType[EnemyShape[randomShape]][12];
distanceY[i] = EnemyType[EnemyShape[randomShape]][13];
distanceTotal[i] = EnemyType[EnemyShape[randomShape]][14];
moveDistanceX[i] = EnemyType[EnemyShape[randomShape]][15];
moveDistanceY[i] = EnemyType[EnemyShape[randomShape]][16];
totalmove[i] = EnemyType[EnemyShape[randomShape]][17];
if (BossSpawn == 0) {
BossSpawn = -1;
EnemyShape.splice(0, 1);
}
enemies[enemies.length] = i;
i++;
}
j = 0;
while (j < enemies.length) {
n = enemies[j];
doFollow(_root["enemy" + n], player_mc, n);
_root["enemyHP" + n]._x = _root["enemy" + n]._x;
_root["enemyHP" + n]._y = _root["enemy" + n]._y;
if (LevelFailed == false) {
checkCollision(player_mc, _root["enemy" + n]);
}
j++;
}
if (Lives == 0) {
if (EndLevelCounter > 0) {
EndLevelCounter--;
LevelCompleted = true;
LevelComplete._alpha = 100;
LevelComplete.CompleteInfo.text = "Game Over";
} else {
FinishLevel();
}
}
if (player_mc._x > 532) {
player_mc._x = player_mc._x - 0.5;
BallSpeedx = 0;
}
if (player_mc._x < 17) {
player_mc._x = player_mc._x + 0.5;
BallSpeedx = 0;
}
if (player_mc._y < 17) {
player_mc._y = player_mc._y + 0.5;
BallSpeedy = 0;
}
if (player_mc._y > 432) {
player_mc._y = player_mc._y - 0.5;
BallSpeedy = 0;
}
player_mc._x = player_mc._x + BallSpeedx;
player_mc._y = player_mc._y + BallSpeedy;
if (noControlTimer > 0) {
noControlTimer--;
} else {
if (Key.isDown(87) or Key.isDown(38)) {
BallSpeedy = -BallSpeed;
BallSpeedx = BallSpeedx * DirectionFriction;
}
if (Key.isDown(83) or Key.isDown(40)) {
BallSpeedy = BallSpeed;
BallSpeedx = BallSpeedx * DirectionFriction;
}
if (Key.isDown(68) or Key.isDown(39)) {
BallSpeedx = BallSpeed;
BallSpeedy = BallSpeedy * DirectionFriction;
}
if (Key.isDown(65) or Key.isDown(37)) {
BallSpeedx = -BallSpeed;
BallSpeedy = BallSpeedy * DirectionFriction;
}
}
BallSpeedx = BallSpeedx * Friction;
BallSpeedy = BallSpeedy * Friction;
}
};
Symbol 218 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _loader, _loaderListener, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function get childClip() {
return(_clip);
}
static function getVersion() {
return("3.0");
}
static function allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function get isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function set comChannelName(val) {
if (val != undefined) {
if (val.length > 3) {
_sendChannelName = val + "_fromgame";
initComChannels();
}
}
//return(__get__comChannelName());
}
static function get connected() {
return(_connected);
}
static function connect(id, clip, onError) {
if ((!_connected) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.as2.MochiServices.onError = onError;
} else if (mochi.as2.MochiServices.onError == undefined) {
mochi.as2.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var _local3 = "_mochiservices_com_" + id;
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servicesURL != undefined) {
_servicesURL = urlOptions().servicesURL;
}
allowDomains(_servicesURL);
_clip = clip.createEmptyMovieClip(_local3, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, [errorCode]);
};
_loaderListener.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_loaderListener.startTime = getTimer();
_loaderListener.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_loaderListener.waitInterval = setInterval(_loaderListener, "wait", 1000);
_loader.addListener(_loaderListener);
_loader.loadClip((((_servicesURL + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.as2.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel._nextcallbackID = 0;
_listenChannel._callbacks = {};
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_clip, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _listenChannel._callbacks[_local1.callbackID];
}
delete _listenChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
if ((args.options != null) && (args.options.onError != null)) {
args.options.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
} else {
if ((_clip == undefined) || (!_connecting)) {
onError.apply(null, ["NotConnected"]);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
}
_listenChannel._callbacks[_listenChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_listenChannel._nextcallbackID++;
}
static function urlOptions() {
var _local5 = {};
if (_root.mochiad_options) {
var _local4 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
_local5[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local5);
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var _local2 = new Object();
_local2.mav = getVersion();
_local2.swfv = btn.getSWFVersion() || 6;
_local2.swfurl = btn._url;
_local2.fv = System.capabilities.version;
_local2.os = System.capabilities.os;
_local2.lang = System.capabilities.language;
_local2.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var _local3 = 0;
for (var _local6 in _local2) {
if (_local3 != 0) {
s = s + "&";
}
_local3++;
s = ((s + _local6) + "=") + escape(_local2[_local6]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var _local7 = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://x.mochiads.com/linkping.swf?t=" + getTimer());
_local7.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
mochi.as2.MochiServices.netup = false;
}
};
}
var _local4 = btn.createEmptyMovieClip("clk", 1001);
_local4._alpha = 0;
_local4.beginFill(1044735);
_local4.moveTo(0, 0);
_local4.lineTo(0, btn._height);
_local4.lineTo(btn._width, btn._height);
_local4.lineTo(btn._width, 0);
_local4.lineTo(0, 0);
_local4.endFill();
_local4.onRelease = function () {
if (mochi.as2.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static var _servicesURL = "http://www.mochiads.com/static/lib/services/services.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
}
Symbol 219 MovieClip [__Packages.mochi.as2.MochiAd] Frame 0
class mochi.as2.MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("3.0 as2");
}
static function showPreGameAd(options) {
var _local26 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.stop();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local2});
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local9 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local9);
var clip = options.clip;
var _local8 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.gotoAndStop(4);
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local7 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local7._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local7.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local7._mochiad_loaded = true;
if (_local7._url.indexOf("http") != 0) {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
}
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
mochi.as2.MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local9 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local9;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local9);
_local6.lc = _local5;
_local4.lc = _local9;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
if (clip._mochiad._containerLCName != undefined) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local3);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
}
Symbol 220 MovieClip [__Packages.com.gskinner.sprites.CollisionDetection] Frame 0
class com.gskinner.sprites.CollisionDetection
{
function CollisionDetection () {
}
static function checkForCollision(p_clip1, p_clip2, p_alphaTolerance) {
if (p_alphaTolerance == undefined) {
p_alphaTolerance = 255;
}
var _local4 = p_clip1.getBounds(_root);
var _local3 = p_clip2.getBounds(_root);
if (((_local4.xMax < _local3.xMin) || (_local3.xMax < _local4.xMin)) || ((_local4.yMax < _local3.yMin) || (_local3.yMax < _local4.yMin))) {
return(null);
}
var _local2 = {};
_local2.xMin = Math.max(_local4.xMin, _local3.xMin);
_local2.xMax = Math.min(_local4.xMax, _local3.xMax);
_local2.yMin = Math.max(_local4.yMin, _local3.yMin);
_local2.yMax = Math.min(_local4.yMax, _local3.yMax);
var _local7 = new flash.display.BitmapData(_local2.xMax - _local2.xMin, _local2.yMax - _local2.yMin, false);
var _local5 = p_clip1.transform.concatenatedMatrix;
_local5.tx = _local5.tx - _local2.xMin;
_local5.ty = _local5.ty - _local2.yMin;
_local7.draw(p_clip1, _local5, new flash.geom.ColorTransform(1, 1, 1, 1, 255, -255, -255, p_alphaTolerance));
_local5 = p_clip2.transform.concatenatedMatrix;
_local5.tx = _local5.tx - _local2.xMin;
_local5.ty = _local5.ty - _local2.yMin;
_local7.draw(p_clip2, _local5, new flash.geom.ColorTransform(1, 1, 1, 1, 255, 255, 255, p_alphaTolerance), "difference");
var _local6 = _local7.getColorBoundsRect(4294967295, 4278255615);
if (_local6.width == 0) {
return(null);
}
_local6.x = _local6.x + _local2.xMin;
_local6.y = _local6.y + _local2.yMin;
return(_local6);
}
}
Symbol 221 MovieClip [__Packages.mochi.as2.MochiScores] Frame 0
class mochi.as2.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.as2.MochiScores.boardID = boardID;
mochi.as2.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
if ((options.clip == null) || (options.clip == undefined)) {
options.clip = mochi.as2.MochiServices.clip;
}
if ((options.clip != mochi.as2.MochiServices.__get__clip()) || (mochi.as2.MochiServices.__get__childClip()._target == undefined)) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.connect(mochi.as2.MochiServices.__get__id(), options.clip);
}
delete options.clip;
if (options.name != null) {
if (typeof(options.name) == "object") {
if (options.name.text != undefined) {
options.name = options.name.text;
}
}
}
if (options.score != null) {
if (options.score instanceof TextField) {
if (options.score.text != undefined) {
options.score = options.score.text;
}
} else if (options.score instanceof mochi.as2.MochiDigits) {
options.score = options.score.value;
}
var _local1 = Number(options.score);
if (isNaN(_local1)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'");
} else if ((_local1 == Number.NEGATIVE_INFINITY) || (_local1 == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(_local1) != _local1) {
trace(("WARNING: Submitted score '" + options.score) + "' will be truncated");
}
options.score = _local1;
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.as2.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
mochi.as2.MochiServices.__get__clip().gotoAndStop(4);
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
mochi.as2.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
mochi.as2.MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
score = Number(score);
if (isNaN(score)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'");
} else if ((score == Number.NEGATIVE_INFINITY) || (score == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(score) != score) {
trace(("WARNING: Submitted score '" + String(score)) + "' will be truncated");
}
score = Number(score);
}
mochi.as2.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
static function scoresArrayToObjects(scores) {
var _local5 = {};
var _local1;
var _local4;
var _local2;
var _local6;
for (var _local8 in scores) {
if (typeof(scores[_local8]) == "object") {
if ((scores[_local8].cols != null) && (scores[_local8].rows != null)) {
_local5[_local8] = [];
_local2 = scores[_local8];
_local4 = 0;
while (_local4 < _local2.rows.length) {
_local6 = {};
_local1 = 0;
while (_local1 < _local2.cols.length) {
_local6[_local2.cols[_local1]] = _local2.rows[_local4][_local1];
_local1++;
}
_local5[_local8].push(_local6);
_local4++;
}
} else {
_local5[_local8] = {};
for (var _local7 in scores[_local8]) {
_local5[_local8][_local7] = scores[_local8][_local7];
}
}
} else {
_local5[_local8] = scores[_local8];
}
}
return(_local5);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 222 MovieClip [__Packages.mochi.as2.MochiDigits] Frame 0
class mochi.as2.MochiDigits
{
var Encoder, Fragment, Sibling;
function MochiDigits (digit, index) {
Encoder = 0;
setValue(digit, index);
}
function get value() {
return(Number(toString()));
}
function set value(v) {
setValue(v);
//return(value);
}
function addValue(v) {
value = value + v;
}
function setValue(digit, index) {
var _local3 = digit.toString();
if ((index == undefined) || (isNaN(index))) {
index = 0;
}
Fragment = _local3.charCodeAt(index++) ^ Encoder;
if (index < _local3.length) {
Sibling = new mochi.as2.MochiDigits(digit, index);
} else {
Sibling = null;
}
reencode();
}
function reencode() {
var _local2 = int(2147483647 * Math.random());
Fragment = Fragment ^ (_local2 ^ Encoder);
Encoder = _local2;
}
function toString() {
var _local2 = String.fromCharCode(Fragment ^ Encoder);
return(((Sibling != null) ? (_local2.concat(Sibling.toString())) : (_local2)));
}
}
Symbol 95 Button
on (release) {
_root.NewGame = true;
gotoAndPlay (3);
}
Symbol 99 Button
on (release) {
_root.LoadGame = true;
gotoAndPlay (3);
}
Symbol 109 MovieClip Frame 9
stop();
Symbol 113 Button
on (release) {
_root.closeMenu();
delete eval (_root.onEnterFrame());
_root.gotoAndStop(5);
}
on (keyPress "q") {
if (quality == "HIGH") {
_quality = "LOW";
quality = "LOW";
} else if (quality == "LOW") {
_quality = "MEDIUM";
quality = "MEDIUM";
} else {
_quality = "HIGH";
quality = "HIGH";
}
}
Symbol 130 Button
on (release) {
_root.closeMenu();
_root.LevelName = "Escalation - High Score Challenge";
_root.SpawnRate = 50;
_root.EnemyCounterTotal = 0;
_root.EnemyShape = [0];
delete eval (onEnterFrame());
gotoAndStop (7);
}
Symbol 132 Button
on (release) {
savefile.data.Saved = 1;
savefile.data.KillCounterTotal = _root.KillCounterTotal;
savefile.data.CharacterLevel = _root.CharacterLevel;
savefile.data.XP = _root.XP;
savefile.data.TotalXPtoSpend = _root.TotalXPtoSpend;
savefile.data.TotalXP = _root.TotalXP;
savefile.data.LevelsUnlocked = _root.LevelsUnlocked;
savefile.data.currStage = _root.currStage;
savefile.data.LevelsFailed = _root.LevelsFailed;
savefile.data.WeaponChoice = _root.WeaponChoice;
savefile.data.ChassisChoice = _root.ChassisChoice;
savefile.data.WeaponSlot1Info = _root.WeaponSlot1Info;
savefile.data.WeaponSlot2Info = _root.WeaponSlot2Info;
savefile.data.ChassisSlotInfo = _root.ChassisSlotInfo;
savefile.data.WideBought = _root.WideBought;
savefile.data.NarrowBought = _root.NarrowBought;
savefile.data.LongBought = _root.LongBought;
savefile.data.ShortBought = _root.ShortBought;
savefile.data.PlatedBought = _root.PlatedBought;
savefile.data.StealthBought = _root.StealthBought;
savefile.data.EscalationUnlocked = _root.EscalationUnlocked;
savefile.flush();
_root.SaveGameButton._alpha = 50;
_root.SaveGameButton.enabled = false;
}
Symbol 135 MovieClip Frame 1
stop();
Symbol 135 MovieClip Frame 2
stop();
Symbol 137 Button
on (release) {
if (_root.bgMusicEnabled == true) {
_root.bgMusic.stop();
_root.music_mc.gotoAndStop(2);
_root.bgMusicEnabled = false;
} else if (_root.bgMusicEnabled == false) {
_root.bgMusic.start(1, 100);
_root.bgMusic.setVolume(50);
_root.music_mc.gotoAndStop(1);
_root.bgMusicEnabled = true;
}
}
Symbol 145 Button
on (release) {
_root.gotoAndStop(4);
}
on (keyPress "q") {
if (quality == "HIGH") {
_quality = "LOW";
quality = "LOW";
} else if (quality == "LOW") {
_quality = "MEDIUM";
quality = "MEDIUM";
} else {
_quality = "HIGH";
quality = "HIGH";
}
}
Symbol 149 MovieClip Frame 1
stop();
Symbol 149 MovieClip Frame 2
stop();
Symbol 149 MovieClip Frame 3
stop();
Symbol 157 MovieClip Frame 1
stop();
Symbol 157 MovieClip Frame 2
stop();
Symbol 157 MovieClip Frame 3
stop();
Symbol 157 MovieClip Frame 4
stop();
Symbol 157 MovieClip Frame 5
stop();
Symbol 157 MovieClip Frame 6
stop();
Symbol 157 MovieClip Frame 7
stop();
Symbol 166 Button
on (release) {
if (_root.WeaponSlot1.Info.text != "Wide") {
_root.WeaponSlot1.Info.text = "Wide";
} else {
_root.WeaponSlot1.Info.text = "Tier 1";
}
}
Symbol 168 Button
on (release) {
if (_root.WeaponSlot1.Info.text != "Narrow") {
_root.WeaponSlot1.Info.text = "Narrow";
} else {
_root.WeaponSlot1.Info.text = "Tier 1";
}
}
Symbol 170 Button
on (release) {
if (_root.WeaponSlot2.Info.text != "Long") {
_root.WeaponSlot2.Info.text = "Long";
} else {
_root.WeaponSlot2.Info.text = "Tier 2";
}
}
Symbol 172 Button
on (release) {
if (_root.WeaponSlot2.Info.text != "Short") {
_root.WeaponSlot2.Info.text = "Short";
} else {
_root.WeaponSlot2.Info.text = "Tier 2";
}
}
Symbol 174 Button
on (release) {
if (_root.Chassis.Info.text != "Plated") {
_root.Chassis.Info.text = "Plated";
} else {
_root.Chassis.Info.text = "Chassis";
}
}
Symbol 176 Button
on (release) {
if (_root.Chassis.Info.text != "Stealth") {
_root.Chassis.Info.text = "Stealth";
} else {
_root.Chassis.Info.text = "Chassis";
}
}
Symbol 199 Button
on (keyPress "q") {
if (quality == "HIGH") {
_quality = "LOW";
quality = "LOW";
} else if (quality == "LOW") {
_quality = "MEDIUM";
quality = "MEDIUM";
} else {
_quality = "HIGH";
quality = "HIGH";
}
}
Symbol 203 Button
on (release) {
_root.Paused = false;
_root.player_mc._alpha = 100;
j = 0;
while (j < _root.enemies.length) {
n = _root.enemies[j];
_root["enemy" + n]._alpha = 100;
j++;
}
Mouse.hide();
_root.Crosshair._alpha = 100;
_root.PauseScreen._alpha = 0;
_root.PauseScreen.enabled = false;
}