Section 1
//healthbar_25 (GalacticStarShooters_fla.healthbar_25)
package GalacticStarShooters_fla {
import flash.display.*;
public dynamic class healthbar_25 extends MovieClip {
public var bar:MovieClip;
}
}//package GalacticStarShooters_fla
Section 2
//healthbar2_27 (GalacticStarShooters_fla.healthbar2_27)
package GalacticStarShooters_fla {
import flash.display.*;
public dynamic class healthbar2_27 extends MovieClip {
public var bar:MovieClip;
}
}//package GalacticStarShooters_fla
Section 3
//mouseOverAnim_22 (GalacticStarShooters_fla.mouseOverAnim_22)
package GalacticStarShooters_fla {
import flash.display.*;
public dynamic class mouseOverAnim_22 extends MovieClip {
public function mouseOverAnim_22(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package GalacticStarShooters_fla
Section 4
//pauseScreen_30 (GalacticStarShooters_fla.pauseScreen_30)
package GalacticStarShooters_fla {
import flash.display.*;
import flash.text.*;
public dynamic class pauseScreen_30 extends MovieClip {
public var btnKeyboard:button2;
public var controlStyleText:TextField;
public var btnMouse:button2;
public function pauseScreen_30(){
addFrameScript(0, frame1);
}
function frame1(){
visible = false;
alpha = 1;
btnKeyboard.clickFunction = function (){
game.useMouse = false;
update();
};
btnMouse.clickFunction = function (){
game.useMouse = true;
update();
};
update();
}
public function update(){
controlStyleText.text = "User Control Style: ";
if (game.useMouse){
controlStyleText.appendText("Mouse");
} else {
controlStyleText.appendText("Keyboard");
};
}
}
}//package GalacticStarShooters_fla
Section 5
//progressMc_29 (GalacticStarShooters_fla.progressMc_29)
package GalacticStarShooters_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class progressMc_29 extends MovieClip {
public function progressMc_29(){
addFrameScript(0, frame1);
}
function frame1(){
MovieClip(root).progressIcon = this;
}
}
}//package GalacticStarShooters_fla
Section 6
//upgradeScreen_31 (GalacticStarShooters_fla.upgradeScreen_31)
package GalacticStarShooters_fla {
import main.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class upgradeScreen_31 extends MovieClip {
public var bulletStrengthBtn:button2;
public var ammoRefillBtn:button2;
public var maxHealthBtn:button2;
public var spreadFireBtn:button2;
public var extraLifeBtn:button2;
public var currentItemText:TextField;
public var mc:MovieClip;
public var doneBtn:button2;
public var maxEnergyBtn:button2;
public var maxAmmoBtn:button2;
public var purchaseBtn:button2;
public var itemDescriptionText:TextField;
public var itemCostText:TextField;
public var purchaseText:TextField;
public var scoreText:TextField;
public var shipSpeedBtn:button2;
public var current:String;
public function upgradeScreen_31(){
addFrameScript(0, frame1);
}
public function getName(_arg1:String){
switch (_arg1){
case "extraLife":
return ((("Extra Life - " + (game.lives + 1)) + " Lives"));
case "maxHealth":
return ("Maximum Health Increase");
case "maxEnergy":
return ("Maximum Energy Increase");
case "maxAmmo":
return ("Maximum Ammo Increase");
case "bulletStrength":
return ((("Bullet Strength Increase - Lv. " + game.bulletStrengthLevel) + " of 5 "));
case "shipSpeed":
return ((("Ship Speed Increase - Lv. " + game.shipSpeedLevel) + " of 5 "));
case "spreadFire":
return ((("Spread Fire Increase - " + (game.shotCount + 1)) + " / 5 Shots"));
case "ammoRefill":
return ("Ammo Refill");
};
}
public function setupButtons(){
var _local1:*;
var _local2:*;
_local1 = 0;
while (_local1 < numChildren) {
_local2 = getChildAt(_local1);
if ((_local2 is game_button)){
if (_local2.clickFunction == null){
_local2.clickFunction = createFunction(_local2.name.replace("Btn", ""));
};
};
_local1++;
};
}
public function createFunction(_arg1):Function{
var t = _arg1;
return (function (){
update(t);
});
}
function frame1(){
stop();
purchaseBtn.clickFunction = function (){
if (getPrice(current) <= game.score){
switch (current){
case "extraLife":
game.lives++;
break;
case "maxHealth":
game.healthLevel++;
game.heroEntity.maxHealth = Math.floor((game.heroEntity.maxHealth * game.HEALTH_INCREASE_FACTOR));
break;
case "maxEnergy":
game.energyLevel++;
game.heroEntity.maxEnergy = Math.floor((game.heroEntity.maxEnergy * game.ENERGY_INCREASE_FACTOR));
break;
case "maxAmmo":
game.ammoLevel++;
game.maxAmmo = Math.floor((game.maxAmmo * game.AMMO_INCREASE_FACTOR));
break;
case "bulletStrength":
if (game.bulletStrengthLevel == 5){
return;
};
game.shotVitality++;
game.bulletStrengthLevel++;
break;
case "shipSpeed":
return ("Ship Speed Increase");
case "spreadFire":
if (game.shotSpreadLevel == 5){
return;
};
game.shotCount++;
game.shotSpreadLevel++;
break;
case "ammoRefill":
game.ammo = game.maxAmmo;
break;
};
game.upgrades.push(current);
game.score = (game.score - getPrice(current));
};
update();
};
doneBtn.clickFunction = function (){
game.upgrading = false;
};
mc = this;
current = "nothing";
visible = false;
alpha = 1;
update();
}
public function getPrice(_arg1:String){
switch (_arg1){
case "extraLife":
return (8000);
case "maxHealth":
return ((2000 + (800 * (game.healthLevel - 1))));
case "maxEnergy":
return ((2500 + (1800 * (game.energyLevel - 1))));
case "maxAmmo":
return ((2000 + (1800 * (game.ammoLevel - 1))));
case "bulletStrength":
return ((2500 + (1800 * (game.bulletStrengthLevel - 1))));
case "shipSpeed":
return ((5000 + (200 * (game.shipSpeedLevel - 1))));
case "spreadFire":
return ((13000 + (5000 * (game.shotSpreadLevel - 1))));
case "ammoRefill":
return (4000);
};
}
public function getDescription(_arg1:String){
switch (_arg1){
case "extraLife":
return ("Gives you an extra life so you can play longer.");
case "maxHealth":
return ("Increases your ships maximum health, allowing you to overall take more damage");
case "maxEnergy":
return ("Increases your ships maximum energy, allowing you to use your shield more.");
case "maxAmmo":
return ("Increases how much ammo you can hold at maximum, allowing you to fire more bullets.");
case "bulletStrength":
return ("Increases how strong your bullets are, making them destroy stronger enemies faster.");
case "shipSpeed":
return ("Increases how fast your ship moves, allowing you to move around better.");
case "spreadFire":
return ("Increases how many bullets are fire per shot by one, multiplying your overall damage and blast radius.");
case "ammoRefill":
return ("Full refills your ammo to its max.");
};
}
public function update(_arg1:String="nothing"){
scoreText.text = ("Score Points: " + game.score);
setupButtons();
if (_arg1 == "nothing"){
return;
};
current = _arg1;
currentItemText.text = ("Current Item: " + getName(_arg1));
itemCostText.text = ("Item Cost: " + getPrice(_arg1));
itemDescriptionText.text = ("Item Description:\n" + getDescription(_arg1));
purchaseBtn.enabled = (purchaseBtn.mouseEnabled = (purchaseBtn.mouseChildren = (getPrice(_arg1) <= game.score)));
purchaseText.mouseEnabled = false;
if (purchaseBtn.enabled){
purchaseBtn.alpha = 1;
purchaseText.text = "Purchase Upgrade";
} else {
purchaseBtn.alpha = 0;
purchaseText.text = "Insufficient Funds";
};
}
}
}//package GalacticStarShooters_fla
Section 7
//cheats (main.cheats)
package main {
public class cheats {
public static const TEN_YEARS_OLD:String = "10 years old";
public static const I_WANT_IT_ALL:String = "i want it all";
public static const SPEEDING_BULLET:String = "speeding bullet";
public static const KILLER_INSTINCT:String = "killer instinct";
public static const TRIGGER_HAPPY:String = "trigger happy";
public static const LIST:Array = [cheats.CASH, cheats.FIFTY_YEARS_OLD, cheats.FOURTY_YEARS_OLD, cheats.I_WANT_IT_ALL, cheats.KILLER_INSTINCT, cheats.RED_BULL, cheats.TEN_YEARS_OLD, cheats.THIRTY_YEARS_OLD, cheats.TRIGGER_HAPPY, cheats.TWENTY_YEARS_OLD, cheats.SPEEDING_BULLET];
public static const RED_BULL:String = "red bull";
public static const THIRTY_YEARS_OLD:String = "30 years old";
public static const FOURTY_YEARS_OLD:String = "40 years old";
public static const FIFTY_YEARS_OLD:String = "50 years old";
public static const TWENTY_YEARS_OLD:String = "20 years old";
public static const CASH:String = "cash";
public static var userCheats:Array = new Array();
}
}//package main
Section 8
//documentClass (main.documentClass)
package main {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import mochi.*;
public dynamic class documentClass extends MovieClip {
public const referenceBitmap:bitmap;
public const NO_SOUND:SoundTransform;
public const maxExplosionsOnScreen:Number = 100;
public const SCREEN_RECT:Rectangle;
public const st2:SoundTransform;
public const CLEAR:ColorTransform;
public const referenceBitmap3:spaceBkg;
public const referenceBitmap2:bkg;
public const referenceBitmap4:bitmap2;
public const absoluteMaxEnemiesOnScreen:Number = 200;
public const maxStarsOnScreen:Number = 50;
public const maxBulletsOnScreen:Number = 200;
public var btnSound:button2;
private var songTimerMax:Number;// = 2500
public var inputText:TextField;
private var _clickMap:Sprite;
public var enemyHealth:Number;
private var timerStart:Number;// = 0
private var yDiff:Number;
public var gameMusicChannel:SoundChannel;
private var keyListener;
public var progressIcon:MovieClip;
public var bigOnScreen;// = false
public var btnEnterCheat:enterCheat;
public var destinationGame_Credits:creditsButton;
public var varyingFunction:Function;// = null
public var i;
public var n:Number;
public var o:Object;
public var p:Number;
private var firstHeroBullet:entity_bullet;
public var showingMessage:Boolean;// = false
public var pauseBtn:button2;
private var shipProgress:Number;// = 0
public var r:String;
public var s:Sound;
public var test:Number;// = 0
private var xDiff:Number;
private var display:BitmapData;
private var songIndex:Number;// = 1
public var destinationInstructions:instructions;
public var useGMakerButton:useShipType1;
private var lastHeroBullet:entity_bullet;
public var obj:Object;
public var bID:String;
public var useGMaker2Button:useShipType2;
public var btnLeaderboards:leaderboards;
public var ammoText:TextField;
public var validCheats:Array;
private var lastExplosion:entity_explosion;
private var firstStar:entity_star;
public var shotStrengthText:TextField;
private var atmosphere:gradient;
public var gameMusic2:gameMusicSymbol2;
public var gameMusic4:gameMusicSymbol4;
private var enemiesWaiting:Number;// = 10
public var gameMusic3:gameMusicSymbol3;
public var gameMusic:gameMusicSymbol;
public var _mochiads_game_id:String;
private var displayBmp:Bitmap;
public var upgradeScreenMc:MovieClip;
public var maxEnemiesOnScreen:Number;
public var usePaperman2Button:useShipType2;
public var factor:Number;
public var canSpawn:Boolean;
public var btnSubmit:submitScore;
public var quitBtn:button2;
public var enemySpeed:Number;
public var healthText:TextField;
public var heroBulletsWaitingList:Array;
public var enemyBulletsWaitingList:Array;
public var powerup1:entity;
public var powerup2:entity;
private var firstEnemyBullet:entity;
public var powerUpSeparation:Number;// = 0
public var bulletsOnScreen:Number;// = 0
public var pauseScreen:MovieClip;
public var gameMusicChannel3:SoundChannel;
public var gameMusicChannel4:SoundChannel;
private var lastStar:entity_star;
public var gameMusicChannel2:SoundChannel;
public var useCheeseButton:useShipType1;
public var len:Number;
public var progress:MovieClip;
private var lastEnemyBullet:entity;
public var explosionWaitingList:Array;
private var firstExplosion:entity_explosion;
public var enteredCheats:Array;
public var health:MovieClip;
public var st:SoundTransform;
public var btnKeyboard:keyboard;
public var gameSoundTransform4:SoundTransform;
public var extras:String;
public var gameSoundTransform3:SoundTransform;
public var gameSoundTransform2:SoundTransform;
public var boardID:String;
public var bossCountNum:Number;// = 1
public var usePapermanButton:useShipType1;
public var energy:MovieClip;
private var lastEnemy:entity_enemy;
public var waveSize:Number;// = 200
public var maxAmmoText:TextField;
public var upgradeBtn:button2;
public var starsOnScreen:Number;// = 0
private var firstEnemy:entity_enemy;
public var starsWaiting:Number;// = 50
public var bossMusic:bossMusicSymbol;
public var levelText:TextField;
public var livesText:TextField;
public var enemyDelay:Number;
public var scoreText:TextField;
public var created:Boolean;// = false
public var resultText:TextField;
private var tempI:uint;
public var onScreenText:TextField;
public var useCheese2Button:useShipType2;
public var bossMusicChannel:SoundChannel;
private var terrain:Sprite;
public var shipSpeedText:TextField;
public var useAreagleButton:useShipType1;
private var songTimer:Number;// = 2500
public var musicDone:Boolean;// = false
private var boss:entity_boss;
public var enemiesOnScreen:Number;// = 0
public var num;
public var destinationControl_Setup:startGame;
public var destinationShip_Select:Continue;
public var _mochiads_id:String;// = "a81591dd9dcc3f0a"
public var useAreagle2Button:useShipType2;
public var masterMc:MovieClip;
public var btnMouse:mouse;
public var gameSoundTransform:SoundTransform;
private var terrainW:Number;// = 99520
public var destinationMain_Menu:backToMenu;
public var shotSpreadText:TextField;
private var terrains:Array;
public var bossSoundTransform:SoundTransform;
public function documentClass():void{
var _local1:*;
_mochiads_id = "a81591dd9dcc3f0a";
referenceBitmap = new bitmap(0, 0);
referenceBitmap2 = new bkg(0, 0);
referenceBitmap3 = new spaceBkg(0, 0);
referenceBitmap4 = new bitmap2(0, 0);
NO_SOUND = new SoundTransform(0);
SCREEN_RECT = new Rectangle(0, 0, 640, 480);
CLEAR = new ColorTransform(1, 1, 1, 0);
test = 0;
bulletsOnScreen = 0;
heroBulletsWaitingList = new Array();
enemyBulletsWaitingList = new Array();
explosionWaitingList = new Array();
starsOnScreen = 0;
enemiesOnScreen = 0;
starsWaiting = 50;
showingMessage = false;
varyingFunction = null;
timerStart = 0;
enemiesWaiting = 10;
display = new BitmapData(640, 480, false, 0);
boss = new entity_boss();
terrains = new Array();
terrain = new Sprite();
terrainW = (100000 - 480);
atmosphere = new gradient();
powerup1 = new entity();
powerup2 = new entity();
powerUpSeparation = 0;
shipProgress = 0;
_clickMap = new Sprite();
bigOnScreen = false;
songIndex = 1;
songTimer = 2500;
songTimerMax = 2500;
gameMusic4 = new gameMusicSymbol4();
gameMusic3 = new gameMusicSymbol3();
gameMusic2 = new gameMusicSymbol2();
gameMusic = new gameMusicSymbol();
bossMusic = new bossMusicSymbol();
gameSoundTransform4 = new SoundTransform(0);
gameSoundTransform3 = new SoundTransform(0);
gameSoundTransform2 = new SoundTransform(0);
gameSoundTransform = new SoundTransform(0);
bossSoundTransform = new SoundTransform(0);
musicDone = false;
st2 = new SoundTransform();
bossCountNum = 1;
created = false;
waveSize = 200;
st = new SoundTransform(0.5);
super();
addFrameScript(0, frame1, 1, frame2, 11, frame12, 12, frame13, 46, frame47, 59, frame60, 72, frame73, 88, frame89, 98, frame99, 99, frame100, 115, frame116);
keyListener = stage;
game.createStaticArrays();
displayBmp = new Bitmap(display);
addChild(displayBmp);
_local1 = 0;
while (_local1 < 0x0100) {
Key.keys[_local1] = false;
Key.keys2[_local1] = false;
_local1++;
};
this.addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
private function addedToStage(_arg1:Event):void{
MochiServices.connect(_mochiads_id, this);
MochiAd.showPreGameAd({clip:this, id:_mochiads_id, res:"640x480"});
}
public function setupListeners():void{
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
this.stage.addEventListener(KeyboardEvent.KEY_UP, keyUp);
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
this.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
this.addEventListener(Event.ENTER_FRAME, enterFrame);
}
function frame12(){
stop();
game.inPlay = false;
btnLeaderboards.clickFunction = function (){
o = {n:[12, 3, 14, 0, 4, 9, 3, 6, 0, 7, 9, 0, 14, 5, 7, 8], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
boardID = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID});
};
}
function frame1(){
_mochiads_game_id = "a81591dd9dcc3f0a";
MovieClip(root).masterMc = this;
stop();
game.inPlay = false;
btnSound.clickFunction = function (){
game.bkgMusic = !(game.bkgMusic);
};
}
function frame2(){
musicDone = true;
setupEntities();
setupMusic();
setupListeners();
gotoAndStop("Main Menu");
}
function frame13(){
gotoAndStop("Main Menu");
}
public function startGameplay():void{
game.inPlay = true;
game.heroEntity.x = 100;
game.heroEntity.y = 240;
game.heroEntity.firstAnimFrame = (game.heroEntity.currentAnimFrame = game.heroIndex);
game.heroEntity.lastAnimFrame = (game.heroEntity.firstAnimFrame + 3);
game.resetGameVariables();
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
}
function frame47(){
btnMouse.clickFunction = function (){
game.useMouse = true;
gotoAndStop("Cheats");
};
btnKeyboard.clickFunction = function (){
game.useMouse = false;
gotoAndStop("Cheats");
};
}
function handleMusic():void{
songTimer--;
if (songTimer < 0){
songTimer = songTimerMax;
songIndex++;
if (songIndex > 4){
songIndex = 1;
};
};
if (!game.bkgMusic){
gameSoundTransform.volume = 0;
gameSoundTransform2.volume = 0;
gameSoundTransform3.volume = 0;
gameSoundTransform4.volume = 0;
bossSoundTransform.volume = 0;
} else {
if (masterMc.currentLabel.toLowerCase() != "gameplay"){
if (songIndex == 1){
gameSoundTransform.volume = (gameSoundTransform.volume + ((1 - gameSoundTransform.volume) / 35));
} else {
gameSoundTransform.volume = (gameSoundTransform.volume + (-(gameSoundTransform.volume) / 35));
};
if (songIndex == 2){
gameSoundTransform2.volume = (gameSoundTransform2.volume + ((1 - gameSoundTransform2.volume) / 35));
} else {
gameSoundTransform2.volume = (gameSoundTransform2.volume + (-(gameSoundTransform2.volume) / 35));
};
if (songIndex == 3){
gameSoundTransform3.volume = (gameSoundTransform3.volume + ((1 - gameSoundTransform3.volume) / 35));
} else {
gameSoundTransform3.volume = (gameSoundTransform3.volume + (-(gameSoundTransform3.volume) / 35));
};
if (songIndex == 4){
gameSoundTransform3.volume = (gameSoundTransform3.volume + ((1 - gameSoundTransform4.volume) / 35));
} else {
gameSoundTransform4.volume = (gameSoundTransform4.volume + (-(gameSoundTransform4.volume) / 35));
};
bossSoundTransform.volume = (bossSoundTransform.volume + (-(bossSoundTransform.volume) / 15));
} else {
if (((game.inPlay) && (!(game.playingBoss)))){
if (songIndex == 1){
gameSoundTransform.volume = (gameSoundTransform.volume + ((1 - gameSoundTransform.volume) / 35));
} else {
gameSoundTransform.volume = (gameSoundTransform.volume + (-(gameSoundTransform.volume) / 35));
};
if (songIndex == 2){
gameSoundTransform2.volume = (gameSoundTransform2.volume + ((1 - gameSoundTransform2.volume) / 35));
} else {
gameSoundTransform2.volume = (gameSoundTransform2.volume + (-(gameSoundTransform2.volume) / 35));
};
if (songIndex == 3){
gameSoundTransform3.volume = (gameSoundTransform3.volume + ((1 - gameSoundTransform3.volume) / 35));
} else {
gameSoundTransform3.volume = (gameSoundTransform3.volume + (-(gameSoundTransform3.volume) / 35));
};
if (songIndex == 4){
gameSoundTransform3.volume = (gameSoundTransform3.volume + ((1 - gameSoundTransform4.volume) / 35));
} else {
gameSoundTransform4.volume = (gameSoundTransform4.volume + (-(gameSoundTransform4.volume) / 35));
};
bossSoundTransform.volume = (bossSoundTransform.volume + (-(bossSoundTransform.volume) / 15));
} else {
if (((game.inPlay) && (game.playingBoss))){
bossSoundTransform.volume = (bossSoundTransform.volume + ((1 - bossSoundTransform.volume) / 15));
gameSoundTransform.volume = (gameSoundTransform.volume + (-(gameSoundTransform.volume) / 15));
gameSoundTransform2.volume = (gameSoundTransform2.volume + (-(gameSoundTransform.volume) / 15));
gameSoundTransform3.volume = (gameSoundTransform3.volume + (-(gameSoundTransform.volume) / 15));
gameSoundTransform4.volume = (gameSoundTransform4.volume + (-(gameSoundTransform.volume) / 15));
};
};
};
};
gameMusicChannel.soundTransform = gameSoundTransform;
gameMusicChannel2.soundTransform = gameSoundTransform2;
gameMusicChannel3.soundTransform = gameSoundTransform3;
gameMusicChannel4.soundTransform = gameSoundTransform4;
bossMusicChannel.soundTransform = bossSoundTransform;
}
private function gameplayLogic():void{
var _local1:startingNextWaveMc;
if (Key.wasToggled(80)){
game.paused = true;
};
if (Key.wasToggled(80)){
game.paused = true;
};
if (Key.wasToggled(81)){
MovieClip(root).quitGame();
};
if (Key.wasToggled(83)){
game.bkgMusic = !(game.bkgMusic);
};
if (Key.wasToggled(85)){
game.upgrading = (game.paused = true);
};
factor = ((game.currentWave - 1) / game.TOTAL_WAVE_COUNT);
game.enemyScoreUnit = game.scoreUnitArray[(game.currentWave - 1)];
waveSize = game.waveSizeArray[(game.currentWave - 1)];
enemyDelay = game.enemyDelayArray[(game.currentWave - 1)];
enemySpeed = game.enemySpeedArray[(game.currentWave - 1)];
enemyHealth = game.enemyHealthArray[(game.currentWave - 1)];
maxEnemiesOnScreen = game.maxEnemiesOnScreenArray[(game.currentWave - 1)];
canSpawn = ((((((((((((((((getTimer() - timerStart) >= enemyDelay)) && (game.playerOnScreen))) && (!(game.playingBoss)))) && ((game.currentWaveKillCount < waveSize)))) && ((showingMessage == false)))) && ((enemiesOnScreen < maxEnemiesOnScreen)))) && (!(game.playingBoss)))) && (!(game.paused)));
if ((((((((game.currentWaveKillCount >= waveSize)) && ((showingMessage == false)))) && ((enemiesOnScreen <= 0)))) && (!(game.playingBoss)))){
if ((((((((game.currentWave == 10)) || ((game.currentWave == 30)))) || ((game.currentWave == 50)))) && ((boss.destroyed == false)))){
game.playingBoss = true;
boss.x = 840;
boss.y = 240;
if (game.currentWave == 10){
boss.difficulty = 1;
} else {
if (game.currentWave == 30){
boss.difficulty = 2;
} else {
if (game.currentWave == 50){
boss.difficulty = 3;
};
};
};
boss.health = (boss.maxHealth = (2500 + (100 * game.currentWave)));
boss.firstAnimFrame = (boss.currentAnimFrame = 0);
boss.difficulty = bossCountNum;
boss.lastAnimFrame = 3;
boss.destroyed = false;
} else {
_local1 = new startingNextWaveMc();
_local1.x = 320;
_local1.y = 208;
masterMc.addChild(_local1);
showingMessage = true;
game.currentWaveKillCount = 0;
};
};
lastEnemyBullet = firstEnemyBullet;
tempI = 0;
while (tempI < maxBulletsOnScreen) {
if (lastEnemyBullet.isAlive){
if ((((game.paused == false)) && (game.inPlay))){
lastEnemyBullet.update();
};
display.copyPixels(referenceBitmap, new Rectangle(getColumn(65), getRow(65), 100, 100), new Point((lastEnemyBullet.x - 50), (lastEnemyBullet.y - 50)), null, null, true);
} else {
if (enemyBulletsWaitingList.length > 0){
lastEnemyBullet.isAlive = true;
lastEnemyBullet.x = (enemyBulletsWaitingList[0].energy.x + enemyBulletsWaitingList[0].xDiff);
lastEnemyBullet.y = (enemyBulletsWaitingList[0].energy.y + enemyBulletsWaitingList[0].yDiff);
lastEnemyBullet.xVelocity = (-20 + enemyBulletsWaitingList[0].rx);
lastEnemyBullet.yVelocity = enemyBulletsWaitingList[0].ry;
enemyBulletsWaitingList.splice(0, 1);
};
};
lastEnemyBullet = lastEnemyBullet.nextObject;
tempI++;
};
created = false;
entity_enemy.tmrE = false;
lastEnemy = firstEnemy;
tempI = 0;
while (tempI < maxEnemiesOnScreen) {
if ((((game.paused == false)) && (game.inPlay))){
lastEnemy.bulletHitTest(firstHeroBullet);
};
if (lastEnemy.isAlive){
if ((((game.paused == false)) && (game.inPlay))){
lastEnemy.updateEnemy();
};
display.copyPixels(referenceBitmap, new Rectangle(getColumn(lastEnemy.currentAnimFrame), getRow(lastEnemy.currentAnimFrame), 100, 100), new Point((lastEnemy.x - 50), (lastEnemy.y - 50)), null, null, true);
} else {
if (((((canSpawn) && (!(created)))) && (!(game.paused)))){
enemiesOnScreen++;
lastEnemy.x = (690 + (Math.random() * 200));
lastEnemy.y = (120 + ((250 / 7) * Math.floor((Math.random() * 7))));
lastEnemy.xVelocity = -(enemySpeed);
if (Math.random() < 0.3){
lastEnemy.yVelocity = 0;
} else {
if (Math.random() < 0.6){
lastEnemy.yVelocity = (((240 - (240 - lastEnemy.y)) - lastEnemy.y) / (500 / enemySpeed));
} else {
lastEnemy.yVelocity = ((game.heroEntity.y - lastEnemy.y) / (500 / enemySpeed));
};
};
lastEnemy.isAlive = true;
if (((((Math.random() * 50) < game.currentWave)) && (!(bigOnScreen)))){
bigOnScreen = true;
lastEnemy.currentAnimFrame = (lastEnemy.firstAnimFrame = (4 + (Math.round((3 + (Math.random() * 2))) * 8)));
lastEnemy.bg = true;
lastEnemy.health = (lastEnemy.health = (enemyHealth * 15));
lastEnemy.xVelocity = (lastEnemy.xVelocity / 2);
lastEnemy.yVelocity = 0;
timerStart = (getTimer() + 600);
} else {
lastEnemy.currentAnimFrame = (lastEnemy.firstAnimFrame = (4 + (Math.round((Math.random() * 2)) * 8)));
lastEnemy.bg = false;
lastEnemy.health = (lastEnemy.health = enemyHealth);
timerStart = getTimer();
};
lastEnemy.lastAnimFrame = (lastEnemy.currentAnimFrame + 3);
created = true;
};
};
lastEnemy = entity_enemy(lastEnemy.nextObject);
tempI++;
};
if (game.playingBoss){
if ((((game.paused == false)) && (game.inPlay))){
boss.updateBoss(firstHeroBullet);
};
display.copyPixels(referenceBitmap4, new Rectangle(getBossColumn(boss.currentAnimFrame), getBossRow(boss.currentAnimFrame), 400, 400), new Point((boss.x - 200), (boss.y - 200)), null, null, true);
};
if ((((game.paused == false)) && (game.inPlay))){
game.heroEntity.updateHero(mouseX, mouseY, firstEnemyBullet);
};
display.copyPixels(referenceBitmap, new Rectangle(getColumn(game.heroEntity.firstAnimFrame), getRow(game.heroEntity.firstAnimFrame), 100, 100), new Point((game.heroEntity.x - 50), (game.heroEntity.y - 50)), null, null, true);
if (game.heroEntity.usingShield){
display.copyPixels(referenceBitmap, new Rectangle(getColumn(game.heroEntity.currentShieldFrame), getRow(game.heroEntity.currentShieldFrame), 100, 100), new Point((game.heroEntity.x - 50), (game.heroEntity.y - 50)), null, null, true);
};
lastHeroBullet = firstHeroBullet;
tempI = 0;
while (tempI < maxBulletsOnScreen) {
if (lastHeroBullet.isAlive){
if ((((game.paused == false)) && (game.inPlay))){
lastHeroBullet.update();
};
display.copyPixels(referenceBitmap, new Rectangle(getColumn(64), getRow(64), 100, 100), new Point((lastHeroBullet.x - 50), (lastHeroBullet.y - 50)), null, null, true);
} else {
if (heroBulletsWaitingList.length > 0){
lastHeroBullet.x = heroBulletsWaitingList[0].x;
lastHeroBullet.y = heroBulletsWaitingList[0].y;
lastHeroBullet.xVelocity = 27;
lastHeroBullet.yVelocity = heroBulletsWaitingList[0].yVelocity;
lastHeroBullet.isAlive = true;
lastHeroBullet.vt = game.shotVitality;
heroBulletsWaitingList.splice(0, 1);
bulletsOnScreen++;
};
};
lastHeroBullet = entity_bullet(lastHeroBullet.nextObject);
tempI++;
};
lastExplosion = firstExplosion;
tempI = 0;
while (tempI < maxExplosionsOnScreen) {
if (lastExplosion.isAlive){
if ((((game.paused == false)) && (game.inPlay))){
lastExplosion.update();
};
display.copyPixels(referenceBitmap, new Rectangle(getColumn(lastExplosion.currentAnimFrame), getRow(lastExplosion.currentAnimFrame), 100, 100), new Point((lastExplosion.x - 50), (lastExplosion.y - 50)), null, null, true);
} else {
if (explosionWaitingList.length > 0){
lastExplosion.isAlive = true;
lastExplosion.x = ((explosionWaitingList[0].energy.x + (Math.random() * (explosionWaitingList[0].r * 2))) - explosionWaitingList[0].r);
lastExplosion.y = ((explosionWaitingList[0].energy.y + (Math.random() * (explosionWaitingList[0].r * 2))) - explosionWaitingList[0].r);
if (!explosionWaitingList[0].s){
lastExplosion.currentAnimFrame = (lastExplosion.firstAnimFrame = 66);
lastExplosion.lastAnimFrame = 71;
s = new explosionSound();
s.play(0, 0, st);
} else {
lastExplosion.currentAnimFrame = (lastExplosion.firstAnimFrame = 88);
lastExplosion.lastAnimFrame = 95;
s = new reflectSound();
s.play();
};
lastExplosion.isPlayingAnimation = true;
explosionWaitingList.splice(0, 1);
};
};
lastExplosion = entity_explosion(lastExplosion.nextObject);
tempI++;
};
if (powerUpSeparation > 60){
if ((((Math.random() < 0.5)) && (((game.ammo / game.maxAmmo) < 0.7)))){
powerup1.isAlive = true;
powerup1.x = ((Math.random() * 200) + 50);
powerup1.y = -50;
};
if ((game.heroEntity.health / game.heroEntity.maxHealth) < 0.7){
powerup2.isAlive = true;
powerup2.x = ((Math.random() * 200) + 50);
powerup2.y = -50;
};
powerUpSeparation = 0;
};
}
function frame60(){
btnEnterCheat.clickFunction = function (){
enteredCheats = inputText.text.split(".").concat(inputText.text.split(","));
validCheats = new Array();
r = "";
num = 0;
i = 0;
while (i < enteredCheats.length) {
if (cheats.LIST.indexOf(enteredCheats[i].toLowerCase()) != -1){
cheats.userCheats.push(enteredCheats[i].toLowerCase());
r = (r + enteredCheats[i].toLowerCase());
num++;
if (i != (enteredCheats.length - 1)){
r = (r + ", ");
};
};
i++;
};
if (num == 0){
resultText.text = "No Cheats Activated, Please Try Again!";
} else {
resultText.text = ((num + " Cheats Activated: ") + r);
};
};
}
function frame73(){
game_button(this.useGMakerButton).clickFunction = function (){
game.heroIndex = 0;
gotoAndStop("Gameplay");
};
game_button(this.useAreagleButton).clickFunction = function (){
game.heroIndex = 8;
gotoAndStop("Gameplay");
};
game_button(this.usePapermanButton).clickFunction = function (){
game.heroIndex = 16;
gotoAndStop("Gameplay");
};
game_button(this.useCheeseButton).clickFunction = function (){
game.heroIndex = 24;
gotoAndStop("Gameplay");
};
game_button(this.useGMaker2Button).clickFunction = function (){
game.heroIndex = 32;
gotoAndStop("Gameplay");
};
game_button(this.useAreagle2Button).clickFunction = function (){
game.heroIndex = 40;
gotoAndStop("Gameplay");
};
game_button(this.usePaperman2Button).clickFunction = function (){
game.heroIndex = 48;
gotoAndStop("Gameplay");
};
game_button(this.useCheese2Button).clickFunction = function (){
game.heroIndex = 56;
gotoAndStop("Gameplay");
};
}
private function getBossColumn(_arg1:Number):Number{
return (((_arg1 % 5) * 400));
}
function frame89(){
MovieClip(root).startGameplay();
MovieClip(root).varyingFunction = function (){
if (currentLabel != "Gameplay"){
MovieClip(root).varyingFunction = null;
return;
};
onScreenText.text = (MovieClip(root).enemiesOnScreen + " Enemies on SCreen");
p = (game.currentWaveKillCount / MovieClip(root).waveSize);
n = Math.max(Math.min((560 * p), 560), 0);
MovieClip(root).progressIcon.x = (MovieClip(root).progressIcon.x + ((n - MovieClip(root).progressIcon.x) / 5));
ammoText.text = (game.ammo + "");
maxAmmoText.text = (("Max:" + game.maxAmmo) + "");
livesText.text = ("Lives Remaining: " + game.lives);
levelText.text = ("Wave: " + game.currentWave);
scoreText.text = ("Score: " + game.score);
healthText.text = ((("Health: " + Math.round(game.heroEntity.health)) + "/") + game.heroEntity.maxHealth);
extras = "0000000000000000000";
len = (extras.length - game.score.toString().length);
upgradeScreenMc.visible = game.upgrading;
shotSpreadText.text = ("Shot Spread Lv. " + (game.shotCount - 1));
if (game.shipSpeed == game.SLOWEST_SHIP_SPEED){
shipSpeedText.text = "Ship Speed Lv. 1";
} else {
if (game.shipSpeed == (game.SLOWEST_SHIP_SPEED + ((game.FASTEST_SHIP_SPEED - game.SLOWEST_SHIP_SPEED) * 0.33))){
shipSpeedText.text = "Ship Speed Lv. 2";
} else {
if (game.shipSpeed == (game.SLOWEST_SHIP_SPEED + ((game.FASTEST_SHIP_SPEED - game.SLOWEST_SHIP_SPEED) * 0.66))){
shipSpeedText.text = "Ship Speed Lv. 3";
} else {
if (game.shipSpeed == game.FASTEST_SHIP_SPEED){
shipSpeedText.text = "Ship Speed Lv. 4";
};
};
};
};
shotStrengthText.text = ("Shot Strength Lv. " + game.shotVitality);
pauseScreen.visible = ((game.paused) && ((game.upgrading == false)));
scoreText.text = (("Score: " + extras.substr(0, len)) + game.score);
health.bar.scaleX = (health.bar.scaleX + (((game.heroEntity.health / game.heroEntity.maxHealth) - health.bar.scaleX) / 4));
energy.bar.scaleX = (energy.bar.scaleX + (((game.heroEntity.energy / game.heroEntity.maxEnergy) - energy.bar.scaleX) / 4));
if (game.heroEntity.rechargingShield){
energy.bar.transform.colorTransform = new ColorTransform(1, 0, 0);
} else {
energy.bar.transform.colorTransform = new ColorTransform();
};
};
upgradeBtn.clickFunction = function (){
game.upgrading = true;
game.paused = true;
};
pauseBtn.clickFunction = function (){
game.paused = !(game.paused);
};
quitBtn.clickFunction = function (){
MovieClip(root).quitGame();
};
}
function frame99(){
btnSound.clickFunction = function (){
game.bkgMusic = !(game.bkgMusic);
};
scoreText.text = game.score.toString();
btnSubmit.clickFunction = function (){
obj = {n:[12, 3, 14, 0, 4, 9, 3, 6, 0, 7, 9, 0, 14, 5, 7, 8], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
bID = obj.f(0, "");
MochiScores.showLeaderboard({boardID:bID, score:game.score});
};
if (MovieClip(root).isConnected){
MovieClip(root).whirled.game.endGameWithScore(Math.floor((game.score / game.COIN_DIVISER)));
};
}
private function keyUp(_arg1:KeyboardEvent):void{
Key.keys[_arg1.keyCode] = false;
Key.keys2[_arg1.keyCode] = false;
}
function frame100(){
gotoAndStop("Main Menu");
}
function enterFrame(_arg1:Event):void{
if (varyingFunction != null){
varyingFunction();
};
if (musicDone){
handleMusic();
};
if (Key.wasToggled(81)){
game.paused = !(game.paused);
};
if (Key.wasToggled(83)){
game.bkgMusic = !(game.bkgMusic);
};
displayBmp.visible = !((masterMc == null));
display.colorTransform(SCREEN_RECT, CLEAR);
display.lock();
display.copyPixels(referenceBitmap2, SCREEN_RECT, new Point(), null, null, true);
shipProgress = (shipProgress + 0.01);
terrain.scrollRect = new Rectangle((terrainW * (shipProgress / 100)), 0, 640, 480);
display.draw(atmosphere);
if (powerup1.isAlive){
powerUpSeparation = 0;
powerup1.update();
xDiff = (game.heroEntity.x - powerup1.x);
yDiff = (game.heroEntity.y - powerup1.y);
if (((xDiff * xDiff) + (yDiff * yDiff)) < 2700){
powerup1.isAlive = false;
game.ammo = Math.min((game.ammo + 150), game.maxAmmo);
};
powerup1.y = (powerup1.y + 6);
if (powerup1.y > 450){
powerup1.isAlive = false;
};
display.copyPixels(referenceBitmap, new Rectangle(getColumn(52), getRow(52), 100, 100), new Point((powerup1.x - 50), (powerup1.y - 50)), null, null, true);
} else {
if (powerup2.isAlive){
powerUpSeparation = 0;
powerup2.update();
xDiff = (game.heroEntity.x - powerup2.x);
yDiff = (game.heroEntity.y - powerup2.y);
if (((xDiff * xDiff) + (yDiff * yDiff)) < 2700){
powerup2.isAlive = false;
game.heroEntity.health = Math.min((game.heroEntity.health + 40), game.heroEntity.maxHealth);
};
powerup2.y = (powerup2.y + 6);
if (powerup2.y > 450){
powerup2.isAlive = false;
};
display.copyPixels(referenceBitmap, new Rectangle(getColumn(53), getRow(53), 100, 100), new Point((powerup2.x - 50), (powerup2.y - 50)), null, null, true);
} else {
powerUpSeparation++;
};
};
lastStar = firstStar;
tempI = 0;
while (tempI < maxStarsOnScreen) {
if (lastStar.isAlive){
if (((game.paused) && (game.inPlay)) == false){
lastStar.x = (lastStar.x + lastStar.xVelocity);
lastStar.y = (lastStar.y + lastStar.yVelocity);
if (lastStar.x > 640){
lastStar.isAlive = false;
starsWaiting++;
starsOnScreen--;
};
};
display.copyPixels(referenceBitmap, new Rectangle(getColumn(lastStar.currentAnimFrame), getRow(lastStar.currentAnimFrame), 100, 100), new Point((lastStar.x - 50), (lastStar.y - 50)), null, null, true);
} else {
if ((((((starsWaiting > 0)) && ((starsOnScreen < maxStarsOnScreen)))) && ((((game.paused) && (game.inPlay)) == false)))){
starsWaiting--;
lastStar.x = (-(Math.random()) * 100);
lastStar.y = (Math.random() * 480);
lastStar.currentAnimFrame = (72 + Math.round((Math.random() * 7)));
lastStar.xVelocity = (16 - (12 * ((lastStar.currentAnimFrame - 72) / 9)));
lastStar.isAlive = true;
};
};
lastStar = entity_star(lastStar.nextObject);
tempI++;
};
if (masterMc != null){
if (((game.inPlay) && ((masterMc.currentLabel == "Gameplay")))){
gameplayLogic();
};
display.draw(masterMc);
};
display.unlock();
}
public function setupEntities():void{
firstEnemy = new entity_enemy();
lastEnemy = firstEnemy;
tempI = 0;
while (tempI < absoluteMaxEnemiesOnScreen) {
lastEnemy.root = this;
lastEnemy.nextObject = new entity_enemy();
lastEnemy = entity_enemy(lastEnemy.nextObject);
tempI++;
};
firstHeroBullet = new entity_bullet();
lastHeroBullet = firstHeroBullet;
tempI = 0;
while (tempI < maxBulletsOnScreen) {
lastHeroBullet.root = this;
lastHeroBullet.nextObject = new entity_bullet();
lastHeroBullet = entity_bullet(lastHeroBullet.nextObject);
tempI++;
};
firstEnemyBullet = new entity();
lastEnemyBullet = firstEnemyBullet;
tempI = 0;
while (tempI < maxBulletsOnScreen) {
lastEnemyBullet.root = this;
lastEnemyBullet.nextObject = new entity_bullet();
lastEnemyBullet = entity_bullet(lastEnemyBullet.nextObject);
tempI++;
};
firstStar = new entity_star();
lastStar = firstStar;
tempI = 0;
while (tempI < maxStarsOnScreen) {
lastStar.root = this;
lastStar.nextObject = new entity_star();
lastStar = entity_star(lastStar.nextObject);
tempI++;
};
firstExplosion = new entity_explosion();
lastExplosion = firstExplosion;
tempI = 0;
while (tempI < maxExplosionsOnScreen) {
lastExplosion.root = this;
lastExplosion.nextObject = new entity_explosion();
lastExplosion = entity_explosion(lastExplosion.nextObject);
tempI++;
};
timerStart = getTimer();
game.heroEntity = new entity_hero();
game.heroEntity.root = this;
boss.root = this;
}
function frame116(){
stop();
}
public function setupMusic():void{
gameMusicChannel = gameMusic.play(0, 100000000);
gameMusicChannel2 = gameMusic2.play(0, 100000000);
gameMusicChannel3 = gameMusic3.play(0, 100000000);
gameMusicChannel4 = gameMusic4.play(0, 100000000);
bossMusicChannel = bossMusic.play(0, 100000000);
gameMusicChannel2.soundTransform = gameSoundTransform4;
gameMusicChannel3.soundTransform = gameSoundTransform3;
gameMusicChannel4.soundTransform = gameSoundTransform2;
gameMusicChannel.soundTransform = gameSoundTransform;
bossMusicChannel.soundTransform = bossSoundTransform;
}
private function mouseUp(_arg1:MouseEvent):void{
game.isMouseDown = false;
}
private function getColumn(_arg1:Number):Number{
return (((_arg1 % 8) * 100));
}
public function setupTerain():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
terrain.graphics.clear();
_local1 = 430;
_local2 = 415;
terrain.graphics.moveTo(0, _local1);
terrain.graphics.lineTo(0, _local1);
terrain.graphics.beginBitmapFill(referenceBitmap4);
_local3 = 0;
while (terrain.width < 100000) {
_local3 = (_local3 + (32 + (Math.random() * 100)));
terrain.graphics.lineTo(_local3, (_local1 + (Math.random() * (_local2 - _local1))));
};
terrain.graphics.lineTo(_local3, 480);
terrain.graphics.lineTo(0, 480);
terrain.graphics.endFill();
}
private function getRow(_arg1:Number):Number{
return ((Math.floor((_arg1 / 8)) * 100));
}
public function quitGame(_arg1:String="Main Menu"):void{
lastStar = firstStar;
tempI = 0;
while (tempI < maxStarsOnScreen) {
lastStar.isAlive = false;
lastStar = entity_star(lastStar.nextObject);
tempI++;
};
lastEnemy = firstEnemy;
tempI = 0;
while (tempI < maxEnemiesOnScreen) {
lastEnemy.isAlive = false;
lastEnemy = entity_enemy(lastEnemy.nextObject);
tempI++;
};
lastEnemyBullet = firstEnemyBullet;
tempI = 0;
while (tempI < maxBulletsOnScreen) {
lastEnemyBullet.isAlive = false;
lastEnemyBullet = lastEnemyBullet.nextObject;
tempI++;
};
lastHeroBullet = firstHeroBullet;
tempI = 0;
while (tempI < maxBulletsOnScreen) {
lastHeroBullet.isAlive = false;
lastHeroBullet = entity_bullet(lastHeroBullet.nextObject);
tempI++;
};
lastExplosion = firstExplosion;
tempI = 0;
while (tempI < maxExplosionsOnScreen) {
lastExplosion.isAlive = false;
lastExplosion = entity_explosion(lastExplosion.nextObject);
tempI++;
};
timerStart = 0;
bulletsOnScreen = 0;
enemiesWaiting = 0;
enemiesOnScreen = 0;
starsWaiting = 50;
starsOnScreen = 0;
game.inPlay = false;
cheats.userCheats = new Array();
masterMc.gotoAndStop(_arg1);
}
private function mouseDown(_arg1:MouseEvent):void{
game.isMouseDown = true;
}
private function getBossRow(_arg1:Number):Number{
return ((Math.floor((_arg1 / 5)) * 400));
}
public function startNextWave():void{
showingMessage = false;
game.currentWave++;
game.playingBoss = false;
}
private function keyDown(_arg1:KeyboardEvent):void{
Key.keys2[_arg1.keyCode] = (Key.keys[_arg1.keyCode] == false);
Key.keys[_arg1.keyCode] = true;
}
public function win(){
gotoAndStop("Win");
}
public function gameOver(){
gotoAndStop("Game Over");
}
}
}//package main
Section 9
//entity (main.entity)
package main {
public class entity {
public var isPlayingAnimation:Boolean;// = false
public var isAlive:Boolean;// = false
public var firstAnimFrame:Number;// = 0
public var nextObject:entity;
public var health:Number;// = 20
public var maxHealth:Number;// = 20
public var root:documentClass;
public var currentAnimFrame:Number;// = 0
public var lastAnimFrame:Number;// = 0
public var xVelocity:Number;// = 0
public var yVelocity:Number;// = 0
public var x:Number;// = 0
public var y:Number;// = 0
public static const ENEMY_BULLET_STRENGTH:Number = 5;
public static const PI:Number = (Math.PI / 180);
public static const BULLET_STRENGTH:Number = 10;
public function entity(){
x = 0;
y = 0;
xVelocity = 0;
yVelocity = 0;
firstAnimFrame = 0;
lastAnimFrame = 0;
currentAnimFrame = 0;
isAlive = false;
isPlayingAnimation = false;
health = 20;
maxHealth = 20;
super();
}
public function update():void{
x = (x + xVelocity);
y = (y + yVelocity);
if (isPlayingAnimation){
currentAnimFrame++;
if (currentAnimFrame > lastAnimFrame){
currentAnimFrame = firstAnimFrame;
};
};
if (health <= 0){
destroy();
};
}
public function explode(_arg1:Boolean=false, _arg2:entity=null, _arg3:Number=0):void{
if (_arg2 == null){
_arg2 = this;
};
root.explosionWaitingList.push({energy:_arg2, s:_arg1, r:_arg3});
}
public function destroy():void{
isAlive = false;
}
}
}//package main
Section 10
//entity_boss (main.entity_boss)
package main {
import flash.media.*;
public class entity_boss extends entity {
private var shotTimer:Number;// = 1
private var shotTimerMax:Number;// = 2
public var destroyed:Boolean;// = false
public var xDiff:Number;
public var yDiff:Number;
public var ste:Number;// = 0
public var strTmr:Number;// = 0
public var vd:Number;// = 1
public var rd:Number;
public var difficulty:Number;// = 1
public var lastHeroBullet:Object;
public var wc:Number;// = 0
public var wm:Number;// = 20
public var strTmrMs:Array;
public var w:Number;// = 0
public var v:Number;// = 0
public static var tmrE:Boolean = false;
public function entity_boss():void{
destroyed = false;
ste = 0;
strTmr = 0;
strTmrMs = [150, 400, 75];
v = 0;
vd = 1;
w = 0;
wc = 0;
wm = 20;
difficulty = 1;
shotTimer = 1;
shotTimerMax = 2;
super();
health = (maxHealth = 500);
}
private function shoot(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
root.enemyBulletsWaitingList.push({energy:this, xDiff:_arg1, yDiff:_arg2, rx:_arg3, ry:_arg4});
}
public function updateBoss(_arg1:entity):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:Sound;
var _local6:*;
var _local7:*;
if (x <= 560){
xVelocity = 0;
} else {
x = (x - 10);
};
if (w < 0){
shotTimer--;
};
w--;
v = (v + (vd * 0.3));
if (v > 10){
vd = -(Math.abs(vd));
} else {
if (v < -10){
vd = Math.abs(vd);
};
};
strTmr++;
if (strTmr > strTmrMs[ste]){
strTmr = 0;
ste++;
if (ste > (strTmrMs.length - 1)){
ste = 0;
};
};
xDiff = (game.heroEntity.x - x);
yDiff = (game.heroEntity.y - y);
if ((((isPlayingAnimation == true)) && ((currentAnimFrame == firstAnimFrame)))){
isPlayingAnimation = false;
};
lastHeroBullet = _arg1;
if (health > 0){
if (w >= 0){
w--;
};
if (ste == 0){
y = (y + ((game.heroEntity.y - y) / 20));
if (Math.abs((game.heroEntity.y - y)) < (75 + (25 * difficulty))){
_local2 = 5;
_local3 = ((difficulty - 1) * _local2);
_local4 = (_local3 / 2);
if (shotTimer < 0){
shotTimer = shotTimerMax;
_local6 = 0;
while (_local6 < difficulty) {
this.shoot(0, 0, 0, ((-(_local4) + (_local2 * _local6)) + vd));
_local6++;
};
};
shotTimer = shotTimerMax;
_local5 = new shotSound();
_local5.play(0, 0, root.st);
};
} else {
if (ste == 1){
y = (y + ((240 - y) / 20));
if (shotTimer < 0){
shoot(0, 0, 0, v);
shotTimer = shotTimerMax;
_local5 = new shotSound();
_local5.play(0, 0, root.st);
};
} else {
if (ste == 2){
_local2 = 5;
_local7 = 5;
_local3 = ((_local7 - 1) * _local2);
_local4 = (_local3 / 2);
if (shotTimer < 0){
shotTimer = shotTimerMax;
_local6 = 0;
while (_local6 < _local7) {
if (Math.random() < 0.8){
this.shoot(0, 0, 0, ((-(_local4) + (_local2 * _local6)) + vd));
};
_local6++;
};
};
_local5 = new shotSound();
_local5.play(0, 0, root.st);
};
};
};
wc++;
if (wc == 30){
w = wm;
};
if (game.playerOnScreen){
if (game.heroEntity.x > 320){
ste = 0;
strTmr = 0;
};
rd = 24000;
if (game.heroEntity.usingShield){
rd = 0x6400;
};
if ((((((xDiff * xDiff) + (yDiff * yDiff)) < rd)) && ((Math.abs(yDiff) < 70)))){
if (!game.heroEntity.usingShield){
game.heroEntity.health = Math.max((game.heroEntity.health - 10), 0);
} else {
game.heroEntity.energy = Math.max((game.heroEntity.energy - 4), 0);
};
if (game.heroEntity.health <= 0){
game.heroEntity.explode();
};
return;
};
};
if (x >= (game.heroEntity.x - 15)){
while (true) {
xDiff = (lastHeroBullet.x - x);
yDiff = (lastHeroBullet.y - y);
if ((((((((xDiff * xDiff) + (yDiff * yDiff)) < 9000)) && (lastHeroBullet.isAlive))) && ((Math.abs(yDiff) < 90)))){
x = (x + 5);
isPlayingAnimation = true;
health = (health - BULLET_STRENGTH);
if (maxHealth >= (BULLET_STRENGTH * lastHeroBullet.vt)){
lastHeroBullet.destroy();
} else {
lastHeroBullet.vt--;
};
if (health <= 0){
game.currentWaveKillCount++;
game.score = (game.score + (game.enemyScoreUnit * 20));
break;
};
};
if (lastHeroBullet.nextObject == null){
break;
};
lastHeroBullet = lastHeroBullet.nextObject;
};
};
x = (x + xVelocity);
y = (y + yVelocity);
if (isPlayingAnimation){
currentAnimFrame++;
if (currentAnimFrame > lastAnimFrame){
currentAnimFrame = firstAnimFrame;
};
};
} else {
if (!destroyed){
currentAnimFrame = (lastAnimFrame = (firstAnimFrame = (firstAnimFrame + 4)));
};
destroyed = true;
y = (y + 7);
if (shotTimer < 0){
shotTimer = (shotTimerMax / 2);
explode(false, this, 70);
if (y > 580){
destroy();
};
};
};
}
override public function destroy():void{
var _local1:startingNextWaveMc;
explode();
_local1 = new startingNextWaveMc();
_local1.x = 320;
_local1.y = 208;
root.masterMc.addChild(_local1);
root.showingMessage = true;
game.currentWaveKillCount = 0;
game.playingBoss = false;
super.destroy();
}
}
}//package main
Section 11
//entity_bullet (main.entity_bullet)
package main {
public class entity_bullet extends entity {
public var vt:Number;
public static const PI:Number = 0.0174532925199433;
override public function update():void{
if ((((x > 700)) && ((this.xVelocity > 0)))){
game.bulletToEnemyCollisionCount = 0;
destroy();
};
if (x < -50){
destroy();
};
super.update();
}
override public function destroy():void{
root.bulletsOnScreen = Math.max((root.bulletsOnScreen - 1), 0);
super.destroy();
}
}
}//package main
Section 12
//entity_enemy (main.entity_enemy)
package main {
import flash.media.*;
public class entity_enemy extends entity {
public var xDiff:Number;
public var yDiff:Number;
public var rd:Number;
public var bg:Boolean;// = false
public var lastHeroBullet:Object;
private var shotTimer:Number;// = 1
private var shotTimerMax:Number;// = 3
public static var tmrE:Boolean = false;
public function entity_enemy(){
shotTimer = 1;
shotTimerMax = 3;
bg = false;
super();
}
private function shoot(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
root.enemyBulletsWaitingList.push({energy:this, xDiff:_arg1, yDiff:_arg2, rx:_arg3, ry:_arg4});
}
public function updateEnemy():void{
var _local1:Sound;
if (x > 600){
x = (x - 10);
};
shotTimer--;
if ((((isPlayingAnimation == true)) && ((currentAnimFrame == lastAnimFrame)))){
isPlayingAnimation = false;
currentAnimFrame = firstAnimFrame;
};
if ((((((Math.abs((x - 390)) < 5)) && ((yVelocity == 0)))) && ((bg == false)))){
yVelocity = (Math.random() * 3);
if (game.heroEntity.y < y){
yVelocity = -(yVelocity);
};
};
if (x < -50){
if (bg){
root.bigOnScreen = false;
};
isAlive = false;
game.score = Math.max((game.score - Math.floor((game.enemyScoreUnit / 3))), 0);
root.enemiesOnScreen--;
return;
};
if (game.playerOnScreen == false){
x = (x - 14);
} else {
xDiff = (game.heroEntity.x - x);
yDiff = (game.heroEntity.y - y);
rd = 2000;
if (game.heroEntity.usingShield){
rd = 3500;
};
if (bg){
rd = (rd * 1.7);
};
if (((xDiff * xDiff) + (yDiff * yDiff)) < rd){
if (!game.heroEntity.usingShield){
game.heroEntity.health = Math.max((game.heroEntity.health - maxHealth), 0);
} else {
game.heroEntity.energy = Math.max((game.heroEntity.energy - (maxHealth * 0.4)), 0);
};
if (game.heroEntity.health <= 0){
game.heroEntity.explode();
};
if (game.heroEntity.usingShield){
destroySpecial();
game.shieldKillCount++;
} else {
destroy();
};
return;
};
};
rd = 3;
if (bg){
rd = 25;
};
if ((((Math.abs((game.heroEntity.y - y)) < (rd + (50 * root.factor)))) && ((shotTimer < 0)))){
if (!bg){
shoot();
} else {
shoot(0, -20, 0, -1);
shoot(0, 20, 1);
};
_local1 = new shotSound();
_local1.play(0, 0, root.st);
shotTimer = shotTimerMax;
};
update();
}
public function destroySpecial():void{
explode(true, this);
root.enemiesOnScreen--;
super.destroy();
}
override public function destroy():void{
if (bg){
root.bigOnScreen = false;
};
explode();
game.currentWaveKillCount++;
root.enemiesOnScreen--;
super.destroy();
}
public function bulletHitTest(_arg1:entity):void{
lastHeroBullet = _arg1;
while (true) {
if (((isAlive) && ((x <= 590)))){
xDiff = (lastHeroBullet.x - x);
yDiff = (lastHeroBullet.y - y);
rd = 700;
if (bg){
rd = (rd * 1.7);
};
if ((((((xDiff * xDiff) + (yDiff * yDiff)) < rd)) && (lastHeroBullet.isAlive))){
x = (x + 5);
isPlayingAnimation = true;
health = (health - BULLET_STRENGTH);
if (maxHealth >= (BULLET_STRENGTH * lastHeroBullet.vt)){
lastHeroBullet.destroy();
game.bulletToEnemyCollisionCount++;
} else {
lastHeroBullet.vt--;
};
if (health <= 0){
game.score = (game.score + game.enemyScoreUnit);
break;
};
};
};
if (lastHeroBullet.nextObject == null){
break;
};
lastHeroBullet = lastHeroBullet.nextObject;
};
}
}
}//package main
Section 13
//entity_explosion (main.entity_explosion)
package main {
public class entity_explosion extends entity {
override public function update():void{
if (currentAnimFrame == lastAnimFrame){
destroy();
};
super.update();
}
}
}//package main
Section 14
//entity_hero (main.entity_hero)
package main {
import flash.geom.*;
import flash.media.*;
import flash.ui.*;
public class entity_hero extends entity {
private var unit:Number;// = 4
public var energy:Number;// = 100
public var usingShield:Boolean;// = false
public var lastShieldFrame:Number;// = 87
public var maxEnergy:Number;// = 100
public var xDiff:Number;
public var yDiff:Number;
private var count:Number;
public var rechargingShield:Boolean;// = false
private var rd:Number;
public var lastEnemyBullet:entity;
public var firstShieldFrame:Number;// = 80
private var half:Number;
private var span:Number;
public var currentShieldFrame:Number;// = 80
public var shotTimer:Number;// = 0
private var d:Point;
public var ti:Number;
public function entity_hero():void{
shotTimer = 0;
currentShieldFrame = 80;
firstShieldFrame = 80;
lastShieldFrame = 87;
energy = game.START_MAX_ENERGY;
maxEnergy = game.START_MAX_ENERGY;
usingShield = false;
rechargingShield = false;
unit = 4;
super();
maxHealth = (health = game.START_MAX_HEALTH);
maxEnergy = (energy = game.START_MAX_ENERGY);
}
override public function destroy():void{
x = -100;
health = maxHealth;
game.lives--;
if (game.lives < 0){
root.quitGame("Game Over");
};
game.bulletToEnemyCollisionCount = 0;
game.shieldKillCount = 0;
game.ammo = game.maxAmmo;
game.playerOnScreen = false;
explode();
super.destroy();
}
public function updateHero(_arg1, _arg2, _arg3):void{
var _local4:Sound;
currentShieldFrame++;
if (currentShieldFrame > lastShieldFrame){
currentShieldFrame = firstShieldFrame;
};
usingShield = ((((Key.isDown(Keyboard.SHIFT)) && ((energy > 0)))) && ((rechargingShield == false)));
if (usingShield){
energy = Math.max((energy - 1), 0);
} else {
if (((!(rechargingShield)) && (!(Key.isDown(Keyboard.SHIFT))))){
energy = Math.min((energy + 1), maxEnergy);
health = Math.min((health + 0), maxHealth);
} else {
energy = Math.min((energy + 0.5), maxEnergy);
};
};
if ((((((energy <= 0)) && (Key.isDown(Keyboard.SHIFT)))) && (!(rechargingShield)))){
rechargingShield = true;
game.shieldKillCount = 0;
};
if ((((energy == maxEnergy)) && (rechargingShield))){
rechargingShield = false;
};
if ((((isPlayingAnimation == true)) && ((currentAnimFrame == 1)))){
isPlayingAnimation = false;
};
if (game.playerOnScreen){
rd = game.shipSpeed;
if (usingShield){
rd = (rd * 4);
};
xVelocity = (xVelocity + (-(xVelocity) / 5));
yVelocity = (yVelocity + (-(yVelocity) / 5));
if (game.useMouse){
d = new Point((_arg1 - x), (_arg2 - y));
d.normalize(Math.min(d.length, Math.abs((game.shipSpeed * 2))));
xVelocity = (xVelocity + ((d.x - xVelocity) / 5));
yVelocity = (yVelocity + ((d.y - yVelocity) / 5));
} else {
if (((Key.isDown(65)) || (Key.isDown(Keyboard.LEFT)))){
xVelocity = (xVelocity + (((-(game.shipSpeed) * 2) - xVelocity) / 5));
};
if (((Key.isDown(65)) || (Key.isDown(Keyboard.RIGHT)))){
xVelocity = (xVelocity + (((game.shipSpeed * 2) - xVelocity) / 5));
};
if (((Key.isDown(88)) || (Key.isDown(Keyboard.UP)))){
yVelocity = (yVelocity + (((-(game.shipSpeed) * 2) - yVelocity) / 5));
};
if (((Key.isDown(83)) || (Key.isDown(Keyboard.DOWN)))){
yVelocity = (yVelocity + (((game.shipSpeed * 2) - yVelocity) / 5));
};
};
x = (x + this.xVelocity);
y = (y + this.yVelocity);
} else {
if ((((root.enemiesOnScreen <= 0)) || (game.playingBoss))){
x = (x + ((100 - x) / 4));
if (Math.abs((100 - x)) < 4){
game.playerOnScreen = true;
};
return;
};
};
shotTimer--;
if (((((((((game.isMouseDown) || (Key.isDown(Keyboard.SPACE)))) && ((shotTimer < 0)))) && ((root.bulletsOnScreen < root.maxBulletsOnScreen)))) && (!(usingShield)))){
if (game.ammo > 0){
shotTimer = game.shotTimerMax;
span = ((game.shotCount - 1) * unit);
half = (span / 2);
count = Math.min(game.shotCount, game.ammo);
ti = 0;
while (ti < count) {
root.heroBulletsWaitingList.push({x:(this.x + 20), y:((this.y - half) + (unit * ti)), yVelocity:(-(half) + (unit * ti))});
ti++;
};
_local4 = new shotSound();
_local4.play(0, 0, root.st);
game.ammo = Math.max((game.ammo - count), 0);
};
};
lastEnemyBullet = _arg3;
usingShield = ((((Key.isDown(Keyboard.SHIFT)) && ((energy > 0)))) && ((rechargingShield == false)));
while (true) {
xDiff = (lastEnemyBullet.x - x);
yDiff = (lastEnemyBullet.y - y);
rd = 900;
if (usingShield){
rd = 1600;
};
if ((((((((xDiff * xDiff) + (yDiff * yDiff)) < rd)) && (lastEnemyBullet.isAlive))) && ((Math.abs(yDiff) <= 19)))){
if (usingShield == false){
health = Math.max((health - ENEMY_BULLET_STRENGTH), 0);
explode();
x = (x - 10);
} else {
energy = Math.max((energy - (ENEMY_BULLET_STRENGTH * 0.5)), 0);
explode(true, lastEnemyBullet);
};
isPlayingAnimation = true;
lastEnemyBullet.destroy();
};
if (lastEnemyBullet.nextObject == null){
break;
};
lastEnemyBullet = lastEnemyBullet.nextObject;
};
if (health <= 0){
destroy();
};
}
}
}//package main
Section 15
//entity_star (main.entity_star)
package main {
public class entity_star extends entity {
public static const PI:Number = 0.0174532925199433;
public static const BULLET_STRENGTH:Number = 5;
override public function update():void{
if (x > 640){
destroy();
};
x = (x + xVelocity);
y = (y + yVelocity);
super.update();
}
override public function destroy():void{
root.starsWaiting++;
root.starsOnScreen--;
super.destroy();
}
}
}//package main
Section 16
//game_button (main.game_button)
package main {
import flash.display.*;
import flash.events.*;
public class game_button extends SimpleButton {
private var _clickFunction:Function;
public function game_button():void{
this.addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
public function set clickFunction(_arg1:Function):void{
_clickFunction = _arg1;
}
private function removedFromStage(_arg1:Event):void{
this.removeEventListener(Event.REMOVED_FROM_STAGE, removedFromStage);
this.removeEventListener(MouseEvent.CLICK, click);
}
private function addedToStage(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
this.addEventListener(Event.REMOVED_FROM_STAGE, removedFromStage);
this.addEventListener(MouseEvent.CLICK, click);
}
public function get clickFunction():Function{
return (_clickFunction);
}
private function click(_arg1:MouseEvent):void{
var _local2:String;
if (isNavigationButton){
_local2 = name.replace("destination", "");
_local2 = _local2.replace("_", " ");
MovieClip(parent).gotoAndStop(_local2);
};
if (clickFunction != null){
clickFunction();
};
}
public function get isNavigationButton():Boolean{
return (!((name.toLowerCase().indexOf("destination") == -1)));
}
}
}//package main
Section 17
//Key (main.Key)
package main {
public class Key {
public static var keys:Array = new Array(0x0100);
public static var keys2:Array = new Array(0x0100);
public static function wasToggled(_arg1:Number):Boolean{
var _local2:Boolean;
_local2 = (keys2[_arg1] == true);
keys2[_arg1] = false;
return (_local2);
}
public static function isDown(_arg1:Number):Boolean{
return ((keys[_arg1] == true));
}
}
}//package main
Section 18
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("3.0 as3");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 19
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 20
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 21
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__ms_";
private static var _servicesURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
public static var netup:Boolean = true;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime()));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.0");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
public static function get id():String{
return (_id);
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
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))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_listenChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
trace("connected!");
_connecting = false;
_connected = true;
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var vars:URLVariables;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servicesURL != undefined){
_servicesURL = urlOptions(clip).servicesURL;
};
MochiServices.allowDomains(_servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor((Math.random() * 99999))));
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_servicesURL);
vars = new URLVariables();
vars.listenLC = _listenChannelName;
vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options;
if (widget){
vars.widget = true;
};
req.data = vars;
listen();
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 22
//backToMenu (backToMenu)
package {
import main.*;
public dynamic class backToMenu extends game_button {
}
}//package
Section 23
//bitmap (bitmap)
package {
import flash.display.*;
public dynamic class bitmap extends BitmapData {
public function bitmap(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 24
//bitmap2 (bitmap2)
package {
import flash.display.*;
public dynamic class bitmap2 extends BitmapData {
public function bitmap2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 25
//bkg (bkg)
package {
import flash.display.*;
public dynamic class bkg extends BitmapData {
public function bkg(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 26
//bossMusicSymbol (bossMusicSymbol)
package {
import flash.media.*;
public dynamic class bossMusicSymbol extends Sound {
}
}//package
Section 27
//button2 (button2)
package {
import main.*;
public dynamic class button2 extends game_button {
}
}//package
Section 28
//Continue (Continue)
package {
import main.*;
public dynamic class Continue extends game_button {
}
}//package
Section 29
//creditsButton (creditsButton)
package {
import main.*;
public dynamic class creditsButton extends game_button {
}
}//package
Section 30
//enterCheat (enterCheat)
package {
import main.*;
public dynamic class enterCheat extends game_button {
}
}//package
Section 31
//explosionSound (explosionSound)
package {
import flash.media.*;
public dynamic class explosionSound extends Sound {
}
}//package
Section 32
//game (game)
package {
import main.*;
public class game {
public static const MIN_ENEMY_HEALTH:Number = 5;
public static const MIN_ENEMY_SPEED:Number = 8;
public static const HEALTH_INCREASE_FACTOR:Number = 1.5;
public static const SLOWEST_SHOT_RATE:Number = 12;
public static const START_MAX_ENERGY:Number = 100;
public static const HEALTH_INCREASE_AMOUNT:Number = 20;
public static const MAX_ENEMY_SPEED:Number = 12;
public static const SLOWEST_SHIP_SPEED:Number = 7;
public static const TOTAL_WAVE_COUNT:Number = 50;
public static const MAX_ENEMY_HEALTH:Number = 50;
public static const ENERGY_INCREASE_FACTOR:Number = 1.5;
public static const FASTEST_SHIP_SPEED:Number = 14;
public static const MIN_ENEMY_DELAY:Number = 400;
public static const START_MAX_AMMO:Number = 300;
public static const MAX_WAVE_SIZE:Number = 300;
public static const MAX_ENEMY_DELAY:Number = 40;
public static const AMMO_INCREASE_FACTOR:Number = 1.5;
public static const FASTEST_SHOT_RATE:Number = 2;
public static const COIN_DIVISER:Number = 100;
public static const MIN_WAVE_SIZE:Number = 50;
public static const MIN_ENEMY_COUNT:Number = 10;
public static const START_MAX_HEALTH:Number = 100;
public static const ENEMY_SCORE_UNIT_MIN:Number = 100;
public static const MAX_ENEMY_COUNT:Number = 200;
public static const MAX_AMMO_INCREASE_RATE:Number = 100;
public static const ENEMY_SCORE_UNIT_MAX:Number = 1000;
public static var coins:Number = 0;
public static var shotTimerMax:Number = 2;
public static var lives:Number = 3;
public static var currentWave:Number = 1;
public static var enemySpeedArray:Array = new Array();
public static var playerOnScreen:Boolean = true;
public static var onScreen:Boolean = false;
public static var paused:Boolean = false;
public static var enemyDelayArray:Array = new Array();
public static var shotVitality:Number = 1;
public static var shotCount:Number = 1;
public static var bulletToEnemyCollisionCount:Number = 0;
public static var maxAmmo:Number = 300;
public static var ammoLevel:Number = 1;
public static var useMouse:Boolean = true;
public static var currentWaveKillCount:Number = 0;
public static var shipSpeed:Number = 7;
public static var useCheats:Boolean = true;
public static var shotSpreadLevel:Number = 1;
public static var heroEntity:entity_hero;
public static var bkgMusic:Boolean = true;
public static var healthLevel:Number = 1;
public static var enemyScoreUnit:Number = 100;
public static var score:Number = 0;
public static var showScore:Number = 0;
public static var enemyHealthArray:Array = new Array();
public static var playingBoss:Boolean = false;
public static var scoreUnitArray:Array = new Array();
public static var ammo:Number = 300;
public static var upgrades:Array = new Array();
public static var upgrading:Boolean = false;
public static var energyLevel:Number = 1;
public static var waveSizeArray:Array = new Array();
public static var shipSpeedLevel:Number = 1;
public static var bulletStrengthLevel:Number = 1;
public static var isMouseDown:Boolean = false;
public static var shieldKillCount:Number = 0;
public static var maxEnemiesOnScreenArray:Array = new Array();
public static var heroIndex:Number = 0;
public static var inPlay:Boolean = true;
public static function createStaticArrays(){
var _local1:*;
var _local2:*;
_local1 = 0;
while (_local1 < 150) {
_local2 = (_local1 / game.TOTAL_WAVE_COUNT);
game.scoreUnitArray.push((game.ENEMY_SCORE_UNIT_MIN + Math.floor(((game.ENEMY_SCORE_UNIT_MAX - game.ENEMY_SCORE_UNIT_MIN) * _local2))));
game.waveSizeArray.push((game.MIN_WAVE_SIZE + Math.floor(((game.MAX_WAVE_SIZE - game.MIN_WAVE_SIZE) * _local2))));
game.enemyDelayArray.push((game.MIN_ENEMY_DELAY + Math.floor(((game.MAX_ENEMY_DELAY - game.MIN_ENEMY_DELAY) * _local2))));
game.maxEnemiesOnScreenArray.push((game.MIN_ENEMY_COUNT + (Math.floor((game.MAX_ENEMY_COUNT - game.MIN_ENEMY_COUNT)) * _local2)));
game.enemyHealthArray.push((game.MIN_ENEMY_HEALTH + Math.floor(((game.MAX_ENEMY_HEALTH - game.MIN_ENEMY_HEALTH) * _local2))));
game.enemySpeedArray.push((game.MIN_ENEMY_SPEED + ((game.MAX_ENEMY_SPEED - game.MIN_ENEMY_SPEED) * _local2)));
_local1++;
};
}
public static function resetGameVariables(){
game.shotVitality = 1;
game.shotCount = 1;
game.maxAmmo = START_MAX_AMMO;
game.ammo = START_MAX_AMMO;
game.enemyScoreUnit = ENEMY_SCORE_UNIT_MIN;
game.shotTimerMax = FASTEST_SHOT_RATE;
game.shipSpeed = SLOWEST_SHIP_SPEED;
game.currentWave = 1;
game.currentWaveKillCount = 0;
game.coins = 0;
game.score = 0;
game.shieldKillCount = 0;
game.showScore = 0;
game.inPlay = true;
game.lives = 3;
game.paused = false;
game.playerOnScreen = true;
game.playingBoss = false;
game.upgrades = new Array();
game.shipSpeedLevel = 1;
game.ammoLevel = 1;
game.healthLevel = 1;
game.energyLevel = 1;
game.bulletStrengthLevel = 1;
game.shotSpreadLevel = 1;
game.heroEntity.maxHealth = (game.heroEntity.health = game.START_MAX_HEALTH);
game.heroEntity.maxEnergy = (game.heroEntity.energy = game.START_MAX_ENERGY);
if (cheats.userCheats.indexOf(cheats.I_WANT_IT_ALL) != -1){
cheats.userCheats = cheats.LIST;
};
if (cheats.userCheats.indexOf(cheats.TRIGGER_HAPPY) != -1){
game.ammo = (game.maxAmmo = 5000);
};
if (cheats.userCheats.indexOf(cheats.TEN_YEARS_OLD) != -1){
game.currentWave = 10;
};
if (cheats.userCheats.indexOf(cheats.TWENTY_YEARS_OLD) != -1){
game.currentWave = 20;
};
if (cheats.userCheats.indexOf(cheats.THIRTY_YEARS_OLD) != -1){
game.currentWave = 30;
};
if (cheats.userCheats.indexOf(cheats.FOURTY_YEARS_OLD) != -1){
game.currentWave = 40;
};
if (cheats.userCheats.indexOf(cheats.FIFTY_YEARS_OLD) != -1){
game.currentWave = 50;
};
if (cheats.userCheats.indexOf(cheats.KILLER_INSTINCT) != -1){
game.shotVitality = 5;
game.shotCount = 5;
};
if (cheats.userCheats.indexOf(cheats.CASH) != -1){
game.score = 10000000;
};
if (cheats.userCheats.indexOf(cheats.SPEEDING_BULLET) != -1){
game.shipSpeed = game.FASTEST_SHIP_SPEED;
};
if (cheats.userCheats.indexOf(cheats.RED_BULL) != -1){
game.heroEntity.health = (game.heroEntity.maxHealth = (game.heroEntity.energy = (game.heroEntity.maxEnergy = 2000)));
};
game.useCheats = (cheats.userCheats.length > 0);
}
public static function get bossCount():Number{
return ((game.currentWave * 10));
}
}
}//package
Section 33
//gameMusicSymbol (gameMusicSymbol)
package {
import flash.media.*;
public dynamic class gameMusicSymbol extends Sound {
}
}//package
Section 34
//gameMusicSymbol2 (gameMusicSymbol2)
package {
import flash.media.*;
public dynamic class gameMusicSymbol2 extends Sound {
}
}//package
Section 35
//gameMusicSymbol3 (gameMusicSymbol3)
package {
import flash.media.*;
public dynamic class gameMusicSymbol3 extends Sound {
}
}//package
Section 36
//gameMusicSymbol4 (gameMusicSymbol4)
package {
import flash.media.*;
public dynamic class gameMusicSymbol4 extends Sound {
}
}//package
Section 37
//gradient (gradient)
package {
import flash.display.*;
public dynamic class gradient extends MovieClip {
}
}//package
Section 38
//instructions (instructions)
package {
import main.*;
public dynamic class instructions extends game_button {
}
}//package
Section 39
//keyboard (keyboard)
package {
import main.*;
public dynamic class keyboard extends game_button {
}
}//package
Section 40
//leaderboards (leaderboards)
package {
import main.*;
public dynamic class leaderboards extends game_button {
}
}//package
Section 41
//mouse (mouse)
package {
import main.*;
public dynamic class mouse extends game_button {
}
}//package
Section 42
//pause (pause)
package {
import main.*;
public dynamic class pause extends game_button {
}
}//package
Section 43
//quitGame (quitGame)
package {
import main.*;
public dynamic class quitGame extends game_button {
}
}//package
Section 44
//reflectSound (reflectSound)
package {
import flash.media.*;
public dynamic class reflectSound extends Sound {
}
}//package
Section 45
//shotSound (shotSound)
package {
import flash.media.*;
public dynamic class shotSound extends Sound {
}
}//package
Section 46
//spaceBkg (spaceBkg)
package {
import flash.display.*;
public dynamic class spaceBkg extends BitmapData {
public function spaceBkg(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 47
//startGame (startGame)
package {
import main.*;
public dynamic class startGame extends game_button {
}
}//package
Section 48
//startingNextWaveMc (startingNextWaveMc)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class startingNextWaveMc extends MovieClip {
public function startingNextWaveMc(){
addFrameScript(49, frame50);
}
function frame50(){
stop();
MovieClip(root).startNextWave();
parent.removeChild(this);
}
}
}//package
Section 49
//submitScore (submitScore)
package {
import main.*;
public dynamic class submitScore extends game_button {
}
}//package
Section 50
//terrainBmp (terrainBmp)
package {
import flash.display.*;
public dynamic class terrainBmp extends BitmapData {
public function terrainBmp(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 51
//upgradeButton (upgradeButton)
package {
import main.*;
public dynamic class upgradeButton extends game_button {
}
}//package
Section 52
//useShipType1 (useShipType1)
package {
import main.*;
public dynamic class useShipType1 extends game_button {
}
}//package
Section 53
//useShipType2 (useShipType2)
package {
import main.*;
public dynamic class useShipType2 extends game_button {
}
}//package