Section 1
//text_3 (FlashJoystickUtilsv2_fla.text_3)
package FlashJoystickUtilsv2_fla {
import flash.display.*;
import flash.text.*;
public dynamic class text_3 extends MovieClip {
public var pAPIName:TextField;
}
}//package FlashJoystickUtilsv2_fla
Section 2
//JoystickUtils (PillowFort.FlashJoystick.JoystickUtils)
package PillowFort.FlashJoystick {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.utils.*;
import flash.errors.*;
public class JoystickUtils extends MovieClip {
public static function Rumble(_arg1:int, _arg2:int, _arg3:int):void{
var rumbleURL:URLRequest;
var playerIndex = _arg1;
var leftMotorSpeed = _arg2;
var rightMotorSpeed = _arg3;
try {
rumbleURL = new URLRequest((((((("http://127.0.0.1:8899?06141981.FJSPF" + playerIndex) + "-") + leftMotorSpeed) + "-") + rightMotorSpeed) + "|"));
rumbleURL.method = URLRequestMethod.POST;
trace("RUMBLE");
sendToURL(rumbleURL);
} catch(e:IOError) {
trace("************PillowFort FlashJoystick Error*************");
trace("The following error occurred when trying to send a rumble command");
trace(e.toString());
trace("Parameters:");
trace(("PlayerIndex: " + playerIndex));
trace(("LeftMotorSpeed: " + leftMotorSpeed));
trace(("RightMotorSpeed: " + rightMotorSpeed));
trace("Possible reasons for this error may be that the FlashJoystick application was not running at the time when this command was sent.");
trace("Make sure FlashJoystick is running and try again. If you continue to get errors, email support@pillowfortgames.com");
trace("********************************************************");
};
}
}
}//package PillowFort.FlashJoystick
Section 3
//BaseBone (TheBrain.BrainGuys.BrainGuyParts.BaseBone)
package TheBrain.BrainGuys.BrainGuyParts {
public class BaseBone extends BrainGuyPart {
public function BaseBone():void{
uType = BONE;
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 4
//BaseBrain (TheBrain.BrainGuys.BrainGuyParts.BaseBrain)
package TheBrain.BrainGuys.BrainGuyParts {
public class BaseBrain extends BrainGuyPart {
public function BaseBrain():void{
uType = BRAIN;
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 5
//BaseEye (TheBrain.BrainGuys.BrainGuyParts.BaseEye)
package TheBrain.BrainGuys.BrainGuyParts {
import TheBrain.*;
import flash.geom.*;
public class BaseEye extends BrainGuyPart {
private var pParentObject:WorldObject;// = null
private var fLastRotation:Number;// = 0
public function BaseEye():void{
fLastRotation = 0;
pParentObject = null;
super();
uType = EYE;
}
public function SetParentObject(_arg1:WorldObject):void{
pParentObject = _arg1;
}
public function Fire():void{
gotoAndPlay("fire");
}
public function GetRotation():Number{
return (fLastRotation);
}
override public function Update():void{
var _local1:Point;
var _local2:Vector;
_local1 = localToGlobal(new Point(x, y));
_local2 = new Vector((TheBrainGame.pEnergyBall.x - _local1.x), (TheBrainGame.pEnergyBall.y - _local1.y));
rotation = (((Math.atan2(_local2.y, _local2.x) * (180 / Math.PI)) - 90) - pParentObject.rotation);
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 6
//BaseTooth (TheBrain.BrainGuys.BrainGuyParts.BaseTooth)
package TheBrain.BrainGuys.BrainGuyParts {
public class BaseTooth extends BrainGuyPart {
public function BaseTooth():void{
uType = TOOTH;
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 7
//BeamEye (TheBrain.BrainGuys.BrainGuyParts.BeamEye)
package TheBrain.BrainGuys.BrainGuyParts {
public class BeamEye extends BaseEye {
public var bDeadly:Boolean;
public var bFiring:Boolean;
public function BeamEye():void{
addFrameScript(0, frame1, 1, frame2, 11, frame12);
}
function frame12(){
bDeadly = true;
}
function frame1(){
bFiring = false;
bDeadly = false;
stop();
}
function frame2(){
bFiring = true;
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 8
//BigBrain (TheBrain.BrainGuys.BrainGuyParts.BigBrain)
package TheBrain.BrainGuys.BrainGuyParts {
public class BigBrain extends BaseBrain {
public function BigBrain():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 9
//BrainEye (TheBrain.BrainGuys.BrainGuyParts.BrainEye)
package TheBrain.BrainGuys.BrainGuyParts {
public class BrainEye extends BaseEye {
public function BrainEye():void{
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 10
//BrainGuyPart (TheBrain.BrainGuys.BrainGuyParts.BrainGuyPart)
package TheBrain.BrainGuys.BrainGuyParts {
import TheBrain.*;
import flash.display.*;
public class BrainGuyPart extends WorldObject {
public var pBitmapData:BitmapData;// = null
public var uType:uint;// = 1
public static const EYE:uint = 4;
public static const BONE:uint = 1;
public static const BRAIN:uint = 0;
public static const TOOTH:uint = 2;
public function BrainGuyPart():void{
uType = BONE;
pBitmapData = null;
super();
if (((((this is BaseTooth) == false)) && (((this is BaseEye) == false)))){
};
}
public function RegisterHit():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 11
//LittleBrain (TheBrain.BrainGuys.BrainGuyParts.LittleBrain)
package TheBrain.BrainGuys.BrainGuyParts {
public class LittleBrain extends BaseBrain {
public function LittleBrain():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 12
//MediumBrain (TheBrain.BrainGuys.BrainGuyParts.MediumBrain)
package TheBrain.BrainGuys.BrainGuyParts {
public class MediumBrain extends BaseBrain {
public function MediumBrain():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 13
//PelvicPart (TheBrain.BrainGuys.BrainGuyParts.PelvicPart)
package TheBrain.BrainGuys.BrainGuyParts {
public class PelvicPart extends BaseBone {
public function PelvicPart():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 14
//SmallBrainEye (TheBrain.BrainGuys.BrainGuyParts.SmallBrainEye)
package TheBrain.BrainGuys.BrainGuyParts {
public class SmallBrainEye extends BaseEye {
public function SmallBrainEye():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 15
//SpinePart (TheBrain.BrainGuys.BrainGuyParts.SpinePart)
package TheBrain.BrainGuys.BrainGuyParts {
public class SpinePart extends BaseBone {
public function SpinePart():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 16
//TeethRowPart (TheBrain.BrainGuys.BrainGuyParts.TeethRowPart)
package TheBrain.BrainGuys.BrainGuyParts {
public class TeethRowPart extends BaseTooth {
public function TeethRowPart():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 17
//ThighPart (TheBrain.BrainGuys.BrainGuyParts.ThighPart)
package TheBrain.BrainGuys.BrainGuyParts {
public class ThighPart extends BaseBone {
public function ThighPart():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 18
//TuskPart (TheBrain.BrainGuys.BrainGuyParts.TuskPart)
package TheBrain.BrainGuys.BrainGuyParts {
public class TuskPart extends BaseBone {
public function TuskPart():void{
}
}
}//package TheBrain.BrainGuys.BrainGuyParts
Section 19
//Boss (TheBrain.BrainGuys.Boss)
package TheBrain.BrainGuys {
import TheBrain.*;
import flash.events.*;
import flash.display.*;
import TheBrain.ParticleEffects.*;
import flash.media.*;
public class Boss extends MovieClip {
private var iFrameCounter:int;// = 0
private var pNextStage:BrainGuy;// = null
private var bFinalExplosion:Boolean;// = false
private var fExplosionAlpha:Number;// = 0
private var iCurrStage:int;// = 0
private var pCurrentStage:BrainGuy;// = null
public var iStart:int;// = 0
public var iCurrTime:int;// = 0
private var bDestroyBoss:Boolean;// = false
public static var pBoss:Boss = null;
public function Boss():void{
iCurrStage = 0;
pCurrentStage = null;
pNextStage = null;
bDestroyBoss = false;
iFrameCounter = 0;
fExplosionAlpha = 0;
bFinalExplosion = false;
iStart = 0;
iCurrTime = 0;
super();
pBoss = this;
NextBossStage();
}
public function NextBossStage():void{
if (iCurrStage > 3){
pCurrentStage.Destroy();
bDestroyBoss = true;
pNextStage = null;
TheBrainGame.pGame.SetShake(150, 4);
return;
};
switch (iCurrStage){
case 0:
pNextStage = new BossStage1();
break;
case 1:
pNextStage = new BossStage2();
break;
case 2:
pNextStage = new BossStage3();
break;
default:
pNextStage = new BossStage4();
break;
};
if (pCurrentStage != null){
pNextStage.SetPosition(pCurrentStage.x, pCurrentStage.y);
pCurrentStage.Destroy();
} else {
pNextStage.SetPosition((TheBrainGame.screenWidth * 0.5), (TheBrainGame.screenHeight * 0.5));
};
pNextStage.scaleX = 1;
pNextStage.scaleY = 1;
pNextStage.bStationary = true;
iCurrStage++;
}
public function FadeInBlack(_arg1:Event):void{
if (TheBrainGame.pGame.gameMode == TheBrainGame.NORMALMODE){
TheBrainGame.pGame.VictoryScreen(1);
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
TheBrainGame.pGame.VictoryScreen(2);
} else {
TheBrainGame.pGame.VictoryScreen(0);
};
};
}
public function Update():void{
var _local1:Sound;
var _local2:Sound;
var _local3:SoundChannel;
var _local4:Date;
var _local5:*;
iFrameCounter++;
if (pNextStage != null){
pCurrentStage = pNextStage;
TheBrainGame.pGame.CreateGuy(pNextStage, null);
pNextStage = null;
};
if (bDestroyBoss == true){
if (fExplosionAlpha > 0){
TheBrainGame.pGame.pFadeLayer.graphics.clear();
TheBrainGame.pGame.pFadeLayer.graphics.beginFill(0xFFFFFF, fExplosionAlpha);
TheBrainGame.pGame.pFadeLayer.graphics.drawRect(0, 0, TheBrainGame.screenWidth, TheBrainGame.screenHeight);
TheBrainGame.pGame.pFadeLayer.graphics.endFill();
};
if (bFinalExplosion == false){
fExplosionAlpha = (fExplosionAlpha + 0.005);
TheBrainGame.pBGMusicChannel.soundTransform = new SoundTransform((1 - fExplosionAlpha));
};
if ((((((bFinalExplosion == false)) && ((fExplosionAlpha <= 1)))) && (((iFrameCounter % 3) == 0)))){
_local1 = new BossMiniExplosion();
_local1.play();
TheBrainGame.pGame.SetShake(10, 3);
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(Math.round((Math.random() * TheBrainGame.screenWidth)), Math.round((Math.random() * TheBrainGame.screenHeight)), true));
} else {
if ((((fExplosionAlpha >= 1)) && ((bFinalExplosion == false)))){
bFinalExplosion = true;
_local2 = new BossFinalDeath();
_local3 = _local2.play();
if (_local3 != null){
_local3.addEventListener(Event.SOUND_COMPLETE, FadeInBlack);
};
} else {
if (bFinalExplosion == true){
fExplosionAlpha = (fExplosionAlpha - 0.05);
};
};
};
} else {
_local4 = new Date();
iCurrTime = (_local4.time - iStart);
_local5 = (iCurrTime / 1000);
TheBrainGame.pGame.pScore.pTimeDisplay.time.text = _local5.toString();
};
}
}
}//package TheBrain.BrainGuys
Section 20
//BossStage1 (TheBrain.BrainGuys.BossStage1)
package TheBrain.BrainGuys {
import TheBrain.*;
import flash.events.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
import flash.media.*;
public class BossStage1 extends BrainGuy {
public var bCanAttack:Boolean;// = false
public var pSpawnNorms:Array;
public var iSpawnFrame;// = 60
public var pLeftEye:BrainEye;
public var vShotDirection:Vector;
public var tmpCanAttack:Boolean;// = false
public var pRightEye:BrainEye;
public var pIntroSoundChannel:SoundChannel;// = null
public var pLittleGuys:Array;
public var fCurrRad;// = 0
public var pSpawnPositions:Array;
public function BossStage1():void{
var _local1:Sound;
iSpawnFrame = 60;
pSpawnPositions = new Array(new Vector(0, -75), new Vector(-75, 75), new Vector(75, 75));
pSpawnNorms = new Array(new Vector(0, -200), new Vector(-200, 200), new Vector(200, 200));
fCurrRad = 0;
vShotDirection = new Vector(0, 1);
pLittleGuys = new Array();
pIntroSoundChannel = null;
bCanAttack = false;
tmpCanAttack = false;
super();
uGuyType = BrainGuy.BOSS;
pLeftEye.SetParentObject(this);
pRightEye.SetParentObject(this);
iShotWait = 100;
uTotalPointsWorth = 3500;
if (TheBrainGame.pGame.gameMode == TheBrainGame.NORMALMODE){
WebStats.HitStats(WebStats.MADETOBOSSNORMALSTAT);
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
WebStats.HitStats(WebStats.MADETOBOSSEXPERTSTAT);
};
};
_local1 = new BossIntro();
pIntroSoundChannel = _local1.play();
pIntroSoundChannel.addEventListener(Event.SOUND_COMPLETE, IntroFinished);
if (TheBrainGame.pBGMusicChannel != null){
TheBrainGame.pBGMusicChannel.stop();
};
TheBrainGame.pGame.pFadeLayer.graphics.clear();
TheBrainGame.pGame.pFadeLayer.graphics.beginFill(0, 1);
TheBrainGame.pGame.pFadeLayer.graphics.drawRect(0, 0, 640, 480);
TheBrainGame.pGame.pFadeLayer.graphics.endFill();
}
override protected function Fire():void{
var _local1:Vector;
var _local2:Vector;
_local1 = Vector.PointToVector(localToGlobal(pLeftEye.vPos.toPoint()));
_local2 = Vector.PointToVector(localToGlobal(pRightEye.vPos.toPoint()));
Shoot(400, _local1, fLargeBulletScale, TheBrainGame.pEnergyBall.vPos.subtract(_local1).normalize(), true);
Shoot(400, _local2, fLargeBulletScale, TheBrainGame.pEnergyBall.vPos.subtract(_local2).normalize(), true);
}
private function IntroFinished(_arg1:Event):void{
var _local2:Sound;
var _local3:Date;
bCanAttack = true;
_local2 = new BossMusic();
TheBrainGame.pBGMusicChannel = _local2.play(0, 99999);
_local3 = new Date();
Boss.pBoss.iStart = _local3.time;
}
override public function Update():void{
var _local1:Number;
var _local2:Vector;
var _local3:int;
var _local4:Petey;
var _local5:Vector;
if (bCanAttack == false){
return;
};
if (tmpCanAttack != bCanAttack){
tmpCanAttack = bCanAttack;
TheBrainGame.pGame.pFadeLayer.graphics.clear();
TheBrainGame.pGame.pFadeLayer.graphics.endFill();
TheBrainGame.pGame.AddParticleEffect(new ScreenCrack(0, 0));
};
if (bDead == true){
return;
};
pLeftEye.Update();
pRightEye.Update();
_local3 = 0;
while (_local3 < pLittleGuys.length) {
if (pLittleGuys[_local3].ShouldDestroy() == true){
pLittleGuys.splice(_local3, 1);
_local3 = Math.max((_local3 - 1), 0);
} else {
_local2 = pLittleGuys[_local3].vPos.subtract(vPos);
_local1 = _local2.lengthSq();
if ((((_local1 < (110 * 110))) && ((_local1 > 0)))){
pLittleGuys[_local3].AccumulateForce(_local2.multiply((2000 / Math.sqrt(_local1))));
};
};
_local3++;
};
if ((((iSpawnFrame <= 0)) && ((pLittleGuys.length < 9)))){
iSpawnFrame = 120;
_local3 = 0;
while (_local3 < 3) {
_local4 = new Petey();
_local4.SetPosition((pSpawnPositions[_local3].x + x), (pSpawnPositions[_local3].y + y));
pLittleGuys.push(_local4);
TheBrainGame.pGame.CreateGuy(_local4, null);
_local3++;
};
} else {
iSpawnFrame--;
};
if ((((iShotWait > 0)) && ((iShotClock >= iShotWait)))){
iShotClock = 0;
Fire();
};
iShotClock++;
if ((iShotClock % 20) == 0){
_local5 = new Vector((TheBrainGame.screenWidth * 0.5), (TheBrainGame.screenHeight * 0.5));
Shoot(50, _local5, fSmallBulletScale, vShotDirection, false, false);
Shoot(50, _local5, fSmallBulletScale, vShotDirection.multiply(-1), false, false);
Shoot(50, _local5, fSmallBulletScale, vShotDirection.PerpLH(), false, false);
Shoot(50, _local5, fSmallBulletScale, vShotDirection.PerpRH(), false, false);
fCurrRad = (fCurrRad + 0.1);
vShotDirection.x = Math.sin(fCurrRad);
vShotDirection.y = Math.cos(fCurrRad);
};
}
override public function Kill():void{
}
override public function TriangleKill():void{
var _local1:int;
var _local2:Sound;
bDead = true;
_local1 = 0;
while (_local1 < TheBrainGame.pGame.pBullets.length) {
TheBrainGame.pGame.pBullets[_local1].Destroy();
_local1++;
};
_local1 = 0;
while (_local1 < TheBrainGame.pGame.pGuys.length) {
TheBrainGame.pGame.pGuys[_local1].Kill();
_local1++;
};
if (TheBrainGame.pGame.gameMode == TheBrainGame.NORMALMODE){
WebStats.HitStats(WebStats.BEATBOSS1NORMAL);
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
WebStats.HitStats(WebStats.BEATBOSS1EXPERT);
};
};
TheBrainGame.pGame.AddParticleEffect(new BossBoom(x, y));
Boss.pBoss.NextBossStage();
_local2 = new BossDeath();
_local2.play();
}
}
}//package TheBrain.BrainGuys
Section 21
//BossStage2 (TheBrain.BrainGuys.BossStage2)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
import flash.media.*;
public class BossStage2 extends BrainGuy {
public var iWaveSet:int;// = 0
public var pSpawnNorms:Array;
public var iSpawnFrame;// = 60
public var pLeftEye:BrainEye;
var bLeftRotate:Boolean;// = false
public var pSpermGuys:Array;
public var vShotDirection:Vector;
public var pRightEye:BrainEye;
public var fCurrRad;// = 0
public var fRadOffset;// = 0
var iShotCounter:int;// = 0
public var pSpawnPositions:Array;
public var bShooting:Boolean;// = false
public function BossStage2():void{
iSpawnFrame = 60;
pSpawnPositions = new Array(new Vector(0, -50), new Vector(-50, 50), new Vector(50, 50));
pSpawnNorms = new Array(new Vector(0, -200), new Vector(-200, 200), new Vector(200, 200));
pSpermGuys = new Array();
fCurrRad = 0;
fRadOffset = 0;
vShotDirection = new Vector(0, 1);
iWaveSet = 0;
bShooting = false;
iShotCounter = 0;
bLeftRotate = false;
super();
uGuyType = BrainGuy.BOSS;
bStationary = true;
pLeftEye.SetParentObject(this);
pRightEye.SetParentObject(this);
uTotalPointsWorth = 7500;
}
override protected function Fire():void{
var _local1:Vector;
var _local2:Vector;
_local1 = Vector.PointToVector(localToGlobal(pLeftEye.vPos.toPoint()));
_local2 = Vector.PointToVector(localToGlobal(pRightEye.vPos.toPoint()));
Shoot(400, _local1, fLargeBulletScale, TheBrainGame.pEnergyBall.vPos.subtract(_local1).normalize(), true);
Shoot(400, _local2, fLargeBulletScale, TheBrainGame.pEnergyBall.vPos.subtract(_local2).normalize(), true);
}
override public function Update():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Boolean;
var _local5:Vector;
var _local6:Number;
var _local7:Sound;
var _local8:Sperm;
var _local9:Vector;
var _local10:Number;
if (bDead == true){
return;
};
pLeftEye.Update();
pRightEye.Update();
_local1 = 0;
while (_local1 < pSpermGuys.length) {
if (pSpermGuys[_local1].ShouldDestroy() == true){
pSpermGuys.splice(_local1, 1);
_local1 = Math.max((_local1 - 1), 0);
};
_local1++;
};
_local2 = (100 * 100);
_local3 = (100 * 100);
_local4 = bShooting;
if (TheBrainGame.pGame.pBullets.length > 200){
bShooting = true;
} else {
if (TheBrainGame.pGame.pBullets.length == 0){
bShooting = false;
iShotCounter = 0;
};
};
if (bShooting == true){
iShotCounter++;
if ((iShotCounter % 60) == 0){
bLeftRotate = !(bLeftRotate);
TheBrainGame.pGame.SetShake(15, 3);
_local7 = new BossAttack();
_local7.play();
};
};
if ((((bShooting == true)) && ((_local4 == false)))){
TheBrainGame.pGame.SetShake(10, 3);
_local7 = new BossAttack();
_local7.play();
};
_local1 = 0;
while (_local1 < TheBrainGame.pGame.pBullets.length) {
_local5 = vPos.subtract(TheBrainGame.pGame.pBullets[_local1].vPos);
_local6 = _local5.lengthSq();
if (bShooting == false){
if (_local6 > 0){
_local5 = _local5.divide(Math.sqrt(_local6));
if (_local6 > _local2){
TheBrainGame.pGame.pBullets[_local1].vVelocity = TheBrainGame.pGame.pBullets[_local1].vVelocity.add(_local5.multiply(4));
} else {
if (_local6 > _local3){
TheBrainGame.pGame.pBullets[_local1].vVelocity = TheBrainGame.pGame.pBullets[_local1].vVelocity.add(_local5.multiply(2));
};
};
if (bLeftRotate == true){
TheBrainGame.pGame.pBullets[_local1].vVelocity = TheBrainGame.pGame.pBullets[_local1].vVelocity.add(_local5.PerpLH().multiply(0.1));
} else {
TheBrainGame.pGame.pBullets[_local1].vVelocity = TheBrainGame.pGame.pBullets[_local1].vVelocity.add(_local5.PerpRH().multiply(0.1));
};
};
} else {
if ((iShotCounter % 60) == 0){
TheBrainGame.pGame.pBullets[_local1].vVelocity = new Vector(0, 0);
} else {
TheBrainGame.pGame.pBullets[_local1].vVelocity = TheBrainGame.pGame.pBullets[_local1].vVelocity.add(_local5.multiply(-0.01));
if (bLeftRotate == true){
TheBrainGame.pGame.pBullets[_local1].vVelocity = TheBrainGame.pGame.pBullets[_local1].vVelocity.add(_local5.PerpLH().multiply(-0.05));
} else {
TheBrainGame.pGame.pBullets[_local1].vVelocity = TheBrainGame.pGame.pBullets[_local1].vVelocity.add(_local5.PerpRH().multiply(-0.05));
};
};
};
_local1++;
};
if (pSpermGuys.length == 0){
iWaveSet = 3;
};
if (iSpawnFrame == 0){
iSpawnFrame = 60;
if (iWaveSet > 0){
_local1 = 0;
while (_local1 < 3) {
_local8 = new Sperm();
_local8.SetPosition((pSpawnPositions[_local1].x + x), (pSpawnPositions[_local1].y + y));
_local8.SetDirection(pSpawnNorms[_local1]);
_local8.bAllowedOffScreen = false;
pSpermGuys.push(_local8);
TheBrainGame.pGame.CreateGuy(_local8, null);
_local1++;
};
iWaveSet--;
};
} else {
iSpawnFrame--;
};
if ((((((bShooting == false)) && ((iShotWait > 0)))) && ((iShotClock >= iShotWait)))){
iShotClock = 0;
Fire();
};
iShotClock++;
if (((((iShotClock % 5) == 0)) && ((bShooting == false)))){
_local9 = new Vector((TheBrainGame.screenWidth * 0.5), (TheBrainGame.screenHeight * 0.5));
Shoot(75, _local9, fSmallBulletScale, vShotDirection, false, false);
Shoot(75, _local9, fSmallBulletScale, vShotDirection.multiply(-1), false, false);
Shoot(75, _local9, fSmallBulletScale, vShotDirection.PerpLH(), false, false);
Shoot(75, _local9, fSmallBulletScale, vShotDirection.PerpRH(), false, false);
fRadOffset = (fRadOffset + 0.1);
_local10 = (Math.sin(fRadOffset) * 0.5);
vShotDirection.x = Math.sin((fCurrRad + _local10));
vShotDirection.y = Math.cos((fCurrRad + _local10));
};
SetPosition(vPos.x, vPos.y);
}
override public function Kill():void{
}
override public function TriangleKill():void{
var _local1:int;
var _local2:Sound;
bDead = true;
_local1 = 0;
while (_local1 < TheBrainGame.pGame.pBullets.length) {
TheBrainGame.pGame.pBullets[_local1].Destroy();
_local1++;
};
_local1 = 0;
while (_local1 < TheBrainGame.pGame.pGuys.length) {
TheBrainGame.pGame.pGuys[_local1].Kill();
_local1++;
};
if (TheBrainGame.pGame.gameMode == TheBrainGame.NORMALMODE){
WebStats.HitStats(WebStats.BEATBOSS2NORMAL);
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
WebStats.HitStats(WebStats.BEATBOSS2EXPERT);
};
};
TheBrainGame.pGame.AddParticleEffect(new BossBoom(x, y));
Boss.pBoss.NextBossStage();
_local2 = new BossDeath();
_local2.play();
}
}
}//package TheBrain.BrainGuys
Section 22
//BossStage3 (TheBrain.BrainGuys.BossStage3)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
import flash.media.*;
public class BossStage3 extends BrainGuy {
public const fBaseRate = 0.02;
public var pSpawnNorms:Array;
private var fGlintWidth:Number;// = 10
private var pParticles:Array;
private var iSpawnDelay:int;// = 10
private var vFirePlane1:Object;
public var fYRads;// = 3.14159265358979
private var fLaserLoopFade:Number;// = -1
private var vFirePlane2:Object;
private var iCurrSpawnIdx:int;// = 0
public var fCurrRate;// = 0.02
public var fXRads;// = 0
private var iFiringFrames:int;// = 0
private var pSuckEffect:SuckEffect;
private var iCurrParticleIdx:int;// = 0
private var pLittleGuys:Array;
private var vFireDir:Vector;
private var fLaserLength:Number;// = 0
public var pEye:BrainEye;
public var pSpawnPositions:Array;
private var bLaserFlash:Boolean;// = false
private var laserLoopChannel:SoundChannel;
public function BossStage3():void{
var _local1:Object;
var _local2:int;
fXRads = 0;
fYRads = Math.PI;
fCurrRate = fBaseRate;
iFiringFrames = 0;
pParticles = new Array();
iCurrParticleIdx = 0;
fLaserLength = 0;
bLaserFlash = false;
vFirePlane1 = new Object();
vFirePlane2 = new Object();
fGlintWidth = 10;
pLittleGuys = new Array();
iSpawnDelay = 10;
fLaserLoopFade = -1;
pSpawnPositions = new Array(new Vector(0, -50), new Vector(-50, 50), new Vector(50, 50));
pSpawnNorms = new Array(new Vector(0, -200), new Vector(-200, 200), new Vector(200, 200));
iCurrSpawnIdx = 0;
super();
uGuyType = BrainGuy.BOSS;
iShotWait = 300;
pEye.SetParentObject(this);
uTotalPointsWorth = 15000;
_local2 = 0;
while (_local2 < (iShotWait / 2)) {
_local1 = new Object();
_local1.vPos = new Vector(0, 0);
_local1.vVel = new Vector(0, 0);
_local1.fDrag = 1;
pParticles.push(_local1);
_local2++;
};
pSuckEffect = new SuckEffect(x, y);
addChild(pSuckEffect);
}
override protected function Fire():void{
var _local1:Sound;
var _local2:Vector;
iFiringFrames = 60;
fLaserLength = 0;
TheBrainGame.pGame.SetShake(60, 2);
_local1 = new LaserLoop();
laserLoopChannel = _local1.play(0, 9999);
TheBrainGame.pGame.Pause(1);
fGlintWidth = 10;
_local2 = new Vector(x, y);
vFireDir = TheBrainGame.pEnergyBall.vPos.subtract(_local2).normalize();
vFirePlane1.vNorm = vFireDir.PerpLH();
vFirePlane1.fDist = Vector.dot(_local2.add(vFirePlane1.vNorm.multiply(50)), vFirePlane1.vNorm);
vFirePlane2.vNorm = vFireDir.PerpRH();
vFirePlane2.fDist = Vector.dot(_local2.add(vFirePlane2.vNorm.multiply(50)), vFirePlane2.vNorm);
}
override public function Update():void{
var _local1:Vector;
var _local2:Number;
var _local3:int;
var _local4:Number;
var _local5:Vector;
var _local6:*;
var _local7:Vector;
var _local8:Vector;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:int;
var _local13:Number;
var _local14:Number;
var _local15:Corey;
if (bDead == true){
return;
};
SetPosition(((Math.sin(fXRads) * 200) + (TheBrainGame.screenWidth * 0.5)), ((Math.sin((fYRads * 2)) * 100) + (TheBrainGame.screenHeight * 0.5)));
pSuckEffect.x = 0;
pSuckEffect.y = 0;
pSuckEffect.visible = true;
if (iShotClock > (iShotWait * 0.75)){
fCurrRate = (fCurrRate - (fBaseRate / (iShotWait * 0.75)));
};
if (iFiringFrames == 0){
fXRads = (fXRads + fCurrRate);
fYRads = (fYRads + fCurrRate);
pEye.Update();
};
TheBrainGame.pGame.pBossParticleLayer.graphics.clear();
TheBrainGame.pGame.pBossParticleLayer.graphics.beginFill(0, 0);
if (Math.abs((iShotClock - iShotWait)) < 5){
TheBrainGame.pGame.pBossParticleLayer.graphics.lineStyle(fGlintWidth, 0xFFFFFF, 1);
TheBrainGame.pGame.pBossParticleLayer.graphics.moveTo(0, y);
TheBrainGame.pGame.pBossParticleLayer.graphics.lineTo(640, y);
fGlintWidth = (fGlintWidth - 2);
};
if (fLaserLoopFade > 0){
if (laserLoopChannel != null){
laserLoopChannel.soundTransform = new SoundTransform(fLaserLoopFade);
};
fLaserLoopFade = (fLaserLoopFade - 0.1);
} else {
if (fLaserLoopFade == 0){
fLaserLoopFade = -1;
if (laserLoopChannel != null){
laserLoopChannel.stop();
};
};
};
if (iFiringFrames > 0){
fCurrRate = fBaseRate;
iFiringFrames--;
pSuckEffect.visible = false;
if (iFiringFrames == 0){
fLaserLoopFade = 1;
};
_local6 = ((bLaserFlash)==true) ? 0 : 0xFFFFFF;
bLaserFlash = !(bLaserFlash);
_local7 = new Vector(x, y);
_local8 = _local7;
_local3 = 0;
while (_local3 < 50) {
TheBrainGame.pGame.pBossParticleLayer.graphics.lineStyle(_local3, _local6, 1);
TheBrainGame.pGame.pBossParticleLayer.graphics.moveTo(_local8.x, _local8.y);
_local8 = _local8.add(vFireDir.multiply(1));
TheBrainGame.pGame.pBossParticleLayer.graphics.lineTo(_local8.x, _local8.y);
_local3++;
};
fLaserLength = Math.min((fLaserLength + 50), 640);
TheBrainGame.pGame.pBossParticleLayer.graphics.lineTo((_local8.x + (vFireDir.x * fLaserLength)), (_local8.y + (vFireDir.y * fLaserLength)));
if (TheBrainGame.pEnergyBall.vPos.subtract(_local7).lengthSq() <= (fLaserLength * fLaserLength)){
_local9 = (Vector.dot(TheBrainGame.pEnergyBall.vPos, vFirePlane1.vNorm) - vFirePlane1.fDist);
_local10 = (Vector.dot(TheBrainGame.pEnergyBall.vPos, vFirePlane2.vNorm) - vFirePlane2.fDist);
if ((((_local9 <= 0)) && ((_local10 <= 0)))){
TheBrainGame.pEnergyBall.RegisterHit(999);
iFiringFrames = 0;
laserLoopChannel.stop();
};
};
};
if ((((iShotWait > 0)) && ((iShotClock >= iShotWait)))){
iShotClock = 0;
Fire();
iCurrParticleIdx = 0;
};
if (iFiringFrames == 0){
iShotClock++;
if ((iShotClock % 2) == 0){
_local11 = ((Math.random() * 2) * Math.PI);
pParticles[iCurrParticleIdx].vPos = vPos.add(new Vector((Math.sin(_local11) * 200), (Math.cos(_local11) * 200)));
pParticles[iCurrParticleIdx].fDrag = 1;
iCurrParticleIdx++;
};
if ((iShotClock % 100) == 0){
_local12 = 25;
_local13 = 0;
_local14 = ((Math.PI * 2) * (1 / _local12));
_local3 = 0;
while (_local3 < _local12) {
Shoot(80, Vector.PointToVector(localToGlobal(pEye.vPos.toPoint())), fSmallBulletScale, new Vector(Math.sin(_local13), Math.cos(_local13)), false, (_local3 == 0));
_local13 = (_local13 + _local14);
_local3++;
};
};
};
_local3 = 0;
while (_local3 < iCurrParticleIdx) {
TheBrainGame.pGame.pBossParticleLayer.graphics.moveTo(pParticles[_local3].vPos.x, pParticles[_local3].vPos.y);
_local1 = vPos.subtract(pParticles[_local3].vPos);
_local2 = _local1.length();
if (_local2 > 0){
_local1 = _local1.divide(_local2);
};
pParticles[_local3].vVel = pParticles[_local3].vVel.add(_local1.multiply(5));
pParticles[_local3].vPos = pParticles[_local3].vPos.add(pParticles[_local3].vVel);
pParticles[_local3].vVel = pParticles[_local3].vVel.multiply(pParticles[_local3].fDrag);
if (_local2 < 50){
pParticles[_local3].fDrag = (pParticles[_local3].fDrag * 0.91);
};
TheBrainGame.pGame.pBossParticleLayer.graphics.lineStyle(2, 0, (_local2 / 300));
TheBrainGame.pGame.pBossParticleLayer.graphics.lineTo(pParticles[_local3].vPos.x, pParticles[_local3].vPos.y);
_local3++;
};
TheBrainGame.pGame.pBossParticleLayer.graphics.endFill();
_local3 = 0;
while (_local3 < pLittleGuys.length) {
if (pLittleGuys[_local3].ShouldDestroy() == true){
pLittleGuys.splice(_local3, 1);
_local3 = Math.max((_local3 - 1), 0);
} else {
_local5 = pLittleGuys[_local3].vPos.subtract(vPos);
_local4 = _local5.lengthSq();
if ((((_local4 < (110 * 110))) && ((_local4 > 0)))){
pLittleGuys[_local3].AccumulateForce(_local5.multiply((2000 / Math.sqrt(_local4))));
};
};
_local3++;
};
if ((((pLittleGuys.length < 3)) && ((iSpawnDelay <= 0)))){
_local15 = new Corey();
_local15.SetPosition((x + pSpawnPositions[iCurrSpawnIdx].x), (y + pSpawnPositions[iCurrSpawnIdx].y));
pLittleGuys.push(_local15);
TheBrainGame.pGame.CreateGuy(_local15, null);
iSpawnDelay = 10;
iCurrSpawnIdx++;
if (iCurrSpawnIdx == pSpawnPositions.length){
iCurrSpawnIdx = 0;
};
};
iSpawnDelay--;
}
override public function Kill():void{
}
override public function TriangleKill():void{
var _local1:int;
var _local2:Sound;
bDead = true;
_local1 = 0;
while (_local1 < TheBrainGame.pGame.pGuys.length) {
TheBrainGame.pGame.pGuys[_local1].Kill();
_local1++;
};
if (TheBrainGame.pGame.gameMode == TheBrainGame.NORMALMODE){
WebStats.HitStats(WebStats.BEATBOSS3NORMAL);
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
WebStats.HitStats(WebStats.BEATBOSS3EXPERT);
};
};
TheBrainGame.pGame.AddParticleEffect(new BossBoom(x, y));
Boss.pBoss.NextBossStage();
if (laserLoopChannel != null){
laserLoopChannel.stop();
};
_local2 = new BossDeath();
_local2.play();
}
}
}//package TheBrain.BrainGuys
Section 23
//BossStage4 (TheBrain.BrainGuys.BossStage4)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
import flash.media.*;
import flash.net.*;
public class BossStage4 extends BrainGuy {
public const fBaseRate = 0.03;
private var iFireIdx:int;// = 1
private var bChargeForFire:Boolean;// = false
private var bLineFlash:Boolean;// = false
public var fYRads;// = 3.14159265358979
public var fCurrRate;// = 0.03
private var fNonWiggleShotRad:Number;// = 0
public var fXRads;// = 0
private var iCoolDownFrames:int;// = 0
private var bWiggleShoot:Boolean;// = true
private var iNonWiggleShotClock:int;// = 0
private var bReturnToCenter:Boolean;// = false
private var fWiggleMoveRad:Number;// = 0
private var pRightArmPos:Array;
private var iWiggleAttackFrames:int;// = 0
private var pSuckEffect:SuckEffect;
private var pGuys:Array;
private var fLaserLength:Number;// = 0
private var vNonWiggleShotDir:Vector;
private var bSwapFireIdxDir:Boolean;// = false
private var iWiggleWait:int;// = 600
public var pEye:BrainEye;
private var iNonWiggleShotWait:int;// = 3
private var pLeftArmPos:Array;
var iModOffset:int;// = 0
private var fArmWiggleOffset:Number;// = 0
var iLastWiggleFrame:int;// = 0
private var laserLoopChannel:SoundChannel;// = null
public function BossStage4():void{
var _local1:Object;
var _local2:Object;
var _local3:int;
pLeftArmPos = new Array();
pRightArmPos = new Array();
bLineFlash = false;
fArmWiggleOffset = 0;
bWiggleShoot = true;
iWiggleAttackFrames = 0;
fLaserLength = 0;
fWiggleMoveRad = 0;
iWiggleWait = 600;
iNonWiggleShotWait = 3;
iNonWiggleShotClock = 0;
vNonWiggleShotDir = new Vector(0, 0);
fNonWiggleShotRad = 0;
iCoolDownFrames = 0;
bChargeForFire = false;
pGuys = new Array();
bReturnToCenter = false;
laserLoopChannel = null;
fXRads = 0;
fYRads = Math.PI;
fCurrRate = fBaseRate;
iModOffset = 0;
iLastWiggleFrame = 0;
iFireIdx = 1;
bSwapFireIdxDir = false;
super();
uGuyType = BrainGuy.BOSS;
_local3 = 0;
while (_local3 < 30) {
_local1 = new Object();
_local1.vPos = new Vector((_local3 * 10), 0);
pLeftArmPos.push(_local1);
_local2 = new Object();
_local2.vPos = new Vector((_local3 * -10), 0);
pRightArmPos.push(_local2);
_local3++;
};
pEye.SetParentObject(this);
uTotalPointsWorth = 250000;
iShotWait = 10;
pSuckEffect = new SuckEffect(x, y);
addChild(pSuckEffect);
}
override protected function Fire():void{
}
override public function Update():void{
var _local1:int;
var _local2:Fatty;
var _local3:Sound;
var _local4:int;
var _local5:Vector;
var _local6:Vector;
var _local7:Vector;
var _local8:int;
var _local9:Number;
var _local10:Vector;
var _local11:Number;
if (bDead == true){
return;
};
TheBrainGame.pGame.pBossParticleLayer.graphics.clear();
iLastWiggleFrame = iWiggleAttackFrames;
pSuckEffect.visible = false;
if ((((pGuys.length == 0)) && ((iCoolDownFrames > 0)))){
_local2 = new Fatty();
_local2.SetPosition(0, 0);
TheBrainGame.pGame.CreateGuy(_local2, null);
pGuys.push(_local2);
_local2 = new Fatty();
_local2.SetPosition(640, 0);
TheBrainGame.pGame.CreateGuy(_local2, null);
pGuys.push(_local2);
_local2 = new Fatty();
_local2.SetPosition(0, 480);
TheBrainGame.pGame.CreateGuy(_local2, null);
pGuys.push(_local2);
_local2 = new Fatty();
_local2.SetPosition(640, 480);
TheBrainGame.pGame.CreateGuy(_local2, null);
pGuys.push(_local2);
};
_local1 = 0;
while (_local1 < pGuys.length) {
if (pGuys[_local1].ShouldDestroy() == true){
pGuys.splice(_local1, 1);
_local1 = Math.max((_local1 - 1), 0);
};
_local1++;
};
if (iCoolDownFrames <= 0){
if (iWiggleAttackFrames == 450){
_local3 = new LaserLoop();
laserLoopChannel = _local3.play(0, 9999);
};
iWiggleAttackFrames--;
};
if ((iWiggleAttackFrames - 1) == 0){
iWiggleAttackFrames = 0;
iCoolDownFrames = 180;
if (laserLoopChannel != null){
laserLoopChannel.stop();
};
};
if ((((iCoolDownFrames <= 0)) && ((iWiggleAttackFrames > 0)))){
_local1 = 0;
while (_local1 < pGuys.length) {
pGuys[_local1].Kill();
_local1++;
};
bChargeForFire = false;
bWiggleShoot = false;
iShotClock++;
if ((((iShotWait > 0)) && ((iShotClock >= iShotWait)))){
iShotClock = 0;
Fire();
bWiggleShoot = true;
};
if (bWiggleShoot == true){
iModOffset = ((iModOffset)==0) ? 1 : 0;
};
SetPosition(((TheBrainGame.screenWidth * 0.5) + (Math.sin(fWiggleMoveRad) * 50)), 50);
fArmWiggleOffset = (fArmWiggleOffset + 0.2);
bLineFlash = !(bLineFlash);
if (bSwapFireIdxDir == true){
iFireIdx = (iFireIdx - 2);
} else {
iFireIdx = (iFireIdx + 2);
};
if (iFireIdx >= pLeftArmPos.length){
iFireIdx = (pLeftArmPos.length - 1);
bSwapFireIdxDir = true;
} else {
if (iFireIdx <= 0){
iFireIdx = 1;
bSwapFireIdxDir = false;
};
};
WiggleArmFire(pLeftArmPos, 1.25);
WiggleArmFire(pRightArmPos, 1.25);
_local4 = ((bLineFlash)==true) ? 0 : 0xFFFFFF;
_local5 = Vector.PointToVector(localToGlobal(pEye.vPos.toPoint()));
_local6 = _local5;
_local7 = new Vector(0, 1);
_local1 = 0;
while (_local1 < 50) {
TheBrainGame.pGame.pBossParticleLayer.graphics.lineStyle(_local1, _local4, 1);
TheBrainGame.pGame.pBossParticleLayer.graphics.moveTo(_local6.x, _local6.y);
_local6 = _local6.add(_local7.multiply(1));
TheBrainGame.pGame.pBossParticleLayer.graphics.lineTo(_local6.x, _local6.y);
_local1++;
};
fLaserLength = Math.min((fLaserLength + 50), 640);
TheBrainGame.pGame.pBossParticleLayer.graphics.lineTo(_local6.x, (_local6.y + fLaserLength));
if (Math.abs((TheBrainGame.pEnergyBall.vPos.x - _local5.x)) <= 50){
TheBrainGame.pEnergyBall.RegisterHit(999);
iWiggleAttackFrames = 5;
};
TheBrainGame.pGame.pBossParticleLayer.graphics.endFill();
fWiggleMoveRad = (fWiggleMoveRad + 0.1);
TheBrainGame.pGame.SetShake(1, 1);
} else {
if (iCoolDownFrames <= 0){
iWiggleWait--;
_local8 = Math.round((Math.random() * 100));
if ((((iWiggleWait < 0)) && ((_local8 == 50)))){
iWiggleAttackFrames = 450;
iWiggleWait = 600;
iCoolDownFrames = 180;
bChargeForFire = true;
bReturnToCenter = true;
fXRads = (fYRads = 0);
} else {
SetPosition(((Math.sin(fXRads) * 200) + (TheBrainGame.screenWidth * 0.5)), ((Math.sin((fYRads * 2)) * 100) + (TheBrainGame.screenHeight * 0.5)));
fXRads = (fXRads + fCurrRate);
fYRads = (fYRads + fCurrRate);
pEye.Update();
iNonWiggleShotClock++;
if ((((iNonWiggleShotWait > 0)) && ((iNonWiggleShotClock >= iNonWiggleShotWait)))){
iNonWiggleShotClock = 0;
vNonWiggleShotDir.x = Math.sin(fNonWiggleShotRad);
vNonWiggleShotDir.y = Math.cos(fNonWiggleShotRad);
fNonWiggleShotRad = (fNonWiggleShotRad - 0.1);
_local9 = 0;
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
_local9 = 25;
} else {
_local9 = 50;
};
Shoot(_local9, new Vector(x, y), fSmallBulletScale, vNonWiggleShotDir, false, false);
Shoot(_local9, new Vector(x, y), fSmallBulletScale, vNonWiggleShotDir.multiply(-1), false, false);
Shoot(_local9, new Vector(x, y), fSmallBulletScale, vNonWiggleShotDir.PerpLH(), false, false);
Shoot(_local9, new Vector(x, y), fSmallBulletScale, vNonWiggleShotDir.PerpRH(), false, false);
};
};
} else {
if (bChargeForFire == true){
if (bReturnToCenter == true){
_local10 = vPos.subtract(new Vector((TheBrainGame.screenWidth * 0.5), (TheBrainGame.screenHeight * 0.5)));
_local11 = _local10.length();
if (_local11 <= 5){
bReturnToCenter = false;
} else {
_local10 = _local10.divide(_local11);
SetPosition((vPos.x - (_local10.x * 2)), (vPos.y - (_local10.y * 2)));
};
} else {
if (y >= 50){
iCoolDownFrames--;
SetPosition((TheBrainGame.screenWidth * 0.5), (y - 1));
pSuckEffect.visible = true;
};
};
} else {
iCoolDownFrames--;
if (y <= (TheBrainGame.screenHeight * 0.5)){
SetPosition((TheBrainGame.screenWidth * 0.5), (y + 1));
};
if (laserLoopChannel != null){
laserLoopChannel.stop();
laserLoopChannel = null;
};
};
};
};
}
override public function Kill():void{
}
override public function TriangleKill():void{
var _local1:int;
var _local2:Sound;
bDead = true;
_local1 = 0;
while (_local1 < TheBrainGame.pGame.pGuys.length) {
TheBrainGame.pGame.pGuys[_local1].Kill();
_local1++;
};
_local1 = 0;
while (_local1 < TheBrainGame.pGame.pBullets.length) {
TheBrainGame.pGame.pBullets[_local1].Destroy();
_local1++;
};
if (TheBrainGame.pGame.gameMode == TheBrainGame.NORMALMODE){
WebStats.HitStats(WebStats.BEATNORMALSTAT);
SharedObject.getLocal("greymatter_local").data.bBossUnlocked = true;
WebStats.SubmitScore(WebStats.NORMALLEADERBOARD, TheBrainGame.pGame.pScore.GetScore());
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
WebStats.HitStats(WebStats.BEATEXPERTSTAT);
SharedObject.getLocal("greymatter_local").data.bEndlessUnlocked = true;
WebStats.SubmitScore(WebStats.EXPERTLEADERBOARD, TheBrainGame.pGame.pScore.GetScore());
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.BOSSMODE){
SharedObject.getLocal("greymatter_local").data.bExpertUnlocked = true;
WebStats.SubmitScore(WebStats.BOSSLEADERBOARD, Boss.pBoss.iCurrTime);
};
};
};
Boss.pBoss.NextBossStage();
TheBrainGame.pGame.AddParticleEffect(new BossBoom(x, y));
if (laserLoopChannel != null){
laserLoopChannel.stop();
};
_local2 = new BossDying();
_local2.play();
}
private function WiggleArmFire(_arg1:Array, _arg2:Number):void{
var _local3:int;
var _local4:Vector;
var _local5:Vector;
var _local6:Vector;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
_local3 = ((bLineFlash)==true) ? 0 : 0xFFFFFF;
_local4 = new Vector(vPos.x, vPos.y);
_local5 = pLeftArmPos[0].vPos.add(_local4);
_local7 = 10;
_local8 = (_local7 / _arg1.length);
_local9 = 10;
TheBrainGame.pGame.pSpermBullets.graphics.moveTo(_local5.x, _local5.y);
_local10 = 1;
while (_local10 < _arg1.length) {
_local7 = (_local7 - _local8);
TheBrainGame.pGame.pSpermBullets.graphics.lineStyle(_local7, _local3, 1);
_local6 = new Vector((_arg1[_local10].vPos.x * _arg2), _arg1[_local10].vPos.y);
_local6 = _local6.add(new Vector(0, (Math.sin(((_local7 + fArmWiggleOffset) * 2)) * _local9)));
_local6 = _local6.add(_local4);
TheBrainGame.pGame.pSpermBullets.graphics.lineTo(_local6.x, _local6.y);
_local9 = (_local9 * 0.99);
if ((((bWiggleShoot == true)) && (((_local10 % 3) == 0)))){
Shoot(100, new Vector(_local6.x, 50), fSmallBulletScale, new Vector(0, 1), false, false);
};
_local10++;
};
}
}
}//package TheBrain.BrainGuys
Section 24
//BrainGuy (TheBrain.BrainGuys.BrainGuy)
package TheBrain.BrainGuys {
import TheBrain.*;
import flash.geom.*;
import flash.display.*;
import TheBrain.ParticleEffects.*;
import TheBrain.Bullets.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
import flash.media.*;
public class BrainGuy extends WorldObject {
public const fSmallBulletScale:Number = 1.5;
public const fLargeBulletScale:Number = 3;
public var pBitmapData:BitmapData;// = null
protected var fEnemyOverlapRadius:Number;// = 0
protected var uTotalPointsWorth:uint;// = 100
protected var bSlowRotation:Boolean;// = true
protected var fMagnitude:Number;// = 100
public var bAllowedOffScreen:Boolean;// = true
protected var uNumBrainsKilled:uint;// = 0
protected var bFlash:Boolean;// = false
protected var bMoveOnlyWhenFacing:Boolean;// = true
public var bStationary:Boolean;// = false
protected var iShotClock:uint;// = 0
private var pBrains:Array;
protected var uGuyType:uint;// = 0
private var pTeeth:Array;
protected var fRotationRate:Number;// = 2
protected var iShotWait:uint;// = 60
protected var fEnergyDiffLen:Number;
protected var bCanFire:Boolean;// = true
protected var bJustAppeared:Boolean;// = true
private var pBones:Array;
protected var vEnergyDiff:Vector;
protected var bDead:Boolean;// = false
public static const SPERM:uint = 6;
public static const CRAIG:uint = 8;
public static const RANDAL:uint = 9;
public static const TELEPORTER:uint = 7;
public static const COREY:uint = 1;
public static const DANIEL:uint = 4;
public static const JAMES:uint = 3;
public static const JORDAN:uint = 5;
public static const BOSS:uint = 99;
public static const STANLEY:uint = 9;
public static const PETEY:uint = 0;
public static const FATTY:uint = 2;
public static var pExplosionSound:Sound = null;
public static var pShotSound:Sound = null;
public function BrainGuy():void{
var _local1:Number;
fEnemyOverlapRadius = 0;
bDead = false;
pBrains = new Array();
pBones = new Array();
pTeeth = new Array();
uNumBrainsKilled = 0;
fMagnitude = 100;
bAllowedOffScreen = true;
iShotWait = 60;
iShotClock = 0;
bFlash = false;
bCanFire = true;
bSlowRotation = true;
bMoveOnlyWhenFacing = true;
fRotationRate = 2;
uGuyType = 0;
bStationary = false;
uTotalPointsWorth = 100;
pBitmapData = null;
bJustAppeared = true;
super();
AutoRegisterParts();
_local1 = 0.5;
fEnemyOverlapRadius = ((Math.max(width, height) * 0.5) * _local1);
scaleX = _local1;
scaleY = _local1;
if (pShotSound == null){
pShotSound = new ShotSound1();
pExplosionSound = new DeathExplosionSound();
};
}
public function RegisterBone(_arg1:WorldObject):void{
}
public function ConvertRotation(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
_local2 = rotation;
rotation = Math.round(_arg1);
_local3 = rotation;
rotation = _local2;
return (_local3);
}
public function TestBrainCollision():void{
var _local1:int;
var _local2:Point;
if (pBrains.length == 0){
TheBrainGame.pGame.AddScore(uTotalPointsWorth, this);
Kill();
return;
};
_local1 = 0;
while (_local1 < pBrains.length) {
if ((((pBrains[_local1].visible == true)) && ((TheBrainGame.pEnergyBall.IsObjectCollidingWithObject(pBrains[_local1]) == true)))){
pBrains[_local1].visible = false;
uNumBrainsKilled++;
_local2 = localToGlobal(pBrains[_local1].vPos.toPoint());
if (pBrains.length > 1){
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(_local2.x, _local2.y));
};
pBrains[_local1].RegisterHit();
if (uNumBrainsKilled == pBrains.length){
TheBrainGame.pGame.AddScore(uTotalPointsWorth, this);
Kill();
break;
};
};
_local1++;
};
}
public function IsOverlappingEnemy(_arg1:BrainGuy):Boolean{
var _local2:Number;
_local2 = _arg1.vPos.subtract(vPos).lengthSq();
return ((_local2 <= Math.pow((fEnemyOverlapRadius + _arg1.GetEnemyOverlapRadius()), 2)));
}
protected function Fire():void{
}
public function DeadUpdate():void{
}
private function AutoRegisterParts():void{
var _local1:int;
var _local2:BrainGuyPart;
_local1 = 0;
while (_local1 < numChildren) {
if ((getChildAt(_local1) is BrainGuyPart)){
_local2 = BrainGuyPart(getChildAt(_local1));
switch (_local2.uType){
case BrainGuyPart.BRAIN:
RegisterBrain(_local2);
break;
case BrainGuyPart.BONE:
RegisterBone(_local2);
break;
case BrainGuyPart.TOOTH:
RegisterTooth(_local2);
break;
};
};
_local1++;
};
}
public function GetPointsWorth():uint{
return (uTotalPointsWorth);
}
override public function IsOnScreen():Boolean{
var _local1:int;
var _local2:int;
if (stage == null){
return (false);
};
_local1 = (stage.stageWidth - 50);
_local2 = (stage.stageHeight - 50);
return ((((((x > 50)) && ((x < _local1)))) && ((((y > 50)) && ((y < _local2))))));
}
public function GetEnemyOverlapRadius():Number{
return (fEnemyOverlapRadius);
}
override public function Update():void{
var _local1:Vector;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Boolean;
var _local8:*;
var _local9:*;
var _local10:Number;
var _local11:Number;
var _local12:Number;
if (bJustAppeared == true){
TheBrainGame.pGame.AddParticleEffect(new AppearEffect(x, y));
bJustAppeared = false;
};
if (bDead == false){
super.Update();
vEnergyDiff = TheBrainGame.pEnergyBall.vPos.subtract(vPos);
fEnergyDiffLen = vEnergyDiff.length();
if (fEnergyDiffLen > 0){
vEnergyDiff = vEnergyDiff.divide(fEnergyDiffLen);
};
_local1 = vVelocity.normalize();
_local2 = ((Math.atan2(vEnergyDiff.y, vEnergyDiff.x) * (180 / Math.PI)) - 90);
_local2 = ConvertRotation(_local2);
_local3 = (rotation * (Math.PI / 180));
_local4 = (_local2 * (Math.PI / 180));
_local5 = 0;
_local6 = Vector.dot(new Vector(Math.sin(_local3), Math.cos(_local3)), new Vector(Math.sin(_local4), Math.cos(_local4)));
_local5 = ConvertRotation((Math.acos(_local6) * (180 / Math.PI)));
if (ConvertRotation((rotation + _local5)) == _local2){
rotation = (rotation + fRotationRate);
} else {
if (ConvertRotation((rotation - _local5)) == _local2){
rotation = (rotation - fRotationRate);
};
};
_local7 = false;
if ((((_local5 <= 5)) && ((fRotationRate > 0)))){
rotation = _local2;
_local7 = (bCanFire = true);
} else {
bCanFire = false;
if (bMoveOnlyWhenFacing == true){
_local7 = false;
};
};
if (IsOnScreen() == true){
if ((((((bSlowRotation == false)) || ((_local7 == true)))) || ((bMoveOnlyWhenFacing == false)))){
AccumulateForce(vEnergyDiff.multiply(fMagnitude));
};
bAllowedOffScreen = false;
} else {
if (bAllowedOffScreen == true){
_local8 = vWorldCenter.subtract(vPos).normalize();
AccumulateForce(_local8.multiply(500));
rotation = _local2;
} else {
if (x < 50){
SetPosition(55, y);
AccumulateForce(new Vector((vNetForce.x * -1.01), vNetForce.y));
} else {
if (x > (TheBrainGame.screenWidth - 50)){
ResetPhysics((TheBrainGame.screenWidth - 55), y);
AccumulateForce(new Vector((vNetForce.x * -1.01), vNetForce.y));
};
};
if (y < 50){
ResetPhysics(x, 55);
AccumulateForce(new Vector(vNetForce.x, (vNetForce.y * -1.01)));
} else {
if (y > (TheBrainGame.screenHeight - 50)){
ResetPhysics(x, (TheBrainGame.screenHeight - 55));
AccumulateForce(new Vector(vNetForce.x, (vNetForce.y * -1.01)));
};
};
};
};
if ((((((iShotWait > 0)) && ((iShotClock >= iShotWait)))) && ((bAllowedOffScreen == false)))){
iShotClock = 0;
Fire();
};
if ((((iShotWait > 0)) && (((iShotClock / iShotWait) > 0.75)))){
_local9 = ((bFlash)==true) ? 0.6 : 0.8;
_local10 = 2;
_local11 = ((bFlash)==true) ? 2 : 0;
_local12 = 1;
bFlash = !(bFlash);
transform.colorTransform = new ColorTransform(_local9, _local9, _local9);
} else {
transform.colorTransform = new ColorTransform();
};
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
iShotClock = (iShotClock + 2);
} else {
iShotClock++;
};
TestBrainCollision();
TestBoneCollision();
TestTeethCollision();
} else {
DeadUpdate();
};
}
public function BoneCollisionReaction(_arg1:BaseBone):void{
var _local2:Vector;
var _local3:Vector;
var _local4:Vector;
var _local5:Number;
var _local6:Number;
var _local7:Vector;
}
public function TestBoneCollision():void{
var _local1:Number;
var _local2:BaseBone;
var _local3:*;
var _local4:uint;
var _local5:*;
return;
}
public function GetType():uint{
return (uGuyType);
}
public function Kill():void{
TheBrainGame.pEnergyBall.AddToSpringStrength(10);
TheBrainGame.pGame.pBGEffects.AddExplosion(x, y);
Destroy();
}
public function TriangleKill():void{
Kill();
}
public function RegisterTooth(_arg1:WorldObject):void{
pTeeth.push(_arg1);
}
public function TestTeethCollision():void{
var _local1:int;
var _local2:Point;
_local1 = 0;
while (_local1 < pTeeth.length) {
_local2 = localToGlobal(pTeeth[_local1].vPos.subtract(new Vector((pTeeth[_local1].width * 0.5), (pTeeth[_local1].height * 0.5))).toPoint());
if (TheBrainGame.pEnergyBall.IsObjectCollidingWithObject(pTeeth[_local1]) == true){
TheBrainGame.pEnergyBall.RegisterHit(1);
};
_local1++;
};
}
public function RegisterBrain(_arg1:WorldObject):void{
pBrains.push(_arg1);
}
protected function Shoot(_arg1:Number, _arg2:Vector, _arg3:Number, _arg4:Vector=null, _arg5:Boolean=false, _arg6:Boolean=true):void{
var _local7:Bullet;
var _local8:SoundChannel;
if (bCanFire == false){
return;
};
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
_arg1 = (_arg1 * 1.5);
};
_local7 = new Bullet(_arg5);
if (_arg4 == null){
_local7.vVelocity = TheBrainGame.pEnergyBall.vPos.subtract(_arg2).normalize().multiply(_arg1);
} else {
_local7.vVelocity = _arg4.multiply(_arg1);
};
_local7.scaleX = _arg3;
_local7.scaleY = _arg3;
_local7.SetPosition(_arg2.x, _arg2.y);
TheBrainGame.pGame.AddBullet(_local7);
if (_arg6 == true){
_local8 = pShotSound.play();
if (_local8 != null){
_local8.soundTransform = new SoundTransform(0.5);
};
};
}
}
}//package TheBrain.BrainGuys
Section 25
//Corey (TheBrain.BrainGuys.Corey)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
public class Corey extends BrainGuy {
public var pEye:SmallBrainEye;
public function Corey():void{
pEye.SetParentObject(this);
fKineticFriction = 0.1;
uGuyType = COREY;
fMagnitude = 100;
bMoveOnlyWhenFacing = false;
}
override protected function Fire():void{
Shoot(200, Vector.PointToVector(localToGlobal(pEye.vPos.toPoint())), fSmallBulletScale);
}
override public function Update():void{
super.Update();
pEye.Update();
if (fEnergyDiffLen < 100){
fMagnitude = -250;
} else {
fMagnitude = 150;
};
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 26
//Craig (TheBrain.BrainGuys.Craig)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
public class Craig extends BrainGuy {
public var pEastBrain:LittleBrain;
public var pNorthSpine1:SpinePart;
public var pEastSpine1:SpinePart;
public var pEastSpine2:SpinePart;
public var pNorthSpine2:SpinePart;
public var pWestSpine1:SpinePart;
public var pWestSpine2:SpinePart;
public var pNorthBrain:LittleBrain;
public var pEye:BrainEye;
public var pSouthBrain:LittleBrain;
public var pSouthSpine1:SpinePart;
public var pSouthSpine2:SpinePart;
public var pWestBrain:LittleBrain;
public function Craig():void{
pEye.SetParentObject(this);
fKineticFriction = 0.1;
uGuyType = CRAIG;
fMagnitude = 0;
iShotWait = 100;
}
override protected function Fire():void{
Shoot(200, Vector.PointToVector(localToGlobal(pEye.vPos.toPoint())), fLargeBulletScale);
pEye.gotoAndPlay("fire");
}
override public function Update():void{
super.Update();
pEye.Update();
if (fEnergyDiffLen < 100){
fMagnitude = -150;
} else {
fMagnitude = 75;
};
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 27
//Daniel (TheBrain.BrainGuys.Daniel)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
public class Daniel extends BrainGuy {
public var pLeftEye:SmallBrainEye;
public var pRightEye:SmallBrainEye;
public function Daniel():void{
pLeftEye.SetParentObject(this);
pRightEye.SetParentObject(this);
fKineticFriction = 0.1;
fMagnitude = 500;
iShotWait = 0;
uGuyType = DANIEL;
}
override public function Update():void{
super.Update();
pLeftEye.Update();
pRightEye.Update();
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 28
//Fatty (TheBrain.BrainGuys.Fatty)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
public class Fatty extends BrainGuy {
public var pEye:SmallBrainEye;
public function Fatty():void{
pEye.SetParentObject(this);
fKineticFriction = 0.1;
uGuyType = FATTY;
fMagnitude = 100;
uTotalPointsWorth = 125;
bMoveOnlyWhenFacing = false;
}
override protected function Fire():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:int;
_local1 = 10;
_local2 = 0;
_local3 = ((Math.PI * 2) * (1 / _local1));
_local4 = 0;
while (_local4 < _local1) {
Shoot(200, Vector.PointToVector(localToGlobal(pEye.vPos.toPoint())), fSmallBulletScale, new Vector(Math.sin(_local2), Math.cos(_local2)), false, (_local4 == 0));
_local2 = (_local2 + _local3);
_local4++;
};
}
override public function Update():void{
super.Update();
pEye.Update();
if (fEnergyDiffLen < 100){
fMagnitude = -75;
} else {
fMagnitude = 75;
};
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 29
//James (TheBrain.BrainGuys.James)
package TheBrain.BrainGuys {
import TheBrain.*;
import flash.geom.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
import flash.media.*;
public class James extends BrainGuy {
var vEyePoint:Vector;
var pWallEffect:LaserWallHit;// = null
public var pEye:BeamEye;
var uCounter:uint;// = 0
var bDeadlyLastFrame:Boolean;// = false
var bLaserFlash:Boolean;// = false
var vFireDiff:Vector;
public function James():void{
vFireDiff = new Vector(0, 0);
vEyePoint = new Vector(0, 0);
pWallEffect = null;
bDeadlyLastFrame = false;
uCounter = 0;
bLaserFlash = false;
super();
pEye.SetParentObject(this);
fKineticFriction = 0.1;
fMagnitude = 100;
iShotWait = 120;
uGuyType = JAMES;
uTotalPointsWorth = 300;
}
override protected function Fire():void{
var _local1:Sound;
pEye.gotoAndPlay("fire");
vEyePoint = Vector.PointToVector(localToGlobal(new Point(pEye.x, pEye.y)));
vFireDiff = TheBrainGame.pEnergyBall.vPos.subtract(vEyePoint).normalize();
_local1 = new SmallLaserSound();
_local1.play();
}
override public function Update():void{
var _local1:Number;
var _local2:Vector;
var _local3:Number;
var _local4:int;
var _local5:Vector;
var _local6:Vector;
var _local7:Vector;
super.Update();
if (pEye.bFiring == false){
pEye.Update();
fRotationRate = 2;
} else {
fRotationRate = 0;
_local4 = ((bLaserFlash)==true) ? 0 : 0xFFFFFF;
bLaserFlash = !(bLaserFlash);
_local5 = Vector.PointToVector(localToGlobal(new Point(pEye.x, pEye.y)));
TheBrainGame.pGame.pLaserLayer.graphics.lineStyle(2.5, _local4, 1);
TheBrainGame.pGame.pLaserLayer.graphics.moveTo(_local5.x, _local5.y);
TheBrainGame.pGame.pLaserLayer.graphics.lineTo((_local5.x + (vFireDiff.x * 640)), (_local5.y + (vFireDiff.y * 640)));
};
if (pEye.bDeadly == true){
bDeadlyLastFrame = true;
_local6 = Vector.PointToVector(localToGlobal(new Point(pEye.x, pEye.y)));
_local7 = TheBrainGame.pEnergyBall.vPos.subtract(_local6).normalize();
if (Vector.dot(_local7, vFireDiff) >= 0.999){
TheBrainGame.pEnergyBall.RegisterHit(1);
uCounter++;
};
} else {
bDeadlyLastFrame = false;
};
_local1 = 180;
_local2 = vWorldCenter.subtract(vPos);
_local3 = _local2.length();
if (_local3 < _local1){
_local2 = _local2.multiply(((_local1 - _local3) / _local3));
vPos = vPos.subtract(_local2);
ResetPhysics(vPos.x, vPos.y);
};
}
override public function Kill():void{
super.Kill();
if (pWallEffect != null){
pWallEffect.Destroy();
};
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 30
//Jordan (TheBrain.BrainGuys.Jordan)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
public class Jordan extends BrainGuy {
var iBulletsShot:int;// = 0
public var pEye:BrainEye;
public function Jordan():void{
iBulletsShot = 0;
super();
pEye.SetParentObject(this);
fKineticFriction = 0.05;
fMagnitude = 200;
iShotWait = 50;
uGuyType = JORDAN;
}
override protected function Fire():void{
Shoot(400, Vector.PointToVector(localToGlobal(pEye.vPos.toPoint())), fSmallBulletScale);
iBulletsShot++;
if (iBulletsShot < 10){
iShotWait = 2;
} else {
iShotWait = 50;
iBulletsShot = 0;
};
}
override public function Update():void{
super.Update();
pEye.Update();
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 31
//Petey (TheBrain.BrainGuys.Petey)
package TheBrain.BrainGuys {
import TheBrain.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
public class Petey extends BrainGuy {
public var pEye:SmallBrainEye;
public function Petey():void{
pEye.SetParentObject(this);
fKineticFriction = 0.1;
uGuyType = PETEY;
fMagnitude = 100;
bMoveOnlyWhenFacing = false;
}
override protected function Fire():void{
Shoot(200, Vector.PointToVector(localToGlobal(pEye.vPos.toPoint())), fSmallBulletScale);
}
override public function Update():void{
super.Update();
pEye.Update();
if (fEnergyDiffLen < 100){
fMagnitude = -100;
} else {
fMagnitude = 100;
};
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 32
//Randal (TheBrain.BrainGuys.Randal)
package TheBrain.BrainGuys {
import TheBrain.*;
import flash.geom.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
public class Randal extends BrainGuy {
var vEyePoint:Vector;
var pWallEffect:LaserWallHit;// = null
public var pEye:BeamEye;
var bDeadlyLastFrame:Boolean;// = false
var vFireDiff:Vector;
public function Randal():void{
vFireDiff = new Vector(0, 0);
vEyePoint = new Vector(0, 0);
pWallEffect = null;
bDeadlyLastFrame = false;
super();
pEye.SetParentObject(this);
fKineticFriction = 0.01;
fMagnitude = 20;
iShotWait = 120;
uGuyType = RANDAL;
}
override protected function Fire():void{
pEye.gotoAndPlay("fire");
vEyePoint = Vector.PointToVector(localToGlobal(new Point(pEye.x, pEye.y)));
vFireDiff = TheBrainGame.pEnergyBall.vPos.subtract(vEyePoint).normalize();
pWallEffect = new LaserWallHit();
TheBrainGame.pGame.AddParticleEffect(pWallEffect);
pWallEffect.visible = false;
}
override public function Update():void{
var _local1:Number;
var _local2:Vector;
var _local3:Number;
var _local4:Vector;
var _local5:Vector;
var _local6:*;
super.Update();
if (pEye.bFiring == false){
pEye.Update();
};
if ((((bDeadlyLastFrame == true)) && ((pEye.bDeadly == false)))){
pWallEffect.Destroy();
pWallEffect.visible = false;
};
if (pEye.bDeadly == true){
bDeadlyLastFrame = true;
_local4 = Vector.PointToVector(localToGlobal(new Point(pEye.x, pEye.y)));
_local5 = TheBrainGame.pEnergyBall.vPos.subtract(_local4).normalize();
if (Vector.dot(_local5, vFireDiff) > 0.99){
} else {
_local6 = (0.05 * 1);
pEye.rotation = (pEye.rotation + ((_local6 * 180) / Math.PI));
vFireDiff = vFireDiff.add(new Vector(Math.cos(_local6), Math.sin(_local6)));
};
} else {
bDeadlyLastFrame = false;
};
_local1 = 200;
_local2 = vWorldCenter.subtract(vPos);
_local3 = _local2.length();
if (_local3 < _local1){
_local2 = _local2.multiply(((_local1 - _local3) / _local3));
vPos = vPos.subtract(_local2);
ResetPhysics(vPos.x, vPos.y);
};
}
override public function Kill():void{
super.Kill();
if (pWallEffect != null){
pWallEffect.Destroy();
};
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 33
//Sperm (TheBrain.BrainGuys.Sperm)
package TheBrain.BrainGuys {
import TheBrain.*;
import flash.geom.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
import flash.media.*;
public class Sperm extends BrainGuy {
private var pSpermChannel:SoundChannel;
private var bInitial:Boolean;// = true
private var bTailFlash:Boolean;
public var pTailStart:SpinePart;
private var vDirection:Vector;
private var uCounter:uint;// = 0
private var fRad:Number;// = 0
private var pPositions:Array;
public function Sperm():void{
var _local1:Sound;
pPositions = new Array();
bInitial = true;
uCounter = 0;
fRad = 0;
super();
fKineticFriction = 0.1;
uGuyType = SPERM;
fMagnitude = 200;
iShotWait = 100;
uTotalPointsWorth = 150;
bSlowRotation = false;
_local1 = new SpermSound();
pSpermChannel = _local1.play(0, 999999);
pSpermChannel.soundTransform = new SoundTransform(0.2);
}
override protected function Fire():void{
}
override public function Update():void{
var _local1:Number;
var _local2:Vector;
var _local3:Vector;
var _local4:int;
var _local5:*;
var _local6:Vector;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:*;
var _local11:int;
if (bJustAppeared == true){
TheBrainGame.pGame.AddParticleEffect(new AppearEffect(x, y));
bJustAppeared = false;
};
_local1 = 0;
if (bShouldDestroy == true){
return;
};
vEnergyDiff = TheBrainGame.pEnergyBall.vPos.subtract(vPos);
fEnergyDiffLen = vEnergyDiff.length();
if (IsOnScreen() == true){
if (bAllowedOffScreen == true){
_local1 = ((Math.random() * 2) * Math.PI);
vDirection = new Vector((Math.sin(_local1) * 200), (Math.cos(_local1) * 200));
};
AccumulateForce(vDirection);
bAllowedOffScreen = false;
} else {
if (bAllowedOffScreen == true){
_local5 = vWorldCenter.subtract(vPos).normalize();
AccumulateForce(_local5.multiply(500));
} else {
if (bAllowedOffScreen == false){
if (x < 50){
SetPosition(55, y);
AccumulateForce(new Vector((vNetForce.x * -1.01), vNetForce.y));
} else {
if (x > (TheBrainGame.screenWidth - 50)){
ResetPhysics((TheBrainGame.screenWidth - 55), y);
AccumulateForce(new Vector((vNetForce.x * -1.01), vNetForce.y));
};
};
if (y < 50){
ResetPhysics(x, 55);
AccumulateForce(new Vector(vNetForce.x, (vNetForce.y * -1.01)));
} else {
if (y > (TheBrainGame.screenHeight - 50)){
ResetPhysics(x, (TheBrainGame.screenHeight - 55));
AccumulateForce(new Vector(vNetForce.x, (vNetForce.y * -1.01)));
};
};
_local1 = ((Math.random() * 2) * Math.PI);
vDirection = new Vector((Math.sin(_local1) * 200), (Math.cos(_local1) * 200));
};
};
};
_local2 = vAccumulatedForce.PerpLH();
if (_local2.length() > 0){
AccumulateForce(_local2.normalize().multiply((300 * Math.sin((0.5 * fRad)))));
fRad = (fRad + 0.3);
};
vNetForce = vNetForce.add(vAccumulatedForce);
vNetForce = vNetForce.subtract(vNetForce.multiply(fKineticFriction));
vVelocity = vNetForce.multiply(fTime);
fSpeed = vVelocity.length();
vPos = vPos.add(vVelocity.multiply(fTime));
x = vPos.x;
y = vPos.y;
vAccumulatedForce.x = 0;
vAccumulatedForce.y = 0;
_local3 = vVelocity.normalize();
rotation = ((Math.atan2(_local3.y, _local3.x) * (180 / Math.PI)) - 90);
_local4 = 40;
if (bAllowedOffScreen == false){
_local6 = vPos;
_local7 = 1;
_local8 = ((bTailFlash)==true) ? 0 : 0xFFFFFF;
bTailFlash = !(bTailFlash);
_local9 = 3;
_local10 = (_local9 / pPositions.length);
_local11 = 0;
while (_local11 < pPositions.length) {
TheBrainGame.pGame.pSpermBullets.graphics.lineStyle(_local9, _local8, 1);
TheBrainGame.pGame.pSpermBullets.graphics.moveTo(pPositions[_local11].x, pPositions[_local11].y);
TheBrainGame.pGame.pSpermBullets.graphics.lineTo(_local6.x, _local6.y);
_local7 = (_local7 - (1 / _local4));
_local7 = Math.max(_local7, 0);
_local6 = pPositions[_local11];
_local9 = (_local9 - _local10);
_local11++;
};
};
pPositions.unshift(new Vector(x, y));
if (pPositions.length >= _local4){
pPositions.pop();
};
uCounter = 0;
TestBrainCollision();
if ((((bShouldDestroy == false)) && ((fEnergyDiffLen < 200)))){
_local11 = 0;
while (_local11 < pPositions.length) {
if (TheBrainGame.pEnergyBall.pBounds.hitTestPoint(pPositions[_local11].x, pPositions[_local11].y) == true){
TheBrainGame.pEnergyBall.RegisterHit(1);
break;
};
_local11++;
};
};
}
public function SetDirection(_arg1:Vector):void{
vDirection = _arg1;
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
pSpermChannel.stop();
}
}
}//package TheBrain.BrainGuys
Section 34
//Stanley (TheBrain.BrainGuys.Stanley)
package TheBrain.BrainGuys {
import TheBrain.*;
import flash.geom.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
public class Stanley extends BrainGuy {
public var pEye:BrainEye;
public function Stanley():void{
pEye.SetParentObject(this);
fKineticFriction = 0.05;
fMagnitude = 200;
iShotWait = 50;
uGuyType = STANLEY;
}
override protected function Fire():void{
var _local1:Vector;
var _local2:Vector;
var _local3:Point;
var _local4:Matrix;
_local1 = Vector.PointToVector(localToGlobal(pEye.vPos.toPoint()));
_local2 = TheBrainGame.pEnergyBall.vPos.subtract(_local1).normalize();
_local3 = _local2.toPoint();
Shoot(200, _local1, fLargeBulletScale);
_local4 = new Matrix();
_local4.rotate((25 * (Math.PI / 180)));
Shoot(200, _local1, fLargeBulletScale, Vector.PointToVector(_local4.transformPoint(_local3)));
_local4.rotate((-50 * (Math.PI / 180)));
Shoot(200, _local1, fLargeBulletScale, Vector.PointToVector(_local4.transformPoint(_local3)));
pEye.gotoAndPlay("fire");
}
override public function Update():void{
super.Update();
pEye.Update();
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 35
//Teleporter (TheBrain.BrainGuys.Teleporter)
package TheBrain.BrainGuys {
import TheBrain.*;
import flash.display.*;
import TheBrain.ParticleEffects.*;
import TheBrain.BrainGuys.BrainGuyParts.*;
import flash.media.*;
public class Teleporter extends BrainGuy {
public var pTusk1:TuskPart;
public var pTusk2:TuskPart;
private var iTeleportCoolDown:int;// = 0
public var pBrain:LittleBrain;
private var pTuskMC:MovieClip;
private var fRads:Number;// = 0
private var fTuskRotateDist:Number;// = 0
private var fRadRate:Number;// = 0.1
public var pEye:SmallBrainEye;
public function Teleporter():void{
fRads = 0;
fRadRate = 0.1;
fTuskRotateDist = 0;
iTeleportCoolDown = 0;
pTuskMC = new MovieClip();
super();
pEye.SetParentObject(this);
fKineticFriction = 0.1;
uGuyType = TELEPORTER;
fMagnitude = 100;
uTotalPointsWorth = 200;
pTuskMC.addChild(pTusk1);
pTuskMC.addChild(pTusk2);
addChild(pTuskMC);
}
override protected function Fire():void{
Shoot(200, Vector.PointToVector(localToGlobal(pEye.vPos.toPoint())), fSmallBulletScale);
}
override public function Update():void{
var _local1:Vector;
var _local2:Vector;
var _local3:int;
var _local4:int;
var _local5:Sound;
var _local6:SoundChannel;
iTeleportCoolDown--;
if ((((iTeleportCoolDown < 0)) && ((fEnergyDiffLen < 100)))){
TheBrainGame.pGame.AddParticleEffect(new TeleportEffect(x, y));
if (TheBrainGame.pEnergyBall.fSpeed > 0){
_local1 = TheBrainGame.pEnergyBall.vVelocity.normalize();
} else {
_local1 = vEnergyDiff;
};
_local2 = vPos.subtract(_local1.multiply(-150));
iTeleportCoolDown = 10;
_local3 = stage.stageWidth;
_local4 = stage.stageHeight;
if ((((((_local2.x < 0)) || ((_local2.x > _local3)))) || ((((_local2.y < 0)) || ((_local2.y > _local4)))))){
_local2 = new Vector((stage.stageWidth * 0.5), (stage.stageHeight * 0.5));
};
vPos = _local2;
SetPosition(vPos.x, vPos.y);
_local5 = new TeleportSound();
_local6 = _local5.play();
if (_local6 != null){
_local6.soundTransform = new SoundTransform(1);
};
TheBrainGame.pGame.AddParticleEffect(new TeleportEffect(x, y));
};
super.Update();
pTuskMC.rotation = (pTuskMC.rotation + 10);
pEye.Update();
}
override public function Kill():void{
super.Kill();
TheBrainGame.pGame.AddParticleEffect(new DeathEffect(x, y));
}
}
}//package TheBrain.BrainGuys
Section 36
//Bullet (TheBrain.Bullets.Bullet)
package TheBrain.Bullets {
import TheBrain.*;
import flash.display.*;
public class Bullet extends WorldObject {
public var pBitmapData:BitmapData;// = null
public var bSpermBullet:Boolean;// = false
public var iColor:int;// = 0xFFFFFF
public var bFlash:Boolean;// = false
public var bBossBullet:Boolean;// = false
public function Bullet(_arg1:Boolean=false):void{
pBitmapData = null;
bSpermBullet = false;
bBossBullet = false;
iColor = 0xFFFFFF;
bFlash = false;
super();
bBossBullet = _arg1;
visible = false;
}
public function DestroyIfOffScreen():void{
if ((((bSpermBullet == false)) && ((IsOnScreen() == false)))){
bShouldDestroy = true;
};
}
override public function Update():void{
if (bSpermBullet == false){
vPos = vPos.add(vVelocity.multiply(fTime));
x = vPos.x;
y = vPos.y;
};
iColor = ((bFlash)==true) ? 0 : 0xFFFFFF;
bFlash = !(bFlash);
if (hitTestPoint(TheBrainGame.pEnergyBall.x, TheBrainGame.pEnergyBall.y) == true){
TheBrainGame.pEnergyBall.RegisterHit(1);
bShouldDestroy = true;
} else {
if (bSpermBullet == false){
DestroyIfOffScreen();
};
};
}
}
}//package TheBrain.Bullets
Section 37
//AppearEffect (TheBrain.ParticleEffects.AppearEffect)
package TheBrain.ParticleEffects {
public class AppearEffect extends BaseParticleEffect {
public function AppearEffect(_arg1:Number=0, _arg2:Number=0):void{
width = (width * 0.55);
height = (height * 0.55);
rotation = Math.round((Math.random() * 360));
SetPosition(_arg1, _arg2);
}
}
}//package TheBrain.ParticleEffects
Section 38
//BaseParticleEffect (TheBrain.ParticleEffects.BaseParticleEffect)
package TheBrain.ParticleEffects {
import TheBrain.*;
import flash.events.*;
import flash.display.*;
public class BaseParticleEffect extends WorldObject {
private var uCurrFrame:uint;// = 0
public function BaseParticleEffect():void{
uCurrFrame = 0;
super();
fKineticFriction = 0.1;
stop();
addEventListener(Event.ENTER_FRAME, FrameCheck);
}
public function RecursivePlay(_arg1:MovieClip):void{
var _local2:int;
_local2 = 0;
while (_local2 < _arg1.numChildren) {
if ((_arg1.getChildAt(_local2) is MovieClip)){
MovieClip(_arg1.getChildAt(_local2)).gotoAndStop(uCurrFrame);
};
_local2++;
};
}
public function FrameCheck(_arg1:Event):void{
var _local2:uint;
_local2 = uCurrFrame;
if (((!((TheBrainGame.pGame == null))) && ((TheBrainGame.pGame.IsPaused() == false)))){
uCurrFrame++;
};
RecursivePlay(this);
gotoAndStop(uCurrFrame);
}
override public function Update():void{
super.Update();
if (currentLabel == "endEffect"){
bShouldDestroy = true;
stop();
visible = false;
};
}
}
}//package TheBrain.ParticleEffects
Section 39
//BGEffects (TheBrain.ParticleEffects.BGEffects)
package TheBrain.ParticleEffects {
import TheBrain.*;
import flash.display.*;
import flash.media.*;
import flash.filters.*;
public class BGEffects extends MovieClip {
private var pPositionArray:Array;
private var pChainPositions:Array;
private var pBGTriangleParticles:Sprite;
private var pBGParticlesMask:Sprite;
private var pBGSprite1:Sprite;
private var pBGSprite2:Sprite;
private var pBGSprite3:Sprite;
private var uLastType:uint;// = 99999
private var pObjectArray:Array;
private var bBoosting:Boolean;// = false
private var bPauseNextFrame:Boolean;// = false
private static var pTrinitySound:Sound = null;
public function BGEffects():void{
var _local1:Array;
pObjectArray = new Array();
pBGSprite1 = new Sprite();
pBGSprite2 = new Sprite();
pBGSprite3 = new Sprite();
pBGTriangleParticles = new Sprite();
pBGParticlesMask = new Sprite();
pPositionArray = new Array();
pChainPositions = new Array();
uLastType = 99999;
bPauseNextFrame = false;
bBoosting = false;
super();
addChild(pBGSprite1);
addChild(pBGSprite2);
addChild(pBGSprite3);
addChild(pBGTriangleParticles);
addChild(pBGParticlesMask);
pBGTriangleParticles.mask = pBGParticlesMask;
_local1 = pBGSprite2.filters;
_local1.push(new BlurFilter(10, 10));
pBGSprite2.filters = _local1;
if (pTrinitySound == null){
pTrinitySound = new TrinitySound();
};
}
public function AddChainPosition(_arg1:int, _arg2:int, _arg3:uint):void{
var _local4:Vector;
var _local5:int;
var _local6:Array;
var _local7:Object;
var _local8:Number;
var _local9:SoundChannel;
var _local10:Boolean;
var _local11:int;
var _local12:Number;
var _local13:Object;
if (_arg3 == uLastType){
pChainPositions[0].iLineSize = 5;
pChainPositions[0].fAlpha = 1;
pChainPositions[0].pPositions.unshift(new Vector(_arg1, _arg2));
if (pChainPositions[0].pPositions.length == 3){
_local4 = new Vector(0, 0);
_local5 = 0;
while (_local5 < pChainPositions[0].pPositions.length) {
_local4 = _local4.add(pChainPositions[0].pPositions[_local5]);
_local5++;
};
_local4 = _local4.multiply((1 / 3));
_local6 = new Array();
_local7 = new Object();
_local8 = 0;
_local7.vNorm = pChainPositions[0].pPositions[1].subtract(pChainPositions[0].pPositions[2]).PerpLH().normalize();
_local8 = Vector.dot(_local7.vNorm, _local4.subtract(pChainPositions[0].pPositions[1]));
_local7.vNorm = _local7.vNorm.multiply(((_local8)>0) ? -1 : 1);
_local7.fDist = Vector.dot(pChainPositions[0].pPositions[1], _local7.vNorm);
_local6.push(_local7);
_local7 = new Object();
_local7.vNorm = pChainPositions[0].pPositions[0].subtract(pChainPositions[0].pPositions[1]).PerpLH().normalize();
_local8 = Vector.dot(_local7.vNorm, _local4.subtract(pChainPositions[0].pPositions[0]));
_local7.vNorm = _local7.vNorm.multiply(((_local8)>0) ? -1 : 1);
_local7.fDist = Vector.dot(pChainPositions[0].pPositions[0], _local7.vNorm);
_local6.push(_local7);
_local7 = new Object();
_local7.vNorm = pChainPositions[0].pPositions[2].subtract(pChainPositions[0].pPositions[0]).PerpLH().normalize();
_local8 = Vector.dot(_local7.vNorm, _local4.subtract(pChainPositions[0].pPositions[2]));
_local7.vNorm = _local7.vNorm.multiply(((_local8)>0) ? -1 : 1);
_local7.fDist = Vector.dot(pChainPositions[0].pPositions[2], _local7.vNorm);
_local6.push(_local7);
_local5 = 0;
while (_local5 < TheBrainGame.pGame.pGuys.length) {
if (TheBrainGame.pGame.pGuys[_local5].ShouldDestroy() == true){
} else {
_local10 = true;
_local11 = 0;
while (_local11 < _local6.length) {
_local12 = (Vector.dot(_local6[_local11].vNorm, TheBrainGame.pGame.pGuys[_local5].vPos) - _local6[_local11].fDist);
if (_local12 > 0){
_local10 = false;
break;
};
_local11++;
};
if (_local10 == true){
if (TheBrainGame.pGame.pGuys[_local5].GetType() == uLastType){
TheBrainGame.pGame.pScore.AddToScoreNoChainAdjust((TheBrainGame.pGame.pGuys[_local5].GetPointsWorth() * 2));
} else {
TheBrainGame.pGame.pScore.AddToScoreNoChainAdjust(TheBrainGame.pGame.pGuys[_local5].GetPointsWorth());
};
TheBrainGame.pGame.pScore.IncrementChain(TheBrainGame.pGame.pGuys[_local5].x, TheBrainGame.pGame.pGuys[_local5].y);
TheBrainGame.pGame.pGuys[_local5].TriangleKill();
};
};
_local5++;
};
pChainPositions[0].cColor = 0;
pChainPositions[0].fAlpha = 1;
pChainPositions[0].bDestroy = true;
pChainPositions[0].bTrinityComplete = true;
uLastType = 99999;
AddExplosion(_local4.x, _local4.y, 0);
TheBrainGame.pGame.SetShake(15, 2);
pBGParticlesMask.graphics.clear();
pBGParticlesMask.graphics.beginFill(0, 1);
pBGParticlesMask.graphics.moveTo(pChainPositions[0].pPositions[0].x, pChainPositions[0].pPositions[0].y);
AddExplosion(pChainPositions[0].pPositions[0].x, pChainPositions[0].pPositions[0].y, 0);
pBGParticlesMask.graphics.lineTo(pChainPositions[0].pPositions[1].x, pChainPositions[0].pPositions[1].y);
AddExplosion(pChainPositions[0].pPositions[1].x, pChainPositions[0].pPositions[1].y, 0);
pBGParticlesMask.graphics.lineTo(pChainPositions[0].pPositions[2].x, pChainPositions[0].pPositions[2].y);
AddExplosion(pChainPositions[0].pPositions[2].x, pChainPositions[0].pPositions[2].y, 0);
pBGParticlesMask.graphics.lineTo(pChainPositions[0].pPositions[0].x, pChainPositions[0].pPositions[0].y);
pBGParticlesMask.graphics.endFill();
bPauseNextFrame = true;
_local9 = pTrinitySound.play();
if (_local9 != null){
_local9.soundTransform = new SoundTransform(2);
};
};
} else {
if (pChainPositions.length > 0){
pChainPositions[0].bDestroy = true;
};
_local13 = new Object();
_local13.pPositions = new Array(new Vector(_arg1, _arg2));
_local13.iLineSize = 3;
_local13.fAlpha = 1;
_local13.bDestroy = false;
_local13.cColor = 0;
_local13.bTrinityComplete = false;
pChainPositions.unshift(_local13);
uLastType = _arg3;
};
}
public function AddEnergyBallPosition(_arg1:int, _arg2:int):void{
if ((((TheBrainGame.pEnergyBall.visible == true)) && ((TheBrainGame.pEnergyBall.fBoostMultiplier > 1)))){
if (bBoosting == false){
while (pPositionArray.length > 0) {
pPositionArray.pop();
};
};
bBoosting = true;
pPositionArray.unshift(new Vector(_arg1, _arg2));
} else {
bBoosting = false;
};
}
public function ResetBG():void{
while (pChainPositions.length > 0) {
pChainPositions.pop();
};
uLastType = 99999;
}
public function AddExplosion(_arg1:int, _arg2:int, _arg3:int=0xFF0000):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Object;
var _local8:Number;
var _local9:Number;
_local4 = _arg3;
_local5 = ((_arg3)==0) ? 150 : 100;
_local6 = 0;
while (_local6 < _local5) {
_local7 = new Object();
_local7.vPos = new Vector(_arg1, _arg2);
_local8 = ((((Math.random() - 0.5) * 2) * Math.PI) * 2);
_local9 = ((Math.random() * 30) + 30);
_local7.vVel = new Vector((Math.sin(_local8) * _local9), (Math.cos(_local8) * _local9));
_local7.fAlpha = 1;
_local7.cColor = _local4;
if (_local6 > (_local5 / 2)){
_local7.fResistance = Math.random();
} else {
_local7.fResistance = 1;
};
pObjectArray.push(_local7);
_local6++;
};
}
private function DrawDottedLine(_arg1:Vector, _arg2:Vector, _arg3:Number, _arg4:Sprite){
var _local5:Vector;
var _local6:Number;
var _local7:Vector;
var _local8:Number;
var _local9:Vector;
var _local10:int;
var _local11:Vector;
_local5 = _arg2.subtract(_arg1);
_local6 = _local5.length();
if (_local6 > 0){
_local7 = _local5.divide(_local6);
_local8 = (Math.ceil((_local6 / _arg3)) * 0.5);
_local9 = _arg1;
_local10 = 0;
while (_local10 < _local8) {
_local11 = _local7.multiply(_arg3).add(_local9);
_arg4.graphics.moveTo(_local9.x, _local9.y);
_arg4.graphics.lineTo(_local11.x, _local11.y);
_local9 = _local9.add(_local7.multiply((_arg3 * 2)));
_local10++;
};
};
}
public function Update():void{
var _local1:int;
var _local2:Sprite;
var _local3:int;
var _local4:int;
var _local5:Vector;
var _local6:int;
var _local7:uint;
if (bPauseNextFrame == true){
TheBrainGame.pGame.Pause(5);
bPauseNextFrame = false;
};
pBGSprite1.graphics.clear();
pBGSprite1.graphics.beginFill(0, 0);
pBGTriangleParticles.graphics.clear();
pBGTriangleParticles.graphics.beginFill(0, 0);
_local1 = 0;
while (_local1 < pObjectArray.length) {
if (pObjectArray[_local1].fAlpha <= 0){
pObjectArray.splice(_local1, 1);
_local1 = Math.max(0, (_local1 - 1));
} else {
if (pObjectArray[_local1].cColor != 0){
_local2 = pBGSprite1;
} else {
_local2 = pBGTriangleParticles;
};
pObjectArray[_local1].fAlpha = (pObjectArray[_local1].fAlpha - 0.05);
_local2.graphics.lineStyle(1, pObjectArray[_local1].cColor, pObjectArray[_local1].fAlpha);
_local2.graphics.moveTo(pObjectArray[_local1].vPos.x, pObjectArray[_local1].vPos.y);
pObjectArray[_local1].vPos = pObjectArray[_local1].vPos.add(pObjectArray[_local1].vVel);
pObjectArray[_local1].vVel.x = (pObjectArray[_local1].vVel.x * (0.85 * pObjectArray[_local1].fResistance));
pObjectArray[_local1].vVel.y = (pObjectArray[_local1].vVel.y * (0.85 * pObjectArray[_local1].fResistance));
_local2.graphics.lineTo(pObjectArray[_local1].vPos.x, pObjectArray[_local1].vPos.y);
};
_local1++;
};
pBGSprite1.graphics.endFill();
pBGTriangleParticles.graphics.endFill();
pBGSprite2.graphics.clear();
pBGSprite2.graphics.beginFill(0, 0);
if (TheBrainGame.pEnergyBall.visible == true){
_local3 = 5;
_local4 = 10;
_local5 = TheBrainGame.pEnergyBall.vPos;
_local1 = 0;
while (_local1 < pPositionArray.length) {
if (_local1 > _local3){
pPositionArray.pop();
} else {
pBGSprite2.graphics.lineStyle(_local4, 0, ((TheBrainGame.pEnergyBall.fBoostMultiplier - 1) / 2));
pBGSprite2.graphics.moveTo(_local5.x, _local5.y);
pBGSprite2.graphics.lineTo(pPositionArray[_local1].x, pPositionArray[_local1].y);
_local5 = pPositionArray[_local1];
_local4 = (_local4 - 2);
};
_local1++;
};
};
pBGSprite2.graphics.endFill();
pBGSprite3.graphics.clear();
pBGSprite3.graphics.beginFill(0, 0);
_local1 = 0;
while (_local1 < pChainPositions.length) {
_local5 = pChainPositions[_local1].pPositions[0];
pBGSprite3.graphics.lineStyle(pChainPositions[_local1].iLineSize, pChainPositions[_local1].cColor, pChainPositions[_local1].fAlpha);
_local6 = 0;
while (_local6 < pChainPositions[_local1].pPositions.length) {
if (_local6 < 2){
pBGSprite3.graphics.moveTo(_local5.x, _local5.y);
} else {
pBGSprite3.graphics.moveTo(pChainPositions[_local1].pPositions[0].x, pChainPositions[_local1].pPositions[0].y);
pBGSprite3.graphics.lineTo(pChainPositions[_local1].pPositions[_local6].x, pChainPositions[_local1].pPositions[_local6].y);
pBGSprite3.graphics.moveTo(_local5.x, _local5.y);
};
if (pChainPositions[_local1].bTrinityComplete == false){
DrawDottedLine(_local5, pChainPositions[_local1].pPositions[_local6], 5, pBGSprite3);
} else {
pBGSprite3.graphics.lineTo(pChainPositions[_local1].pPositions[_local6].x, pChainPositions[_local1].pPositions[_local6].y);
};
_local5 = pChainPositions[_local1].pPositions[_local6];
_local6++;
};
pChainPositions[_local1].fAlpha = Math.max((pChainPositions[_local1].fAlpha - 0.1), ((pChainPositions[_local1].bDestroy)==true) ? 0 : 0.4);
pChainPositions[_local1].iLineSize = (pChainPositions[_local1].iLineSize - 1);
pChainPositions[_local1].iLineSize = Math.max(pChainPositions[_local1].iLineSize, 3);
if ((((pChainPositions[_local1].bDestroy == true)) && ((pChainPositions[_local1].fAlpha <= 0)))){
pChainPositions.splice(_local1, 1);
_local1 = Math.max(0, (_local1 - 1));
};
_local1++;
};
if ((((pChainPositions.length > 0)) && ((pChainPositions[0].bDestroy == false)))){
_local7 = pChainPositions[0].pPositions.length;
if (_local7 >= 1){
pBGSprite3.graphics.lineStyle(3, 0, 0.25);
DrawDottedLine(pChainPositions[0].pPositions[0], TheBrainGame.pEnergyBall.vPos, 5, pBGSprite3);
};
};
pBGSprite3.graphics.endFill();
}
}
}//package TheBrain.ParticleEffects
Section 40
//BossBoom (TheBrain.ParticleEffects.BossBoom)
package TheBrain.ParticleEffects {
public class BossBoom extends BaseParticleEffect {
public function BossBoom(_arg1:Number=0, _arg2:Number=0):void{
rotation = Math.round((Math.random() * 360));
SetPosition(_arg1, _arg2);
}
}
}//package TheBrain.ParticleEffects
Section 41
//ChainEffect (TheBrain.ParticleEffects.ChainEffect)
package TheBrain.ParticleEffects {
import flash.geom.*;
import flash.text.*;
public class ChainEffect extends BaseParticleEffect {
public var chainnumber:TextField;
private var fAlpha:Number;// = 1
public function ChainEffect(_arg1:Number, _arg2:Number, _arg3:int):void{
fAlpha = 1;
super();
SetPosition(_arg1, _arg2);
chainnumber.text = _arg3.toString();
}
override public function Update():void{
fAlpha = (fAlpha - 0.05);
transform.colorTransform = new ColorTransform(1, 1, 1, fAlpha);
if (fAlpha <= 0){
bShouldDestroy = true;
};
}
}
}//package TheBrain.ParticleEffects
Section 42
//DeathEffect (TheBrain.ParticleEffects.DeathEffect)
package TheBrain.ParticleEffects {
import TheBrain.*;
import flash.media.*;
public class DeathEffect extends BaseParticleEffect {
public static var pExplosion1:Sound = null;
public static var pExplosion2:Sound = null;
public static var pExplosion3:Sound = null;
public static var pExplosion4:Sound = null;
public function DeathEffect(_arg1:Number=0, _arg2:Number=0, _arg3:Boolean=false):void{
var _local4:int;
super();
width = (width * 0.55);
height = (height * 0.55);
rotation = Math.round((Math.random() * 360));
SetPosition(_arg1, _arg2);
if (pExplosion1 == null){
pExplosion1 = new GuyDeath1();
pExplosion2 = new GuyDeath2();
pExplosion3 = new GuyDeath3();
pExplosion4 = new GuyDeath4();
};
if (_arg3 == false){
_local4 = Math.floor((Math.random() * 4));
switch (_local4){
case 1:
pExplosion1.play();
break;
case 2:
pExplosion2.play();
break;
case 2:
pExplosion3.play();
break;
default:
pExplosion4.play();
break;
};
};
}
}
}//package TheBrain.ParticleEffects
Section 43
//LaserWallHit (TheBrain.ParticleEffects.LaserWallHit)
package TheBrain.ParticleEffects {
public class LaserWallHit extends BaseParticleEffect {
public function LaserWallHit():void{
SetPosition(0, 0);
}
override public function Update():void{
}
}
}//package TheBrain.ParticleEffects
Section 44
//PlayerAppear (TheBrain.ParticleEffects.PlayerAppear)
package TheBrain.ParticleEffects {
import TheBrain.*;
public class PlayerAppear extends BaseParticleEffect {
public function PlayerAppear(_arg1:Number, _arg2:Number):void{
SetPosition(_arg1, _arg2);
}
override public function Update():void{
SetPosition(TheBrainGame.pEnergyBall.x, TheBrainGame.pEnergyBall.y);
super.Update();
}
}
}//package TheBrain.ParticleEffects
Section 45
//PlayerDeath (TheBrain.ParticleEffects.PlayerDeath)
package TheBrain.ParticleEffects {
import TheBrain.*;
public class PlayerDeath extends BaseParticleEffect {
public function PlayerDeath(_arg1:Number, _arg2:Number):void{
addFrameScript(9, frame10);
SetPosition(_arg1, _arg2);
TheBrainGame.pGame.AddParticleEffect(new ScreenFlash(0, 0));
}
function frame10(){
stop();
}
}
}//package TheBrain.ParticleEffects
Section 46
//PlayerDestroy (TheBrain.ParticleEffects.PlayerDestroy)
package TheBrain.ParticleEffects {
public class PlayerDestroy extends BaseParticleEffect {
public function PlayerDestroy(_arg1:Number, _arg2:Number):void{
SetPosition(_arg1, _arg2);
}
}
}//package TheBrain.ParticleEffects
Section 47
//ScreenCrack (TheBrain.ParticleEffects.ScreenCrack)
package TheBrain.ParticleEffects {
import TheBrain.*;
import flash.media.*;
public class ScreenCrack extends BaseParticleEffect {
public function ScreenCrack(_arg1:Number, _arg2:Number):void{
var _local3:Sound;
super();
SetPosition((TheBrainGame.screenWidth * 0.5), (TheBrainGame.screenHeight * 0.5));
_local3 = new GuyDeath4();
_local3.play();
}
}
}//package TheBrain.ParticleEffects
Section 48
//ScreenFlash (TheBrain.ParticleEffects.ScreenFlash)
package TheBrain.ParticleEffects {
public class ScreenFlash extends BaseParticleEffect {
public function ScreenFlash(_arg1:Number, _arg2:Number):void{
SetPosition(_arg1, _arg2);
}
}
}//package TheBrain.ParticleEffects
Section 49
//SuckEffect (TheBrain.ParticleEffects.SuckEffect)
package TheBrain.ParticleEffects {
import flash.geom.*;
import flash.display.*;
public class SuckEffect extends MovieClip {
public function SuckEffect(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
transform.colorTransform = new ColorTransform(1, 1, 1, 0.5);
}
}
}//package TheBrain.ParticleEffects
Section 50
//TeleportEffect (TheBrain.ParticleEffects.TeleportEffect)
package TheBrain.ParticleEffects {
public class TeleportEffect extends BaseParticleEffect {
public function TeleportEffect(_arg1:Number=0, _arg2:Number=0):void{
width = (width * 0.55);
height = (height * 0.55);
SetPosition(_arg1, _arg2);
}
}
}//package TheBrain.ParticleEffects
Section 51
//BrainGraphic (TheBrain.TimelinePlaceableObjects.BrainGraphic)
package TheBrain.TimelinePlaceableObjects {
import flash.display.*;
public class BrainGraphic extends MovieClip {
public static var pGraphic:BrainGraphic = null;
public function BrainGraphic():void{
pGraphic = this;
}
}
}//package TheBrain.TimelinePlaceableObjects
Section 52
//BoostSound (TheBrain.BoostSound)
package TheBrain {
import flash.media.*;
public dynamic class BoostSound extends Sound {
}
}//package TheBrain
Section 53
//BossAttack (TheBrain.BossAttack)
package TheBrain {
import flash.media.*;
public dynamic class BossAttack extends Sound {
}
}//package TheBrain
Section 54
//BossDeath (TheBrain.BossDeath)
package TheBrain {
import flash.media.*;
public dynamic class BossDeath extends Sound {
}
}//package TheBrain
Section 55
//BossDying (TheBrain.BossDying)
package TheBrain {
import flash.media.*;
public dynamic class BossDying extends Sound {
}
}//package TheBrain
Section 56
//BossFinalDeath (TheBrain.BossFinalDeath)
package TheBrain {
import flash.media.*;
public dynamic class BossFinalDeath extends Sound {
}
}//package TheBrain
Section 57
//BossIntro (TheBrain.BossIntro)
package TheBrain {
import flash.media.*;
public dynamic class BossIntro extends Sound {
}
}//package TheBrain
Section 58
//BossLeaderboard (TheBrain.BossLeaderboard)
package TheBrain {
public class BossLeaderboard extends Leaderboard {
public function BossLeaderboard():void{
}
override public function Load(_arg1:int, _arg2:int=0, _arg3:int=10):void{
pLeaderLoader.visible = true;
iLeaderID = _arg1;
WebStats.GetScores(_arg1, _arg2, _arg3, FinishLoad, 1);
}
override public function FormatScore(_arg1:Number):String{
var _local2:Number;
_local2 = (_arg1 / 1000);
return ((_local2.toString() + " sec"));
}
}
}//package TheBrain
Section 59
//BossMiniExplosion (TheBrain.BossMiniExplosion)
package TheBrain {
import flash.media.*;
public dynamic class BossMiniExplosion extends Sound {
}
}//package TheBrain
Section 60
//BrainBG (TheBrain.BrainBG)
package TheBrain {
import flash.display.*;
public class BrainBG extends MovieClip {
public function BrainBG():void{
x = (TheBrainGame.screenWidth * 0.5);
y = (TheBrainGame.screenHeight * 0.5);
cacheAsBitmap = true;
gotoAndStop(1);
TheBrainGame.pMeatWall.gotoAndStop(1);
}
public function Next():void{
gotoAndStop((currentFrame + 1));
TheBrainGame.pMeatWall.gotoAndStop((TheBrainGame.pMeatWall.currentFrame + 1));
}
public function Reset():void{
gotoAndStop(1);
}
public function Update():void{
}
}
}//package TheBrain
Section 61
//DashBar (TheBrain.DashBar)
package TheBrain {
import flash.display.*;
public dynamic class DashBar extends MovieClip {
public var pBoostCharge:MovieClip;
}
}//package TheBrain
Section 62
//DeathExplosionSound (TheBrain.DeathExplosionSound)
package TheBrain {
import flash.media.*;
public dynamic class DeathExplosionSound extends Sound {
}
}//package TheBrain
Section 63
//Door (TheBrain.Door)
package TheBrain {
import flash.display.*;
public class Door extends MovieClip {
public var bClosing:Boolean;// = false
public var pGuysSpawned:Array;
public var bOpened:Boolean;// = false
public var bClosed:Boolean;// = true
public var bOpening:Boolean;// = false
public function Door():void{
bOpening = false;
bClosing = false;
bOpened = false;
bClosed = true;
pGuysSpawned = new Array();
super();
addFrameScript(0, frame1, 1, frame2, 5, frame6, 6, frame7);
visible = false;
}
function frame6(){
bOpened = true;
bOpening = false;
bClosing = false;
stop();
}
function frame7(){
bClosing = true;
bOpened = false;
}
function frame1(){
bClosed = true;
bClosing = false;
stop();
}
function frame2(){
bOpening = true;
bClosed = false;
}
public function Update():void{
var _local1:int;
return;
}
}
}//package TheBrain
Section 64
//Doors (TheBrain.Doors)
package TheBrain {
import flash.display.*;
public class Doors extends MovieClip {
public var leftdoor:Door;
public var bottomdoor:Door;
public var topdoor:Door;
public var rightdoor:Door;
static var pDoors:Doors = null;
public function Doors():void{
pDoors = this;
}
public function Update():void{
topdoor.Update();
bottomdoor.Update();
leftdoor.Update();
rightdoor.Update();
}
}
}//package TheBrain
Section 65
//EnergyBall (TheBrain.EnergyBall)
package TheBrain {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.ui.*;
public class EnergyBall extends WorldObject {
private const fSpringStrength:Number = 200000;
public var iLives:int;// = 4
private var fCurrentSpring:Number;// = 200000
private var bDown:Boolean;
private var bPaused:Boolean;// = false
private var originalHeight:Number;
private var fOriginalFriction:Number;// = 0.425
private var originalWidth:Number;
private var blurBitmap:Bitmap;
public var fBoostMultiplier:Number;// = 1
private var bmpMovieClip:MovieClip;
private var bUp:Boolean;
private var blurData:BitmapData;
var fCurrVelocity:Number;// = 10000
private var bRight:Boolean;
private var iSheilds:int;// = 1
private var fMiniBallRadius:Number;// = 16
public var pBounds:MovieClip;
private var fMiniBallRadians:Number;// = 0
private var baseHeight:Number;
private var iBaseSheilds:int;// = 1
private var baseWidth:Number;
private var lerp:Number;// = 0
private var iInvincibleCounter:int;// = 0
private var fBaseMiniRadius:Number;// = 16
private var bLeft:Boolean;
private var bSlow:Boolean;// = false
private var fBaseBoost:Number;// = 2
private var pMiniBalls:Array;
var iFramesDown:int;// = 0
private var vCurrMouse:Vector;
private var vLastMouse:Vector;
public static var pTakeDamageSound:Sound = null;
public static var pDeathSound:Sound = null;
public static var pBoostSound:Sound = null;
public function EnergyBall():void{
var _local1:Array;
vCurrMouse = new Vector(0, 0);
vLastMouse = new Vector(0, 0);
fCurrentSpring = fSpringStrength;
fOriginalFriction = 0.425;
lerp = 0;
bPaused = false;
fBoostMultiplier = 1;
fBaseBoost = 2;
iSheilds = 1;
iBaseSheilds = 1;
pMiniBalls = new Array();
fMiniBallRadians = 0;
iInvincibleCounter = 0;
iLives = 4;
fBaseMiniRadius = 16;
fMiniBallRadius = 16;
bSlow = false;
fCurrVelocity = 10000;
iFramesDown = 0;
super();
cacheAsBitmap = false;
_local1 = new Array();
originalWidth = width;
originalHeight = height;
if (pDeathSound == null){
pDeathSound = new PlayerDeathSound();
pTakeDamageSound = new TakeDamageSound();
pBoostSound = new BoostSound();
};
pBounds.visible = false;
TheBrainGame.pGame.pEnergyBallLayer.addChild(this);
fKineticFriction = fOriginalFriction;
baseWidth = pBounds.width;
baseHeight = pBounds.height;
if (TheBrainGame.pGame.gameMode == TheBrainGame.BOSSMODE){
iLives = 99;
UpgradeSheild(2);
UpgradeBoost(3.5);
SetPosition((TheBrainGame.screenWidth * 0.25), (TheBrainGame.screenHeight * 0.75));
} else {
SetPosition((TheBrainGame.screenWidth * 0.5), (TheBrainGame.screenHeight * 0.5));
if (TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE){
iLives = 4;
} else {
iLives = 6;
};
};
if (TheBrainGame.pGame.gameMode == TheBrainGame.ENDLESSMODE){
iLives = 4;
UpgradeSheild(3);
UpgradeSize(1);
UpgradeSize(1);
UpgradeSize(1);
UpgradeBoost(4);
};
}
public function UpgradeSheild(_arg1:int):void{
iBaseSheilds = _arg1;
iSheilds = iBaseSheilds;
}
public function UpgradeSize(_arg1:Number):void{
var _local2:MiniEnergyBall;
_local2 = new MiniEnergyBall();
pMiniBalls.push(_local2);
addChild(_local2);
}
public function AdjustLives(_arg1:int):void{
SetLives((iLives + _arg1));
}
public function MoveWithKeyboardUp(_arg1:KeyboardEvent){
if (_arg1.keyCode == Keyboard.UP){
bUp = false;
};
if (_arg1.keyCode == Keyboard.DOWN){
bDown = false;
};
if (_arg1.keyCode == Keyboard.LEFT){
bLeft = false;
};
if (_arg1.keyCode == Keyboard.RIGHT){
bRight = false;
};
if ((((((((bUp == false)) && ((bDown == false)))) && ((bLeft == false)))) && ((bRight == false)))){
};
if (_arg1.keyCode == Keyboard.SHIFT){
fCurrVelocity = 10000;
bSlow = false;
};
}
public function TotalReset(){
fBaseBoost = 2;
iBaseSheilds = 1;
width = baseWidth;
height = baseHeight;
SetLives(4);
while (pMiniBalls.length) {
removeChild(pMiniBalls[0]);
pMiniBalls.unshift();
};
}
override public function Update():void{
var _local1:Number;
var _local2:Vector;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:int;
if (visible == false){
return;
};
if (bSlow == true){
fMiniBallRadius = Math.min((fMiniBallRadius + 0.3), 32);
} else {
fMiniBallRadius = Math.max((fMiniBallRadius - 0.3), 16);
};
iInvincibleCounter--;
if (iInvincibleCounter > 0){
transform.colorTransform = new ColorTransform(1, 1, 1, ((2 + Math.sin((iInvincibleCounter / 10))) * 0.25));
} else {
transform.colorTransform = new ColorTransform(1, 1, 1, 1);
};
if (fBoostMultiplier > 1){
_local3 = ((fBaseBoost - 1) / 15);
fBoostMultiplier = (fBoostMultiplier - _local3);
TheBrainGame.pGame.pScore.pDashBar.pBoostCharge.scaleX = (TheBrainGame.pGame.pScore.pDashBar.pBoostCharge.scaleX - (1 / 15));
} else {
fBoostMultiplier = 1;
TheBrainGame.pGame.pScore.pDashBar.pBoostCharge.scaleX = 1;
};
_local1 = (fCurrVelocity * fBoostMultiplier);
_local2 = new Vector(0, 0);
if (bUp == true){
_local2 = _local2.add(new Vector(0, -(_local1)));
};
if (bDown == true){
_local2 = _local2.add(new Vector(0, _local1));
};
if (bLeft == true){
_local2 = _local2.add(new Vector(-(_local1), 0));
};
if (bRight == true){
_local2 = _local2.add(new Vector(_local1, 0));
};
AccumulateForce(_local2);
super.Update();
if (x > TheBrainGame.screenWidth){
x = (TheBrainGame.screenWidth - 1);
};
if (x < 0){
x = 1;
};
if (y > TheBrainGame.screenHeight){
y = (TheBrainGame.screenHeight - 1);
};
if (y < 0){
y = 1;
};
SetPosition(x, y);
TheBrainGame.pGame.pBGEffects.AddEnergyBallPosition(x, y);
TheBrainGame.pGame.pEnergyBallLayer.graphics.clear();
if (iSheilds > 1){
TheBrainGame.pGame.pEnergyBallLayer.graphics.lineStyle(iSheilds, 0, 1);
TheBrainGame.pGame.pEnergyBallLayer.graphics.drawCircle(x, y, 12);
};
TheBrainGame.pGame.pEnergyBallLayer.graphics.endFill();
if (pMiniBalls.length > 0){
_local4 = fMiniBallRadians;
_local5 = ((Math.PI * 2) / pMiniBalls.length);
_local6 = 0;
while (_local6 < pMiniBalls.length) {
pMiniBalls[_local6].x = (Math.sin(_local4) * fMiniBallRadius);
pMiniBalls[_local6].y = (Math.cos(_local4) * fMiniBallRadius);
_local4 = (_local4 + _local5);
_local6++;
};
fMiniBallRadians = (fMiniBallRadians + ((bSlow)==true) ? 0.3 : 0.15);
};
}
public function CalculateSpring():void{
var _local1:Vector;
var _local2:Vector;
var _local3:Vector;
_local1 = new Vector(x, y);
_local2 = vCurrMouse.subtract(_local1);
_local3 = _local2.multiply(fCurrentSpring);
}
public function UpgradeBoost(_arg1:Number):void{
fBaseBoost = _arg1;
}
public function MoveWithKeyboardDown(_arg1:KeyboardEvent){
var _local2:Boolean;
_local2 = false;
if (_arg1.keyCode == Keyboard.UP){
bUp = true;
_local2 = true;
};
if (_arg1.keyCode == Keyboard.DOWN){
bDown = true;
_local2 = true;
};
if (_arg1.keyCode == Keyboard.LEFT){
bLeft = true;
_local2 = true;
};
if (_arg1.keyCode == Keyboard.RIGHT){
bRight = true;
_local2 = true;
};
if (_arg1.keyCode == Keyboard.SHIFT){
fCurrVelocity = 3000;
bSlow = true;
};
if ((((((((bSlow == false)) && ((_arg1.keyCode == Keyboard.SPACE)))) && ((fBoostMultiplier == 1)))) && ((visible == true)))){
fBoostMultiplier = fBaseBoost;
pBoostSound.play();
};
if ((((_arg1.keyCode == 80)) || ((_arg1.keyCode == Keyboard.ESCAPE)))){
bPaused = !(TheBrainGame.pGame.IsPaused());
TheBrainGame.pGame.PauseGame(bPaused);
};
}
public function Reset():void{
iSheilds = iBaseSheilds;
}
public function AddToSpringStrength(_arg1:Number){
}
public function MoveEnergyBall(_arg1:MouseEvent){
}
override public function IsObjectCollidingWithObject(_arg1:WorldObject):Boolean{
var _local2:Boolean;
var _local3:int;
if (visible == false){
return (false);
};
_local2 = pBounds.hitTestObject(_arg1);
if (_local2 == false){
_local3 = 0;
while (_local3 < pMiniBalls.length) {
if (pMiniBalls[_local3].hitTestObject(_arg1) == true){
_local2 = true;
break;
};
_local3++;
};
};
return (_local2);
}
public function Kill():void{
AdjustLives(-1);
pDeathSound.play();
if (iLives == 0){
TheBrainGame.pUpgrade.GameOver();
TheBrainGame.pGame.PauseGame(true, false, true);
};
Reset();
}
public function RegisterHit(_arg1:uint):void{
var _local2:int;
if (iInvincibleCounter > 0){
return;
};
iSheilds = (iSheilds - _arg1);
iInvincibleCounter = 60;
if (iSheilds <= 0){
TheBrainGame.pGame.pBGEffects.AddExplosion(x, y, 0x111111);
_local2 = 0;
while (_local2 < 10) {
TheBrainGame.pGame.pBGEffects.AddExplosion(Math.round((Math.random() * TheBrainGame.screenWidth)), Math.round((Math.random() * TheBrainGame.screenHeight)), 0x111111);
_local2++;
};
TheBrainGame.pGame.KillEnergyBall();
Reset();
} else {
TheBrainGame.pGame.EnergyBallHitEffect(10, 20);
pTakeDamageSound.play();
};
}
public function SetLives(_arg1:int):void{
TheBrainGame.pGame.pScore.SetLives(_arg1);
iLives = _arg1;
}
}
}//package TheBrain
Section 66
//GT4Lives (TheBrain.GT4Lives)
package TheBrain {
import flash.display.*;
import flash.text.*;
public dynamic class GT4Lives extends MovieClip {
public var pLivesNumber:TextField;
}
}//package TheBrain
Section 67
//GuyDeath1 (TheBrain.GuyDeath1)
package TheBrain {
import flash.media.*;
public dynamic class GuyDeath1 extends Sound {
}
}//package TheBrain
Section 68
//GuyDeath2 (TheBrain.GuyDeath2)
package TheBrain {
import flash.media.*;
public dynamic class GuyDeath2 extends Sound {
}
}//package TheBrain
Section 69
//GuyDeath3 (TheBrain.GuyDeath3)
package TheBrain {
import flash.media.*;
public dynamic class GuyDeath3 extends Sound {
}
}//package TheBrain
Section 70
//GuyDeath4 (TheBrain.GuyDeath4)
package TheBrain {
import flash.media.*;
public dynamic class GuyDeath4 extends Sound {
}
}//package TheBrain
Section 71
//LaserLoop (TheBrain.LaserLoop)
package TheBrain {
import flash.media.*;
public dynamic class LaserLoop extends Sound {
}
}//package TheBrain
Section 72
//Leaderboard (TheBrain.Leaderboard)
package TheBrain {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.xml.*;
public class Leaderboard extends MovieClip {
public var pLeaderLoader:LeaderLoader;
public var pRows:Array;
public var iLeaderID:int;
public var iStart:int;// = 0
public var pNextButton:NextButton;
public var iEnd:int;// = 10
public var pPrevButton:PrevButton;
public function Leaderboard(){
iStart = 0;
iEnd = 10;
pRows = new Array();
super();
pNextButton = new NextButton();
pPrevButton = new PrevButton();
pLeaderLoader = new LeaderLoader();
addChild(pNextButton);
addChild(pPrevButton);
addChild(pLeaderLoader);
pLeaderLoader.x = (pLeaderLoader.y = 0);
pNextButton.x = 200;
pNextButton.y = 225;
pPrevButton.x = -100;
pPrevButton.y = 225;
pPrevButton.visible = false;
pNextButton.visible = false;
pPrevButton.addEventListener(MouseEvent.CLICK, Prev);
pNextButton.addEventListener(MouseEvent.CLICK, Next);
}
public function Load(_arg1:int, _arg2:int=0, _arg3:int=10):void{
pLeaderLoader.visible = true;
iLeaderID = _arg1;
WebStats.GetScores(_arg1, _arg2, _arg3, FinishLoad);
}
public function Next(_arg1:Event):void{
iStart = (iStart + 10);
if (iStart > 0){
pPrevButton.visible = true;
} else {
pPrevButton.visible = false;
};
Load(iLeaderID, iStart, 10);
RemoveRows();
}
public function FinishLoad(_arg1:Event):void{
var _local2:XMLDocument;
var _local3:Number;
var _local4:int;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:LeaderboardRow;
pLeaderLoader.visible = false;
_local2 = new XMLDocument();
_local2.ignoreWhite = true;
_local2.parseXML(WebStats.pScoresLoader.data);
_local3 = 0;
_local4 = (iStart + 1);
if (_local2.childNodes != null){
if (_local2.childNodes[0].childNodes != null){
_local5 = 1;
while (_local5 < _local2.childNodes[0].childNodes.length) {
if (((!((_local2.childNodes[0].childNodes[_local5].childNodes == null))) && ((_local2.childNodes[0].childNodes[_local5].childNodes.length == 2)))){
_local6 = _local2.childNodes[0].childNodes[_local5].childNodes[1].attributes.value;
_local7 = FormatScore(_local2.childNodes[0].childNodes[_local5].childNodes[0].attributes.value);
_local8 = new LeaderboardRow();
_local8.pScore.text = _local7;
_local8.pInitials.text = _local6;
_local8.pNumber.text = (_local4.toString() + ".");
_local8.x = 0;
_local8.y = _local3;
_local3 = (_local3 + (_local8.height * 1.1));
_local4++;
addChild(_local8);
pRows.push(_local8);
};
_local5++;
};
};
};
if (pRows.length >= 10){
pNextButton.visible = true;
} else {
pNextButton.visible = false;
};
}
public function Prev(_arg1:Event):void{
iStart = Math.max((iStart - 10), 0);
if (iStart > 0){
pPrevButton.visible = true;
} else {
pPrevButton.visible = false;
};
RemoveRows();
Load(iLeaderID, iStart, 10);
}
public function RemoveRows():void{
while (pRows.length > 0) {
removeChild(pRows[0]);
pRows.shift();
};
}
public function FormatScore(_arg1:Number):String{
return (_arg1.toString());
}
}
}//package TheBrain
Section 73
//LeaderboardRow (TheBrain.LeaderboardRow)
package TheBrain {
import flash.display.*;
import flash.text.*;
public dynamic class LeaderboardRow extends MovieClip {
public var pScore:TextField;
public var pInitials:TextField;
public var pNumber:TextField;
}
}//package TheBrain
Section 74
//MeatWall (TheBrain.MeatWall)
package TheBrain {
import flash.display.*;
public class MeatWall extends MovieClip {
private var pWallBMP:Bitmap;
public function MeatWall():void{
x = (TheBrainGame.screenWidth * 0.5);
y = (TheBrainGame.screenHeight * 0.5);
cacheAsBitmap = true;
}
public function Update():void{
}
}
}//package TheBrain
Section 75
//MiniEnergyBall (TheBrain.MiniEnergyBall)
package TheBrain {
import flash.display.*;
public dynamic class MiniEnergyBall extends MovieClip {
}
}//package TheBrain
Section 76
//NGButton (TheBrain.NGButton)
package TheBrain {
import flash.events.*;
import flash.display.*;
public class NGButton extends MovieClip {
public function NGButton():void{
buttonMode = true;
useHandCursor = true;
addEventListener(MouseEvent.CLICK, LoadNGSite);
}
public function LoadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
}
}//package TheBrain
Section 77
//PlayerCursor (TheBrain.PlayerCursor)
package TheBrain {
import flash.display.*;
public class PlayerCursor extends MovieClip {
public function PlayerCursor():void{
cacheAsBitmap = true;
}
}
}//package TheBrain
Section 78
//PlayerDeathSound (TheBrain.PlayerDeathSound)
package TheBrain {
import flash.media.*;
public dynamic class PlayerDeathSound extends Sound {
}
}//package TheBrain
Section 79
//ScoreHud (TheBrain.ScoreHud)
package TheBrain {
import TheBrain.BrainGuys.*;
import flash.display.*;
import flash.text.*;
import TheBrain.ParticleEffects.*;
public class ScoreHud extends MovieClip {
public var pLivesGT4:GT4Lives;
private var uLastTypeKilled:uint;// = 88888
private var iCurrChain:int;// = 1
public var pIcons:MovieClip;
public var pDashBar:DashBar;
public var score:TextField;
private var iScore:int;// = 0
public var pTimeDisplay:TimeDisplay;
private var iEnemiesKilledOfType:int;// = 0
public var pLivesLT4:MovieClip;
public var chaindisplay:TextField;
public function ScoreHud():void{
iScore = 0;
iCurrChain = 1;
iEnemiesKilledOfType = 0;
uLastTypeKilled = 88888;
super();
x = (TheBrainGame.screenWidth * 0.5);
y = (TheBrainGame.screenHeight * 0.5);
Reset();
pIcons.gotoAndStop(1);
SetLives(TheBrainGame.pEnergyBall.iLives);
if (TheBrainGame.pGame.gameMode == TheBrainGame.BOSSMODE){
pTimeDisplay.visible = true;
} else {
pTimeDisplay.visible = false;
};
}
public function GetScore():int{
return (iScore);
}
public function AddToScore(_arg1:int, _arg2:BrainGuy, _arg3:Boolean=true):void{
var _local4:uint;
_local4 = _arg2.GetType();
if ((((_local4 == uLastTypeKilled)) && ((iEnemiesKilledOfType > 0)))){
iEnemiesKilledOfType++;
if (iEnemiesKilledOfType >= 3){
IncrementChain(_arg2.x, _arg2.y);
iEnemiesKilledOfType = 0;
};
} else {
if (iEnemiesKilledOfType == 0){
iEnemiesKilledOfType = 1;
} else {
ResetChain();
};
};
uLastTypeKilled = _local4;
pIcons.gotoAndStop((uLastTypeKilled + 2));
if (_arg3 == true){
TheBrainGame.pGame.pBGEffects.AddChainPosition(_arg2.x, _arg2.y, _arg2.GetType());
};
iScore = (iScore + (_arg1 * iCurrChain));
score.text = iScore.toString();
}
public function Reset():void{
iScore = 0;
score.text = iScore.toString();
ResetChain();
}
public function SubtractFromScore(_arg1:int):void{
iScore = (iScore - _arg1);
iScore = Math.max(0, iScore);
score.text = iScore.toString();
}
public function IncrementChain(_arg1:int, _arg2:int):void{
iCurrChain++;
chaindisplay.text = iCurrChain.toString();
TheBrainGame.pGame.AddParticleEffect(new ChainEffect(_arg1, _arg2, iCurrChain));
}
public function AddToScoreNoChainAdjust(_arg1:int){
iScore = (iScore + (_arg1 * iCurrChain));
score.text = iScore.toString();
}
public function ResetChain():void{
uLastTypeKilled = 99999;
iEnemiesKilledOfType = 1;
iCurrChain = 1;
pIcons.gotoAndStop(1);
chaindisplay.text = iCurrChain.toString();
}
public function SetLives(_arg1:int):void{
if (_arg1 > 4){
pLivesLT4.visible = false;
pLivesGT4.visible = true;
pLivesGT4.pLivesNumber.text = _arg1.toString();
} else {
pLivesLT4.visible = true;
pLivesGT4.visible = false;
pLivesLT4.gotoAndStop(_arg1);
};
}
}
}//package TheBrain
Section 80
//ScrollCredits (TheBrain.ScrollCredits)
package TheBrain {
import flash.display.*;
public dynamic class ScrollCredits extends MovieClip {
public var pUnlock:UnlockScreen;
public function ScrollCredits(){
addFrameScript(0, frame1, 1684, frame1685, 1697, frame1698);
}
function frame1(){
pUnlock.gotoAndStop(1);
}
function frame1685(){
pUnlock.gotoAndPlay("showunlock");
}
function frame1698(){
stop();
}
}
}//package TheBrain
Section 81
//ShotSound1 (TheBrain.ShotSound1)
package TheBrain {
import flash.media.*;
public dynamic class ShotSound1 extends Sound {
}
}//package TheBrain
Section 82
//ShotSound2 (TheBrain.ShotSound2)
package TheBrain {
import flash.media.*;
public dynamic class ShotSound2 extends Sound {
}
}//package TheBrain
Section 83
//SpermSound (TheBrain.SpermSound)
package TheBrain {
import flash.media.*;
public dynamic class SpermSound extends Sound {
}
}//package TheBrain
Section 84
//TakeDamageSound (TheBrain.TakeDamageSound)
package TheBrain {
import flash.media.*;
public dynamic class TakeDamageSound extends Sound {
}
}//package TheBrain
Section 85
//TeleportSound (TheBrain.TeleportSound)
package TheBrain {
import flash.media.*;
public dynamic class TeleportSound extends Sound {
}
}//package TheBrain
Section 86
//TheBrainGame (TheBrain.TheBrainGame)
package TheBrain {
import flash.events.*;
import TheBrain.BrainGuys.*;
import flash.display.*;
import flash.text.*;
import TheBrain.ParticleEffects.*;
import TheBrain.Bullets.*;
import flash.media.*;
import PillowFort.FlashJoystick.*;
import flash.filters.*;
import flash.ui.*;
public class TheBrainGame extends MovieClip {
public const totalNumGuys:int = 8;
public var pScore:ScoreHud;
private var pParticles:Array;
public var pTimelineMC:MovieClip;
public var pGridSprite:Sprite;
public var pFPS:TextField;
public var pEnergyBallLayer:MovieClip;
private var uSpawnsDone:uint;// = 0
public var fTotalTime:Number;// = 0
private var bUnPauseToMenu:Boolean;// = false
public var fFadeAlpha:Number;// = 0
private var uSpawningTimer:uint;// = 0
public var lastframe:Number;// = 0
public var frames:Number;// = 0
public var pBGEffects:BGEffects;
public var gameMode:int;
public var fBlurAmount:Number;// = 0
public var bFadeOutColor:Boolean;// = false
private var iShakeAmount:int;// = 10
public var pSpermBullets:MovieClip;
public var pBulletLayer:MovieClip;
private var uPauseTime:uint;// = 0
private var iShakeFrames:uint;// = 0
public var fBlurDecrement:Number;// = 0
public var pGuys:Array;
public var pBossBulletLayer:MovieClip;
public var pBullets:Array;
public var pBossLayer:MovieClip;
public var pGuyLayer:MovieClip;
public var pBossParticleLayer:MovieClip;
public var bFadeInColor:Boolean;// = false
public var pPauseLayer:MovieClip;
private var uWaitTimeInMS:uint;// = 1000
public var uRumbleFrames:int;// = 0
public var pFadeLayer:MovieClip;
public var pBGParticleLayer:Sprite;
public var pLaserLayer:MovieClip;
public var pParticleLayer:MovieClip;
public var bShouldUpdate:Boolean;// = true
public var pWaveManager:WaveManager;
public var iFadeColor:int;// = 0
public static const screenWidth:int = 640;
public static const ENDLESSMODE:int = 3;
public static const EXPERTMODE:int = 1;
public static const BOSSMODE:int = 2;
public static const NORMALMODE:int = 0;
public static const screenHeight:int = 480;
public static var pGame:TheBrainGame = null;
public static var pMeatWall:MeatWall = null;
public static var pUpgrade:Upgrades;
public static var bShowDebug:Boolean = false;
public static var pCursor:PlayerCursor = null;
public static var pBGMusic:Sound = null;
public static var pBGMusicChannel:SoundChannel = null;
public static var pEnergyBall:EnergyBall = null;
public static var pBackground:BrainBG = null;
public function TheBrainGame(_arg1:int):void{
pGuys = new Array();
pParticles = new Array();
pBullets = new Array();
uWaitTimeInMS = 1000;
uSpawningTimer = 0;
uSpawnsDone = 0;
lastframe = 0;
frames = 0;
fTotalTime = 0;
pWaveManager = new WaveManager();
pGuyLayer = new MovieClip();
pParticleLayer = new MovieClip();
pBulletLayer = new MovieClip();
pLaserLayer = new MovieClip();
pEnergyBallLayer = new MovieClip();
pBGParticleLayer = new Sprite();
pSpermBullets = new MovieClip();
pPauseLayer = new MovieClip();
pBossLayer = new MovieClip();
pBossBulletLayer = new MovieClip();
pBossParticleLayer = new MovieClip();
pFadeLayer = new MovieClip();
pBGEffects = new BGEffects();
bFadeInColor = false;
bFadeOutColor = false;
iFadeColor = 0;
fFadeAlpha = 0;
uRumbleFrames = 0;
fBlurDecrement = 0;
fBlurAmount = 0;
uPauseTime = 0;
iShakeFrames = 0;
iShakeAmount = 10;
bUnPauseToMenu = false;
bShouldUpdate = true;
pFPS = new TextField();
super();
pGame = this;
gameMode = _arg1;
switch (_arg1){
case NORMALMODE:
WebStats.HitStats(WebStats.PLAYEDNORMALSTAT);
break;
case EXPERTMODE:
WebStats.HitStats(WebStats.PLAYEDEXPERTSTAT);
break;
case BOSSMODE:
WebStats.HitStats(WebStats.PLAYEDBOSSTIMEATTACKSTAT);
break;
case ENDLESSMODE:
WebStats.HitStats(WebStats.PLAYEDENDLESSSTAT);
break;
};
}
public function ShouldSpawnGuys():int{
if (uSpawningTimer > (uWaitTimeInMS * 0.75)){
pEnergyBall.visible = true;
};
if ((((uSpawningTimer > uWaitTimeInMS)) && ((pGuys.length == 0)))){
uSpawnsDone++;
return (Math.round((Math.random() * Math.min(10, (Math.random() * uSpawnsDone)))));
};
return (0);
}
public function DestroyEverything(){
removeEventListener(Event.ENTER_FRAME, Update);
stage.removeEventListener(KeyboardEvent.KEY_UP, pEnergyBall.MoveWithKeyboardUp);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, pEnergyBall.MoveWithKeyboardDown);
pUpgrade = null;
pEnergyBall = null;
pBackground = null;
pMeatWall = null;
if (pBGMusicChannel != null){
pBGMusicChannel.stop();
};
pBGMusicChannel = null;
pBGMusic = null;
pGame = null;
}
public function BackToMenu():void{
bShouldUpdate = false;
MovieClip(pTimelineMC.root).gotoAndStop("menustart");
DestroyEverything();
stage.removeChild(this);
}
public function BringEnergyBallUpFront():void{
}
public function CreateGuy(_arg1:BrainGuy, _arg2:Door):void{
if (_arg1 != null){
pGuys.push(_arg1);
if (_arg1.GetType() == BrainGuy.BOSS){
pBossLayer.addChild(_arg1);
} else {
pGuyLayer.addChild(_arg1);
};
};
}
public function AddScore(_arg1:int, _arg2:BrainGuy):void{
pScore.AddToScore(_arg1, _arg2);
}
public function AddParticleEffect(_arg1:BaseParticleEffect):void{
pParticles.push(_arg1);
pParticleLayer.addChild(_arg1);
BringEnergyBallUpFront();
}
public function ReplayGame():void{
bShouldUpdate = false;
DestroyEverything();
stage.removeChild(this);
MovieClip(pTimelineMC.root).gotoAndPlay("begingame");
}
private function UpdateBullets():void{
var _local1:int;
var _local2:Bullet;
pBulletLayer.graphics.clear();
pBossBulletLayer.graphics.clear();
pBulletLayer.graphics.lineStyle(2, 0, 1);
pBossBulletLayer.graphics.lineStyle(2, 0, 1);
_local1 = 0;
while (_local1 < pBullets.length) {
pBullets[_local1].Update();
if (pBullets[_local1].ShouldDestroy() == true){
_local2 = pBullets[_local1];
if (_local2.bBossBullet == false){
pBulletLayer.removeChild(_local2);
} else {
pBossBulletLayer.removeChild(_local2);
};
pBullets.splice(_local1, 1);
_local1 = Math.max(0, (_local1 - 1));
} else {
if (pBullets[_local1].bBossBullet == false){
pBulletLayer.graphics.beginFill(pBullets[_local1].iColor, 1);
pBulletLayer.graphics.drawCircle(pBullets[_local1].vPos.x, pBullets[_local1].vPos.y, (pBullets[_local1].scaleX * 3));
} else {
pBossBulletLayer.graphics.beginFill(pBullets[_local1].iColor, 1);
pBossBulletLayer.graphics.drawCircle(pBullets[_local1].vPos.x, pBullets[_local1].vPos.y, (pBullets[_local1].scaleX * 3));
};
};
_local1++;
};
pBulletLayer.graphics.endFill();
pBossBulletLayer.graphics.endFill();
}
public function KillEnergyBall():void{
var _local1:int;
pScore.ResetChain();
SetShake(15, 2);
JoystickUtils.Rumble(1, 100, 100);
uRumbleFrames = 15;
_local1 = 0;
while (_local1 < pGuys.length) {
pGuys[_local1].Kill();
_local1++;
};
_local1 = 0;
while (_local1 < pBullets.length) {
pBullets[_local1].Destroy();
_local1++;
};
AddParticleEffect(new PlayerDestroy(pEnergyBall.x, pEnergyBall.y));
uSpawningTimer = 0;
pEnergyBall.Kill();
pBGEffects.ResetBG();
pEnergyBall.visible = false;
}
public function PauseGame(_arg1:Boolean, _arg2:Boolean=true, _arg3:Boolean=false):void{
if ((((gameMode == ENDLESSMODE)) || ((gameMode == BOSSMODE)))){
_arg2 = false;
};
if (_arg1 == true){
Pause(4294967295);
pUpgrade.Pause(_arg2);
pUpgrade.DeterminePurchasableItems();
bUnPauseToMenu = _arg3;
if (_arg3 == true){
switch (gameMode){
case NORMALMODE:
WebStats.SubmitScore(WebStats.NORMALLEADERBOARD, pScore.GetScore());
break;
case EXPERTMODE:
WebStats.SubmitScore(WebStats.EXPERTLEADERBOARD, pScore.GetScore());
break;
case ENDLESSMODE:
WebStats.SubmitScore(WebStats.ENDLESSLEADERBOARD, pScore.GetScore());
break;
};
};
} else {
if (bUnPauseToMenu == true){
BackToMenu();
} else {
Pause(0);
pUpgrade.UnPause();
};
};
}
public function Update(_arg1:Event):void{
var _local2:Date;
var _local3:Number;
var _local4:Number;
var _local5:Array;
if (bShouldUpdate == false){
return;
};
pUpgrade.Update();
if ((((bFadeInColor == true)) || ((bFadeOutColor == true)))){
pFadeLayer.graphics.clear();
pFadeLayer.graphics.beginFill(iFadeColor, fFadeAlpha);
pFadeLayer.graphics.drawRect(0, 0, screenWidth, screenHeight);
pFadeLayer.graphics.endFill();
if (bFadeInColor == true){
fFadeAlpha = (fFadeAlpha + 0.01);
bFadeInColor = (fFadeAlpha <= 1);
} else {
if (bFadeOutColor == true){
fFadeAlpha = (fFadeAlpha - 0.01);
bFadeOutColor = (fFadeAlpha >= 0);
};
};
};
if (uRumbleFrames > 0){
uRumbleFrames--;
} else {
if (uRumbleFrames == 0){
JoystickUtils.Rumble(1, 0, 0);
uRumbleFrames = -1;
};
};
if (uPauseTime > 0){
uPauseTime--;
return;
};
if (iShakeFrames == 0){
x = (y = 0);
} else {
if ((iShakeFrames % 2) == 0){
x = iShakeAmount;
} else {
x = -(iShakeAmount);
};
iShakeFrames--;
};
if (fBlurAmount > 0){
_local5 = new Array(new BlurFilter(fBlurAmount, fBlurAmount));
fBlurAmount = (fBlurAmount - fBlurDecrement);
filters = _local5;
} else {
if (filters.length > 0){
filters = new Array();
};
};
uSpawningTimer++;
if (uSpawningTimer > 45){
if (pEnergyBall.visible == false){
AddParticleEffect(new PlayerAppear(pEnergyBall.x, pEnergyBall.y));
};
pEnergyBall.visible = true;
};
_local2 = new Date();
_local3 = _local2.getTime();
pEnergyBall.CalculateSpring();
pEnergyBall.Update();
pBackground.Update();
pMeatWall.Update();
UpdateBullets();
UpdateParticles();
pSpermBullets.graphics.clear();
pLaserLayer.graphics.clear();
UpdateGuys();
pLaserLayer.graphics.endFill();
pSpermBullets.graphics.endFill();
EnemyOnEnemyDetection();
pBGEffects.Update();
if (Boss.pBoss != null){
Boss.pBoss.Update();
};
_local4 = (_local3 - lastframe);
fTotalTime = (fTotalTime + _local4);
frames++;
if (fTotalTime >= 1000){
fTotalTime = 0;
pFPS.text = frames.toString();
pFPS.textColor = 4278190335;
frames = 0;
};
lastframe = _local3;
pFPS.visible = true;
pWaveManager.Update();
}
public function VictoryScreen(_arg1:int=0):void{
var _local2:*;
bFadeInColor = true;
iFadeColor = 0;
fFadeAlpha = 0;
_local2 = new ScrollCredits();
_local2.x = (screenWidth * 0.5);
_local2.y = (100 + (_local2.height * 0.5));
switch (_arg1){
case 0:
_local2.pUnlock.strUnlockName = "EXPERT";
break;
case 1:
_local2.pUnlock.strUnlockName = "BOSS";
break;
default:
_local2.pUnlock.strUnlockName = "ENDLESS";
break;
};
pFadeLayer.addChild(_local2);
}
public function AddBullet(_arg1:Bullet):void{
pBullets.push(_arg1);
if (_arg1.bBossBullet == false){
pBulletLayer.addChild(_arg1);
} else {
pBossBulletLayer.addChild(_arg1);
};
BringEnergyBallUpFront();
}
private function UpdateGuys():void{
var _local1:int;
var _local2:BrainGuy;
_local1 = 0;
while (_local1 < pGuys.length) {
pGuys[_local1].Update();
if (pGuys[_local1].ShouldDestroy() == true){
_local2 = pGuys[_local1];
if (pGuys[_local1].GetType() == BrainGuy.BOSS){
pBossLayer.removeChild(_local2);
} else {
pGuyLayer.removeChild(_local2);
};
pGuys.splice(_local1, 1);
_local1 = Math.max(0, (_local1 - 1));
};
_local1++;
};
}
private function EnemyOnEnemyDetection():void{
var _local1:int;
var _local2:int;
var _local3:Vector;
var _local4:Number;
var _local5:Number;
_local1 = 0;
while (_local1 < pGuys.length) {
_local2 = (_local1 + 1);
while (_local2 < pGuys.length) {
if (pGuys[_local1].IsOverlappingEnemy(pGuys[_local2]) == true){
_local3 = pGuys[_local1].vPos.subtract(pGuys[_local2].vPos);
_local4 = _local3.length();
_local5 = (((pGuys[_local1].GetEnemyOverlapRadius() + pGuys[_local2].GetEnemyOverlapRadius()) - _local4) * 0.5);
if (_local4 > 0){
_local3 = _local3.multiply((1 / _local4));
};
_local3 = _local3.multiply(_local5);
if (pGuys[_local1].bStationary == true){
pGuys[_local2].vPos = pGuys[_local2].vPos.subtract(_local3.multiply(2));
} else {
if ((((pGuys[_local2].bStationary == false)) && ((pGuys[_local1].bStationary == false)))){
pGuys[_local1].vPos = pGuys[_local1].vPos.add(_local3);
pGuys[_local2].vPos = pGuys[_local2].vPos.subtract(_local3);
};
};
};
_local2++;
};
_local1++;
};
}
public function GetNumGuys():uint{
return (pGuys.length);
}
public function IsPaused():Boolean{
return ((uPauseTime > 0));
}
private function UpdateWorldObjectList(_arg1:Array, _arg2:MovieClip):void{
var _local3:int;
var _local4:WorldObject;
_local3 = 0;
while (_local3 < _arg1.length) {
_arg1[_local3].Update();
if (_arg1[_local3].ShouldDestroy() == true){
_local4 = _arg1[_local3];
_arg2.removeChild(_local4);
_arg1.splice(_local3, 1);
_local3 = Math.max(0, (_local3 - 1));
};
_local3++;
};
}
public function SetGuyVisibility(_arg1:Boolean):void{
var _local2:int;
_local2 = 0;
while (_local2 < pGuys.length) {
pGuys[_local2].visible = _arg1;
_local2++;
};
}
public function DebugConsole(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.SHIFT){
bShowDebug = !(bShowDebug);
};
}
public function Initialize():void{
var _local1:int;
var _local2:Array;
addEventListener(Event.ENTER_FRAME, Update);
pEnergyBall = new EnergyBall();
pMeatWall = new MeatWall();
pBackground = new BrainBG();
stage.addEventListener(KeyboardEvent.KEY_DOWN, pEnergyBall.MoveWithKeyboardDown);
stage.addEventListener(KeyboardEvent.KEY_UP, pEnergyBall.MoveWithKeyboardUp);
_local1 = 0;
while (_local1 < 2) {
_local1++;
};
if (gameMode != BOSSMODE){
pBGMusic = new BackgroundMusic();
pBGMusicChannel = pBGMusic.play(0, 999999);
};
pFPS.x = 0;
pFPS.y = 0;
pScore = new ScoreHud();
addChild(pBackground);
addChild(pMeatWall);
addChild(pBGEffects);
addChild(pSpermBullets);
addChild(pGuyLayer);
addChild(pLaserLayer);
addChild(pBulletLayer);
addChild(pBossLayer);
addChild(pBossBulletLayer);
addChild(pParticleLayer);
addChild(pBossParticleLayer);
addChild(pEnergyBallLayer);
addChild(pPauseLayer);
addChild(pScore);
addChild(pFadeLayer);
pPauseLayer.graphics.beginFill(0, 0.85);
pPauseLayer.graphics.drawRect(0, 0, screenWidth, screenHeight);
pPauseLayer.graphics.endFill();
pPauseLayer.visible = false;
pUpgrade = new Upgrades();
pUpgrade.x = (screenWidth * 0.5);
pUpgrade.y = (screenHeight * 0.5);
pPauseLayer.addChild(pUpgrade);
_local2 = pSpermBullets.filters;
_local2.push(new GlowFilter(0, 1, 2, 2, 1000));
_local2.push(new BlurFilter(1, 1));
pSpermBullets.filters = _local2;
stage.quality = StageQuality.MEDIUM;
trace(parent.numChildren);
}
public function ResetGame():void{
bShouldUpdate = false;
DestroyEverything();
stage.removeChild(this);
MovieClip(pTimelineMC.root).gotoAndPlay("ngfadein");
}
private function UpdateParticles():void{
var _local1:int;
var _local2:BaseParticleEffect;
_local1 = 0;
while (_local1 < pParticles.length) {
pParticles[_local1].Update();
if (pParticles[_local1].ShouldDestroy() == true){
_local2 = pParticles[_local1];
pParticleLayer.removeChild(_local2);
pParticles.splice(_local1, 1);
_local1 = Math.max(0, (_local1 - 1));
};
_local1++;
};
}
public function Pause(_arg1:uint):void{
uPauseTime = _arg1;
}
public function SetShake(_arg1:int, _arg2:int):void{
iShakeFrames = _arg1;
iShakeAmount = _arg2;
}
public function EnergyBallHitEffect(_arg1:uint, _arg2:Number):void{
fBlurDecrement = (_arg2 / _arg1);
fBlurAmount = _arg2;
}
public static function DetermineOffset(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return ((((_arg1 + _arg2) * 0.5) - Math.abs(_arg3)));
}
public static function lerp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (((_arg1 * (1 - _arg3)) + (_arg2 * _arg3)));
}
}
}//package TheBrain
Section 87
//TimeDisplay (TheBrain.TimeDisplay)
package TheBrain {
import flash.display.*;
import flash.text.*;
public dynamic class TimeDisplay extends MovieClip {
public var time:TextField;
}
}//package TheBrain
Section 88
//TrinitySound (TheBrain.TrinitySound)
package TheBrain {
import flash.media.*;
public dynamic class TrinitySound extends Sound {
}
}//package TheBrain
Section 89
//UpgradeButton (TheBrain.UpgradeButton)
package TheBrain {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
public class UpgradeButton extends MovieClip {
public var pGraphic:MovieClip;// = null
public var bEnabled:Boolean;// = true
public var fnClick:Function;
public function UpgradeButton():void{
pGraphic = null;
bEnabled = true;
super();
buttonMode = true;
useHandCursor = true;
gotoAndStop(1);
addEventListener(MouseEvent.CLICK, ClickFunction);
addEventListener(MouseEvent.MOUSE_OVER, Over);
addEventListener(MouseEvent.MOUSE_OUT, Out);
}
public function Over(_arg1:Event){
gotoAndStop(2);
}
public function Out(_arg1:Event){
gotoAndStop(1);
}
public function Init(_arg1:MovieClip, _arg2:Function):void{
var _local3:Point;
_local3 = new Point((_arg1.x - x), (_arg1.y - y));
addChild(_arg1);
pGraphic = _arg1;
fnClick = _arg2;
pGraphic.x = _local3.x;
pGraphic.y = _local3.y;
}
public function MaxedOut():void{
bEnabled = false;
}
public function ClickFunction(_arg1:MouseEvent):void{
if (bEnabled == true){
fnClick.apply(this);
};
}
public function Enable():void{
bEnabled = true;
transform.colorTransform = new ColorTransform();
}
public function Disable():void{
bEnabled = false;
transform.colorTransform = new ColorTransform(0.5, 0.5, 0.5);
}
}
}//package TheBrain
Section 90
//Upgrades (TheBrain.Upgrades)
package TheBrain {
import flash.geom.*;
import flash.display.*;
import flash.text.*;
import flash.media.*;
public class Upgrades extends MovieClip {
public var pUpgradePanel:MovieClip;
private var pShieldUpgrade:Array;
private var pSizeUpgrade:Array;
private var fAlphaOffset:Number;// = 0
public var pMessage:MovieClip;
private var iShieldLevel:int;// = 0
private var pBoostUpgrade:Array;
private var fAlpha:Number;// = 0
private var iSizeLevel:int;// = 0
private var fAlphaMax:Number;// = 0
private var pOneUpUpgrade:Array;
private var iBoostLevel:int;// = 0
public function Upgrades():void{
pBoostUpgrade = new Array(new Array(2500, 3), new Array(5000, 3.5), new Array(10000, 4));
pSizeUpgrade = new Array(new Array(6000, 16), new Array(12000, 20), new Array(24000, 25));
pShieldUpgrade = new Array(new Array(7500, 2), new Array(15000, 3), new Array(30000, 4));
pOneUpUpgrade = new Array(new Array(20000, 1));
iBoostLevel = 0;
iSizeLevel = 0;
iShieldLevel = 0;
fAlpha = 0;
fAlphaOffset = 0;
fAlphaMax = 0;
super();
pUpgradePanel.pOneUpButton.Init(pUpgradePanel.pOneUpDisplay, UpgradeOneUp);
pUpgradePanel.pOptionButton.Init(pUpgradePanel.pOptionDisplay, UpgradeSize);
pUpgradePanel.pBoostButton.Init(pUpgradePanel.pBoostDisplay, UpgradeBoost);
pUpgradePanel.pShieldButton.Init(pUpgradePanel.pShieldDisplay, UpgradeSheild);
pUpgradePanel.pOneUpDisplay.gotoAndStop(1);
pUpgradePanel.pOptionDisplay.gotoAndStop(1);
pUpgradePanel.pBoostDisplay.gotoAndStop(1);
pUpgradePanel.pShieldDisplay.gotoAndStop(1);
pMessage.gotoAndStop(1);
}
public function GameOver():void{
pUpgradePanel.visible = false;
pMessage.gotoAndStop(6);
}
public function UpgradeBoost():void{
var _local1:Sound;
_local1 = new UpgradeSound();
_local1.play();
TheBrainGame.pEnergyBall.UpgradeBoost(pBoostUpgrade[iBoostLevel][1]);
TheBrainGame.pGame.pScore.SubtractFromScore(pBoostUpgrade[iBoostLevel][0]);
iBoostLevel++;
pUpgradePanel.pBoostDisplay.gotoAndStop((pUpgradePanel.pBoostDisplay.currentFrame + 1));
DeterminePurchasableItems();
}
public function UpgradeSheild():void{
var _local1:Sound;
_local1 = new UpgradeSound();
_local1.play();
TheBrainGame.pEnergyBall.UpgradeSheild(pShieldUpgrade[iShieldLevel][1]);
TheBrainGame.pGame.pScore.SubtractFromScore(pShieldUpgrade[iShieldLevel][0]);
pUpgradePanel.pShieldDisplay.gotoAndStop((pUpgradePanel.pShieldDisplay.currentFrame + 1));
iShieldLevel++;
DeterminePurchasableItems();
}
public function UpgradeSize():void{
var _local1:Sound;
_local1 = new UpgradeSound();
_local1.play();
TheBrainGame.pEnergyBall.UpgradeSize(pSizeUpgrade[iSizeLevel][1]);
TheBrainGame.pGame.pScore.SubtractFromScore(pSizeUpgrade[iSizeLevel][0]);
iSizeLevel++;
pUpgradePanel.pOptionDisplay.gotoAndStop((pUpgradePanel.pOptionDisplay.currentFrame + 1));
DeterminePurchasableItems();
}
public function UpgradeOneUp():void{
var _local1:Sound;
_local1 = new UpgradeSound();
_local1.play();
TheBrainGame.pGame.pScore.SubtractFromScore(pOneUpUpgrade[0][0]);
TheBrainGame.pEnergyBall.AdjustLives(1);
DeterminePurchasableItems();
}
public function Reset():void{
pUpgradePanel.visible = true;
iBoostLevel = (iSizeLevel = (iShieldLevel = 0));
}
public function SetLevel(_arg1:uint):void{
pMessage.gotoAndStop((_arg1 + 1));
}
public function DeterminePurchasableItems():void{
var _local1:int;
_local1 = TheBrainGame.pGame.pScore.GetScore();
DetermineUpgradeState(pUpgradePanel.pOneUpButton, _local1, pOneUpUpgrade, 0, pUpgradePanel.pOneUpCost);
DetermineUpgradeState(pUpgradePanel.pOptionButton, _local1, pSizeUpgrade, iSizeLevel, pUpgradePanel.pOptionCost);
DetermineUpgradeState(pUpgradePanel.pBoostButton, _local1, pBoostUpgrade, iBoostLevel, pUpgradePanel.pBoostCost);
DetermineUpgradeState(pUpgradePanel.pShieldButton, _local1, pShieldUpgrade, iShieldLevel, pUpgradePanel.pShieldCost);
}
public function DetermineUpgradeState(_arg1:UpgradeButton, _arg2:int, _arg3:Array, _arg4:int, _arg5:TextField):void{
if (_arg3.length > _arg4){
if (_arg3[_arg4][0] <= _arg2){
_arg1.Enable();
} else {
_arg1.Disable();
};
_arg5.text = _arg3[_arg4][0].toString();
} else {
_arg1.MaxedOut();
_arg5.text = "Maxed";
};
}
public function Boss():void{
pUpgradePanel.visible = false;
pMessage.gotoAndStop(7);
}
public function UnPause():void{
fAlphaMax = 0;
fAlphaOffset = -0.15;
fAlpha = 1;
TheBrainGame.pGame.pPauseLayer.visible = true;
}
public function Pause(_arg1:Boolean):void{
pUpgradePanel.visible = _arg1;
fAlphaMax = 1;
fAlphaOffset = 0.15;
fAlpha = 0;
TheBrainGame.pGame.pPauseLayer.visible = true;
}
public function Update():void{
TheBrainGame.pGame.pPauseLayer.transform.colorTransform = new ColorTransform(1, 1, 1, fAlpha);
if (fAlphaOffset < 0){
fAlpha = Math.max((fAlpha + fAlphaOffset), fAlphaMax);
} else {
fAlpha = Math.min((fAlpha + fAlphaOffset), fAlphaMax);
};
if (fAlpha == 0){
TheBrainGame.pGame.pPauseLayer.visible = false;
};
}
}
}//package TheBrain
Section 91
//Wave (TheBrain.Wave)
package TheBrain {
public class Wave {
public var bSwitchOverOnClear:Boolean;// = false
public var pDoorIndices:Array;
public var fLifeTimeInSeconds:Number;// = 0
public var pGuyIndices:Array;
public var bSwitchBGOnClear:Boolean;// = false
public var uEndWaveUpgradeIndex:uint;// = 4294967295
public var bBoss:Boolean;// = false
public function Wave():void{
fLifeTimeInSeconds = 0;
bSwitchOverOnClear = false;
bSwitchBGOnClear = false;
uEndWaveUpgradeIndex = 4294967295;
bBoss = false;
super();
}
}
}//package TheBrain
Section 92
//WaveManager (TheBrain.WaveManager)
package TheBrain {
import flash.geom.*;
import TheBrain.BrainGuys.*;
public class WaveManager {
private var pCurrentWave:Wave;
private var numEndlessSpawns:int;// = 0
private var fCurrentWait:Number;// = 0
private var pWaves:Array;
private var bSwitchOnClear:Boolean;// = false
private var iMaxRandomIndex:int;// = 1
private var iWaveWaitFrames:int;// = 0
private var iScreenIndex:int;// = 0
private var bBossSpawned:Boolean;// = false
private var maxOnScreen:int;// = 6
private var iIndex:int;// = 0
public function WaveManager():void{
var _local1:Wave;
pWaves = new Array();
fCurrentWait = 0;
bSwitchOnClear = false;
iScreenIndex = 0;
iWaveWaitFrames = 0;
numEndlessSpawns = 0;
maxOnScreen = 6;
iMaxRandomIndex = 1;
bBossSpawned = false;
iIndex = 0;
super();
_local1 = null;
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.PETEY, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
_local1.uEndWaveUpgradeIndex = 0;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.PETEY, 9));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.COREY, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.COREY, 6), new Array(BrainGuy.PETEY, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.SPERM, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.SPERM, 6), new Array(BrainGuy.PETEY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 600;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.SPERM, 6), new Array(BrainGuy.PETEY, 3), new Array(BrainGuy.COREY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 600;
_local1.bSwitchOverOnClear = true;
_local1.bSwitchBGOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.FATTY, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 600;
_local1.bSwitchOverOnClear = true;
_local1.uEndWaveUpgradeIndex = 1;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.FATTY, 6), new Array(BrainGuy.SPERM, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.FATTY, 6), new Array(BrainGuy.COREY, 3), new Array(BrainGuy.PETEY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.CRAIG, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.CRAIG, 6), new Array(BrainGuy.SPERM, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.CRAIG, 6), new Array(BrainGuy.SPERM, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.CRAIG, 3), new Array(BrainGuy.SPERM, 3), new Array(BrainGuy.COREY, 3), new Array(BrainGuy.FATTY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
_local1.bSwitchBGOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.DANIEL, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
_local1.uEndWaveUpgradeIndex = 2;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.DANIEL, 6), new Array(BrainGuy.SPERM, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.DANIEL, 6), new Array(BrainGuy.FATTY, 3), new Array(BrainGuy.PETEY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.STANLEY, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.STANLEY, 6), new Array(BrainGuy.FATTY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.STANLEY, 3), new Array(BrainGuy.PETEY, 3), new Array(BrainGuy.COREY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.DANIEL, 3), new Array(BrainGuy.STANLEY, 3), new Array(BrainGuy.CRAIG, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
_local1.bSwitchBGOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.TELEPORTER, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
_local1.uEndWaveUpgradeIndex = 3;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.TELEPORTER, 6), new Array(BrainGuy.DANIEL, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.TELEPORTER, 6), new Array(BrainGuy.FATTY, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.JAMES, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.JAMES, 6), new Array(BrainGuy.PETEY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.JAMES, 6), new Array(BrainGuy.STANLEY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.TELEPORTER, 6), new Array(BrainGuy.SPERM, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
_local1.bSwitchBGOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.JORDAN, 6));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
_local1.uEndWaveUpgradeIndex = 4;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.JORDAN, 6), new Array(BrainGuy.SPERM, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.JAMES, 6), new Array(BrainGuy.SPERM, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.TELEPORTER, 12));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.JAMES, 6), new Array(BrainGuy.COREY, 3), new Array(BrainGuy.PETEY, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 60;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.CRAIG, 3), new Array(BrainGuy.COREY, 3), new Array(BrainGuy.FATTY, 3), new Array(BrainGuy.TELEPORTER, 3));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 6000;
_local1.bSwitchOverOnClear = true;
pWaves.push(_local1);
_local1 = new Wave();
_local1.pGuyIndices = new Array(new Array(BrainGuy.BOSS, 1));
_local1.pDoorIndices = new Array(0, 1, 2, 3, 0, 1, 2);
_local1.fLifeTimeInSeconds = 6000;
_local1.bSwitchOverOnClear = true;
_local1.uEndWaveUpgradeIndex = 5;
_local1.bBoss = true;
pWaves.push(_local1);
}
public function CreateNewGuy(_arg1:uint, _arg2:uint):void{
var _local3:BrainGuy;
var _local4:Boolean;
var _local5:Point;
var _local6:Door;
var _local7:Number;
_local3 = null;
_local4 = false;
switch (_arg1){
case BrainGuy.PETEY:
_local3 = new Petey();
break;
case BrainGuy.CRAIG:
_local3 = new Craig();
break;
case BrainGuy.JAMES:
_local3 = new James();
break;
case BrainGuy.STANLEY:
_local3 = new Stanley();
break;
case BrainGuy.COREY:
_local3 = new Corey();
break;
case BrainGuy.RANDAL:
_local3 = new Randal();
break;
case BrainGuy.JORDAN:
_local3 = new Jordan();
break;
case BrainGuy.TELEPORTER:
_local3 = new Teleporter();
break;
case BrainGuy.FATTY:
_local3 = new Fatty();
break;
case BrainGuy.SPERM:
_local3 = new Sperm();
break;
case BrainGuy.DANIEL:
_local3 = new Daniel();
break;
case BrainGuy.BOSS:
_local4 = true;
break;
default:
_local3 = new Petey();
break;
};
if (_local4 == true){
new Boss();
return;
};
_local7 = (((2 * Math.PI) * 2) * (Math.random() - 0.5));
_local5 = new Point((Math.sin(_local7) * (TheBrainGame.screenWidth + 100)), (Math.cos(_local7) * (TheBrainGame.screenWidth + 100)));
_local3.SetPosition(_local5.x, _local5.y);
TheBrainGame.pGame.CreateGuy(_local3, _local6);
}
public function Update():void{
var _local1:int;
var _local2:int;
if ((((TheBrainGame.pGame.gameMode == TheBrainGame.NORMALMODE)) || ((TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE)))){
if (iWaveWaitFrames > 0){
iWaveWaitFrames--;
if (iWaveWaitFrames == 0){
NextWave(true);
iWaveWaitFrames = 0;
return;
};
} else {
fCurrentWait = (fCurrentWait - (1 / 30));
if ((((bSwitchOnClear == true)) && ((TheBrainGame.pGame.GetNumGuys() == 0)))){
NextWave();
} else {
if ((((bSwitchOnClear == false)) && ((fCurrentWait <= 0)))){
NextWave();
};
};
};
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.ENDLESSMODE){
if ((TheBrainGame.pGame.GetNumGuys() + 3) <= maxOnScreen){
_local1 = Math.round((Math.random() * iMaxRandomIndex));
switch (_local1){
case 0:
_local1 = BrainGuy.PETEY;
break;
case 1:
_local1 = BrainGuy.COREY;
break;
case 2:
_local1 = BrainGuy.FATTY;
break;
case 3:
_local1 = BrainGuy.CRAIG;
break;
case 4:
_local1 = BrainGuy.SPERM;
break;
case 5:
_local1 = BrainGuy.TELEPORTER;
break;
case 6:
_local1 = BrainGuy.JAMES;
break;
case 7:
_local1 = BrainGuy.STANLEY;
break;
case 8:
_local1 = BrainGuy.DANIEL;
break;
case 9:
_local1 = BrainGuy.JORDAN;
break;
default:
_local1 = ((Math.round(Math.random()))>0.5) ? BrainGuy.PETEY : BrainGuy.COREY;
break;
};
_local2 = 0;
while (_local2 < 3) {
CreateNewGuy(_local1, 0);
_local2++;
};
numEndlessSpawns++;
if ((numEndlessSpawns % 30) == 0){
maxOnScreen = (maxOnScreen + 3);
};
if ((numEndlessSpawns % 10) == 0){
iMaxRandomIndex = Math.min((iMaxRandomIndex + 1), 15);
};
};
} else {
if (TheBrainGame.pGame.gameMode == TheBrainGame.BOSSMODE){
if (bBossSpawned == false){
CreateNewGuy(BrainGuy.BOSS, 0);
bBossSpawned = true;
};
};
};
};
}
public function NextWave(_arg1:Boolean=false):void{
var _local2:uint;
var _local3:uint;
if ((((TheBrainGame.pGame.gameMode == TheBrainGame.NORMALMODE)) || ((TheBrainGame.pGame.gameMode == TheBrainGame.EXPERTMODE)))){
if (pWaves.length > iIndex){
if ((((_arg1 == false)) && (!((pWaves[iIndex].uEndWaveUpgradeIndex == 4294967295))))){
iWaveWaitFrames = 1;
iScreenIndex = pWaves[iIndex].uEndWaveUpgradeIndex;
if (pWaves[iIndex].bBoss == false){
TheBrainGame.pUpgrade.SetLevel(iScreenIndex);
TheBrainGame.pGame.PauseGame(true, true);
} else {
TheBrainGame.pUpgrade.Boss();
TheBrainGame.pGame.PauseGame(true, false);
};
return;
};
_local2 = 0;
while (_local2 < pWaves[iIndex].pGuyIndices.length) {
_local3 = 0;
while (_local3 < pWaves[iIndex].pGuyIndices[_local2][1]) {
CreateNewGuy(pWaves[iIndex].pGuyIndices[_local2][0], 0);
_local3++;
};
_local2++;
};
fCurrentWait = pWaves[iIndex].fLifeTimeInSeconds;
bSwitchOnClear = pWaves[iIndex].bSwitchOverOnClear;
if (((((iIndex - 1) >= 1)) && ((pWaves[(iIndex - 1)].bSwitchBGOnClear == true)))){
TheBrainGame.pBackground.Next();
};
iIndex++;
};
};
}
}
}//package TheBrain
Section 93
//WebStats (TheBrain.WebStats)
package TheBrain {
import flash.events.*;
import flash.net.*;
import flash.xml.*;
public class WebStats {
public static const BEATNORMALSTAT:int = 7;
public static const BEATBOSS2EXPERT:int = 10;
public static const ENDLESSLEADERBOARD:int = 3;
public static const PLAYEDNORMALSTAT:int = 1;
public static const BOSSLEADERBOARD:int = 4;
public static const PLAYEDEXPERTSTAT:int = 2;
public static const BEATBOSS1NORMAL:int = 9;
public static const NORMALLEADERBOARD:int = 1;
public static const BEATBOSS3NORMAL:int = 11;
public static const BEATBOSS1EXPERT:int = 9;
public static const BEATBOSS3EXPERT:int = 11;
public static const BEATBOSS2NORMAL:int = 10;
public static const EXPERTLEADERBOARD:int = 2;
public static const BEATEXPERTSTAT:int = 8;
public static const PLAYEDENDLESSSTAT:int = 3;
public static const PLAYEDBOSSTIMEATTACKSTAT:int = 4;
public static const MADETOBOSSEXPERTSTAT:int = 6;
public static const MADETOBOSSNORMALSTAT:int = 5;
public static var pScoresLoader:URLLoader = null;
public static function GetStats():void{
}
public static function HitStats(_arg1:int):void{
var _local2:URLRequest;
_local2 = new URLRequest(((("http://www.tommunism.com/greymatter/hitstat.php?id=" + _arg1) + "&rand=") + Math.random()));
sendToURL(_local2);
}
public static function SubmitScore(_arg1:int, _arg2:uint):void{
var _local3:SharedObject;
var _local4:URLRequest;
_local3 = SharedObject.getLocal("greymatter_local");
_local4 = new URLRequest(((((((("http://www.tommunism.com/greymatter/submitscore.php?id=" + _arg1) + "&initials=") + _local3.data.strInitials) + "&score=") + _arg2) + "&rand=") + Math.random()));
sendToURL(_local4);
}
public static function GetScores(_arg1:int, _arg2:int, _arg3:int, _arg4:Function, _arg5:int=0):void{
var _local6:URLRequest;
_local6 = new URLRequest(((((((((("http://www.tommunism.com/greymatter/getscores.php?id=" + _arg1) + "&start=") + _arg2) + "&end=") + _arg3) + "&asc=") + _arg5) + "&=rand") + Math.random()));
pScoresLoader = new URLLoader();
pScoresLoader.addEventListener(Event.COMPLETE, _arg4);
pScoresLoader.load(_local6);
}
}
}//package TheBrain
Section 94
//Vector (TheBrain.Vector)
package TheBrain {
import flash.geom.*;
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
}
public function divide(_arg1:Number):Vector{
return (new Vector((x / _arg1), (y / _arg1)));
}
public function multiply(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
public function length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function add(_arg1:Vector):Vector{
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function PerpRH():Vector{
return (new Vector(y, -(x)));
}
public function lengthSq():Number{
return (((x * x) + (y * y)));
}
public function toString():String{
return (new String((((("(" + x) + ", ") + y) + ")")));
}
public function normalize():Vector{
return (divide(length()));
}
public function subtract(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function toPoint():Point{
return (new Point(x, y));
}
public function PerpLH():Vector{
return (new Vector(-(y), x));
}
public static function dot(_arg1:Vector, _arg2:Vector):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function dotAngle(_arg1:Vector, _arg2:Vector):Number{
return (Math.acos(dot(_arg1, _arg2)));
}
public static function PointToVector(_arg1:Point):Vector{
return (new Vector(_arg1.x, _arg1.y));
}
}
}//package TheBrain
Section 95
//WorldObject (TheBrain.WorldObject)
package TheBrain {
import flash.display.*;
public class WorldObject extends MovieClip {
public var vPos:Vector;
public var vNetForce:Vector;
public var vAccumulatedForce:Vector;
public var fDiagonalSQ:Number;// = 0
public var fSpeed:Number;// = 0
public var vVelocity:Vector;
protected var bShouldDestroy:Boolean;// = false
public var fKineticFriction:Number;// = 0.1
public static const fTime = 0.0333333333333333;
public static var vWorldCenter:Vector = null;
public function WorldObject():void{
vPos = new Vector(0, 0);
vVelocity = new Vector(0, 0);
vNetForce = new Vector(0, 0);
vAccumulatedForce = new Vector(0, 0);
fSpeed = 0;
bShouldDestroy = false;
fKineticFriction = 0.1;
fDiagonalSQ = 0;
super();
vPos.x = x;
vPos.y = y;
cacheAsBitmap = false;
}
public function ResetPhysics(_arg1:Number, _arg2:Number):void{
SetPosition(_arg1, _arg2);
vAccumulatedForce = new Vector(0, 0);
}
public function IsObjectCollidingWithObject(_arg1:WorldObject):Boolean{
return (hitTestObject(_arg1));
}
public function AccumulateForce(_arg1:Vector):void{
vAccumulatedForce = vAccumulatedForce.add(_arg1);
}
public function SetPosition(_arg1:Number, _arg2:Number):void{
vPos.x = _arg1;
vPos.y = _arg2;
x = _arg1;
y = _arg2;
}
public function ShouldDestroy():Boolean{
return (bShouldDestroy);
}
public function IsOnScreen():Boolean{
var _local1:int;
var _local2:int;
if (stage == null){
return (false);
};
_local1 = stage.stageWidth;
_local2 = stage.stageHeight;
return ((((((x > 0)) && ((x < stage.stageWidth)))) && ((((y > 0)) && ((y < stage.stageHeight))))));
}
public function Destroy():void{
bShouldDestroy = true;
}
public function Update():void{
if (vWorldCenter == null){
vWorldCenter = new Vector((stage.stageWidth * 0.5), (stage.stageHeight * 0.5));
};
vNetForce = vNetForce.add(vAccumulatedForce);
vNetForce = vNetForce.subtract(vNetForce.multiply(fKineticFriction));
vVelocity = vNetForce.multiply(fTime);
fSpeed = vVelocity.length();
vPos = vPos.add(vVelocity.multiply(fTime));
x = vPos.x;
y = vPos.y;
vAccumulatedForce.x = 0;
vAccumulatedForce.y = 0;
}
}
}//package TheBrain
Section 96
//FUCKINGRETARDED_7 (TheBrain_fla.FUCKINGRETARDED_7)
package TheBrain_fla {
import flash.display.*;
public dynamic class FUCKINGRETARDED_7 extends MovieClip {
public function FUCKINGRETARDED_7(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package TheBrain_fla
Section 97
//leveltext_111 (TheBrain_fla.leveltext_111)
package TheBrain_fla {
import TheBrain.*;
import flash.events.*;
import flash.display.*;
public dynamic class leveltext_111 extends MovieClip {
public var pContinue:SimpleButton;
public var pBackToTitleButton:SimpleButton;
public function leveltext_111(){
addFrameScript(0, frame1, 6, frame7);
}
public function BossContinue(_arg1:Event):void{
TheBrainGame.pGame.PauseGame(false);
}
function frame7(){
pContinue.addEventListener(MouseEvent.CLICK, BossContinue);
}
function frame1(){
pBackToTitleButton.addEventListener(MouseEvent.CLICK, BackToTitleButton);
pContinue.addEventListener(MouseEvent.CLICK, Continue);
}
public function BackToTitleButton(_arg1:Event):void{
TheBrainGame.pGame.ResetGame();
}
public function Continue(_arg1:Event):void{
TheBrainGame.pGame.PauseGame(false);
}
}
}//package TheBrain_fla
Section 98
//MainTimeline (TheBrain_fla.MainTimeline)
package TheBrain_fla {
import TheBrain.*;
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
import flash.xml.*;
import flash.filters.*;
import flash.utils.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MainTimeline extends MovieClip {
public var endlessleaderboard:SimpleButton;
public var pLeaderPos:MovieClip;
public var pPlayButton:SimpleButton;
public var startbutton:SimpleButton;
public var normalleaderboard:SimpleButton;
public var pInitials:TextField;
public var expertmodebutton:SimpleButton;
public var pObj:SharedObject;
public var normalbutton:SimpleButton;
public var bossbutton:SimpleButton;
public var pRandomLoad:MovieClip;
public var pLeaderboard:Leaderboard;
public var iSelectedGameMode:int;
public var expertleaderboard:SimpleButton;
public var endlessbutton:SimpleButton;
public var pPercentage:TextField;
public var pFaker:MovieClip;
public var highscorebutton:SimpleButton;
public var instructionline:MovieClip;
public var pSoundChannel:SoundChannel;
public var startgamebutton:SimpleButton;
public var pAmbientSound:Sound;
public var bossleaderboard:SimpleButton;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 3, frame4, 11, frame12, 183, frame184, 184, frame185, 185, frame186, 186, frame187, 187, frame188, 188, frame189, 189, frame190, 190, frame191, 191, frame192);
}
public function normal_leaderboard(_arg1:Event):void{
MakeClickSound();
gotoAndStop("normalhighscores");
}
public function CalculatePercent(_arg1:ProgressEvent){
var _local2:Number;
_local2 = Math.ceil(((_arg1.bytesLoaded / _arg1.bytesTotal) * 100));
if (pPercentage != null){
pPercentage.text = _local2.toString();
pPercentage.text = (pPercentage.text + "%");
};
if (_local2 >= 100){
gotoAndStop(4);
};
}
public function normal_click(_arg1:MouseEvent):void{
MakeClickSound();
iSelectedGameMode = TheBrainGame.NORMALMODE;
instructionline.visible = true;
instructionline.gotoAndStop(1);
gotoAndStop("showcontrols");
}
public function boss_click(_arg1:MouseEvent):void{
MakeClickSound();
instructionline.visible = true;
instructionline.gotoAndStop(4);
iSelectedGameMode = TheBrainGame.BOSSMODE;
gotoAndStop("showcontrols");
}
function frame12(){
pAmbientSound = new AmbientSound();
pSoundChannel = pAmbientSound.play(0, 99999);
pSoundChannel.soundTransform = new SoundTransform(0.5);
}
function frame184(){
iSelectedGameMode = TheBrainGame.NORMALMODE;
pLeaderboard = null;
stop();
instructionline.visible = false;
startbutton.addEventListener(MouseEvent.CLICK, startbutton_click);
highscorebutton.addEventListener(MouseEvent.CLICK, highscores_click);
}
function frame186(){
stop();
startgamebutton.addEventListener(MouseEvent.CLICK, start_game_click);
}
function frame187(){
normalleaderboard.addEventListener(MouseEvent.CLICK, normal_leaderboard);
expertleaderboard.addEventListener(MouseEvent.CLICK, expert_leaderboard);
endlessleaderboard.addEventListener(MouseEvent.CLICK, endless_leaderboard);
bossleaderboard.addEventListener(MouseEvent.CLICK, boss_leaderboard);
}
function frame188(){
CreateLeaderboard(1);
}
function frame2(){
loaderInfo.addEventListener(ProgressEvent.PROGRESS, CalculatePercent);
pRandomLoad.gotoAndStop((Math.round((Math.random() * 3)) + 1));
stop();
}
function frame185(){
stop();
determineUnlockables();
}
function frame4(){
pPlayButton.addEventListener(MouseEvent.CLICK, PlayGame);
pObj = SharedObject.getLocal("greymatter_local");
if (pInitials != null){
pInitials.text = pObj.data.strInitials;
};
}
function frame189(){
CreateLeaderboard(2);
}
function frame190(){
CreateLeaderboard(3);
}
function frame1(){
NewgroundsAPI.linkAPI(this);
NewgroundsAPI.connectMovie(3753);
gotoAndStop(2);
}
function frame191(){
CreateLeaderboard(4);
}
public function endless_click(_arg1:MouseEvent):void{
MakeClickSound();
iSelectedGameMode = TheBrainGame.ENDLESSMODE;
instructionline.visible = true;
instructionline.gotoAndStop(3);
gotoAndStop("showcontrols");
}
public function highscores_click(_arg1:MouseEvent):void{
instructionline.visible = false;
MakeClickSound();
gotoAndStop("highscoremenu");
}
function frame192(){
if (pSoundChannel != null){
pSoundChannel.stop();
pSoundChannel = null;
};
trace("STARTING THE GAME");
new TheBrainGame(iSelectedGameMode);
stage.addChild(TheBrainGame.pGame);
TheBrainGame.pGame.Initialize();
TheBrainGame.pGame.pTimelineMC = pFaker;
stop();
}
public function MakeLocked(_arg1:SimpleButton):void{
_arg1.transform.colorTransform = new ColorTransform(1, 1, 1, 0.5);
}
public function endless_leaderboard(_arg1:Event):void{
MakeClickSound();
gotoAndStop("endlesshighscores");
}
public function lockedclick(_arg1:Event):void{
trace("locked");
}
public function CreateLeaderboard(_arg1:int):void{
if (pLeaderboard != null){
removeChild(pLeaderboard);
};
if (_arg1 == 4){
pLeaderboard = new BossLeaderboard();
} else {
pLeaderboard = new Leaderboard();
};
pLeaderboard.Load(_arg1);
pLeaderboard.x = pLeaderPos.x;
pLeaderboard.y = pLeaderPos.y;
addChild(pLeaderboard);
}
public function expert_leaderboard(_arg1:Event):void{
MakeClickSound();
gotoAndStop("experthighscores");
}
public function start_game_click(_arg1:MouseEvent):void{
MakeClickSound();
gotoAndPlay("begingame");
}
public function MakeClickSound():void{
var _local1:Sound;
_local1 = new ClickSound();
_local1.play(1);
}
public function MakeUnlocked(_arg1:SimpleButton):void{
_arg1.transform.colorTransform = new ColorTransform(1, 1, 1, 1);
}
public function expert_click(_arg1:MouseEvent):void{
MakeClickSound();
iSelectedGameMode = TheBrainGame.EXPERTMODE;
instructionline.visible = true;
instructionline.gotoAndStop(2);
gotoAndStop("showcontrols");
}
public function determineUnlockables():void{
var _local1:SharedObject;
normalbutton.addEventListener(MouseEvent.CLICK, normal_click);
_local1 = SharedObject.getLocal("greymatter_local");
if (_local1.data.bExpertUnlocked == true){
MakeUnlocked(expertmodebutton);
expertmodebutton.addEventListener(MouseEvent.CLICK, expert_click);
} else {
MakeLocked(expertmodebutton);
expertmodebutton.addEventListener(MouseEvent.CLICK, lockedclick);
};
if (_local1.data.bEndlessUnlocked == true){
MakeUnlocked(endlessbutton);
endlessbutton.addEventListener(MouseEvent.CLICK, endless_click);
} else {
MakeLocked(endlessbutton);
endlessbutton.addEventListener(MouseEvent.CLICK, lockedclick);
};
if (_local1.data.bBossUnlocked == true){
MakeUnlocked(bossbutton);
bossbutton.addEventListener(MouseEvent.CLICK, boss_click);
} else {
MakeLocked(bossbutton);
bossbutton.addEventListener(MouseEvent.CLICK, lockedclick);
};
}
public function PlayGame(_arg1:Event):void{
var _local2:SharedObject;
_local2 = SharedObject.getLocal("greymatter_local");
if (pInitials != null){
_local2.data.strInitials = pInitials.text;
};
gotoAndPlay("introstart");
}
public function startbutton_click(_arg1:MouseEvent):void{
MakeClickSound();
instructionline.visible = false;
if (pLeaderboard != null){
removeChild(pLeaderboard);
pLeaderboard = null;
};
gotoAndStop("gameselect");
}
public function boss_leaderboard(_arg1:Event):void{
MakeClickSound();
gotoAndStop("bosshighscores");
}
}
}//package TheBrain_fla
Section 99
//menufade_69 (TheBrain_fla.menufade_69)
package TheBrain_fla {
import flash.display.*;
public dynamic class menufade_69 extends MovieClip {
public function menufade_69(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package TheBrain_fla
Section 100
//NG_AD_OBJECT_3 (TheBrain_fla.NG_AD_OBJECT_3)
package TheBrain_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
import flash.xml.*;
import flash.filters.*;
import flash.utils.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class NG_AD_OBJECT_3 extends MovieClip {
public var ng_ad:MovieClip;
public var NG_Button:SimpleButton;
public function NG_AD_OBJECT_3(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
public function startAd(_arg1){
var _local2:URLLoader;
_local2 = new URLLoader(new URLRequest(_arg1));
_local2.addEventListener(Event.COMPLETE, ad_Loaded);
}
function frame1(){
Security.allowDomain("70.87.128.99");
Security.allowInsecureDomain("70.87.128.99");
Security.allowDomain("ads.shizmoo.com");
Security.allowInsecureDomain("ads.shizmoo.com");
Security.allowDomain("www.cpmstar.com");
Security.allowInsecureDomain("www.cpmstar.com");
Security.allowDomain("server.cpmstar.com");
Security.allowInsecureDomain("server.cpmstar.com");
if (NewgroundsAPI.getAdURL()){
startAd(NewgroundsAPI.getAdURL());
};
NewgroundsAPI.addEventListener(NewgroundsAPI.ADS_APPROVED, startAd);
NG_Button.addEventListener(MouseEvent.CLICK, loadNGSite);
stop();
}
public function ad_Loaded(_arg1:Event){
var _local2:*;
var _local3:Loader;
_local2 = String(_arg1.target.data);
_local3 = new Loader();
_local3.load(new URLRequest(_local2));
ng_ad.addChild(_local3);
}
}
}//package TheBrain_fla
Section 101
//NG_TANK_01_67 (TheBrain_fla.NG_TANK_01_67)
package TheBrain_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NG_TANK_01_67 extends MovieClip {
public var pNGButton:SimpleButton;
public function NG_TANK_01_67(){
addFrameScript(0, frame1);
}
function frame1(){
pNGButton.addEventListener(MouseEvent.CLICK, function (_arg1:Event){
NewgroundsAPI.loadNewgrounds();
});
}
}
}//package TheBrain_fla
Section 102
//NG_TANK_5 (TheBrain_fla.NG_TANK_5)
package TheBrain_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NG_TANK_5 extends MovieClip {
public var NG_Logo:SimpleButton;
public function NG_TANK_5(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
function frame1(){
NG_Logo.addEventListener(MouseEvent.CLICK, loadNGSite);
}
}
}//package TheBrain_fla
Section 103
//upgradepanel_105 (TheBrain_fla.upgradepanel_105)
package TheBrain_fla {
import TheBrain.*;
import flash.display.*;
import flash.text.*;
public dynamic class upgradepanel_105 extends MovieClip {
public var pBoostButton:UpgradeButton;
public var pBoostDisplay:MovieClip;
public var pShieldCost:TextField;
public var pOneUpDisplay:MovieClip;
public var pBoostCost:TextField;
public var pOptionCost:TextField;
public var pShieldDisplay:MovieClip;
public var pOptionButton:UpgradeButton;
public var pShieldButton:UpgradeButton;
public var pOneUpCost:TextField;
public var pOneUpButton:UpgradeButton;
public var pOptionDisplay:MovieClip;
}
}//package TheBrain_fla
Section 104
//AmbientSound (AmbientSound)
package {
import flash.media.*;
public dynamic class AmbientSound extends Sound {
}
}//package
Section 105
//BackgroundMusic (BackgroundMusic)
package {
import flash.media.*;
public dynamic class BackgroundMusic extends Sound {
}
}//package
Section 106
//BossMusic (BossMusic)
package {
import flash.media.*;
public dynamic class BossMusic extends Sound {
}
}//package
Section 107
//ClickSound (ClickSound)
package {
import flash.media.*;
public dynamic class ClickSound extends Sound {
}
}//package
Section 108
//LeaderLoader (LeaderLoader)
package {
import flash.display.*;
public dynamic class LeaderLoader extends MovieClip {
}
}//package
Section 109
//NewgroundsAPI (NewgroundsAPI)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public class NewgroundsAPI {
public static const ADS_APPROVED:Number = 3;
public static const bridge:Sprite = new Sprite();
private static const STAT_NEW_VERSION:Number = 4;
private static const STAT_AUTHOR_SITE:Number = 2;
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway.php";
private static const NEWGROUNDS_URL:String = "http://www.newgrounds.com";
private static const STAT_CUSTOM_STATS:Number = 50;
private static const STAT_MOVIE_VIEWS:Number = 1;
private static const STAT_NEWGROUNDS:Number = 3;
public static const NEW_VERSION:Number = 2;
public static const DENY_HOST:Number = 1;
private static var tracker_id:Number;
private static var movie_options:Object = new Object();
private static var connected:Boolean;
private static var custom_events:Object = new Object();
private static var host:String;
private static var linked:Boolean;
private static var events:Object = new Object();
private static var debug:Boolean;
private static var version:String;
private static var custom_links:Object = new Object();
public static function getNewVersionURL(){
return (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + STAT_NEW_VERSION));
}
private static function ReadGatewayData(_arg1:Object){
var _local2:*;
var _local3:String;
var _local4:*;
var _local5:URLLoader;
for (_local2 in _arg1) {
_arg1[_local2] = unescape(_arg1[_local2]);
movie_options[_local2] = _arg1[_local2];
};
if (_arg1["settings_loaded"]){
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage((("Movie Identified as '" + movie_options["movie_name"]) + "'"));
if (movie_options["message"]){
SendMessage(movie_options["message"]);
};
if (movie_options["ad_url"]){
SendMessage("Your movie has been approved to run Flash Ads");
if (events[ADS_APPROVED]){
var _local6 = events;
_local6[ADS_APPROVED](movie_options["ad_url"]);
} else {
onAdsApproved(movie_options["ad_url"]);
};
};
if (((movie_options["movie_version"]) && (!((String(movie_options["movie_version"]) == String(version)))))){
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
if (events[NEW_VERSION]){
_local6 = events;
_local6[NEW_VERSION]({version:movie_options["movie_version"], real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onNewVersionAvailable(movie_options["movie_version"], getMovieURL(), getNewVersionURL());
};
};
if (movie_options["deny_host"]){
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
if (events[DENY_HOST]){
_local6 = events;
_local6[DENY_HOST]({host:host, real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onDenyHost(host, getMovieURL(), getNewVersionURL());
};
};
if (movie_options["request_portal_url"]){
_local3 = bridge.root.loaderInfo.url;
_local4 = ((((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_local3));
_local5 = new URLLoader(new URLRequest(_local4));
};
if (events[69]){
_local6 = events;
_local6[69]();
};
} else {
if (!movie_options["settings_loaded"]){
SendError("Could not establish connection to the API gateway.");
};
};
}
public static function setMovieVersion(_arg1){
if (!_arg1){
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = String(_arg1);
};
}
public static function loadCustomLink(_arg1:String){
if (!_arg1){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else {
if (!custom_links[_arg1]){
SendError(("Attempted to open undefined custom link: " + _arg1));
} else {
SendLink(custom_links[_arg1]);
};
};
}
public static function addCustomLink(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(((("Created custom link " + _arg1) + ": ") + _arg2));
};
};
}
public static function getMovieURL(){
if (movie_options["movie_url"]){
return (movie_options["movie_url"]);
};
return ("Newgrounds.com");
}
public static function debugMode(){
debug = true;
}
public static function getAdURL(){
return (movie_options["ad_url"]);
}
private static function SendStat(_arg1:Number, _arg2:Boolean, _arg3=null){
var target_url:*;
var XML_Loaded:Function;
var x:*;
var request:URLRequest;
var gateway_loader:URLLoader;
var stat_id = _arg1;
var open_in_browser = _arg2;
var extra = _arg3;
if (!tracker_id){
SendError("You must call NewgroundsAPI.connectMovie() with a valid movie id before using API features!");
} else {
XML_Loaded = function (_arg1:Event){
var _local2:XML;
var _local3:Object;
var _local4:XMLList;
var _local5:XML;
var _local6:*;
var _local7:*;
XML.ignoreWhitespace = true;
_local2 = XML(_arg1.target.data);
_local3 = new Object();
_local4 = _local2.children();
for each (_local5 in _local4) {
_local6 = _local5.localName();
_local7 = _local5.attribute("value");
if (_local7 == Number(_local7)){
_local7 = Number(_local7);
};
_local3[_local6] = _local7;
};
ReadGatewayData(_local3);
};
target_url = (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id) + addSeed());
if (extra){
for (x in extra) {
target_url = (target_url + ((("&" + escape(x)) + "=") + escape(extra[x])));
};
};
if (debug){
target_url = (target_url + "&debug=1");
};
if (open_in_browser){
request = new URLRequest((target_url + addSeed()));
navigateToURL(request, "_blank");
} else {
gateway_loader = new URLLoader(new URLRequest((target_url + addSeed())));
gateway_loader.addEventListener(Event.COMPLETE, XML_Loaded);
};
};
}
public static function onAdsApproved(_arg1:String){
}
public static function loadMySite(_arg1:Event=null){
SendLink(STAT_AUTHOR_SITE);
}
private static function SendMessage(_arg1:String){
trace(("[NEWGROUNDS API] :: " + _arg1));
}
public static function linkAPI(_arg1){
_arg1.addChild(bridge);
linked = true;
}
public static function loadNewgrounds(_arg1:Event=null, _arg2:String=null){
var _local3:URLRequest;
var _local4:*;
if (!tracker_id){
_local3 = new URLRequest(((NEWGROUNDS_URL + "/") + _arg2));
navigateToURL(_local3, "_blank");
} else {
_local4 = null;
if (_arg2){
_local4 = new Object();
_local4.page = _arg2;
};
SendLink(STAT_NEWGROUNDS, _local4);
};
}
private static function SendLink(_arg1, _arg2=null){
SendStat(_arg1, true, _arg2);
}
public static function logCustomEvent(_arg1:String){
if (!_arg1){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else {
if (!custom_events[_arg1]){
SendError(("Attempted to log undefined custom event: " + _arg1));
} else {
SendEvent(custom_events[_arg1]);
};
};
}
private static function SendError(_arg1:String){
trace(("[NEWGROUNDS API ERROR] :: " + _arg1));
}
public static function addCustomEvent(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(("Created custom event: " + _arg2));
};
};
}
private static function addSeed(){
return (("&seed=" + Math.random()));
}
public static function addEventListener(_arg1:Number, _arg2:Function){
events[_arg1] = _arg2;
}
private static function SendEvent(_arg1){
SendStat(_arg1, false);
}
public static function onNewVersionAvailable(_arg1:String, _arg2:String, _arg3:String){
var sw:*;
var sh:*;
var tw:*;
var th:*;
var mg:*;
var _root:*;
var overlay:MovieClip;
var overlay_x:*;
var overlay_y:*;
var close_x:*;
var blankarea:TextField;
var header:TextField;
var header_format:TextFormat;
var msgtext:TextField;
var msgtext_format:TextFormat;
var msgtext_link:TextFormat;
var version = _arg1;
var movie_url = _arg2;
var redirect_url = _arg3;
sw = bridge.stage.stageWidth;
sh = bridge.stage.stageHeight;
tw = 350;
th = 160;
mg = 20;
_root = bridge.root;
overlay = new MovieClip();
overlay.graphics.beginFill(0, 0.6);
overlay.graphics.lineStyle(0, 0);
overlay.graphics.drawRect(0, 0, sw, sh);
overlay.graphics.endFill();
overlay_x = Math.round(((sw - tw) / 2));
overlay_y = Math.round(((sh - th) / 2));
overlay.graphics.beginFill(102);
overlay.graphics.lineStyle(10, 0);
overlay.graphics.drawRect((overlay_x - mg), (overlay_y - mg), (tw + mg), (th + mg));
overlay.graphics.endFill();
overlay.close = function (_arg1:Event){
_root.removeChild(overlay);
};
close_x = new MovieClip();
close_x.graphics.beginFill(0, 0.1);
close_x.graphics.lineStyle(3, 22015);
close_x.graphics.drawRect(0, 0, 16, 16);
close_x.graphics.endFill();
close_x.graphics.moveTo(4, 4);
close_x.graphics.lineTo(13, 13);
close_x.graphics.moveTo(13, 4);
close_x.graphics.lineTo(4, 13);
close_x.x = ((overlay_x + tw) - 26);
close_x.y = (overlay_y - 10);
close_x.addEventListener(MouseEvent.CLICK, overlay.close);
blankarea = new TextField();
blankarea.x = (overlay_x - mg);
blankarea.y = (overlay_y - mg);
blankarea.width = (tw + mg);
blankarea.height = (th + mg);
blankarea.selectable = false;
header = new TextField();
header.width = tw;
header.x = overlay_x;
header.y = overlay_y;
header.height = 100;
header.selectable = false;
header_format = new TextFormat();
header_format.font = "Arial Black";
header_format.color = 0xFFFFFF;
header_format.size = 20;
header.defaultTextFormat = header_format;
header.text = "New Version Available!";
msgtext = new TextField();
msgtext.x = overlay_x;
msgtext.y = (overlay_y + 70);
msgtext.width = tw;
msgtext.height = 60;
msgtext.selectable = false;
msgtext_format = new TextFormat();
msgtext_format.font = "Arial";
msgtext_format.color = 0xFFFFFF;
msgtext_format.size = 12;
msgtext_format.bold = true;
msgtext_link = new TextFormat();
msgtext_link.font = "Arial";
msgtext_link.color = 0xFFFF00;
msgtext_link.size = 12;
msgtext_link.bold = true;
msgtext_link.url = redirect_url;
msgtext_link.target = "_blank";
if (version){
version = ("Version " + version);
} else {
version = "A new version";
};
msgtext.defaultTextFormat = msgtext_format;
msgtext.appendText((version + " is now available"));
if (movie_url){
msgtext.appendText(" at:\n");
msgtext.defaultTextFormat = msgtext_link;
msgtext.appendText(movie_url);
} else {
msgtext.appendText("!");
};
_root.addChild(overlay);
overlay.addChild(blankarea);
overlay.addChild(header);
overlay.addChild(msgtext);
overlay.addChild(close_x);
}
public static function onDenyHost(_arg1:String, _arg2:String, _arg3:String){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:MovieClip;
var _local10:TextField;
var _local11:TextField;
var _local12:TextFormat;
var _local13:TextField;
var _local14:TextFormat;
var _local15:TextFormat;
_local4 = bridge.stage.stageWidth;
_local5 = bridge.stage.stageHeight;
_local6 = 350;
_local7 = 160;
_local8 = bridge.root;
_local9 = new MovieClip();
_local9.graphics.beginFill(0x660000);
_local9.graphics.lineStyle(20, 0);
_local9.graphics.drawRect(0, 0, _local4, _local5);
_local9.graphics.endFill();
_local10 = new TextField();
_local10.x = 0;
_local10.y = 0;
_local10.width = _local4;
_local10.height = _local5;
_local10.selectable = false;
_local11 = new TextField();
_local11.x = Math.round(((_local4 - _local6) / 2));
_local11.y = Math.round(((_local5 - _local7) / 2.5));
_local11.width = _local6;
_local11.height = 100;
_local11.selectable = false;
_local12 = new TextFormat();
_local12.font = "Arial Black";
_local12.color = 0xFF0000;
_local12.size = 38;
_local11.defaultTextFormat = _local12;
_local11.text = "ERROR!";
_local13 = new TextField();
_local13.x = Math.round(((_local4 - _local6) / 2));
_local13.y = (Math.round(((_local5 - _local7) / 2.5)) + 80);
_local13.width = _local6;
_local13.height = 80;
_local13.selectable = false;
_local14 = new TextFormat();
_local14.font = "Arial";
_local14.color = 0xFFFFFF;
_local14.size = 12;
_local14.bold = true;
_local15 = new TextFormat();
_local15.font = "Arial";
_local15.color = 0xFFFF00;
_local15.size = 12;
_local15.bold = true;
_local15.url = _arg3;
_local15.target = "_blank";
_local13.defaultTextFormat = _local14;
_local13.appendText((("This movie has not been approved for use on " + _arg1) + "\n"));
_local13.appendText("For an approved copy, please visit:\n");
_local13.defaultTextFormat = _local15;
_local13.appendText(_arg2);
_local8.addChild(_local9);
_local9.addChild(_local10);
_local9.addChild(_local11);
_local9.addChild(_local13);
}
public static function connectMovie(_arg1:Number){
var _local2:String;
var _local3:*;
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else {
if (!linked){
SendError("Attempted to call MewgroundsAPI.connectMovie() without first calling NewgroundsAPI.linkAPI(this)");
} else {
if (!tracker_id){
SendMessage("Connecting to API gateway...");
tracker_id = _arg1;
_local2 = bridge.root.loaderInfo.url;
host = _local2.split("/")[2].toLowerCase();
if (host.length < 1){
host = "localhost";
};
_local3 = new Object();
SendEvent(STAT_MOVIE_VIEWS);
};
};
};
}
public static function isInstalled(){
return (true);
}
}
}//package
Section 110
//NextButton (NextButton)
package {
import flash.display.*;
public dynamic class NextButton extends SimpleButton {
}
}//package
Section 111
//PrevButton (PrevButton)
package {
import flash.display.*;
public dynamic class PrevButton extends SimpleButton {
}
}//package
Section 112
//SmallLaserSound (SmallLaserSound)
package {
import flash.media.*;
public dynamic class SmallLaserSound extends Sound {
}
}//package
Section 113
//UnlockScreen (UnlockScreen)
package {
import TheBrain.*;
import flash.display.*;
import flash.text.*;
public dynamic class UnlockScreen extends MovieClip {
public var strUnlockName:String;
public var pModeName:TextField;
public function UnlockScreen(){
addFrameScript(0, frame1, 2, frame3, 3, frame4, 91, frame92);
}
function frame3(){
pModeName.text = strUnlockName;
pModeName.visible = false;
}
function frame1(){
stop();
}
function frame4(){
pModeName.visible = true;
pModeName.text = strUnlockName;
}
function frame92(){
TheBrainGame.pGame.ResetGame();
}
}
}//package
Section 114
//UpgradeSound (UpgradeSound)
package {
import flash.media.*;
public dynamic class UpgradeSound extends Sound {
}
}//package