Section 1
//DiffSelect_130 (Colorshot_fla.DiffSelect_130)
package Colorshot_fla {
import flash.display.*;
public dynamic class DiffSelect_130 extends MovieClip {
public var normal_btn:SimpleButton;
public var hard_btn:SimpleButton;
public var cancel_btn:SimpleButton;
public var extreme_btn:SimpleButton;
public var easy_btn:SimpleButton;
}
}//package Colorshot_fla
Section 2
//looseanimMC_80 (Colorshot_fla.looseanimMC_80)
package Colorshot_fla {
import flash.display.*;
public dynamic class looseanimMC_80 extends MovieClip {
public var player:PlayerMC;
}
}//package Colorshot_fla
Section 3
//UpgradeButton_39 (Colorshot_fla.UpgradeButton_39)
package Colorshot_fla {
import flash.display.*;
public dynamic class UpgradeButton_39 extends MovieClip {
public var dupe:MovieClip;
}
}//package Colorshot_fla
Section 4
//UpgradeInfo_45 (Colorshot_fla.UpgradeInfo_45)
package Colorshot_fla {
import flash.display.*;
import flash.text.*;
public dynamic class UpgradeInfo_45 extends MovieClip {
public var infotxt:TextField;
public var costtxt:TextField;
}
}//package Colorshot_fla
Section 5
//whole_logo_mc_103 (Colorshot_fla.whole_logo_mc_103)
package Colorshot_fla {
import flash.display.*;
public dynamic class whole_logo_mc_103 extends MovieClip {
public function whole_logo_mc_103(){
addFrameScript(115, frame116);
}
function frame116(){
stop();
}
}
}//package Colorshot_fla
Section 6
//winanimMC_52 (Colorshot_fla.winanimMC_52)
package Colorshot_fla {
import flash.display.*;
public dynamic class winanimMC_52 extends MovieClip {
public var player:PlayerMC;
public function winanimMC_52(){
addFrameScript(94, frame95);
}
function frame95(){
stop();
}
}
}//package Colorshot_fla
Section 7
//Bullet (gam.Bullet)
package gam {
public class Bullet extends BulletMC {
private var player:Player;
private var removeme:Boolean;// = false
private var yspeed:Number;
private var xspeed:Number;
private var angle:Number;
private var dx:Number;
private var dy:Number;
public function Bullet(p:Player){
super();
scaleX = p.bulletSize;
scaleY = p.bulletSize;
player = p;
}
public function move():void{
var e:Enemy;
x = (x - xspeed);
y = (y - yspeed);
if ((((x < 0)) || ((x > 600)))){
removeme = true;
};
if ((((y < 0)) || ((y > 500)))){
removeme = true;
};
for each (e in EnemyManager.enList) {
if (hitTestObject(e)){
e.hit();
removeme = true;
};
};
if (removeme){
player.removeBullet(this);
};
}
public function setDirection(iks:Number, ei:Number):void{
dx = (x - iks);
dy = (y - ei);
angle = Math.atan2(dy, dx);
rotation = ((angle * 180) / Math.PI);
xspeed = (Math.cos(angle) * 10);
yspeed = (Math.sin(angle) * 10);
}
}
}//package gam
Section 8
//Enemy (gam.Enemy)
package gam {
public class Enemy extends EnemyMC {
public var hits:Number;// = 1
private var acc:Number;// = 0.05
public var maxHits:Number;
private var speed:Number;
private var xspeed:Number;// = 0
private var angle:Number;
private var dx:Number;
private var dy:Number;
private var reload:Number;// = 0
private var maxXspeed:Number;// = 0
private var removeme:Boolean;// = false
private var player:Player;
private var yspeed:Number;// = 0
private var maxYspeed:Number;// = 0
public var color:String;
private var totalReload:Number;// = 120
public function Enemy(c:String, p:Player){
super();
color = c;
switch (color){
case "red":
speed = 0.7;
maxHits = 5;
break;
case "blue":
speed = 1;
maxHits = 4;
break;
case "purple":
speed = 1;
maxHits = 3;
break;
case "black":
speed = 1.5;
maxHits = 2;
break;
case "yellow":
maxHits = 3;
break;
case "white":
maxHits = 3;
break;
};
gotoAndStop((color + "1"));
player = p;
}
public function setDirection():void{
if (x == 0){
if ((((y == 0)) || ((y == 500)))){
y = (100 + (Math.random() * 200));
};
if (color == "white"){
maxXspeed = -2;
} else {
xspeed = -1.5;
};
} else {
if (x == 600){
if ((((y == 0)) || ((y == 500)))){
y = (100 + (Math.random() * 200));
};
if (color == "white"){
maxXspeed = 2;
} else {
xspeed = 1.5;
};
} else {
if (y == 0){
if ((((x == 0)) || ((x == 600)))){
x = (100 + (Math.random() * 350));
};
if (color == "white"){
maxYspeed = -2;
} else {
yspeed = -1.5;
};
} else {
if (y == 500){
if ((((x == 0)) || ((x == 600)))){
x = (100 + (Math.random() * 350));
};
if (color == "white"){
maxYspeed = -2;
} else {
yspeed = 1.5;
};
};
};
};
};
}
public function move():void{
if (color == "white"){
moveWhite();
} else {
if (color != "yellow"){
dx = (x - player.x);
dy = (y - player.y);
angle = Math.atan2(dy, dx);
xspeed = (Math.cos(angle) * speed);
yspeed = (Math.sin(angle) * speed);
};
x = (x - (xspeed * EnemyManager.speedQuotient));
y = (y - (yspeed * EnemyManager.speedQuotient));
if (color == "yellow"){
if (x < 0){
x = 600;
} else {
if (x > 600){
x = 0;
} else {
if (y < 0){
y = 500;
} else {
if (y > 500){
y = 0;
};
};
};
};
};
if (hitTestObject(player.hitarea)){
player.hit(this);
removeme = true;
};
if (color == "red"){
reload++;
if (reload == totalReload){
reload = 0;
EnemyManager.addBullet(this);
};
};
if (removeme){
EnemyManager.removeEnemy(this);
};
};
}
private function moveWhite():void{
if (maxXspeed < 0){
xspeed = (xspeed - acc);
if (xspeed < maxXspeed){
xspeed = 0;
};
} else {
if (maxXspeed > 0){
xspeed = (xspeed + acc);
if (xspeed > maxXspeed){
xspeed = 0;
};
} else {
if (maxYspeed < 0){
yspeed = (yspeed - acc);
if (yspeed < maxYspeed){
yspeed = 0;
};
} else {
if (maxYspeed > 0){
yspeed = (yspeed + acc);
if (yspeed > maxYspeed){
yspeed = 0;
};
};
};
};
};
x = (x - (xspeed * EnemyManager.speedQuotient));
y = (y - (yspeed * EnemyManager.speedQuotient));
if (x < 0){
x = 600;
} else {
if (x > 600){
x = 0;
} else {
if (y < 0){
y = 500;
} else {
if (y > 500){
y = 0;
};
};
};
};
if (hitTestObject(player.hitarea)){
player.hit(this);
removeme = true;
};
if (removeme){
EnemyManager.removeEnemy(this);
};
}
public function hit(missile:Boolean=false):void{
var puchance:Number;
hits++;
Game(parent).addScore(1);
if (missile){
hits = maxHits;
Game(parent).addScore(19);
};
if (hits < maxHits){
gotoAndStop((color + String(hits)));
} else {
puchance = Math.random();
switch (color){
case "red":
gotoAndStop("green4");
if (puchance < 0.1){
gotoAndStop("circleShot");
};
break;
case "blue":
gotoAndStop("green3");
if (puchance < 0.05){
gotoAndStop("extraGen");
};
break;
case "purple":
gotoAndStop("green2");
if (puchance < 0.1){
gotoAndStop("speedReduce");
};
break;
case "black":
gotoAndStop("green1");
if (puchance < 0.1){
gotoAndStop("cleanSweep");
};
break;
case "yellow":
gotoAndStop("green6");
if (puchance < 0.1){
gotoAndStop("extraScore");
};
break;
case "white":
gotoAndStop("green5");
break;
};
EnemyManager.enemyTransformed(this);
};
}
}
}//package gam
Section 9
//EnemyManager (gam.EnemyManager)
package gam {
public class EnemyManager {
private static var spawnQuotient:Number = 1;
private static var totalAlphaC:Number = 10;
private static var level:Number = 0;
private static var speedReduceCount:Number = 0;
public static var speedReduce:Boolean = false;
private static var totalSpawn:Number = 75;
private static var posList:Array = [[0, 0], [0, 100], [0, 200], [0, 300], [0, 400], [0, 500], [600, 0], [600, 100], [600, 200], [600, 300], [600, 400], [600, 500], [100, 0], [200, 0], [300, 0], [400, 0], [500, 0], [600, 0], [100, 500], [200, 500], [300, 500], [400, 500], [500, 500]];
private static var alphaC:Number = 0;
private static var totalSpeedReduce:Number = 240;
public static var levelDone:Boolean = false;
private static var totalSpawns:Number = 1;
private static var bulletList:Array;
private static var colors1:Array = ["red", "yellow", "white"];
private static var colors2:Array = ["red", "blue", "yellow", "white"];
private static var colors3:Array = ["red", "blue", "purple", "yellow", "white", "yellow", "white"];
private static var colors4:Array = ["red", "blue", "purple", "black", "yellow", "white", "yellow", "white", "yellow", "white"];
private static var currentColors:Array = colors1;
public static var transformedList:Array = new Array();
private static var spawnAdder:Number = 0;
private static var spawnCount:Number = 0;
public static var speedQuotient:Number = 1;
public static var enList:Array = new Array();
private static var startEnemies:Number = 10;
private static var game:Game;
public function EnemyManager(){
super();
}
public static function reduceSpeed():void{
speedReduce = true;
speedQuotient = 0;
speedReduceCount = 0;
}
public static function addBullet(e:Enemy):void{
var b:RedBullet = new RedBullet();
b.x = e.x;
b.y = e.y;
b.setDirection(game.player.x, game.player.y);
game.addChild(b);
bulletList.push(b);
}
public static function init(g:Game):void{
game = g;
}
public static function cleanup():void{
var e:Enemy;
var b:RedBullet;
alphaC = 0;
for each (e in enList) {
game.removeChild(e);
};
for each (b in bulletList) {
game.removeChild(b);
};
bulletList = new Array();
enList = new Array();
}
public static function removeBullet(b:RedBullet):void{
bulletList.splice(bulletList.indexOf(b), 1);
game.removeChild(b);
}
public static function cleanGreen():void{
var e2:Enemy;
for each (e2 in transformedList) {
game.removeChild(e2);
};
transformedList = new Array();
}
public static function reset():void{
var e:Enemy;
var e2:Enemy;
var b:RedBullet;
for each (e in enList) {
game.removeChild(e);
};
for each (e2 in transformedList) {
game.removeChild(e2);
};
for each (b in bulletList) {
game.removeChild(b);
};
enList = new Array();
transformedList = new Array();
bulletList = new Array();
spawnAdder = 0;
switch (game.difficulty){
case 1:
spawnQuotient = 0.1;
speedQuotient = 0.7;
startEnemies = 5;
break;
case 2:
spawnQuotient = 0.12;
speedQuotient = 1;
startEnemies = 7;
break;
case 3:
spawnQuotient = 0.14;
speedQuotient = 1.2;
startEnemies = 9;
break;
case 4:
spawnQuotient = 0.16;
speedQuotient = 1.4;
startEnemies = 10;
break;
};
nextLevel(1);
}
public static function nextLevel(l:Number):void{
var r:Number;
speedReduce = false;
speedReduceCount = 0;
if (game.difficulty == 1){
speedQuotient = 0.7;
} else {
if (game.difficulty == 3){
speedQuotient = 1.2;
} else {
if (game.difficulty == 4){
speedQuotient = 1.4;
} else {
speedQuotient = 1;
};
};
};
currentColors = colors1;
levelDone = false;
spawnAdder++;
totalSpawn = Math.round((17 / (spawnAdder * spawnQuotient)));
if (totalSpawn < 10){
totalSpawns++;
totalSpawn = 22;
spawnAdder = 6;
};
trace(l, spawnQuotient, "total spawn: ", totalSpawn, "spawns: ", totalSpawns);
spawnCount = 0;
if ((l % 3)){
startEnemies = (startEnemies + Math.round((game.difficulty / 2)));
};
if (l >= 3){
currentColors = colors2;
};
if (l >= 7){
currentColors = colors3;
};
if (l >= 15){
currentColors = colors4;
};
var workPos:Array = posList.concat();
var i:Number = 0;
while (i < startEnemies) {
r = Math.round((Math.random() * (workPos.length - 1)));
startUpSpawn(workPos[r][0], workPos[r][1]);
workPos.splice(r, 1);
if (workPos.length == 0){
break;
};
i++;
};
}
public static function step():void{
var e:Enemy;
var b:RedBullet;
var _e:Enemy;
if (!levelDone){
spawnCount++;
} else {
if (enList.length == 0){
game.gameWon();
};
};
if (spawnCount == totalSpawn){
spawn();
spawnCount = 0;
};
if (speedReduce){
speedReduceCount++;
if (speedReduceCount > 30){
speedQuotient = (speedReduceCount / totalSpeedReduce);
};
if (speedReduceCount == totalSpeedReduce){
if (game.difficulty == 1){
speedQuotient = 0.7;
} else {
if (game.difficulty == 3){
speedQuotient = 1.2;
} else {
if (game.difficulty == 4){
speedQuotient = 1.4;
} else {
speedQuotient = 1;
};
};
};
speedReduceCount = 0;
speedReduce = false;
};
};
for each (e in enList) {
e.move();
};
alphaC++;
if (alphaC == totalAlphaC){
alphaC = 0;
for each (_e in transformedList) {
_e.alpha = (_e.alpha - 0.06);
if (_e.alpha <= 0){
removeTransformedEnemy(_e);
};
};
};
for each (b in bulletList) {
b.move();
};
}
private static function startUpSpawn(iks:Number, ei:Number):void{
var e:Enemy;
var color:String = currentColors[Math.round((Math.random() * (currentColors.length - 1)))];
e = new Enemy(color, game.player);
e.x = iks;
e.y = ei;
game.addChildAt(e, 1);
if ((((e.color == "white")) || ((e.color == "yellow")))){
e.setDirection();
};
enList.push(e);
game.setEnemyText();
}
public static function removeTransformedEnemy(e:Enemy):void{
transformedList.splice(transformedList.indexOf(e), 1);
game.removeChild(e);
}
public static function enemyTransformed(e:Enemy):void{
enList.splice(enList.indexOf(e), 1);
game.setEnemyText();
transformedList.push(e);
}
public static function removeEnemy(e:Enemy):void{
enList.splice(enList.indexOf(e), 1);
game.setEnemyText();
game.removeChild(e);
}
private static function spawn():void{
var i:Number;
var color:String;
var e:Enemy;
var r:Number;
if (speedQuotient != 0){
i = 1;
while (i <= totalSpawns) {
color = currentColors[Math.round((Math.random() * (currentColors.length - 1)))];
e = new Enemy(color, game.player);
r = Math.round((Math.random() * (posList.length - 1)));
e.x = posList[r][0];
e.y = posList[r][1];
game.addChildAt(e, 1);
if ((((e.color == "white")) || ((e.color == "yellow")))){
e.setDirection();
};
enList.push(e);
game.setEnemyText();
i++;
};
};
}
}
}//package gam
Section 10
//Game (gam.Game)
package gam {
import flash.events.*;
import nav.*;
import ui.*;
import flash.utils.*;
import snd.*;
public class Game extends GameMC {
private var pauseScreen:PauseScreen;
private var level:Number;// = 0
private var diff:Number;
private var seconds:Number;// = 0
private var countdownMC:InfectedMC;
private var score:Number;// = 0
private var totalLevelTime:Number;
private var timeC:Number;// = 0
private var sweeper:Sweeper;
private var scoreLetters:String;
public var totalGenetics:Number;// = 0
private var lettersInScore:Number;// = 9
private var secStr:String;
private var upgradeScreen:UpgradeMenu;
public var paused:Boolean;// = false
private var geneticsCollected:Number;// = 0
private var levelKills:Number;
private var finalLevel:Boolean;// = false
private var countdown:Timer;
private var countdownC:Number;
public var mouseD:Boolean;// = false
private var totalLevels:Number;
private var scoreMulti:Number;// = 1
private var minutes:Number;// = 0
private var overScreen:GameOver;
public var player:Player;
private var countDownPaused:Boolean;// = false
private var circleShotBullets:Array;
private var strScore:String;
private var totalTime:Number;
private var scoreTexts:Array;
private var winScreen:WinScreen;
private var levelTime:Number;
private var minStr:String;
public function Game(){
player = new Player();
sweeper = new Sweeper();
circleShotBullets = new Array();
scoreTexts = new Array();
countdownMC = new InfectedMC();
countdown = new Timer(1000, 0);
pauseScreen = new PauseScreen();
overScreen = new GameOver();
winScreen = new WinScreen();
upgradeScreen = new UpgradeMenu();
super();
mouseChildren = false;
addChildAt(player, 1);
bgmc.addFrameScript(9, returnBG);
bgmc.addFrameScript(250, returnBG);
countdownMC.x = 300;
countdownMC.y = 250;
EnemyManager.init(this);
countdown.addEventListener(TimerEvent.TIMER, updateCountdown);
countdown.addEventListener(TimerEvent.TIMER_COMPLETE, countdownComplete);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
addEventListener(MouseEvent.MOUSE_UP, mouseUp);
}
public function addScore(a:Number, e:Enemy=null):void{
var s:ScoreTxt;
score = (score + ((a * level) * scoreMulti));
strScore = String(score);
var lamount:Number = strScore.length;
scoreLetters = "";
var i:Number = 0;
while (i < (lettersInScore - lamount)) {
scoreLetters = (scoreLetters + "0");
i++;
};
scoreLetters = (scoreLetters + strScore);
scoretxt.text = scoreLetters;
if (e != null){
s = new ScoreTxt((a * level));
s.x = e.x;
s.y = e.y;
addChild(s);
scoreTexts.push(s);
};
}
public function slowEffect():void{
bgmc.gotoAndPlay(11);
}
public function unpause():void{
mouseChildren = false;
removeChild(pauseScreen);
trace("unpause");
Navigation.regainFocus();
if (countDownPaused){
countdown.start();
countDownPaused = false;
};
addEventListener(Event.ENTER_FRAME, run);
paused = false;
}
private function countdownComplete():void{
var b:Object;
countdown.stop();
removeEventListener(Event.ENTER_FRAME, run);
removeChild(countdownMC);
mouseChildren = true;
EnemyManager.cleanGreen();
if (contains(sweeper)){
removeChild(sweeper);
};
if (circleShotBullets.length > 0){
for each (b in circleShotBullets) {
removeChild(b.clip);
};
circleShotBullets = new Array();
};
updateData();
if (!finalLevel){
player.x = 300;
player.y = 250;
upgradeScreen.update(geneticsCollected, totalGenetics, player.health, player.totalHealth, player.shield, player.totalShield);
addChild(upgradeScreen);
} else {
SaveGameData.addVictory(difficulty);
Navigation.submitToKongregate(score, difficulty);
Music.stopSong(Music.FADE_OUT);
SoundManager.playSound("win", 2, 0.3);
winScreen.settings(player.currentFrame, score);
addChild(winScreen);
};
}
public function hitEffect():void{
if (bgmc.currentFrame == 1){
bgmc.gotoAndPlay(2);
};
}
private function addSecond():void{
totalTime++;
levelTime++;
seconds++;
if (seconds == 60){
seconds = 0;
minutes++;
};
if (levelTime == totalLevelTime){
EnemyManager.levelDone = true;
};
if (seconds < 10){
secStr = ("0" + String(seconds));
} else {
secStr = String(seconds);
};
if (minutes < 10){
minStr = ("0" + String(minutes));
} else {
minStr = String(minutes);
};
timetxt.text = ((minStr + ":") + secStr);
}
private function updateCountdown(e:TimerEvent):void{
countdownC--;
countdownMC.countdown.text = String(countdownC);
if (countdownC == 0){
countdownComplete();
};
}
public function setEnemyText():void{
levelKills++;
entxt.text = String(EnemyManager.enList.length);
}
private function run(e:Event):void{
var b:Object;
var s:ScoreTxt;
var en:Enemy;
var _en:Enemy;
if (((Key.isDown(80)) && (!(paused)))){
pause();
};
player.move();
if (!countdown.running){
EnemyManager.step();
timeC++;
if (timeC == 30){
timeC = 0;
addSecond();
};
};
if (contains(sweeper)){
sweeper.scaleX = (sweeper.scaleX + 1);
sweeper.scaleY = (sweeper.scaleY + 1);
sweeper.alpha = (sweeper.alpha - 0.07);
for each (en in EnemyManager.enList) {
if (sweeper.hitTestObject(en)){
en.hit();
};
};
if (sweeper.alpha <= 0){
removeChild(sweeper);
};
};
for each (b in circleShotBullets) {
b.clip.x = (b.clip.x + b.xspeed);
b.clip.y = (b.clip.y + b.yspeed);
for each (_en in EnemyManager.enList) {
if (b.clip.hitTestObject(_en)){
_en.hit();
};
};
if ((((((((b.clip.x < 0)) || ((b.clip.x > 600)))) || ((b.clip.y < 0)))) || ((b.clip.y > 500)))){
circleShotBullets.splice(circleShotBullets.indexOf(b), 1);
removeChild(b.clip);
};
};
for each (s in scoreTexts) {
s.y = (s.y - 1);
s.alpha = (s.alpha - 0.01);
if (s.alpha <= 0){
scoreTexts.splice(scoreTexts.indexOf(s), 1);
removeChild(s);
};
};
}
public function cleanSweep():void{
sweeper.scaleX = 1;
sweeper.scaleY = 1;
sweeper.alpha = 1;
sweeper.x = player.x;
sweeper.y = player.y;
addChild(sweeper);
}
public function get difficulty():Number{
return (diff);
}
public function newGame():void{
mouseChildren = false;
player.x = 300;
player.y = 250;
player.reset();
bgmc.gotoAndStop(1);
EnemyManager.reset();
SaveGameData.addGame();
upgradeScreen.reset();
level = 1;
scoreMulti = 1;
timeC = 0;
seconds = 0;
minutes = 0;
totalTime = 0;
score = 0;
addScore(0);
totalGenetics = 0;
setGenetics(0);
setEnemyText();
finalLevel = false;
levelKills = 0;
levelTime = 0;
wavetxt.text = ((String(level) + "/") + String(totalLevels));
addEventListener(Event.ENTER_FRAME, run);
}
public function setGenetics(a:Number, e:Enemy=null):void{
var s:ScoreTxt;
if (a > 0){
totalGenetics = (totalGenetics + (a * 5));
geneticstxt.text = String(totalGenetics);
geneticsCollected = (geneticsCollected + (a * 5));
} else {
totalGenetics = (totalGenetics + a);
geneticstxt.text = String(totalGenetics);
geneticsCollected = (geneticsCollected + a);
};
if (e != null){
s = new ScoreTxt(a);
s.x = e.x;
s.y = e.y;
s.setText((("+ " + String((a * 5))) + " GEN"));
addChild(s);
scoreTexts.push(s);
};
}
public function gameWon():void{
if (!contains(countdownMC)){
EnemyManager.cleanup();
addChild(countdownMC);
countdownC = 3;
countdownMC.countdown.text = "3";
countdown.reset();
countdown.start();
};
}
public function gameover():void{
var b:Object;
removeEventListener(Event.ENTER_FRAME, run);
if (circleShotBullets.length > 0){
for each (b in circleShotBullets) {
removeChild(b.clip);
};
circleShotBullets = new Array();
};
Music.stopSong(Music.FADE_OUT);
SoundManager.playSound("loose", 2, 0.6);
updateData();
mouseChildren = true;
overScreen.setCell(player.currentFrame);
addChild(overScreen);
}
public function setHealthTxt(h:Number, t:Number):void{
if (h < 0){
h = 0;
};
healthtxt.text = ((String(h) + "/") + String(t));
}
private function updateData():void{
SaveGameData.setScore(score);
SaveGameData.setLevel(level);
SaveGameData.setCell(player.currentFrame);
SaveGameData.setShortest(totalTime);
SaveGameData.setLongest(totalTime);
SaveGameData.setTime(levelTime);
SaveGameData.setInfections(levelKills);
}
private function mouseUp(e:MouseEvent):void{
mouseD = false;
}
public function nextLevel():void{
removeChild(upgradeScreen);
Navigation.regainFocus();
mouseChildren = false;
bgmc.gotoAndStop(1);
level++;
if (level == totalLevels){
finalLevel = true;
};
player.nextLevel();
wavetxt.text = ((String(level) + "/") + String(totalLevels));
levelKills = 0;
levelTime = 0;
EnemyManager.nextLevel(level);
setEnemyText();
geneticsCollected = 0;
setGenetics(0);
addEventListener(Event.ENTER_FRAME, run);
}
public function scoreMultiUp():void{
scoreMulti++;
}
private function mouseDown(e:MouseEvent):void{
mouseD = true;
}
public function pushUnPause(removeScreen:Boolean=false):void{
mouseChildren = false;
Navigation.regainFocus();
if (countDownPaused){
countdown.start();
countDownPaused = false;
};
addEventListener(Event.ENTER_FRAME, run);
paused = false;
}
private function returnBG():void{
bgmc.gotoAndStop(1);
}
public function set difficulty(d:Number):void{
diff = d;
switch (d){
case 1:
totalLevels = 15;
totalLevelTime = 30;
break;
case 2:
totalLevels = 20;
totalLevelTime = 40;
break;
case 3:
totalLevels = 25;
totalLevelTime = 50;
break;
case 4:
totalLevels = 30;
totalLevelTime = 60;
break;
};
}
public function circleShot():void{
var bul:BulletMC;
var b:Object;
var i:Number = 1;
while (i <= 8) {
bul = new BulletMC();
b = {clip:bul, xspeed:0, yspeed:0};
switch (i){
case 1:
b.clip.x = player.x;
b.clip.y = (player.y - 6);
b.clip.rotation = 90;
b.xspeed = 0;
b.yspeed = -4;
break;
case 2:
b.clip.x = (player.x + 3);
b.clip.y = (player.y - 3);
b.clip.rotation = -45;
b.xspeed = 2;
b.yspeed = -2;
break;
case 3:
b.clip.x = (player.x + 6);
b.clip.y = player.y;
b.xspeed = 4;
b.yspeed = 0;
break;
case 4:
b.clip.x = (player.x + 3);
b.clip.y = (player.y + 3);
b.clip.rotation = 45;
b.xspeed = 2;
b.yspeed = 2;
break;
case 5:
b.clip.x = player.x;
b.clip.y = (player.y + 6);
b.clip.rotation = 90;
b.xspeed = 0;
b.yspeed = 4;
break;
case 6:
b.clip.x = (player.x - 3);
b.clip.y = (player.y + 3);
b.clip.rotation = -45;
b.xspeed = -2;
b.yspeed = 2;
break;
case 7:
b.clip.x = (player.x - 6);
b.clip.y = player.y;
b.xspeed = -4;
b.yspeed = 0;
break;
case 8:
b.clip.x = (player.x - 3);
b.clip.y = (player.y - 3);
b.clip.rotation = 45;
b.xspeed = -2;
b.yspeed = -2;
break;
};
addChild(b.clip);
circleShotBullets.push(b);
i++;
};
}
public function pushPause(addScreen:Boolean=false):void{
if (((((!(contains(upgradeScreen))) && (!(contains(overScreen))))) && (!(contains(winScreen))))){
removeEventListener(Event.ENTER_FRAME, run);
mouseChildren = true;
paused = true;
if (countdown.running){
countdown.stop();
countDownPaused = true;
};
if (addScreen){
addChild(pauseScreen);
};
};
}
private function pause():void{
removeEventListener(Event.ENTER_FRAME, run);
mouseChildren = true;
paused = true;
if (countdown.running){
countdown.stop();
countDownPaused = true;
};
addChild(pauseScreen);
}
}
}//package gam
Section 11
//Key (gam.Key)
package gam {
import flash.events.*;
import flash.display.*;
import nav.*;
public class Key {
private static var quals:Array = ["low", "medium", "high", "best"];
public static var curQual:Number;
private static var mystage:Stage;
private static var initialized:Boolean = false;
private static var keysDown:Object = new Object();
public function Key(){
super();
}
private static function clearKeys(event:Event):void{
keysDown = new Object();
}
private static function keyPressed(event:KeyboardEvent):void{
keysDown[event.keyCode] = true;
}
public static function clear():void{
keysDown = new Object();
}
public static function initialize(stage:Stage):void{
if (!initialized){
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
stage.addEventListener(Event.DEACTIVATE, clearKeys);
mystage = stage;
initialized = true;
};
}
public static function isDown(keyCode:uint):Boolean{
if (!initialized){
throw (new Error("Key class has not yet been initialized."));
};
return (Boolean(keysDown[keyCode]));
}
private static function keyReleased(event:KeyboardEvent):void{
keysDown[event.keyCode] = false;
if (event.keyCode == 81){
curQual++;
if (curQual == 4){
curQual = 1;
};
mystage.quality = quals[(curQual - 1)];
SaveGameData.setQuality(quals[(curQual - 1)]);
};
}
public static function setQuality(q:String):void{
curQual = quals.indexOf(q);
mystage.quality = q;
SaveGameData.setQuality(q);
}
}
}//package gam
Section 12
//Missile (gam.Missile)
package gam {
import flash.display.*;
public class Missile extends MissileMC {
private var acc:Number;// = 0.1
private var speed:Number;// = 2
private var xspeed:Number;
private var target:MovieClip;
private var angle:Number;
private var dx:Number;
private var dy:Number;
private var health:Number;// = 3
private var player:Player;
private var dist:Number;
private var yspeed:Number;
private var gotTarget:Boolean;// = false
public function Missile(p:Player){
super();
player = p;
stop();
}
private function getTarget():void{
var closest:Number;
var e:Enemy;
if (EnemyManager.enList.length != 0){
closest = 1000;
for each (e in EnemyManager.enList) {
dx = (e.x - x);
dy = (e.y - y);
dist = Math.sqrt(((dx * dx) + (dy * dy)));
if (dist < closest){
closest = dist;
target = e;
gotTarget = true;
};
};
} else {
player.removeMissile(this);
};
}
public function move():void{
var e:Enemy;
if (!gotTarget){
getTarget();
} else {
if ((((target.currentFrame < 15)) && (parent.contains(target)))){
dx = (target.x - x);
dy = (target.y - y);
angle = Math.atan2(dy, dx);
rotation = (((angle * 180) / Math.PI) - 180);
speed = (speed + acc);
xspeed = (Math.cos(angle) * speed);
yspeed = (Math.sin(angle) * speed);
x = (x + xspeed);
y = (y + yspeed);
for each (e in EnemyManager.enList) {
if (hitTestObject(e)){
e.hit(true);
health--;
scaleX = (scaleX - 0.2);
scaleY = (scaleY - 0.2);
nextFrame();
if (health == 0){
player.removeMissile(this);
} else {
gotTarget = false;
};
};
};
} else {
gotTarget = false;
};
};
}
}
}//package gam
Section 13
//Player (gam.Player)
package gam {
import flash.ui.*;
import snd.*;
import flash.filters.*;
import flash.geom.*;
public class Player extends PlayerMC {
private var acc:Number;// = 0.3
private var dupeList:Array;
private var friction:Number;// = 0.1
private var level:Number;// = 0
private var minSpeed:Number;// = 0.1
private var shieldGF:GlowFilter;
private var reload:Number;// = 0
private var up:Boolean;// = false
private var missileAmount:Number;// = 1
public var bulletSize:Number;// = 1
private var regenC:Number;// = 0
private var canShoot:Boolean;// = true
private var haveMissile:Boolean;// = false
private var bulletList:Array;
private var maxSpeed:Number;// = 2
public var totalHealth:Number;// = 20
private var missileDupeList:Array;
private var canRegen:Boolean;// = false
private var xspeed:Number;// = 0
public var totalShield:Number;// = 0
private var effectList:Array;
private var totalRegen:Number;// = 150
private var missileReload:Number;
public var health:Number;// = 20
private var missileList:Array;
public var shield:Number;// = 0
private var yspeed:Number;// = 0
private var canShootMissile:Boolean;// = false
private var bulletAmount:Number;// = 1
private var totalMissileReload:Number;// = 200
private var totalReload:Number;// = 18
public function Player(){
dupeList = new Array();
bulletList = new Array();
shieldGF = new GlowFilter(15332445, 0.7, 4, 4, 2);
missileList = new Array();
missileDupeList = new Array();
super();
}
public function addBullet():void{
bulletAmount++;
}
public function upMove():void{
maxSpeed = (maxSpeed + 0.5);
}
private function shootMissile():void{
var m:Missile;
var p:Point;
var locp:Point;
for each (m in missileDupeList) {
removeChild(m);
p = new Point(m.x, m.y);
locp = this.localToGlobal(p);
m.x = locp.x;
m.y = locp.y;
parent.addChild(m);
missileList.push(m);
};
missileDupeList = [];
}
public function removeMissile(m:Missile):void{
missileList.splice(missileList.indexOf(m), 1);
if (parent.contains(m)){
parent.removeChild(m);
};
}
public function hit(e:Enemy):void{
if (e == null){
SoundManager.playSound("enHit", 1, 0.3);
Game(parent).hitEffect();
looseHealth(2);
} else {
SoundManager.playSound("enHit", 1, 0.3);
Game(parent).hitEffect();
switch ((e.maxHits - e.hits)){
case 1:
looseHealth(2);
break;
case 2:
looseHealth(4);
break;
case 3:
looseHealth(6);
break;
case 4:
looseHealth(8);
break;
};
};
}
public function resetShield():void{
shield = totalShield;
shieldGF.blurX = shield;
shieldGF.blurY = shield;
filters = [shieldGF];
}
private function shoot():void{
var bullet2:Bullet;
var bullet3:Bullet;
var bullet:Bullet = new Bullet(this);
bullet.x = x;
bullet.y = y;
bullet.setDirection(parent.mouseX, parent.mouseY);
parent.addChild(bullet);
bulletList.push(bullet);
SoundManager.playSound("shoot", 3, 1.2);
if (bulletAmount > 1){
bullet2 = new Bullet(this);
bullet2.x = (x - 2);
bullet2.y = (y - 2);
bullet2.setDirection(parent.mouseX, parent.mouseY);
parent.addChild(bullet2);
bulletList.push(bullet2);
};
if (bulletAmount > 2){
bullet3 = new Bullet(this);
bullet3.x = (x + 2);
bullet3.y = (y + 2);
bullet3.setDirection(parent.mouseX, parent.mouseY);
parent.addChild(bullet3);
bulletList.push(bullet3);
};
}
private function looseHealth(a:Number):void{
var left:Number;
if (shield > a){
shield = (shield - a);
shieldGF.blurX = shield;
shieldGF.blurY = shield;
} else {
left = (a - shield);
health = (health - left);
filters = [];
shield = 0;
};
checkCondition();
}
public function upReload():void{
totalReload = (totalReload - 2);
reload = 0;
}
private function hitEnemy(e:Enemy):void{
switch (e.color){
case "red":
if (e.currentLabel == "circleShot"){
Game(parent).circleShot();
SoundManager.playSound("shoot", 5, 1);
SoundManager.playSound("shoot", 5, 1);
SoundManager.playSound("shoot", 5, 1);
SoundManager.playSound("shoot", 5, 1);
SoundManager.playSound("shoot", 5, 1);
} else {
SoundManager.playSound("transform", 3, 1.5);
Game(parent).setGenetics(1);
Game(parent).addScore(10, e);
};
break;
case "yellow":
if (e.currentLabel == "extraScore"){
SoundManager.playSound("scoreup", 2, 0.1);
Game(parent).addScore(5000, e);
} else {
SoundManager.playSound("transform", 3, 1.5);
Game(parent).setGenetics(1);
Game(parent).addScore(20, e);
};
break;
case "white":
SoundManager.playSound("transform", 3, 1.5);
Game(parent).setGenetics(1);
Game(parent).addScore(20, e);
break;
case "blue":
if (e.currentLabel == "extraGen"){
SoundManager.playSound("genup", 2, 0.1);
Game(parent).setGenetics(20, e);
} else {
SoundManager.playSound("transform", 3, 1.5);
Game(parent).setGenetics(2);
Game(parent).addScore(10, e);
};
break;
case "purple":
if (e.currentLabel == "speedReduce"){
SoundManager.playSound("slow", 1, 0.5);
Game(parent).slowEffect();
EnemyManager.reduceSpeed();
} else {
SoundManager.playSound("transform", 3, 1.5);
Game(parent).setGenetics(2);
Game(parent).addScore(10, e);
};
break;
case "black":
if (e.currentLabel == "cleanSweep"){
SoundManager.playSound("sweep", 2, 0.2);
Game(parent).cleanSweep();
} else {
SoundManager.playSound("transform", 3, 1.5);
Game(parent).setGenetics(3);
Game(parent).addScore(25, e);
};
break;
};
EnemyManager.removeTransformedEnemy(e);
}
public function regenUp():void{
if (!canRegen){
canRegen = true;
} else {
totalRegen = (totalRegen - 10);
};
regenC = 0;
}
public function nextLevel():void{
var i:Number;
var m:Missile;
xspeed = 0;
yspeed = 0;
reload = 0;
canShoot = true;
regenC = 0;
if (haveMissile){
i = 0;
while (i < missileAmount) {
m = new Missile(this);
if (i == 0){
m.y = -15;
} else {
m.y = 15;
};
addChildAt(m, 0);
missileDupeList.push(m);
i++;
};
canShootMissile = true;
};
}
public function removeBullet(b:Bullet):void{
bulletList.splice(bulletList.indexOf(b), 1);
parent.removeChild(b);
}
public function upHealth(a:Number):void{
if (a == 0){
health = totalHealth;
} else {
totalHealth = (totalHealth + a);
health = (health + a);
};
Game(parent).setHealthTxt(health, totalHealth);
}
public function move():void{
var m:Missile;
var b:Bullet;
var e:Enemy;
var i:Number;
var _m:Missile;
if (((((Key.isDown(Keyboard.LEFT)) || (Key.isDown(65)))) && ((xspeed > -(maxSpeed))))){
xspeed = (xspeed - acc);
};
if (((((Key.isDown(Keyboard.RIGHT)) || (Key.isDown(68)))) && ((xspeed < maxSpeed)))){
xspeed = (xspeed + acc);
};
if (((((Key.isDown(Keyboard.UP)) || (Key.isDown(87)))) && ((yspeed > -(maxSpeed))))){
yspeed = (yspeed - acc);
};
if (((((Key.isDown(Keyboard.DOWN)) || (Key.isDown(83)))) && ((yspeed < maxSpeed)))){
yspeed = (yspeed + acc);
};
if (((((haveMissile) && (canShootMissile))) && (Key.isDown(Keyboard.SPACE)))){
shootMissile();
canShootMissile = false;
};
if (((haveMissile) && (!(canShootMissile)))){
missileReload++;
if (missileReload == totalMissileReload){
canShootMissile = true;
missileReload = 0;
i = 0;
while (i < missileAmount) {
_m = new Missile(this);
if (i == 0){
_m.y = -15;
} else {
_m.y = 15;
};
addChildAt(_m, 0);
missileDupeList.push(_m);
i++;
};
};
};
for each (m in missileList) {
m.move();
};
if (xspeed > 0){
xspeed = (xspeed - friction);
if (xspeed < minSpeed){
xspeed = 0;
};
} else {
xspeed = (xspeed + friction);
if (xspeed > -(minSpeed)){
xspeed = 0;
};
};
if (yspeed > 0){
yspeed = (yspeed - friction);
if (yspeed < minSpeed){
yspeed = 0;
};
} else {
yspeed = (yspeed + friction);
if (yspeed > -(minSpeed)){
yspeed = 0;
};
};
if ((((x > 10)) && ((x < 590)))){
x = (x + xspeed);
} else {
xspeed = 0;
if (x <= 10){
x = 11;
};
if (x >= 590){
x = 589;
};
};
if ((((y > 10)) && ((y < 490)))){
y = (y + yspeed);
} else {
yspeed = 0;
if (y <= 10){
y = 11;
};
if (y >= 490){
y = 489;
};
};
if (((Game(parent).mouseD) && (canShoot))){
canShoot = false;
shoot();
};
if (!canShoot){
reload++;
if (reload == totalReload){
reload = 0;
canShoot = true;
};
};
for each (b in bulletList) {
b.move();
};
for each (e in EnemyManager.transformedList) {
if (hitarea.hitTestObject(e)){
hitEnemy(e);
};
};
if (((((canRegen) && ((health < totalHealth)))) && (!(EnemyManager.levelDone)))){
regenC++;
};
if (regenC == totalRegen){
regenC = 0;
health++;
Game(parent).setHealthTxt(health, totalHealth);
};
}
public function biggerMicrobes():void{
bulletSize = (bulletSize + 0.2);
}
public function reset():void{
var m:Missile;
reload = 0;
canShoot = true;
missileReload = 0;
missileAmount = 1;
canShootMissile = false;
haveMissile = false;
totalMissileReload = 200;
xspeed = 0;
yspeed = 0;
health = 20;
totalHealth = 20;
effectList = new Array();
regenC = 0;
totalRegen = 100;
canRegen = false;
maxSpeed = 2;
totalReload = 18;
bulletSize = 1;
bulletAmount = 1;
gotoAndStop(1);
for each (m in missileDupeList) {
removeChild(m);
};
missileDupeList = new Array();
Game(parent).setHealthTxt(health, totalHealth);
}
public function upShield():void{
totalShield = (totalShield + 10);
shield = (shield + 10);
shieldGF.blurX = shield;
shieldGF.blurY = shield;
filters = [shieldGF];
}
private function checkCondition():void{
Game(parent).setHealthTxt(health, totalHealth);
if (health <= 0){
health = 0;
Game(parent).gameover();
};
}
public function virusUp(second:Boolean=false):void{
if (!haveMissile){
haveMissile = true;
} else {
if (second){
missileAmount++;
} else {
totalMissileReload = (totalMissileReload - 25);
missileReload = 0;
};
};
}
}
}//package gam
Section 14
//RedBullet (gam.RedBullet)
package gam {
public class RedBullet extends RedBulletMC {
private var yspeed:Number;
private var xspeed:Number;
private var angle:Number;
private var dx:Number;
private var dy:Number;
private var removeme:Boolean;// = false
public function RedBullet(){
super();
}
public function move():void{
x = (x - (xspeed * EnemyManager.speedQuotient));
y = (y - (yspeed * EnemyManager.speedQuotient));
if ((((x < 0)) || ((x > 600)))){
removeme = true;
};
if ((((y < 0)) || ((y > 500)))){
removeme = true;
};
if (hitTestObject(Game(parent).player.hitarea)){
Game(parent).player.hit(null);
removeme = true;
};
if (removeme){
EnemyManager.removeBullet(this);
};
}
public function setDirection(iks:Number, ei:Number):void{
dx = (x - iks);
dy = (y - ei);
angle = Math.atan2(dy, dx);
rotation = ((angle * 180) / Math.PI);
xspeed = (Math.cos(angle) * 2);
yspeed = (Math.sin(angle) * 2);
}
}
}//package gam
Section 15
//ScoreTxt (gam.ScoreTxt)
package gam {
public class ScoreTxt extends ScoreTxtMC {
public function ScoreTxt(s:Number){
super();
scoretxt.text = ("+" + String(s));
}
public function setText(t:String):void{
scoretxt.text = t;
}
}
}//package gam
Section 16
//UpgradeMenu (gam.UpgradeMenu)
package gam {
import flash.events.*;
import flash.display.*;
import snd.*;
public class UpgradeMenu extends UpgradeMC {
private var states:Array;
private var moveUpgrades:Array;
private var scoreUpgrades:Array;
private var upEff:UpEffect;
private var cost:Number;
private var healthUpgrades:Array;
private var upgradeState:Number;// = 0
private var allUpgrades:Array;
private var shieldUpgrades:Array;
private var virusUpgrades:Array;
private var regenUpgrades:Array;
private var microbeUpgrades:Array;
public function UpgradeMenu(){
upEff = new UpEffect();
super();
addChild(upEff);
upEff.visible = false;
healthUpgrades = [health1, health2, health3, health4, health5];
microbeUpgrades = [microbes1, microbes2, microbes3, microbes4, microbes5, microbes6, microbes7, microbes8, microbes9, microbes10];
shieldUpgrades = [shield1, shield2, shield3, shield4, shield5];
moveUpgrades = [move1, move2, move3, move4, move5];
virusUpgrades = [virus1, virus2, virus3, virus4, virus5];
regenUpgrades = [regen1, regen2, regen3, regen4, regen5];
scoreUpgrades = [score1, score2, score3, score4, score5];
allUpgrades = [healthUpgrades, shieldUpgrades, moveUpgrades, microbeUpgrades, virusUpgrades, regenUpgrades, scoreUpgrades];
states = [e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15];
nextWave.addEventListener(MouseEvent.CLICK, startNextLevel);
}
private function removeEff():void{
upEff.stop();
upEff.visible = false;
}
private function makeButton(mc:MovieClip):void{
mc.buttonMode = true;
mc.useHandCursor = true;
mc.dupe.visible = false;
mc.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
mc.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
mc.addEventListener(MouseEvent.CLICK, doUpgrade);
}
public function reset():void{
var a:Array;
var e:MovieClip;
var mc:MovieClip;
for each (a in allUpgrades) {
for each (mc in a) {
mc.dupe.visible = false;
mc.removeEventListener(MouseEvent.MOUSE_OVER, mouseOver);
mc.removeEventListener(MouseEvent.MOUSE_OUT, mouseOut);
mc.removeEventListener(MouseEvent.CLICK, doUpgrade);
mc.buttonMode = false;
mc.useHandCursor = false;
};
};
for each (e in states) {
if (e.name == "e1"){
e.gotoAndStop(1);
} else {
e.gotoAndStop(2);
};
};
upgradeState = 0;
info.visible = false;
makeButton(healthUpgrades[0]);
makeButton(microbeUpgrades[0]);
makeButton(shieldUpgrades[0]);
makeButton(moveUpgrades[0]);
makeButton(virusUpgrades[0]);
makeButton(regenUpgrades[0]);
makeButton(scoreUpgrades[0]);
}
private function doUpgrade(e:MouseEvent):void{
if (cost <= Game(parent).totalGenetics){
SoundManager.playSound("click", 1, 0.4);
Game(parent).setGenetics(-(cost));
totalgen.text = String(Game(parent).totalGenetics);
switch (e.currentTarget.name){
case "health1":
makeButton(healthUpgrades[1]);
Game(parent).player.upHealth(5);
hptxt.text = ((String(Game(parent).player.health) + "/") + String(Game(parent).player.totalHealth));
break;
case "health2":
makeButton(healthUpgrades[2]);
Game(parent).player.upHealth(10);
hptxt.text = ((String(Game(parent).player.health) + "/") + String(Game(parent).player.totalHealth));
break;
case "health3":
makeButton(healthUpgrades[3]);
Game(parent).player.upHealth(10);
hptxt.text = ((String(Game(parent).player.health) + "/") + String(Game(parent).player.totalHealth));
break;
case "health4":
makeButton(healthUpgrades[4]);
Game(parent).player.upHealth(10);
hptxt.text = ((String(Game(parent).player.health) + "/") + String(Game(parent).player.totalHealth));
break;
case "health5":
Game(parent).player.upHealth(0);
hptxt.text = ((String(Game(parent).player.health) + "/") + String(Game(parent).player.totalHealth));
break;
case "shield1":
makeButton(shieldUpgrades[1]);
Game(parent).player.upShield();
shieldtxt.text = ((String(Game(parent).player.shield) + "/") + String(Game(parent).player.totalShield));
break;
case "shield2":
makeButton(shieldUpgrades[2]);
Game(parent).player.upShield();
shieldtxt.text = ((String(Game(parent).player.shield) + "/") + String(Game(parent).player.totalShield));
break;
case "shield3":
makeButton(shieldUpgrades[3]);
Game(parent).player.upShield();
shieldtxt.text = ((String(Game(parent).player.shield) + "/") + String(Game(parent).player.totalShield));
break;
case "shield4":
makeButton(shieldUpgrades[4]);
Game(parent).player.upShield();
shieldtxt.text = ((String(Game(parent).player.shield) + "/") + String(Game(parent).player.totalShield));
break;
case "shield5":
Game(parent).player.resetShield();
shieldtxt.text = ((String(Game(parent).player.shield) + "/") + String(Game(parent).player.totalShield));
break;
case "move1":
makeButton(moveUpgrades[1]);
Game(parent).player.upMove();
break;
case "move2":
makeButton(moveUpgrades[2]);
Game(parent).player.upMove();
break;
case "move3":
makeButton(moveUpgrades[3]);
Game(parent).player.upMove();
break;
case "move4":
makeButton(moveUpgrades[4]);
Game(parent).player.upMove();
break;
case "move5":
Game(parent).player.upMove();
break;
case "microbes1":
makeButton(microbeUpgrades[1]);
Game(parent).player.upReload();
break;
case "microbes2":
makeButton(microbeUpgrades[2]);
Game(parent).player.biggerMicrobes();
break;
case "microbes3":
makeButton(microbeUpgrades[3]);
Game(parent).player.upReload();
break;
case "microbes4":
makeButton(microbeUpgrades[4]);
Game(parent).player.biggerMicrobes();
break;
case "microbes5":
makeButton(microbeUpgrades[5]);
Game(parent).player.addBullet();
break;
case "microbes6":
makeButton(microbeUpgrades[6]);
Game(parent).player.upReload();
break;
case "microbes7":
makeButton(microbeUpgrades[7]);
Game(parent).player.biggerMicrobes();
break;
case "microbes8":
makeButton(microbeUpgrades[8]);
Game(parent).player.upReload();
break;
case "microbes9":
makeButton(microbeUpgrades[9]);
Game(parent).player.addBullet();
break;
case "microbes10":
Game(parent).player.upReload();
break;
case "virus1":
makeButton(virusUpgrades[1]);
Game(parent).player.virusUp();
break;
case "virus2":
makeButton(virusUpgrades[2]);
Game(parent).player.virusUp();
break;
case "virus3":
makeButton(virusUpgrades[3]);
Game(parent).player.virusUp();
break;
case "virus4":
makeButton(virusUpgrades[4]);
Game(parent).player.virusUp(true);
break;
case "virus5":
Game(parent).player.virusUp();
break;
case "regen1":
makeButton(regenUpgrades[1]);
Game(parent).player.regenUp();
break;
case "regen2":
makeButton(regenUpgrades[2]);
Game(parent).player.regenUp();
break;
case "regen3":
makeButton(regenUpgrades[3]);
Game(parent).player.regenUp();
break;
case "regen4":
makeButton(regenUpgrades[4]);
Game(parent).player.regenUp();
break;
case "regen5":
Game(parent).player.regenUp();
break;
case "score1":
makeButton(scoreUpgrades[1]);
Game(parent).scoreMultiUp();
break;
case "score2":
makeButton(scoreUpgrades[2]);
Game(parent).scoreMultiUp();
break;
case "score3":
makeButton(scoreUpgrades[3]);
Game(parent).scoreMultiUp();
break;
case "score4":
makeButton(scoreUpgrades[4]);
Game(parent).scoreMultiUp();
break;
case "score5":
Game(parent).scoreMultiUp();
break;
};
if (((!((e.currentTarget.name == "health5"))) && (!((e.currentTarget.name == "shield5"))))){
upgradeState++;
e.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER, mouseOver);
e.currentTarget.removeEventListener(MouseEvent.MOUSE_OUT, mouseOut);
e.currentTarget.removeEventListener(MouseEvent.CLICK, doUpgrade);
e.currentTarget.buttonMode = false;
e.currentTarget.useHandCursor = false;
};
info.visible = false;
MovieClip(e.currentTarget).dupe.gotoAndStop(1);
if ((((upgradeState == 2)) && (!((Game(parent).player.currentFrame == 2))))){
e2.gotoAndStop(1);
addEffect(e2);
Game(parent).player.gotoAndStop(2);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 4)) && (!((Game(parent).player.currentFrame == 3))))){
e3.gotoAndStop(1);
addEffect(e3);
Game(parent).player.gotoAndStop(3);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 7)) && (!((Game(parent).player.currentFrame == 4))))){
e4.gotoAndStop(1);
addEffect(e4);
Game(parent).player.gotoAndStop(4);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 10)) && (!((Game(parent).player.currentFrame == 5))))){
e5.gotoAndStop(1);
addEffect(e5);
Game(parent).player.gotoAndStop(5);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 13)) && (!((Game(parent).player.currentFrame == 6))))){
e6.gotoAndStop(1);
addEffect(e6);
Game(parent).player.gotoAndStop(6);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 16)) && (!((Game(parent).player.currentFrame == 7))))){
e7.gotoAndStop(1);
addEffect(e7);
Game(parent).player.gotoAndStop(7);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 19)) && (!((Game(parent).player.currentFrame == 8))))){
e8.gotoAndStop(1);
addEffect(e8);
Game(parent).player.gotoAndStop(8);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 21)) && (!((Game(parent).player.currentFrame == 9))))){
e9.gotoAndStop(1);
addEffect(e9);
Game(parent).player.gotoAndStop(9);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 24)) && (!((Game(parent).player.currentFrame == 10))))){
e10.gotoAndStop(1);
addEffect(e10);
Game(parent).player.gotoAndStop(10);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 27)) && (!((Game(parent).player.currentFrame == 11))))){
e11.gotoAndStop(1);
addEffect(e11);
Game(parent).player.gotoAndStop(11);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 30)) && (!((Game(parent).player.currentFrame == 12))))){
e12.gotoAndStop(1);
addEffect(e12);
Game(parent).player.gotoAndStop(12);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 33)) && (!((Game(parent).player.currentFrame == 13))))){
e13.gotoAndStop(1);
addEffect(e13);
Game(parent).player.gotoAndStop(13);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 35)) && (!((Game(parent).player.currentFrame == 14))))){
e14.gotoAndStop(1);
addEffect(e14);
Game(parent).player.gotoAndStop(14);
SoundManager.playSound("scoreup", 2, 0.2);
};
if ((((upgradeState == 37)) && (!((Game(parent).player.currentFrame == 15))))){
e15.gotoAndStop(1);
addEffect(e15);
Game(parent).player.gotoAndStop(15);
SoundManager.playSound("scoreup", 2, 0.2);
};
};
}
private function startNextLevel(e:MouseEvent):void{
Music.playNextLevelSong();
removeEff();
Game(parent).nextLevel();
}
private function mouseOver(e:MouseEvent):void{
MovieClip(e.currentTarget).dupe.gotoAndPlay(1);
MovieClip(e.currentTarget).dupe.visible = true;
MovieClip(e.currentTarget).gotoAndStop("over1");
setInfo(MovieClip(e.currentTarget));
SoundManager.playSound("mouseover", 1, 0.8);
}
public function update(c:Number, t:Number, hp:Number, thp:Number, sh:Number, tsh:Number):void{
totalgen.text = String(t);
gencoll.text = String(c);
hptxt.text = ((String(hp) + "/") + String(thp));
shieldtxt.text = ((String(sh) + "/") + String(tsh));
}
private function mouseOut(e:MouseEvent):void{
MovieClip(e.currentTarget).dupe.visible = false;
MovieClip(e.currentTarget).gotoAndStop("up1");
info.visible = false;
}
private function setInfo(mc:MovieClip):void{
switch (mc.name){
case "health1":
info.infotxt.text = "HEALTH + 5";
info.costtxt.text = "COST 20 GEN";
cost = 20;
break;
case "health2":
info.infotxt.text = "HEALTH + 10";
info.costtxt.text = "COST 50 GEN";
cost = 50;
break;
case "health3":
info.infotxt.text = "HEALTH + 10";
info.costtxt.text = "COST 100 GEN";
cost = 100;
break;
case "health4":
info.infotxt.text = "HEALTH + 10";
info.costtxt.text = "COST 100 GEN";
cost = 100;
break;
case "health5":
info.infotxt.text = "RESTORE HEALTH";
info.costtxt.text = "COST 750 GEN";
cost = 750;
break;
case "shield1":
info.infotxt.text = "SHIELD + 10";
info.costtxt.text = "COST 50 GEN";
cost = 50;
break;
case "shield2":
info.infotxt.text = "SHIELD + 10";
info.costtxt.text = "COST 50 GEN";
cost = 50;
break;
case "shield3":
info.infotxt.text = "SHIELD + 10";
info.costtxt.text = "COST 50 GEN";
cost = 50;
break;
case "shield4":
info.infotxt.text = "SHIELD + 10";
info.costtxt.text = "COST 50 GEN";
cost = 50;
break;
case "shield5":
info.infotxt.text = "RESTORE SHIELD";
info.costtxt.text = "COST 750 GEN";
cost = 750;
break;
case "move1":
info.infotxt.text = "MOVEMENT +1";
info.costtxt.text = "COST 100 GEN";
cost = 100;
break;
case "move2":
info.infotxt.text = "MOVEMENT +1";
info.costtxt.text = "COST 150 GEN";
cost = 150;
break;
case "move3":
info.infotxt.text = "MOVEMENT +1";
info.costtxt.text = "COST 200 GEN";
cost = 200;
break;
case "move4":
info.infotxt.text = "MOVEMENT +1";
info.costtxt.text = "COST 250 GEN";
cost = 250;
break;
case "move5":
info.infotxt.text = "MOVEMENT +1";
info.costtxt.text = "COST 500 GEN";
cost = 500;
break;
case "microbes1":
info.infotxt.text = "FASTER RELOAD";
info.costtxt.text = "COST 20 GEN";
cost = 20;
break;
case "microbes2":
info.infotxt.text = "BIGGER MICROBES";
info.costtxt.text = "COST 20 GEN";
cost = 20;
break;
case "microbes3":
info.infotxt.text = "FASTER RELOAD";
info.costtxt.text = "COST 50 GEN";
cost = 50;
break;
case "microbes4":
info.infotxt.text = "BIGGER MICROBES";
info.costtxt.text = "COST 50 GEN";
cost = 50;
break;
case "microbes5":
info.infotxt.text = "ADDITIONAL MICROBE";
info.costtxt.text = "COST 300 GEN";
cost = 300;
break;
case "microbes6":
info.infotxt.text = "FASTER RELOAD";
info.costtxt.text = "COST 250 GEN";
cost = 250;
break;
case "microbes7":
info.infotxt.text = "BIGGER MICROBES";
info.costtxt.text = "COST 150 GEN";
cost = 150;
break;
case "microbes8":
info.infotxt.text = "FASTER RELOAD";
info.costtxt.text = "COST 350 GEN";
cost = 350;
break;
case "microbes9":
info.infotxt.text = "ADDITIONAL MICROBE";
info.costtxt.text = "COST 1200 GEN";
cost = 1200;
break;
case "microbes10":
info.infotxt.text = "CONSTANT FLOW";
info.costtxt.text = "COST 1500 GEN";
cost = 1500;
break;
case "virus1":
info.infotxt.text = "VIRAL SHOT (SPACE)";
info.costtxt.text = "COST 250 GEN";
cost = 250;
break;
case "virus2":
info.infotxt.text = "FASTER VIRAL SHOT";
info.costtxt.text = "COST 250 GEN";
cost = 250;
break;
case "virus3":
info.infotxt.text = "FASTER VIRAL SHOT";
info.costtxt.text = "COST 250 GEN";
cost = 250;
break;
case "virus4":
info.infotxt.text = "SECOND VIRAL SHOT";
info.costtxt.text = "COST 1000 GEN";
cost = 1000;
break;
case "virus5":
info.infotxt.text = "FASTER VIRAL SHOT";
info.costtxt.text = "COST 1000 GEN";
cost = 1000;
break;
case "regen1":
info.infotxt.text = "REGENERATION";
info.costtxt.text = "COST 150 GEN";
cost = 150;
break;
case "regen2":
info.infotxt.text = "FASTER REGENERATION";
info.costtxt.text = "COST 250 GEN";
cost = 250;
break;
case "regen3":
info.infotxt.text = "FASTER REGENERATION";
info.costtxt.text = "COST 500 GEN";
cost = 500;
break;
case "regen4":
info.infotxt.text = "FASTER REGENERATION";
info.costtxt.text = "COST 750 GEN";
cost = 750;
break;
case "regen5":
info.infotxt.text = "FASTER REGENERATION";
info.costtxt.text = "COST 1000 GEN";
cost = 1000;
break;
case "score1":
info.infotxt.text = "HIGHER SCORES";
info.costtxt.text = "COST 200 GEN";
cost = 200;
break;
case "score2":
info.infotxt.text = "HIGHER SCORES";
info.costtxt.text = "COST 300 GEN";
cost = 300;
break;
case "score3":
info.infotxt.text = "HIGHER SCORES";
info.costtxt.text = "COST 400 GEN";
cost = 400;
break;
case "score4":
info.infotxt.text = "HIGHER SCORES";
info.costtxt.text = "COST 500 GEN";
cost = 500;
break;
case "score5":
info.infotxt.text = "HIGHER SCORES";
info.costtxt.text = "COST 600 GEN";
cost = 600;
break;
};
info.x = (mc.x + 20);
info.y = mc.y;
info.visible = true;
}
private function addEffect(mc:MovieClip):void{
upEff.x = (mc.x + 17);
upEff.y = (mc.y + 17);
upEff.gotoAndPlay(1);
upEff.visible = true;
upEff.addFrameScript((upEff.totalFrames - 1), removeEff);
}
}
}//package gam
Section 17
//KongregateApiConnection (kon.KongregateApiConnection)
package kon {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class KongregateApiConnection extends Loader {
private var __loaded:Boolean;
private var __type:String;
private var __url:String;
private var __api:Object;
public function KongregateApiConnection(stage:Stage){
super();
this.__loaded = false;
this.__type = "kongregate";
Security.allowDomain("*.kongregate.com");
var params:Object = LoaderInfo(stage.loaderInfo).parameters;
this.__url = ((params.api_path)!=undefined) ? params.api_path : "http://www.kongregate.com/flash/API_AS3_Local.swf";
this.contentLoaderInfo.addEventListener(Event.COMPLETE, this.__loaderComplete);
stage.addChild(this);
}
public function get type():String{
return (this.__type);
}
private function __loaderComplete(event:Event):void{
this.__loaded = true;
this.__api = event.target.content;
this.__api.services.connect();
var connectedEvent:* = new KongregateApiConnectionEvent(KongregateApiConnectionEvent.CONNECTED);
this.dispatchEvent(connectedEvent);
}
public function get scores():Object{
if (!this.loaded){
throw (new Error("Kongregate API is not loaded."));
};
return (this.__api.scores);
}
public function get connected():Boolean{
return (((this.__api)!=null) ? this.__api.isConnected() : false);
}
public function get user():Object{
if (!this.loaded){
throw (new Error("Kongregate API is not loaded."));
};
return (this.__api.user);
}
public function get loaded():Boolean{
return (this.__loaded);
}
public function get services():Object{
if (!this.loaded){
throw (new Error("Kongregate API is not loaded."));
};
return (this.__api.services);
}
public function get url():String{
return (this.__url);
}
public function connect():void{
var request:URLRequest;
if (!this.connected){
request = new URLRequest(this.__url);
this.load(request);
};
}
public function get stats():Object{
if (!this.loaded){
throw (new Error("Kongregate API is not loaded."));
};
return (this.__api.stats);
}
}
}//package kon
Section 18
//KongregateApiConnectionEvent (kon.KongregateApiConnectionEvent)
package kon {
import flash.events.*;
public class KongregateApiConnectionEvent extends Event {
public static const CONNECTED:String = "connected";
public function KongregateApiConnectionEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false){
super(type, bubbles, cancelable);
}
override public function toString():String{
return ((((((((("[KongregateApiConnectionEvent type=\"" + this.type) + "\" bubbles=") + this.bubbles) + " cancelable=") + this.cancelable) + " eventPhase=") + this.eventPhase) + "]"));
}
override public function clone():Event{
return (new KongregateApiConnectionEvent(this.type, this.bubbles, this.cancelable));
}
}
}//package kon
Section 19
//MochiAd (mochi.MochiAd)
package mochi {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class MochiAd {
public function MochiAd(){
super();
}
public static function getVersion():String{
return ("3.02 as3");
}
public static function showClickAwayAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (width:Number, height: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;
var ad_timeout:Number = 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();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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 (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
var sendHostProgress:Boolean;
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
finished = true;
chk.started = getTimer();
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (this.root == null){
finished = true;
};
if (finished){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(server:String):String{
var hostname:String = server.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (hostname);
};
Security.allowDomain("*");
Security.allowDomain(hostname);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(hostname);
return (hostname);
}
public static function unload(clip:Object):Boolean{
if (((clip.clip) && (clip.clip._mochiad))){
clip = clip.clip;
};
if (clip.origFrameRate != undefined){
clip.stage.frameRate = clip.origFrameRate;
};
if (!clip._mochiad){
return (false);
};
if (clip._mochiad._containerLCName != undefined){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
};
if (clip._mochiad.onUnload){
clip._mochiad.onUnload();
};
delete clip._mochiad_loaded;
delete clip._mochiad;
return (true);
}
public static function showInterLevelAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {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 (width:Number, height: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;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = 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();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 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 (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = (msec - 250);
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (finished){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(options:Object, defaults:Object):Object{
var k:String;
var pairs:Array;
var i:Number;
var kv:Array;
var optcopy:Object = {};
for (k in defaults) {
optcopy[k] = defaults[k];
};
if (options){
for (k in options) {
optcopy[k] = options[k];
};
};
if (optcopy.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."));
};
options = optcopy.clip.loaderInfo.parameters.mochiad_options;
if (options){
pairs = options.split("&");
i = 0;
while (i < pairs.length) {
kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
};
};
if (optcopy.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (optcopy);
}
public static function _cleanup(mc:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = mc;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
lc.client = null;
lc.close();
//unresolved jump
var _slot1 = e;
};
setTimeout(f, 0);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(options:Object):MovieClip{
var clip:Object;
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 = options;
var DEFAULTS:Object = {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);
};
if (clip._mochiad_loaded){
return (null);
};
//unresolved jump
var _slot1 = e;
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."));
var depth:Number = options.depth;
delete options.depth;
var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = 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");
};
var lv:URLVariables = 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 (ev:Object):void{
ev.target.removeEventListener(ev.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 (io:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(base:Object, methodName:String, argsArray:Array):Object{
var nameArray:Array = methodName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
if (typeof(base[nameArray[i]]) == "function"){
return (base[nameArray[i]].apply(base, argsArray));
};
return (undefined);
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number):MovieClip{
var mc:MovieClip = new MovieClip();
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
parent[name] = mc;
mc["_name"] = name;
return (mc);
}
public static function _getRes(options:Object, clip:Object):Array{
var xy:Array;
var b:Object = clip.getBounds(clip.root);
var w:Number = 0;
var h:Number = 0;
if (typeof(options.res) != "undefined"){
xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = (b.xMax - b.xMin);
h = (b.yMax - b.yMin);
};
if ((((w == 0)) || ((h == 0)))){
w = clip.stage.stageWidth;
h = clip.stage.stageHeight;
};
return ([w, h]);
}
public static function adShowing(mc:Object):void{
mc.origFrameRate = mc.stage.frameRate;
mc.stage.frameRate = 30;
}
public static function getValue(base:Object, objectName:String):Object{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
return (base[nameArray[i]]);
}
public static function rpc(clip:Object, callbackID:Number, arg:Object):void{
var _local4:Object;
var _local5:Object;
switch (arg.id){
case "setValue":
MochiAd.setValue(clip, arg.objectName, arg.value);
break;
case "getValue":
_local4 = MochiAd.getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + arg.id));
};
}
public static function setValue(base:Object, objectName:String, value:Object):void{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return;
};
base = base[nameArray[i]];
i++;
};
base[nameArray[i]] = value;
}
public static function showPreGameAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = options;
var DEFAULTS:Object = {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 (width:Number, height: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 (percent: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;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = 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);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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);
var bar:MovieClip = 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);
};
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = 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();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = 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;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = 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 p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var f:Function = function (ev:Event):void{
ev.target.removeEventListener(ev.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s:String):Object{
trace(("[MOCHIAD rpcTestFn] " + s));
return (s);
};
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (lc_name:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _clip:Object = this.parent.parent.root;
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
var clip_total:Number = _clip.loaderInfo.bytesTotal;
var clip_loaded:Number = _clip.loaderInfo.bytesLoaded;
if (complete){
clip_loaded = Math.max(1, clip_loaded);
clip_total = clip_loaded;
};
var clip_pcnt:Number = ((100 * clip_loaded) / clip_total);
var ad_pcnt:Number = ((100 * elapsed) / chk.ad_msec);
var _inside:Object = this._mochiad_bar._inside;
var pcnt:Number = Math.min(100, Math.min(((clip_pcnt) || (0)), ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside.scaleX = (pcnt * 0.01);
options.ad_progress(pcnt);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:clip_pcnt});
if (clip_pcnt == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((elapsed > chk.ad_timeout)) && ((clip_pcnt == 100)))){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (((complete) && (finished))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(options);
}
public static function showTimedAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(options);
}
public static function doOnEnterFrame(mc:MovieClip):void{
var mc = mc;
var f:Function = function (ev:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
ev.target.removeEventListener(ev.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi
Section 20
//HowTo (nav.HowTo)
package nav {
import flash.events.*;
import gam.*;
import snd.*;
public class HowTo extends htpMC {
public function HowTo(){
super();
continue_btn.addEventListener(MouseEvent.CLICK, hideme);
SoundButton.addSound(continue_btn);
}
private function hideme(e:MouseEvent):void{
if ((parent is Game)){
Game(parent).pushUnPause();
};
parent.removeChild(this);
}
}
}//package nav
Section 21
//MainMenu (nav.MainMenu)
package nav {
import flash.events.*;
import flash.net.*;
import snd.*;
public class MainMenu extends MainMenuMC {
public function MainMenu(){
super();
SoundButton.addSound(start_btn);
SoundButton.addSound(stats_btn);
SoundButton.addSound(howto_btn);
SoundButton.addSound(settings_btn);
SoundButton.addSound(diff_select.easy_btn);
SoundButton.addSound(diff_select.normal_btn);
SoundButton.addSound(diff_select.hard_btn);
SoundButton.addSound(diff_select.extreme_btn);
SoundButton.addSound(diff_select.cancel_btn);
SoundButton.addSound(mm_logo);
SoundButton.addSound(s_logo);
start_btn.addEventListener(MouseEvent.CLICK, showDifSelect);
stats_btn.addEventListener(MouseEvent.CLICK, showStats);
howto_btn.addEventListener(MouseEvent.CLICK, showHowTo);
settings_btn.addEventListener(MouseEvent.CLICK, showSettings);
diff_select.easy_btn.addEventListener(MouseEvent.CLICK, startEasy);
diff_select.normal_btn.addEventListener(MouseEvent.CLICK, startNormal);
diff_select.hard_btn.addEventListener(MouseEvent.CLICK, startHard);
diff_select.extreme_btn.addEventListener(MouseEvent.CLICK, startExtreme);
diff_select.cancel_btn.addEventListener(MouseEvent.CLICK, cancel);
mm_logo.addEventListener(MouseEvent.CLICK, toMM);
s_logo.addEventListener(MouseEvent.CLICK, toS);
diff_select.visible = false;
}
private function showSettings(e:MouseEvent):void{
Navigation.showSettings(this);
}
private function cancel(e:MouseEvent):void{
diff_select.visible = false;
}
private function showStats(e:MouseEvent):void{
Navigation.showStats(this);
}
private function startEasy(e:MouseEvent):void{
diff_select.visible = false;
Navigation.game.difficulty = 1;
Navigation.switchScreens(this, Navigation.game);
}
private function showDifSelect(e:MouseEvent):void{
diff_select.visible = true;
}
private function toS(e:MouseEvent):void{
var url:URLRequest = new URLRequest("http://www.iamthestory.net");
navigateToURL(url);
}
private function startNormal(e:MouseEvent):void{
diff_select.visible = false;
Navigation.game.difficulty = 2;
Navigation.switchScreens(this, Navigation.game);
}
private function startExtreme(e:MouseEvent):void{
diff_select.visible = false;
Navigation.game.difficulty = 4;
Navigation.switchScreens(this, Navigation.game);
}
private function toMM(e:MouseEvent):void{
var url:URLRequest = new URLRequest("http://www.manicmartian.com");
navigateToURL(url);
}
private function startHard(e:MouseEvent):void{
diff_select.visible = false;
Navigation.game.difficulty = 3;
Navigation.switchScreens(this, Navigation.game);
}
private function showHowTo(e:MouseEvent):void{
Navigation.showHowTo(this);
}
}
}//package nav
Section 22
//Navigation (nav.Navigation)
package nav {
import flash.display.*;
import gam.*;
import ui.*;
import snd.*;
public class Navigation {
private static var settings:Settings = new Settings();
private static var howto:HowTo = new HowTo();
public static var game:Game = new Game();
private static var _main:Main;
private static var statsScreen:Statistics = new Statistics();
public static var mainmenu:MainMenu = new MainMenu();
public function Navigation(){
super();
}
public static function showSettings(mc:MovieClip):void{
mc.addChild(settings);
}
public static function hideSettings(mc:MovieClip):void{
mc.removeChild(settings);
}
public static function init(m:Main):void{
_main = m;
_main.addChild(mainmenu);
Music.playSong("main", true, Music.NO_FADE);
}
public static function showStats(mc:MovieClip):void{
statsScreen.update();
mc.addChild(statsScreen);
}
public static function hideStats(mc:MovieClip):void{
mc.removeChild(statsScreen);
}
public static function regainFocus():void{
game.focusRect = false;
_main.stage.focus = game;
}
public static function showHowTo(mc:MovieClip):void{
mc.addChild(howto);
}
public static function pauseGame():void{
if (_main.contains(game)){
game.pushPause(true);
};
}
public static function switchScreens(mc1:MovieClip, mc2:MovieClip):void{
_main.removeChild(mc1);
_main.addChild(mc2);
if ((mc2 is Game)){
mc2.focusRect = false;
_main.stage.focus = mc2;
Game(mc2).newGame();
if (SaveGameData.showHTP()){
Game(mc2).pushPause();
showHowTo(mc2);
};
Music.playNextLevelSong();
} else {
Music.playSong("main");
};
}
public static function submitToKongregate(score:Number, difficulty:Number):void{
switch (difficulty){
case 1:
_main.submitToKongregate(score, "easy");
break;
case 2:
_main.submitToKongregate(score, "normal");
break;
case 3:
_main.submitToKongregate(score, "hard");
break;
case 4:
_main.submitToKongregate(score, "extreme");
break;
};
}
}
}//package nav
Section 23
//PreloadScreen (nav.PreloadScreen)
package nav {
public class PreloadScreen extends PreloadMC {
public function PreloadScreen(){
super();
}
public function update(p:Number):void{
loadtxt.text = (String(p) + "%");
if (p > 20){
stufftxt.text = "PREPARING EVOLUTIONARY SCALES";
};
if (p > 40){
stufftxt.text = "EVOLVING MICROBES";
};
if (p > 60){
stufftxt.text = "ADJUSTING ENVIRONMENT";
};
if (p > 80){
stufftxt.text = "GROWING TENTACLES";
};
}
}
}//package nav
Section 24
//SaveGameData (nav.SaveGameData)
package nav {
import flash.net.*;
public class SaveGameData {
private static var _main:Main;
public static var so_name:String = "Cell_shot";
private static var reset:Boolean = false;
public static var campaign:Object = {score:0, level:0, cell:0, shortest:0, longest:0, time:0, games:0, easyvics:0, normalvics:0, hardvics:0, extremevics:0, infections:0};
private static var version:Number = 0.8;
public static var settings:Object = {volume:1, quality:"high"};
public static var so_path:String = "/";
private static var so:SharedObject;
public function SaveGameData(){
super();
}
public static function getShortest():Number{
return (campaign.shortest);
}
public static function getVictories():Array{
var a:Array = [campaign.easyvics, campaign.normalvics, campaign.hardvics, campaign.extremevics];
return (a);
}
public static function setLevel(s:Number):void{
if (s > campaign.level){
campaign.level = s;
so.data.campaign.level = s;
};
}
public static function getTime():Number{
return (campaign.time);
}
public static function setLongest(s:Number):void{
if (s > campaign.longest){
campaign.longest = s;
so.data.campaign.longest = s;
_main.submitToKongregate(s, "longestRun");
};
}
public static function setInfections(s:Number):void{
campaign.infections = (campaign.infections + s);
so.data.campaign.infections = (so.data.campaign.infections + s);
}
public static function getGames():Number{
return (campaign.games);
}
public static function setShortest(s:Number):void{
if ((((campaign.shortest == 0)) || ((s < campaign.shortest)))){
campaign.shortest = s;
so.data.campaign.shortest = s;
};
}
public static function init(m:Main):void{
var m = m;
_main = m;
so = SharedObject.getLocal("Cell_shot", "/");
//unresolved jump
var _slot1 = e;
trace("Error getting local data");
if (so){
if (!so.data.havePlayed){
trace("firstPlay");
reset = true;
so.data.havePlayed = true;
so.data.showHTP = true;
} else {
so.data.showHTP = false;
};
if (((!(so.data.version)) || ((so.data.version < version)))){
reset = true;
so.data.version = version;
};
if (((so.data.campaign) && (!(reset)))){
campaign = so.data.campaign;
} else {
so.data.campaign = campaign;
};
if (((so.data.settings) && (!(reset)))){
settings = so.data.settings;
} else {
so.data.settings = settings;
};
};
}
public static function getLongest():Number{
return (campaign.longest);
}
public static function getLevel():Number{
return (campaign.level);
}
public static function setTime(s:Number):void{
campaign.time = (campaign.time + s);
so.data.campaign.time = (so.data.campaign.time + s);
}
public static function setScore(s:Number):void{
if (s > campaign.score){
campaign.score = s;
so.data.campaign.score = s;
_main.submitToKongregate(s, "highestScore");
};
}
public static function getQuality():String{
return (settings.quality);
}
public static function deleteSaveGameData():void{
if (so){
delete so.data.campaign;
delete so.data.settings;
};
}
public static function showHTP():Boolean{
return (so.data.showHTP);
}
public static function getScore():Number{
return (campaign.score);
}
public static function addGame():void{
campaign.games++;
so.data.campaign.games++;
}
public static function addVictory(m:Number):void{
if (m == 1){
so.data.campaign.easyvics++;
};
if (m == 2){
so.data.campaign.normalvics++;
};
if (m == 3){
so.data.campaign.hardvics++;
};
if (m == 4){
so.data.campaign.extremevics++;
};
}
public static function setCell(s:Number):void{
if (s > campaign.cell){
campaign.cell = s;
so.data.campaign.cell = s;
_main.submitToKongregate(s, "biggestCellSize");
};
}
public static function getInfections():Number{
return (campaign.infections);
}
public static function getCell():Number{
return (campaign.cell);
}
public static function setQuality(q:String):void{
trace(q);
settings.quality = q;
so.data.settings.quality = q;
}
}
}//package nav
Section 25
//Statistics (nav.Statistics)
package nav {
import flash.events.*;
import flash.display.*;
import snd.*;
public class Statistics extends StatsMC {
public function Statistics(){
super();
con_btn.addEventListener(MouseEvent.CLICK, removeMe);
SoundButton.addSound(con_btn);
}
public function update():void{
var secStr:String;
var minStr:String;
var hrStr:String;
score.text = String(SaveGameData.getScore());
level.text = String(SaveGameData.getLevel());
evolution.text = String(SaveGameData.getCell());
var time:Number = SaveGameData.getShortest();
var seconds:Number = (time % 60);
var minutes:Number = ((time - seconds) / 60);
if (seconds < 10){
secStr = ("0" + String(seconds));
} else {
secStr = String(seconds);
};
if (minutes < 10){
minStr = ("0" + String(minutes));
} else {
minStr = String(minutes);
};
shortestrun.text = ((minStr + ":") + secStr);
time = SaveGameData.getLongest();
seconds = (time % 60);
minutes = ((time - seconds) / 60);
if (seconds < 10){
secStr = ("0" + String(seconds));
} else {
secStr = String(seconds);
};
if (minutes < 10){
minStr = ("0" + String(minutes));
} else {
minStr = String(minutes);
};
longestrun.text = ((minStr + ":") + secStr);
var hrs:Number = 0;
time = SaveGameData.getTime();
while (time > 3600) {
hrs++;
time = (time - 3600);
};
seconds = (time % 60);
minutes = ((time - seconds) / 60);
if (seconds < 10){
secStr = ("0" + String(seconds));
} else {
secStr = String(seconds);
};
if (minutes < 10){
minStr = ("0" + String(minutes));
} else {
minStr = String(minutes);
};
if (hrs < 10){
hrStr = ("0" + String(hrs));
} else {
hrStr = String(hrs);
};
totaltime.text = ((((hrStr + ":") + minStr) + ":") + secStr);
games.text = String(SaveGameData.getGames());
easyvics.text = String(SaveGameData.getVictories()[0]);
normalvics.text = String(SaveGameData.getVictories()[1]);
hardvics.text = String(SaveGameData.getVictories()[2]);
extremevics.text = String(SaveGameData.getVictories()[3]);
infections.text = String(SaveGameData.getInfections());
}
private function removeMe(e:MouseEvent):void{
Navigation.hideStats(MovieClip(parent));
}
}
}//package nav
Section 26
//Music (snd.Music)
package snd {
import flash.events.*;
import flash.display.*;
import flash.media.*;
public class Music {
public static const TEST:Object = {fadeInStart:0, fadeInTime:5, fadeOutStart:1, fadeOutTime:5};
public static const FADE_IN_OUT:Object = {fadeInStart:2.5, fadeInTime:2.5, fadeOutStart:0, fadeOutTime:2.5};
public static const NO_FADE:Object = {fadeInStart:1, fadeInTime:0, fadeOutStart:0, fadeOutTime:0};
public static const FADE_IN:Object = {fadeInStart:0, fadeInTime:1, fadeOutStart:0, fadeOutTime:0};
public static const FADE_OUT_SLOW:Object = {fadeInStart:1, fadeInTime:0, fadeOutStart:1, fadeOutTime:2.5};
public static const FADE_OUT:Object = {fadeInStart:1, fadeInTime:0, fadeOutStart:1, fadeOutTime:1};
private static const frameRate:Number = 30;
private static var isFading:Boolean = false;
private static var enterFrameDispatcher:MovieClip = new MovieClip();
private static var lastChannel:SoundChannel;
private static var currentFade:Object;
private static var currentSound:Sound;
private static var lastSound:Sound;
private static var currentSong:String;
private static var paused:Boolean;
public static var _volume:Number = 1;
private static var pausePosition:Number;
private static var currentChannel:SoundChannel;
private static var lastSong:String;
private static var currentLevelMusic:Number = 0;
private static var currentTransform:SoundTransform;
private static var lastTransform:SoundTransform;
private static var songs:Object = {main:MainSong, music1:Level3, music2:Level1, music3:Level2};
private static var _mute:Number = 1;
public function Music(){
super();
}
public static function get volume():Number{
return (_volume);
}
public static function get mute():Boolean{
return (!(Boolean(_mute)));
}
private static function doFade(e:Event):void{
var outDone:Boolean;
var inDone:Boolean;
if (((((lastSong) && (lastTransform))) && (lastChannel))){
lastTransform.volume = (lastTransform.volume - (volume / (frameRate * currentFade.fadeOutTime)));
if (lastTransform.volume <= 0){
lastTransform.volume = 0;
lastChannel.stop();
outDone = true;
} else {
lastChannel.soundTransform = lastTransform;
};
} else {
outDone = true;
};
if (((((currentSong) && (currentTransform))) && (currentChannel))){
currentTransform.volume = (currentTransform.volume + (volume / (frameRate * currentFade.fadeInTime)));
if (currentTransform.volume >= (volume * _mute)){
currentTransform.volume = (volume * _mute);
inDone = true;
};
currentChannel.soundTransform = currentTransform;
} else {
inDone = true;
};
if (((outDone) && (inDone))){
enterFrameDispatcher.removeEventListener(Event.ENTER_FRAME, doFade);
isFading = false;
};
}
public static function resume():void{
if (!paused){
return;
};
paused = false;
currentChannel = currentSound.play((pausePosition % currentSound.length), 1, currentTransform);
if (currentChannel){
currentChannel.addEventListener(Event.SOUND_COMPLETE, loopSong, false, 0, true);
};
}
public static function playNextLevelSong():void{
currentLevelMusic++;
if (currentLevelMusic == 4){
currentLevelMusic = 1;
};
playSong(("music" + currentLevelMusic));
}
public static function set volume(v:Number):void{
_volume = v;
if (((currentTransform) && (currentChannel))){
currentTransform.volume = (_mute * _volume);
currentChannel.soundTransform = currentTransform;
};
}
public static function stopSong(fade:Object=null):void{
playSong(null, false, fade);
}
public static function set mute(value:Boolean):void{
_mute = (value) ? 0 : 1;
if (((currentTransform) && (currentChannel))){
currentTransform.volume = (_mute * volume);
currentChannel.soundTransform = currentTransform;
};
}
private static function loopSong(e:Event):void{
currentChannel = currentSound.play(0, 100, currentTransform);
}
public static function playSong(name:String=null, loop:Boolean=true, fade:Object=null, restart:Boolean=false):void{
if ((((currentSong == name)) && (!(restart)))){
return;
};
if (((isFading) && (lastChannel))){
lastChannel.stop();
};
currentFade = (fade) ? fade : FADE_IN_OUT;
pausePosition = 0;
if (currentSong != null){
lastSong = currentSong;
lastSound = currentSound;
lastTransform = currentTransform;
lastChannel = currentChannel;
if (lastTransform){
lastTransform.volume = ((currentFade.fadeOutStart * volume) * _mute);
};
};
currentSong = name;
if (songs[name] != null){
currentSound = new (songs[name]);
currentChannel = currentSound.play(0, (loop) ? 100 : 1);
currentTransform = new SoundTransform();
currentTransform.volume = ((currentFade.fadeInStart * volume) * _mute);
if (currentChannel){
currentChannel.soundTransform = currentTransform;
};
};
enterFrameDispatcher.addEventListener(Event.ENTER_FRAME, doFade);
isFading = true;
paused = false;
}
public static function pause():void{
paused = true;
pausePosition = currentChannel.position;
currentChannel.stop();
}
}
}//package snd
Section 27
//SoundButton (snd.SoundButton)
package snd {
import flash.events.*;
import flash.display.*;
public class SoundButton {
public function SoundButton(){
super();
}
private static function mouseOver(e:MouseEvent):void{
if (MovieClip(e.currentTarget).currentLabel == "mouseup"){
e.currentTarget.gotoAndStop("mouseOver");
};
SoundManager.playSound("mouseOver", 1, 1);
}
public static function initSoundButton(m:MovieClip):void{
m.gotoAndStop("mouseup");
m.buttonMode = true;
m.useHandCursor = true;
m.addEventListener(Event.ADDED_TO_STAGE, checkSound);
m.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
m.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
m.addEventListener(MouseEvent.CLICK, mouseClickSound);
}
private static function mouseOverSound(e:MouseEvent):void{
SoundManager.playSound("mouseover", 1, 0.8);
}
private static function clickSound(e:MouseEvent):void{
SoundManager.playSound("click", 1, 0.4);
}
private static function mouseOut(e:MouseEvent):void{
if (MovieClip(e.currentTarget).currentLabel == "mouseOver"){
e.currentTarget.gotoAndStop("mouseup");
};
}
private static function checkSound(e:Event):void{
if (SoundFX.mute){
e.currentTarget.gotoAndStop("_off");
} else {
e.currentTarget.gotoAndStop("mouseup");
};
}
private static function mouseClickMusic(e:MouseEvent):void{
if (MovieClip(e.currentTarget).currentLabel == "_off"){
e.currentTarget.gotoAndStop("mouseup");
Music.mute = false;
} else {
e.currentTarget.gotoAndStop("_off");
Music.mute = true;
};
}
private static function mouseClickSound(e:MouseEvent):void{
if (MovieClip(e.currentTarget).currentLabel == "_off"){
e.currentTarget.gotoAndStop("mouseup");
SoundFX.mute = false;
} else {
e.currentTarget.gotoAndStop("_off");
SoundFX.mute = true;
};
}
private static function checkMusic(e:Event):void{
if (Music.mute){
e.currentTarget.gotoAndStop("_off");
} else {
e.currentTarget.gotoAndStop("mouseup");
};
}
public static function addSound(btn:SimpleButton):void{
btn.addEventListener(MouseEvent.MOUSE_OVER, mouseOverSound);
btn.addEventListener(MouseEvent.CLICK, clickSound);
}
public static function initMusicButton(m:MovieClip):void{
m.gotoAndStop("mouseup");
m.buttonMode = true;
m.useHandCursor = true;
m.addEventListener(Event.ADDED_TO_STAGE, checkMusic);
m.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
m.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
m.addEventListener(MouseEvent.CLICK, mouseClickMusic);
}
}
}//package snd
Section 28
//SoundFX (snd.SoundFX)
package snd {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class SoundFX {
private static var soundDict:Dictionary = new Dictionary();
private static var _mute:Boolean = false;
private static var channelDict:Dictionary = new Dictionary();
public static var volume:Number = 1;
public function SoundFX(){
super();
}
public static function get mute():Boolean{
return (_mute);
}
public static function set mute(value:Boolean):void{
_mute = value;
}
public static function resetCounters():void{
channelDict = new Dictionary();
soundDict = new Dictionary();
}
private static function soundComplete(e:Event):void{
var sound:Class = channelDict[e.currentTarget];
var _local3 = soundDict;
var _local4 = sound;
var _local5 = (_local3[_local4] - 1);
_local3[_local4] = _local5;
delete channelDict[e.currentTarget];
}
public static function playSound(cls, loops:Number=1, vol:Number=1, max:Number=3):SoundChannel{
if ((cls is Array)){
cls = cls[Math.floor((Math.random() * cls.length))];
};
if ((!(cls) is Class)){
return (null);
};
if (soundDict[cls] >= max){
return (null);
};
var sound:Sound = new (cls);
var channel:SoundChannel = sound.play(0, loops);
if (!channel){
return (null);
};
var transform:SoundTransform = new SoundTransform((_mute) ? 0 : (volume * vol));
channel.soundTransform = transform;
channelDict[channel] = cls;
if (!soundDict[cls]){
soundDict[cls] = 0;
};
var _local8 = soundDict;
var _local9 = cls;
var _local10 = (_local8[_local9] + 1);
_local8[_local9] = _local10;
channel.addEventListener(Event.SOUND_COMPLETE, soundComplete);
return (channel);
}
}
}//package snd
Section 29
//SoundManager (snd.SoundManager)
package snd {
import flash.media.*;
public class SoundManager {
public static var sounds:Object = {shoot:ShootSound, transform:TransformSound, slow:SlowSound, enHit:EnemyhitSound, mouseover:OverSound, click:ClickSound, scoreup:ScoreUpSound, genup:GenUpSound, sweep:SweeperSound, win:WinSound, loose:LooseSound};
public function SoundManager(){
super();
}
public static function playSound(type:String, max:Number, vol:Number=1):SoundChannel{
return (SoundFX.playSound(sounds[type], 1, vol, max));
}
}
}//package snd
Section 30
//GameOver (ui.GameOver)
package ui {
import flash.events.*;
import gam.*;
import nav.*;
import snd.*;
public class GameOver extends GameOverMC {
private var playerF:Number;// = 1
public function GameOver(){
super();
anim.stop();
retry_btn.addEventListener(MouseEvent.CLICK, playAgain);
menu_btn.addEventListener(MouseEvent.CLICK, toMenu);
SoundButton.addSound(retry_btn);
SoundButton.addSound(menu_btn);
}
private function toMenu(e:MouseEvent):void{
Navigation.switchScreens(Game(parent), Navigation.mainmenu);
Navigation.showStats(Navigation.mainmenu);
parent.removeChild(this);
}
public function setCell(f:Number):void{
anim.player.gotoAndStop(f);
anim.gotoAndPlay(1);
anim.addFrameScript(1, setCellFrame);
playerF = f;
}
private function setCellFrame():void{
anim.player.gotoAndStop(playerF);
}
private function playAgain(e:MouseEvent):void{
Game(parent).newGame();
Navigation.regainFocus();
Music.playNextLevelSong();
parent.removeChild(this);
}
}
}//package ui
Section 31
//PauseScreen (ui.PauseScreen)
package ui {
import flash.events.*;
import gam.*;
import nav.*;
import snd.*;
public class PauseScreen extends PauseMC {
public function PauseScreen(){
super();
continue_btn.addEventListener(MouseEvent.CLICK, unpauseGame);
retry_btn.addEventListener(MouseEvent.CLICK, retryGame);
settings_btn.addEventListener(MouseEvent.CLICK, showSettings);
menu_btn.addEventListener(MouseEvent.CLICK, toMain);
htp_btn.addEventListener(MouseEvent.CLICK, showHtp);
SoundButton.addSound(continue_btn);
SoundButton.addSound(retry_btn);
SoundButton.addSound(settings_btn);
SoundButton.addSound(menu_btn);
SoundButton.addSound(htp_btn);
}
private function showSettings(e:MouseEvent):void{
Navigation.showSettings(this);
}
private function retryGame(e:MouseEvent):void{
Game(parent).paused = false;
Game(parent).newGame();
Navigation.regainFocus();
Music.playNextLevelSong();
parent.removeChild(this);
}
private function toMain(e:MouseEvent):void{
Game(parent).paused = false;
Navigation.switchScreens(Game(parent), Navigation.mainmenu);
parent.removeChild(this);
}
private function showHtp(e:MouseEvent):void{
Navigation.showHowTo(this);
}
private function unpauseGame(e:MouseEvent):void{
Game(parent).unpause();
}
}
}//package ui
Section 32
//Settings (ui.Settings)
package ui {
import flash.events.*;
import flash.display.*;
import gam.*;
import nav.*;
import snd.*;
public class Settings extends settingsMC {
public function Settings(){
super();
sound_off.buttonMode = true;
sound_off.useHandCursor = true;
sound_on.buttonMode = true;
sound_on.useHandCursor = true;
music_off.buttonMode = true;
music_off.useHandCursor = true;
music_on.buttonMode = true;
music_on.useHandCursor = true;
low.buttonMode = true;
low.useHandCursor = true;
normal.buttonMode = true;
normal.useHandCursor = true;
high.buttonMode = true;
high.useHandCursor = true;
sound_on.addEventListener(MouseEvent.CLICK, soundOn);
sound_off.addEventListener(MouseEvent.CLICK, soundOff);
music_on.addEventListener(MouseEvent.CLICK, musicOn);
music_off.addEventListener(MouseEvent.CLICK, musicOff);
low.addEventListener(MouseEvent.CLICK, lowQ);
normal.addEventListener(MouseEvent.CLICK, medQ);
high.addEventListener(MouseEvent.CLICK, highQ);
con_btn.addEventListener(MouseEvent.CLICK, hideMe);
SoundButton.addSound(con_btn);
addEventListener(Event.ADDED_TO_STAGE, checks);
}
private function soundOff(e:MouseEvent):void{
if (!SoundFX.mute){
SoundFX.mute = true;
sound_on.gotoAndStop(1);
sound_off.gotoAndStop(2);
};
}
private function hideMe(e:MouseEvent):void{
Navigation.hideSettings(MovieClip(parent));
}
private function musicOn(e:MouseEvent):void{
if (Music.mute){
Music.mute = false;
music_on.gotoAndStop(2);
music_off.gotoAndStop(1);
};
}
private function medQ(e:MouseEvent):void{
Key.setQuality("medium");
low.gotoAndStop(1);
normal.gotoAndStop(2);
high.gotoAndStop(1);
}
private function musicOff(e:MouseEvent):void{
if (!Music.mute){
Music.mute = true;
music_on.gotoAndStop(1);
music_off.gotoAndStop(2);
};
}
private function checks(e:Event):void{
if (Music.mute){
music_on.gotoAndStop(1);
music_off.gotoAndStop(2);
} else {
music_on.gotoAndStop(2);
music_off.gotoAndStop(1);
};
if (SoundFX.mute){
sound_on.gotoAndStop(1);
sound_off.gotoAndStop(2);
} else {
sound_on.gotoAndStop(2);
sound_off.gotoAndStop(1);
};
trace(Key.curQual);
switch (Key.curQual){
case 0:
low.gotoAndStop(2);
normal.gotoAndStop(1);
high.gotoAndStop(1);
break;
case 1:
low.gotoAndStop(1);
normal.gotoAndStop(2);
high.gotoAndStop(1);
break;
case 2:
low.gotoAndStop(1);
normal.gotoAndStop(1);
high.gotoAndStop(2);
break;
};
}
private function lowQ(e:MouseEvent):void{
Key.setQuality("low");
low.gotoAndStop(2);
normal.gotoAndStop(1);
high.gotoAndStop(1);
}
private function soundOn(e:MouseEvent):void{
if (SoundFX.mute){
SoundFX.mute = false;
sound_on.gotoAndStop(2);
sound_off.gotoAndStop(1);
};
}
private function highQ(e:MouseEvent):void{
Key.setQuality("high");
low.gotoAndStop(1);
normal.gotoAndStop(1);
high.gotoAndStop(2);
}
}
}//package ui
Section 33
//WinScreen (ui.WinScreen)
package ui {
import flash.events.*;
import gam.*;
import nav.*;
import snd.*;
public class WinScreen extends WinMC {
private var thescore:Number;
private var numbersInScore:Number;// = 9
private var finalStage:Number;
private var curUp:Number;
private var scrStr:String;
private var curScore:Number;
private var upRate:Number;
private var upMoments:Array;
private var scoreLetters:String;
public function WinScreen(){
upMoments = new Array();
super();
menu_btn.addEventListener(MouseEvent.CLICK, toMenu);
addEventListener(MouseEvent.CLICK, skip);
SoundButton.addSound(menu_btn);
anim.player.stop();
anim.stop();
addEventListener(Event.ADDED_TO_STAGE, startAnim);
}
private function toMenu(e:MouseEvent):void{
Navigation.switchScreens(Game(parent), Navigation.mainmenu);
Navigation.showStats(Navigation.mainmenu);
parent.removeChild(this);
}
private function startAnim(e:Event):void{
anim.gotoAndPlay(1);
curScore = 0;
addEventListener(Event.ENTER_FRAME, doAnim);
}
private function doAnim(e:Event):void{
var j:Number;
SoundManager.playSound("shoot", 5, 0.3);
curScore = (curScore + upRate);
scrStr = String(curScore);
var lamount:Number = scrStr.length;
scoreLetters = "";
var i:Number = 0;
while (i < (numbersInScore - lamount)) {
scoreLetters = (scoreLetters + "0");
i++;
};
scoreLetters = (scoreLetters + scrStr);
score.text = scoreLetters;
if (curScore > upMoments[curUp]){
anim.player.nextFrame();
curUp++;
};
if (curScore >= thescore){
removeEventListener(Event.ENTER_FRAME, doAnim);
curScore = thescore;
scrStr = String(curScore);
lamount = scrStr.length;
scoreLetters = "";
j = 0;
while (j < (numbersInScore - lamount)) {
scoreLetters = (scoreLetters + "0");
j++;
};
scoreLetters = (scoreLetters + scrStr);
score.text = scoreLetters;
};
}
public function settings(endStage:Number, score:Number):void{
finalStage = endStage;
thescore = score;
upMoments = new Array();
curUp = 0;
var up:Number = (score / finalStage);
var n:Number = up;
if (score < 10000){
upRate = 53;
} else {
if (score < 100000){
upRate = 553;
} else {
if (score < 1000000){
upRate = 5553;
} else {
upRate = 55553;
};
};
};
while (n < score) {
n = (n + up);
upMoments.push(n);
};
}
private function skip(e:MouseEvent):void{
removeEventListener(Event.ENTER_FRAME, doAnim);
curScore = thescore;
scrStr = String(curScore);
var lamount:Number = scrStr.length;
scoreLetters = "";
var j:Number = 0;
while (j < (numbersInScore - lamount)) {
scoreLetters = (scoreLetters + "0");
j++;
};
scoreLetters = (scoreLetters + scrStr);
score.text = scoreLetters;
anim.player.gotoAndStop(finalStage);
}
}
}//package ui
Section 34
//BulletMC (BulletMC)
package {
import flash.display.*;
public dynamic class BulletMC extends MovieClip {
}
}//package
Section 35
//ClickSound (ClickSound)
package {
import flash.media.*;
public dynamic class ClickSound extends Sound {
}
}//package
Section 36
//ColorShot (ColorShot)
package {
import flash.events.*;
import flash.display.*;
import nav.*;
import mochi.*;
import flash.utils.*;
public dynamic class ColorShot extends MovieClip {
private var loader:PreloadScreen;
public function ColorShot(){
loader = new PreloadScreen();
super();
gotoAndStop(1);
MochiAd.showPreGameAd({clip:root, id:"3b6c25387e9a9962", res:"600x500", background:0xFFFFFF, color:6674987, outline:3960789, no_bg:false, ad_finished:MochiAdComplete});
}
private function checkLoad(e:Event):void{
var perc:Number;
if ((((currentFrame == totalFrames)) || ((root.loaderInfo.bytesLoaded == root.loaderInfo.bytesTotal)))){
removeEventListener(Event.ENTER_FRAME, checkLoad);
startup();
} else {
perc = Math.round(((root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal) * 100));
loader.update(perc);
};
}
private function startup():void{
gotoAndStop(2);
removeChild(loader);
removeEventListener(Event.ENTER_FRAME, checkLoad);
var mainClass:Class = (getDefinitionByName("Main") as Class);
addChild((new (mainClass) as DisplayObject));
}
private function MochiAdComplete():void{
addChild(loader);
addEventListener(Event.ENTER_FRAME, checkLoad);
}
}
}//package
Section 37
//EnemyhitSound (EnemyhitSound)
package {
import flash.media.*;
public dynamic class EnemyhitSound extends Sound {
}
}//package
Section 38
//EnemyMC (EnemyMC)
package {
import flash.display.*;
public dynamic class EnemyMC extends MovieClip {
}
}//package
Section 39
//GameMC (GameMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class GameMC extends MovieClip {
public var entxt:TextField;
public var timetxt:TextField;
public var healthtxt:TextField;
public var scoretxt:TextField;
public var bgmc:MovieClip;
public var wavetxt:TextField;
public var geneticstxt:TextField;
}
}//package
Section 40
//GameOverMC (GameOverMC)
package {
import flash.display.*;
public dynamic class GameOverMC extends MovieClip {
public var anim:MovieClip;
public var retry_btn:SimpleButton;
public var menu_btn:SimpleButton;
}
}//package
Section 41
//GenUpSound (GenUpSound)
package {
import flash.media.*;
public dynamic class GenUpSound extends Sound {
}
}//package
Section 42
//htpMC (htpMC)
package {
import flash.display.*;
public dynamic class htpMC extends MovieClip {
public var continue_btn:SimpleButton;
}
}//package
Section 43
//InfectedMC (InfectedMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class InfectedMC extends MovieClip {
public var countdown:TextField;
}
}//package
Section 44
//Level1 (Level1)
package {
import flash.media.*;
public dynamic class Level1 extends Sound {
}
}//package
Section 45
//Level2 (Level2)
package {
import flash.media.*;
public dynamic class Level2 extends Sound {
}
}//package
Section 46
//Level3 (Level3)
package {
import flash.media.*;
public dynamic class Level3 extends Sound {
}
}//package
Section 47
//LooseSound (LooseSound)
package {
import flash.media.*;
public dynamic class LooseSound extends Sound {
}
}//package
Section 48
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import gam.*;
import flash.net.*;
import flash.ui.*;
import nav.*;
import kon.*;
import flash.geom.*;
public class Main extends MovieClip {
private var _url2:URLRequest;
public var myContextMenu:ContextMenu;
private var _url:URLRequest;
private var apiConnection;
public function Main(){
_url = new URLRequest("http://www.manicmartian.com");
_url2 = new URLRequest("http://www.iamthestory.net");
super();
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
};
}
private function removeDefaultItems():void{
myContextMenu.hideBuiltInItems();
}
public function submitToKongregate(score:Number, mode:String):void{
if (((!((apiConnection == null))) && ((apiConnection.type == "kongregate")))){
apiConnection.scores.submit(score, mode);
};
}
private function addCustomMenuItems():void{
var item:ContextMenuItem = new ContextMenuItem("Manic Martian");
myContextMenu.customItems.push(item);
var item2:ContextMenuItem = new ContextMenuItem("I am the story");
myContextMenu.customItems.push(item2);
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
item2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler2);
}
private function menuItemSelectHandler2(event:ContextMenuEvent):void{
navigateToURL(_url2, "blank");
}
private function init(e:Event=null):void{
stage.scaleMode = StageScaleMode.NO_SCALE;
myContextMenu = new ContextMenu();
removeDefaultItems();
addCustomMenuItems();
this.contextMenu = myContextMenu;
myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, menuSelectHandler);
scrollRect = new Rectangle(0, 0, 600, 500);
if (stage.loaderInfo.url.indexOf("kongregate") > 0){
apiConnection = new KongregateApiConnection(stage);
apiConnection.connect();
};
SaveGameData.init(this);
Key.initialize(stage);
Key.setQuality(SaveGameData.getQuality());
Navigation.init(this);
}
private function menuItemSelectHandler(event:ContextMenuEvent):void{
navigateToURL(_url, "blank");
}
private function menuSelectHandler(e:ContextMenuEvent):void{
Key.clear();
Navigation.pauseGame();
}
}
}//package
Section 49
//MainMenuMC (MainMenuMC)
package {
import flash.display.*;
public dynamic class MainMenuMC extends MovieClip {
public var s_logo:SimpleButton;
public var settings_btn:SimpleButton;
public var diff_select:MovieClip;
public var stats_btn:SimpleButton;
public var howto_btn:SimpleButton;
public var mm_logo:SimpleButton;
public var start_btn:SimpleButton;
}
}//package
Section 50
//MainSong (MainSong)
package {
import flash.media.*;
public dynamic class MainSong extends Sound {
}
}//package
Section 51
//MissileMC (MissileMC)
package {
import flash.display.*;
public dynamic class MissileMC extends MovieClip {
}
}//package
Section 52
//OverSound (OverSound)
package {
import flash.media.*;
public dynamic class OverSound extends Sound {
}
}//package
Section 53
//PauseMC (PauseMC)
package {
import flash.display.*;
public dynamic class PauseMC extends MovieClip {
public var retry_btn:SimpleButton;
public var settings_btn:SimpleButton;
public var menu_btn:SimpleButton;
public var htp_btn:SimpleButton;
public var continue_btn:SimpleButton;
}
}//package
Section 54
//PlayerMC (PlayerMC)
package {
import flash.display.*;
public dynamic class PlayerMC extends MovieClip {
public var hitarea:MovieClip;
}
}//package
Section 55
//PreloadMC (PreloadMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class PreloadMC extends MovieClip {
public var stufftxt:TextField;
public var loadtxt:TextField;
}
}//package
Section 56
//RedBulletMC (RedBulletMC)
package {
import flash.display.*;
public dynamic class RedBulletMC extends MovieClip {
}
}//package
Section 57
//ScoreTxtMC (ScoreTxtMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ScoreTxtMC extends MovieClip {
public var scoretxt:TextField;
}
}//package
Section 58
//ScoreUpSound (ScoreUpSound)
package {
import flash.media.*;
public dynamic class ScoreUpSound extends Sound {
}
}//package
Section 59
//settingsMC (settingsMC)
package {
import flash.display.*;
public dynamic class settingsMC extends MovieClip {
public var sound_on:MovieClip;
public var con_btn:SimpleButton;
public var sound_off:MovieClip;
public var music_on:MovieClip;
public var low:MovieClip;
public var music_off:MovieClip;
public var high:MovieClip;
public var normal:MovieClip;
}
}//package
Section 60
//ShootSound (ShootSound)
package {
import flash.media.*;
public dynamic class ShootSound extends Sound {
}
}//package
Section 61
//SlowSound (SlowSound)
package {
import flash.media.*;
public dynamic class SlowSound extends Sound {
}
}//package
Section 62
//StatsMC (StatsMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class StatsMC extends MovieClip {
public var infections:TextField;
public var extremevics:TextField;
public var totaltime:TextField;
public var con_btn:SimpleButton;
public var evolution:TextField;
public var level:TextField;
public var easyvics:TextField;
public var score:TextField;
public var games:TextField;
public var normalvics:TextField;
public var hardvics:TextField;
public var shortestrun:TextField;
public var longestrun:TextField;
}
}//package
Section 63
//Sweeper (Sweeper)
package {
import flash.display.*;
public dynamic class Sweeper extends MovieClip {
}
}//package
Section 64
//SweeperSound (SweeperSound)
package {
import flash.media.*;
public dynamic class SweeperSound extends Sound {
}
}//package
Section 65
//TransformSound (TransformSound)
package {
import flash.media.*;
public dynamic class TransformSound extends Sound {
}
}//package
Section 66
//UpEffect (UpEffect)
package {
import flash.display.*;
public dynamic class UpEffect extends MovieClip {
}
}//package
Section 67
//UpgradeMC (UpgradeMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class UpgradeMC extends MovieClip {
public var gencoll:TextField;
public var microbes1:MovieClip;
public var microbes2:MovieClip;
public var shieldtxt:TextField;
public var hptxt:TextField;
public var microbes5:MovieClip;
public var microbes6:MovieClip;
public var microbes10:MovieClip;
public var microbes9:MovieClip;
public var e3:MovieClip;
public var e4:MovieClip;
public var e5:MovieClip;
public var e6:MovieClip;
public var e8:MovieClip;
public var e2:MovieClip;
public var microbes3:MovieClip;
public var microbes4:MovieClip;
public var e1:MovieClip;
public var move1:MovieClip;
public var e9:MovieClip;
public var microbes8:MovieClip;
public var e7:MovieClip;
public var move3:MovieClip;
public var microbes7:MovieClip;
public var nextWave:SimpleButton;
public var move2:MovieClip;
public var move4:MovieClip;
public var move5:MovieClip;
public var info:MovieClip;
public var virus1:MovieClip;
public var virus2:MovieClip;
public var virus3:MovieClip;
public var virus4:MovieClip;
public var virus5:MovieClip;
public var e10:MovieClip;
public var e13:MovieClip;
public var e14:MovieClip;
public var e15:MovieClip;
public var e11:MovieClip;
public var e12:MovieClip;
public var health1:MovieClip;
public var health2:MovieClip;
public var health3:MovieClip;
public var health4:MovieClip;
public var health5:MovieClip;
public var regen2:MovieClip;
public var regen4:MovieClip;
public var regen5:MovieClip;
public var totalgen:TextField;
public var regen3:MovieClip;
public var regen1:MovieClip;
public var score2:MovieClip;
public var score3:MovieClip;
public var score4:MovieClip;
public var score5:MovieClip;
public var score1:MovieClip;
public var shield1:MovieClip;
public var shield2:MovieClip;
public var shield4:MovieClip;
public var shield5:MovieClip;
public var shield3:MovieClip;
}
}//package
Section 68
//WinMC (WinMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class WinMC extends MovieClip {
public var anim:MovieClip;
public var menu_btn:SimpleButton;
public var score:TextField;
}
}//package
Section 69
//WinSound (WinSound)
package {
import flash.media.*;
public dynamic class WinSound extends Sound {
}
}//package